capibara 1.3.51 → 1.3.53
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/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/capibara.js +32 -3
- package/src/scss/abstracts/_animations.scss +25 -0
- package/src/scss/base/_utils_mobile.scss +37 -46
- package/src/scss/components/_select.scss +21 -13
- package/src/scss/layout/_mobileFooter.scss +9 -2
- package/src/scss/layout/_nav.scss +32 -0
- package/src/scss/layout/_selectContainer.scss +21 -1
- package/src/util/icons.js +8 -0
- package/src/util/tableElements.js +76 -10
package/package.json
CHANGED
package/src/lib/capibara.js
CHANGED
|
@@ -39,6 +39,7 @@ export class Capibara{
|
|
|
39
39
|
this.selected = [];
|
|
40
40
|
this.config = config;
|
|
41
41
|
this.lastDataDay = null;
|
|
42
|
+
this.lastFocusedDay = null;
|
|
42
43
|
this.isShowNavExtended = false;
|
|
43
44
|
this.isShowNavInitial = true;
|
|
44
45
|
this.isShowNavButtons = true;
|
|
@@ -72,6 +73,7 @@ export class Capibara{
|
|
|
72
73
|
this.$saveCancelBtns = [];
|
|
73
74
|
this.selected = [];
|
|
74
75
|
this.lastDataDay = null;
|
|
76
|
+
this.lastFocusedDay = null;
|
|
75
77
|
this.isMobile = utils.checkIsMobile(this.config);
|
|
76
78
|
this.isVisibleContextMenu = false;
|
|
77
79
|
this.mobileSelectable = this.config.timeline.mobileSelectable === true;
|
|
@@ -547,6 +549,7 @@ export class Capibara{
|
|
|
547
549
|
this.mobileSelectable = false;
|
|
548
550
|
this.config.timeline.mobileSelectable = false;
|
|
549
551
|
this.setSelectable(false);
|
|
552
|
+
this.lastFocusedDay = null;
|
|
550
553
|
this.updateMobileSelectButton();
|
|
551
554
|
this.updateMobileFooterButtonsVisibility();
|
|
552
555
|
}
|
|
@@ -870,9 +873,13 @@ export class Capibara{
|
|
|
870
873
|
this.$elements.$detailDay.innerHTML = newDDContentString;
|
|
871
874
|
}
|
|
872
875
|
this.lastDataDay = dataByDate;
|
|
876
|
+
this.lastFocusedDay = item ? { date, item, pos } : null;
|
|
873
877
|
this.focusOnFloatBox({pos, evt});
|
|
874
878
|
return;
|
|
875
879
|
}
|
|
880
|
+
if(this.isMobile && !this.mobileSelectable && item){
|
|
881
|
+
this.lastFocusedDay = { date, item, pos };
|
|
882
|
+
}
|
|
876
883
|
|
|
877
884
|
if(!this.isSelectable({item, date, dataByDate})){
|
|
878
885
|
this.$capibara.dispatchEvent(new CustomEvent("selectNoSelectable", {
|
|
@@ -1410,6 +1417,28 @@ export class Capibara{
|
|
|
1410
1417
|
if(this.isMobile){
|
|
1411
1418
|
this.setSelectable(this.mobileSelectable);
|
|
1412
1419
|
}
|
|
1420
|
+
if(this.mobileSelectable && this.lastFocusedDay){
|
|
1421
|
+
const { date, item, pos } = this.lastFocusedDay;
|
|
1422
|
+
const dataByDate = item && item.data ? _.find(item.data, { date }) : null;
|
|
1423
|
+
if(this.isSelectable({ item, date, dataByDate })){
|
|
1424
|
+
this.toggleSelect(date, item, pos);
|
|
1425
|
+
this.redrawSelection();
|
|
1426
|
+
this.updateMobileFooterButtonsVisibility();
|
|
1427
|
+
this.$capibara.dispatchEvent(new CustomEvent("selectDay", {
|
|
1428
|
+
bubbles: true,
|
|
1429
|
+
cancelable: false,
|
|
1430
|
+
detail: {
|
|
1431
|
+
config: this.config,
|
|
1432
|
+
lastSelection: { date, item, pos },
|
|
1433
|
+
selected: this.selected,
|
|
1434
|
+
tabSelected: this.tabSelected
|
|
1435
|
+
}
|
|
1436
|
+
}));
|
|
1437
|
+
}
|
|
1438
|
+
this.lastFocusedDay = null;
|
|
1439
|
+
} else if(!this.mobileSelectable){
|
|
1440
|
+
this.lastFocusedDay = null;
|
|
1441
|
+
}
|
|
1413
1442
|
this.updateMobileSelectButton();
|
|
1414
1443
|
this.checkClassSidebarExtendedRight();
|
|
1415
1444
|
this.updateMobileFooterVisibility();
|
|
@@ -1427,10 +1456,9 @@ export class Capibara{
|
|
|
1427
1456
|
const label = active ? "Desactivar selección" : "Activar selección de días";
|
|
1428
1457
|
const labelStyle = active ? "display:none" : "";
|
|
1429
1458
|
const countStyle = active ? "" : "display:none";
|
|
1430
|
-
const countText = this.selected.length + " d";
|
|
1431
1459
|
$btn.innerHTML = this.getCheckboxIconHtml(active)
|
|
1432
1460
|
+ '<span class="mobile-footer-select-label" style="' + labelStyle + '">Seleccionar días</span>'
|
|
1433
|
-
+ '<span class="mobile-footer-select-count" style="' + countStyle + '">'
|
|
1461
|
+
+ '<span class="mobile-footer-select-count" style="' + countStyle + '"></span>';
|
|
1434
1462
|
$btn.classList.toggle("active", active);
|
|
1435
1463
|
$btn.setAttribute("aria-checked", active);
|
|
1436
1464
|
$btn.setAttribute("aria-label", label);
|
|
@@ -1444,7 +1472,7 @@ export class Capibara{
|
|
|
1444
1472
|
const selectMode = this.mobileSelectable;
|
|
1445
1473
|
const hasSelected = this.selected.length > 0;
|
|
1446
1474
|
const $count = $footer.querySelector(".mobile-footer-select-count");
|
|
1447
|
-
if($count) $count.textContent = this.selected.length + "
|
|
1475
|
+
if($count) $count.textContent = this.selected.length + " días";
|
|
1448
1476
|
$footer.querySelectorAll("[data-show-when]").forEach(($el) => {
|
|
1449
1477
|
const showWhen = $el.getAttribute("data-show-when");
|
|
1450
1478
|
let visible = showWhen === "always" ||
|
|
@@ -1604,6 +1632,7 @@ export class Capibara{
|
|
|
1604
1632
|
if(options.detailDay){
|
|
1605
1633
|
this.hideDetailDay();
|
|
1606
1634
|
this.lastDataDay = null;
|
|
1635
|
+
this.lastFocusedDay = null;
|
|
1607
1636
|
}
|
|
1608
1637
|
|
|
1609
1638
|
if(options.navLeft){
|
|
@@ -42,4 +42,29 @@
|
|
|
42
42
|
transform: translateX(200%);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
@keyframes pulseSelectedDay {
|
|
47
|
+
0%,
|
|
48
|
+
100% {
|
|
49
|
+
border-color: var(--selected-day-pulse-color, rgba(255, 255, 255, 0.5));
|
|
50
|
+
box-shadow:
|
|
51
|
+
0 0 0 2px var(--selected-day-pulse-color, rgba(255, 255, 255, 0.4)),
|
|
52
|
+
inset 0px 0px 5px var(--selected-day-pulse-inset, rgba(189, 189, 189, 0.8));
|
|
53
|
+
}
|
|
54
|
+
25%,
|
|
55
|
+
75% {
|
|
56
|
+
border-color: var(--selected-day-pulse-color-mid, rgba(255, 255, 255, 0.7));
|
|
57
|
+
box-shadow:
|
|
58
|
+
0 0 0 2px var(--selected-day-pulse-color-mid, rgba(255, 255, 255, 0.65)),
|
|
59
|
+
0 0 6px var(--selected-day-pulse-glow-mid, rgba(255, 255, 255, 0.25)),
|
|
60
|
+
inset 0px 0px 5px var(--selected-day-pulse-inset, rgba(189, 189, 189, 0.8));
|
|
61
|
+
}
|
|
62
|
+
50% {
|
|
63
|
+
border-color: var(--selected-day-pulse-color-strong, rgba(255, 255, 255, 0.95));
|
|
64
|
+
box-shadow:
|
|
65
|
+
0 0 0 2px var(--selected-day-pulse-color-strong, rgba(255, 255, 255, 0.9)),
|
|
66
|
+
0 0 12px var(--selected-day-pulse-glow, rgba(255, 255, 255, 0.5)),
|
|
67
|
+
inset 0px 0px 5px var(--selected-day-pulse-inset, rgba(189, 189, 189, 0.8));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
45
70
|
}
|
|
@@ -1,58 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
.c-d-desktop-none,
|
|
5
|
-
.c-d-desktop-flex,
|
|
6
|
-
.c-d-desktop-block,
|
|
7
|
-
.c-d-desktop-inline-block {
|
|
8
|
-
display: none !important;
|
|
9
|
-
}
|
|
10
|
-
.c-d-mobile-flex {
|
|
11
|
-
display: flex !important;
|
|
12
|
-
}
|
|
13
|
-
.c-d-mobile-block {
|
|
14
|
-
display: block !important;
|
|
15
|
-
}
|
|
16
|
-
.c-d-mobile-inline-block {
|
|
17
|
-
display: inline-block !important;
|
|
18
|
-
}
|
|
1
|
+
@mixin mobile-breakpoint-styles {
|
|
2
|
+
.c-d-mobile-none {
|
|
3
|
+
display: none !important;
|
|
19
4
|
}
|
|
5
|
+
.c-d-mobile-flex {
|
|
6
|
+
display: flex !important;
|
|
7
|
+
}
|
|
8
|
+
.c-d-mobile-block {
|
|
9
|
+
display: block !important;
|
|
10
|
+
}
|
|
11
|
+
.c-d-mobile-inline-block {
|
|
12
|
+
display: inline-block !important;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
20
15
|
|
|
21
|
-
|
|
16
|
+
.capibara {
|
|
17
|
+
// Desktop: solo cuando viewport >= 960px y NO force-mobile
|
|
22
18
|
@media screen and (min-width: 960px) {
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
display: flex !important;
|
|
19
|
+
&:not(.force-mobile) {
|
|
20
|
+
.c-d-desktop-none {
|
|
21
|
+
display: none !important;
|
|
22
|
+
}
|
|
23
|
+
.c-d-desktop-inline-block {
|
|
24
|
+
display: inline-block !important;
|
|
25
|
+
}
|
|
26
|
+
.c-d-desktop-block {
|
|
27
|
+
display: block !important;
|
|
28
|
+
}
|
|
29
|
+
.c-d-desktop-flex {
|
|
30
|
+
display: flex !important;
|
|
31
|
+
}
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
34
|
|
|
40
|
-
//
|
|
35
|
+
// Mobile: cuando viewport < 960px
|
|
41
36
|
@media screen and (max-width: 959px) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.c-d-mobile-block {
|
|
47
|
-
display: block !important;
|
|
48
|
-
}
|
|
37
|
+
@include mobile-breakpoint-styles;
|
|
38
|
+
}
|
|
49
39
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
// Force-mobile: mismos estilos que mobile, sin media query (ej. tablets)
|
|
41
|
+
&.force-mobile {
|
|
42
|
+
@include mobile-breakpoint-styles;
|
|
53
43
|
|
|
54
|
-
.
|
|
55
|
-
|
|
44
|
+
// Tabs: ocultar botones (headerTop .tabs-container tiene display:flex)
|
|
45
|
+
.header-top .tabs-container {
|
|
46
|
+
display: none !important;
|
|
56
47
|
}
|
|
57
48
|
}
|
|
58
49
|
}
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
.capibara {
|
|
2
|
+
.tab-select-container {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
|
|
7
|
+
&::after {
|
|
8
|
+
content: "";
|
|
9
|
+
position: absolute;
|
|
10
|
+
right: 20px;
|
|
11
|
+
top: 50%;
|
|
12
|
+
transform: translateY(-50%);
|
|
13
|
+
pointer-events: none;
|
|
14
|
+
width: 0;
|
|
15
|
+
height: 0;
|
|
16
|
+
border-left: 5px solid transparent;
|
|
17
|
+
border-right: 5px solid transparent;
|
|
18
|
+
border-top: 6px solid white;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
2
22
|
select.tabs-select {
|
|
3
23
|
margin: 6px 18px;
|
|
4
24
|
background: grey;
|
|
@@ -6,8 +26,7 @@
|
|
|
6
26
|
font-size: 16px;
|
|
7
27
|
outline: none;
|
|
8
28
|
width: 100px;
|
|
9
|
-
|
|
10
|
-
padding: 3px 18px;
|
|
29
|
+
padding: 3px 28px 3px 18px;
|
|
11
30
|
font-weight: bold;
|
|
12
31
|
border: 1px solid transparent;
|
|
13
32
|
margin: 8px;
|
|
@@ -21,17 +40,6 @@
|
|
|
21
40
|
padding: 15px;
|
|
22
41
|
}
|
|
23
42
|
|
|
24
|
-
&:after {
|
|
25
|
-
content: "";
|
|
26
|
-
display: block;
|
|
27
|
-
position: absolute;
|
|
28
|
-
right: 10px;
|
|
29
|
-
top: 4px;
|
|
30
|
-
border-width: 4px;
|
|
31
|
-
border-color: white;
|
|
32
|
-
z-index: 2;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
43
|
&.disabled {
|
|
36
44
|
color: grey;
|
|
37
45
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
.container-tl {
|
|
9
9
|
flex: 1;
|
|
10
10
|
min-height: 0;
|
|
11
|
-
margin-bottom:
|
|
11
|
+
margin-bottom: var(--mobile-footer-height);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -41,13 +41,20 @@
|
|
|
41
41
|
margin-left: auto;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
@media (min-width: 768px) {
|
|
45
|
+
.mobile-footer-buttons {
|
|
46
|
+
margin-left: 0;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
.mobile-footer-select-toggle {
|
|
45
51
|
display: inline-flex;
|
|
46
52
|
align-items: center;
|
|
47
53
|
gap: 0.5em;
|
|
48
54
|
width: auto;
|
|
49
55
|
min-width: auto;
|
|
50
|
-
padding:
|
|
56
|
+
padding: 8px 8px;
|
|
57
|
+
margin: 0;
|
|
51
58
|
border-radius: 4px;
|
|
52
59
|
margin-right: 0;
|
|
53
60
|
background: rgba(255, 255, 255, 0.35);
|
|
@@ -353,6 +353,13 @@
|
|
|
353
353
|
flex: 1 1 auto;
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
// clickLabelToDetail en mobile: nombre con underline (botón oculto)
|
|
357
|
+
&.click-label-to-detail .item-title-content {
|
|
358
|
+
@media screen and (max-width: 959px) {
|
|
359
|
+
text-decoration: underline !important;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
356
363
|
.detail-btn-container {
|
|
357
364
|
flex: 0 0 auto;
|
|
358
365
|
width: auto;
|
|
@@ -374,12 +381,37 @@
|
|
|
374
381
|
&:hover {
|
|
375
382
|
background: rgba(100, 100, 100, 0.2) !important;
|
|
376
383
|
}
|
|
384
|
+
&.detail-btn-icon {
|
|
385
|
+
margin-left: 0.5rem;
|
|
386
|
+
padding: 2px 6px;
|
|
387
|
+
display: inline-flex;
|
|
388
|
+
align-items: center;
|
|
389
|
+
justify-content: center;
|
|
390
|
+
.info-outline-icon,
|
|
391
|
+
.close-icon {
|
|
392
|
+
display: inline-flex;
|
|
393
|
+
svg {
|
|
394
|
+
width: 18px;
|
|
395
|
+
height: 18px;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
377
399
|
}
|
|
378
400
|
}
|
|
379
401
|
}
|
|
380
402
|
}
|
|
381
403
|
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
&.force-mobile {
|
|
407
|
+
nav .nav-item-list .nav-item .nav-item-container .item-title {
|
|
408
|
+
&.click-label-to-detail .item-title-content {
|
|
409
|
+
text-decoration: underline;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
382
413
|
|
|
414
|
+
nav {
|
|
383
415
|
.multibuttons-btn {
|
|
384
416
|
background: transparent;
|
|
385
417
|
border: none;
|
|
@@ -8,11 +8,20 @@
|
|
|
8
8
|
height: 0px;
|
|
9
9
|
|
|
10
10
|
.selected-day {
|
|
11
|
+
--selected-day-pulse-color: rgba(200, 85, 57, 0.6);
|
|
12
|
+
--selected-day-pulse-color-mid: rgba(200, 85, 57, 0.75);
|
|
13
|
+
--selected-day-pulse-color-strong: rgba(200, 85, 57, 0.9);
|
|
14
|
+
--selected-day-pulse-glow: rgba(200, 85, 57, 0.35);
|
|
15
|
+
--selected-day-pulse-glow-mid: rgba(200, 85, 57, 0.18);
|
|
16
|
+
--selected-day-pulse-inset: rgba(189, 189, 189, 0.8);
|
|
11
17
|
width: var(--day-width);
|
|
12
18
|
height: var(--item-height);
|
|
13
19
|
position: absolute;
|
|
14
20
|
background: rgba(189, 189, 189, 0.4);
|
|
15
|
-
box-shadow: inset 0px 0px 5px
|
|
21
|
+
box-shadow: inset 0px 0px 5px var(--selected-day-pulse-inset);
|
|
22
|
+
border: 2px solid var(--selected-day-pulse-color);
|
|
23
|
+
animation: pulseSelectedDay 1s ease-in-out infinite;
|
|
24
|
+
|
|
16
25
|
&[cap-badge] {
|
|
17
26
|
&::after {
|
|
18
27
|
content: attr(cap-badge);
|
|
@@ -35,4 +44,15 @@
|
|
|
35
44
|
}
|
|
36
45
|
}
|
|
37
46
|
}
|
|
47
|
+
|
|
48
|
+
&.dark-theme {
|
|
49
|
+
.selected-day {
|
|
50
|
+
--selected-day-pulse-color: rgba(0, 255, 34, 0.5);
|
|
51
|
+
--selected-day-pulse-color-mid: rgba(0, 255, 34, 0.75);
|
|
52
|
+
--selected-day-pulse-glow-mid: rgba(0, 255, 34, 0.18);
|
|
53
|
+
--selected-day-pulse-color-strong: rgba(0, 255, 34, 0.95);
|
|
54
|
+
--selected-day-pulse-glow: rgba(0, 255, 34, 0.5);
|
|
55
|
+
--selected-day-pulse-inset: rgba(189, 189, 189, 0.8);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
38
58
|
}
|
package/src/util/icons.js
CHANGED
|
@@ -84,6 +84,13 @@ const alert = `<span class="alert-icon">
|
|
|
84
84
|
</svg>
|
|
85
85
|
</span>`;
|
|
86
86
|
|
|
87
|
+
// Info / open detail (para botón detail en mobile)
|
|
88
|
+
const infoOutline = `<span class="info-outline-icon">
|
|
89
|
+
<svg style="width:24px;height:24px" viewBox="0 0 24 24">
|
|
90
|
+
<path fill="currentColor" d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z" />
|
|
91
|
+
</svg>
|
|
92
|
+
</span>`;
|
|
93
|
+
|
|
87
94
|
// Material Design: checkbox-marked (activado)
|
|
88
95
|
const checkboxChecked = `<span class="checkbox-checked-icon">
|
|
89
96
|
<svg style="width:24px;height:24px" viewBox="0 0 24 24">
|
|
@@ -108,6 +115,7 @@ function getCheckboxIcon(checked) {
|
|
|
108
115
|
export default {
|
|
109
116
|
closeIcon,
|
|
110
117
|
linkIcon,
|
|
118
|
+
infoOutline,
|
|
111
119
|
toggleLegends,
|
|
112
120
|
chevronDown,
|
|
113
121
|
chevronRight,
|
|
@@ -25,6 +25,9 @@ export default {
|
|
|
25
25
|
if (config.timeline.header.extend.isShow) {
|
|
26
26
|
e.classList.add("header-extended");
|
|
27
27
|
}
|
|
28
|
+
if (config.timeline && config.timeline.forceMobile === true) {
|
|
29
|
+
e.classList.add("force-mobile");
|
|
30
|
+
}
|
|
28
31
|
return e;
|
|
29
32
|
},
|
|
30
33
|
|
|
@@ -401,7 +404,14 @@ export default {
|
|
|
401
404
|
}
|
|
402
405
|
|
|
403
406
|
if (showTabs) {
|
|
404
|
-
|
|
407
|
+
const forceMobile = config.timeline && config.timeline.forceMobile === true;
|
|
408
|
+
const tabSelectClasses = forceMobile
|
|
409
|
+
? "tab-select-container c-d-mobile-flex"
|
|
410
|
+
: "tab-select-container c-d-desktop-none c-d-mobile-flex";
|
|
411
|
+
const tabsContainerClasses = forceMobile
|
|
412
|
+
? "tabs-container c-d-mobile-none"
|
|
413
|
+
: "tabs-container c-d-desktop-flex c-d-mobile-none";
|
|
414
|
+
str += ` <div class="${tabSelectClasses}">
|
|
405
415
|
<select class="tabs-select" >`;
|
|
406
416
|
|
|
407
417
|
config.timeline.tabs.forEach((tab) => {
|
|
@@ -414,7 +424,7 @@ export default {
|
|
|
414
424
|
|
|
415
425
|
str += `</select> </div>`;
|
|
416
426
|
|
|
417
|
-
str += ` <div class="
|
|
427
|
+
str += ` <div class="${tabsContainerClasses}">`;
|
|
418
428
|
|
|
419
429
|
config.timeline.tabs.forEach((tab) => {
|
|
420
430
|
if (!tab.isHidden) {
|
|
@@ -1011,11 +1021,22 @@ export default {
|
|
|
1011
1021
|
if (d.isHidden) return;
|
|
1012
1022
|
|
|
1013
1023
|
const hasBtn = !!d.onClickDetailButton;
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1024
|
+
const isMobile = utils.checkIsMobile(config);
|
|
1025
|
+
const hasClickLabelToDetail =
|
|
1026
|
+
!!d.onClickDetailButton && !!d.clickLabelToDetail;
|
|
1027
|
+
// en mobile con clickLabelToDetail: no mostrar botón, el nombre es clickeable
|
|
1028
|
+
const showDetailBtn = hasBtn && !(isMobile && hasClickLabelToDetail);
|
|
1029
|
+
const detailBtnContent =
|
|
1030
|
+
showDetailBtn && isMobile
|
|
1031
|
+
? (d.iconDetailButton || icons.infoOutline)
|
|
1032
|
+
: showDetailBtn
|
|
1033
|
+
? (d.labelDetailButton || "")
|
|
1034
|
+
: "";
|
|
1035
|
+
const detailBtn = showDetailBtn
|
|
1036
|
+
? `<button class="detail-btn ${isMobile ? "detail-btn-icon" : ""}" item-id="${d.id || -1}" type-node="${
|
|
1016
1037
|
d.type || ""
|
|
1017
|
-
}" >
|
|
1018
|
-
${
|
|
1038
|
+
}" ${isMobile && d.labelDetailButton ? `title="${d.labelDetailButton.replace(/"/g, """)}"` : ""}>
|
|
1039
|
+
${detailBtnContent}
|
|
1019
1040
|
</button>`
|
|
1020
1041
|
: "";
|
|
1021
1042
|
|
|
@@ -1035,8 +1056,8 @@ export default {
|
|
|
1035
1056
|
|
|
1036
1057
|
navList += `
|
|
1037
1058
|
<div class="item-title truncate full-width ${
|
|
1038
|
-
d.clickeable ? "clickeable" : ""
|
|
1039
|
-
}
|
|
1059
|
+
d.clickeable || hasClickLabelToDetail ? "clickeable" : ""
|
|
1060
|
+
} ${hasClickLabelToDetail ? "click-label-to-detail" : ""}
|
|
1040
1061
|
${d.navOver ? "hoverable" : ""} " item-id="${
|
|
1041
1062
|
d.id || -1
|
|
1042
1063
|
}" type-node="${d.type || ""}" >
|
|
@@ -1611,9 +1632,24 @@ export default {
|
|
|
1611
1632
|
|
|
1612
1633
|
$elem.querySelectorAll(".item-title.clickeable").forEach((i) => {
|
|
1613
1634
|
i.addEventListener("click", (e) => {
|
|
1635
|
+
// si tiene clickLabelToDetail, ese handler se encarga (no disparar clickNavLeftItem)
|
|
1636
|
+
if (i.classList.contains("click-label-to-detail")) return;
|
|
1614
1637
|
let itemId = i.getAttribute("item-id");
|
|
1615
1638
|
let typeNode = i.getAttribute("type-node");
|
|
1616
1639
|
let value = i.value;
|
|
1640
|
+
const $container = i.closest(".nav-item-container");
|
|
1641
|
+
const isGroup = $container && $container.classList.contains("parent");
|
|
1642
|
+
const isItem = i.closest(".child-nav-item") !== null;
|
|
1643
|
+
const kind = isItem ? "item" : isGroup ? "group" : "unknown";
|
|
1644
|
+
console.log("[Capibara nav] clickNavLeftItem", {
|
|
1645
|
+
kind,
|
|
1646
|
+
isGroup,
|
|
1647
|
+
isItem,
|
|
1648
|
+
itemId,
|
|
1649
|
+
typeNode,
|
|
1650
|
+
value: value != null ? value : "(no value)",
|
|
1651
|
+
target: e.target ? e.target.className : undefined,
|
|
1652
|
+
});
|
|
1617
1653
|
i.dispatchEvent(
|
|
1618
1654
|
new CustomEvent("clickNavLeftItem", {
|
|
1619
1655
|
bubbles: true,
|
|
@@ -1622,6 +1658,9 @@ export default {
|
|
|
1622
1658
|
itemId: itemId,
|
|
1623
1659
|
type: typeNode,
|
|
1624
1660
|
value: value,
|
|
1661
|
+
isGroup,
|
|
1662
|
+
isItem,
|
|
1663
|
+
kind,
|
|
1625
1664
|
},
|
|
1626
1665
|
})
|
|
1627
1666
|
);
|
|
@@ -1702,6 +1741,7 @@ export default {
|
|
|
1702
1741
|
|
|
1703
1742
|
$elem.querySelectorAll("button.detail-btn").forEach((i) => {
|
|
1704
1743
|
i.addEventListener("click", (e) => {
|
|
1744
|
+
e.stopPropagation(); // evitar que también dispare el click de item-title
|
|
1705
1745
|
let itemId = i.getAttribute("item-id");
|
|
1706
1746
|
let typeNode = i.getAttribute("type-node");
|
|
1707
1747
|
let item = utils.getItemById(config, itemId, "parent");
|
|
@@ -1718,6 +1758,26 @@ export default {
|
|
|
1718
1758
|
});
|
|
1719
1759
|
});
|
|
1720
1760
|
|
|
1761
|
+
// click en nombre/label ejecuta onClickDetailButton cuando clickLabelToDetail
|
|
1762
|
+
$elem.querySelectorAll(".item-title.click-label-to-detail").forEach((i) => {
|
|
1763
|
+
i.addEventListener("click", (e) => {
|
|
1764
|
+
if (e.target.closest(".detail-btn")) return; // el botón ya lo maneja
|
|
1765
|
+
let itemId = i.getAttribute("item-id");
|
|
1766
|
+
let typeNode = i.getAttribute("type-node");
|
|
1767
|
+
let item = utils.getItemById(config, itemId, "parent");
|
|
1768
|
+
|
|
1769
|
+
if (item && item.onClickDetailButton) {
|
|
1770
|
+
item.onClickDetailButton({
|
|
1771
|
+
itemId: itemId,
|
|
1772
|
+
type: typeNode,
|
|
1773
|
+
item: item,
|
|
1774
|
+
event: e,
|
|
1775
|
+
button: null,
|
|
1776
|
+
});
|
|
1777
|
+
}
|
|
1778
|
+
});
|
|
1779
|
+
});
|
|
1780
|
+
|
|
1721
1781
|
$elem.querySelectorAll("button.tree-icon").forEach((i) => {
|
|
1722
1782
|
i.addEventListener("click", (e) => {
|
|
1723
1783
|
let itemId = i.getAttribute("item-id");
|
|
@@ -1977,8 +2037,10 @@ export default {
|
|
|
1977
2037
|
const mobileSelectActive = config.timeline.mobileSelectable === true;
|
|
1978
2038
|
const mobileSelectLabel = mobileSelectActive ? "Desactivar selección" : "Activar selección de días";
|
|
1979
2039
|
const mobileSelectIcon = icons.getCheckboxIcon ? icons.getCheckboxIcon(mobileSelectActive) : (mobileSelectActive ? icons.checkboxChecked : icons.checkboxUnchecked);
|
|
2040
|
+
const forceMobile = config.timeline && config.timeline.forceMobile === true;
|
|
2041
|
+
const footerClasses = forceMobile ? "mobile-footer c-d-mobile-flex" : "mobile-footer c-d-mobile-flex c-d-desktop-none";
|
|
1980
2042
|
let str = `
|
|
1981
|
-
<div class="
|
|
2043
|
+
<div class="${footerClasses}">
|
|
1982
2044
|
<div class="mobile-footer-content">`;
|
|
1983
2045
|
if (config.timeline.selectableDesktop !== false) {
|
|
1984
2046
|
const countHidden = !mobileSelectActive;
|
|
@@ -1986,7 +2048,11 @@ export default {
|
|
|
1986
2048
|
<button type="button" id="cap-btn-mobile-select" toggle-mobile-select
|
|
1987
2049
|
class="cap-btn-icon cap-btn-icon-raised mobile-footer-select-toggle ${mobileSelectActive ? "active" : ""}"
|
|
1988
2050
|
role="switch" aria-checked="${mobileSelectActive}" aria-label="${mobileSelectLabel}"
|
|
1989
|
-
cap-tooltip="${mobileSelectLabel}">${mobileSelectIcon}<span class="mobile-footer-select-label">
|
|
2051
|
+
cap-tooltip="${mobileSelectLabel}">${mobileSelectIcon}<span class="mobile-footer-select-label">
|
|
2052
|
+
Editar Días
|
|
2053
|
+
</span>
|
|
2054
|
+
<span class="mobile-footer-select-count" ${countHidden ? 'style="display:none"' : ''}>0 d</span>
|
|
2055
|
+
</button>`;
|
|
1990
2056
|
}
|
|
1991
2057
|
str += `
|
|
1992
2058
|
<div class="mobile-footer-buttons">
|