@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.
Files changed (78) hide show
  1. package/dist/cjs/ez-combo-box.cjs.entry.js +62 -27
  2. package/dist/cjs/ez-date-input.cjs.entry.js +71 -25
  3. package/dist/cjs/ez-date-time-input.cjs.entry.js +94 -31
  4. package/dist/cjs/ez-filter-input.cjs.entry.js +10 -4
  5. package/dist/cjs/ez-form.cjs.entry.js +54 -9
  6. package/dist/cjs/ez-grid.cjs.entry.js +9 -6
  7. package/dist/cjs/ez-number-input.cjs.entry.js +69 -25
  8. package/dist/cjs/ez-search.cjs.entry.js +20 -5
  9. package/dist/cjs/ez-text-area.cjs.entry.js +8 -2
  10. package/dist/cjs/ez-text-input.cjs.entry.js +30 -21
  11. package/dist/cjs/ez-time-input.cjs.entry.js +75 -40
  12. package/dist/cjs/ezui.cjs.js +1 -1
  13. package/dist/cjs/loader.cjs.js +1 -1
  14. package/dist/collection/components/ez-combo-box/ez-combo-box.js +81 -28
  15. package/dist/collection/components/ez-date-input/ez-date-input.js +87 -25
  16. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +108 -31
  17. package/dist/collection/components/ez-filter-input/ez-filter-input.js +26 -4
  18. package/dist/collection/components/ez-form/DataBinder.js +12 -3
  19. package/dist/collection/components/ez-form/ez-form.js +43 -6
  20. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +1 -1
  21. package/dist/collection/components/ez-grid/ez-grid.js +14 -7
  22. package/dist/collection/components/ez-number-input/ez-number-input.js +83 -25
  23. package/dist/collection/components/ez-search/ez-search.js +38 -5
  24. package/dist/collection/components/ez-text-area/ez-text-area.css +1 -1
  25. package/dist/collection/components/ez-text-area/ez-text-area.js +23 -1
  26. package/dist/collection/components/ez-text-input/ez-text-input.css +1 -1
  27. package/dist/collection/components/ez-text-input/ez-text-input.js +45 -38
  28. package/dist/collection/components/ez-time-input/ez-time-input.js +95 -59
  29. package/dist/custom-elements/index.js +504 -197
  30. package/dist/esm/ez-combo-box.entry.js +62 -27
  31. package/dist/esm/ez-date-input.entry.js +71 -25
  32. package/dist/esm/ez-date-time-input.entry.js +94 -31
  33. package/dist/esm/ez-filter-input.entry.js +10 -4
  34. package/dist/esm/ez-form.entry.js +54 -9
  35. package/dist/esm/ez-grid.entry.js +9 -6
  36. package/dist/esm/ez-number-input.entry.js +69 -25
  37. package/dist/esm/ez-search.entry.js +20 -5
  38. package/dist/esm/ez-text-area.entry.js +8 -2
  39. package/dist/esm/ez-text-input.entry.js +30 -21
  40. package/dist/esm/ez-time-input.entry.js +76 -41
  41. package/dist/esm/ezui.js +1 -1
  42. package/dist/esm/loader.js +1 -1
  43. package/dist/ezui/ezui.esm.js +1 -1
  44. package/dist/ezui/p-003d53b1.entry.js +1 -0
  45. package/dist/ezui/p-267fa515.entry.js +1 -0
  46. package/dist/ezui/p-2acf7d59.entry.js +1 -0
  47. package/dist/ezui/p-403de0a4.entry.js +1 -0
  48. package/dist/ezui/p-4c3d136c.entry.js +1 -0
  49. package/dist/ezui/p-53bbba8e.entry.js +1 -0
  50. package/dist/ezui/p-6668c3b0.entry.js +1 -0
  51. package/dist/ezui/p-7fd6deec.entry.js +1 -0
  52. package/dist/ezui/p-ad6cc559.entry.js +1 -0
  53. package/dist/ezui/{p-be87ac5e.entry.js → p-ae2fea4c.entry.js} +1 -1
  54. package/dist/ezui/p-ff7b4b13.entry.js +1 -0
  55. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +13 -7
  56. package/dist/types/components/ez-date-input/ez-date-input.d.ts +10 -3
  57. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +15 -7
  58. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +5 -1
  59. package/dist/types/components/ez-form/DataBinder.d.ts +1 -1
  60. package/dist/types/components/ez-form/ez-form.d.ts +1 -0
  61. package/dist/types/components/ez-grid/ez-grid.d.ts +4 -1
  62. package/dist/types/components/ez-number-input/ez-number-input.d.ts +14 -5
  63. package/dist/types/components/ez-search/ez-search.d.ts +6 -1
  64. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -0
  65. package/dist/types/components/ez-text-input/ez-text-input.d.ts +7 -6
  66. package/dist/types/components/ez-time-input/ez-time-input.d.ts +17 -13
  67. package/dist/types/components.d.ts +43 -20
  68. package/package.json +1 -1
  69. package/dist/ezui/p-1859a3d8.entry.js +0 -1
  70. package/dist/ezui/p-49fdfa4b.entry.js +0 -1
  71. package/dist/ezui/p-4fdceb7d.entry.js +0 -1
  72. package/dist/ezui/p-6d4b1628.entry.js +0 -1
  73. package/dist/ezui/p-8f4fac31.entry.js +0 -1
  74. package/dist/ezui/p-91377c65.entry.js +0 -1
  75. package/dist/ezui/p-b524dfca.entry.js +0 -1
  76. package/dist/ezui/p-bc8aa27f.entry.js +0 -1
  77. package/dist/ezui/p-ec21ecce.entry.js +0 -1
  78. package/dist/ezui/p-fc9b9487.entry.js +0 -1
