@sankhyalabs/ezui 1.1.70 → 1.1.73
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 +13 -6
- package/dist/cjs/ez-dialog.cjs.entry.js +1 -1
- package/dist/cjs/ez-label-chip.cjs.entry.js +1 -1
- package/dist/cjs/ez-list.cjs.entry.js +174 -0
- package/dist/cjs/ez-modal.cjs.entry.js +1 -1
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +1 -1
- package/dist/cjs/ez-popup.cjs.entry.js +1 -1
- 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-4d2896bb.js} +10 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/assets/actions-sprite.svg +257 -0
- package/dist/collection/components/ez-button/ez-button.css +4 -1
- package/dist/collection/components/ez-button/ez-button.js +5 -2
- 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-list/ez-list.css +131 -0
- package/dist/collection/components/ez-list/ez-list.js +252 -0
- 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.d.ts +6 -0
- package/dist/custom-elements/index.js +204 -76
- 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 +13 -6
- package/dist/esm/ez-dialog.entry.js +1 -1
- package/dist/esm/ez-label-chip.entry.js +1 -1
- package/dist/esm/ez-list.entry.js +170 -0
- package/dist/esm/ez-modal.entry.js +1 -1
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +1 -1
- package/dist/esm/ez-popup.entry.js +1 -1
- 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-33153059.js} +10 -2
- package/dist/esm/loader.js +2 -2
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-061d21ba.entry.js +1 -0
- package/dist/ezui/{p-8d547517.entry.js → p-0db8d49b.entry.js} +1 -1
- package/dist/ezui/{p-1c33a56d.entry.js → p-129b53df.entry.js} +1 -1
- package/dist/ezui/{p-a88ee12f.entry.js → p-15743b09.entry.js} +1 -1
- package/dist/ezui/p-25953d44.entry.js +1 -0
- package/dist/ezui/p-4df6f855.js +1 -0
- package/dist/ezui/{p-a7e23f65.entry.js → p-50464bdf.entry.js} +1 -1
- package/dist/ezui/{p-1bc9ddad.entry.js → p-67410dfa.entry.js} +1 -1
- package/dist/ezui/p-74809665.entry.js +1 -0
- package/dist/ezui/{p-74e4415e.entry.js → p-7f3bc6d9.entry.js} +1 -1
- package/dist/ezui/{p-b692a0ab.entry.js → p-8818da66.entry.js} +1 -1
- package/dist/ezui/{p-9702db61.entry.js → p-a99f8d42.entry.js} +1 -1
- package/dist/ezui/p-d1889704.js +1 -0
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +1 -0
- package/dist/types/components/ez-list/ez-list.d.ts +34 -0
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +1 -8
- package/dist/types/components.d.ts +42 -0
- package/dist/types/utils/CSSVarsUtils.d.ts +4 -0
- package/package.json +1 -1
- package/react/components.d.ts +1 -0
- package/react/components.js +1 -0
- package/react/components.js.map +1 -1
- package/dist/ezui/p-762ac7a0.js +0 -1
- package/dist/ezui/p-b6e0fd3e.entry.js +0 -1
- package/dist/ezui/p-f7d7fb7f.entry.js +0 -1
|
@@ -11,9 +11,9 @@ export class EzButton {
|
|
|
11
11
|
this.mode = "regular";
|
|
12
12
|
}
|
|
13
13
|
handleSlotChange(ev) {
|
|
14
|
+
const slot = ev.target;
|
|
15
|
+
const content = slot.assignedElements()[0];
|
|
14
16
|
if (this.mode == "link") {
|
|
15
|
-
const slot = ev.target;
|
|
16
|
-
const content = slot.assignedElements()[0];
|
|
17
17
|
content.style.display = "inline";
|
|
18
18
|
if (slot.name == "leftIcon") {
|
|
19
19
|
content.style.paddingRight = "var(--button__inline__icon--padding)";
|
|
@@ -22,6 +22,9 @@ export class EzButton {
|
|
|
22
22
|
content.style.paddingLeft = "var(--button__inline__icon--padding)";
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
else {
|
|
26
|
+
content.style.setProperty('--ez-icon--color', 'var(--ez-icon--color)');
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
render() {
|
|
27
30
|
if (this.mode == "icon") {
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
|
-
/*@doc Define a cor de fundo do input.*/
|
|
5
|
-
--it__input--background-color: var(--background--medium, #e0e0e0);
|
|
6
|
-
/*@doc Define a cor da borda do input.*/
|
|
7
|
-
--it__input--border-color: var(--it__input--background-color);
|
|
8
4
|
/*@doc Contém a imagem do calendário.*/
|
|
9
5
|
--di__calendar-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z"/></svg>');
|
|
10
6
|
}
|
|
11
7
|
|
|
12
|
-
.text-input {
|
|
13
|
-
--it__input--background-color: inherit;
|
|
14
|
-
--it__input--border-color: inherit;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
8
|
.btn-open-cal {
|
|
18
9
|
outline: none;
|
|
19
10
|
border: none;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Component, Element, Host, h, Prop, Watch, Event } from '@stencil/core';
|
|
2
2
|
import { DateUtils } from '@sankhyalabs/core';
|
|
3
|
+
import CSSVarsUtils from '../../utils/CSSVarsUtils';
|
|
3
4
|
export class EzDateInput {
|
|
4
5
|
constructor() {
|
|
5
6
|
/**
|
|
@@ -57,9 +58,12 @@ export class EzDateInput {
|
|
|
57
58
|
getTextValue(d) {
|
|
58
59
|
return d ? new Intl.DateTimeFormat('pt-BR').format(d) : null;
|
|
59
60
|
}
|
|
61
|
+
componentDidLoad() {
|
|
62
|
+
CSSVarsUtils.applyVarsTextInput(this._elem, this._textInput);
|
|
63
|
+
}
|
|
60
64
|
render() {
|
|
61
65
|
return (h(Host, null,
|
|
62
|
-
h("ez-text-input", {
|
|
66
|
+
h("ez-text-input", { ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => { if (event.key === 'H' || event.key === 'h')
|
|
63
67
|
this.changeValue(new Date()); }, label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errorMessage: this.errorMessage },
|
|
64
68
|
h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })),
|
|
65
69
|
h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
|
|
3
|
+
/* @doc Define o raio da borda do componente. */
|
|
4
|
+
--list__host--border-radius: var(--border--radius-medium, 12px);
|
|
5
|
+
/* @doc Define o espaçamento entre a lista e o componente. */
|
|
6
|
+
--list__host--padding: var(--space--medium, 12px);
|
|
7
|
+
/* @doc Define o espaçamento interno do ícone. */
|
|
8
|
+
--list__icon__padding: var(--space--small, 6px);
|
|
9
|
+
/* --list__item__padding: var(--space--small, 6px); */
|
|
10
|
+
/* @doc Define o espaçamento externo do item da lista. */
|
|
11
|
+
--list__item__margin: 0 var(--space--small, 6px);
|
|
12
|
+
/* @doc Define a cor do texto do item da lista. */
|
|
13
|
+
--list__item--color: var(--title--primary, #2b3a54);
|
|
14
|
+
/* @doc Define o estilo borda inferior do item da lista. */
|
|
15
|
+
--list__item--border-bottom: var(--border--small, 1px solid);
|
|
16
|
+
/* @doc Define a cor da borda inferior do item da lista. */
|
|
17
|
+
--list__item--border-color: var(--title--primary, #2b3a54);
|
|
18
|
+
/* @doc Define o estilo do texto do item da lista. */
|
|
19
|
+
--list__item--font-family: var(--font-pattern, #2b3a54);
|
|
20
|
+
/* @doc Define o tamanho do texto do item da lista. */
|
|
21
|
+
--list__item--font-size: var(--text--medium, 14px);
|
|
22
|
+
/* @doc Define a imagem do ícone de drag. */
|
|
23
|
+
--list__draggable__icon--image: url('data:image/svg+xml;utf8,<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m 12,16 a 2,2 0 0 1 2,2 2,2 0 0 1 -2,2 2,2 0 0 1 -2,-2 2,2 0 0 1 2,-2 m 0,-6 a 2,2 0 0 1 2,2 2,2 0 0 1 -2,2 2,2 0 0 1 -2,-2 2,2 0 0 1 2,-2 m 0,-6 a 2,2 0 0 1 2,2 2,2 0 0 1 -2,2 2,2 0 0 1 -2,-2 2,2 0 0 1 2,-2 z"/></svg>');
|
|
24
|
+
|
|
25
|
+
border-radius: var(--list__host--border-radius);
|
|
26
|
+
padding: var(--list__host--padding);
|
|
27
|
+
max-height: 100%;
|
|
28
|
+
width: 100%;
|
|
29
|
+
background-color: #fff;
|
|
30
|
+
display: flex;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.draggable {
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: flex-start;
|
|
38
|
+
/* padding: 0 var(--list__item__padding); */
|
|
39
|
+
flex: 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.draggable-list {
|
|
43
|
+
color: var(--text-color);
|
|
44
|
+
padding: 0;
|
|
45
|
+
margin: 0;
|
|
46
|
+
width: 100%;
|
|
47
|
+
max-height: 100%;
|
|
48
|
+
overflow-y: auto;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.draggable-list li {
|
|
52
|
+
background-color: #fff;
|
|
53
|
+
display: flex;
|
|
54
|
+
margin: var(--list__item__margin);
|
|
55
|
+
font-family: var(--list__item--font-family);
|
|
56
|
+
font-size: var(--list__item--font-size);
|
|
57
|
+
color: var(--list__item--color);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.draggable-list li:not(:last-of-type) {
|
|
61
|
+
border-bottom: var(--list__item--border-bottom);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.draggable-list li.over .draggable {
|
|
65
|
+
background-color: var(--background--strong);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.draggable:hover {
|
|
69
|
+
background-color: var(--background--medium);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.draggable-selected {
|
|
73
|
+
background-color: var(--background--strong) !important;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.draggable-selected div:hover {
|
|
77
|
+
background-color: var(--background--strong) !important;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
/* Precisamos dos tokens do scrollbar */
|
|
82
|
+
.draggable-list::-webkit-scrollbar-track {
|
|
83
|
+
background-color: #f0f2f5;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.draggable-list::-webkit-scrollbar-thumb {
|
|
87
|
+
background-color: var(--title--primary);
|
|
88
|
+
border-radius: var(--space--extra-small);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.draggable-list::-webkit-scrollbar {
|
|
92
|
+
background-color: #f0f2f5;
|
|
93
|
+
height: 6px;
|
|
94
|
+
max-height: 6px;
|
|
95
|
+
min-height: 6px;
|
|
96
|
+
width: 6px;
|
|
97
|
+
max-width: 6px;
|
|
98
|
+
min-width: 6px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.draggable-icon {
|
|
102
|
+
align-items: flex-start;
|
|
103
|
+
display: flex;
|
|
104
|
+
outline: none;
|
|
105
|
+
border: none;
|
|
106
|
+
background-color: unset;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.draggable-icon::after {
|
|
110
|
+
content: '';
|
|
111
|
+
display: flex;
|
|
112
|
+
background-color: var(--list__item--color);
|
|
113
|
+
width: 24px;
|
|
114
|
+
height: 24px;
|
|
115
|
+
-webkit-mask-image: var(--list__draggable__icon--image);
|
|
116
|
+
mask-image: var(--list__draggable__icon--image);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
* {
|
|
120
|
+
box-sizing: border-box;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.checkbox {
|
|
124
|
+
width: fit-content;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.text--ellipsis {
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
text-overflow: ellipsis;
|
|
131
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { Component, Host, h, Prop, Method } from '@stencil/core';
|
|
2
|
+
;
|
|
3
|
+
export class EzList {
|
|
4
|
+
constructor() {
|
|
5
|
+
this._listItems = [];
|
|
6
|
+
/**
|
|
7
|
+
* Define a lista inicial do componente.
|
|
8
|
+
*/
|
|
9
|
+
this.initialList = [];
|
|
10
|
+
/**
|
|
11
|
+
* Define se o componente terá o comportamento de arrasto de linhas.
|
|
12
|
+
*/
|
|
13
|
+
this.draggable = true;
|
|
14
|
+
/**
|
|
15
|
+
* Define se é possível selecionar mais de um registro.
|
|
16
|
+
*/
|
|
17
|
+
this.isMultipleSelection = true;
|
|
18
|
+
}
|
|
19
|
+
createList() {
|
|
20
|
+
[...this.initialList]
|
|
21
|
+
.forEach((item, index) => {
|
|
22
|
+
const listItem = document.createElement('li');
|
|
23
|
+
listItem.setAttribute('data-index', index.toString());
|
|
24
|
+
if (!this.isMultipleSelection)
|
|
25
|
+
listItem.onclick = this.selectLine.bind(this);
|
|
26
|
+
listItem.innerHTML = `
|
|
27
|
+
<div class="draggable" ${this.draggable ? "draggable=true" : ""}>
|
|
28
|
+
|
|
29
|
+
${this.draggable ? '<span class="draggable-icon"></span>' : ""}
|
|
30
|
+
|
|
31
|
+
${this.isMultipleSelection ? `<ez-check class='checkbox' value=${item.checked}></ez-check>` : ''}
|
|
32
|
+
<p title="${item.value}" class="person-name text--ellipsis">${item.value}</p>
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
`;
|
|
36
|
+
this._listItems.push(listItem);
|
|
37
|
+
this._draggableList.appendChild(listItem);
|
|
38
|
+
});
|
|
39
|
+
if (this.draggable) {
|
|
40
|
+
this.handleEventListeners(this._listItems, this._draggableList, this._hostElement, false);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
selectLine(e) {
|
|
44
|
+
var _a, _b, _c;
|
|
45
|
+
this._listItems.forEach(item => { item.classList.remove('draggable-selected'); });
|
|
46
|
+
if (((_a = e.target) === null || _a === void 0 ? void 0 : _a.tagName) === 'SPAN') {
|
|
47
|
+
const span = e.target;
|
|
48
|
+
this._selectedItem = { value: span.parentElement.getElementsByTagName('p')[0].textContent };
|
|
49
|
+
span.parentElement.parentElement.classList.add('draggable-selected');
|
|
50
|
+
}
|
|
51
|
+
else if (((_b = e.target) === null || _b === void 0 ? void 0 : _b.tagName) === 'P') {
|
|
52
|
+
const paragraph = e.target;
|
|
53
|
+
this._selectedItem = { value: paragraph.textContent };
|
|
54
|
+
paragraph.parentElement.parentElement.classList.add('draggable-selected');
|
|
55
|
+
}
|
|
56
|
+
else if (((_c = e.target) === null || _c === void 0 ? void 0 : _c.tagName) === 'DIV') {
|
|
57
|
+
const draggable = e.target;
|
|
58
|
+
this._selectedItem = { value: draggable.getElementsByTagName('p')[0].textContent };
|
|
59
|
+
draggable.parentElement.classList.add('draggable-selected');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
handleEventListeners(listItems, dragableList, hostElement, removeEvents) {
|
|
63
|
+
let _dragStartIndex;
|
|
64
|
+
let _isItemOut = false;
|
|
65
|
+
function dragStart(item) {
|
|
66
|
+
_dragStartIndex = item.parentElement.getAttribute('data-index');
|
|
67
|
+
}
|
|
68
|
+
function dragEnter(item) {
|
|
69
|
+
item.classList.add('over');
|
|
70
|
+
}
|
|
71
|
+
function dragLeave(item) {
|
|
72
|
+
item.classList.remove('over');
|
|
73
|
+
}
|
|
74
|
+
function dragOver(e) {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
}
|
|
77
|
+
function dragDrop(item) {
|
|
78
|
+
if (_isItemOut) {
|
|
79
|
+
let index = +item.getAttribute('data-index');
|
|
80
|
+
const itemRemoved = listItems[index].querySelector('.draggable');
|
|
81
|
+
listItems[index].removeChild(itemRemoved);
|
|
82
|
+
}
|
|
83
|
+
const dragEndIndex = +item.getAttribute('data-index');
|
|
84
|
+
swapItems(+_dragStartIndex, dragEndIndex);
|
|
85
|
+
item.classList.remove('over');
|
|
86
|
+
}
|
|
87
|
+
function swapItems(fromIndex, toIndex) {
|
|
88
|
+
const itemOne = listItems[fromIndex].querySelector('.draggable');
|
|
89
|
+
const itemTwo = listItems[toIndex].querySelector('.draggable');
|
|
90
|
+
listItems[fromIndex].appendChild(itemTwo);
|
|
91
|
+
listItems[toIndex].appendChild(itemOne);
|
|
92
|
+
return listItems;
|
|
93
|
+
}
|
|
94
|
+
if (!removeEvents) {
|
|
95
|
+
hostElement.addEventListener('dragenter', function () { _isItemOut = false; });
|
|
96
|
+
hostElement.addEventListener('dragleave', function () { _isItemOut = true; });
|
|
97
|
+
const draggables = dragableList.querySelectorAll("div.draggable");
|
|
98
|
+
draggables.forEach(draggable => {
|
|
99
|
+
draggable.addEventListener('dragstart', function () { dragStart(draggable); });
|
|
100
|
+
});
|
|
101
|
+
listItems.forEach(item => {
|
|
102
|
+
item.addEventListener('dragover', function (event) { dragOver(event); });
|
|
103
|
+
item.addEventListener('drop', function () { dragDrop(item); });
|
|
104
|
+
item.addEventListener('dragenter', function () { dragEnter(item); });
|
|
105
|
+
item.addEventListener('dragleave', function () { dragLeave(item); });
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
hostElement.removeEventListener('dragenter', function () { _isItemOut = false; });
|
|
110
|
+
hostElement.removeEventListener('dragleave', function () { _isItemOut = true; });
|
|
111
|
+
const draggables = dragableList.querySelectorAll("div.draggable");
|
|
112
|
+
draggables.forEach(draggable => {
|
|
113
|
+
draggable.removeEventListener('dragstart', function () { dragStart(draggable); });
|
|
114
|
+
});
|
|
115
|
+
listItems.forEach(item => {
|
|
116
|
+
item.removeEventListener('dragover', function (event) { dragOver(event); });
|
|
117
|
+
item.removeEventListener('drop', function () { dragDrop(item); });
|
|
118
|
+
item.removeEventListener('dragenter', function () { dragEnter(item); });
|
|
119
|
+
item.removeEventListener('dragleave', function () { dragLeave(item); });
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Retorna uma promessa com o estado da atual lista composta por objetos do tipo {value: string, checked: boolean}.
|
|
125
|
+
*/
|
|
126
|
+
async getState() {
|
|
127
|
+
let emitionList = [];
|
|
128
|
+
this._listItems.forEach(item => {
|
|
129
|
+
let emitionItem = {
|
|
130
|
+
value: this.getValueItem(item),
|
|
131
|
+
checked: this.getChecked(item)
|
|
132
|
+
};
|
|
133
|
+
emitionList.push(emitionItem);
|
|
134
|
+
});
|
|
135
|
+
return emitionList;
|
|
136
|
+
}
|
|
137
|
+
getChecked(item) {
|
|
138
|
+
if (this.isMultipleSelection) {
|
|
139
|
+
return item.children[0].children[1].value;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
if (!this._selectedItem)
|
|
143
|
+
return false;
|
|
144
|
+
return (item.children[0].children[1].textContent === this._selectedItem.value);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
getValueItem(item) {
|
|
148
|
+
if (this.isMultipleSelection) {
|
|
149
|
+
return item.children[0].children[2].textContent;
|
|
150
|
+
}
|
|
151
|
+
return item.children[0].children[1].textContent;
|
|
152
|
+
}
|
|
153
|
+
componentDidLoad() {
|
|
154
|
+
this.createList();
|
|
155
|
+
}
|
|
156
|
+
disconnectedCallback() {
|
|
157
|
+
if (this.draggable) {
|
|
158
|
+
this.handleEventListeners(this._listItems, this._draggableList, this._hostElement, true);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
render() {
|
|
162
|
+
return (h(Host, { ref: (el) => this._hostElement = el },
|
|
163
|
+
h("ul", { ref: (el) => this._draggableList = el, class: "draggable-list", id: "draggable-list" })));
|
|
164
|
+
}
|
|
165
|
+
static get is() { return "ez-list"; }
|
|
166
|
+
static get encapsulation() { return "shadow"; }
|
|
167
|
+
static get originalStyleUrls() { return {
|
|
168
|
+
"$": ["ez-list.css"]
|
|
169
|
+
}; }
|
|
170
|
+
static get styleUrls() { return {
|
|
171
|
+
"$": ["ez-list.css"]
|
|
172
|
+
}; }
|
|
173
|
+
static get properties() { return {
|
|
174
|
+
"initialList": {
|
|
175
|
+
"type": "unknown",
|
|
176
|
+
"mutable": true,
|
|
177
|
+
"complexType": {
|
|
178
|
+
"original": "ListItem[]",
|
|
179
|
+
"resolved": "ListItem[]",
|
|
180
|
+
"references": {
|
|
181
|
+
"ListItem": {
|
|
182
|
+
"location": "local"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"required": false,
|
|
187
|
+
"optional": false,
|
|
188
|
+
"docs": {
|
|
189
|
+
"tags": [],
|
|
190
|
+
"text": "Define a lista inicial do componente."
|
|
191
|
+
},
|
|
192
|
+
"defaultValue": "[]"
|
|
193
|
+
},
|
|
194
|
+
"draggable": {
|
|
195
|
+
"type": "boolean",
|
|
196
|
+
"mutable": false,
|
|
197
|
+
"complexType": {
|
|
198
|
+
"original": "boolean",
|
|
199
|
+
"resolved": "boolean",
|
|
200
|
+
"references": {}
|
|
201
|
+
},
|
|
202
|
+
"required": false,
|
|
203
|
+
"optional": false,
|
|
204
|
+
"docs": {
|
|
205
|
+
"tags": [],
|
|
206
|
+
"text": "Define se o componente ter\u00E1 o comportamento de arrasto de linhas."
|
|
207
|
+
},
|
|
208
|
+
"attribute": "draggable",
|
|
209
|
+
"reflect": false,
|
|
210
|
+
"defaultValue": "true"
|
|
211
|
+
},
|
|
212
|
+
"isMultipleSelection": {
|
|
213
|
+
"type": "boolean",
|
|
214
|
+
"mutable": true,
|
|
215
|
+
"complexType": {
|
|
216
|
+
"original": "boolean",
|
|
217
|
+
"resolved": "boolean",
|
|
218
|
+
"references": {}
|
|
219
|
+
},
|
|
220
|
+
"required": false,
|
|
221
|
+
"optional": false,
|
|
222
|
+
"docs": {
|
|
223
|
+
"tags": [],
|
|
224
|
+
"text": "Define se \u00E9 poss\u00EDvel selecionar mais de um registro."
|
|
225
|
+
},
|
|
226
|
+
"attribute": "is-multiple-selection",
|
|
227
|
+
"reflect": true,
|
|
228
|
+
"defaultValue": "true"
|
|
229
|
+
}
|
|
230
|
+
}; }
|
|
231
|
+
static get methods() { return {
|
|
232
|
+
"getState": {
|
|
233
|
+
"complexType": {
|
|
234
|
+
"signature": "() => Promise<ListItem[]>",
|
|
235
|
+
"parameters": [],
|
|
236
|
+
"references": {
|
|
237
|
+
"Promise": {
|
|
238
|
+
"location": "global"
|
|
239
|
+
},
|
|
240
|
+
"ListItem": {
|
|
241
|
+
"location": "local"
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"return": "Promise<ListItem[]>"
|
|
245
|
+
},
|
|
246
|
+
"docs": {
|
|
247
|
+
"text": "Retorna uma promessa com o estado da atual lista composta por objetos do tipo {value: string, checked: boolean}.",
|
|
248
|
+
"tags": []
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}; }
|
|
252
|
+
}
|
|
@@ -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
|
}
|