@sankhyalabs/ezui 1.1.159 → 1.1.160
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-combo-box.cjs.entry.js +62 -27
- package/dist/cjs/ez-date-input.cjs.entry.js +71 -25
- package/dist/cjs/ez-date-time-input.cjs.entry.js +94 -31
- package/dist/cjs/ez-filter-input.cjs.entry.js +10 -4
- package/dist/cjs/ez-form.cjs.entry.js +54 -9
- package/dist/cjs/ez-grid.cjs.entry.js +9 -6
- package/dist/cjs/ez-number-input.cjs.entry.js +69 -25
- package/dist/cjs/ez-search.cjs.entry.js +20 -5
- package/dist/cjs/ez-text-area.cjs.entry.js +8 -2
- package/dist/cjs/ez-text-input.cjs.entry.js +30 -21
- package/dist/cjs/ez-time-input.cjs.entry.js +75 -40
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +81 -28
- package/dist/collection/components/ez-date-input/ez-date-input.js +87 -25
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +108 -31
- package/dist/collection/components/ez-filter-input/ez-filter-input.js +26 -4
- package/dist/collection/components/ez-form/DataBinder.js +12 -3
- package/dist/collection/components/ez-form/ez-form.js +43 -6
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
- package/dist/collection/components/ez-grid/ez-grid.js +14 -7
- package/dist/collection/components/ez-number-input/ez-number-input.js +83 -25
- package/dist/collection/components/ez-search/ez-search.js +38 -5
- package/dist/collection/components/ez-text-area/ez-text-area.css +1 -1
- package/dist/collection/components/ez-text-area/ez-text-area.js +23 -1
- package/dist/collection/components/ez-text-input/ez-text-input.css +1 -1
- package/dist/collection/components/ez-text-input/ez-text-input.js +45 -38
- package/dist/collection/components/ez-time-input/ez-time-input.js +95 -59
- package/dist/custom-elements/index.js +504 -197
- package/dist/esm/ez-combo-box.entry.js +62 -27
- package/dist/esm/ez-date-input.entry.js +71 -25
- package/dist/esm/ez-date-time-input.entry.js +94 -31
- package/dist/esm/ez-filter-input.entry.js +10 -4
- package/dist/esm/ez-form.entry.js +54 -9
- package/dist/esm/ez-grid.entry.js +9 -6
- package/dist/esm/ez-number-input.entry.js +69 -25
- package/dist/esm/ez-search.entry.js +20 -5
- package/dist/esm/ez-text-area.entry.js +8 -2
- package/dist/esm/ez-text-input.entry.js +30 -21
- package/dist/esm/ez-time-input.entry.js +76 -41
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-003d53b1.entry.js +1 -0
- package/dist/ezui/p-267fa515.entry.js +1 -0
- package/dist/ezui/p-2acf7d59.entry.js +1 -0
- package/dist/ezui/p-403de0a4.entry.js +1 -0
- package/dist/ezui/p-4c3d136c.entry.js +1 -0
- package/dist/ezui/p-53bbba8e.entry.js +1 -0
- package/dist/ezui/p-6668c3b0.entry.js +1 -0
- package/dist/ezui/p-7fd6deec.entry.js +1 -0
- package/dist/ezui/p-ad6cc559.entry.js +1 -0
- package/dist/ezui/{p-be87ac5e.entry.js → p-ae2fea4c.entry.js} +1 -1
- package/dist/ezui/p-ff7b4b13.entry.js +1 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +13 -7
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +10 -3
- package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +15 -7
- package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +5 -1
- package/dist/types/components/ez-form/DataBinder.d.ts +1 -1
- package/dist/types/components/ez-form/ez-form.d.ts +1 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +4 -1
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +14 -5
- package/dist/types/components/ez-search/ez-search.d.ts +6 -1
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +7 -6
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +17 -13
- package/dist/types/components.d.ts +43 -20
- package/package.json +1 -1
- package/dist/ezui/p-1859a3d8.entry.js +0 -1
- package/dist/ezui/p-49fdfa4b.entry.js +0 -1
- package/dist/ezui/p-4fdceb7d.entry.js +0 -1
- package/dist/ezui/p-6d4b1628.entry.js +0 -1
- package/dist/ezui/p-8f4fac31.entry.js +0 -1
- package/dist/ezui/p-91377c65.entry.js +0 -1
- package/dist/ezui/p-b524dfca.entry.js +0 -1
- package/dist/ezui/p-bc8aa27f.entry.js +0 -1
- package/dist/ezui/p-ec21ecce.entry.js +0 -1
- package/dist/ezui/p-fc9b9487.entry.js +0 -1
|
@@ -635,7 +635,7 @@ class DataBinder {
|
|
|
635
635
|
case core.Action.NEXT_SELECTED:
|
|
636
636
|
case core.Action.PREVIOUS_SELECTED:
|
|
637
637
|
(_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
|
|
638
|
-
this.updateValue(field.fieldName, field.field);
|
|
638
|
+
this.updateValue(field.fieldName, field.field, action.type === core.Action.EDITION_CANCELED);
|
|
639
639
|
});
|
|
640
640
|
break;
|
|
641
641
|
}
|
|
@@ -653,15 +653,24 @@ class DataBinder {
|
|
|
653
653
|
onDisconnectedCallback() {
|
|
654
654
|
this._dataUnit.unsubscribe(this.onDataUnitEvent);
|
|
655
655
|
}
|
|
656
|
-
updateValue(fieldName, field) {
|
|
656
|
+
updateValue(fieldName, field, actionCanceled = false) {
|
|
657
|
+
var _a;
|
|
657
658
|
field["value"] = this._dataUnit.getFieldValue(fieldName);
|
|
659
|
+
/**
|
|
660
|
+
* FIXME: Campo já salvo com undefined, ao inserir valor inválido e cancelar,
|
|
661
|
+
* o campo não é limpo e atualizado automaticamente, pois o value não mudou,
|
|
662
|
+
* assim, não dispara o Watch do value, que é o responsável por limpar o errorMessage.
|
|
663
|
+
*/
|
|
664
|
+
if (actionCanceled && ((_a = field["errorMessage"]) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
665
|
+
field["errorMessage"] = "";
|
|
666
|
+
}
|
|
658
667
|
}
|
|
659
668
|
updateBind(fieldName, field) {
|
|
660
669
|
const oldBind = this._fields.get(fieldName);
|
|
661
670
|
if (oldBind) {
|
|
662
671
|
oldBind.destroy();
|
|
663
672
|
}
|
|
664
|
-
|
|
673
|
+
this.updateValue(fieldName, field);
|
|
665
674
|
this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
|
|
666
675
|
this.bindSearchOptionsLoader(fieldName, field);
|
|
667
676
|
this.applyEzUploadContext(fieldName, field);
|
|
@@ -792,25 +801,58 @@ let EzForm = class {
|
|
|
792
801
|
return Promise.resolve();
|
|
793
802
|
}
|
|
794
803
|
validate() {
|
|
795
|
-
return new Promise((accept, reject) => {
|
|
804
|
+
return new Promise(async (accept, reject) => {
|
|
796
805
|
const metadata = selectFormMetadata(this._store.getState());
|
|
797
806
|
const requiredFields = this._staticFields
|
|
798
807
|
.filter(f => f.dataset.required)
|
|
799
808
|
.map(f => f.dataset.fieldName)
|
|
800
809
|
.concat(metadata.getRequiredFields());
|
|
810
|
+
let isReject = false;
|
|
801
811
|
const records = this.dataUnit.getModifiedRecords();
|
|
802
812
|
for (let i = 0; i < records.length; i++) {
|
|
803
813
|
if (!this.validateRequired(requiredFields, records[i])) {
|
|
804
|
-
|
|
814
|
+
isReject = true;
|
|
805
815
|
break;
|
|
806
816
|
}
|
|
807
817
|
}
|
|
808
|
-
|
|
818
|
+
if (!isReject) {
|
|
819
|
+
const validateError = await this.validateError();
|
|
820
|
+
if (!validateError) {
|
|
821
|
+
isReject = true;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
if (isReject) {
|
|
825
|
+
reject();
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
accept();
|
|
829
|
+
}
|
|
809
830
|
});
|
|
810
831
|
}
|
|
811
832
|
observeConfig() {
|
|
812
833
|
this.processMetadata();
|
|
813
834
|
}
|
|
835
|
+
async validateError() {
|
|
836
|
+
var _a;
|
|
837
|
+
const invalidFields = [];
|
|
838
|
+
const dataFields = (_a = this._element) === null || _a === void 0 ? void 0 : _a.querySelectorAll("[data-field-name]");
|
|
839
|
+
if (dataFields && dataFields.length > 0) {
|
|
840
|
+
for (let i = 0; i < dataFields.length; i++) {
|
|
841
|
+
const fieldElem = dataFields[i];
|
|
842
|
+
if (fieldElem && fieldElem['isInvalid']) {
|
|
843
|
+
const hasError = await fieldElem['isInvalid']();
|
|
844
|
+
if (hasError && fieldElem['dataset']) {
|
|
845
|
+
invalidFields.push(fieldElem['dataset'].fieldName);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
const isValid = invalidFields.length === 0;
|
|
851
|
+
if (!isValid) {
|
|
852
|
+
ApplicationUtils.ApplicationUtils.info("Há pelo menos um campo com conteúdo inválido.");
|
|
853
|
+
}
|
|
854
|
+
return isValid;
|
|
855
|
+
}
|
|
814
856
|
validateRequired(requiredFields, record) {
|
|
815
857
|
const invalidFields = [];
|
|
816
858
|
requiredFields.forEach(field => {
|
|
@@ -823,13 +865,16 @@ let EzForm = class {
|
|
|
823
865
|
* na aba, isso será tratado no card: https://sankhya.atlassian.net/browse/SKA-44182
|
|
824
866
|
*/
|
|
825
867
|
if (fieldElem) {
|
|
868
|
+
/**
|
|
869
|
+
* Devido o StencilJS não possuir Getter e Setter, para casos que o Watch não for chamado,
|
|
870
|
+
* é necessário limpar a propriedade antes de setar o valor novamente, para que o Watch seja disparado novamente,
|
|
871
|
+
* solução necessária para controlar componentes com herança (Exemplo: EzSearch -> EzComboBox -> EzTextInput).
|
|
872
|
+
*/
|
|
873
|
+
fieldElem["errorMessage"] = "";
|
|
826
874
|
if (value === null || value === undefined || value === "") {
|
|
827
875
|
invalidFields.push(field);
|
|
828
876
|
fieldElem["errorMessage"] = "Essa informação é obrigatória";
|
|
829
877
|
}
|
|
830
|
-
else {
|
|
831
|
-
fieldElem["errorMessage"] = "";
|
|
832
|
-
}
|
|
833
878
|
}
|
|
834
879
|
});
|
|
835
880
|
const isValid = invalidFields.length === 0;
|
|
@@ -110285,7 +110285,7 @@ class AgGridController {
|
|
|
110285
110285
|
throw new Error("Erro interno: Grid ainda não inicializado.");
|
|
110286
110286
|
}
|
|
110287
110287
|
const colDef = this._gridOptions.columnApi.getAllColumns();
|
|
110288
|
-
return colDef.map(c => {
|
|
110288
|
+
return colDef.filter(c => c.getColId() !== "checkBoxColumn").map(c => {
|
|
110289
110289
|
const def = c.getColDef();
|
|
110290
110290
|
const colDef = { name: def.field, label: def.headerName };
|
|
110291
110291
|
this.conditionalSet(colDef, "sortable", def.sortable);
|
|
@@ -110781,6 +110781,14 @@ let EzGrid = class {
|
|
|
110781
110781
|
async hasPreviousRecord() {
|
|
110782
110782
|
return Promise.resolve(this._gridController.hasPreviousRecord());
|
|
110783
110783
|
}
|
|
110784
|
+
/**
|
|
110785
|
+
* Método para abrir a configuração da grid.
|
|
110786
|
+
*/
|
|
110787
|
+
async openGridConfig() {
|
|
110788
|
+
this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
|
|
110789
|
+
this._gridConfig.selectedTab = "Colunas";
|
|
110790
|
+
this._popUpGridConfig = true;
|
|
110791
|
+
}
|
|
110784
110792
|
componentWillLoad() {
|
|
110785
110793
|
if (this.dataUnit) {
|
|
110786
110794
|
this._dataUnitBridge = new DataUnitBridge(this._gridController, this.dataUnit);
|
|
@@ -110898,11 +110906,6 @@ let EzGrid = class {
|
|
|
110898
110906
|
closeGridConfig() {
|
|
110899
110907
|
this._popUpGridConfig = false;
|
|
110900
110908
|
}
|
|
110901
|
-
openGridConfig() {
|
|
110902
|
-
this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
|
|
110903
|
-
this._gridConfig.selectedTab = "Colunas";
|
|
110904
|
-
this._popUpGridConfig = true;
|
|
110905
|
-
}
|
|
110906
110909
|
render() {
|
|
110907
110910
|
return (index.h(index.Host, null, index.h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, index.h("div", { class: "grid-header__container" }, index.h("slot", { name: "leftButtons" })), index.h("div", { class: "grid-header__container" }, this.getPaginationControl())), index.h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), index.h("div", { class: "grid__footer" }), index.h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, index.h("grid-config", { ref: ref => this._gridConfig = ref, config: this.config, selectedTab: "Colunas", onConfigFinish: evt => { this.observeConfig(evt.detail); this.configChange.emit(evt.detail); }, onConfigCancel: _evt => this.closeGridConfig() }))));
|
|
110908
110911
|
}
|
|
@@ -14,6 +14,7 @@ let EzNumberInput = class {
|
|
|
14
14
|
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
15
15
|
this.ezStartChange = index.createEvent(this, "ezStartChange", 7);
|
|
16
16
|
this.ezCancelWaitingChange = index.createEvent(this, "ezCancelWaitingChange", 7);
|
|
17
|
+
this._focused = false;
|
|
17
18
|
/**
|
|
18
19
|
* Deixa o campo disponível ou não para uso.
|
|
19
20
|
*/
|
|
@@ -35,66 +36,109 @@ let EzNumberInput = class {
|
|
|
35
36
|
async setBlur() {
|
|
36
37
|
this._textInput.setBlur();
|
|
37
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
41
|
+
*/
|
|
42
|
+
async isInvalid() {
|
|
43
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
44
|
+
}
|
|
38
45
|
observeLabel() {
|
|
39
46
|
if (this._textInput) {
|
|
40
47
|
this._textInput.label = this.label;
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
50
|
observeErrorMessage() {
|
|
51
|
+
var _a;
|
|
44
52
|
if (this._textInput) {
|
|
45
53
|
this._textInput.errorMessage = this.errorMessage;
|
|
54
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
55
|
+
this.setInputValue();
|
|
56
|
+
}
|
|
46
57
|
}
|
|
47
58
|
}
|
|
48
|
-
observeValue() {
|
|
49
|
-
if (this._textInput) {
|
|
50
|
-
|
|
59
|
+
observeValue(newValue, oldValue) {
|
|
60
|
+
if (this._textInput && newValue != oldValue) {
|
|
61
|
+
const newValueValidated = this.validateValue(newValue);
|
|
62
|
+
const oldValueValidated = this.validateValue(oldValue);
|
|
63
|
+
if (newValueValidated != oldValueValidated) {
|
|
64
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
65
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
66
|
+
const parsedNumber = this.getParsedNumber(textValue);
|
|
67
|
+
if (parsedNumber !== undefined || !this._focused) {
|
|
68
|
+
this._textInput.value = textValue;
|
|
69
|
+
this._focused = false;
|
|
70
|
+
this.errorMessage = "";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
74
|
+
this.ezChange.emit(valueEmitted);
|
|
75
|
+
}
|
|
51
76
|
}
|
|
52
77
|
}
|
|
78
|
+
validateValue(value) {
|
|
79
|
+
return isNaN(value) || value === undefined ? null : value;
|
|
80
|
+
}
|
|
81
|
+
getTextValue(value) {
|
|
82
|
+
if (value != undefined) {
|
|
83
|
+
return this.precision > 0 ? core.NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
|
|
84
|
+
}
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
53
87
|
changeValue(newValue) {
|
|
54
88
|
this.errorMessage = "";
|
|
55
|
-
if (
|
|
56
|
-
this.value = newValue;
|
|
57
|
-
this.ezChange.emit(this.value);
|
|
58
|
-
return true;
|
|
89
|
+
if (this.value != newValue) {
|
|
90
|
+
this.value = newValue === undefined ? null : newValue;
|
|
59
91
|
}
|
|
60
92
|
else {
|
|
61
|
-
this.
|
|
93
|
+
this.ezCancelWaitingChange.emit();
|
|
62
94
|
}
|
|
63
|
-
return false;
|
|
64
95
|
}
|
|
65
|
-
|
|
66
|
-
|
|
96
|
+
setError(msg) {
|
|
97
|
+
this.value = null;
|
|
98
|
+
this.errorMessage = msg;
|
|
99
|
+
this.ezCancelWaitingChange.emit();
|
|
100
|
+
}
|
|
101
|
+
handleBlur() {
|
|
102
|
+
const parsedNumber = this.getParsedNumber();
|
|
67
103
|
if (parsedNumber !== undefined && isNaN(parsedNumber)) {
|
|
68
|
-
this.
|
|
69
|
-
this.errorMessage = "O valor digitado não é um número válido";
|
|
104
|
+
this.setError("O valor digitado não é um número válido");
|
|
70
105
|
}
|
|
71
106
|
else {
|
|
72
107
|
try {
|
|
73
|
-
|
|
74
|
-
this.ezCancelWaitingChange.emit();
|
|
75
|
-
}
|
|
108
|
+
this.changeValue(parsedNumber);
|
|
76
109
|
}
|
|
77
110
|
catch (e) {
|
|
78
|
-
this.
|
|
79
|
-
this.errorMessage = e.message;
|
|
111
|
+
this.setError(e.message);
|
|
80
112
|
return;
|
|
81
113
|
}
|
|
82
114
|
}
|
|
83
115
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
116
|
+
handleInput() {
|
|
117
|
+
const parsedNumber = this.getParsedNumber();
|
|
118
|
+
if (parsedNumber !== this.value) {
|
|
119
|
+
this._focused = true;
|
|
120
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
87
121
|
}
|
|
88
|
-
return undefined;
|
|
89
122
|
}
|
|
90
|
-
|
|
91
|
-
|
|
123
|
+
getParsedNumber(value) {
|
|
124
|
+
var _a;
|
|
125
|
+
if (value === void 0) {
|
|
126
|
+
value = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value;
|
|
127
|
+
}
|
|
128
|
+
return (value === null || value === void 0 ? void 0 : value.trim()) ? core.NumberUtils.stringToNumber(value) : undefined;
|
|
129
|
+
}
|
|
130
|
+
setInputValue() {
|
|
131
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
132
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
133
|
+
this._textInput.value = textValue;
|
|
134
|
+
}
|
|
92
135
|
}
|
|
93
136
|
componentDidLoad() {
|
|
94
137
|
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
138
|
+
this.setInputValue();
|
|
95
139
|
}
|
|
96
140
|
render() {
|
|
97
|
-
return (index.h("ez-text-input", { ref: elem => this._textInput = elem,
|
|
141
|
+
return (index.h("ez-text-input", { ref: elem => this._textInput = elem, "data-slave-mode": "true", label: this.label, onBlur: () => this.handleBlur(), onInput: () => this.handleInput(), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode }));
|
|
98
142
|
}
|
|
99
143
|
get _elem() { return index.getElement(this); }
|
|
100
144
|
static get watchers() { return {
|
|
@@ -33,6 +33,11 @@ let EzSearch = class {
|
|
|
33
33
|
*/
|
|
34
34
|
this.mode = "regular";
|
|
35
35
|
}
|
|
36
|
+
observeErrorMessage() {
|
|
37
|
+
if (this._comboElement) {
|
|
38
|
+
this._comboElement.errorMessage = this.errorMessage;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
36
41
|
observeValue() {
|
|
37
42
|
if (this._comboElement) {
|
|
38
43
|
this._comboElement.value = this.value;
|
|
@@ -50,20 +55,30 @@ let EzSearch = class {
|
|
|
50
55
|
async setBlur() {
|
|
51
56
|
this._comboElement.setBlur();
|
|
52
57
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
60
|
+
*/
|
|
61
|
+
async isInvalid() {
|
|
62
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
63
|
+
}
|
|
64
|
+
onComboChange(event) {
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
this.value = event.detail;
|
|
67
|
+
this.ezChange.emit(event.detail);
|
|
68
|
+
if (this.errorMessage !== this._comboElement.errorMessage) {
|
|
69
|
+
this.errorMessage = this._comboElement.errorMessage;
|
|
70
|
+
}
|
|
57
71
|
}
|
|
58
72
|
componentDidLoad() {
|
|
59
73
|
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
|
|
60
74
|
}
|
|
61
75
|
render() {
|
|
62
|
-
return (index.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:
|
|
76
|
+
return (index.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: event => this.onComboChange(event), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue, suppressEmptyOption: this.suppressEmptyOption, mode: this.mode }));
|
|
63
77
|
}
|
|
64
78
|
;
|
|
65
79
|
get _elem() { return index.getElement(this); }
|
|
66
80
|
static get watchers() { return {
|
|
81
|
+
"errorMessage": ["observeErrorMessage"],
|
|
67
82
|
"value": ["observeValue"]
|
|
68
83
|
}; }
|
|
69
84
|
};
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-c15a9551.js');
|
|
6
6
|
|
|
7
|
-
const ezTextAreaCss = ":host{--text-area--width:100%;--text-area--border-radius:var(--border--radius-medium, 12px);--text-area--font-size:var(--text--medium, 14px);--text-area--font-family:var(--font-pattern, Arial);--text-area--font-weight:var(--text-weight--medium, 400);--text-area--color:var(--title--primary, #000);--text-area__input--background-color:var(--background--medium, #e0e0e0);--text-area__input--border:var(--border--medium, 2px solid);--text-area__input--border-color:var(--text-area__input--background-color);--text-area__input--focus--border-color:var(--color--primary, #008561);--text-area__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--text-area__input--disabled--color:var(--text--disable, #AFB6C0);--text-area__input--error--border-color:#CC2936;--text-area__message_box--font-size:var(--text--small, 12px);--text-area__message_box--info--color:var(--color--success, #22085d);--text-area__message_box--error--color:var(--color--error, #FF0000);--text-area__label--floating--top:6px;--text-area__label--padding-top:12px;--text-area__label--padding-left:14px;--text-area__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--text-area--width)}textarea{box-sizing:border-box;border:none;resize:none;margin-top:calc(var(--space--medium, 12px) + 4px);width:100%;font-weight:var(--text-weight
|
|
7
|
+
const ezTextAreaCss = ":host{--text-area--width:100%;--text-area--border-radius:var(--border--radius-medium, 12px);--text-area--font-size:var(--text--medium, 14px);--text-area--font-family:var(--font-pattern, Arial);--text-area--font-weight:var(--text-weight--medium, 400);--text-area--color:var(--title--primary, #000);--text-area__input--background-color:var(--background--medium, #e0e0e0);--text-area__input--border:var(--border--medium, 2px solid);--text-area__input--border-color:var(--text-area__input--background-color);--text-area__input--focus--border-color:var(--color--primary, #008561);--text-area__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--text-area__input--disabled--color:var(--text--disable, #AFB6C0);--text-area__input--error--border-color:#CC2936;--text-area__message_box--font-size:var(--text--small, 12px);--text-area__message_box--info--color:var(--color--success, #22085d);--text-area__message_box--error--color:var(--color--error, #FF0000);--text-area__label--floating--top:6px;--text-area__label--padding-top:12px;--text-area__label--padding-left:14px;--text-area__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--text-area--width)}textarea{box-sizing:border-box;border:none;resize:none;margin-top:calc(var(--space--medium, 12px) + 4px);width:100%;font-weight:var(--text-area--font-weight);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);color:var(--text-area--color);padding:0;background:none}textarea:focus{outline:none}textarea:disabled{background-color:transparent;color:var(--text-area__input--disabled--color)}.textarea{width:100%;box-sizing:border-box;padding-left:var(--space--medium);padding-right:var(--space--extra-small);border-radius:var(--text-area--border-radius);border:var(--text-area__input--border);border-color:var(--text-area__input--border-color);background-color:var(--text-area__input--background-color)}.textarea--focus{border-color:var(--text-area__input--focus--border-color)}.textarea.hasError{color:var(--text-area--color);border-color:var(--text-area__input--error--border-color)}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--text-area--font-family);font-size:var(--text-area__message_box--font-size);color:var(--text-area__message_box--info--color)}.hasError{color:var(--text-area__message_box--error--color)}.textarea__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--text-area__label--padding-right));left:var(--text-area--space--medium);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color);top:var(--text-area__label--padding-top);left:var(--text-area__label--padding-left);padding-right:var(--text-area__label--padding-right)}.textarea__label--floated{font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--text-area__label--floating--top)}.textarea__label--disabled{color:var(--text-area__input--disabled--color)}.textarea--slim{margin-top:var(--space--small, 6px)}.textarea--slim::-webkit-input-placeholder{font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color)}.textarea--slim:-moz-placeholder{font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color)}.textarea--slim::-moz-placeholder{font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color)}.textarea--slim:-ms-input-placeholder{font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color)}.textarea--slim::placeholder{font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color)}.textarea--slim:disabled::-webkit-input-placeholder{color:var(--text-area__input--disabled--color)}.textarea--slim:disabled:-moz-placeholder{color:var(--text-area__input--disabled--color)}.textarea--slim:disabled::-moz-placeholder{color:var(--text-area__input--disabled--color)}.textarea--slim:disabled:-ms-input-placeholder{color:var(--text-area__input--disabled--color)}.textarea--slim:disabled::placeholder{color:var(--text-area__input--disabled--color)}";
|
|
8
8
|
|
|
9
9
|
let EzTextArea = class {
|
|
10
10
|
constructor(hostRef) {
|
|
@@ -82,6 +82,12 @@ let EzTextArea = class {
|
|
|
82
82
|
async setBlur() {
|
|
83
83
|
this._inputElem.blur();
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
87
|
+
*/
|
|
88
|
+
async isInvalid() {
|
|
89
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
90
|
+
}
|
|
85
91
|
//---------------------------------------------
|
|
86
92
|
// Private methods
|
|
87
93
|
//---------------------------------------------
|
|
@@ -140,7 +146,7 @@ let EzTextArea = class {
|
|
|
140
146
|
render() {
|
|
141
147
|
return (index.h(index.Host, null, index.h("div", { class: "textarea", ref: (el) => this._container = el }, this.label && this.mode != "slim" ?
|
|
142
148
|
index.h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "textarea__label" : "textarea__label textarea__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
|
|
143
|
-
: null, index.h("textarea", { onFocus: () => this.handleFocus(), ref: (el) => this._inputElem = el, value: this.value, disabled: !this.enabled, class: this.mode
|
|
149
|
+
: null, index.h("textarea", { onFocus: () => this.handleFocus(), ref: (el) => this._inputElem = el, value: this.value, disabled: !this.enabled, class: this.mode === "slim" ? "textarea--slim" : "", placeholder: this.mode === "slim" && this.label ? this.label : "", onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, onKeyDown: event => event.stopPropagation(), rows: this.rows })), this.canShowError && this.mode != "slim" &&
|
|
144
150
|
index.h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
|
|
145
151
|
}
|
|
146
152
|
get _hostElement() { return index.getElement(this); }
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-c15a9551.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
7
|
|
|
8
|
-
const ezTextInputCss = ":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--height--slim:32px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #2B3A54);--ez-text-input__input--background-color:var(--background--medium, #e0e0e0);--ez-text-input__input--border:var(--border--medium, 2px solid);--ez-text-input__input--border-color:var(--ez-text-input__input--background-color);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-text-input__input--disabled--color:var(--text--disable, #AFB6C0);--ez-text-input__input--error--border-color:#CC2936;--ez-text-input__message_box--font-size:var(--text--small, 12px);--ez-text-input__message_box--info--color:var(--color--success, #22085d);--ez-text-input__message_box--error--color:var(--color--error, #FF0000);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width)}input{width:100%;box-sizing:border-box;padding:var(--space--medium, 6px);
|
|
8
|
+
const ezTextInputCss = ":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--height--slim:32px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #2B3A54);--ez-text-input__input--background-color:var(--background--medium, #e0e0e0);--ez-text-input__input--border:var(--border--medium, 2px solid);--ez-text-input__input--border-color:var(--ez-text-input__input--background-color);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-text-input__input--disabled--color:var(--text--disable, #AFB6C0);--ez-text-input__input--error--border-color:#CC2936;--ez-text-input__message_box--font-size:var(--text--small, 12px);--ez-text-input__message_box--info--color:var(--color--success, #22085d);--ez-text-input__message_box--error--color:var(--color--error, #FF0000);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width)}input{width:100%;box-sizing:border-box;padding:var(--space--medium, 6px);height:var(--ez-text-input--height);border-radius:var(--ez-text-input--border-radius);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);border:var(--ez-text-input__input--border);border-color:var(--ez-text-input__input--border-color);background-color:var(--ez-text-input__input--background-color);color:var(--ez-text-input--color);font-weight:var(--ez-text-input--font-weight)}input:disabled{background-color:var(--ez-text-input__input--disabled--background-color);color:var(--ez-text-input__input--disabled--color)}input:focus{outline:none;border-color:var(--ez-text-input__input--focus--border-color)}input.icon--left{padding-left:var(--ez-text-input__icon--width)}input.icon--right{padding-right:var(--ez-text-input__icon--width)}input.hasError{color:var(--ez-text-input--color);border-color:var(--ez-text-input__input--error--border-color)}input:disabled.hasError{color:var(--ez-text-input__input--disabled--color)}input.text--right{text-align:right}input:read-only{cursor:default}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input__message_box--font-size);color:var(--ez-text-input__message_box--info--color)}.hasError{color:var(--ez-text-input__message_box--error--color)}.input__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--ez-text-input__label--padding-right));left:var(--ez-text-input--space--medium);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color);top:var(--ez-text-input__label--padding-top);left:var(--ez-text-input__label--padding-left);padding-right:var(--ez-text-input__label--padding-right)}.input__label--floated{font-family:var(--ez-text-input--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--ez-text-input__label--floating--top)}.input__label--disabled{color:var(--ez-text-input__input--disabled--color)}.input__label--left{text-align:left;left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--right{right:var(--ez-text-input__icon--width);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--left.input__label--right{left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width) * 2)}.input--with--label{padding-bottom:0}.input--slim{padding-top:var(--space--small, 3px);padding-bottom:var(--space--small, 3px);height:var(--ez-text-input--height--slim)}.input--slim::-webkit-input-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:-moz-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim::-moz-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:-ms-input-placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim::placeholder{font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color)}.input--slim:disabled::-webkit-input-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled:-moz-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled::-moz-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled:-ms-input-placeholder{color:var(--ez-text-input__input--disabled--color)}.input--slim:disabled::placeholder{color:var(--ez-text-input__input--disabled--color)}";
|
|
9
9
|
|
|
10
10
|
let EzTextInput = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -23,23 +23,20 @@ let EzTextInput = class {
|
|
|
23
23
|
* Define o modo do tamanho do campo; opções: slim e regular.
|
|
24
24
|
*/
|
|
25
25
|
this.mode = "regular";
|
|
26
|
-
/**
|
|
27
|
-
* Define se o controle de change do value será controlado por um componente pai.
|
|
28
|
-
*/
|
|
29
|
-
this.slaveMode = false;
|
|
30
26
|
}
|
|
31
27
|
observeErrorMessage() {
|
|
32
|
-
var _a, _b;
|
|
33
28
|
if (this._inputElem) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
this.isInvalid().then((hasError) => {
|
|
30
|
+
var _a, _b;
|
|
31
|
+
if (hasError) {
|
|
32
|
+
this._inputElem.classList.add("hasError");
|
|
33
|
+
(_a = this._messageBoxElem) === null || _a === void 0 ? void 0 : _a.classList.add("hasError");
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this._inputElem.classList.remove("hasError");
|
|
37
|
+
(_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove("hasError");
|
|
38
|
+
}
|
|
39
|
+
});
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
observeMask() {
|
|
@@ -58,14 +55,16 @@ let EzTextInput = class {
|
|
|
58
55
|
this._inputElem.value = this.value || "";
|
|
59
56
|
this.handleChange();
|
|
60
57
|
this.adjustFloatingLabel();
|
|
61
|
-
if (this.
|
|
62
|
-
|
|
58
|
+
if (!this.isSlaveMode()) {
|
|
59
|
+
this.errorMessage = "";
|
|
60
|
+
this.ezChange.emit(this.value);
|
|
63
61
|
}
|
|
64
|
-
this.errorMessage = "";
|
|
65
|
-
this.ezChange.emit(this.value);
|
|
66
62
|
}
|
|
67
63
|
}
|
|
68
64
|
}
|
|
65
|
+
//---------------------------------------------
|
|
66
|
+
// Private methods
|
|
67
|
+
//---------------------------------------------
|
|
69
68
|
adjustFloatingLabel() {
|
|
70
69
|
if (this.label && this._labelElem) {
|
|
71
70
|
if (this._inputElem && !this._inputElem.classList.contains("input--with--label")) {
|
|
@@ -88,6 +87,10 @@ let EzTextInput = class {
|
|
|
88
87
|
isFocused() {
|
|
89
88
|
return this._hostElement.shadowRoot.activeElement !== null;
|
|
90
89
|
}
|
|
90
|
+
isSlaveMode() {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
return ((_b = (_a = this._hostElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.slaveMode) === "true";
|
|
93
|
+
}
|
|
91
94
|
adjustColorContentSlot(color = "") {
|
|
92
95
|
if (this._contentLeftSlot) {
|
|
93
96
|
this._contentLeftSlot.style.color = color;
|
|
@@ -108,6 +111,12 @@ let EzTextInput = class {
|
|
|
108
111
|
async setBlur() {
|
|
109
112
|
this._inputElem.blur();
|
|
110
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
116
|
+
*/
|
|
117
|
+
async isInvalid() {
|
|
118
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
119
|
+
}
|
|
111
120
|
//---------------------------------------------
|
|
112
121
|
// Event handlers
|
|
113
122
|
//---------------------------------------------
|
|
@@ -132,7 +141,7 @@ let EzTextInput = class {
|
|
|
132
141
|
return true;
|
|
133
142
|
}
|
|
134
143
|
controlChangeValue() {
|
|
135
|
-
if ((this.value || '') !== this._inputElem.value) {
|
|
144
|
+
if (this._inputElem && (this.value || '') !== this._inputElem.value) {
|
|
136
145
|
this.value = this._inputElem.value;
|
|
137
146
|
}
|
|
138
147
|
}
|
|
@@ -215,7 +224,7 @@ let EzTextInput = class {
|
|
|
215
224
|
render() {
|
|
216
225
|
return (index.h(index.Host, null, index.h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label && this.mode != "slim" ?
|
|
217
226
|
index.h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "input__label" : "input__label input__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
|
|
218
|
-
: null, index.h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", class: this.mode
|
|
227
|
+
: null, index.h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", class: this.mode === "slim" ? "input--slim" : "", placeholder: this.mode === "slim" && this.label ? this.label : "", value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), index.h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.canShowError && this.mode != "slim" &&
|
|
219
228
|
index.h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
|
|
220
229
|
}
|
|
221
230
|
get _hostElement() { return index.getElement(this); }
|