@sankhyalabs/ezui 1.1.64 → 1.1.68
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-button_16.cjs.entry.js +44 -52
- package/dist/cjs/ez-number-input.cjs.entry.js +9 -9
- package/dist/cjs/ez-popover.cjs.entry.js +10 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +6 -6
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-button/ez-button.css +45 -41
- package/dist/collection/components/ez-button/ez-button.js +2 -2
- package/dist/collection/components/ez-check/ez-check.css +78 -78
- package/dist/collection/components/ez-check/ez-check.js +1 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +4 -4
- package/dist/collection/components/ez-date-input/ez-date-input.js +8 -8
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +2 -2
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +6 -6
- package/dist/collection/components/ez-icon/ez-icon.css +3 -1
- package/dist/collection/components/ez-icon/ez-icon.js +5 -3
- package/dist/collection/components/ez-number-input/ez-number-input.js +11 -11
- package/dist/collection/components/ez-numeric-input/ez-numeric-input.js +7 -7
- package/dist/collection/components/ez-popover/ez-popover.css +1 -1
- package/dist/collection/components/ez-popover/ez-popover.js +26 -1
- package/dist/collection/components/ez-search/ez-search.js +3 -3
- package/dist/collection/components/ez-text-area/ez-text-area.js +5 -5
- package/dist/collection/components/ez-text-input/ez-text-input.css +60 -60
- package/dist/collection/components/ez-text-input/ez-text-input.js +11 -35
- package/dist/collection/components/ez-time-input/ez-time-input.js +8 -8
- package/dist/custom-elements/index.js +77 -76
- package/dist/esm/ez-button_16.entry.js +44 -52
- package/dist/esm/ez-number-input.entry.js +9 -9
- package/dist/esm/ez-popover.entry.js +11 -2
- package/dist/esm/ez-time-input.entry.js +6 -6
- 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-d8a47f23.entry.js → p-74e4415e.entry.js} +1 -1
- package/dist/ezui/p-7d066b1c.entry.js +1 -0
- package/dist/ezui/p-ee5058c1.entry.js +1 -0
- package/dist/ezui/{p-7f528c19.entry.js → p-f7d7fb7f.entry.js} +1 -1
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -1
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +1 -1
- package/dist/types/components/ez-icon/ez-icon.d.ts +6 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +1 -1
- package/dist/types/components/ez-numeric-input/ez-numeric-input.d.ts +1 -1
- package/dist/types/components/ez-popover/ez-popover.d.ts +6 -0
- package/dist/types/components/ez-search/ez-search.d.ts +1 -1
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +1 -1
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +1 -5
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +1 -1
- package/dist/types/components.d.ts +32 -24
- package/package.json +2 -1
- package/dist/ezui/p-171bdc12.entry.js +0 -1
- package/dist/ezui/p-46275da0.entry.js +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Component, Prop, h, Watch, Host, Method, Event, Element } from '@stencil/core';
|
|
2
|
-
import { isValidNumber } from '../../utils/utils';
|
|
3
2
|
import { MaskFormatter } from '@sankhyalabs/core';
|
|
4
3
|
export class EzTextInput {
|
|
5
4
|
constructor() {
|
|
@@ -9,7 +8,7 @@ export class EzTextInput {
|
|
|
9
8
|
this.enabled = true;
|
|
10
9
|
}
|
|
11
10
|
showError() {
|
|
12
|
-
const hasError = typeof this.
|
|
11
|
+
const hasError = typeof this.errorMessage === 'string' && this.errorMessage !== '';
|
|
13
12
|
if (hasError) {
|
|
14
13
|
this._inputElem.classList.add('hasError');
|
|
15
14
|
this._messageBoxElem.classList.add('hasError');
|
|
@@ -84,16 +83,13 @@ export class EzTextInput {
|
|
|
84
83
|
this._inputElem.value = this._maskFormatter.format(value);
|
|
85
84
|
}
|
|
86
85
|
catch (e) {
|
|
87
|
-
this.
|
|
86
|
+
this.errorMessage = e.message;
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
this.value = this._inputElem.value;
|
|
91
90
|
this.adjustFloatingLabel();
|
|
92
91
|
}
|
|
93
92
|
isValidValue(value) {
|
|
94
|
-
if (this.onlynumber) {
|
|
95
|
-
return value == "" || isValidNumber(value);
|
|
96
|
-
}
|
|
97
93
|
if (this.restrict) {
|
|
98
94
|
return Array.from(value).reduce((valid, c) => valid && this.restrict.indexOf(c) > -1, true);
|
|
99
95
|
}
|
|
@@ -122,11 +118,11 @@ export class EzTextInput {
|
|
|
122
118
|
content.style.justifyContent = "center";
|
|
123
119
|
content.style.overflow = "hidden";
|
|
124
120
|
content.style.top = "0px";
|
|
125
|
-
content.style.width = "var(--
|
|
126
|
-
content.style.height = "var(--
|
|
121
|
+
content.style.width = "var(--text-input__icon--width)";
|
|
122
|
+
content.style.height = "var(--text-input--height)";
|
|
127
123
|
if (slot.name == "leftIcon") {
|
|
128
124
|
content.style.left = "0px";
|
|
129
|
-
content.style.borderRadius = "var(--
|
|
125
|
+
content.style.borderRadius = "var(--text-input--border-radius) 0 0 var(--text-input--border-radius)";
|
|
130
126
|
this._inputElem.classList.add('icon--left');
|
|
131
127
|
if (this._labelElem) {
|
|
132
128
|
this._labelElem.classList.add('input__label--left');
|
|
@@ -134,7 +130,7 @@ export class EzTextInput {
|
|
|
134
130
|
}
|
|
135
131
|
else if (slot.name == "rightIcon") {
|
|
136
132
|
content.style.right = "0px";
|
|
137
|
-
content.style.borderRadius = "0 var(--
|
|
133
|
+
content.style.borderRadius = "0 var(--text-input--border-radius) var(--text-input--border-radius) 0";
|
|
138
134
|
this._inputElem.classList.add('icon--right');
|
|
139
135
|
if (this._labelElem) {
|
|
140
136
|
this._labelElem.classList.add('input__label--right');
|
|
@@ -152,9 +148,6 @@ export class EzTextInput {
|
|
|
152
148
|
// Lifecycle web component
|
|
153
149
|
//---------------------------------------------
|
|
154
150
|
componentDidLoad() {
|
|
155
|
-
if (this.onlynumber) {
|
|
156
|
-
this._inputElem.classList.add('text--right');
|
|
157
|
-
}
|
|
158
151
|
this.showError();
|
|
159
152
|
this.prepareMask();
|
|
160
153
|
this.adjustFloatingLabel();
|
|
@@ -167,7 +160,7 @@ export class EzTextInput {
|
|
|
167
160
|
this.value = this._maskFormatter.format(this.value);
|
|
168
161
|
}
|
|
169
162
|
catch (e) {
|
|
170
|
-
this.
|
|
163
|
+
this.errorMessage = e.message;
|
|
171
164
|
}
|
|
172
165
|
}
|
|
173
166
|
if (!this.isValidValue(this.value)) {
|
|
@@ -184,7 +177,7 @@ export class EzTextInput {
|
|
|
184
177
|
: null,
|
|
185
178
|
h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }),
|
|
186
179
|
h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }),
|
|
187
|
-
h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.
|
|
180
|
+
h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
|
|
188
181
|
}
|
|
189
182
|
static get is() { return "ez-text-input"; }
|
|
190
183
|
static get encapsulation() { return "shadow"; }
|
|
@@ -264,7 +257,7 @@ export class EzTextInput {
|
|
|
264
257
|
"attribute": "loading",
|
|
265
258
|
"reflect": true
|
|
266
259
|
},
|
|
267
|
-
"
|
|
260
|
+
"errorMessage": {
|
|
268
261
|
"type": "string",
|
|
269
262
|
"mutable": true,
|
|
270
263
|
"complexType": {
|
|
@@ -278,24 +271,7 @@ export class EzTextInput {
|
|
|
278
271
|
"tags": [],
|
|
279
272
|
"text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio"
|
|
280
273
|
},
|
|
281
|
-
"attribute": "
|
|
282
|
-
"reflect": true
|
|
283
|
-
},
|
|
284
|
-
"onlynumber": {
|
|
285
|
-
"type": "boolean",
|
|
286
|
-
"mutable": false,
|
|
287
|
-
"complexType": {
|
|
288
|
-
"original": "boolean",
|
|
289
|
-
"resolved": "boolean",
|
|
290
|
-
"references": {}
|
|
291
|
-
},
|
|
292
|
-
"required": false,
|
|
293
|
-
"optional": false,
|
|
294
|
-
"docs": {
|
|
295
|
-
"tags": [],
|
|
296
|
-
"text": "Faz com que o componente s\u00F3 aceite n\u00FAmeros"
|
|
297
|
-
},
|
|
298
|
-
"attribute": "onlynumber",
|
|
274
|
+
"attribute": "error-message",
|
|
299
275
|
"reflect": true
|
|
300
276
|
},
|
|
301
277
|
"mask": {
|
|
@@ -385,7 +361,7 @@ export class EzTextInput {
|
|
|
385
361
|
}; }
|
|
386
362
|
static get elementRef() { return "_hostElement"; }
|
|
387
363
|
static get watchers() { return [{
|
|
388
|
-
"propName": "
|
|
364
|
+
"propName": "errorMessage",
|
|
389
365
|
"methodName": "showError"
|
|
390
366
|
}, {
|
|
391
367
|
"propName": "mask",
|
|
@@ -12,7 +12,7 @@ export class EzTimeInput {
|
|
|
12
12
|
this.showSeconds = false;
|
|
13
13
|
}
|
|
14
14
|
showError() {
|
|
15
|
-
const hasError = typeof this.
|
|
15
|
+
const hasError = typeof this.errorMessage === 'string' && this.errorMessage !== '';
|
|
16
16
|
if (hasError) {
|
|
17
17
|
this._inputElem.classList.add('hasError');
|
|
18
18
|
this._messageBoxElem.classList.add('hasError');
|
|
@@ -88,11 +88,11 @@ export class EzTimeInput {
|
|
|
88
88
|
// Event handlers
|
|
89
89
|
//---------------------------------------------
|
|
90
90
|
handleFocusout() {
|
|
91
|
-
this.
|
|
91
|
+
this.errorMessage = "";
|
|
92
92
|
this.prepareValue(this.viewValue);
|
|
93
93
|
if (!TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
|
|
94
94
|
this.clearField();
|
|
95
|
-
this.
|
|
95
|
+
this.errorMessage = "Favor inserir um horário válido.";
|
|
96
96
|
}
|
|
97
97
|
this.adjustFloatingLabel();
|
|
98
98
|
}
|
|
@@ -102,7 +102,7 @@ export class EzTimeInput {
|
|
|
102
102
|
}
|
|
103
103
|
catch (e) {
|
|
104
104
|
this.clearField();
|
|
105
|
-
this.
|
|
105
|
+
this.errorMessage = e.message;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
clearField() {
|
|
@@ -163,7 +163,7 @@ export class EzTimeInput {
|
|
|
163
163
|
h("label", { onClick: () => this._inputElem.focus(), class: this.value ? "input__label input__label--floated" : "input__label", ref: (el) => this._labelElem = el, title: this.label }, this.label)
|
|
164
164
|
: null,
|
|
165
165
|
h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", value: this.viewValue, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }),
|
|
166
|
-
h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el }, this.
|
|
166
|
+
h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el }, this.errorMessage)));
|
|
167
167
|
}
|
|
168
168
|
static get is() { return "ez-time-input"; }
|
|
169
169
|
static get encapsulation() { return "shadow"; }
|
|
@@ -243,7 +243,7 @@ export class EzTimeInput {
|
|
|
243
243
|
"reflect": true,
|
|
244
244
|
"defaultValue": "true"
|
|
245
245
|
},
|
|
246
|
-
"
|
|
246
|
+
"errorMessage": {
|
|
247
247
|
"type": "string",
|
|
248
248
|
"mutable": true,
|
|
249
249
|
"complexType": {
|
|
@@ -257,7 +257,7 @@ export class EzTimeInput {
|
|
|
257
257
|
"tags": [],
|
|
258
258
|
"text": "Quando h\u00E1 um problema de valida\u00E7\u00E3o, serve como orienta\u00E7\u00E3o ao usu\u00E1rio"
|
|
259
259
|
},
|
|
260
|
-
"attribute": "
|
|
260
|
+
"attribute": "error-message",
|
|
261
261
|
"reflect": true
|
|
262
262
|
},
|
|
263
263
|
"showSeconds": {
|
|
@@ -314,7 +314,7 @@ export class EzTimeInput {
|
|
|
314
314
|
}
|
|
315
315
|
}; }
|
|
316
316
|
static get watchers() { return [{
|
|
317
|
-
"propName": "
|
|
317
|
+
"propName": "errorMessage",
|
|
318
318
|
"methodName": "showError"
|
|
319
319
|
}, {
|
|
320
320
|
"propName": "showSeconds",
|