@sankhyalabs/ezui 1.1.69 → 1.1.70
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 +89 -92
- package/dist/cjs/ez-dialog.cjs.entry.js +4 -1
- package/dist/cjs/ez-modal.cjs.entry.js +15 -68
- package/dist/cjs/ez-popover.cjs.entry.js +13 -14
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- 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 +5 -4
- 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-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/custom-elements/index.js +126 -180
- package/dist/esm/ez-button_16.entry.js +89 -92
- package/dist/esm/ez-dialog.entry.js +4 -1
- package/dist/esm/ez-modal.entry.js +15 -68
- package/dist/esm/ez-popover.entry.js +13 -14
- package/dist/esm/ez-popup.entry.js +1 -1
- 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-1bc9ddad.entry.js +1 -0
- package/dist/ezui/p-a7e23f65.entry.js +1 -0
- package/dist/ezui/p-a88ee12f.entry.js +1 -0
- package/dist/ezui/p-b692a0ab.entry.js +1 -0
- package/dist/ezui/p-b6e0fd3e.entry.js +1 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +5 -5
- 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.d.ts +56 -35
- 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
|
@@ -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,
|