capibara 1.1.21 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config_cuarteles.js +393 -153
- package/cuarteles.html +0 -1
- package/dist/cuarteles.html +0 -1
- package/dist/index.js +3 -3
- package/package.json +1 -1
- package/src/lib/capibara.js +115 -31
- package/src/scss/abstracts/_colors.scss +1 -1
- package/src/scss/components/_floatbox.scss +15 -10
- package/src/scss/layout/_contextMenu.scss +25 -2
- package/src/scss/layout/_detail_day.scss +1 -1
- package/src/scss/layout/_headerTop.scss +41 -1
- package/src/scss/layout/_selectContainer.scss +9 -8
- package/src/scss/layout/_table.scss +1 -0
- package/src/scss/themes/_color_themes.scss +3 -3
- package/src/scss/themes/_themes.scss +2 -2
- package/src/util/tableElements.js +202 -47
|
@@ -281,7 +281,7 @@ export default {
|
|
|
281
281
|
<div class="progress-bar progress-bar-right hide-progress"></div>
|
|
282
282
|
</div>
|
|
283
283
|
`;
|
|
284
|
-
return dom.createElementFromHTML(str
|
|
284
|
+
return dom.createElementFromHTML(str);
|
|
285
285
|
},
|
|
286
286
|
|
|
287
287
|
|
|
@@ -296,17 +296,24 @@ export default {
|
|
|
296
296
|
* @param {Object} config - Configuracion capibara
|
|
297
297
|
* @return {Object} Elemento Dom
|
|
298
298
|
*/
|
|
299
|
-
|
|
299
|
+
|
|
300
|
+
createHeaderTop(config, tabSelected = null){
|
|
301
|
+
return this.redrawHeaderTop(config, tabSelected, dom.createElement("div"));
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
redrawHeaderTop(config, tabSelected = null, $elem){
|
|
300
305
|
let str = `
|
|
301
306
|
<div class="header-top">`;
|
|
302
307
|
|
|
303
308
|
|
|
304
309
|
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
305
313
|
if(config.timeline.tabs){
|
|
306
314
|
|
|
307
|
-
str += `
|
|
308
|
-
|
|
309
|
-
<select class="tabs-select" >`;
|
|
315
|
+
str += ` <div class="tab-select-container c-d-desktop-none c-d-mobile-flex">
|
|
316
|
+
<select class="tabs-select" >`;
|
|
310
317
|
|
|
311
318
|
config.timeline.tabs.forEach(tab => {
|
|
312
319
|
if(!tab.isHidden){
|
|
@@ -314,19 +321,19 @@ export default {
|
|
|
314
321
|
}
|
|
315
322
|
});
|
|
316
323
|
|
|
317
|
-
str +=
|
|
318
|
-
</select>
|
|
324
|
+
str += `</select>
|
|
319
325
|
</div>`;
|
|
320
326
|
|
|
321
327
|
|
|
322
|
-
str += `
|
|
323
|
-
<div class="tabs-container c-d-desktop-flex c-d-mobile-none">
|
|
324
|
-
`;
|
|
328
|
+
str += ` <div class="tabs-container c-d-desktop-flex c-d-mobile-none">`;
|
|
325
329
|
|
|
326
330
|
config.timeline.tabs.forEach(tab => {
|
|
327
331
|
if(!tab.isHidden){
|
|
328
|
-
str += `
|
|
329
|
-
|
|
332
|
+
str += ` <div
|
|
333
|
+
class="tab ${tab.disabled ? 'disabled': ''} ${tab == tabSelected ? 'active': ''} ${tab.color}"
|
|
334
|
+
color="${tab.color}"
|
|
335
|
+
input-key="${tab.id}"
|
|
336
|
+
${tab.tooltip?'cap-tooltip="'+tab.tooltip+'"':''} >
|
|
330
337
|
<span>${tab.label}</span>
|
|
331
338
|
${tab.icon || ''}
|
|
332
339
|
</div>
|
|
@@ -334,10 +341,44 @@ export default {
|
|
|
334
341
|
}
|
|
335
342
|
});
|
|
336
343
|
|
|
337
|
-
str +=
|
|
338
|
-
</div>`;
|
|
344
|
+
str += `</div>`;
|
|
339
345
|
}
|
|
340
346
|
|
|
347
|
+
if(tabSelected){
|
|
348
|
+
|
|
349
|
+
if(tabSelected.legends){
|
|
350
|
+
|
|
351
|
+
str += `<div class="legends-select-container c-d-desktop-none c-d-mobile-flex">
|
|
352
|
+
<select class="tabs-select">`;
|
|
353
|
+
|
|
354
|
+
tabSelected.legends.forEach(legend => {
|
|
355
|
+
str +=` <option value="${legend.id}"> ${legend.label} </option>`
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
str += `</select>
|
|
359
|
+
</div>`;
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
str += `<div class="legends-container c-d-desktop-flex c-d-mobile-none">`;
|
|
363
|
+
|
|
364
|
+
tabSelected.legends.forEach(legend => {
|
|
365
|
+
str += ` <div
|
|
366
|
+
class="legend ${legend.active? 'active': ''}"
|
|
367
|
+
input-key="${legend.key}"
|
|
368
|
+
${legend.tooltip ? `cap-tooltip="${legend.tooltip}"`:''} >
|
|
369
|
+
<div class="icon-legend ${legend.color && legend.active ? legend.color+"--background":''} ${legend.shape}"></div>
|
|
370
|
+
<span>${legend.label}</span>
|
|
371
|
+
</div>`;
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
str += `</div>`;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
341
382
|
|
|
342
383
|
str += `
|
|
343
384
|
|
|
@@ -452,7 +493,8 @@ export default {
|
|
|
452
493
|
}
|
|
453
494
|
|
|
454
495
|
|
|
455
|
-
str +=
|
|
496
|
+
str += ` <div class="button-right-container"></div>
|
|
497
|
+
</div>`;
|
|
456
498
|
/*
|
|
457
499
|
`
|
|
458
500
|
<button toggle-sidebar-right class="btn-icon btn-icon-raised">
|
|
@@ -466,24 +508,50 @@ export default {
|
|
|
466
508
|
</div>
|
|
467
509
|
`;
|
|
468
510
|
*/
|
|
511
|
+
|
|
512
|
+
|
|
469
513
|
let $r = dom.createElementFromHTML(str);
|
|
514
|
+
$elem.replaceWith($r);
|
|
470
515
|
|
|
471
|
-
|
|
472
|
-
$r.
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
516
|
+
if(config.timeline.header.rightButtons){
|
|
517
|
+
let $buttonContainer = $r.querySelector(".button-right-container");
|
|
518
|
+
config.timeline.header.rightButtons.forEach(button => {
|
|
519
|
+
let str = `<button class="btn-icon btn-icon-raised">
|
|
520
|
+
<span>
|
|
521
|
+
<svg style="width:24px;height:24px" viewBox="0 0 24 24">
|
|
522
|
+
<path fill="currentColor" d="${button.icon}" />
|
|
523
|
+
</svg>
|
|
524
|
+
</span>
|
|
525
|
+
</button>`;
|
|
526
|
+
let $button = dom.createElementFromHTML(str);
|
|
527
|
+
$button.addEventListener("click", evt => button.onClick({evt}) );
|
|
528
|
+
$buttonContainer.append($button);
|
|
529
|
+
});
|
|
530
|
+
}
|
|
477
531
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
$
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
532
|
+
|
|
533
|
+
let $toggleDark = $r.querySelector("[toggle-dark]");
|
|
534
|
+
if($toggleDark){
|
|
535
|
+
$toggleDark.addEventListener("click", e => {
|
|
536
|
+
$r.dispatchEvent(new CustomEvent("toggleDark", {
|
|
537
|
+
bubbles: true,
|
|
538
|
+
cancelable: false,
|
|
539
|
+
}));
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
let $btnCalendar = $r.querySelector("[btn-calendar]")
|
|
544
|
+
if($btnCalendar){
|
|
545
|
+
$btnCalendar.addEventListener("click", e => {
|
|
546
|
+
let x = e.x;
|
|
547
|
+
let y = e.y;
|
|
548
|
+
$r.dispatchEvent(new CustomEvent("clickCalendarIcon", {
|
|
549
|
+
bubbles: true,
|
|
550
|
+
cancelable: false,
|
|
551
|
+
detail:{x, y}
|
|
552
|
+
}));
|
|
553
|
+
});
|
|
554
|
+
}
|
|
487
555
|
|
|
488
556
|
let $btnToggleHeader = $r.querySelector("[toggle-header]")
|
|
489
557
|
if($btnToggleHeader){
|
|
@@ -535,6 +603,29 @@ export default {
|
|
|
535
603
|
});
|
|
536
604
|
|
|
537
605
|
|
|
606
|
+
$r.querySelectorAll(".legend").forEach($legend => {
|
|
607
|
+
$legend.addEventListener("click", e => {
|
|
608
|
+
|
|
609
|
+
let key = e.currentTarget.getAttribute("input-key");
|
|
610
|
+
|
|
611
|
+
if(key){
|
|
612
|
+
let legendSelected = tabSelected.legends.find(tab => tab.key === key);
|
|
613
|
+
if(legendSelected){
|
|
614
|
+
$r.dispatchEvent(new CustomEvent("selectLegendHeader", {
|
|
615
|
+
bubbles: true,
|
|
616
|
+
cancelable: false,
|
|
617
|
+
detail:{
|
|
618
|
+
legend: legendSelected,
|
|
619
|
+
$legend
|
|
620
|
+
}
|
|
621
|
+
}));
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
|
|
538
629
|
$r.querySelectorAll(".tab:not(.disabled)").forEach($tab => {
|
|
539
630
|
$tab.addEventListener("click", e => {
|
|
540
631
|
|
|
@@ -556,6 +647,8 @@ export default {
|
|
|
556
647
|
});
|
|
557
648
|
});
|
|
558
649
|
|
|
650
|
+
|
|
651
|
+
|
|
559
652
|
$r.querySelectorAll(".tabs-select:not(.disabled)").forEach($tab => {
|
|
560
653
|
$tab.addEventListener("change", e => {
|
|
561
654
|
|
|
@@ -646,6 +739,22 @@ export default {
|
|
|
646
739
|
|
|
647
740
|
if(config.timeline.dateSelectable){
|
|
648
741
|
$elem.querySelectorAll(".dia-calendario[date]").forEach($dia => {
|
|
742
|
+
|
|
743
|
+
$dia.addEventListener("contextmenu", evt => {
|
|
744
|
+
|
|
745
|
+
$elem.dispatchEvent(new CustomEvent("contextMenuDate", {
|
|
746
|
+
bubbles : true,
|
|
747
|
+
cancelable : false,
|
|
748
|
+
detail : {
|
|
749
|
+
$elem: $dia,
|
|
750
|
+
date: $dia.getAttribute("date"),
|
|
751
|
+
clientX : evt.clientX,
|
|
752
|
+
clientY: evt.clientY
|
|
753
|
+
}
|
|
754
|
+
}));
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
|
|
649
758
|
$dia.addEventListener("click", evt => {
|
|
650
759
|
|
|
651
760
|
$elem.dispatchEvent(new CustomEvent("clickDate", {
|
|
@@ -657,6 +766,7 @@ export default {
|
|
|
657
766
|
}
|
|
658
767
|
}));
|
|
659
768
|
});
|
|
769
|
+
|
|
660
770
|
});
|
|
661
771
|
}
|
|
662
772
|
|
|
@@ -1801,6 +1911,11 @@ export default {
|
|
|
1801
1911
|
if(tabSelected.floatBox.nums){
|
|
1802
1912
|
tabSelected.floatBox.nums.forEach(n => {
|
|
1803
1913
|
|
|
1914
|
+
if(tabSelected.legends && n.tabKey){
|
|
1915
|
+
let legend = tabSelected.legends.find(l => l.key == n.tabKey);
|
|
1916
|
+
if(legend && !legend.active) return;
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1804
1919
|
let dataFloatBox = null;
|
|
1805
1920
|
let className = "";
|
|
1806
1921
|
|
|
@@ -2134,11 +2249,19 @@ export default {
|
|
|
2134
2249
|
*/
|
|
2135
2250
|
redrawSelectBoard($elem, selected){
|
|
2136
2251
|
$elem.innerHTML = "";
|
|
2252
|
+
let hasNumber = true;
|
|
2253
|
+
|
|
2137
2254
|
if(selected){
|
|
2255
|
+
|
|
2256
|
+
if(selected.length == 1) hasNumber = false;
|
|
2257
|
+
|
|
2138
2258
|
selected.forEach(s => {
|
|
2139
|
-
let
|
|
2140
|
-
|
|
2141
|
-
|
|
2259
|
+
let attributes = []
|
|
2260
|
+
|
|
2261
|
+
if(hasNumber){
|
|
2262
|
+
attributes.push({name:"cap-badge", value:s.index });
|
|
2263
|
+
}
|
|
2264
|
+
let $s = dom.createElement("div", {className: "selected-day", attributes });
|
|
2142
2265
|
$s.style.left = s.pos.left + "px";
|
|
2143
2266
|
$s.style.top = s.pos.top + "px";
|
|
2144
2267
|
$elem.append($s);
|
|
@@ -2692,30 +2815,49 @@ export default {
|
|
|
2692
2815
|
},
|
|
2693
2816
|
|
|
2694
2817
|
|
|
2695
|
-
createContextMenu( {
|
|
2818
|
+
createContextMenu( {
|
|
2819
|
+
config,
|
|
2820
|
+
$capibaraElem = null,
|
|
2821
|
+
evt = null,
|
|
2822
|
+
date = null,
|
|
2823
|
+
item = null,
|
|
2824
|
+
selected = [],
|
|
2825
|
+
tabSelected = null,
|
|
2826
|
+
left = null,
|
|
2827
|
+
top = null,
|
|
2828
|
+
name = ""
|
|
2829
|
+
} ){
|
|
2696
2830
|
|
|
2697
2831
|
if(config.timeline.contextMenu === undefined) return {elem: null, isVisible: false} ;
|
|
2698
2832
|
|
|
2699
2833
|
let className = "";
|
|
2700
2834
|
let style = "";
|
|
2701
|
-
let
|
|
2702
|
-
let
|
|
2835
|
+
let strHtml = '';
|
|
2836
|
+
let leftPosition = null;
|
|
2837
|
+
let topPosition = null;
|
|
2703
2838
|
let isVisible = true;
|
|
2704
2839
|
|
|
2705
|
-
if(evt){
|
|
2706
|
-
left = evt.clientX
|
|
2707
|
-
top = evt.clientY
|
|
2840
|
+
if(evt && $capibaraElem ){
|
|
2841
|
+
left = evt.clientX;
|
|
2842
|
+
top = evt.clientY - $capibaraElem.getBoundingClientRect().top;
|
|
2843
|
+
}
|
|
2844
|
+
|
|
2845
|
+
if(left){
|
|
2846
|
+
leftPosition = left;
|
|
2708
2847
|
}
|
|
2709
2848
|
|
|
2710
|
-
if(
|
|
2711
|
-
|
|
2849
|
+
if(top){
|
|
2850
|
+
topPosition = top;
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2853
|
+
if(leftPosition !== null & topPosition !== null){
|
|
2854
|
+
style += `top: ${ topPosition }px; left: ${ leftPosition }px`;
|
|
2712
2855
|
}else{
|
|
2713
2856
|
className += "cm-hide";
|
|
2714
2857
|
isVisible = false;
|
|
2715
2858
|
}
|
|
2716
2859
|
|
|
2717
2860
|
|
|
2718
|
-
let strHtml = '';
|
|
2719
2861
|
|
|
2720
2862
|
strHtml += ` <div class="cap-context-menu-container ${className}">
|
|
2721
2863
|
<div class="cap-context-menu" style="${style}">
|
|
@@ -2728,32 +2870,45 @@ export default {
|
|
|
2728
2870
|
config.timeline.contextMenu.options.forEach(option => {
|
|
2729
2871
|
|
|
2730
2872
|
if(option.showIf){
|
|
2731
|
-
let show = option.showIf({item, date, selected});
|
|
2873
|
+
let show = option.showIf({item, date, selected, name, tabSelected});
|
|
2732
2874
|
if(!show) return;
|
|
2733
2875
|
}
|
|
2734
2876
|
|
|
2735
2877
|
|
|
2736
2878
|
let isEnabled = true;
|
|
2737
2879
|
if(option.enableIf){
|
|
2738
|
-
isEnabled = option.enableIf({item, date, selected});
|
|
2880
|
+
isEnabled = option.enableIf({item, date, selected, name, tabSelected});
|
|
2739
2881
|
}
|
|
2740
2882
|
|
|
2741
2883
|
let optionClassName = "";
|
|
2884
|
+
let strIcon = "";
|
|
2742
2885
|
|
|
2743
2886
|
if(!isEnabled){
|
|
2744
2887
|
optionClassName += "is-disabled";
|
|
2745
2888
|
}
|
|
2746
2889
|
|
|
2890
|
+
if(option.icon){
|
|
2891
|
+
|
|
2892
|
+
strIcon = `<div class="cap-context-menu_item_icon">
|
|
2893
|
+
<svg viewBox="0 0 24 24">
|
|
2894
|
+
<path d="${option.icon}" />
|
|
2895
|
+
</svg>
|
|
2896
|
+
</div>`;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2747
2899
|
let optionStrHtml = `
|
|
2748
|
-
<div class="cap-context-
|
|
2749
|
-
${
|
|
2900
|
+
<div class="cap-context-menu_item ${optionClassName}">
|
|
2901
|
+
${strIcon}
|
|
2902
|
+
<span>
|
|
2903
|
+
${option.label}
|
|
2904
|
+
</span>
|
|
2750
2905
|
</div>`;
|
|
2751
2906
|
|
|
2752
2907
|
let $option = dom.createElementFromHTML(optionStrHtml);
|
|
2753
2908
|
|
|
2754
2909
|
if(isEnabled){
|
|
2755
2910
|
$option.addEventListener("click", (evtClick) => option.onClick({
|
|
2756
|
-
config, evt:evtClick, date, item, selected
|
|
2911
|
+
config, evt:evtClick, date, item, selected, tabSelected
|
|
2757
2912
|
}));
|
|
2758
2913
|
}else{
|
|
2759
2914
|
$option.addEventListener("click", (evtClick) => {
|