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
|
@@ -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
|
*/
|
|
@@ -666,6 +666,42 @@ function onDidWindowResizeEnd(element, cb) {
|
|
|
666
666
|
}));
|
|
667
667
|
return disposable;
|
|
668
668
|
}
|
|
669
|
+
function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
|
|
670
|
+
const buffer = options.buffer;
|
|
671
|
+
const rect = element.getBoundingClientRect();
|
|
672
|
+
const rootRect = root.getBoundingClientRect();
|
|
673
|
+
let translateX = 0;
|
|
674
|
+
let translateY = 0;
|
|
675
|
+
const left = rect.left - rootRect.left;
|
|
676
|
+
const top = rect.top - rootRect.top;
|
|
677
|
+
const bottom = rect.bottom - rootRect.bottom;
|
|
678
|
+
const right = rect.right - rootRect.right;
|
|
679
|
+
// Check horizontal overflow
|
|
680
|
+
if (left < buffer) {
|
|
681
|
+
translateX = buffer - left;
|
|
682
|
+
}
|
|
683
|
+
else if (right > buffer) {
|
|
684
|
+
translateX = -buffer - right;
|
|
685
|
+
}
|
|
686
|
+
// Check vertical overflow
|
|
687
|
+
if (top < buffer) {
|
|
688
|
+
translateY = buffer - top;
|
|
689
|
+
}
|
|
690
|
+
else if (bottom > buffer) {
|
|
691
|
+
translateY = -bottom - buffer;
|
|
692
|
+
}
|
|
693
|
+
// Apply the translation if needed
|
|
694
|
+
if (translateX !== 0 || translateY !== 0) {
|
|
695
|
+
element.style.transform = `translate(${translateX}px, ${translateY}px)`;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
function findRelativeZIndexParent(el) {
|
|
699
|
+
let tmp = el;
|
|
700
|
+
while (tmp && (tmp.style.zIndex === 'auto' || tmp.style.zIndex === '')) {
|
|
701
|
+
tmp = tmp.parentElement;
|
|
702
|
+
}
|
|
703
|
+
return tmp;
|
|
704
|
+
}
|
|
669
705
|
|
|
670
706
|
function tail(arr) {
|
|
671
707
|
if (arr.length === 0) {
|
|
@@ -4933,6 +4969,8 @@ function addGhostImage(dataTransfer, ghostElement, options) {
|
|
|
4933
4969
|
var _a, _b;
|
|
4934
4970
|
// class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
|
|
4935
4971
|
addClasses(ghostElement, 'dv-dragged');
|
|
4972
|
+
// move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
|
|
4973
|
+
ghostElement.style.top = '-9999px';
|
|
4936
4974
|
document.body.appendChild(ghostElement);
|
|
4937
4975
|
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);
|
|
4938
4976
|
setTimeout(() => {
|
|
@@ -5633,7 +5671,7 @@ class TabsContainer extends CompositeDisposable {
|
|
|
5633
5671
|
toggleClass(wrapper, 'dv-tab', true);
|
|
5634
5672
|
toggleClass(wrapper, 'dv-active-tab', panelObject.api.isActive);
|
|
5635
5673
|
toggleClass(wrapper, 'dv-inactive-tab', !panelObject.api.isActive);
|
|
5636
|
-
wrapper.addEventListener('
|
|
5674
|
+
wrapper.addEventListener('pointerdown', () => {
|
|
5637
5675
|
this.accessor.popupService.close();
|
|
5638
5676
|
tab.element.scrollIntoView();
|
|
5639
5677
|
tab.panel.api.setActive();
|
|
@@ -5641,9 +5679,13 @@ class TabsContainer extends CompositeDisposable {
|
|
|
5641
5679
|
wrapper.appendChild(child);
|
|
5642
5680
|
el.appendChild(wrapper);
|
|
5643
5681
|
}
|
|
5682
|
+
const relativeParent = findRelativeZIndexParent(root);
|
|
5644
5683
|
this.accessor.popupService.openPopover(el, {
|
|
5645
5684
|
x: event.clientX,
|
|
5646
5685
|
y: event.clientY,
|
|
5686
|
+
zIndex: (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex)
|
|
5687
|
+
? `calc(${relativeParent.style.zIndex} * 2)`
|
|
5688
|
+
: undefined,
|
|
5647
5689
|
});
|
|
5648
5690
|
}));
|
|
5649
5691
|
}
|
|
@@ -8008,10 +8050,11 @@ class PopupService extends CompositeDisposable {
|
|
|
8008
8050
|
}), this._activeDisposable);
|
|
8009
8051
|
}
|
|
8010
8052
|
openPopover(element, position) {
|
|
8053
|
+
var _a;
|
|
8011
8054
|
this.close();
|
|
8012
8055
|
const wrapper = document.createElement('div');
|
|
8013
8056
|
wrapper.style.position = 'absolute';
|
|
8014
|
-
wrapper.style.zIndex = '
|
|
8057
|
+
wrapper.style.zIndex = (_a = position.zIndex) !== null && _a !== void 0 ? _a : 'var(--dv-overlay-z-index)';
|
|
8015
8058
|
wrapper.appendChild(element);
|
|
8016
8059
|
const anchorBox = this._element.getBoundingClientRect();
|
|
8017
8060
|
const offsetX = anchorBox.left;
|
|
@@ -8035,6 +8078,9 @@ class PopupService extends CompositeDisposable {
|
|
|
8035
8078
|
}
|
|
8036
8079
|
this.close();
|
|
8037
8080
|
}));
|
|
8081
|
+
requestAnimationFrame(() => {
|
|
8082
|
+
shiftAbsoluteElementIntoView(wrapper, this.root);
|
|
8083
|
+
});
|
|
8038
8084
|
}
|
|
8039
8085
|
close() {
|
|
8040
8086
|
if (this._active) {
|
|
@@ -9568,24 +9614,26 @@ class DockviewComponent extends BaseGrid {
|
|
|
9568
9614
|
selectedPopoutGroup.disposable.dispose();
|
|
9569
9615
|
}
|
|
9570
9616
|
}
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9617
|
+
if (from.api.location.type !== 'popout') {
|
|
9618
|
+
const referenceLocation = getGridLocation(to.element);
|
|
9619
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
9620
|
+
let size;
|
|
9621
|
+
switch (this.gridview.orientation) {
|
|
9622
|
+
case Orientation.VERTICAL:
|
|
9623
|
+
size =
|
|
9624
|
+
referenceLocation.length % 2 == 0
|
|
9625
|
+
? from.api.width
|
|
9626
|
+
: from.api.height;
|
|
9627
|
+
break;
|
|
9628
|
+
case Orientation.HORIZONTAL:
|
|
9629
|
+
size =
|
|
9630
|
+
referenceLocation.length % 2 == 0
|
|
9631
|
+
? from.api.height
|
|
9632
|
+
: from.api.width;
|
|
9633
|
+
break;
|
|
9634
|
+
}
|
|
9635
|
+
this.gridview.addView(from, size, dropLocation);
|
|
9587
9636
|
}
|
|
9588
|
-
this.gridview.addView(from, size, dropLocation);
|
|
9589
9637
|
}
|
|
9590
9638
|
from.panels.forEach((panel) => {
|
|
9591
9639
|
this._onDidMovePanel.fire({ panel, from });
|