@sankhyalabs/ezui 1.1.69 → 1.1.72
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/assets/actions-sprite.svg +257 -0
- package/dist/cjs/CSSVarsUtils-f8827674.js +18 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-button_16.cjs.entry.js +101 -97
- package/dist/cjs/ez-dialog.cjs.entry.js +5 -2
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal.cjs.entry.js +16 -69
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +14 -15
- package/dist/cjs/ez-popup.cjs.entry.js +2 -2
- package/dist/cjs/ez-time-input.cjs.entry.js +7 -70
- package/dist/cjs/ez-toast.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +2 -2
- package/dist/cjs/{index-0f668cc5.js → index-bb6cdd1a.js} +5 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/assets/actions-sprite.svg +257 -0
- package/dist/collection/components/ez-button/ez-button.css +8 -4
- package/dist/collection/components/ez-button/ez-button.js +5 -2
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +46 -44
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +34 -35
- package/dist/collection/components/ez-date-input/ez-date-input.css +0 -9
- package/dist/collection/components/ez-date-input/ez-date-input.js +5 -1
- package/dist/collection/components/ez-dialog/ez-dialog.css +43 -43
- package/dist/collection/components/ez-dialog/ez-dialog.js +5 -2
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +1 -1
- package/dist/collection/components/ez-modal/ez-modal.js +27 -80
- package/dist/collection/components/ez-popover/ez-popover.css +4 -5
- package/dist/collection/components/ez-popover/ez-popover.js +25 -26
- package/dist/collection/components/ez-popup/ez-popup.css +5 -5
- package/dist/collection/components/ez-popup/ez-popup.js +1 -1
- package/dist/collection/components/ez-search/ez-search.js +1 -1
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +7 -10
- package/dist/collection/components/ez-tabselector/ez-tabselector.js +67 -69
- package/dist/collection/components/ez-time-input/ez-time-input.css +0 -168
- package/dist/collection/components/ez-time-input/ez-time-input.js +8 -75
- package/dist/collection/utils/CSSVarsUtils.js +14 -0
- package/dist/custom-elements/index.js +157 -254
- package/dist/esm/CSSVarsUtils-e0128b01.js +16 -0
- package/dist/esm/ez-action-chip.entry.js +1 -1
- package/dist/esm/ez-button_16.entry.js +101 -97
- package/dist/esm/ez-dialog.entry.js +5 -2
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-modal.entry.js +16 -69
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +14 -15
- package/dist/esm/ez-popup.entry.js +2 -2
- package/dist/esm/ez-time-input.entry.js +7 -70
- package/dist/esm/ez-toast.entry.js +1 -1
- package/dist/esm/ezui.js +2 -2
- package/dist/esm/{index-89fc9bfd.js → index-989e6e7d.js} +5 -1
- package/dist/esm/loader.js +2 -2
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-762ac7a0.js → p-384f89f7.js} +1 -1
- package/dist/ezui/p-55003571.entry.js +1 -0
- package/dist/ezui/p-5c5ba099.entry.js +1 -0
- package/dist/ezui/p-65ea9879.entry.js +1 -0
- package/dist/ezui/{p-9702db61.entry.js → p-889030b3.entry.js} +1 -1
- package/dist/ezui/{p-8d547517.entry.js → p-8b945611.entry.js} +1 -1
- package/dist/ezui/p-a6a87bc5.entry.js +1 -0
- package/dist/ezui/p-d01bcce1.entry.js +1 -0
- package/dist/ezui/p-d1889704.js +1 -0
- package/dist/ezui/{p-74e4415e.entry.js → p-e2533df1.entry.js} +1 -1
- package/dist/ezui/p-edcc9e6f.entry.js +1 -0
- package/dist/ezui/{p-1c33a56d.entry.js → p-f8f92f68.entry.js} +1 -1
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +5 -5
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +1 -0
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +4 -1
- package/dist/types/components/ez-modal/ez-modal.d.ts +7 -7
- package/dist/types/components/ez-popover/ez-popover.d.ts +4 -5
- package/dist/types/components/ez-popup/ez-popup.d.ts +1 -1
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +19 -10
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +1 -8
- package/dist/types/components.d.ts +56 -35
- package/dist/types/utils/CSSVarsUtils.d.ts +4 -0
- package/package.json +1 -1
- package/dist/ezui/p-169d99a1.entry.js +0 -1
- package/dist/ezui/p-7c7dbfcb.entry.js +0 -1
- package/dist/ezui/p-8c8f1c00.entry.js +0 -1
- package/dist/ezui/p-d185d7e8.entry.js +0 -1
- package/dist/ezui/p-ee5058c1.entry.js +0 -1
- package/dist/ezui/p-f7d7fb7f.entry.js +0 -1
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
import { Component, Event, Element, h, Prop, Host } from
|
|
1
|
+
import { Component, Event, Element, h, Prop, Host } from "@stencil/core";
|
|
2
2
|
export class EzTabselector {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.
|
|
5
|
-
if (ev.key ===
|
|
6
|
-
this.
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
9
|
-
this.handleTabClick(this.
|
|
4
|
+
this.setFocusedParam = (ev) => {
|
|
5
|
+
if (ev.key === "Enter") {
|
|
6
|
+
this.selectedIndex = this.focusedIndex;
|
|
7
|
+
this.focusedIndex = undefined;
|
|
8
|
+
this.selectedTab = this._processedTabs[this.selectedIndex]["tabKey"];
|
|
9
|
+
this.handleTabClick(this.selectedTab, parseInt(this.selectedIndex));
|
|
10
10
|
ev.preventDefault();
|
|
11
|
-
this.setFocusedTab(this.
|
|
11
|
+
this.setFocusedTab(this.selectedIndex);
|
|
12
12
|
}
|
|
13
|
-
else if (ev.key ===
|
|
13
|
+
else if (ev.key === "ArrowLeft" || ev.key === "ArrowRight") {
|
|
14
14
|
let operator = undefined;
|
|
15
|
-
if (ev.key ===
|
|
15
|
+
if (ev.key === "ArrowLeft") {
|
|
16
16
|
operator = false;
|
|
17
17
|
}
|
|
18
|
-
else if (ev.key ===
|
|
18
|
+
else if (ev.key === "ArrowRight") {
|
|
19
19
|
operator = true;
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
if (this.
|
|
24
|
+
if (this.focusedIndex === undefined) {
|
|
25
25
|
if (operator === false) {
|
|
26
|
-
this.
|
|
26
|
+
this.focusedIndex = this.selectedIndex !== undefined ? (parseInt(this.selectedIndex) - 1).toString() : undefined;
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
this.
|
|
29
|
+
this.focusedIndex = this.selectedIndex !== undefined ? (parseInt(this.selectedIndex) + 1).toString() : undefined;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
33
|
if (operator === false) {
|
|
34
|
-
this.
|
|
34
|
+
this.focusedIndex = (parseInt(this.focusedIndex) - 1).toString();
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
this.
|
|
37
|
+
this.focusedIndex = (parseInt(this.focusedIndex) + 1).toString();
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
if (parseInt(this.
|
|
41
|
-
this.
|
|
40
|
+
if (parseInt(this.focusedIndex) < 0) {
|
|
41
|
+
this.focusedIndex = "0";
|
|
42
42
|
}
|
|
43
|
-
else if (parseInt(this.
|
|
44
|
-
this.
|
|
43
|
+
else if (parseInt(this.focusedIndex) > this._processedTabs.length - 1) {
|
|
44
|
+
this.focusedIndex = (this._processedTabs.length - 1).toString();
|
|
45
45
|
}
|
|
46
|
-
this.
|
|
47
|
-
this.setFocusedTab(this.
|
|
48
|
-
this.
|
|
46
|
+
this.setFocusedBtn(true, this.focusedIndex);
|
|
47
|
+
this.setFocusedTab(this.focusedIndex);
|
|
48
|
+
this.ezChange.emit();
|
|
49
49
|
}
|
|
50
|
-
else if (ev.key ===
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
this.handleTabClick(this.
|
|
50
|
+
else if (ev.key === "Tab" || ev.key === "Escape") {
|
|
51
|
+
this.focusedIndex = undefined;
|
|
52
|
+
this.selectedTab = this._processedTabs[this.selectedIndex]["tabKey"];
|
|
53
|
+
this.handleTabClick(this.selectedTab, parseInt(this.selectedIndex));
|
|
54
54
|
ev.preventDefault();
|
|
55
|
-
this.setFocusedTab(this.
|
|
55
|
+
this.setFocusedTab(this.selectedIndex);
|
|
56
56
|
}
|
|
57
57
|
// this.setFocusedTab();
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
handleTabClick(tab, index) {
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
61
|
+
this.selectedIndex = index.toString();
|
|
62
|
+
this.focusedIndex = undefined;
|
|
63
|
+
this.selectedTab = tab;
|
|
64
|
+
this.ezChange.emit();
|
|
65
|
+
this.setFocusedBtn(false, this.selectedIndex);
|
|
66
66
|
}
|
|
67
67
|
componentWillRender() {
|
|
68
68
|
if (!this._processedTabs) {
|
|
69
69
|
this._processedTabs = [];
|
|
70
70
|
if (this.tabs) {
|
|
71
|
-
this.tabs.split(
|
|
71
|
+
this.tabs.split(",").forEach((label) => {
|
|
72
72
|
label = label.trim();
|
|
73
73
|
this._processedTabs.push(new Tab(label, label));
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
this._hostElem.querySelectorAll(
|
|
77
|
-
const tabKey = elem.getAttribute(
|
|
78
|
-
const label = elem.getAttribute(
|
|
76
|
+
this._hostElem.querySelectorAll("ez-tab").forEach((elem) => {
|
|
77
|
+
const tabKey = elem.getAttribute("tabKey");
|
|
78
|
+
const label = elem.getAttribute("label");
|
|
79
79
|
const t = new Tab(label, tabKey);
|
|
80
80
|
const content = elem.firstChild;
|
|
81
81
|
if (content) {
|
|
82
|
-
content.setAttribute(
|
|
82
|
+
content.setAttribute("slot", "tab" + this._processedTabs.length);
|
|
83
83
|
this._hostElem.appendChild(content);
|
|
84
84
|
}
|
|
85
85
|
this._processedTabs.push(t);
|
|
@@ -103,7 +103,7 @@ export class EzTabselector {
|
|
|
103
103
|
const container = this._scrollContainer;
|
|
104
104
|
if (container) {
|
|
105
105
|
let lastTab = null;
|
|
106
|
-
container.querySelectorAll(
|
|
106
|
+
container.querySelectorAll(".tab").forEach((tab) => {
|
|
107
107
|
if (tab.getBoundingClientRect().right < container.clientWidth) {
|
|
108
108
|
lastTab = tab;
|
|
109
109
|
}
|
|
@@ -122,18 +122,18 @@ export class EzTabselector {
|
|
|
122
122
|
this._startHidden = container.scrollLeft > 0;
|
|
123
123
|
this._endHidden = remainingScroll > 0;
|
|
124
124
|
if (this._startHidden) {
|
|
125
|
-
this._backwardButton.classList.remove(
|
|
125
|
+
this._backwardButton.classList.remove("hidden");
|
|
126
126
|
}
|
|
127
127
|
else {
|
|
128
|
-
this._backwardButton.classList.add(
|
|
128
|
+
this._backwardButton.classList.add("hidden");
|
|
129
129
|
}
|
|
130
130
|
if (this._endHidden) {
|
|
131
|
-
this._forwardButton.classList.remove(
|
|
131
|
+
this._forwardButton.classList.remove("hidden");
|
|
132
132
|
}
|
|
133
133
|
else {
|
|
134
|
-
this._forwardButton.classList.add(
|
|
134
|
+
this._forwardButton.classList.add("hidden");
|
|
135
135
|
}
|
|
136
|
-
const classNames = [
|
|
136
|
+
const classNames = ["", "startHidden", "endHidden", "midle"];
|
|
137
137
|
const currentClass = classNames[Number(this._startHidden) | Number(this._endHidden) << 1];
|
|
138
138
|
classNames.forEach((name) => {
|
|
139
139
|
if (name !== currentClass && container.classList.contains(name)) {
|
|
@@ -150,11 +150,9 @@ export class EzTabselector {
|
|
|
150
150
|
this._scrollCallBack = window.setTimeout(() => { this.updateScroll(); }, 200);
|
|
151
151
|
}
|
|
152
152
|
setFocusedTab(index) {
|
|
153
|
-
window.clearTimeout(this.
|
|
154
|
-
this.
|
|
153
|
+
window.clearTimeout(this._scrollCallBackTest);
|
|
154
|
+
this._scrollCallBackTest = window.setTimeout(() => {
|
|
155
155
|
const tabtoscroll = this._scrollContainer.querySelector(`#tab${index}`);
|
|
156
|
-
console.log('tabtoscroll => ID', `#tab${this.selectedindex}`);
|
|
157
|
-
console.log('tabtoscroll', tabtoscroll);
|
|
158
156
|
tabtoscroll.scrollIntoView();
|
|
159
157
|
}, 200);
|
|
160
158
|
}
|
|
@@ -163,16 +161,16 @@ export class EzTabselector {
|
|
|
163
161
|
this._textMesurement = this._hostElem.shadowRoot.ownerDocument.createElement("canvas");
|
|
164
162
|
}
|
|
165
163
|
const context = this._textMesurement.getContext("2d");
|
|
166
|
-
context.font =
|
|
167
|
-
return Math.min(220, 24 + context.measureText(text).width) +
|
|
164
|
+
context.font = "14px Sora, Algerian";
|
|
165
|
+
return Math.min(220, 24 + context.measureText(text).width) + "px";
|
|
168
166
|
}
|
|
169
167
|
;
|
|
170
|
-
|
|
171
|
-
const tabsButtons = this._scrollContainer.querySelectorAll(
|
|
168
|
+
setFocusedBtn(visible, parameter) {
|
|
169
|
+
const tabsButtons = this._scrollContainer.querySelectorAll(".tab");
|
|
172
170
|
tabsButtons.forEach((el) => {
|
|
173
|
-
el.classList.remove(
|
|
174
|
-
if (el.id ===
|
|
175
|
-
el.classList.add(
|
|
171
|
+
el.classList.remove("is-focused");
|
|
172
|
+
if (el.id === "tab" + parameter && visible) {
|
|
173
|
+
el.classList.add("is-focused");
|
|
176
174
|
}
|
|
177
175
|
;
|
|
178
176
|
});
|
|
@@ -180,13 +178,13 @@ export class EzTabselector {
|
|
|
180
178
|
render() {
|
|
181
179
|
return (h(Host, null,
|
|
182
180
|
h("button", { class: "backward-button", ref: (el) => this._backwardButton = el, onClick: () => this.scrollBackward() }),
|
|
183
|
-
h("div", { class: "scroll", ref: (el) => this._scrollContainer = el, onScroll: () => this.domScrollHandler(), onKeyDown: (ev) => this.
|
|
184
|
-
const labelStyle = {
|
|
181
|
+
h("div", { class: "scroll", ref: (el) => this._scrollContainer = el, onScroll: () => this.domScrollHandler(), onKeyDown: (ev) => this.setFocusedParam(ev) }, this._processedTabs.map((tab, index) => {
|
|
182
|
+
const labelStyle = { "min-width": this.getTextWidth(tab.label) };
|
|
185
183
|
const tabId = "tab" + index;
|
|
186
|
-
const isSelected = index === parseInt(this.
|
|
184
|
+
const isSelected = index === parseInt(this.selectedIndex) || (this.selectedTab && tab.tabKey === this.selectedTab);
|
|
187
185
|
if (isSelected) {
|
|
188
|
-
this.
|
|
189
|
-
this.
|
|
186
|
+
this.selectedTab = tab.tabKey;
|
|
187
|
+
this.selectedIndex = index.toString();
|
|
190
188
|
}
|
|
191
189
|
return h("button", { id: tabId, class: `tab${isSelected ? " is-active" : ""}`, onClick: () => this.handleTabClick(tab.tabKey, index), style: labelStyle },
|
|
192
190
|
h("span", { class: "tab-label", title: tab.label }, tab.label),
|
|
@@ -203,7 +201,7 @@ export class EzTabselector {
|
|
|
203
201
|
"$": ["ez-tabselector.css"]
|
|
204
202
|
}; }
|
|
205
203
|
static get properties() { return {
|
|
206
|
-
"
|
|
204
|
+
"selectedIndex": {
|
|
207
205
|
"type": "string",
|
|
208
206
|
"mutable": true,
|
|
209
207
|
"complexType": {
|
|
@@ -215,12 +213,12 @@ export class EzTabselector {
|
|
|
215
213
|
"optional": false,
|
|
216
214
|
"docs": {
|
|
217
215
|
"tags": [],
|
|
218
|
-
"text": ""
|
|
216
|
+
"text": "Define o index da aba selecionada."
|
|
219
217
|
},
|
|
220
|
-
"attribute": "
|
|
218
|
+
"attribute": "selected-index",
|
|
221
219
|
"reflect": true
|
|
222
220
|
},
|
|
223
|
-
"
|
|
221
|
+
"selectedTab": {
|
|
224
222
|
"type": "string",
|
|
225
223
|
"mutable": true,
|
|
226
224
|
"complexType": {
|
|
@@ -232,9 +230,9 @@ export class EzTabselector {
|
|
|
232
230
|
"optional": false,
|
|
233
231
|
"docs": {
|
|
234
232
|
"tags": [],
|
|
235
|
-
"text": ""
|
|
233
|
+
"text": "Define a aba selecionada."
|
|
236
234
|
},
|
|
237
|
-
"attribute": "
|
|
235
|
+
"attribute": "selected-tab",
|
|
238
236
|
"reflect": true
|
|
239
237
|
},
|
|
240
238
|
"tabs": {
|
|
@@ -249,15 +247,15 @@ export class EzTabselector {
|
|
|
249
247
|
"optional": false,
|
|
250
248
|
"docs": {
|
|
251
249
|
"tags": [],
|
|
252
|
-
"text": ""
|
|
250
|
+
"text": "Define o nome das abas do componente, separadas por v\u00EDrgulas \",\"."
|
|
253
251
|
},
|
|
254
252
|
"attribute": "tabs",
|
|
255
253
|
"reflect": false
|
|
256
254
|
}
|
|
257
255
|
}; }
|
|
258
256
|
static get events() { return [{
|
|
259
|
-
"method": "
|
|
260
|
-
"name": "
|
|
257
|
+
"method": "ezChange",
|
|
258
|
+
"name": "ezChange",
|
|
261
259
|
"bubbles": true,
|
|
262
260
|
"cancelable": true,
|
|
263
261
|
"composed": true,
|
|
@@ -1,53 +1,4 @@
|
|
|
1
1
|
:host {
|
|
2
|
-
/* dimensions */
|
|
3
|
-
/*@doc Define a altura do componente.*/
|
|
4
|
-
--eztime--height: 42px;
|
|
5
|
-
/*@doc Define a largura do componente.*/
|
|
6
|
-
--eztime--width: 100%;
|
|
7
|
-
/*@doc Define a largura do slot que contém o ícone.*/
|
|
8
|
-
--eztime__icon--width: 48px;
|
|
9
|
-
|
|
10
|
-
/* general */
|
|
11
|
-
/*@doc Define o raio da borda do input do componente.*/
|
|
12
|
-
--eztime--border-radius: var(--border--radius-medium, 12px);
|
|
13
|
-
/*@doc Define o tamanho da fonte do input e label do componente.*/
|
|
14
|
-
--eztime--font-size: var(--text--medium, 14px);
|
|
15
|
-
/*@doc Define a família da fonte do input, label e caixa de mensagem do componente.*/
|
|
16
|
-
--eztime--font-family: var(--font-pattern, Arial);
|
|
17
|
-
/*@doc Define o peso da fonte do label do componente.*/
|
|
18
|
-
--eztime--font-weight: var(--text-weight--large, 500);
|
|
19
|
-
/*@doc Define o espaçamento do label.*/
|
|
20
|
-
--eztime--space--medium: var(--space--medium, 6px);
|
|
21
|
-
|
|
22
|
-
/* input */
|
|
23
|
-
/*@doc Define a cor de fundo do input.*/
|
|
24
|
-
--eztime__input--background-color: var(--background--medium, #e0e0e0);
|
|
25
|
-
/*@doc Define o estilo da borda do input.*/
|
|
26
|
-
--eztime__input--border: var(--border--medium, 2px solid);
|
|
27
|
-
/*@doc Define a cor da borda do input.*/
|
|
28
|
-
--eztime__input--border-color: var(--eztime__input--background-color);
|
|
29
|
-
/*no modo normal usamos a borda com a mesma cor do bg*/
|
|
30
|
-
/*@doc Define a cor da borda do input quando focado.*/
|
|
31
|
-
--eztime__input--focus--border-color: var(--color--primary, #008561);
|
|
32
|
-
/*@doc Define a cor de fundo do input quando desabilitado.*/
|
|
33
|
-
--eztime__input--disabled--background-color: var(--color--disable-secondary, #F2F5F8);
|
|
34
|
-
/*@doc Define a cor do texto do input.*/
|
|
35
|
-
--eztime__input--disabled--color: var(--text--disable, #AFB6C0);
|
|
36
|
-
/*@doc Define a cor da borda do input quando com erro.*/
|
|
37
|
-
--eztime__input--error--border-color: #CC2936;
|
|
38
|
-
|
|
39
|
-
/* label */
|
|
40
|
-
/*@doc Define a cor do texto do label.*/
|
|
41
|
-
--eztime__label--color: var(--title--primary, #919191);
|
|
42
|
-
|
|
43
|
-
/* message box */
|
|
44
|
-
/*@doc Define o tamanho da fonte da mensagem abaixo do input.*/
|
|
45
|
-
--eztime__message_box--font-size: var(--text--small, 12px);
|
|
46
|
-
/*@doc Define a cor da fonte da mensagem quando info.*/
|
|
47
|
-
--eztime__message_box--info--color: var(--color--success, #22085d);
|
|
48
|
-
/*@doc Define a cor da fonte da mensagem quando erro.*/
|
|
49
|
-
--eztime__message_box--error--color: var(--color--error, #FF0000);
|
|
50
|
-
|
|
51
2
|
/***************
|
|
52
3
|
host style
|
|
53
4
|
***************/
|
|
@@ -55,124 +6,5 @@
|
|
|
55
6
|
display: flex;
|
|
56
7
|
flex-wrap: wrap;
|
|
57
8
|
position: relative;
|
|
58
|
-
/*public*/
|
|
59
|
-
width: var(--eztime--width);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.invisible {
|
|
63
|
-
visibility: hidden;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
input {
|
|
67
|
-
/*private*/
|
|
68
9
|
width: 100%;
|
|
69
|
-
box-sizing: border-box;
|
|
70
|
-
padding: var(--space--medium, 6px);
|
|
71
|
-
font-weight: var(--text-weight--large, 600);
|
|
72
|
-
/*public*/
|
|
73
|
-
height: var(--eztime--height);
|
|
74
|
-
border-radius: var(--eztime--border-radius);
|
|
75
|
-
font-family: var(--eztime--font-family);
|
|
76
|
-
font-size: var(--eztime--font-size);
|
|
77
|
-
border: var(--eztime__input--border);
|
|
78
|
-
border-color: var(--eztime__input--border-color);
|
|
79
|
-
background-color: var(--eztime__input--background-color);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
input:disabled {
|
|
83
|
-
/*public*/
|
|
84
|
-
background-color: var(--eztime__input--disabled--background-color);
|
|
85
|
-
color: var(--eztime__input--disabled--color);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
input:focus {
|
|
89
|
-
/*private*/
|
|
90
|
-
outline: none;
|
|
91
|
-
/*public*/
|
|
92
|
-
border-color: var(--eztime__input--focus--border-color);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
input.icon--left {
|
|
96
|
-
padding-left: var(--eztime__icon--width);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
input.icon--right {
|
|
100
|
-
padding-right: var(--eztime__icon--width);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
input::placeholder {
|
|
104
|
-
color: var(--eztime__placeholder--color);
|
|
105
|
-
font-weight: var(--eztime__placeholder--font-weight);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
input:disabled::placeholder {
|
|
109
|
-
color: var(--eztime__placeholder--disabled--color);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
input.hasError {
|
|
113
|
-
color: inherit;
|
|
114
|
-
border-color: var(--eztime__input--error--border-color);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
input.text--right {
|
|
118
|
-
text-align: right;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.message-box {
|
|
122
|
-
/*private*/
|
|
123
|
-
min-height: 16px;
|
|
124
|
-
min-width: 100%;
|
|
125
|
-
margin-top: 2px;
|
|
126
|
-
line-height: 12px;
|
|
127
|
-
/*public*/
|
|
128
|
-
font-family: var(--eztime--font-family);
|
|
129
|
-
font-size: var(--eztime__message_box--font-size);
|
|
130
|
-
color: var(--eztime__message_box--info--color);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.hasError {
|
|
134
|
-
/*public*/
|
|
135
|
-
color: var(--eztime__message_box--error--color);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.input__label {
|
|
139
|
-
/*public*/
|
|
140
|
-
font-size: var(--eztime--font-size);
|
|
141
|
-
font-weight: var(--eztime--font-weight);
|
|
142
|
-
position: absolute;
|
|
143
|
-
color: var(it__label--color);
|
|
144
|
-
top: var(--eztime--space--medium);
|
|
145
|
-
font-family: var(--eztime--font-family);
|
|
146
|
-
-webkit-transition: font-size .3s, top .3s;
|
|
147
|
-
transition: font-size .3s, top .3s;
|
|
148
|
-
z-index: var(--visible);
|
|
149
|
-
white-space: nowrap;
|
|
150
|
-
overflow: hidden;
|
|
151
|
-
text-overflow: ellipsis;
|
|
152
|
-
left: var(--eztime__icon--width);
|
|
153
|
-
width: calc(100% - 10px - var(--eztime__icon--width));
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.input__label--floated {
|
|
157
|
-
font-family: var(--eztime--font-family);
|
|
158
|
-
font-size: var(--text--extra-small);
|
|
159
|
-
top: var(--space--small);
|
|
160
|
-
color: var(--text--primary);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.input__label--left {
|
|
164
|
-
/*public*/
|
|
165
|
-
left: var(--eztime__icon--width);
|
|
166
|
-
width: calc(100% - 10px - var(--eztime__icon--width));
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.input__label--right {
|
|
170
|
-
/*public*/
|
|
171
|
-
padding-right: var(--eztime__icon--width);
|
|
172
|
-
width: calc(100% - 10px - var(--eztime__icon--width));
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.input--with--label {
|
|
176
|
-
/*public*/
|
|
177
|
-
padding-bottom: 0;
|
|
178
10
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Component, Prop, h, Watch, Host, Method } from
|
|
2
|
-
import { TimeFormatter, MaskFormatter, NumberUtils } from
|
|
1
|
+
import { Element, Component, Prop, h, Watch, Host, Method, getAssetPath } from "@stencil/core";
|
|
2
|
+
import { TimeFormatter, MaskFormatter, NumberUtils } from "@sankhyalabs/core";
|
|
3
|
+
import CSSVarsUtils from "../../utils/CSSVarsUtils";
|
|
3
4
|
export class EzTimeInput {
|
|
4
5
|
constructor() {
|
|
5
6
|
/**
|
|
@@ -11,17 +12,6 @@ export class EzTimeInput {
|
|
|
11
12
|
*/
|
|
12
13
|
this.showSeconds = false;
|
|
13
14
|
}
|
|
14
|
-
showError() {
|
|
15
|
-
const hasError = typeof this.errorMessage === 'string' && this.errorMessage !== '';
|
|
16
|
-
if (hasError) {
|
|
17
|
-
this._inputElem.classList.add('hasError');
|
|
18
|
-
this._messageBoxElem.classList.add('hasError');
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
this._inputElem.classList.remove('hasError');
|
|
22
|
-
this._messageBoxElem.classList.remove('hasError');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
15
|
prepareMask() {
|
|
26
16
|
if (this.showSeconds) {
|
|
27
17
|
if (this._maskFormatter == undefined) {
|
|
@@ -40,23 +30,6 @@ export class EzTimeInput {
|
|
|
40
30
|
}
|
|
41
31
|
}
|
|
42
32
|
}
|
|
43
|
-
adjustFloatingLabel() {
|
|
44
|
-
if (this.label) {
|
|
45
|
-
if (!this._inputElem.classList.contains("input--with--label")) {
|
|
46
|
-
this._inputElem.classList.add("input--with--label");
|
|
47
|
-
}
|
|
48
|
-
if (this.viewValue && this.viewValue.toString().length > 0) {
|
|
49
|
-
if (!this._labelElem.classList.contains("input__label--floated")) {
|
|
50
|
-
this._labelElem.classList.add("input__label--floated");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
if (this._labelElem.classList.contains("input__label--floated")) {
|
|
55
|
-
this._labelElem.classList.remove("input__label--floated");
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
33
|
onValueChanged() {
|
|
61
34
|
if (this.value === NaN) {
|
|
62
35
|
this.value = undefined;
|
|
@@ -79,12 +52,6 @@ export class EzTimeInput {
|
|
|
79
52
|
this._inputElem.blur();
|
|
80
53
|
}
|
|
81
54
|
//---------------------------------------------
|
|
82
|
-
// Test Methods
|
|
83
|
-
//---------------------------------------------
|
|
84
|
-
setInputElemnt(input) {
|
|
85
|
-
this._iconElement = input;
|
|
86
|
-
}
|
|
87
|
-
//---------------------------------------------
|
|
88
55
|
// Event handlers
|
|
89
56
|
//---------------------------------------------
|
|
90
57
|
handleFocusout() {
|
|
@@ -94,7 +61,6 @@ export class EzTimeInput {
|
|
|
94
61
|
this.clearField();
|
|
95
62
|
this.errorMessage = "Favor inserir um horário válido.";
|
|
96
63
|
}
|
|
97
|
-
this.adjustFloatingLabel();
|
|
98
64
|
}
|
|
99
65
|
prepareValue(value) {
|
|
100
66
|
try {
|
|
@@ -112,40 +78,12 @@ export class EzTimeInput {
|
|
|
112
78
|
this.viewValue = this._inputElem.value;
|
|
113
79
|
this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
|
|
114
80
|
}
|
|
115
|
-
adjustIconStyle() {
|
|
116
|
-
if (this._iconElement) {
|
|
117
|
-
this._iconElement.style.position = "absolute";
|
|
118
|
-
this._iconElement.style.display = "flex";
|
|
119
|
-
this._iconElement.style.alignItems = "center";
|
|
120
|
-
this._iconElement.style.justifyContent = "center";
|
|
121
|
-
this._iconElement.style.overflow = "hidden";
|
|
122
|
-
this._iconElement.style.top = "0px";
|
|
123
|
-
this._iconElement.style.width = "var(--eztime__icon--width)";
|
|
124
|
-
this._iconElement.style.height = "var(--eztime--height)";
|
|
125
|
-
this._iconElement.style.left = "0px";
|
|
126
|
-
this._iconElement.style.borderRadius = "var(--eztime--border-radius) 0 0 var(--eztime--border-radius)";
|
|
127
|
-
this._inputElem.classList.add('icon--left');
|
|
128
|
-
if (this._labelElem) {
|
|
129
|
-
this._labelElem.classList.add("input__label--left");
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
this.showError();
|
|
133
|
-
}
|
|
134
|
-
doFocus() {
|
|
135
|
-
if (this.label && this._labelElem) {
|
|
136
|
-
if (!this._labelElem.classList.contains("input__label--floated")) {
|
|
137
|
-
this._labelElem.classList.add("input__label--floated");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
81
|
//---------------------------------------------
|
|
142
82
|
// Lifecycle web component
|
|
143
83
|
//---------------------------------------------
|
|
144
84
|
componentDidLoad() {
|
|
145
85
|
this.onValueChanged();
|
|
146
|
-
this.
|
|
147
|
-
this.adjustFloatingLabel();
|
|
148
|
-
this.showError();
|
|
86
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._inputElem);
|
|
149
87
|
}
|
|
150
88
|
componentWillLoad() {
|
|
151
89
|
this.prepareMask();
|
|
@@ -158,12 +96,8 @@ export class EzTimeInput {
|
|
|
158
96
|
}
|
|
159
97
|
render() {
|
|
160
98
|
return (h(Host, null,
|
|
161
|
-
h("ez-
|
|
162
|
-
|
|
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
|
-
: null,
|
|
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.errorMessage)));
|
|
99
|
+
h("ez-text-input", { ref: (el) => this._inputElem = el, value: this.viewValue, enabled: this.enabled, label: this.label, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, errorMessage: this.errorMessage },
|
|
100
|
+
h("ez-icon", { slot: "leftIcon", href: getAssetPath("./assets/actions-sprite.svg") + "#timer-outline" }))));
|
|
167
101
|
}
|
|
168
102
|
static get is() { return "ez-time-input"; }
|
|
169
103
|
static get encapsulation() { return "shadow"; }
|
|
@@ -173,6 +107,7 @@ export class EzTimeInput {
|
|
|
173
107
|
static get styleUrls() { return {
|
|
174
108
|
"$": ["ez-time-input.css"]
|
|
175
109
|
}; }
|
|
110
|
+
static get assetsDirs() { return ["../assets"]; }
|
|
176
111
|
static get properties() { return {
|
|
177
112
|
"label": {
|
|
178
113
|
"type": "string",
|
|
@@ -313,10 +248,8 @@ export class EzTimeInput {
|
|
|
313
248
|
}
|
|
314
249
|
}
|
|
315
250
|
}; }
|
|
251
|
+
static get elementRef() { return "_elem"; }
|
|
316
252
|
static get watchers() { return [{
|
|
317
|
-
"propName": "errorMessage",
|
|
318
|
-
"methodName": "showError"
|
|
319
|
-
}, {
|
|
320
253
|
"propName": "showSeconds",
|
|
321
254
|
"methodName": "prepareMask"
|
|
322
255
|
}, {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default class CSSVarsUtils {
|
|
2
|
+
static applyVarsTextInput(host, textInput) {
|
|
3
|
+
if (textInput) {
|
|
4
|
+
CSSVarsUtils.applyIfExists(host, textInput, '--text-input__input--background-color');
|
|
5
|
+
CSSVarsUtils.applyIfExists(host, textInput, '--text-input__input--border-color');
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
static applyIfExists(host, textInput, varName) {
|
|
9
|
+
const prop = getComputedStyle(host).getPropertyValue(varName);
|
|
10
|
+
if (prop) {
|
|
11
|
+
textInput.style.setProperty(varName, prop);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|