dockview-react 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/dockview-react.amd.js +68 -20
- package/dist/dockview-react.amd.js.map +1 -1
- package/dist/dockview-react.amd.min.js +2 -2
- package/dist/dockview-react.amd.min.js.map +1 -1
- package/dist/dockview-react.amd.min.noStyle.js +2 -2
- package/dist/dockview-react.amd.min.noStyle.js.map +1 -1
- package/dist/dockview-react.amd.noStyle.js +68 -20
- package/dist/dockview-react.amd.noStyle.js.map +1 -1
- package/dist/dockview-react.cjs.js +68 -20
- package/dist/dockview-react.cjs.js.map +1 -1
- package/dist/dockview-react.esm.js +68 -20
- package/dist/dockview-react.esm.js.map +1 -1
- package/dist/dockview-react.esm.min.js +2 -2
- package/dist/dockview-react.esm.min.js.map +1 -1
- package/dist/dockview-react.js +68 -20
- package/dist/dockview-react.js.map +1 -1
- package/dist/dockview-react.min.js +2 -2
- package/dist/dockview-react.min.js.map +1 -1
- package/dist/dockview-react.min.noStyle.js +2 -2
- package/dist/dockview-react.min.noStyle.js.map +1 -1
- package/dist/dockview-react.noStyle.js +68 -20
- package/dist/dockview-react.noStyle.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-react
|
|
3
|
-
* @version 4.2.
|
|
3
|
+
* @version 4.2.5
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -671,6 +671,42 @@ function onDidWindowResizeEnd(element, cb) {
|
|
|
671
671
|
}));
|
|
672
672
|
return disposable;
|
|
673
673
|
}
|
|
674
|
+
function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
|
|
675
|
+
const buffer = options.buffer;
|
|
676
|
+
const rect = element.getBoundingClientRect();
|
|
677
|
+
const rootRect = root.getBoundingClientRect();
|
|
678
|
+
let translateX = 0;
|
|
679
|
+
let translateY = 0;
|
|
680
|
+
const left = rect.left - rootRect.left;
|
|
681
|
+
const top = rect.top - rootRect.top;
|
|
682
|
+
const bottom = rect.bottom - rootRect.bottom;
|
|
683
|
+
const right = rect.right - rootRect.right;
|
|
684
|
+
// Check horizontal overflow
|
|
685
|
+
if (left < buffer) {
|
|
686
|
+
translateX = buffer - left;
|
|
687
|
+
}
|
|
688
|
+
else if (right > buffer) {
|
|
689
|
+
translateX = -buffer - right;
|
|
690
|
+
}
|
|
691
|
+
// Check vertical overflow
|
|
692
|
+
if (top < buffer) {
|
|
693
|
+
translateY = buffer - top;
|
|
694
|
+
}
|
|
695
|
+
else if (bottom > buffer) {
|
|
696
|
+
translateY = -bottom - buffer;
|
|
697
|
+
}
|
|
698
|
+
// Apply the translation if needed
|
|
699
|
+
if (translateX !== 0 || translateY !== 0) {
|
|
700
|
+
element.style.transform = `translate(${translateX}px, ${translateY}px)`;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
function findRelativeZIndexParent(el) {
|
|
704
|
+
let tmp = el;
|
|
705
|
+
while (tmp && (tmp.style.zIndex === 'auto' || tmp.style.zIndex === '')) {
|
|
706
|
+
tmp = tmp.parentElement;
|
|
707
|
+
}
|
|
708
|
+
return tmp;
|
|
709
|
+
}
|
|
674
710
|
|
|
675
711
|
function tail(arr) {
|
|
676
712
|
if (arr.length === 0) {
|
|
@@ -4938,6 +4974,8 @@ function addGhostImage(dataTransfer, ghostElement, options) {
|
|
|
4938
4974
|
var _a, _b;
|
|
4939
4975
|
// class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
|
|
4940
4976
|
addClasses(ghostElement, 'dv-dragged');
|
|
4977
|
+
// move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
|
|
4978
|
+
ghostElement.style.top = '-9999px';
|
|
4941
4979
|
document.body.appendChild(ghostElement);
|
|
4942
4980
|
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);
|
|
4943
4981
|
setTimeout(() => {
|
|
@@ -5638,7 +5676,7 @@ class TabsContainer extends CompositeDisposable {
|
|
|
5638
5676
|
toggleClass(wrapper, 'dv-tab', true);
|
|
5639
5677
|
toggleClass(wrapper, 'dv-active-tab', panelObject.api.isActive);
|
|
5640
5678
|
toggleClass(wrapper, 'dv-inactive-tab', !panelObject.api.isActive);
|
|
5641
|
-
wrapper.addEventListener('
|
|
5679
|
+
wrapper.addEventListener('pointerdown', () => {
|
|
5642
5680
|
this.accessor.popupService.close();
|
|
5643
5681
|
tab.element.scrollIntoView();
|
|
5644
5682
|
tab.panel.api.setActive();
|
|
@@ -5646,9 +5684,13 @@ class TabsContainer extends CompositeDisposable {
|
|
|
5646
5684
|
wrapper.appendChild(child);
|
|
5647
5685
|
el.appendChild(wrapper);
|
|
5648
5686
|
}
|
|
5687
|
+
const relativeParent = findRelativeZIndexParent(root);
|
|
5649
5688
|
this.accessor.popupService.openPopover(el, {
|
|
5650
5689
|
x: event.clientX,
|
|
5651
5690
|
y: event.clientY,
|
|
5691
|
+
zIndex: (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex)
|
|
5692
|
+
? `calc(${relativeParent.style.zIndex} * 2)`
|
|
5693
|
+
: undefined,
|
|
5652
5694
|
});
|
|
5653
5695
|
}));
|
|
5654
5696
|
}
|
|
@@ -7990,10 +8032,11 @@ class PopupService extends CompositeDisposable {
|
|
|
7990
8032
|
}), this._activeDisposable);
|
|
7991
8033
|
}
|
|
7992
8034
|
openPopover(element, position) {
|
|
8035
|
+
var _a;
|
|
7993
8036
|
this.close();
|
|
7994
8037
|
const wrapper = document.createElement('div');
|
|
7995
8038
|
wrapper.style.position = 'absolute';
|
|
7996
|
-
wrapper.style.zIndex = '
|
|
8039
|
+
wrapper.style.zIndex = (_a = position.zIndex) !== null && _a !== void 0 ? _a : 'var(--dv-overlay-z-index)';
|
|
7997
8040
|
wrapper.appendChild(element);
|
|
7998
8041
|
const anchorBox = this._element.getBoundingClientRect();
|
|
7999
8042
|
const offsetX = anchorBox.left;
|
|
@@ -8017,6 +8060,9 @@ class PopupService extends CompositeDisposable {
|
|
|
8017
8060
|
}
|
|
8018
8061
|
this.close();
|
|
8019
8062
|
}));
|
|
8063
|
+
requestAnimationFrame(() => {
|
|
8064
|
+
shiftAbsoluteElementIntoView(wrapper, this.root);
|
|
8065
|
+
});
|
|
8020
8066
|
}
|
|
8021
8067
|
close() {
|
|
8022
8068
|
if (this._active) {
|
|
@@ -9550,24 +9596,26 @@ class DockviewComponent extends BaseGrid {
|
|
|
9550
9596
|
selectedPopoutGroup.disposable.dispose();
|
|
9551
9597
|
}
|
|
9552
9598
|
}
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9599
|
+
if (from.api.location.type !== 'popout') {
|
|
9600
|
+
const referenceLocation = getGridLocation(to.element);
|
|
9601
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
9602
|
+
let size;
|
|
9603
|
+
switch (this.gridview.orientation) {
|
|
9604
|
+
case exports.Orientation.VERTICAL:
|
|
9605
|
+
size =
|
|
9606
|
+
referenceLocation.length % 2 == 0
|
|
9607
|
+
? from.api.width
|
|
9608
|
+
: from.api.height;
|
|
9609
|
+
break;
|
|
9610
|
+
case exports.Orientation.HORIZONTAL:
|
|
9611
|
+
size =
|
|
9612
|
+
referenceLocation.length % 2 == 0
|
|
9613
|
+
? from.api.height
|
|
9614
|
+
: from.api.width;
|
|
9615
|
+
break;
|
|
9616
|
+
}
|
|
9617
|
+
this.gridview.addView(from, size, dropLocation);
|
|
9569
9618
|
}
|
|
9570
|
-
this.gridview.addView(from, size, dropLocation);
|
|
9571
9619
|
}
|
|
9572
9620
|
from.panels.forEach((panel) => {
|
|
9573
9621
|
this._onDidMovePanel.fire({ panel, from });
|