@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
|
@@ -3,6 +3,7 @@ import { Component, h, Event, Prop, Element, Method, Watch } from "@stencil/core
|
|
|
3
3
|
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
4
4
|
export class EzNumberInput {
|
|
5
5
|
constructor() {
|
|
6
|
+
this._focused = false;
|
|
6
7
|
/**
|
|
7
8
|
* Deixa o campo disponível ou não para uso.
|
|
8
9
|
*/
|
|
@@ -24,66 +25,107 @@ export class EzNumberInput {
|
|
|
24
25
|
async setBlur() {
|
|
25
26
|
this._textInput.setBlur();
|
|
26
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
30
|
+
*/
|
|
31
|
+
async isInvalid() {
|
|
32
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
33
|
+
}
|
|
27
34
|
observeLabel() {
|
|
28
35
|
if (this._textInput) {
|
|
29
36
|
this._textInput.label = this.label;
|
|
30
37
|
}
|
|
31
38
|
}
|
|
32
39
|
observeErrorMessage() {
|
|
40
|
+
var _a;
|
|
33
41
|
if (this._textInput) {
|
|
34
42
|
this._textInput.errorMessage = this.errorMessage;
|
|
43
|
+
if (!((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.trim())) {
|
|
44
|
+
this.setInputValue();
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
47
|
}
|
|
37
|
-
observeValue() {
|
|
38
|
-
if (this._textInput) {
|
|
39
|
-
|
|
48
|
+
observeValue(newValue, oldValue) {
|
|
49
|
+
if (this._textInput && newValue != oldValue) {
|
|
50
|
+
const newValueValidated = this.validateValue(newValue);
|
|
51
|
+
const oldValueValidated = this.validateValue(oldValue);
|
|
52
|
+
if (newValueValidated != oldValueValidated) {
|
|
53
|
+
const textValue = this.getTextValue(newValueValidated) || '';
|
|
54
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
55
|
+
const parsedNumber = this.getParsedNumber(textValue);
|
|
56
|
+
if (parsedNumber !== undefined || !this._focused) {
|
|
57
|
+
this._textInput.value = textValue;
|
|
58
|
+
this._focused = false;
|
|
59
|
+
this.errorMessage = "";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const valueEmitted = newValueValidated === null ? undefined : newValueValidated;
|
|
63
|
+
this.ezChange.emit(valueEmitted);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
validateValue(value) {
|
|
68
|
+
return isNaN(value) || value === undefined ? null : value;
|
|
69
|
+
}
|
|
70
|
+
getTextValue(value) {
|
|
71
|
+
if (value != undefined) {
|
|
72
|
+
return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
|
|
40
73
|
}
|
|
74
|
+
return undefined;
|
|
41
75
|
}
|
|
42
76
|
changeValue(newValue) {
|
|
43
77
|
this.errorMessage = "";
|
|
44
|
-
if (
|
|
45
|
-
this.value = newValue;
|
|
46
|
-
this.ezChange.emit(this.value);
|
|
47
|
-
return true;
|
|
78
|
+
if (this.value != newValue) {
|
|
79
|
+
this.value = newValue === undefined ? null : newValue;
|
|
48
80
|
}
|
|
49
81
|
else {
|
|
50
|
-
this.
|
|
82
|
+
this.ezCancelWaitingChange.emit();
|
|
51
83
|
}
|
|
52
|
-
return false;
|
|
53
84
|
}
|
|
54
|
-
|
|
55
|
-
|
|
85
|
+
setError(msg) {
|
|
86
|
+
this.value = null;
|
|
87
|
+
this.errorMessage = msg;
|
|
88
|
+
this.ezCancelWaitingChange.emit();
|
|
89
|
+
}
|
|
90
|
+
handleBlur() {
|
|
91
|
+
const parsedNumber = this.getParsedNumber();
|
|
56
92
|
if (parsedNumber !== undefined && isNaN(parsedNumber)) {
|
|
57
|
-
this.
|
|
58
|
-
this.errorMessage = "O valor digitado não é um número válido";
|
|
93
|
+
this.setError("O valor digitado não é um número válido");
|
|
59
94
|
}
|
|
60
95
|
else {
|
|
61
96
|
try {
|
|
62
|
-
|
|
63
|
-
this.ezCancelWaitingChange.emit();
|
|
64
|
-
}
|
|
97
|
+
this.changeValue(parsedNumber);
|
|
65
98
|
}
|
|
66
99
|
catch (e) {
|
|
67
|
-
this.
|
|
68
|
-
this.errorMessage = e.message;
|
|
100
|
+
this.setError(e.message);
|
|
69
101
|
return;
|
|
70
102
|
}
|
|
71
103
|
}
|
|
72
104
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
105
|
+
handleInput() {
|
|
106
|
+
const parsedNumber = this.getParsedNumber();
|
|
107
|
+
if (parsedNumber !== this.value) {
|
|
108
|
+
this._focused = true;
|
|
109
|
+
this.ezStartChange.emit({ waitmessage: "", blocking: false });
|
|
76
110
|
}
|
|
77
|
-
return undefined;
|
|
78
111
|
}
|
|
79
|
-
|
|
80
|
-
|
|
112
|
+
getParsedNumber(value) {
|
|
113
|
+
var _a;
|
|
114
|
+
if (value === void 0) { value = (_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value; }
|
|
115
|
+
return (value === null || value === void 0 ? void 0 : value.trim()) ? NumberUtils.stringToNumber(value) : undefined;
|
|
116
|
+
}
|
|
117
|
+
setInputValue() {
|
|
118
|
+
const textValue = this.getTextValue(this.value) || '';
|
|
119
|
+
if ((this._textInput.value || '') !== textValue) {
|
|
120
|
+
this._textInput.value = textValue;
|
|
121
|
+
}
|
|
81
122
|
}
|
|
82
123
|
componentDidLoad() {
|
|
83
124
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
125
|
+
this.setInputValue();
|
|
84
126
|
}
|
|
85
127
|
render() {
|
|
86
|
-
return (h("ez-text-input", { ref: elem => this._textInput = elem,
|
|
128
|
+
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 }));
|
|
87
129
|
}
|
|
88
130
|
static get is() { return "ez-number-input"; }
|
|
89
131
|
static get encapsulation() { return "shadow"; }
|
|
@@ -299,6 +341,22 @@ export class EzNumberInput {
|
|
|
299
341
|
"text": "Remove o foco no componente de input",
|
|
300
342
|
"tags": []
|
|
301
343
|
}
|
|
344
|
+
},
|
|
345
|
+
"isInvalid": {
|
|
346
|
+
"complexType": {
|
|
347
|
+
"signature": "() => Promise<boolean>",
|
|
348
|
+
"parameters": [],
|
|
349
|
+
"references": {
|
|
350
|
+
"Promise": {
|
|
351
|
+
"location": "global"
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
"return": "Promise<boolean>"
|
|
355
|
+
},
|
|
356
|
+
"docs": {
|
|
357
|
+
"text": "Retorna informando se o campo est\u00E1 inv\u00E1lido (true | false)",
|
|
358
|
+
"tags": []
|
|
359
|
+
}
|
|
302
360
|
}
|
|
303
361
|
}; }
|
|
304
362
|
static get elementRef() { return "_elem"; }
|
|
@@ -23,6 +23,11 @@ export class EzSearch {
|
|
|
23
23
|
*/
|
|
24
24
|
this.mode = "regular";
|
|
25
25
|
}
|
|
26
|
+
observeErrorMessage() {
|
|
27
|
+
if (this._comboElement) {
|
|
28
|
+
this._comboElement.errorMessage = this.errorMessage;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
26
31
|
observeValue() {
|
|
27
32
|
if (this._comboElement) {
|
|
28
33
|
this._comboElement.value = this.value;
|
|
@@ -40,16 +45,25 @@ export class EzSearch {
|
|
|
40
45
|
async setBlur() {
|
|
41
46
|
this._comboElement.setBlur();
|
|
42
47
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
50
|
+
*/
|
|
51
|
+
async isInvalid() {
|
|
52
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
53
|
+
}
|
|
54
|
+
onComboChange(event) {
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
this.value = event.detail;
|
|
57
|
+
this.ezChange.emit(event.detail);
|
|
58
|
+
if (this.errorMessage !== this._comboElement.errorMessage) {
|
|
59
|
+
this.errorMessage = this._comboElement.errorMessage;
|
|
60
|
+
}
|
|
47
61
|
}
|
|
48
62
|
componentDidLoad() {
|
|
49
63
|
CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
|
|
50
64
|
}
|
|
51
65
|
render() {
|
|
52
|
-
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:
|
|
66
|
+
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 }));
|
|
53
67
|
}
|
|
54
68
|
;
|
|
55
69
|
static get is() { return "ez-search"; }
|
|
@@ -295,10 +309,29 @@ export class EzSearch {
|
|
|
295
309
|
"text": "Remove o foco no componente de pesquisa",
|
|
296
310
|
"tags": []
|
|
297
311
|
}
|
|
312
|
+
},
|
|
313
|
+
"isInvalid": {
|
|
314
|
+
"complexType": {
|
|
315
|
+
"signature": "() => Promise<boolean>",
|
|
316
|
+
"parameters": [],
|
|
317
|
+
"references": {
|
|
318
|
+
"Promise": {
|
|
319
|
+
"location": "global"
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"return": "Promise<boolean>"
|
|
323
|
+
},
|
|
324
|
+
"docs": {
|
|
325
|
+
"text": "Retorna informando se o campo est\u00E1 inv\u00E1lido (true | false)",
|
|
326
|
+
"tags": []
|
|
327
|
+
}
|
|
298
328
|
}
|
|
299
329
|
}; }
|
|
300
330
|
static get elementRef() { return "_elem"; }
|
|
301
331
|
static get watchers() { return [{
|
|
332
|
+
"propName": "errorMessage",
|
|
333
|
+
"methodName": "observeErrorMessage"
|
|
334
|
+
}, {
|
|
302
335
|
"propName": "value",
|
|
303
336
|
"methodName": "observeValue"
|
|
304
337
|
}]; }
|
|
@@ -67,7 +67,7 @@ textarea {
|
|
|
67
67
|
resize: none;
|
|
68
68
|
margin-top: calc(var(--space--medium, 12px) + 4px);
|
|
69
69
|
width: 100%;
|
|
70
|
-
font-weight: var(--text-weight
|
|
70
|
+
font-weight: var(--text-area--font-weight);
|
|
71
71
|
font-family: var(--text-area--font-family);
|
|
72
72
|
font-size: var(--text-area--font-size);
|
|
73
73
|
color: var(--text-area--color);
|
|
@@ -73,6 +73,12 @@ export class EzTextArea {
|
|
|
73
73
|
async setBlur() {
|
|
74
74
|
this._inputElem.blur();
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
78
|
+
*/
|
|
79
|
+
async isInvalid() {
|
|
80
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
81
|
+
}
|
|
76
82
|
//---------------------------------------------
|
|
77
83
|
// Private methods
|
|
78
84
|
//---------------------------------------------
|
|
@@ -134,7 +140,7 @@ export class EzTextArea {
|
|
|
134
140
|
this.label && this.mode != "slim" ?
|
|
135
141
|
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)
|
|
136
142
|
: null,
|
|
137
|
-
h("textarea", { onFocus: () => this.handleFocus(), ref: (el) => this._inputElem = el, value: this.value, disabled: !this.enabled, class: this.mode
|
|
143
|
+
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 })),
|
|
138
144
|
this.canShowError && this.mode != "slim" &&
|
|
139
145
|
h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
|
|
140
146
|
}
|
|
@@ -336,6 +342,22 @@ export class EzTextArea {
|
|
|
336
342
|
"text": "Remove o foco no componente de input",
|
|
337
343
|
"tags": []
|
|
338
344
|
}
|
|
345
|
+
},
|
|
346
|
+
"isInvalid": {
|
|
347
|
+
"complexType": {
|
|
348
|
+
"signature": "() => Promise<boolean>",
|
|
349
|
+
"parameters": [],
|
|
350
|
+
"references": {
|
|
351
|
+
"Promise": {
|
|
352
|
+
"location": "global"
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"return": "Promise<boolean>"
|
|
356
|
+
},
|
|
357
|
+
"docs": {
|
|
358
|
+
"text": "Retorna informando se o campo est\u00E1 inv\u00E1lido (true | false)",
|
|
359
|
+
"tags": []
|
|
360
|
+
}
|
|
339
361
|
}
|
|
340
362
|
}; }
|
|
341
363
|
static get elementRef() { return "_hostElement"; }
|
|
@@ -73,7 +73,6 @@ input {
|
|
|
73
73
|
width: 100%;
|
|
74
74
|
box-sizing: border-box;
|
|
75
75
|
padding: var(--space--medium, 6px);
|
|
76
|
-
font-weight: var(--text-weight--large, 600);
|
|
77
76
|
|
|
78
77
|
/*public*/
|
|
79
78
|
height: var(--ez-text-input--height);
|
|
@@ -84,6 +83,7 @@ input {
|
|
|
84
83
|
border-color: var(--ez-text-input__input--border-color);
|
|
85
84
|
background-color: var(--ez-text-input__input--background-color);
|
|
86
85
|
color: var(--ez-text-input--color);
|
|
86
|
+
font-weight: var(--ez-text-input--font-weight);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
input:disabled {
|
|
@@ -14,23 +14,20 @@ export class EzTextInput {
|
|
|
14
14
|
* Define o modo do tamanho do campo; opções: slim e regular.
|
|
15
15
|
*/
|
|
16
16
|
this.mode = "regular";
|
|
17
|
-
/**
|
|
18
|
-
* Define se o controle de change do value será controlado por um componente pai.
|
|
19
|
-
*/
|
|
20
|
-
this.slaveMode = false;
|
|
21
17
|
}
|
|
22
18
|
observeErrorMessage() {
|
|
23
|
-
var _a, _b;
|
|
24
19
|
if (this._inputElem) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
this.isInvalid().then((hasError) => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
if (hasError) {
|
|
23
|
+
this._inputElem.classList.add("hasError");
|
|
24
|
+
(_a = this._messageBoxElem) === null || _a === void 0 ? void 0 : _a.classList.add("hasError");
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
this._inputElem.classList.remove("hasError");
|
|
28
|
+
(_b = this._messageBoxElem) === null || _b === void 0 ? void 0 : _b.classList.remove("hasError");
|
|
29
|
+
}
|
|
30
|
+
});
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
observeMask() {
|
|
@@ -49,14 +46,16 @@ export class EzTextInput {
|
|
|
49
46
|
this._inputElem.value = this.value || "";
|
|
50
47
|
this.handleChange();
|
|
51
48
|
this.adjustFloatingLabel();
|
|
52
|
-
if (this.
|
|
53
|
-
|
|
49
|
+
if (!this.isSlaveMode()) {
|
|
50
|
+
this.errorMessage = "";
|
|
51
|
+
this.ezChange.emit(this.value);
|
|
54
52
|
}
|
|
55
|
-
this.errorMessage = "";
|
|
56
|
-
this.ezChange.emit(this.value);
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
55
|
}
|
|
56
|
+
//---------------------------------------------
|
|
57
|
+
// Private methods
|
|
58
|
+
//---------------------------------------------
|
|
60
59
|
adjustFloatingLabel() {
|
|
61
60
|
if (this.label && this._labelElem) {
|
|
62
61
|
if (this._inputElem && !this._inputElem.classList.contains("input--with--label")) {
|
|
@@ -79,6 +78,10 @@ export class EzTextInput {
|
|
|
79
78
|
isFocused() {
|
|
80
79
|
return this._hostElement.shadowRoot.activeElement !== null;
|
|
81
80
|
}
|
|
81
|
+
isSlaveMode() {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
return ((_b = (_a = this._hostElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.slaveMode) === "true";
|
|
84
|
+
}
|
|
82
85
|
adjustColorContentSlot(color = "") {
|
|
83
86
|
if (this._contentLeftSlot) {
|
|
84
87
|
this._contentLeftSlot.style.color = color;
|
|
@@ -99,6 +102,12 @@ export class EzTextInput {
|
|
|
99
102
|
async setBlur() {
|
|
100
103
|
this._inputElem.blur();
|
|
101
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Retorna informando se o campo está inválido (true | false)
|
|
107
|
+
*/
|
|
108
|
+
async isInvalid() {
|
|
109
|
+
return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
|
|
110
|
+
}
|
|
102
111
|
//---------------------------------------------
|
|
103
112
|
// Event handlers
|
|
104
113
|
//---------------------------------------------
|
|
@@ -123,7 +132,7 @@ export class EzTextInput {
|
|
|
123
132
|
return true;
|
|
124
133
|
}
|
|
125
134
|
controlChangeValue() {
|
|
126
|
-
if ((this.value || '') !== this._inputElem.value) {
|
|
135
|
+
if (this._inputElem && (this.value || '') !== this._inputElem.value) {
|
|
127
136
|
this.value = this._inputElem.value;
|
|
128
137
|
}
|
|
129
138
|
}
|
|
@@ -209,7 +218,7 @@ export class EzTextInput {
|
|
|
209
218
|
this.label && this.mode != "slim" ?
|
|
210
219
|
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)
|
|
211
220
|
: null,
|
|
212
|
-
h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", class: this.mode
|
|
221
|
+
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(); } }),
|
|
213
222
|
h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }),
|
|
214
223
|
this.canShowError && this.mode != "slim" &&
|
|
215
224
|
h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
|
|
@@ -378,24 +387,6 @@ export class EzTextInput {
|
|
|
378
387
|
"attribute": "mode",
|
|
379
388
|
"reflect": true,
|
|
380
389
|
"defaultValue": "\"regular\""
|
|
381
|
-
},
|
|
382
|
-
"slaveMode": {
|
|
383
|
-
"type": "boolean",
|
|
384
|
-
"mutable": false,
|
|
385
|
-
"complexType": {
|
|
386
|
-
"original": "boolean",
|
|
387
|
-
"resolved": "boolean",
|
|
388
|
-
"references": {}
|
|
389
|
-
},
|
|
390
|
-
"required": false,
|
|
391
|
-
"optional": false,
|
|
392
|
-
"docs": {
|
|
393
|
-
"tags": [],
|
|
394
|
-
"text": "Define se o controle de change do value ser\u00E1 controlado por um componente pai."
|
|
395
|
-
},
|
|
396
|
-
"attribute": "slave-mode",
|
|
397
|
-
"reflect": true,
|
|
398
|
-
"defaultValue": "false"
|
|
399
390
|
}
|
|
400
391
|
}; }
|
|
401
392
|
static get events() { return [{
|
|
@@ -446,6 +437,22 @@ export class EzTextInput {
|
|
|
446
437
|
"text": "Remove o foco no componente de input",
|
|
447
438
|
"tags": []
|
|
448
439
|
}
|
|
440
|
+
},
|
|
441
|
+
"isInvalid": {
|
|
442
|
+
"complexType": {
|
|
443
|
+
"signature": "() => Promise<boolean>",
|
|
444
|
+
"parameters": [],
|
|
445
|
+
"references": {
|
|
446
|
+
"Promise": {
|
|
447
|
+
"location": "global"
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
"return": "Promise<boolean>"
|
|
451
|
+
},
|
|
452
|
+
"docs": {
|
|
453
|
+
"text": "Retorna informando se o campo est\u00E1 inv\u00E1lido (true | false)",
|
|
454
|
+
"tags": []
|
|
455
|
+
}
|
|
449
456
|
}
|
|
450
457
|
}; }
|
|
451
458
|
static get elementRef() { return "_hostElement"; }
|