capibara 1.1.20 → 1.1.21
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/config_cuarteles.js +9 -2
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/src/lib/capibara.js +29 -2
- package/src/scss/components/_floatbox.scss +28 -1
- package/src/scss/layout/_contextMenu.scss +49 -30
- package/src/scss/layout/_header.scss +11 -0
- package/src/scss/layout/_selectContainer.scss +19 -0
- package/src/scss/themes/_color_themes.scss +5 -0
- package/src/scss/themes/_themes.scss +12 -0
- package/src/util/domUtils.js +6 -0
- package/src/util/tableElements.js +31 -4
package/package.json
CHANGED
package/src/lib/capibara.js
CHANGED
|
@@ -795,6 +795,11 @@ export class Capibara{
|
|
|
795
795
|
let index = utils.indexSelectedDay(this.selected, {date, item});
|
|
796
796
|
this.selected.splice(index, 1);
|
|
797
797
|
}
|
|
798
|
+
|
|
799
|
+
this.selected.forEach((s, index) => {
|
|
800
|
+
s.index = index+1;
|
|
801
|
+
})
|
|
802
|
+
|
|
798
803
|
if(redraw){
|
|
799
804
|
this.redrawSelection()
|
|
800
805
|
}
|
|
@@ -811,7 +816,13 @@ export class Capibara{
|
|
|
811
816
|
|
|
812
817
|
if(index < 0){
|
|
813
818
|
|
|
814
|
-
this.selected.push({
|
|
819
|
+
this.selected.push({
|
|
820
|
+
index: 0,
|
|
821
|
+
date,
|
|
822
|
+
item,
|
|
823
|
+
pos,
|
|
824
|
+
});
|
|
825
|
+
|
|
815
826
|
let dataDay = null;
|
|
816
827
|
if(item.data){
|
|
817
828
|
dataDay = item.data.find(d => {
|
|
@@ -847,6 +858,10 @@ export class Capibara{
|
|
|
847
858
|
}
|
|
848
859
|
})
|
|
849
860
|
|
|
861
|
+
this.selected.forEach((s, index) => {
|
|
862
|
+
s.index = index+1;
|
|
863
|
+
})
|
|
864
|
+
|
|
850
865
|
if(redraw){
|
|
851
866
|
this.redrawSelection()
|
|
852
867
|
}
|
|
@@ -970,6 +985,17 @@ export class Capibara{
|
|
|
970
985
|
}
|
|
971
986
|
}
|
|
972
987
|
|
|
988
|
+
clickDateHeader(evt){
|
|
989
|
+
let date = evt.detail.date;
|
|
990
|
+
this.selected = [];
|
|
991
|
+
this.config.data.forEach(parent => {
|
|
992
|
+
parent.children.forEach(item => {
|
|
993
|
+
this.selectByItemDate(date, item, false);
|
|
994
|
+
});
|
|
995
|
+
});
|
|
996
|
+
this.redrawSelection();
|
|
997
|
+
}
|
|
998
|
+
|
|
973
999
|
/**
|
|
974
1000
|
* Captura evento window resize
|
|
975
1001
|
* para verificar si es mobile o no
|
|
@@ -1019,7 +1045,6 @@ export class Capibara{
|
|
|
1019
1045
|
}
|
|
1020
1046
|
|
|
1021
1047
|
|
|
1022
|
-
|
|
1023
1048
|
/**
|
|
1024
1049
|
* Agrega eventos a los elementos del dom de la planilla
|
|
1025
1050
|
* usando el objecto $capibara
|
|
@@ -1048,6 +1073,8 @@ export class Capibara{
|
|
|
1048
1073
|
|
|
1049
1074
|
this.$elements.$container.addEventListener("scroll", this.hideContextMenu.bind(this));
|
|
1050
1075
|
|
|
1076
|
+
this.$elements.$container.addEventListener("clickDate", this.clickDateHeader.bind(this));
|
|
1077
|
+
|
|
1051
1078
|
window.addEventListener('resize',this.onWindowResize.bind(this));
|
|
1052
1079
|
|
|
1053
1080
|
}
|
|
@@ -108,7 +108,6 @@
|
|
|
108
108
|
box-shadow: inset 0px 0px 10px rgba(255, 255, 255, 0.2);
|
|
109
109
|
border-radius: 3px;
|
|
110
110
|
color: white;
|
|
111
|
-
backdrop-filter: blur(2px);
|
|
112
111
|
|
|
113
112
|
&:not(.shape-outlined){
|
|
114
113
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
@@ -119,6 +118,7 @@
|
|
|
119
118
|
border-width: 2px;
|
|
120
119
|
border-color: grey;
|
|
121
120
|
border-style: solid;
|
|
121
|
+
backdrop-filter: blur(2px);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
&.shape-bar{
|
|
@@ -130,6 +130,33 @@
|
|
|
130
130
|
margin: 0px 0px -1px 0px;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
&.shape-bar-outlined{
|
|
134
|
+
height: calc(var(--item-height) / 4);
|
|
135
|
+
line-height: 0px;
|
|
136
|
+
color: transparent;
|
|
137
|
+
border-radius: 1px;
|
|
138
|
+
border: 1px solid white;
|
|
139
|
+
margin: 0px 0px -1px 0px;
|
|
140
|
+
border-width: 2px;
|
|
141
|
+
border-color: grey;
|
|
142
|
+
border-style: solid;
|
|
143
|
+
backdrop-filter: blur(2px);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@each $nameTheme , $theme in $themes {
|
|
151
|
+
&#{$nameTheme}{
|
|
152
|
+
.float-box-container{
|
|
153
|
+
.float-box{
|
|
154
|
+
span.data{
|
|
155
|
+
&.shape-bar{
|
|
156
|
+
border-color: mapGet($theme,floatBox, shapeBar,border);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
133
160
|
}
|
|
134
161
|
}
|
|
135
162
|
}
|
|
@@ -1,39 +1,58 @@
|
|
|
1
|
-
.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
.capibara {
|
|
2
|
+
.cap-context-menu-container {
|
|
3
|
+
position: absolute;
|
|
4
|
+
left: 0;
|
|
5
|
+
top: 0;
|
|
6
|
+
z-index: 10;
|
|
7
|
+
|
|
8
|
+
&.cm-hide {
|
|
9
|
+
.cap-context-menu {
|
|
10
|
+
visibility: hidden;
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
10
13
|
}
|
|
11
14
|
|
|
12
|
-
|
|
15
|
+
.cap-context-menu {
|
|
16
|
+
position: absolute;
|
|
17
|
+
min-width: 150px;
|
|
18
|
+
z-index: 2;
|
|
19
|
+
border-radius: 3px;
|
|
20
|
+
border: 1px solid grey;
|
|
21
|
+
background: rgb(255, 255, 255);
|
|
22
|
+
box-shadow: 0 3px 5px -1px rgba(0, 0, 0, 0.2),
|
|
23
|
+
0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);
|
|
24
|
+
font-size: 0.75em;
|
|
25
|
+
transition: all 0.1s linear;
|
|
26
|
+
visibility: visible;
|
|
27
|
+
opacity: 1;
|
|
28
|
+
padding: 0.4em 0px;
|
|
13
29
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
transition: all 0.1s linear;
|
|
23
|
-
visibility: visible;
|
|
24
|
-
opacity: 1;
|
|
25
|
-
padding: 0.4em 0px;
|
|
26
|
-
|
|
27
|
-
&--item {
|
|
28
|
-
padding: 0.5em 1em;
|
|
29
|
-
&:hover {
|
|
30
|
-
background:rgba(20,20,20,0.2);
|
|
31
|
-
}
|
|
32
|
-
&.is-disabled{
|
|
33
|
-
opacity: 0.5;
|
|
30
|
+
&--item {
|
|
31
|
+
padding: 0.5em 1em;
|
|
32
|
+
&:hover {
|
|
33
|
+
background: rgba(20, 20, 20, 0.2);
|
|
34
|
+
}
|
|
35
|
+
&.is-disabled {
|
|
36
|
+
opacity: 0.5;
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
39
|
}
|
|
40
|
+
}
|
|
36
41
|
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@each $nameTheme , $theme in $themes {
|
|
45
|
+
&#{$nameTheme}{
|
|
46
|
+
.cap-context-menu-container{
|
|
47
|
+
.cap-context-menu{
|
|
48
|
+
color: mapGet($theme, detailDay, color);
|
|
49
|
+
border-color: mapGet($theme, detailDay, border);
|
|
50
|
+
background: mapGet($theme, detailDay, background);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
37
54
|
}
|
|
38
55
|
|
|
56
|
+
|
|
57
|
+
|
|
39
58
|
}
|
|
@@ -179,6 +179,9 @@
|
|
|
179
179
|
//background: var(--header-dia-active-background) ;
|
|
180
180
|
//color: white;
|
|
181
181
|
}
|
|
182
|
+
&.is-clickeable{
|
|
183
|
+
cursor:pointer;
|
|
184
|
+
}
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
187
|
}
|
|
@@ -236,6 +239,14 @@
|
|
|
236
239
|
background: mapGet($theme,header, days, active, background);
|
|
237
240
|
color: mapGet($theme,header, days, active, color);
|
|
238
241
|
}
|
|
242
|
+
&.is-clickeable{
|
|
243
|
+
&:hover{
|
|
244
|
+
background: rgba(100, 100, 100, 0.4);
|
|
245
|
+
}
|
|
246
|
+
&:active{
|
|
247
|
+
background: rgba(100, 100, 100, 0.6);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
239
250
|
}
|
|
240
251
|
}
|
|
241
252
|
}
|
|
@@ -13,6 +13,25 @@
|
|
|
13
13
|
position: absolute;
|
|
14
14
|
background: rgba(189,189,189,0.4);
|
|
15
15
|
box-shadow: inset 0px 0px 5px rgba(189,189,189,0.8);
|
|
16
|
+
&[selected-index]{
|
|
17
|
+
&::after{
|
|
18
|
+
content:attr(selected-index);
|
|
19
|
+
display: block;
|
|
20
|
+
position:absolute;
|
|
21
|
+
left:-2px;
|
|
22
|
+
top: -2px;
|
|
23
|
+
background: red;
|
|
24
|
+
font-size: 0.75em;
|
|
25
|
+
color: white;
|
|
26
|
+
width: 1.3em;
|
|
27
|
+
height:1.3em;
|
|
28
|
+
border-radius:50%;
|
|
29
|
+
border: 1px solid blue;
|
|
30
|
+
z-index: 2;
|
|
31
|
+
text-align: center;
|
|
32
|
+
font-weight:bold;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
16
35
|
}
|
|
17
36
|
|
|
18
37
|
}
|
|
@@ -9,6 +9,12 @@ $themes:(
|
|
|
9
9
|
background : rgba(245,245,245,1),
|
|
10
10
|
color : rgba(55,71,79,1),
|
|
11
11
|
|
|
12
|
+
floatBox:(
|
|
13
|
+
shapeBar:(
|
|
14
|
+
border: white,
|
|
15
|
+
)
|
|
16
|
+
),
|
|
17
|
+
|
|
12
18
|
detailDay:(
|
|
13
19
|
background : white,
|
|
14
20
|
border : rgba(0, 0, 0, 0.2),
|
|
@@ -156,6 +162,12 @@ $themes:(
|
|
|
156
162
|
background: mapGet($darkBlueColors, darken-2), // rgb(32, 39, 55),
|
|
157
163
|
color: rgb(240,240,240),
|
|
158
164
|
|
|
165
|
+
floatBox:(
|
|
166
|
+
shapeBar:(
|
|
167
|
+
border: mapGet($darkBlueColors, base),
|
|
168
|
+
)
|
|
169
|
+
),
|
|
170
|
+
|
|
159
171
|
scroll:(
|
|
160
172
|
background: transparent,
|
|
161
173
|
color: rgba(189,189,189,1),
|
package/src/util/domUtils.js
CHANGED
|
@@ -631,7 +631,8 @@ export default {
|
|
|
631
631
|
let day = datesTree[keyY][keyM][keyD];
|
|
632
632
|
let isWeekend = day.isWeekend;
|
|
633
633
|
let isToday = day.isToday;
|
|
634
|
-
|
|
634
|
+
let date = dateUtils.formatDate(day.Date);
|
|
635
|
+
str += `<div class="dia-calendario ${isToday?'today':''} ${isWeekend?'weekend':''} ${config.timeline.dateSelectable ?'is-clickeable':''}" date="${date}">${keyD}</div>`;
|
|
635
636
|
});
|
|
636
637
|
str += `</div></div>`;
|
|
637
638
|
});
|
|
@@ -642,6 +643,23 @@ export default {
|
|
|
642
643
|
str += `</div>`;
|
|
643
644
|
$elem.innerHTML = "";
|
|
644
645
|
$elem.append(dom.createElementFromHTML(str));
|
|
646
|
+
|
|
647
|
+
if(config.timeline.dateSelectable){
|
|
648
|
+
$elem.querySelectorAll(".dia-calendario[date]").forEach($dia => {
|
|
649
|
+
$dia.addEventListener("click", evt => {
|
|
650
|
+
|
|
651
|
+
$elem.dispatchEvent(new CustomEvent("clickDate", {
|
|
652
|
+
bubbles : true,
|
|
653
|
+
cancelable : false,
|
|
654
|
+
detail : {
|
|
655
|
+
$elem: $dia,
|
|
656
|
+
date: $dia.getAttribute("date"),
|
|
657
|
+
}
|
|
658
|
+
}));
|
|
659
|
+
});
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
|
|
645
663
|
return $elem;
|
|
646
664
|
},
|
|
647
665
|
|
|
@@ -2118,7 +2136,9 @@ export default {
|
|
|
2118
2136
|
$elem.innerHTML = "";
|
|
2119
2137
|
if(selected){
|
|
2120
2138
|
selected.forEach(s => {
|
|
2121
|
-
let $s = dom.createElement("div", {className: "selected-day"
|
|
2139
|
+
let $s = dom.createElement("div", {className: "selected-day", attributes:[
|
|
2140
|
+
{name:"selected-index", value:s.index }
|
|
2141
|
+
]});
|
|
2122
2142
|
$s.style.left = s.pos.left + "px";
|
|
2123
2143
|
$s.style.top = s.pos.top + "px";
|
|
2124
2144
|
$elem.append($s);
|
|
@@ -2706,9 +2726,16 @@ export default {
|
|
|
2706
2726
|
let $contextMenu = $contextMenuContainer.querySelector(".cap-context-menu");
|
|
2707
2727
|
|
|
2708
2728
|
config.timeline.contextMenu.options.forEach(option => {
|
|
2729
|
+
|
|
2730
|
+
if(option.showIf){
|
|
2731
|
+
let show = option.showIf({item, date, selected});
|
|
2732
|
+
if(!show) return;
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2735
|
+
|
|
2709
2736
|
let isEnabled = true;
|
|
2710
|
-
if(option.
|
|
2711
|
-
isEnabled = option.
|
|
2737
|
+
if(option.enableIf){
|
|
2738
|
+
isEnabled = option.enableIf({item, date, selected});
|
|
2712
2739
|
}
|
|
2713
2740
|
|
|
2714
2741
|
let optionClassName = "";
|