capibara 1.3.61 → 1.3.62
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 +181 -39
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/util/tableElements.js +105 -23
package/dist/index.js
CHANGED
|
@@ -24440,16 +24440,47 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24440
24440
|
let $contextMenuContainer = _util_domUtils__WEBPACK_IMPORTED_MODULE_0__["default"].createElementFromHTML(strHtml);
|
|
24441
24441
|
let $contextMenu = $contextMenuContainer.querySelector(".cap-context-menu");
|
|
24442
24442
|
let hasSomeoption = false;
|
|
24443
|
-
|
|
24443
|
+
var ctx = {
|
|
24444
|
+
config: config,
|
|
24445
|
+
date: date,
|
|
24446
|
+
item: item,
|
|
24447
|
+
selected: selected,
|
|
24448
|
+
tabSelected: tabSelected,
|
|
24449
|
+
target: target,
|
|
24450
|
+
name: name
|
|
24451
|
+
};
|
|
24452
|
+
|
|
24453
|
+
function renderContextMenuItem(option, $menu) {
|
|
24444
24454
|
if (option.showIf) {
|
|
24445
24455
|
let show = option.showIf({
|
|
24446
|
-
item,
|
|
24447
|
-
date,
|
|
24448
|
-
selected,
|
|
24449
|
-
name,
|
|
24450
|
-
tabSelected
|
|
24456
|
+
item: ctx.item,
|
|
24457
|
+
date: ctx.date,
|
|
24458
|
+
selected: ctx.selected,
|
|
24459
|
+
name: ctx.name,
|
|
24460
|
+
tabSelected: ctx.tabSelected
|
|
24451
24461
|
});
|
|
24452
24462
|
if (!show) return;
|
|
24463
|
+
} // isGroup: llama getItems() e inserta cada resultado como item independiente
|
|
24464
|
+
|
|
24465
|
+
|
|
24466
|
+
if (option.isGroup && option.getItems) {
|
|
24467
|
+
var groupItems = option.getItems({
|
|
24468
|
+
config: ctx.config,
|
|
24469
|
+
date: ctx.date,
|
|
24470
|
+
item: ctx.item,
|
|
24471
|
+
selected: ctx.selected,
|
|
24472
|
+
tabSelected: ctx.tabSelected,
|
|
24473
|
+
target: ctx.target
|
|
24474
|
+
});
|
|
24475
|
+
|
|
24476
|
+
if (groupItems && groupItems.length > 0) {
|
|
24477
|
+
groupItems.forEach(function (gItem) {
|
|
24478
|
+
renderContextMenuItem(gItem, $menu);
|
|
24479
|
+
});
|
|
24480
|
+
hasSomeoption = true;
|
|
24481
|
+
}
|
|
24482
|
+
|
|
24483
|
+
return;
|
|
24453
24484
|
}
|
|
24454
24485
|
|
|
24455
24486
|
let isEnabled = true;
|
|
@@ -24457,11 +24488,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24457
24488
|
|
|
24458
24489
|
if (option.enableIf) {
|
|
24459
24490
|
isEnabled = option.enableIf({
|
|
24460
|
-
item,
|
|
24461
|
-
date,
|
|
24462
|
-
selected,
|
|
24463
|
-
name,
|
|
24464
|
-
tabSelected
|
|
24491
|
+
item: ctx.item,
|
|
24492
|
+
date: ctx.date,
|
|
24493
|
+
selected: ctx.selected,
|
|
24494
|
+
name: ctx.name,
|
|
24495
|
+
tabSelected: ctx.tabSelected
|
|
24465
24496
|
});
|
|
24466
24497
|
}
|
|
24467
24498
|
|
|
@@ -24484,7 +24515,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24484
24515
|
}
|
|
24485
24516
|
|
|
24486
24517
|
if (option.label) {
|
|
24487
|
-
|
|
24518
|
+
var resolvedLabel = typeof option.label === "function" ? option.label({
|
|
24519
|
+
config: ctx.config,
|
|
24520
|
+
date: ctx.date,
|
|
24521
|
+
item: ctx.item,
|
|
24522
|
+
selected: ctx.selected,
|
|
24523
|
+
tabSelected: ctx.tabSelected,
|
|
24524
|
+
target: ctx.target
|
|
24525
|
+
}) : option.label;
|
|
24526
|
+
label = "<span>" + resolvedLabel + "</span>";
|
|
24488
24527
|
}
|
|
24489
24528
|
|
|
24490
24529
|
if (option.icon) {
|
|
@@ -24495,12 +24534,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24495
24534
|
|
|
24496
24535
|
if (option.children) {
|
|
24497
24536
|
resolvedChildren = typeof option.children === "function" ? option.children({
|
|
24498
|
-
config: config,
|
|
24499
|
-
date: date,
|
|
24500
|
-
item: item,
|
|
24501
|
-
selected: selected,
|
|
24502
|
-
tabSelected: tabSelected,
|
|
24503
|
-
target: target
|
|
24537
|
+
config: ctx.config,
|
|
24538
|
+
date: ctx.date,
|
|
24539
|
+
item: ctx.item,
|
|
24540
|
+
selected: ctx.selected,
|
|
24541
|
+
tabSelected: ctx.tabSelected,
|
|
24542
|
+
target: ctx.target
|
|
24504
24543
|
}) : option.children;
|
|
24505
24544
|
}
|
|
24506
24545
|
|
|
@@ -24517,40 +24556,122 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24517
24556
|
|
|
24518
24557
|
if (child.enableIf) {
|
|
24519
24558
|
childEnabled = child.enableIf({
|
|
24520
|
-
config: config,
|
|
24521
|
-
date: date,
|
|
24522
|
-
item: item,
|
|
24523
|
-
selected: selected,
|
|
24524
|
-
tabSelected: tabSelected
|
|
24559
|
+
config: ctx.config,
|
|
24560
|
+
date: ctx.date,
|
|
24561
|
+
item: ctx.item,
|
|
24562
|
+
selected: ctx.selected,
|
|
24563
|
+
tabSelected: ctx.tabSelected
|
|
24525
24564
|
});
|
|
24526
24565
|
}
|
|
24527
24566
|
|
|
24528
24567
|
var childClassName = childEnabled ? "" : "is-disabled ";
|
|
24529
24568
|
var childIcon = "";
|
|
24530
|
-
var childLabel = child.label ? "<span>" + child.label
|
|
24569
|
+
var childLabel = child.label ? "<span>" + (typeof child.label === "function" ? child.label({
|
|
24570
|
+
config: ctx.config,
|
|
24571
|
+
date: ctx.date,
|
|
24572
|
+
item: ctx.item,
|
|
24573
|
+
selected: ctx.selected,
|
|
24574
|
+
tabSelected: ctx.tabSelected,
|
|
24575
|
+
target: ctx.target
|
|
24576
|
+
}) : child.label) + "</span>" : "";
|
|
24531
24577
|
|
|
24532
24578
|
if (child.icon) {
|
|
24533
24579
|
childIcon = "<div class=\"cap-context-menu_item_icon\"><svg viewBox=\"0 0 24 24\"><path d=\"" + child.icon + "\" /></svg></div>";
|
|
24534
24580
|
}
|
|
24535
24581
|
|
|
24536
|
-
var
|
|
24582
|
+
var childResolvedChildren = null;
|
|
24583
|
+
|
|
24584
|
+
if (child.children) {
|
|
24585
|
+
childResolvedChildren = typeof child.children === "function" ? child.children({
|
|
24586
|
+
config: ctx.config,
|
|
24587
|
+
date: ctx.date,
|
|
24588
|
+
item: ctx.item,
|
|
24589
|
+
selected: ctx.selected,
|
|
24590
|
+
tabSelected: ctx.tabSelected,
|
|
24591
|
+
target: ctx.target
|
|
24592
|
+
}) : child.children;
|
|
24593
|
+
}
|
|
24594
|
+
|
|
24595
|
+
var childChevron = childResolvedChildren && childResolvedChildren.length > 0 ? "<span class=\"cap-context-menu_item_chevron\">›</span>" : "";
|
|
24596
|
+
var childHasChildrenClass = childResolvedChildren && childResolvedChildren.length > 0 ? "has-children" : "";
|
|
24597
|
+
var childHtml = "<div class=\"cap-context-menu_item " + childHasChildrenClass + " " + childClassName + "\">" + childIcon + childLabel + childChevron + "</div>";
|
|
24537
24598
|
var $child = _util_domUtils__WEBPACK_IMPORTED_MODULE_0__["default"].createElementFromHTML(childHtml);
|
|
24538
24599
|
|
|
24600
|
+
if (childResolvedChildren && childResolvedChildren.length > 0) {
|
|
24601
|
+
var $childSubmenu = document.createElement("div");
|
|
24602
|
+
$childSubmenu.className = "cap-context-menu cap-context-menu--submenu";
|
|
24603
|
+
childResolvedChildren.forEach(function (grandchild) {
|
|
24604
|
+
var gcEnabled = !grandchild.enableIf || grandchild.enableIf({
|
|
24605
|
+
config: ctx.config,
|
|
24606
|
+
date: ctx.date,
|
|
24607
|
+
item: ctx.item,
|
|
24608
|
+
selected: ctx.selected,
|
|
24609
|
+
tabSelected: ctx.tabSelected
|
|
24610
|
+
});
|
|
24611
|
+
var gcLabel = grandchild.label ? "<span>" + (typeof grandchild.label === "function" ? grandchild.label({
|
|
24612
|
+
config: ctx.config,
|
|
24613
|
+
date: ctx.date,
|
|
24614
|
+
item: ctx.item,
|
|
24615
|
+
selected: ctx.selected,
|
|
24616
|
+
tabSelected: ctx.tabSelected,
|
|
24617
|
+
target: ctx.target
|
|
24618
|
+
}) : grandchild.label) + "</span>" : "";
|
|
24619
|
+
var gcIcon = grandchild.icon ? "<div class=\"cap-context-menu_item_icon\"><svg viewBox=\"0 0 24 24\"><path d=\"" + grandchild.icon + "\" /></svg></div>" : "";
|
|
24620
|
+
var $gc = _util_domUtils__WEBPACK_IMPORTED_MODULE_0__["default"].createElementFromHTML("<div class=\"cap-context-menu_item " + (gcEnabled ? "" : "is-disabled ") + "\">" + gcIcon + gcLabel + "</div>");
|
|
24621
|
+
|
|
24622
|
+
if (gcEnabled && grandchild.onClick) {
|
|
24623
|
+
(function (gc) {
|
|
24624
|
+
$gc.addEventListener("click", function (evtClick) {
|
|
24625
|
+
gc.onClick({
|
|
24626
|
+
config: ctx.config,
|
|
24627
|
+
evt: evtClick,
|
|
24628
|
+
date: ctx.date,
|
|
24629
|
+
item: ctx.item,
|
|
24630
|
+
selected: ctx.selected,
|
|
24631
|
+
tabSelected: ctx.tabSelected,
|
|
24632
|
+
target: ctx.target
|
|
24633
|
+
});
|
|
24634
|
+
});
|
|
24635
|
+
})(grandchild);
|
|
24636
|
+
}
|
|
24637
|
+
|
|
24638
|
+
$childSubmenu.appendChild($gc);
|
|
24639
|
+
});
|
|
24640
|
+
$child.appendChild($childSubmenu);
|
|
24641
|
+
|
|
24642
|
+
(function (el, sub) {
|
|
24643
|
+
el.addEventListener("mouseenter", function () {
|
|
24644
|
+
var elRect = el.getBoundingClientRect();
|
|
24645
|
+
var vh = window.innerHeight;
|
|
24646
|
+
sub.style.transform = "";
|
|
24647
|
+
sub.style.top = "0";
|
|
24648
|
+
sub.style.bottom = "auto";
|
|
24649
|
+
|
|
24650
|
+
if (elRect.top > vh * 4 / 6) {
|
|
24651
|
+
sub.style.top = "auto";
|
|
24652
|
+
sub.style.bottom = "0";
|
|
24653
|
+
} else if (elRect.top > vh * 2 / 6) {
|
|
24654
|
+
sub.style.transform = "translateY(-50%)";
|
|
24655
|
+
}
|
|
24656
|
+
});
|
|
24657
|
+
})($child, $childSubmenu);
|
|
24658
|
+
}
|
|
24659
|
+
|
|
24539
24660
|
if (childEnabled && child.onClick) {
|
|
24540
24661
|
(function (c) {
|
|
24541
24662
|
$child.addEventListener("click", function (evtClick) {
|
|
24542
24663
|
c.onClick({
|
|
24543
|
-
config: config,
|
|
24664
|
+
config: ctx.config,
|
|
24544
24665
|
evt: evtClick,
|
|
24545
|
-
date: date,
|
|
24546
|
-
item: item,
|
|
24547
|
-
selected: selected,
|
|
24548
|
-
tabSelected: tabSelected,
|
|
24549
|
-
target: target
|
|
24666
|
+
date: ctx.date,
|
|
24667
|
+
item: ctx.item,
|
|
24668
|
+
selected: ctx.selected,
|
|
24669
|
+
tabSelected: ctx.tabSelected,
|
|
24670
|
+
target: ctx.target
|
|
24550
24671
|
});
|
|
24551
24672
|
});
|
|
24552
24673
|
})(child);
|
|
24553
|
-
} else {
|
|
24674
|
+
} else if (!(childResolvedChildren && childResolvedChildren.length > 0)) {
|
|
24554
24675
|
$child.addEventListener("click", function (evtClick) {
|
|
24555
24676
|
evtClick.preventDefault();
|
|
24556
24677
|
evtClick.stopPropagation();
|
|
@@ -24560,17 +24681,34 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24560
24681
|
$submenu.appendChild($child);
|
|
24561
24682
|
});
|
|
24562
24683
|
$option.appendChild($submenu);
|
|
24684
|
+
|
|
24685
|
+
(function (el, sub) {
|
|
24686
|
+
el.addEventListener("mouseenter", function () {
|
|
24687
|
+
var elRect = el.getBoundingClientRect();
|
|
24688
|
+
var vh = window.innerHeight;
|
|
24689
|
+
sub.style.transform = "";
|
|
24690
|
+
sub.style.top = "0";
|
|
24691
|
+
sub.style.bottom = "auto";
|
|
24692
|
+
|
|
24693
|
+
if (elRect.top > vh * 4 / 6) {
|
|
24694
|
+
sub.style.top = "auto";
|
|
24695
|
+
sub.style.bottom = "0";
|
|
24696
|
+
} else if (elRect.top > vh * 2 / 6) {
|
|
24697
|
+
sub.style.transform = "translateY(-50%)";
|
|
24698
|
+
}
|
|
24699
|
+
});
|
|
24700
|
+
})($option, $submenu);
|
|
24563
24701
|
}
|
|
24564
24702
|
|
|
24565
24703
|
if (isEnabled && isClickeable && !(resolvedChildren && resolvedChildren.length > 0)) {
|
|
24566
24704
|
$option.addEventListener("click", evtClick => option.onClick({
|
|
24567
|
-
config,
|
|
24705
|
+
config: ctx.config,
|
|
24568
24706
|
evt: evtClick,
|
|
24569
|
-
date,
|
|
24570
|
-
item,
|
|
24571
|
-
selected,
|
|
24572
|
-
tabSelected,
|
|
24573
|
-
target
|
|
24707
|
+
date: ctx.date,
|
|
24708
|
+
item: ctx.item,
|
|
24709
|
+
selected: ctx.selected,
|
|
24710
|
+
tabSelected: ctx.tabSelected,
|
|
24711
|
+
target: ctx.target
|
|
24574
24712
|
}));
|
|
24575
24713
|
} else if (!(resolvedChildren && resolvedChildren.length > 0)) {
|
|
24576
24714
|
$option.addEventListener("click", evtClick => {
|
|
@@ -24579,8 +24717,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
24579
24717
|
});
|
|
24580
24718
|
}
|
|
24581
24719
|
|
|
24582
|
-
$
|
|
24720
|
+
$menu.append($option);
|
|
24583
24721
|
hasSomeoption = true;
|
|
24722
|
+
}
|
|
24723
|
+
|
|
24724
|
+
config.timeline.contextMenu.options.forEach(option => {
|
|
24725
|
+
renderContextMenuItem(option, $contextMenu);
|
|
24584
24726
|
});
|
|
24585
24727
|
return {
|
|
24586
24728
|
elem: $contextMenuContainer,
|