dockview-core 4.2.3 → 4.2.5
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/cjs/dnd/ghost.js +2 -0
- package/dist/cjs/dockview/components/popupService.d.ts +1 -0
- package/dist/cjs/dockview/components/popupService.js +6 -1
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +5 -1
- package/dist/cjs/dockview/dockviewComponent.js +19 -17
- package/dist/cjs/dom.d.ts +4 -0
- package/dist/cjs/dom.js +40 -1
- package/dist/dockview-core.amd.js +68 -20
- package/dist/dockview-core.amd.js.map +1 -1
- package/dist/dockview-core.amd.min.js +2 -2
- package/dist/dockview-core.amd.min.js.map +1 -1
- package/dist/dockview-core.amd.min.noStyle.js +2 -2
- package/dist/dockview-core.amd.min.noStyle.js.map +1 -1
- package/dist/dockview-core.amd.noStyle.js +68 -20
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +68 -20
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +68 -20
- package/dist/dockview-core.esm.js.map +1 -1
- package/dist/dockview-core.esm.min.js +2 -2
- package/dist/dockview-core.esm.min.js.map +1 -1
- package/dist/dockview-core.js +68 -20
- package/dist/dockview-core.js.map +1 -1
- package/dist/dockview-core.min.js +2 -2
- package/dist/dockview-core.min.js.map +1 -1
- package/dist/dockview-core.min.noStyle.js +2 -2
- package/dist/dockview-core.min.noStyle.js.map +1 -1
- package/dist/dockview-core.noStyle.js +68 -20
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/dnd/ghost.js +2 -0
- package/dist/esm/dockview/components/popupService.d.ts +1 -0
- package/dist/esm/dockview/components/popupService.js +6 -1
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +6 -2
- package/dist/esm/dockview/dockviewComponent.js +19 -17
- package/dist/esm/dom.d.ts +4 -0
- package/dist/esm/dom.js +36 -0
- package/package.json +1 -1
package/dist/dockview-core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 4.2.
|
|
3
|
+
* @version 4.2.5
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -672,6 +672,42 @@
|
|
|
672
672
|
}));
|
|
673
673
|
return disposable;
|
|
674
674
|
}
|
|
675
|
+
function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
|
|
676
|
+
const buffer = options.buffer;
|
|
677
|
+
const rect = element.getBoundingClientRect();
|
|
678
|
+
const rootRect = root.getBoundingClientRect();
|
|
679
|
+
let translateX = 0;
|
|
680
|
+
let translateY = 0;
|
|
681
|
+
const left = rect.left - rootRect.left;
|
|
682
|
+
const top = rect.top - rootRect.top;
|
|
683
|
+
const bottom = rect.bottom - rootRect.bottom;
|
|
684
|
+
const right = rect.right - rootRect.right;
|
|
685
|
+
// Check horizontal overflow
|
|
686
|
+
if (left < buffer) {
|
|
687
|
+
translateX = buffer - left;
|
|
688
|
+
}
|
|
689
|
+
else if (right > buffer) {
|
|
690
|
+
translateX = -buffer - right;
|
|
691
|
+
}
|
|
692
|
+
// Check vertical overflow
|
|
693
|
+
if (top < buffer) {
|
|
694
|
+
translateY = buffer - top;
|
|
695
|
+
}
|
|
696
|
+
else if (bottom > buffer) {
|
|
697
|
+
translateY = -bottom - buffer;
|
|
698
|
+
}
|
|
699
|
+
// Apply the translation if needed
|
|
700
|
+
if (translateX !== 0 || translateY !== 0) {
|
|
701
|
+
element.style.transform = `translate(${translateX}px, ${translateY}px)`;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
function findRelativeZIndexParent(el) {
|
|
705
|
+
let tmp = el;
|
|
706
|
+
while (tmp && (tmp.style.zIndex === 'auto' || tmp.style.zIndex === '')) {
|
|
707
|
+
tmp = tmp.parentElement;
|
|
708
|
+
}
|
|
709
|
+
return tmp;
|
|
710
|
+
}
|
|
675
711
|
|
|
676
712
|
function tail(arr) {
|
|
677
713
|
if (arr.length === 0) {
|
|
@@ -4939,6 +4975,8 @@
|
|
|
4939
4975
|
var _a, _b;
|
|
4940
4976
|
// class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
|
|
4941
4977
|
addClasses(ghostElement, 'dv-dragged');
|
|
4978
|
+
// move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
|
|
4979
|
+
ghostElement.style.top = '-9999px';
|
|
4942
4980
|
document.body.appendChild(ghostElement);
|
|
4943
4981
|
dataTransfer.setDragImage(ghostElement, (_a = options === null || options === void 0 ? void 0 : options.x) !== null && _a !== void 0 ? _a : 0, (_b = options === null || options === void 0 ? void 0 : options.y) !== null && _b !== void 0 ? _b : 0);
|
|
4944
4982
|
setTimeout(() => {
|
|
@@ -5639,7 +5677,7 @@
|
|
|
5639
5677
|
toggleClass(wrapper, 'dv-tab', true);
|
|
5640
5678
|
toggleClass(wrapper, 'dv-active-tab', panelObject.api.isActive);
|
|
5641
5679
|
toggleClass(wrapper, 'dv-inactive-tab', !panelObject.api.isActive);
|
|
5642
|
-
wrapper.addEventListener('
|
|
5680
|
+
wrapper.addEventListener('pointerdown', () => {
|
|
5643
5681
|
this.accessor.popupService.close();
|
|
5644
5682
|
tab.element.scrollIntoView();
|
|
5645
5683
|
tab.panel.api.setActive();
|
|
@@ -5647,9 +5685,13 @@
|
|
|
5647
5685
|
wrapper.appendChild(child);
|
|
5648
5686
|
el.appendChild(wrapper);
|
|
5649
5687
|
}
|
|
5688
|
+
const relativeParent = findRelativeZIndexParent(root);
|
|
5650
5689
|
this.accessor.popupService.openPopover(el, {
|
|
5651
5690
|
x: event.clientX,
|
|
5652
5691
|
y: event.clientY,
|
|
5692
|
+
zIndex: (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex)
|
|
5693
|
+
? `calc(${relativeParent.style.zIndex} * 2)`
|
|
5694
|
+
: undefined,
|
|
5653
5695
|
});
|
|
5654
5696
|
}));
|
|
5655
5697
|
}
|
|
@@ -8014,10 +8056,11 @@
|
|
|
8014
8056
|
}), this._activeDisposable);
|
|
8015
8057
|
}
|
|
8016
8058
|
openPopover(element, position) {
|
|
8059
|
+
var _a;
|
|
8017
8060
|
this.close();
|
|
8018
8061
|
const wrapper = document.createElement('div');
|
|
8019
8062
|
wrapper.style.position = 'absolute';
|
|
8020
|
-
wrapper.style.zIndex = '
|
|
8063
|
+
wrapper.style.zIndex = (_a = position.zIndex) !== null && _a !== void 0 ? _a : 'var(--dv-overlay-z-index)';
|
|
8021
8064
|
wrapper.appendChild(element);
|
|
8022
8065
|
const anchorBox = this._element.getBoundingClientRect();
|
|
8023
8066
|
const offsetX = anchorBox.left;
|
|
@@ -8041,6 +8084,9 @@
|
|
|
8041
8084
|
}
|
|
8042
8085
|
this.close();
|
|
8043
8086
|
}));
|
|
8087
|
+
requestAnimationFrame(() => {
|
|
8088
|
+
shiftAbsoluteElementIntoView(wrapper, this.root);
|
|
8089
|
+
});
|
|
8044
8090
|
}
|
|
8045
8091
|
close() {
|
|
8046
8092
|
if (this._active) {
|
|
@@ -9574,24 +9620,26 @@
|
|
|
9574
9620
|
selectedPopoutGroup.disposable.dispose();
|
|
9575
9621
|
}
|
|
9576
9622
|
}
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9623
|
+
if (from.api.location.type !== 'popout') {
|
|
9624
|
+
const referenceLocation = getGridLocation(to.element);
|
|
9625
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
9626
|
+
let size;
|
|
9627
|
+
switch (this.gridview.orientation) {
|
|
9628
|
+
case exports.Orientation.VERTICAL:
|
|
9629
|
+
size =
|
|
9630
|
+
referenceLocation.length % 2 == 0
|
|
9631
|
+
? from.api.width
|
|
9632
|
+
: from.api.height;
|
|
9633
|
+
break;
|
|
9634
|
+
case exports.Orientation.HORIZONTAL:
|
|
9635
|
+
size =
|
|
9636
|
+
referenceLocation.length % 2 == 0
|
|
9637
|
+
? from.api.height
|
|
9638
|
+
: from.api.width;
|
|
9639
|
+
break;
|
|
9640
|
+
}
|
|
9641
|
+
this.gridview.addView(from, size, dropLocation);
|
|
9593
9642
|
}
|
|
9594
|
-
this.gridview.addView(from, size, dropLocation);
|
|
9595
9643
|
}
|
|
9596
9644
|
from.panels.forEach((panel) => {
|
|
9597
9645
|
this._onDidMovePanel.fire({ panel, from });
|