@sankhyalabs/sankhyablocks 1.1.22 → 1.1.25
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/ApplicationUtils-05b74ee9.js +39 -0
- package/dist/cjs/AssetsUtils-7e3c38f9.js +24 -0
- package/dist/cjs/CSSVarsUtils-75ca9c64.js +19 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +27 -0
- package/dist/cjs/ez-application.cjs.entry.js +26 -0
- package/dist/cjs/ez-button_4.cjs.entry.js +660 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +223 -0
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +47 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +278 -0
- package/dist/cjs/ez-date-input.cjs.entry.js +102 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +145 -0
- package/dist/cjs/ez-dialog.cjs.entry.js +89 -0
- package/dist/cjs/ez-form.cjs.entry.js +463 -0
- package/dist/cjs/ez-grid.cjs.entry.js +647 -0
- package/dist/cjs/ez-icon.cjs.entry.js +41 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +104 -0
- package/dist/cjs/ez-modal_2.cjs.entry.js +316 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +86 -0
- package/dist/cjs/ez-popover.cjs.entry.js +120 -0
- package/dist/cjs/ez-popup.cjs.entry.js +48 -0
- package/dist/cjs/ez-search.cjs.entry.js +64 -0
- package/dist/cjs/ez-tabselector.cjs.entry.js +198 -0
- package/dist/cjs/ez-text-area.cjs.entry.js +114 -0
- package/dist/cjs/ez-text-input.cjs.entry.js +201 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +118 -0
- package/dist/cjs/ez-toast.cjs.entry.js +44 -0
- package/dist/cjs/ez-upload.cjs.entry.js +356 -0
- package/dist/cjs/index-682c98b2.js +1771 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/sankhyablocks.cjs.js +3 -3
- package/dist/cjs/snk-application.cjs.entry.js +319 -1275
- package/dist/cjs/test-du.cjs.entry.js +76 -0
- package/dist/collection/collection-manifest.json +37 -2
- package/dist/collection/components/snk-application/snk-application.js +8 -4
- package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +16 -9
- package/dist/{collection/temp → components}/ApplicationUtils.js +37 -31
- package/dist/components/AssetsUtils.js +22 -0
- package/dist/components/CSSVarsUtils.js +17 -0
- package/dist/components/ez-action-chip.js +44 -0
- package/dist/components/ez-application.js +39 -0
- package/dist/components/ez-button.js +6 -0
- package/dist/components/ez-button2.js +105 -0
- package/dist/components/ez-calendar.js +6 -0
- package/dist/components/ez-calendar2.js +242 -0
- package/dist/components/ez-check.js +6 -0
- package/dist/components/ez-check2.js +94 -0
- package/dist/components/ez-collapsible-box.js +67 -0
- package/dist/components/ez-combo-box.js +6 -0
- package/dist/components/ez-combo-box2.js +311 -0
- package/dist/components/ez-date-input.js +135 -0
- package/dist/components/ez-date-time-input.js +179 -0
- package/dist/components/ez-dialog.js +124 -0
- package/dist/components/ez-form.js +6 -0
- package/dist/components/ez-form2.js +485 -0
- package/dist/components/ez-grid.js +738 -0
- package/dist/components/ez-icon.js +6 -0
- package/dist/components/ez-icon2.js +56 -0
- package/dist/components/ez-label-chip.js +125 -0
- package/dist/components/ez-list.js +6 -0
- package/dist/components/ez-list2.js +523 -0
- package/dist/components/ez-modal.js +6 -0
- package/dist/components/ez-modal2.js +82 -0
- package/dist/components/ez-number-input.js +115 -0
- package/dist/components/ez-popover.js +145 -0
- package/dist/components/ez-popup.js +67 -0
- package/dist/components/ez-search.js +100 -0
- package/dist/components/ez-tabselector.js +6 -0
- package/dist/components/ez-tabselector2.js +213 -0
- package/dist/components/ez-text-area.js +137 -0
- package/dist/components/ez-text-input.js +6 -0
- package/dist/components/ez-text-input2.js +223 -0
- package/dist/components/ez-time-input.js +153 -0
- package/dist/components/ez-toast.js +64 -0
- package/dist/components/ez-upload.js +382 -0
- package/dist/components/grid-config.js +6 -0
- package/dist/components/grid-config2.js +318 -0
- package/dist/components/select-box.js +6 -0
- package/dist/components/select-box2.js +47 -0
- package/dist/components/snk-application.js +310 -1266
- package/dist/components/test-du.js +101 -0
- package/dist/esm/ApplicationUtils-e0b6d857.js +37 -0
- package/dist/esm/AssetsUtils-6e6624dc.js +22 -0
- package/dist/esm/CSSVarsUtils-0787c3f3.js +17 -0
- package/dist/esm/ez-action-chip.entry.js +23 -0
- package/dist/esm/ez-application.entry.js +22 -0
- package/dist/esm/ez-button_4.entry.js +653 -0
- package/dist/esm/ez-calendar.entry.js +219 -0
- package/dist/esm/ez-collapsible-box.entry.js +43 -0
- package/dist/esm/ez-combo-box.entry.js +274 -0
- package/dist/esm/ez-date-input.entry.js +98 -0
- package/dist/esm/ez-date-time-input.entry.js +141 -0
- package/dist/esm/ez-dialog.entry.js +85 -0
- package/dist/esm/ez-form.entry.js +459 -0
- package/dist/esm/ez-grid.entry.js +643 -0
- package/dist/esm/ez-icon.entry.js +37 -0
- package/dist/esm/ez-label-chip.entry.js +100 -0
- package/dist/esm/ez-modal_2.entry.js +311 -0
- package/dist/esm/ez-number-input.entry.js +82 -0
- package/dist/esm/ez-popover.entry.js +116 -0
- package/dist/esm/ez-popup.entry.js +44 -0
- package/dist/esm/ez-search.entry.js +60 -0
- package/dist/esm/ez-tabselector.entry.js +194 -0
- package/dist/esm/ez-text-area.entry.js +110 -0
- package/dist/esm/ez-text-input.entry.js +197 -0
- package/dist/esm/ez-time-input.entry.js +114 -0
- package/dist/esm/ez-toast.entry.js +40 -0
- package/dist/esm/ez-upload.entry.js +352 -0
- package/dist/esm/index-35088a3f.js +1740 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/sankhyablocks.js +3 -3
- package/dist/esm/snk-application.entry.js +311 -1267
- package/dist/esm/test-du.entry.js +72 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +67 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +3 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +180 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +319 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +327 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +162 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +217 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +49 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +527 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +5 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +31 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +129 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +10 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +176 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +139 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +335 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +358 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +44 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +405 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +3 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +138 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +165 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +196 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +10 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +127 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +568 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +3 -0
- package/dist/sankhyablocks/p-0183d259.entry.js +1 -0
- package/dist/sankhyablocks/p-01f23a70.entry.js +1 -0
- package/dist/sankhyablocks/p-07c32f68.entry.js +1 -0
- package/dist/sankhyablocks/p-0f90499d.entry.js +1 -0
- package/dist/sankhyablocks/p-105724a3.entry.js +1 -0
- package/dist/sankhyablocks/p-2ac02d48.entry.js +1 -0
- package/dist/sankhyablocks/p-35364a97.entry.js +1 -0
- package/dist/sankhyablocks/p-3f6aa9a7.entry.js +1 -0
- package/dist/sankhyablocks/p-5f9af495.entry.js +1 -0
- package/dist/sankhyablocks/p-60967cf0.js +1 -0
- package/dist/sankhyablocks/p-6ce33b60.entry.js +57 -0
- package/dist/sankhyablocks/p-70ad6c16.entry.js +1 -0
- package/dist/sankhyablocks/p-710bfffe.entry.js +1 -0
- package/dist/sankhyablocks/p-735440c1.entry.js +1 -0
- package/dist/sankhyablocks/p-811b4b9d.js +1 -0
- package/dist/sankhyablocks/p-813fe4f7.js +1 -0
- package/dist/sankhyablocks/p-85a9446b.js +2 -0
- package/dist/sankhyablocks/p-89a1100f.entry.js +1 -0
- package/dist/sankhyablocks/p-8b543003.entry.js +1 -0
- package/dist/sankhyablocks/p-9750632b.entry.js +1 -0
- package/dist/sankhyablocks/p-a96272f7.entry.js +1 -0
- package/dist/sankhyablocks/p-ac8842e5.entry.js +1 -0
- package/dist/sankhyablocks/p-ba64cc41.entry.js +1 -0
- package/dist/sankhyablocks/p-c1ede043.entry.js +1 -0
- package/dist/sankhyablocks/p-d90ebb85.entry.js +1 -0
- package/dist/sankhyablocks/p-e17dfaae.entry.js +1 -0
- package/dist/sankhyablocks/p-e5355a29.entry.js +1 -0
- package/dist/sankhyablocks/p-ef04b633.entry.js +1 -0
- package/dist/sankhyablocks/p-f6db07fb.entry.js +1 -0
- package/dist/sankhyablocks/p-fcd9bd92.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -1
- package/dist/types/components.d.ts +7 -3
- package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +1 -0
- package/package.json +12 -7
- package/react/components.d.ts +29 -0
- package/react/components.js +29 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/index-20a7d705.js +0 -733
- package/dist/esm/index-8d3572c4.js +0 -707
- package/dist/sankhyablocks/p-5fa264b9.js +0 -1
- package/dist/sankhyablocks/p-fe95f2c4.entry.js +0 -57
- package/dist/types/temp/ApplicationUtils.d.ts +0 -7
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { NumberUtils } from '@sankhyalabs/core';
|
|
3
|
+
import { C as CSSVarsUtils } from './CSSVarsUtils.js';
|
|
4
|
+
import { d as defineCustomElement$2 } from './ez-text-input2.js';
|
|
5
|
+
|
|
6
|
+
const ezNumberInputCss = ":host{display:block;width:100%}";
|
|
7
|
+
|
|
8
|
+
const EzNumberInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.__registerHost();
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.ezChange = createEvent(this, "ezChange", 7);
|
|
14
|
+
/**
|
|
15
|
+
* Deixa o campo disponível ou não para uso.
|
|
16
|
+
*/
|
|
17
|
+
this.enabled = true;
|
|
18
|
+
}
|
|
19
|
+
setLabel() {
|
|
20
|
+
this._textInput.label = this.label;
|
|
21
|
+
}
|
|
22
|
+
setErrorMessage() {
|
|
23
|
+
this._textInput.errorMessage = this.errorMessage;
|
|
24
|
+
}
|
|
25
|
+
applyValueToInput() {
|
|
26
|
+
if (this._textInput) {
|
|
27
|
+
this._textInput.value = this.getTextValue(this.value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Realiza o foco no componente de input
|
|
32
|
+
*/
|
|
33
|
+
async setFocus() {
|
|
34
|
+
this._textInput.setFocus();
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Remove o foco no componente de input
|
|
38
|
+
*/
|
|
39
|
+
async setBlur() {
|
|
40
|
+
this._textInput.setBlur();
|
|
41
|
+
}
|
|
42
|
+
changeValue(newValue) {
|
|
43
|
+
this.errorMessage = "";
|
|
44
|
+
if (newValue && newValue !== this.value) {
|
|
45
|
+
this.value = newValue;
|
|
46
|
+
this.ezChange.emit(this.value);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
parseNumber() {
|
|
50
|
+
const parsedNumber = this._textInput.value ? NumberUtils.stringToNumber(this._textInput.value) : null;
|
|
51
|
+
if (parsedNumber != null && isNaN(parsedNumber)) {
|
|
52
|
+
this.errorMessage = "O valor digitado não é um número válido";
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
try {
|
|
56
|
+
this.changeValue(parsedNumber);
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
this.errorMessage = e.message;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
getTextValue(value) {
|
|
65
|
+
if (value) {
|
|
66
|
+
return this.precision > 0 ? NumberUtils.format(value.toString(), Number(this.precision), Number(this.prettyPrecision)) : value.toString();
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
componentDidLoad() {
|
|
71
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
return (h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseNumber(), label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: this.precision > 0 ? "0123456789-,." : "0123456789-", enabled: this.enabled, errorMessage: this.errorMessage }));
|
|
75
|
+
}
|
|
76
|
+
get _elem() { return this; }
|
|
77
|
+
static get watchers() { return {
|
|
78
|
+
"label": ["setLabel"],
|
|
79
|
+
"errorMessage": ["setErrorMessage"],
|
|
80
|
+
"value": ["applyValueToInput"]
|
|
81
|
+
}; }
|
|
82
|
+
static get style() { return ezNumberInputCss; }
|
|
83
|
+
}, [1, "ez-number-input", {
|
|
84
|
+
"label": [1],
|
|
85
|
+
"value": [1538],
|
|
86
|
+
"enabled": [4],
|
|
87
|
+
"errorMessage": [1537, "error-message"],
|
|
88
|
+
"precision": [2],
|
|
89
|
+
"prettyPrecision": [2, "pretty-precision"],
|
|
90
|
+
"setFocus": [64],
|
|
91
|
+
"setBlur": [64]
|
|
92
|
+
}]);
|
|
93
|
+
function defineCustomElement$1() {
|
|
94
|
+
if (typeof customElements === "undefined") {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const components = ["ez-number-input", "ez-text-input"];
|
|
98
|
+
components.forEach(tagName => { switch (tagName) {
|
|
99
|
+
case "ez-number-input":
|
|
100
|
+
if (!customElements.get(tagName)) {
|
|
101
|
+
customElements.define(tagName, EzNumberInput$1);
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
case "ez-text-input":
|
|
105
|
+
if (!customElements.get(tagName)) {
|
|
106
|
+
defineCustomElement$2();
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
} });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const EzNumberInput = EzNumberInput$1;
|
|
113
|
+
const defineCustomElement = defineCustomElement$1;
|
|
114
|
+
|
|
115
|
+
export { EzNumberInput, defineCustomElement };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { FloatingManager } from '@sankhyalabs/core';
|
|
3
|
+
|
|
4
|
+
const ezPopoverCss = ":host{--ez-popover__box--border-radius:var(--border--radius-medium, 12px);--ez-popover__box--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-popover__box--background-color:var(--background--xlight, #fff);--ez-popover__box--z-index:var(--more-visible, 1);position:relative;display:flex;user-select:none;width:100%}.box{z-index:var(--ez-popover__box--z-index);display:flex;flex-direction:column;height:fit-content;background-color:var(--ez-popover__box--background-color);border-radius:var(--ez-popover__box--border-radius);box-shadow:var(--ez-popover__box--box-shadow)}.box--fit-content{width:fit-content}.box--full-width{width:100%}";
|
|
5
|
+
|
|
6
|
+
const EzPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.ezVisibilityChange = createEvent(this, "ezVisibilityChange", 7);
|
|
12
|
+
this._firstRender = true;
|
|
13
|
+
/**
|
|
14
|
+
* No modo floating = false o popover só se tornará visível
|
|
15
|
+
* quando o método show() for acionado.
|
|
16
|
+
*/
|
|
17
|
+
this.autoClose = true;
|
|
18
|
+
/**
|
|
19
|
+
* Offset top do popover em relação ao componente pai
|
|
20
|
+
*/
|
|
21
|
+
this.top = "0px";
|
|
22
|
+
/**
|
|
23
|
+
* Offset left do popover em relação ao componente pai
|
|
24
|
+
*/
|
|
25
|
+
this.left = "0px";
|
|
26
|
+
/**
|
|
27
|
+
* Offset bottom do popover em relação ao componente pai
|
|
28
|
+
*/
|
|
29
|
+
this.bottom = "0px";
|
|
30
|
+
/**
|
|
31
|
+
* Offset right do popover em relação ao componente pai
|
|
32
|
+
*/
|
|
33
|
+
this.right = "0px";
|
|
34
|
+
/**
|
|
35
|
+
* Ajusta o comportamento da largura do popover.
|
|
36
|
+
* Opções: "100% e "fit-content" (default)
|
|
37
|
+
*/
|
|
38
|
+
this.boxWidth = "fit-content";
|
|
39
|
+
}
|
|
40
|
+
dispatchVisibilityChange(newValue, oldValue) {
|
|
41
|
+
if (newValue != oldValue) {
|
|
42
|
+
this.ezVisibilityChange.emit(newValue);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Atualiza a posição do popover em relação ao componente pai.
|
|
47
|
+
*/
|
|
48
|
+
async updatePosition(top = this.top, left = this.left, bottom = this.bottom, right = this.right) {
|
|
49
|
+
const floatingOptions = {
|
|
50
|
+
autoClose: this.autoClose,
|
|
51
|
+
top,
|
|
52
|
+
left,
|
|
53
|
+
bottom,
|
|
54
|
+
right,
|
|
55
|
+
innerClickTest: (_container, node) => {
|
|
56
|
+
if (_container.contains(node)) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (_container.shadowRoot && _container.shadowRoot.contains(node)) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
_container = this._host;
|
|
63
|
+
return !_container.lastElementChild.shadowRoot ? _container.contains(node) : _container.lastElementChild.shadowRoot.contains(node);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
FloatingManager.updateFloatPosition(this._box, this._container, floatingOptions);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Faz com que o popover seja renderizado na DOM.
|
|
70
|
+
*/
|
|
71
|
+
async show(top = this.top, left = this.left, bottom = this.bottom, right = this.right) {
|
|
72
|
+
const floatingOptions = {
|
|
73
|
+
autoClose: this.autoClose,
|
|
74
|
+
top,
|
|
75
|
+
left,
|
|
76
|
+
bottom,
|
|
77
|
+
right,
|
|
78
|
+
innerClickTest: (_container, node) => {
|
|
79
|
+
if (_container.contains(node)) {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
if (_container.shadowRoot && _container.shadowRoot.contains(node)) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
_container = this._host;
|
|
86
|
+
return !_container.lastElementChild.shadowRoot ? _container.contains(node) : _container.lastElementChild.shadowRoot.contains(node);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
this._floatingID = FloatingManager.float(this._box, this._container, floatingOptions);
|
|
90
|
+
this.opened = true;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Usado no modo floating. Faz com que o componente seja ocultado.
|
|
94
|
+
*/
|
|
95
|
+
async hide() {
|
|
96
|
+
if (this._floatingID !== undefined) {
|
|
97
|
+
FloatingManager.close(this._floatingID);
|
|
98
|
+
this._floatingID = undefined;
|
|
99
|
+
this.opened = false;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
componentDidRender() {
|
|
103
|
+
if (this._firstRender) {
|
|
104
|
+
this._box.remove();
|
|
105
|
+
this._firstRender = false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
render() {
|
|
109
|
+
return (h(Host, null, h("section", { ref: el => this._container = el }, h("div", { class: `box ${this.boxWidth === "fit-content" ? "box--fit-content" : "box--full-width"}`, ref: el => this._box = el }, h("slot", null)))));
|
|
110
|
+
}
|
|
111
|
+
get _host() { return this; }
|
|
112
|
+
static get watchers() { return {
|
|
113
|
+
"opened": ["dispatchVisibilityChange"]
|
|
114
|
+
}; }
|
|
115
|
+
static get style() { return ezPopoverCss; }
|
|
116
|
+
}, [1, "ez-popover", {
|
|
117
|
+
"autoClose": [516, "auto-close"],
|
|
118
|
+
"top": [1537],
|
|
119
|
+
"left": [1537],
|
|
120
|
+
"bottom": [1537],
|
|
121
|
+
"right": [1537],
|
|
122
|
+
"boxWidth": [513, "box-width"],
|
|
123
|
+
"opened": [1540],
|
|
124
|
+
"updatePosition": [64],
|
|
125
|
+
"show": [64],
|
|
126
|
+
"hide": [64]
|
|
127
|
+
}]);
|
|
128
|
+
function defineCustomElement$1() {
|
|
129
|
+
if (typeof customElements === "undefined") {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const components = ["ez-popover"];
|
|
133
|
+
components.forEach(tagName => { switch (tagName) {
|
|
134
|
+
case "ez-popover":
|
|
135
|
+
if (!customElements.get(tagName)) {
|
|
136
|
+
customElements.define(tagName, EzPopover$1);
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
} });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const EzPopover = EzPopover$1;
|
|
143
|
+
const defineCustomElement = defineCustomElement$1;
|
|
144
|
+
|
|
145
|
+
export { EzPopover, defineCustomElement };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const ezPopupCss = ":host{display:flex;--ez-popup-z-index:var(--most-visible, 3);--ez-popup__container--color:var(--title--primary, #2b3a54);--ez-popup__container--padding:var(--space--large, 24px);--ez-popup__header--padding-bottom:var(--space--medium, 12px);--ez-popup__title--font-family:var(--font-pattern, \"'Sora', 'Algerian'\");--ez-popup__title--font-size:var(--title--extra-large, 24px);--ez-popup__title--color:var(--title--primary, #2b3a54);--ez-popup__title--font-weight:var(--text-weight--large, 600);--ez-popup__btn__close--icon-color:var(--title--primary, #2b3a54);--ez-popup__btn__close--icon:url('data:image/svg+xml;utf8,<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M 8.2421753,6.9944578 13.743748,1.4930784 C 13.907781,1.3290628 14,1.1065946 14,0.87462511 14,0.64266712 13.907782,0.42019873 13.743748,0.25617155 13.579712,0.09215597 13.35727,6.48e-8 13.125266,6.48e-8 12.89338,6.48e-8 12.670821,0.09215634 12.506787,0.25617155 L 7.005215,5.7575508 1.5035972,0.25617155 C 1.3395631,0.09215597 1.1170968,6.48e-8 0.88511716,6.48e-8 0.65314917,6.48e-8 0.4306712,0.09215597 0.26663695,0.25617155 0.10260271,0.42019873 0.01045441,0.64266712 0.01045441,0.87462511 c 0,0.23196949 0.0921483,0.45443769 0.25618254,0.61845329 L 5.7682546,6.9944578 0.26663695,12.497027 c -0.0834745,0.08067 -0.15003245,0.1772 -0.19581514,0.283871 C 0.02505077,12.887561 9.831648e-4,13.002399 2.950369e-5,13.118395 -9.2415746e-4,13.234504 0.02125019,13.349689 0.06527245,13.457057 c 0.04401053,0.107479 0.10898307,0.205064 0.1911168,0.287137 0.0821454,0.08208 0.17979645,0.146888 0.28727561,0.190839 0.10747906,0.04395 0.22262954,0.06598 0.33872417,0.06493 0.116095,-10e-4 0.23082547,-0.0253 0.33747687,-0.07112 0.1066637,-0.04593 0.2031133,-0.112615 0.2837313,-0.196086 L 7.005215,8.2313646 12.506787,13.732768 c 0.164034,0.164027 0.386593,0.256125 0.618479,0.256125 0.232004,0 0.454446,-0.09209 0.618482,-0.256125 C 13.907781,13.568741 14,13.346308 14,13.114315 14,12.882323 13.90779,12.659888 13.743748,12.495861 Z\"/></svg>')}.overlay{position:fixed;display:flex;top:0px;z-index:var(--ez-popup-z-index);left:0px;width:100%;align-items:center;justify-content:center;box-sizing:border-box;height:100vh;backdrop-filter:blur(4px);background:rgba(0, 4, 12, 0.4)}.popup{display:flex;height:100%;align-items:center;justify-content:center;box-sizing:border-box}.popup__container{width:100%;max-height:90%;height:100%;display:flex;flex-wrap:wrap;overflow:hidden;background:#FFFF;color:var(--ez-popup__container--color);border-radius:12px;box-shadow:0px 0px 16px rgba(0, 38, 111, 0.122);box-sizing:border-box;padding:var(--ez-popup__container--padding)}.popup__content{box-sizing:border-box;max-height:100%;width:100%;display:grid;grid-template-rows:auto 1fr}.popup__expandable-content{box-sizing:border-box;overflow-y:auto;height:100%;width:100%}.popup__header{padding-bottom:var(--ez-popup__header--padding-bottom);width:100%;display:flex}.popup__title{display:flex;margin:0;width:100%;font-family:var(--ez-popup__title--font-family);font-size:var(--ez-popup__title--font-size);font-weight:var(--ez-popup__title--font-weight);color:var(--ez-popup__title--color);line-height:1.3}.btn-close{justify-content:flex-end;align-self:flex-start;align-items:flex-start;display:flex;outline:none;border:none;background-color:unset;cursor:pointer}.btn-close::after{content:'';display:flex;background-color:var(--ez-popup__btn__close--icon-color);width:14px;height:14px;-webkit-mask-image:var(--ez-popup__btn__close--icon);mask-image:var(--ez-popup__btn__close--icon)}.btn-close--solo{width:100%}.row{width:100%;display:flex;flex-wrap:wrap}.col{display:flex;flex-wrap:wrap;align-self:flex-start;box-sizing:border-box}.col--stretch{align-self:stretch}.col--undefined{width:unset}.col--nowrap{flex-wrap:nowrap}@media screen and (min-width: 320px){.col--sd-1{width:8.33333%}.col--sd-2{width:16.66667%}.col--sd-3{width:25%}.col--sd-4{width:33.33333%}.col--sd-5{width:41.66667%}.col--sd-6{width:50%}.col--sd-7{width:58.33333%}.col--sd-8{width:66.66667%}.col--sd-9{width:75%}.col--sd-10{width:83.33333%}.col--sd-11{width:91.66667%}.col--sd-12{width:100%}}@media screen and (min-width: 480px){.col--pn-1{width:8.33333%}.col--pn-2{width:16.66667%}.col--pn-3{width:25%}.col--pn-4{width:33.33333%}.col--pn-5{width:41.66667%}.col--pn-6{width:50%}.col--pn-7{width:58.33333%}.col--pn-8{width:66.66667%}.col--pn-9{width:75%}.col--pn-10{width:83.33333%}.col--pn-11{width:91.66667%}.col--pn-12{width:100%}}@media screen and (min-width: 768px){.col--tb-1{width:8.33333%}.col--tb-2{width:16.66667%}.col--tb-3{width:25%}.col--tb-4{width:33.33333%}.col--tb-5{width:41.66667%}.col--tb-6{width:50%}.col--tb-7{width:58.33333%}.col--tb-8{width:66.66667%}.col--tb-9{width:75%}.col--tb-10{width:83.33333%}.col--tb-11{width:91.66667%}.col--tb-12{width:100%}}@media screen and (min-width: 992px){.col--md-1{width:8.33333%}.col--md-2{width:16.66667%}.col--md-3{width:25%}.col--md-4{width:33.33333%}.col--md-5{width:41.66667%}.col--md-6{width:50%}.col--md-7{width:58.33333%}.col--md-8{width:66.66667%}.col--md-9{width:75%}.col--md-10{width:83.33333%}.col--md-11{width:91.66667%}.col--md-12{width:100%}}@media screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-2{width:16.66667%}.col--ld-3{width:25%}.col--ld-4{width:33.33333%}.col--ld-5{width:41.66667%}.col--ld-6{width:50%}.col--ld-7{width:58.33333%}.col--ld-8{width:66.66667%}.col--ld-9{width:75%}.col--ld-10{width:83.33333%}.col--ld-11{width:91.66667%}.col--ld-12{width:100%}}";
|
|
4
|
+
|
|
5
|
+
const EzPopup$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.ezClosePopup = createEvent(this, "ezClosePopup", 7);
|
|
11
|
+
this.sizeClasses = {
|
|
12
|
+
"x-small": "col--sd-3",
|
|
13
|
+
"small": "col--sd-5",
|
|
14
|
+
"medium": "col--sd-6",
|
|
15
|
+
"large": "col--sd-9",
|
|
16
|
+
"x-large": "col--sd-11"
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Define o width que o componente deve ter, seguindo o grid system. Os valores devem estar
|
|
20
|
+
* compreendidos em [x-small | small | medium | large | x-large].
|
|
21
|
+
*/
|
|
22
|
+
this.size = "medium";
|
|
23
|
+
/**
|
|
24
|
+
* Controla a exibição do componente.
|
|
25
|
+
*/
|
|
26
|
+
this.opened = false;
|
|
27
|
+
/**
|
|
28
|
+
* Define se o componente utilizará um cabeçalho com botão de fechamento.
|
|
29
|
+
*/
|
|
30
|
+
this.useHeader = false;
|
|
31
|
+
}
|
|
32
|
+
getGridSize() {
|
|
33
|
+
return this.sizeClasses[this.size] || this.sizeClasses["medium"];
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
if (this.opened) {
|
|
37
|
+
return (h(Host, null, h("div", { class: "overlay" }, h("div", { class: "popup col " + this.getGridSize() }, h("div", { class: "popup__container" }, h("div", { class: "popup__content" }, h("div", { class: "popup__header" }, this.ezTitle ?
|
|
38
|
+
h("div", { class: "popup__title" }, this.ezTitle)
|
|
39
|
+
: undefined, h("button", { class: this.ezTitle ? "btn-close" : "btn-close btn-close--solo", onClick: () => { this.opened = false; this.ezClosePopup.emit(); } })), h("div", { class: "popup__expandable-content" }, h("slot", null))))))));
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
static get style() { return ezPopupCss; }
|
|
44
|
+
}, [1, "ez-popup", {
|
|
45
|
+
"size": [1],
|
|
46
|
+
"opened": [1540],
|
|
47
|
+
"useHeader": [1540, "use-header"],
|
|
48
|
+
"ezTitle": [1, "ez-title"]
|
|
49
|
+
}]);
|
|
50
|
+
function defineCustomElement$1() {
|
|
51
|
+
if (typeof customElements === "undefined") {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const components = ["ez-popup"];
|
|
55
|
+
components.forEach(tagName => { switch (tagName) {
|
|
56
|
+
case "ez-popup":
|
|
57
|
+
if (!customElements.get(tagName)) {
|
|
58
|
+
customElements.define(tagName, EzPopup$1);
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
} });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const EzPopup = EzPopup$1;
|
|
65
|
+
const defineCustomElement = defineCustomElement$1;
|
|
66
|
+
|
|
67
|
+
export { EzPopup, defineCustomElement };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { C as CSSVarsUtils } from './CSSVarsUtils.js';
|
|
3
|
+
import { d as defineCustomElement$3 } from './ez-combo-box2.js';
|
|
4
|
+
import { d as defineCustomElement$2 } from './ez-text-input2.js';
|
|
5
|
+
|
|
6
|
+
const ezSearchCss = ":host{width:100%}";
|
|
7
|
+
|
|
8
|
+
const EzSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.__registerHost();
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.ezChange = createEvent(this, "ezChange", 7);
|
|
14
|
+
this.showPopup = createEvent(this, "showPopup", 7);
|
|
15
|
+
/**
|
|
16
|
+
* Deixa o campo disponível ou não.
|
|
17
|
+
*/
|
|
18
|
+
this.enabled = true;
|
|
19
|
+
/**
|
|
20
|
+
* Ajusta a opção de mostrar o "value" ao selecionar uma opção.
|
|
21
|
+
*/
|
|
22
|
+
this.showSelectedValue = true;
|
|
23
|
+
/**
|
|
24
|
+
* Ajusta a opção de mostrar o "value" para cada opção.
|
|
25
|
+
*/
|
|
26
|
+
this.showOptionValue = true;
|
|
27
|
+
}
|
|
28
|
+
updateValue() {
|
|
29
|
+
if (this._comboElement) {
|
|
30
|
+
this._comboElement.value = this.value;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Realiza o foco no componente de pesquisa
|
|
35
|
+
*/
|
|
36
|
+
async setFocus() {
|
|
37
|
+
this._comboElement.setFocus();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Remove o foco no componente de pesquisa
|
|
41
|
+
*/
|
|
42
|
+
async setBlur() {
|
|
43
|
+
this._comboElement.setBlur();
|
|
44
|
+
}
|
|
45
|
+
onComboChange(evt) {
|
|
46
|
+
evt.stopPropagation();
|
|
47
|
+
this.value = evt.detail;
|
|
48
|
+
this.ezChange.emit(evt.detail);
|
|
49
|
+
}
|
|
50
|
+
componentDidLoad() {
|
|
51
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._comboElement);
|
|
52
|
+
}
|
|
53
|
+
render() {
|
|
54
|
+
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: evt => this.onComboChange(evt), showSelectedValue: this.showSelectedValue, showOptionValue: this.showOptionValue }));
|
|
55
|
+
}
|
|
56
|
+
;
|
|
57
|
+
get _elem() { return this; }
|
|
58
|
+
static get watchers() { return {
|
|
59
|
+
"value": ["updateValue"]
|
|
60
|
+
}; }
|
|
61
|
+
static get style() { return ezSearchCss; }
|
|
62
|
+
}, [1, "ez-search", {
|
|
63
|
+
"value": [1537],
|
|
64
|
+
"label": [1537],
|
|
65
|
+
"enabled": [1540],
|
|
66
|
+
"errorMessage": [1537, "error-message"],
|
|
67
|
+
"optionLoader": [16],
|
|
68
|
+
"showSelectedValue": [4, "show-selected-value"],
|
|
69
|
+
"showOptionValue": [4, "show-option-value"],
|
|
70
|
+
"setFocus": [64],
|
|
71
|
+
"setBlur": [64]
|
|
72
|
+
}]);
|
|
73
|
+
function defineCustomElement$1() {
|
|
74
|
+
if (typeof customElements === "undefined") {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const components = ["ez-search", "ez-combo-box", "ez-text-input"];
|
|
78
|
+
components.forEach(tagName => { switch (tagName) {
|
|
79
|
+
case "ez-search":
|
|
80
|
+
if (!customElements.get(tagName)) {
|
|
81
|
+
customElements.define(tagName, EzSearch$1);
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
case "ez-combo-box":
|
|
85
|
+
if (!customElements.get(tagName)) {
|
|
86
|
+
defineCustomElement$3();
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case "ez-text-input":
|
|
90
|
+
if (!customElements.get(tagName)) {
|
|
91
|
+
defineCustomElement$2();
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
} });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const EzSearch = EzSearch$1;
|
|
98
|
+
const defineCustomElement = defineCustomElement$1;
|
|
99
|
+
|
|
100
|
+
export { EzSearch, defineCustomElement };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const ezTabselectorCss = "@keyframes activate{0%{clip-path:inset(calc(100% - 3px) 50% 0px 50%)}100%{clip-path:inset(calc(100% - 3px) 0px 0px 0px)}}:host{display:flex;position:relative;width:100%;overflow:hidden;--tabselector--backward-icon:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z\"/></svg>');--tabselector--forward-icon:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>')}.scroll{display:flex;width:100%;scroll-behavior:smooth;overflow-x:auto;scrollbar-width:none}.scroll.startHidden{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px)}.scroll.midle{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px, #000 calc(100% - 48px), transparent calc(100% - 20px))}.scroll.endHidden{-webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 48px), transparent calc(100% - 20px))}.tab{display:flex;border:none;min-width:100px;background-color:unset;cursor:pointer;padding:6px 12px;align-items:center;justify-content:center;color:var(--text--primary, #626e82);font-family:var(--font-pattern, \"Sora, Algerian\");font-size:var(--title--small, 14px)}.tab:focus,.forward-button,.backward-button{outline:none}.is-active{position:relative;color:var(--color--primary, #008561)}.is-active::after{content:\"\";position:absolute;width:100%;height:100%;background-color:var(--color--primary, #008561);clip-path:inset(calc(100% - 3px) 0px 0px 0px);animation:activate 0.25s ease-in-out}.is-focused{border:1px dashed var(--color--primary, #000000c5)}.tab-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-shadow:var(--text-shadow);margin-bottom:var(--space--extra-small, 3px)}.forward-button,.backward-button{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;width:16px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.backward-button{left:0px}.forward-button::after,.backward-button::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:10px;height:16px}.forward-button::after{-webkit-mask-image:var(--tabselector--forward-icon);mask-image:var(--tabselector--forward-icon)}.backward-button::after{-webkit-mask-image:var(--tabselector--backward-icon);mask-image:var(--tabselector--backward-icon)}.forward-button:hover::after,.backward-button:hover::after{background-color:var(--color--primary, #4e4e4e)}.hidden{display:none}.scroll::-webkit-scrollbar{display:none}";
|
|
4
|
+
|
|
5
|
+
const EzTabselector = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.ezChange = createEvent(this, "ezChange", 7);
|
|
11
|
+
this.setFocusedParam = (ev) => {
|
|
12
|
+
if (ev.key === "Enter") {
|
|
13
|
+
const selectedTab = this._processedTabs[this._focusedIndex];
|
|
14
|
+
this.handleTabClick(selectedTab);
|
|
15
|
+
ev.preventDefault();
|
|
16
|
+
this.setFocusedTab(selectedTab.index);
|
|
17
|
+
}
|
|
18
|
+
else if (ev.key === "ArrowLeft" || ev.key === "ArrowRight") {
|
|
19
|
+
let operator = undefined;
|
|
20
|
+
if (ev.key === "ArrowLeft") {
|
|
21
|
+
operator = false;
|
|
22
|
+
}
|
|
23
|
+
else if (ev.key === "ArrowRight") {
|
|
24
|
+
operator = true;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (this._focusedIndex === undefined) {
|
|
30
|
+
if (operator === false) {
|
|
31
|
+
this._focusedIndex = this.selectedIndex !== undefined ? this.selectedIndex - 1 : undefined;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this._focusedIndex = this.selectedIndex !== undefined ? this.selectedIndex + 1 : undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
if (operator === false) {
|
|
39
|
+
this._focusedIndex = this._focusedIndex - 1;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this._focusedIndex = this._focusedIndex + 1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (this._focusedIndex < 0) {
|
|
46
|
+
this._focusedIndex = 0;
|
|
47
|
+
}
|
|
48
|
+
else if (this._focusedIndex > this._processedTabs.length - 1) {
|
|
49
|
+
this._focusedIndex = this._processedTabs.length - 1;
|
|
50
|
+
}
|
|
51
|
+
this.setFocusedBtn(true, this._focusedIndex);
|
|
52
|
+
this.setFocusedTab(this._focusedIndex);
|
|
53
|
+
}
|
|
54
|
+
else if (ev.key === "Tab" || ev.key === "Escape") {
|
|
55
|
+
const currentTab = this._processedTabs[this.selectedIndex];
|
|
56
|
+
this._focusedIndex = undefined;
|
|
57
|
+
this.handleTabClick(currentTab);
|
|
58
|
+
ev.preventDefault();
|
|
59
|
+
this.setFocusedTab(this.selectedIndex);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
handleTabClick(tab) {
|
|
64
|
+
this.selectedIndex = tab.index;
|
|
65
|
+
this._focusedIndex = undefined;
|
|
66
|
+
this.selectedTab = tab.tabKey;
|
|
67
|
+
this.ezChange.emit(tab);
|
|
68
|
+
this.setFocusedBtn(false, tab.index);
|
|
69
|
+
}
|
|
70
|
+
componentWillRender() {
|
|
71
|
+
if (!this._processedTabs) {
|
|
72
|
+
this._processedTabs = [];
|
|
73
|
+
if (this.tabs) {
|
|
74
|
+
this.tabs.split(",").forEach((label) => {
|
|
75
|
+
label = label.trim();
|
|
76
|
+
this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
this._hostElem.querySelectorAll("ez-tab").forEach((elem) => {
|
|
80
|
+
const tabKey = elem.getAttribute("tabKey");
|
|
81
|
+
const label = elem.getAttribute("label");
|
|
82
|
+
const t = { label, tabKey, index: this._processedTabs.length };
|
|
83
|
+
const content = elem.firstChild;
|
|
84
|
+
if (content) {
|
|
85
|
+
content.setAttribute("slot", "tab" + t.index);
|
|
86
|
+
this._hostElem.appendChild(content);
|
|
87
|
+
}
|
|
88
|
+
this._processedTabs.push(t);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
handleSlotChange(ev) {
|
|
93
|
+
const slot = ev.target;
|
|
94
|
+
const content = slot.assignedElements()[0];
|
|
95
|
+
if (content) {
|
|
96
|
+
content.style.marginLeft = "6px";
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
scrollBackward() {
|
|
100
|
+
const container = this._scrollContainer;
|
|
101
|
+
if (container) {
|
|
102
|
+
container.scrollLeft -= container.clientWidth;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
scrollFoward() {
|
|
106
|
+
const container = this._scrollContainer;
|
|
107
|
+
if (container) {
|
|
108
|
+
let lastTab = null;
|
|
109
|
+
container.querySelectorAll(".tab").forEach((tab) => {
|
|
110
|
+
if (tab.getBoundingClientRect().right < container.clientWidth) {
|
|
111
|
+
lastTab = tab;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
container.scrollLeft = lastTab.offsetLeft + lastTab.offsetWidth;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
componentDidRender() {
|
|
118
|
+
this.updateScroll();
|
|
119
|
+
}
|
|
120
|
+
updateScroll() {
|
|
121
|
+
const container = this._scrollContainer;
|
|
122
|
+
if (container) {
|
|
123
|
+
const { scrollWidth, clientWidth, scrollLeft } = container;
|
|
124
|
+
const remainingScroll = scrollWidth - clientWidth - Math.ceil(scrollLeft);
|
|
125
|
+
this._startHidden = container.scrollLeft > 0;
|
|
126
|
+
this._endHidden = remainingScroll > 0;
|
|
127
|
+
if (this._startHidden) {
|
|
128
|
+
this._backwardButton.classList.remove("hidden");
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
this._backwardButton.classList.add("hidden");
|
|
132
|
+
}
|
|
133
|
+
if (this._endHidden) {
|
|
134
|
+
this._forwardButton.classList.remove("hidden");
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
this._forwardButton.classList.add("hidden");
|
|
138
|
+
}
|
|
139
|
+
const classNames = ["", "startHidden", "endHidden", "midle"];
|
|
140
|
+
const currentClass = classNames[Number(this._startHidden) | Number(this._endHidden) << 1];
|
|
141
|
+
classNames.forEach((name) => {
|
|
142
|
+
if (name !== currentClass && container.classList.contains(name)) {
|
|
143
|
+
container.classList.remove(name);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
if (currentClass && !container.classList.contains(currentClass)) {
|
|
147
|
+
container.classList.add(currentClass);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
domScrollHandler() {
|
|
152
|
+
window.clearTimeout(this._scrollCallBack);
|
|
153
|
+
this._scrollCallBack = window.setTimeout(() => { this.updateScroll(); }, 200);
|
|
154
|
+
}
|
|
155
|
+
setFocusedTab(index) {
|
|
156
|
+
window.clearTimeout(this._scrollCallBackTest);
|
|
157
|
+
this._scrollCallBackTest = window.setTimeout(() => {
|
|
158
|
+
const tabtoscroll = this._scrollContainer.querySelector(`#tab${index}`);
|
|
159
|
+
tabtoscroll.scrollIntoView();
|
|
160
|
+
}, 200);
|
|
161
|
+
}
|
|
162
|
+
getTextWidth(text) {
|
|
163
|
+
if (this._textMesurement === undefined) {
|
|
164
|
+
this._textMesurement = this._hostElem.shadowRoot.ownerDocument.createElement("canvas");
|
|
165
|
+
}
|
|
166
|
+
const context = this._textMesurement.getContext("2d");
|
|
167
|
+
context.font = "14px Sora, Algerian";
|
|
168
|
+
return Math.min(220, 24 + context.measureText(text).width) + "px";
|
|
169
|
+
}
|
|
170
|
+
;
|
|
171
|
+
setFocusedBtn(visible, parameter) {
|
|
172
|
+
const tabsButtons = this._scrollContainer.querySelectorAll(".tab");
|
|
173
|
+
tabsButtons.forEach((el) => {
|
|
174
|
+
el.classList.remove("is-focused");
|
|
175
|
+
if (el.id === "tab" + parameter && visible) {
|
|
176
|
+
el.classList.add("is-focused");
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
render() {
|
|
181
|
+
return (h(Host, null, h("button", { class: "backward-button", ref: (el) => this._backwardButton = el, onClick: () => this.scrollBackward() }), 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) };
|
|
183
|
+
const tabId = "tab" + index;
|
|
184
|
+
const isSelected = index === this.selectedIndex || (this.selectedTab && tab.tabKey === this.selectedTab);
|
|
185
|
+
if (isSelected) {
|
|
186
|
+
this.selectedTab = tab.tabKey;
|
|
187
|
+
this.selectedIndex = index;
|
|
188
|
+
}
|
|
189
|
+
return h("button", { id: tabId, class: `tab${isSelected ? " is-active" : ""}`, onClick: () => this.handleTabClick(tab), style: labelStyle }, h("span", { class: "tab-label", title: tab.label }, tab.label), h("slot", { name: tabId, onSlotchange: (ev) => { this.handleSlotChange(ev); } }));
|
|
190
|
+
})), h("button", { class: "forward-button", ref: (el) => this._forwardButton = el, onClick: () => this.scrollFoward() })));
|
|
191
|
+
}
|
|
192
|
+
get _hostElem() { return this; }
|
|
193
|
+
static get style() { return ezTabselectorCss; }
|
|
194
|
+
}, [1, "ez-tabselector", {
|
|
195
|
+
"selectedIndex": [1538, "selected-index"],
|
|
196
|
+
"selectedTab": [1537, "selected-tab"],
|
|
197
|
+
"tabs": [1]
|
|
198
|
+
}]);
|
|
199
|
+
function defineCustomElement() {
|
|
200
|
+
if (typeof customElements === "undefined") {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const components = ["ez-tabselector"];
|
|
204
|
+
components.forEach(tagName => { switch (tagName) {
|
|
205
|
+
case "ez-tabselector":
|
|
206
|
+
if (!customElements.get(tagName)) {
|
|
207
|
+
customElements.define(tagName, EzTabselector);
|
|
208
|
+
}
|
|
209
|
+
break;
|
|
210
|
+
} });
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export { EzTabselector as E, defineCustomElement as d };
|