@@ -631,7 +631,7 @@ class DataBinder {
631
631
  case Action.NEXT_SELECTED:
632
632
  case Action.PREVIOUS_SELECTED:
633
633
  (_a = this._fields) === null || _a === void 0 ? void 0 : _a.forEach(field => {
634
- this.updateValue(field.fieldName, field.field);
634
+ this.updateValue(field.fieldName, field.field, action.type === Action.EDITION_CANCELED);
635
635
  });
636
636
  break;
637
637
  }
@@ -649,15 +649,24 @@ class DataBinder {
649
649
  onDisconnectedCallback() {
650
650
  this._dataUnit.unsubscribe(this.onDataUnitEvent);
651
651
  }
652
- updateValue(fieldName, field) {
652
+ updateValue(fieldName, field, actionCanceled = false) {
653
+ var _a;
653
654
  field["value"] = this._dataUnit.getFieldValue(fieldName);
655
+ /**
656
+ * FIXME: Campo já salvo com undefined, ao inserir valor inválido e cancelar,
657
+ * o campo não é limpo e atualizado automaticamente, pois o value não mudou,
658
+ * assim, não dispara o Watch do value, que é o responsável por limpar o errorMessage.
659
+ */
660
+ if (actionCanceled && ((_a = field["errorMessage"]) === null || _a === void 0 ? void 0 : _a.trim())) {
661
+ field["errorMessage"] = "";
662
+ }
654
663
  }
655
664
  updateBind(fieldName, field) {
656
665
  const oldBind = this._fields.get(fieldName);
657
666
  if (oldBind) {
658
667
  oldBind.destroy();
659
668
  }
660
- field["value"] = this._dataUnit.getFieldValue(fieldName);
669
+ this.updateValue(fieldName, field);
661
670
  this._fields.set(fieldName, Bind.create(fieldName, field, (fieldName, waitingChange) => this.changeStarted(fieldName, waitingChange), (fieldName) => this.cancelWaitingChange(fieldName), (fieldName, newValue) => this.setFieldValue(fieldName, newValue)));
662
671
  this.bindSearchOptionsLoader(fieldName, field);
663
672
  this.applyEzUploadContext(fieldName, field);
@@ -788,25 +797,58 @@ let EzForm = class {
788
797
  return Promise.resolve();
789
798
  }
790
799
  validate() {
791
- return new Promise((accept, reject) => {
800
+ return new Promise(async (accept, reject) => {
792
801
  const metadata = selectFormMetadata(this._store.getState());
793
802
  const requiredFields = this._staticFields
794
803
  .filter(f => f.dataset.required)
795
804
  .map(f => f.dataset.fieldName)
796
805
  .concat(metadata.getRequiredFields());
806
+ let isReject = false;
797
807
  const records = this.dataUnit.getModifiedRecords();
798
808
  for (let i = 0; i < records.length; i++) {
799
809
  if (!this.validateRequired(requiredFields, records[i])) {
800
- reject();
810
+ isReject = true;
801
811
  break;
802
812
  }
803
813
  }
804
- accept();
814
+ if (!isReject) {
815
+ const validateError = await this.validateError();
816
+ if (!validateError) {
817
+ isReject = true;
818
+ }
819
+ }
820
+ if (isReject) {
821
+ reject();
822
+ }
823
+ else {
824
+ accept();
825
+ }
805
826
  });
806
827
  }
807
828
  observeConfig() {
808
829
  this.processMetadata();
809
830
  }
831
+ async validateError() {
832
+ var _a;
833
+ const invalidFields = [];
834
+ const dataFields = (_a = this._element) === null || _a === void 0 ? void 0 : _a.querySelectorAll("[data-field-name]");
835
+ if (dataFields && dataFields.length > 0) {
836
+ for (let i = 0; i < dataFields.length; i++) {
837
+ const fieldElem = dataFields[i];
838
+ if (fieldElem && fieldElem['isInvalid']) {
839
+ const hasError = await fieldElem['isInvalid']();
840
+ if (hasError && fieldElem['dataset']) {
841
+ invalidFields.push(fieldElem['dataset'].fieldName);
842
+ }
843
+ }
844
+ }
845
+ }
846
+ const isValid = invalidFields.length === 0;
847
+ if (!isValid) {
848
+ ApplicationUtils.info("Há pelo menos um campo com conteúdo inválido.");
849
+ }
850
+ return isValid;
851
+ }
810
852
  validateRequired(requiredFields, record) {
811
853
  const invalidFields = [];
812
854
  requiredFields.forEach(field => {
@@ -819,13 +861,16 @@ let EzForm = class {
819
861
  * na aba, isso será tratado no card: https://sankhya.atlassian.net/browse/SKA-44182
820
862
  */
821
863
  if (fieldElem) {
864
+ /**
865
+ * Devido o StencilJS não possuir Getter e Setter, para casos que o Watch não for chamado,
866
+ * é necessário limpar a propriedade antes de setar o valor novamente, para que o Watch seja disparado novamente,
867
+ * solução necessária para controlar componentes com herança (Exemplo: EzSearch -> EzComboBox -> EzTextInput).
868
+ */
869
+ fieldElem["errorMessage"] = "";
822
870
  if (value === null || value === undefined || value === "") {
823
871
  invalidFields.push(field);
824
872
  fieldElem["errorMessage"] = "Essa informação é obrigatória";
825
873
  }
826
- else {
827
- fieldElem["errorMessage"] = "";
828
- }
829
874
  }
830
875
  });
831
876
  const isValid = invalidFields.length === 0;
@@ -110281,7 +110281,7 @@ class AgGridController {
110281
110281
  throw new Error("Erro interno: Grid ainda não inicializado.");
110282
110282
  }
110283
110283
  const colDef = this._gridOptions.columnApi.getAllColumns();
110284
- return colDef.map(c => {
110284
+ return colDef.filter(c => c.getColId() !== "checkBoxColumn").map(c => {
110285
110285
  const def = c.getColDef();
110286
110286
  const colDef = { name: def.field, label: def.headerName };
110287
110287
  this.conditionalSet(colDef, "sortable", def.sortable);
@@ -110777,6 +110777,14 @@ let EzGrid = class {
110777
110777
  async hasPreviousRecord() {
110778
110778
  return Promise.resolve(this._gridController.hasPreviousRecord());
110779
110779
  }
110780
+ /**
110781
+ * Método para abrir a configuração da grid.
110782
+ */
110783
+ async openGridConfig() {
110784
+ this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
110785
+ this._gridConfig.selectedTab = "Colunas";
110786
+ this._popUpGridConfig = true;
110787
+ }
110780
110788
  componentWillLoad() {
110781
110789
  if (this.dataUnit) {
110782
110790
  this._dataUnitBridge = new DataUnitBridge(this._gridController, this.dataUnit);
@@ -110894,11 +110902,6 @@ let EzGrid = class {
110894
110902
  closeGridConfig() {
110895
110903
  this._popUpGridConfig = false;
110896
110904
  }
110897
- openGridConfig() {
110898
- this._gridConfig.columns = this._gridController.getColumnsState().filter(c => c.name);
110899
- this._gridConfig.selectedTab = "Colunas";
110900
- this._popUpGridConfig = true;
110901
- }
110902
110905
  render() {
110903
110906
  return (h(Host, null, h("div", { class: "ez-box ez-box--shadow ez-padding--medium grid-header" }, h("div", { class: "grid-header__container" }, h("slot", { name: "leftButtons" })), h("div", { class: "grid-header__container" }, this.getPaginationControl())), h("div", { class: "grid__container ez-grid", ref: elem => this._container = elem }), h("div", { class: "grid__footer" }), h("ez-modal", { modalSize: "small", closeEsc: false, closeOutsideClick: false, opened: this._popUpGridConfig, onEzCloseModal: () => this.closeGridConfig() }, 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() }))));
110904
110907
  }
@@ -10,6 +10,7 @@ let EzNumberInput = class {
10
10
  this.ezChange = createEvent(this, "ezChange", 7);
11
11
  this.ezStartChange = createEvent(this, "ezStartChange", 7);
12
12
  this.ezCancelWaitingChange = createEvent(this, "ezCancelWaitingChange", 7);
13
+ this._focused = false;
13
14
  /**
14
15
  * Deixa o campo disponível ou não para uso.
15
16
  */
@@ -31,66 +32,109 @@ let EzNumberInput = class {
31
32
  async setBlur() {
32
33
  this._textInput.setBlur();
33
34
  }
35
+ /**
36
+ * Retorna informando se o campo está inválido (true | false)
37
+ */
38
+ async isInvalid() {
39
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
40
+ }
34
41
  observeLabel() {
35
42
  if (this._textInput) {
36
43
  this._textInput.label = this.label;
37
44
  }
38
45
  }
39
46
  observeErrorMessage() {
47
+ var _a;
40
48
  if (this._textInput) {
41
49
  this._textInput.errorMessage = this.errorMessage;
50
+ if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
51
+ this.setInputValue();
52
+ }
42
53
  }
43
54
  }
44
- observeValue() {
45
- if (this._textInput) {
46
- this._textInput.value = this.getTextValue(this.value) || '';
55
+ observeValue(newValue, oldValue) {
56
+ if (this._textInput && newValue != oldValue) {
57
+ const newValueValidated = this.validateValue(newValue);
58
+ const oldValueValidated = this.validateValue(oldValue);
59
+ if (newValueValidated != oldValueValidated) {
60
+ const textValue = this.getTextValue(newValueValidated) || '';
61
+ if ((this._textInput.value || '') !== textValue) {
62
+ const parsedNumber = this.getParsedNumber(textValue);
63
+ if (parsedNumber !== undefined || !this._focused) {
64
+ this._textInput.value = textValue;
65
+ this._focused = false;
66
+ this.errorMessage = "";
67
+ }
68
+ }
69
+ const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
70
+ this.ezChange.emit(valueEmitted);
71
+ }
47
72
  }
48
73
  }
74
+ validateValue(value) {
75
+ return isNaN(value) || value === undefined ? null : value;
76
+ }
77
+ getTextValue(value) {
78
+ if (value != undefined) {
79
+ return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
80
+ }
81
+ return undefined;
82
+ }
49
83
  changeValue(newValue) {
50
84
  this.errorMessage = "";
51
- if (newValue !== this.value) {
52
- this.value = newValue;
53
- this.ezChange.emit(this.value);
54
- return true;
85
+ if (this.value != newValue) {
86
+ this.value = newValue === undefined ? null : newValue;
55
87
  }
56
88
  else {
57
- this.observeValue();
89
+ this.ezCancelWaitingChange.emit();
58
90
  }
59
- return false;
60
91
  }
61
- parseNumber() {
62
- const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : undefined;
92
+ setError(msg) {
93
+ this.value = null;
94
+ this.errorMessage = msg;
95
+ this.ezCancelWaitingChange.emit();
96
+ }
97
+ handleBlur() {
98
+ const parsedNumber = this.getParsedNumber();
63
99
  if (parsedNumber !== undefined && isNaN(parsedNumber)) {
64
- this.ezCancelWaitingChange.emit();
65
- this.errorMessage = "O valor digitado não é um número válido";
100
+ this.setError("O valor digitado não é um número válido");
66
101
  }
67
102
  else {
68
103
  try {
69
- if (!this.changeValue(parsedNumber)) {
70
- this.ezCancelWaitingChange.emit();
71
- }
104
+ this.changeValue(parsedNumber);
72
105
  }
73
106
  catch (e) {
74
- this.ezCancelWaitingChange.emit();
75
- this.errorMessage = e.message;
107
+ this.setError(e.message);
76
108
  return;
77
109
  }
78
110
  }
79
111
  }
80
- getTextValue(value) {
81
- if (value) {
82
- return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
112
+ handleInput() {
113
+ const parsedNumber = this.getParsedNumber();
114
+ if (parsedNumber !== this.value) {
115
+ this._focused = true;
116
+ this.ezStartChange.emit({ waitmessage: "", blocking: false });
83
117
  }
84
- return undefined;
85
118
  }
86
- startChange() {
87
- this.ezStartChange.emit({ waitmessage: "", blocking: false });
119
+ getParsedNumber(value) {
120
+ var _a;
121
+ if (value === void 0) {
122
+ value = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value;
123
+ }
124
+ return (value === null || value === void 0 ? void 0 : value.trim()) ? NumberUtils.stringToNumber(value) : undefined;
125
+ }
126
+ setInputValue() {
127
+ const textValue = this.getTextValue(this.value) || '';
128
+ if ((this._textInput.value || '') !== textValue) {
129
+ this._textInput.value = textValue;
130
+ }
88
131
  }
89
132
  componentDidLoad() {
90
133
  CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
134
+ this.setInputValue();
91
135
  }
92
136
  render() {
93
- return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onInput: () => this.startChange(), value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true }));
137
+ return (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 }));
94
138
  }
95
139
  get _elem() { return getElement(this); }
96
140
  static get watchers() { return {
@@ -29,6 +29,11 @@ let EzSearch = class {
29
29
  */
30
30
  this.mode = "regular";
31
31
  }
32
+ observeErrorMessage() {
33
+ if (this._comboElement) {
34
+ this._comboElement.errorMessage = this.errorMessage;
35
+ }
36
+ }
32
37
  observeValue() {
33
38
  if (this._comboElement) {
34
39
  this._comboElement.value = this.value;
@@ -46,20 +51,30 @@ let EzSearch = class {
46
51
  async setBlur() {
47
52
  this._comboElement.setBlur();
48
53
  }
49
- onComboChange(evt) {
50
- evt.stopPropagation();
51
- this.value = evt.detail;
52
- this.ezChange.emit(evt.detail);
54
+ /**
55
+ * Retorna informando se o campo está inválido (true | false)
56
+ */
57
+ async isInvalid() {
58
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
59
+ }
60
+ onComboChange(event) {
61
+ event.stopPropagation();
62
+ this.value = event.detail;
63
+ this.ezChange.emit(event.detail);
64
+ if (this.errorMessage !== this._comboElement.errorMessage) {
65
+ this.errorMessage = this._comboElement.errorMessage;
66
+ }
53
67
  }
54
68
  componentDidLoad() {
55
69
  CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
56
70
  }
57
71
  render() {
58
- 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, suppressEmptyOption: this.suppressEmptyOption, mode: this.mode }));
72
+ 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: event => this.onComboChange(event), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue, suppressEmptyOption: this.suppressEmptyOption, mode: this.mode }));
59
73
  }
60
74
  ;
61
75
  get _elem() { return getElement(this); }
62
76
  static get watchers() { return {
77
+ "errorMessage": ["observeErrorMessage"],
63
78
  "value": ["observeValue"]
64
79
  }; }
65
80
  };
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-b21f0a10.js';
2
2
 
3
- 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--large, 600);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)}";
3
+ 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)}";
4
4
 
5
5
  let EzTextArea = class {
6
6
  constructor(hostRef) {
@@ -78,6 +78,12 @@ let EzTextArea = class {
78
78
  async setBlur() {
79
79
  this._inputElem.blur();
80
80
  }
81
+ /**
82
+ * Retorna informando se o campo está inválido (true | false)
83
+ */
84
+ async isInvalid() {
85
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
86
+ }
81
87
  //---------------------------------------------
82
88
  // Private methods
83
89
  //---------------------------------------------
@@ -136,7 +142,7 @@ let EzTextArea = class {
136
142
  render() {
137
143
  return (h(Host, null, h("div", { class: "textarea", ref: (el) => this._container = el }, this.label && this.mode != "slim" ?
138
144
  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)
139
- : null, 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" &&
145
+ : null, 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" &&
140
146
  h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
141
147
  }
142
148
  get _hostElement() { return getElement(this); }
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-b21f0a10.js';
2
2
  import { MaskFormatter } from '@sankhyalabs/core';
3
3
 
4
- 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);font-weight:var(--text-weight--large, 600);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)}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)}";
4
+ 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)}";
5
5
 
6
6
  let EzTextInput = class {
7
7
  constructor(hostRef) {
@@ -19,23 +19,20 @@ let EzTextInput = class {
19
19
  * Define o modo do tamanho do campo; opções: slim e regular.
20
20
  */
21
21
  this.mode = "regular";
22
- /**
23
- * Define se o controle de change do value será controlado por um componente pai.
24
- */
25
- this.slaveMode = false;
26
22
  }
27
23
  observeErrorMessage() {
28
- var _a, _b;
29
24
  if (this._inputElem) {
30
- const hasError = typeof this.errorMessage === "string" && this.errorMessage !== "";
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
- }
25
+ this.isInvalid().then((hasError) => {
26
+ var _a, _b;
27
+ if (hasError) {
28
+ this._inputElem.classList.add("hasError");
29
+ (_a = this._messageBoxElem) === null || _a === void 0 ? void 0 : _a.classList.add("hasError");
30
+ }
31
+ else {
32
+ this._inputElem.classList.remove("hasError");
33
+ (_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove("hasError");
34
+ }
35
+ });
39
36
  }
40
37
  }
41
38
  observeMask() {
@@ -54,14 +51,16 @@ let EzTextInput = class {
54
51
  this._inputElem.value = this.value || "";
55
52
  this.handleChange();
56
53
  this.adjustFloatingLabel();
57
- if (this.slaveMode) {
58
- return;
54
+ if (!this.isSlaveMode()) {
55
+ this.errorMessage = "";
56
+ this.ezChange.emit(this.value);
59
57
  }
60
- this.errorMessage = "";
61
- this.ezChange.emit(this.value);
62
58
  }
63
59
  }
64
60
  }
61
+ //---------------------------------------------
62
+ // Private methods
63
+ //---------------------------------------------
65
64
  adjustFloatingLabel() {
66
65
  if (this.label && this._labelElem) {
67
66
  if (this._inputElem && !this._inputElem.classList.contains("input--with--label")) {
@@ -84,6 +83,10 @@ let EzTextInput = class {
84
83
  isFocused() {
85
84
  return this._hostElement.shadowRoot.activeElement !== null;
86
85
  }
86
+ isSlaveMode() {
87
+ var _a, _b;
88
+ return ((_b = (_a = this._hostElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.slaveMode) === "true";
89
+ }
87
90
  adjustColorContentSlot(color = "") {
88
91
  if (this._contentLeftSlot) {
89
92
  this._contentLeftSlot.style.color = color;
@@ -104,6 +107,12 @@ let EzTextInput = class {
104
107
  async setBlur() {
105
108
  this._inputElem.blur();
106
109
  }
110
+ /**
111
+ * Retorna informando se o campo está inválido (true | false)
112
+ */
113
+ async isInvalid() {
114
+ return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
115
+ }
107
116
  //---------------------------------------------
108
117
  // Event handlers
109
118
  //---------------------------------------------
@@ -128,7 +137,7 @@ let EzTextInput = class {
128
137
  return true;
129
138
  }
130
139
  controlChangeValue() {
131
- if ((this.value || '') !== this._inputElem.value) {
140
+ if (this._inputElem && (this.value || '') !== this._inputElem.value) {
132
141
  this.value = this._inputElem.value;
133
142
  }
134
143
  }
@@ -211,7 +220,7 @@ let EzTextInput = class {
211
220
  render() {
212
221
  return (h(Host, null, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label && this.mode != "slim" ?
213
222
  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)
214
- : null, 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(); } }), h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.canShowError && this.mode != "slim" &&
223
+ : null, 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(); } }), h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.canShowError && this.mode != "slim" &&
215
224
  h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
216
225
  }
217
226
  get _hostElement() { return getElement(this); }