dockview-core 4.2.1 → 4.2.4
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/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 +42 -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/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 +38 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 4.2.
|
|
3
|
+
* @version 4.2.4
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -668,6 +668,44 @@ function onDidWindowResizeEnd(element, cb) {
|
|
|
668
668
|
}));
|
|
669
669
|
return disposable;
|
|
670
670
|
}
|
|
671
|
+
function shiftAbsoluteElementIntoView(element, root, options = { buffer: 10 }) {
|
|
672
|
+
const buffer = options.buffer;
|
|
673
|
+
const rect = element.getBoundingClientRect();
|
|
674
|
+
const rootRect = element.getBoundingClientRect();
|
|
675
|
+
const viewportWidth = root.clientWidth;
|
|
676
|
+
const viewportHeight = root.clientHeight;
|
|
677
|
+
let translateX = 0;
|
|
678
|
+
let translateY = 0;
|
|
679
|
+
const left = rect.left - rootRect.left;
|
|
680
|
+
const top = rect.top - rootRect.top;
|
|
681
|
+
const bottom = rect.bottom - rootRect.bottom;
|
|
682
|
+
const right = rect.right - rootRect.right;
|
|
683
|
+
// Check horizontal overflow
|
|
684
|
+
if (left < buffer) {
|
|
685
|
+
translateX = buffer - left;
|
|
686
|
+
}
|
|
687
|
+
else if (right > viewportWidth - buffer) {
|
|
688
|
+
translateX = viewportWidth - right - buffer;
|
|
689
|
+
}
|
|
690
|
+
// Check vertical overflow
|
|
691
|
+
if (top < buffer) {
|
|
692
|
+
translateY = buffer - top;
|
|
693
|
+
}
|
|
694
|
+
else if (bottom > viewportHeight - buffer) {
|
|
695
|
+
translateY = viewportHeight - bottom - buffer;
|
|
696
|
+
}
|
|
697
|
+
// Apply the translation if needed
|
|
698
|
+
if (translateX !== 0 || translateY !== 0) {
|
|
699
|
+
element.style.transform = `translate(${translateX}px, ${translateY}px)`;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
function findRelativeZIndexParent(el) {
|
|
703
|
+
let tmp = el;
|
|
704
|
+
while (tmp && (tmp.style.zIndex === 'auto' || tmp.style.zIndex === '')) {
|
|
705
|
+
tmp = tmp.parentElement;
|
|
706
|
+
}
|
|
707
|
+
return tmp;
|
|
708
|
+
}
|
|
671
709
|
|
|
672
710
|
function tail(arr) {
|
|
673
711
|
if (arr.length === 0) {
|
|
@@ -5635,7 +5673,7 @@ class TabsContainer extends CompositeDisposable {
|
|
|
5635
5673
|
toggleClass(wrapper, 'dv-tab', true);
|
|
5636
5674
|
toggleClass(wrapper, 'dv-active-tab', panelObject.api.isActive);
|
|
5637
5675
|
toggleClass(wrapper, 'dv-inactive-tab', !panelObject.api.isActive);
|
|
5638
|
-
wrapper.addEventListener('
|
|
5676
|
+
wrapper.addEventListener('pointerdown', () => {
|
|
5639
5677
|
this.accessor.popupService.close();
|
|
5640
5678
|
tab.element.scrollIntoView();
|
|
5641
5679
|
tab.panel.api.setActive();
|
|
@@ -5643,9 +5681,13 @@ class TabsContainer extends CompositeDisposable {
|
|
|
5643
5681
|
wrapper.appendChild(child);
|
|
5644
5682
|
el.appendChild(wrapper);
|
|
5645
5683
|
}
|
|
5684
|
+
const relativeParent = findRelativeZIndexParent(root);
|
|
5646
5685
|
this.accessor.popupService.openPopover(el, {
|
|
5647
5686
|
x: event.clientX,
|
|
5648
5687
|
y: event.clientY,
|
|
5688
|
+
zIndex: (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex)
|
|
5689
|
+
? `calc(${relativeParent.style.zIndex} * 2)`
|
|
5690
|
+
: undefined,
|
|
5649
5691
|
});
|
|
5650
5692
|
}));
|
|
5651
5693
|
}
|
|
@@ -8010,10 +8052,11 @@ class PopupService extends CompositeDisposable {
|
|
|
8010
8052
|
}), this._activeDisposable);
|
|
8011
8053
|
}
|
|
8012
8054
|
openPopover(element, position) {
|
|
8055
|
+
var _a;
|
|
8013
8056
|
this.close();
|
|
8014
8057
|
const wrapper = document.createElement('div');
|
|
8015
8058
|
wrapper.style.position = 'absolute';
|
|
8016
|
-
wrapper.style.zIndex = '
|
|
8059
|
+
wrapper.style.zIndex = (_a = position.zIndex) !== null && _a !== void 0 ? _a : 'var(--dv-overlay-z-index)';
|
|
8017
8060
|
wrapper.appendChild(element);
|
|
8018
8061
|
const anchorBox = this._element.getBoundingClientRect();
|
|
8019
8062
|
const offsetX = anchorBox.left;
|
|
@@ -8037,6 +8080,9 @@ class PopupService extends CompositeDisposable {
|
|
|
8037
8080
|
}
|
|
8038
8081
|
this.close();
|
|
8039
8082
|
}));
|
|
8083
|
+
requestAnimationFrame(() => {
|
|
8084
|
+
shiftAbsoluteElementIntoView(wrapper, this.root);
|
|
8085
|
+
});
|
|
8040
8086
|
}
|
|
8041
8087
|
close() {
|
|
8042
8088
|
if (this._active) {
|
|
@@ -9570,24 +9616,26 @@ class DockviewComponent extends BaseGrid {
|
|
|
9570
9616
|
selectedPopoutGroup.disposable.dispose();
|
|
9571
9617
|
}
|
|
9572
9618
|
}
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9619
|
+
if (from.api.location.type !== 'popout') {
|
|
9620
|
+
const referenceLocation = getGridLocation(to.element);
|
|
9621
|
+
const dropLocation = getRelativeLocation(this.gridview.orientation, referenceLocation, target);
|
|
9622
|
+
let size;
|
|
9623
|
+
switch (this.gridview.orientation) {
|
|
9624
|
+
case exports.Orientation.VERTICAL:
|
|
9625
|
+
size =
|
|
9626
|
+
referenceLocation.length % 2 == 0
|
|
9627
|
+
? from.api.width
|
|
9628
|
+
: from.api.height;
|
|
9629
|
+
break;
|
|
9630
|
+
case exports.Orientation.HORIZONTAL:
|
|
9631
|
+
size =
|
|
9632
|
+
referenceLocation.length % 2 == 0
|
|
9633
|
+
? from.api.height
|
|
9634
|
+
: from.api.width;
|
|
9635
|
+
break;
|
|
9636
|
+
}
|
|
9637
|
+
this.gridview.addView(from, size, dropLocation);
|
|
9589
9638
|
}
|
|
9590
|
-
this.gridview.addView(from, size, dropLocation);
|
|
9591
9639
|
}
|
|
9592
9640
|
from.panels.forEach((panel) => {
|
|
9593
9641
|
this._onDidMovePanel.fire({ panel, from });
|