@sankhyalabs/ezui 1.1.4 → 1.1.8
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/README.md +72 -72
- package/dist/{ezui/DataUnit-285bec19.js → cjs/DataUnit-28b290cb.js} +382 -369
- package/dist/{ezui/index-919090de.js → cjs/RequestMetadata-2cd01e8a.js} +4 -383
- package/dist/cjs/ez-action-chip.cjs.entry.js +52 -0
- package/dist/cjs/ez-button_14.cjs.entry.js +3341 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +131 -0
- package/dist/cjs/ez-modal.cjs.entry.js +115 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +248 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +180 -0
- package/dist/cjs/ezui.cjs.js +19 -0
- package/dist/cjs/form-metadata.cjs.entry.js +74 -0
- package/dist/cjs/index-9403fe8f.js +1322 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +31 -0
- package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -0
- package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -0
- package/dist/collection/components/ez-button/ez-button.css +94 -0
- package/dist/collection/components/ez-button/ez-button.js +125 -0
- package/dist/collection/components/ez-calendar/ez-calendar.css +210 -0
- package/dist/collection/components/ez-calendar/ez-calendar.js +215 -0
- package/dist/collection/components/ez-check/ez-check.css +266 -0
- package/dist/collection/components/ez-check/ez-check.js +168 -0
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +68 -0
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -0
- package/dist/collection/components/ez-date-input/ez-date-input.css +39 -0
- package/dist/collection/components/ez-date-input/ez-date-input.js +172 -0
- package/dist/collection/components/ez-form/ez-form.css +19 -0
- package/dist/collection/components/ez-form/ez-form.js +368 -0
- package/dist/collection/components/ez-form/store/Form.actions.js +132 -0
- package/dist/collection/components/ez-form/store/Form.reducer.js +194 -0
- package/dist/collection/components/ez-form/store/Form.selectors.js +44 -0
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +207 -0
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -0
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +24 -0
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -0
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -0
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -0
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -0
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -0
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -0
- package/dist/collection/components/ez-icon/ez-icon.css +37 -0
- package/dist/collection/components/ez-icon/ez-icon.js +56 -0
- package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -0
- package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -0
- package/dist/collection/components/ez-modal/ez-modal.css +87 -0
- package/dist/collection/components/ez-modal/ez-modal.js +224 -0
- package/dist/collection/components/ez-number-input/ez-number-input.css +144 -0
- package/dist/collection/components/ez-number-input/ez-number-input.js +465 -0
- package/dist/collection/components/ez-popover/ez-popover.css +39 -0
- package/dist/collection/components/ez-popover/ez-popover.js +323 -0
- package/dist/collection/components/ez-search/ez-search.css +296 -0
- package/dist/{ezui/ez-search.entry.js → collection/components/ez-search/ez-search.js} +527 -334
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +126 -0
- package/dist/{ezui/ez-tabselector.entry.js → collection/components/ez-tabselector/ez-tabselector.js} +283 -209
- package/dist/collection/components/ez-text-area/ez-text-area.css +140 -0
- package/dist/collection/components/ez-text-area/ez-text-area.js +267 -0
- package/dist/collection/components/ez-text-input/ez-text-input.css +170 -0
- package/dist/collection/components/ez-text-input/ez-text-input.js +395 -0
- package/dist/collection/components/ez-time-input/ez-time-input.css +155 -0
- package/dist/collection/components/ez-time-input/ez-time-input.js +326 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/servidor.js +101 -0
- package/dist/collection/utils/FloatingManager.js +16 -0
- package/dist/collection/utils/utils.js +6 -0
- package/dist/custom-elements/index.js +5071 -0
- package/dist/esm/DataUnit-69e518fa.js +378 -0
- package/dist/esm/RequestMetadata-c265c9d5.js +527 -0
- package/dist/{ezui → esm}/ez-action-chip.entry.js +42 -42
- package/dist/esm/ez-button_14.entry.js +3324 -0
- package/dist/{ezui → esm}/ez-label-chip.entry.js +121 -121
- package/dist/{ezui → esm}/ez-modal.entry.js +105 -96
- package/dist/{ezui → esm}/ez-number-input.entry.js +238 -238
- package/dist/{ezui → esm}/ez-time-input.entry.js +170 -170
- package/dist/esm/ezui.js +17 -0
- package/dist/{ezui → esm}/form-metadata.entry.js +66 -66
- package/dist/esm/index-95bb3fd9.js +1293 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/ezui/ezui.esm.js +1 -122
- package/dist/ezui/index.esm.js +0 -1
- package/dist/ezui/p-10ef58b3.js +1 -0
- package/dist/ezui/p-185c57f4.js +1 -0
- package/dist/ezui/p-22b82efb.entry.js +1 -0
- package/dist/ezui/p-77fdb4fd.entry.js +1 -0
- package/dist/ezui/p-9dfccb16.js +1 -0
- package/dist/ezui/p-b0974f4f.entry.js +1 -0
- package/dist/ezui/p-db11c600.entry.js +1 -0
- package/dist/ezui/p-dd4331b7.entry.js +1 -0
- package/dist/ezui/p-f6fd31ab.entry.js +1 -0
- package/dist/ezui/p-fa260f22.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
- package/dist/types/components/ez-button/ez-button.d.ts +20 -20
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
- package/dist/types/components/ez-check/ez-check.d.ts +32 -32
- package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
- package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
- package/dist/types/components/ez-form/ez-form.d.ts +31 -27
- package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -104
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -11
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -13
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +55 -48
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -7
- package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
- package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
- package/dist/types/components/ez-modal/ez-modal.d.ts +32 -26
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
- package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
- package/dist/types/components/ez-search/ez-search.d.ts +95 -95
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
- package/dist/types/components.d.ts +8 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +2 -2
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +13 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +114 -114
- package/react/components.d.ts +22 -0
- package/react/components.js +25 -0
- package/react/components.js.map +1 -0
- package/react/react-component-lib/createComponent.d.ts +10 -0
- package/react/react-component-lib/createComponent.js +59 -0
- package/react/react-component-lib/createComponent.js.map +1 -0
- package/react/react-component-lib/createOverlayComponent.d.ts +20 -0
- package/react/react-component-lib/createOverlayComponent.js +89 -0
- package/react/react-component-lib/createOverlayComponent.js.map +1 -0
- package/react/react-component-lib/index.d.ts +2 -0
- package/react/react-component-lib/index.js +3 -0
- package/react/react-component-lib/index.js.map +1 -0
- package/react/react-component-lib/interfaces.d.ts +29 -0
- package/react/react-component-lib/interfaces.js +1 -0
- package/react/react-component-lib/interfaces.js.map +1 -0
- package/react/react-component-lib/utils/attachProps.d.ts +12 -0
- package/react/react-component-lib/utils/attachProps.js +96 -0
- package/react/react-component-lib/utils/attachProps.js.map +1 -0
- package/react/react-component-lib/utils/case.d.ts +2 -0
- package/react/react-component-lib/utils/case.js +7 -0
- package/react/react-component-lib/utils/case.js.map +1 -0
- package/react/react-component-lib/utils/dev.d.ts +2 -0
- package/react/react-component-lib/utils/dev.js +13 -0
- package/react/react-component-lib/utils/dev.js.map +1 -0
- package/react/react-component-lib/utils/index.d.ts +7 -0
- package/react/react-component-lib/utils/index.js +21 -0
- package/react/react-component-lib/utils/index.js.map +1 -0
- package/dist/ezui/app-globals-0f993ce5.js +0 -3
- package/dist/ezui/css-shim-003e9264.js +0 -4
- package/dist/ezui/dom-1b195079.js +0 -73
- package/dist/ezui/ez-button.entry.js +0 -47
- package/dist/ezui/ez-calendar.entry.js +0 -102
- package/dist/ezui/ez-check.entry.js +0 -62
- package/dist/ezui/ez-collapsable-box.entry.js +0 -32
- package/dist/ezui/ez-combo-box.entry.js +0 -181
- package/dist/ezui/ez-date-input.entry.js +0 -77
- package/dist/ezui/ez-form.entry.js +0 -1907
- package/dist/ezui/ez-icon.entry.js +0 -17
- package/dist/ezui/ez-popover.entry.js +0 -112
- package/dist/ezui/ez-text-area.entry.js +0 -105
- package/dist/ezui/ez-text-input.entry.js +0 -202
- package/dist/ezui/index-39044be2.js +0 -2832
- package/dist/ezui/place-holder.entry.js +0 -15
- package/dist/ezui/shadow-css-c1ad5fdc.js +0 -383
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
@keyframes activate {
|
|
2
|
+
0% { clip-path: inset(calc(100% - 3px) 50% 0px 50% ); }
|
|
3
|
+
100% { clip-path: inset(calc(100% - 3px) 0px 0px 0px ); }
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:host {
|
|
7
|
+
display: flex;
|
|
8
|
+
position: relative;
|
|
9
|
+
width: 100%;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
margin-bottom: var(--space--large, 24px);
|
|
14
|
+
--tab__box--box-shadow: var(--shadow, 0px 0px 8px 0px #000);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.scroll {
|
|
18
|
+
display: flex;
|
|
19
|
+
width: 100%;
|
|
20
|
+
scroll-behavior: smooth;
|
|
21
|
+
overflow-x: auto;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.scroll.startHidden{
|
|
25
|
+
-webkit-mask-image: linear-gradient(90deg, transparent 20px, #000 48px);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.scroll.midle{
|
|
29
|
+
-webkit-mask-image: linear-gradient(90deg, transparent 20px, #000 48px, #000 calc(100% - 48px), transparent calc(100% - 20px));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.scroll.endHidden{
|
|
33
|
+
-webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent calc(100% - 20px));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.tab{
|
|
37
|
+
display: flex;
|
|
38
|
+
border: none;
|
|
39
|
+
min-width: 100px;
|
|
40
|
+
background-color: unset;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
padding: 6px 12px;/*FIXME: Oza - precisamos usar tokens?*/
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
color: var(--text--primary, #626e82);
|
|
46
|
+
font-family: var(--font-pattern, "Sora, Algerian");
|
|
47
|
+
font-size: var(--title--small, 14px);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.tab:focus, .forward-button, .backward-button{
|
|
51
|
+
outline: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.is-active{
|
|
55
|
+
position: relative;
|
|
56
|
+
color: var(--color--primary, #008561);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.is-active::after {
|
|
60
|
+
content: "";
|
|
61
|
+
position: absolute;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
64
|
+
background-color: var(--color--primary, #008561);
|
|
65
|
+
clip-path: inset(calc(100% - 3px) 0px 0px 0px );
|
|
66
|
+
animation: activate 0.25s ease-in-out;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.is-focused{
|
|
70
|
+
border: 1px dashed var(--color--primary, #000000c5);
|
|
71
|
+
/* border-radius: 5px 5px 0px 0px; */
|
|
72
|
+
/* box-shadow: var(--tab__box--box-shadow); */
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.tab-label{
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
white-space: nowrap;
|
|
78
|
+
text-overflow: ellipsis;
|
|
79
|
+
text-shadow: var(--text-shadow);
|
|
80
|
+
margin-bottom: var(--space--extra-small, 3px);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.forward-button, .backward-button{
|
|
84
|
+
position: absolute;
|
|
85
|
+
z-index: 1;
|
|
86
|
+
display: flex;
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
padding: 0px;
|
|
89
|
+
top: 0px;
|
|
90
|
+
right: 0px;
|
|
91
|
+
width: 16px;
|
|
92
|
+
height: 100%;
|
|
93
|
+
border: none;
|
|
94
|
+
background-color: unset;
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
justify-content: center;
|
|
97
|
+
align-items: center;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.backward-button{
|
|
101
|
+
left: 0px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.forward-button::after, .backward-button::after{
|
|
105
|
+
content: '';
|
|
106
|
+
display: flex;
|
|
107
|
+
background-color: var(--text--primary, #008561);
|
|
108
|
+
width: 10px;
|
|
109
|
+
height: 16px;
|
|
110
|
+
clip-path: path("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");
|
|
111
|
+
}
|
|
112
|
+
.backward-button::after{
|
|
113
|
+
clip-path: path("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");
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.forward-button:hover::after, .backward-button:hover::after{
|
|
117
|
+
background-color: var(--color--primary, #4e4e4e);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.hidden{
|
|
121
|
+
display: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.scroll::-webkit-scrollbar{
|
|
125
|
+
display: none;
|
|
126
|
+
}
|
package/dist/{ezui/ez-tabselector.entry.js → collection/components/ez-tabselector/ez-tabselector.js}
RENAMED
|
@@ -1,209 +1,283 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ev.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.foucusedindex =
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
container.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
window.
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
get
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
1
|
+
import { Component, Event, Element, h, Prop, Host } from '@stencil/core';
|
|
2
|
+
export class EzTabselector {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.setFoucusedParam = (ev) => {
|
|
5
|
+
if (ev.key === 'Enter') {
|
|
6
|
+
this.selectedindex = this.foucusedindex;
|
|
7
|
+
this.foucusedindex = undefined;
|
|
8
|
+
this.selectedtab = this._processedTabs[this.selectedindex]['tabKey'];
|
|
9
|
+
this.handleTabClick(this.selectedtab, parseInt(this.selectedindex));
|
|
10
|
+
ev.preventDefault();
|
|
11
|
+
this.setFocusedTab(this.selectedindex);
|
|
12
|
+
}
|
|
13
|
+
else if (ev.key === 'ArrowLeft' || ev.key === 'ArrowRight') {
|
|
14
|
+
let operator = undefined;
|
|
15
|
+
if (ev.key === 'ArrowLeft') {
|
|
16
|
+
operator = false;
|
|
17
|
+
}
|
|
18
|
+
else if (ev.key === 'ArrowRight') {
|
|
19
|
+
operator = true;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (this.foucusedindex === undefined) {
|
|
25
|
+
if (operator === false) {
|
|
26
|
+
this.foucusedindex = this.selectedindex !== undefined ? (parseInt(this.selectedindex) - 1).toString() : undefined;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
this.foucusedindex = this.selectedindex !== undefined ? (parseInt(this.selectedindex) + 1).toString() : undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
if (operator === false) {
|
|
34
|
+
this.foucusedindex = (parseInt(this.foucusedindex) - 1).toString();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.foucusedindex = (parseInt(this.foucusedindex) + 1).toString();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (parseInt(this.foucusedindex) < 0) {
|
|
41
|
+
this.foucusedindex = '0';
|
|
42
|
+
}
|
|
43
|
+
else if (parseInt(this.foucusedindex) > this._processedTabs.length - 1) {
|
|
44
|
+
this.foucusedindex = (this._processedTabs.length - 1).toString();
|
|
45
|
+
}
|
|
46
|
+
this.setFoucusedBtn(true, this.foucusedindex);
|
|
47
|
+
this.setFocusedTab(this.foucusedindex);
|
|
48
|
+
this.change.emit();
|
|
49
|
+
}
|
|
50
|
+
else if (ev.key === 'Tab' || ev.key === 'Escape') {
|
|
51
|
+
this.foucusedindex = undefined;
|
|
52
|
+
this.selectedtab = this._processedTabs[this.selectedindex]['tabKey'];
|
|
53
|
+
this.handleTabClick(this.selectedtab, parseInt(this.selectedindex));
|
|
54
|
+
ev.preventDefault();
|
|
55
|
+
this.setFocusedTab(this.selectedindex);
|
|
56
|
+
}
|
|
57
|
+
// this.setFocusedTab();
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
handleTabClick(tab, index) {
|
|
61
|
+
this.selectedindex = index.toString();
|
|
62
|
+
this.foucusedindex = undefined;
|
|
63
|
+
this.selectedtab = tab;
|
|
64
|
+
this.change.emit();
|
|
65
|
+
this.setFoucusedBtn(false, this.selectedindex);
|
|
66
|
+
}
|
|
67
|
+
componentWillRender() {
|
|
68
|
+
if (!this._processedTabs) {
|
|
69
|
+
this._processedTabs = [];
|
|
70
|
+
if (this.tabs) {
|
|
71
|
+
this.tabs.split(',').forEach((label) => {
|
|
72
|
+
label = label.trim();
|
|
73
|
+
this._processedTabs.push(new Tab(label, label));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
this._hostElem.querySelectorAll('ez-tab').forEach((elem) => {
|
|
77
|
+
const tabKey = elem.getAttribute('tabKey');
|
|
78
|
+
const label = elem.getAttribute('label');
|
|
79
|
+
const t = new Tab(label, tabKey);
|
|
80
|
+
const content = elem.firstChild;
|
|
81
|
+
if (content) {
|
|
82
|
+
content.setAttribute('slot', 'tab' + this._processedTabs.length);
|
|
83
|
+
this._hostElem.appendChild(content);
|
|
84
|
+
}
|
|
85
|
+
this._processedTabs.push(t);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
handleSlotChange(ev) {
|
|
90
|
+
const slot = ev.target;
|
|
91
|
+
const content = slot.assignedElements()[0];
|
|
92
|
+
if (content) {
|
|
93
|
+
content.style.marginLeft = "6px";
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
scrollBackward() {
|
|
97
|
+
const container = this._scrollContainer;
|
|
98
|
+
if (container) {
|
|
99
|
+
container.scrollLeft -= container.clientWidth;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
scrollFoward() {
|
|
103
|
+
const container = this._scrollContainer;
|
|
104
|
+
if (container) {
|
|
105
|
+
let lastTab = null;
|
|
106
|
+
container.querySelectorAll('.tab').forEach((tab) => {
|
|
107
|
+
if (tab.getBoundingClientRect().right < container.clientWidth) {
|
|
108
|
+
lastTab = tab;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
container.scrollLeft = lastTab.offsetLeft + lastTab.offsetWidth;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
componentDidRender() {
|
|
115
|
+
this.updateScroll();
|
|
116
|
+
}
|
|
117
|
+
updateScroll() {
|
|
118
|
+
const container = this._scrollContainer;
|
|
119
|
+
if (container) {
|
|
120
|
+
const { scrollWidth, clientWidth, scrollLeft } = container;
|
|
121
|
+
const remainingScroll = scrollWidth - clientWidth - Math.ceil(scrollLeft);
|
|
122
|
+
this._startHidden = container.scrollLeft > 0;
|
|
123
|
+
this._endHidden = remainingScroll > 0;
|
|
124
|
+
if (this._startHidden) {
|
|
125
|
+
this._backwardButton.classList.remove('hidden');
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this._backwardButton.classList.add('hidden');
|
|
129
|
+
}
|
|
130
|
+
if (this._endHidden) {
|
|
131
|
+
this._forwardButton.classList.remove('hidden');
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
this._forwardButton.classList.add('hidden');
|
|
135
|
+
}
|
|
136
|
+
const classNames = ['', 'startHidden', 'endHidden', 'midle'];
|
|
137
|
+
const currentClass = classNames[Number(this._startHidden) | Number(this._endHidden) << 1];
|
|
138
|
+
classNames.forEach((name) => {
|
|
139
|
+
if (name !== currentClass && container.classList.contains(name)) {
|
|
140
|
+
container.classList.remove(name);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
if (currentClass && !container.classList.contains(currentClass)) {
|
|
144
|
+
container.classList.add(currentClass);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
domScrollHandler() {
|
|
149
|
+
window.clearTimeout(this._scrollCallBack);
|
|
150
|
+
this._scrollCallBack = window.setTimeout(() => { this.updateScroll(); }, 200);
|
|
151
|
+
}
|
|
152
|
+
setFocusedTab(index) {
|
|
153
|
+
window.clearTimeout(this._scrollCallBackTeste);
|
|
154
|
+
this._scrollCallBackTeste = window.setTimeout(() => {
|
|
155
|
+
const tabtoscroll = this._scrollContainer.querySelector(`#tab${index}`);
|
|
156
|
+
console.log('tabtoscroll => ID', `#tab${this.selectedindex}`);
|
|
157
|
+
console.log('tabtoscroll', tabtoscroll);
|
|
158
|
+
tabtoscroll.scrollIntoView();
|
|
159
|
+
}, 200);
|
|
160
|
+
}
|
|
161
|
+
getTextWidth(text) {
|
|
162
|
+
if (this._textMesurement === undefined) {
|
|
163
|
+
this._textMesurement = this._hostElem.shadowRoot.ownerDocument.createElement("canvas");
|
|
164
|
+
}
|
|
165
|
+
const context = this._textMesurement.getContext("2d");
|
|
166
|
+
context.font = '14px Sora, Algerian';
|
|
167
|
+
return Math.min(220, 24 + context.measureText(text).width) + 'px';
|
|
168
|
+
}
|
|
169
|
+
;
|
|
170
|
+
setFoucusedBtn(visible, paramater) {
|
|
171
|
+
const tabsButtons = this._scrollContainer.querySelectorAll('.tab');
|
|
172
|
+
tabsButtons.forEach((el) => {
|
|
173
|
+
el.classList.remove('is-focused');
|
|
174
|
+
if (el.id === 'tab' + paramater && visible) {
|
|
175
|
+
el.classList.add('is-focused');
|
|
176
|
+
}
|
|
177
|
+
;
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
render() {
|
|
181
|
+
return (h(Host, null,
|
|
182
|
+
h("button", { class: "backward-button", ref: (el) => this._backwardButton = el, onClick: () => this.scrollBackward() }),
|
|
183
|
+
h("div", { class: "scroll", ref: (el) => this._scrollContainer = el,
|
|
184
|
+
// onScroll={() => this.domScrollHandler()}
|
|
185
|
+
onKeyDown: (ev) => this.setFoucusedParam(ev) }, this._processedTabs.map((tab, index) => {
|
|
186
|
+
const labelStyle = { 'min-width': this.getTextWidth(tab.label) };
|
|
187
|
+
const tabId = "tab" + index;
|
|
188
|
+
const isSelected = index === parseInt(this.selectedindex) || (this.selectedtab && tab.tabKey === this.selectedtab);
|
|
189
|
+
if (isSelected) {
|
|
190
|
+
this.selectedtab = tab.tabKey;
|
|
191
|
+
this.selectedindex = index.toString();
|
|
192
|
+
}
|
|
193
|
+
return h("button", { id: tabId, class: `tab${isSelected ? " is-active" : ""}`, onClick: () => this.handleTabClick(tab.tabKey, index), style: labelStyle },
|
|
194
|
+
h("span", { class: "tab-label", title: tab.label }, tab.label),
|
|
195
|
+
h("slot", { name: tabId, onSlotchange: (ev) => { this.handleSlotChange(ev); } }));
|
|
196
|
+
})),
|
|
197
|
+
h("button", { class: "forward-button", ref: (el) => this._forwardButton = el, onClick: () => this.scrollFoward() })));
|
|
198
|
+
}
|
|
199
|
+
static get is() { return "ez-tabselector"; }
|
|
200
|
+
static get encapsulation() { return "shadow"; }
|
|
201
|
+
static get originalStyleUrls() { return {
|
|
202
|
+
"$": ["ez-tabselector.css"]
|
|
203
|
+
}; }
|
|
204
|
+
static get styleUrls() { return {
|
|
205
|
+
"$": ["ez-tabselector.css"]
|
|
206
|
+
}; }
|
|
207
|
+
static get properties() { return {
|
|
208
|
+
"selectedindex": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"mutable": true,
|
|
211
|
+
"complexType": {
|
|
212
|
+
"original": "string",
|
|
213
|
+
"resolved": "string",
|
|
214
|
+
"references": {}
|
|
215
|
+
},
|
|
216
|
+
"required": false,
|
|
217
|
+
"optional": false,
|
|
218
|
+
"docs": {
|
|
219
|
+
"tags": [],
|
|
220
|
+
"text": ""
|
|
221
|
+
},
|
|
222
|
+
"attribute": "selectedindex",
|
|
223
|
+
"reflect": true
|
|
224
|
+
},
|
|
225
|
+
"selectedtab": {
|
|
226
|
+
"type": "string",
|
|
227
|
+
"mutable": true,
|
|
228
|
+
"complexType": {
|
|
229
|
+
"original": "string",
|
|
230
|
+
"resolved": "string",
|
|
231
|
+
"references": {}
|
|
232
|
+
},
|
|
233
|
+
"required": false,
|
|
234
|
+
"optional": false,
|
|
235
|
+
"docs": {
|
|
236
|
+
"tags": [],
|
|
237
|
+
"text": ""
|
|
238
|
+
},
|
|
239
|
+
"attribute": "selectedtab",
|
|
240
|
+
"reflect": true
|
|
241
|
+
},
|
|
242
|
+
"tabs": {
|
|
243
|
+
"type": "string",
|
|
244
|
+
"mutable": false,
|
|
245
|
+
"complexType": {
|
|
246
|
+
"original": "string",
|
|
247
|
+
"resolved": "string",
|
|
248
|
+
"references": {}
|
|
249
|
+
},
|
|
250
|
+
"required": false,
|
|
251
|
+
"optional": false,
|
|
252
|
+
"docs": {
|
|
253
|
+
"tags": [],
|
|
254
|
+
"text": ""
|
|
255
|
+
},
|
|
256
|
+
"attribute": "tabs",
|
|
257
|
+
"reflect": false
|
|
258
|
+
}
|
|
259
|
+
}; }
|
|
260
|
+
static get events() { return [{
|
|
261
|
+
"method": "change",
|
|
262
|
+
"name": "change",
|
|
263
|
+
"bubbles": true,
|
|
264
|
+
"cancelable": true,
|
|
265
|
+
"composed": true,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": ""
|
|
269
|
+
},
|
|
270
|
+
"complexType": {
|
|
271
|
+
"original": "string",
|
|
272
|
+
"resolved": "string",
|
|
273
|
+
"references": {}
|
|
274
|
+
}
|
|
275
|
+
}]; }
|
|
276
|
+
static get elementRef() { return "_hostElem"; }
|
|
277
|
+
}
|
|
278
|
+
class Tab {
|
|
279
|
+
constructor(label, tabKey) {
|
|
280
|
+
this.label = label;
|
|
281
|
+
this.tabKey = tabKey;
|
|
282
|
+
}
|
|
283
|
+
}
|