@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-81596.1 → 0.0.0-bugfix-dev-KB-85226.0
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-dropdown_2.cjs.entry.js → ez-dropdown.cjs.entry.js} +0 -61
- package/dist/cjs/ez-search-plus.cjs.entry.js +42 -17
- package/dist/cjs/ez-search-result-list.cjs.entry.js +2 -3
- package/dist/cjs/ez-skeleton.cjs.entry.js +67 -0
- package/dist/cjs/ez-text-input.cjs.entry.js +41 -24
- package/dist/cjs/ez-tooltip.cjs.entry.js +8 -3
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/filter-column.cjs.entry.js +0 -1
- package/dist/cjs/index-a7b0c73d.js +6 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ez-grid/subcomponents/filter-column.js +0 -1
- package/dist/collection/components/ez-search-plus/ez-search-plus.css +1 -1
- package/dist/collection/components/ez-search-plus/ez-search-plus.js +50 -22
- package/dist/collection/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.css +4 -10
- package/dist/collection/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.js +1 -2
- package/dist/collection/components/ez-text-input/ez-text-input.css +3 -1
- package/dist/collection/components/ez-text-input/ez-text-input.js +40 -23
- package/dist/collection/components/ez-tooltip/ez-tooltip.css +1 -0
- package/dist/collection/components/ez-tooltip/ez-tooltip.js +29 -6
- package/dist/custom-elements/index.js +95 -50
- package/dist/esm/{ez-dropdown_2.entry.js → ez-dropdown.entry.js} +1 -61
- package/dist/esm/ez-search-plus.entry.js +42 -17
- package/dist/esm/ez-search-result-list.entry.js +2 -3
- package/dist/esm/ez-skeleton.entry.js +63 -0
- package/dist/esm/ez-text-input.entry.js +41 -24
- package/dist/esm/ez-tooltip.entry.js +8 -3
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/filter-column.entry.js +0 -1
- package/dist/esm/index-baa5e267.js +6 -2
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-0fb509ff.entry.js +1 -0
- package/dist/ezui/p-2b4df33d.entry.js +1 -0
- package/dist/ezui/p-4cf0aaeb.entry.js +1 -0
- package/dist/ezui/p-6825bdc7.entry.js +1 -0
- package/dist/ezui/p-7742802c.entry.js +1 -0
- package/dist/ezui/p-9f356046.entry.js +1 -0
- package/dist/ezui/p-d9e4a85a.entry.js +1 -0
- package/dist/types/components/ez-search-plus/ez-search-plus.d.ts +6 -4
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +7 -2
- package/dist/types/components/ez-tooltip/ez-tooltip.d.ts +6 -2
- package/dist/types/components.d.ts +19 -11
- package/package.json +1 -1
- package/dist/ezui/p-0fa52b0f.entry.js +0 -1
- package/dist/ezui/p-2f45506d.entry.js +0 -1
- package/dist/ezui/p-3176a6ef.entry.js +0 -1
- package/dist/ezui/p-81145609.entry.js +0 -1
- package/dist/ezui/p-9142b27a.entry.js +0 -1
- package/dist/ezui/p-c5df78be.entry.js +0 -1
|
@@ -2,6 +2,7 @@ import { h, Host } from "@stencil/core";
|
|
|
2
2
|
import { ElementIDUtils, MaskFormatter } from "@sankhyalabs/core";
|
|
3
3
|
export class EzTextInput {
|
|
4
4
|
constructor() {
|
|
5
|
+
this._isOverflowing = false;
|
|
5
6
|
this.label = undefined;
|
|
6
7
|
this.value = undefined;
|
|
7
8
|
this.enabled = true;
|
|
@@ -17,29 +18,17 @@ export class EzTextInput {
|
|
|
17
18
|
this.autoFocus = false;
|
|
18
19
|
this.hasRightSlotContent = false;
|
|
19
20
|
}
|
|
20
|
-
observeHasInvalid() {
|
|
21
|
-
if (
|
|
21
|
+
observeHasInvalid(newValue, oldValue) {
|
|
22
|
+
if (newValue === oldValue) {
|
|
22
23
|
return;
|
|
23
|
-
if (this.hasInvalid) {
|
|
24
|
-
this._inputElem.classList.add("hasError");
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
this._inputElem.classList.remove("hasError");
|
|
28
24
|
}
|
|
25
|
+
this.validateErrors();
|
|
29
26
|
}
|
|
30
|
-
observeErrorMessage() {
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
if (hasError) {
|
|
34
|
-
this._inputElem.classList.add("hasError");
|
|
35
|
-
// this._tooltipPositioningObserver?.observe(this._inputElem);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
this._inputElem.classList.remove("hasError");
|
|
39
|
-
// this.removeGlobalTooltip();
|
|
40
|
-
}
|
|
41
|
-
});
|
|
27
|
+
observeErrorMessage(newValue, oldValue) {
|
|
28
|
+
if (newValue === oldValue) {
|
|
29
|
+
return;
|
|
42
30
|
}
|
|
31
|
+
this.validateErrors();
|
|
43
32
|
}
|
|
44
33
|
observeMask() {
|
|
45
34
|
if (this.mask) {
|
|
@@ -57,6 +46,7 @@ export class EzTextInput {
|
|
|
57
46
|
this._inputElem.value = this.value || "";
|
|
58
47
|
this.handleChange();
|
|
59
48
|
this.adjustFloatingLabel();
|
|
49
|
+
this.checkIsOverflowing();
|
|
60
50
|
if (!this.isSlaveMode()) {
|
|
61
51
|
this.errorMessage = "";
|
|
62
52
|
this.ezChange.emit(this.value);
|
|
@@ -67,6 +57,25 @@ export class EzTextInput {
|
|
|
67
57
|
//---------------------------------------------
|
|
68
58
|
// Private methods
|
|
69
59
|
//---------------------------------------------
|
|
60
|
+
validateErrors() {
|
|
61
|
+
const hasErrorMessage = this.handleValidateErrorMessage(this.errorMessage);
|
|
62
|
+
const hasError = hasErrorMessage || this.hasInvalid;
|
|
63
|
+
this.updateClassError(hasError);
|
|
64
|
+
}
|
|
65
|
+
handleValidateErrorMessage(message = this.errorMessage) {
|
|
66
|
+
return typeof message === "string" && message.trim() !== "";
|
|
67
|
+
}
|
|
68
|
+
updateClassError(status) {
|
|
69
|
+
if (!this._inputElem) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (status) {
|
|
73
|
+
this._inputElem.classList.add("hasError");
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this._inputElem.classList.remove("hasError");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
70
79
|
adjustFloatingLabel() {
|
|
71
80
|
if (this.label && this._labelElem) {
|
|
72
81
|
if (this._inputElem && !this._inputElem.classList.contains("input--with--label")) {
|
|
@@ -125,7 +134,7 @@ export class EzTextInput {
|
|
|
125
134
|
* Retorna se o conteúdo é inválido.
|
|
126
135
|
*/
|
|
127
136
|
async isInvalid() {
|
|
128
|
-
return
|
|
137
|
+
return this.handleValidateErrorMessage();
|
|
129
138
|
}
|
|
130
139
|
//---------------------------------------------
|
|
131
140
|
// Event handlers
|
|
@@ -236,7 +245,7 @@ export class EzTextInput {
|
|
|
236
245
|
}
|
|
237
246
|
slot.name && ElementIDUtils.addIDInfo(content, slot.name);
|
|
238
247
|
}
|
|
239
|
-
this.
|
|
248
|
+
this.validateErrors();
|
|
240
249
|
}
|
|
241
250
|
doFocus() {
|
|
242
251
|
if (this.label && this._labelElem && !this._labelElem.classList.contains("input__label--floated")) {
|
|
@@ -247,6 +256,13 @@ export class EzTextInput {
|
|
|
247
256
|
getValue() {
|
|
248
257
|
return this.mask && this.cleanValueMask ? this.applyMask(this.value) : this.value;
|
|
249
258
|
}
|
|
259
|
+
checkIsOverflowing() {
|
|
260
|
+
if (this._inputElem) {
|
|
261
|
+
this._isOverflowing = this._inputElem.offsetWidth < this._inputElem.scrollWidth;
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
this._isOverflowing = false;
|
|
265
|
+
}
|
|
250
266
|
//---------------------------------------------
|
|
251
267
|
// Lifecycle web component
|
|
252
268
|
//---------------------------------------------
|
|
@@ -274,10 +290,11 @@ export class EzTextInput {
|
|
|
274
290
|
}
|
|
275
291
|
componentDidLoad() {
|
|
276
292
|
var _a;
|
|
277
|
-
this.
|
|
293
|
+
this.validateErrors();
|
|
278
294
|
this.observeMask();
|
|
279
295
|
this.adjustFloatingLabel();
|
|
280
296
|
this.adjustBorderInput();
|
|
297
|
+
this.checkIsOverflowing();
|
|
281
298
|
if (this.autoFocus) {
|
|
282
299
|
requestAnimationFrame(() => {
|
|
283
300
|
this.setFocus({ selectText: true });
|
|
@@ -292,7 +309,7 @@ export class EzTextInput {
|
|
|
292
309
|
ElementIDUtils.addIDInfoIfNotExists(this._hostElement, 'input');
|
|
293
310
|
return (h(Host, { style: this._hostElement.classList.contains("grid_editor") ? { "height": "100%" } : null }, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label && this.mode != "slim" ?
|
|
294
311
|
h("label", { ref: (el) => this._labelElem = el, class: `${this.enabled ? "input__label" : "input__label input__label--disabled"} ${this.errorMessage ? "hasError" : ""}`, onClick: () => this._inputElem.focus(), title: this.label }, this.label)
|
|
295
|
-
: null, h("input", { "data-element-id": ElementIDUtils.getInternalIDInfo("input"), onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: this.password ? "password" : "text", class: `${this.mode === "slim" ? "input--slim" : ""}`, placeholder: this.mode === "slim" && this.label ? this.label : "", value: this.getValue(), disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), h("ez-tooltip", { anchoringElement: this._hostElement, message: this.getValue(),
|
|
312
|
+
: null, h("input", { "data-element-id": ElementIDUtils.getInternalIDInfo("input"), onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: this.password ? "password" : "text", class: `${this.mode === "slim" ? "input--slim" : ""}`, placeholder: this.mode === "slim" && this.label ? this.label : "", value: this.getValue(), disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), h("ez-tooltip", { anchoringElement: this._hostElement, message: this.getValue(), active: this._isOverflowing, useAnchorSize: true }), this.canShowError && this.mode != "slim" && this.errorMessage &&
|
|
296
313
|
h("ez-tooltip", { type: "error", message: this.errorMessage }, h("ez-icon", { class: `tooltip-icon ${this.errorMessage ? "hasError" : ""} ${this.hasRightSlotContent ? "rightIconSlot" : ""}`, "data-element-id": ElementIDUtils.getInternalIDInfo("tooltip-icon"), ref: (el) => this._tooltipIconElem = el, iconName: "alert-circle" })), h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }, " ")));
|
|
297
314
|
}
|
|
298
315
|
static get is() { return "ez-text-input"; }
|
|
@@ -11,7 +11,8 @@ export class EzTooltip {
|
|
|
11
11
|
this.type = 'default';
|
|
12
12
|
this.debouncingTime = 500;
|
|
13
13
|
this.active = true;
|
|
14
|
-
this.
|
|
14
|
+
this.maxWidth = 200;
|
|
15
|
+
this.useAnchorSize = false;
|
|
15
16
|
}
|
|
16
17
|
watchAnchoringElement(newValue, oldValue) {
|
|
17
18
|
if (newValue) {
|
|
@@ -47,6 +48,10 @@ export class EzTooltip {
|
|
|
47
48
|
if (!element || !this._opened) {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
51
|
+
if (this.useAnchorSize) {
|
|
52
|
+
const anchorSize = element.getBoundingClientRect().width;
|
|
53
|
+
this._tooltipElement.style.width = `${anchorSize}px`;
|
|
54
|
+
}
|
|
50
55
|
await computePosition(element, this._tooltipElement, {
|
|
51
56
|
placement: this.placement,
|
|
52
57
|
middleware: [
|
|
@@ -108,7 +113,7 @@ export class EzTooltip {
|
|
|
108
113
|
"tooltip": true,
|
|
109
114
|
[`${this.type}-tooltip`]: true,
|
|
110
115
|
}, style: {
|
|
111
|
-
|
|
116
|
+
maxWidth: (this.maxWidth && !this.useAnchorSize) ? `${this.maxWidth}px` : undefined,
|
|
112
117
|
}, role: "tooltip", "data-element-id": ElementIDUtils.getInternalIDInfo("tooltip") }), this.message, h("div", { ref: ref => this._arrowElement = ref, class: "arrow" })), h("slot", { onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
|
|
113
118
|
}
|
|
114
119
|
static get is() { return "ez-tooltip"; }
|
|
@@ -254,7 +259,7 @@ export class EzTooltip {
|
|
|
254
259
|
"reflect": false,
|
|
255
260
|
"defaultValue": "true"
|
|
256
261
|
},
|
|
257
|
-
"
|
|
262
|
+
"maxWidth": {
|
|
258
263
|
"type": "number",
|
|
259
264
|
"mutable": false,
|
|
260
265
|
"complexType": {
|
|
@@ -266,11 +271,29 @@ export class EzTooltip {
|
|
|
266
271
|
"optional": false,
|
|
267
272
|
"docs": {
|
|
268
273
|
"tags": [],
|
|
269
|
-
"text": "Define a largura m\
|
|
274
|
+
"text": "Define a largura m\u00E1xima do elemento."
|
|
275
|
+
},
|
|
276
|
+
"attribute": "max-width",
|
|
277
|
+
"reflect": false,
|
|
278
|
+
"defaultValue": "200"
|
|
279
|
+
},
|
|
280
|
+
"useAnchorSize": {
|
|
281
|
+
"type": "boolean",
|
|
282
|
+
"mutable": false,
|
|
283
|
+
"complexType": {
|
|
284
|
+
"original": "boolean",
|
|
285
|
+
"resolved": "boolean",
|
|
286
|
+
"references": {}
|
|
287
|
+
},
|
|
288
|
+
"required": false,
|
|
289
|
+
"optional": false,
|
|
290
|
+
"docs": {
|
|
291
|
+
"tags": [],
|
|
292
|
+
"text": "Define se o elemento manter\u00E1 o mesmo tamanho do componente de ancora."
|
|
270
293
|
},
|
|
271
|
-
"attribute": "
|
|
294
|
+
"attribute": "use-anchor-size",
|
|
272
295
|
"reflect": false,
|
|
273
|
-
"defaultValue": "
|
|
296
|
+
"defaultValue": "false"
|
|
274
297
|
}
|
|
275
298
|
};
|
|
276
299
|
}
|