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/cjs/dnd/ghost.js
CHANGED
|
@@ -6,6 +6,8 @@ function addGhostImage(dataTransfer, ghostElement, options) {
|
|
|
6
6
|
var _a, _b;
|
|
7
7
|
// class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
|
|
8
8
|
(0, dom_1.addClasses)(ghostElement, 'dv-dragged');
|
|
9
|
+
// move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
|
|
10
|
+
ghostElement.style.top = '-9999px';
|
|
9
11
|
document.body.appendChild(ghostElement);
|
|
10
12
|
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);
|
|
11
13
|
setTimeout(function () {
|
|
@@ -16,6 +16,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.PopupService = void 0;
|
|
19
|
+
var dom_1 = require("../../dom");
|
|
19
20
|
var events_1 = require("../../events");
|
|
20
21
|
var lifecycle_1 = require("../../lifecycle");
|
|
21
22
|
var PopupService = /** @class */ (function (_super) {
|
|
@@ -36,10 +37,11 @@ var PopupService = /** @class */ (function (_super) {
|
|
|
36
37
|
}
|
|
37
38
|
PopupService.prototype.openPopover = function (element, position) {
|
|
38
39
|
var _this = this;
|
|
40
|
+
var _a;
|
|
39
41
|
this.close();
|
|
40
42
|
var wrapper = document.createElement('div');
|
|
41
43
|
wrapper.style.position = 'absolute';
|
|
42
|
-
wrapper.style.zIndex = '
|
|
44
|
+
wrapper.style.zIndex = (_a = position.zIndex) !== null && _a !== void 0 ? _a : 'var(--dv-overlay-z-index)';
|
|
43
45
|
wrapper.appendChild(element);
|
|
44
46
|
var anchorBox = this._element.getBoundingClientRect();
|
|
45
47
|
var offsetX = anchorBox.left;
|
|
@@ -63,6 +65,9 @@ var PopupService = /** @class */ (function (_super) {
|
|
|
63
65
|
}
|
|
64
66
|
_this.close();
|
|
65
67
|
}));
|
|
68
|
+
requestAnimationFrame(function () {
|
|
69
|
+
(0, dom_1.shiftAbsoluteElementIntoView)(wrapper, _this.root);
|
|
70
|
+
});
|
|
66
71
|
};
|
|
67
72
|
PopupService.prototype.close = function () {
|
|
68
73
|
if (this._active) {
|
|
@@ -264,7 +264,7 @@ var TabsContainer = /** @class */ (function (_super) {
|
|
|
264
264
|
(0, dom_1.toggleClass)(wrapper, 'dv-tab', true);
|
|
265
265
|
(0, dom_1.toggleClass)(wrapper, 'dv-active-tab', panelObject.api.isActive);
|
|
266
266
|
(0, dom_1.toggleClass)(wrapper, 'dv-inactive-tab', !panelObject.api.isActive);
|
|
267
|
-
wrapper.addEventListener('
|
|
267
|
+
wrapper.addEventListener('pointerdown', function () {
|
|
268
268
|
_this.accessor.popupService.close();
|
|
269
269
|
tab.element.scrollIntoView();
|
|
270
270
|
tab.panel.api.setActive();
|
|
@@ -287,9 +287,13 @@ var TabsContainer = /** @class */ (function (_super) {
|
|
|
287
287
|
}
|
|
288
288
|
finally { if (e_1) throw e_1.error; }
|
|
289
289
|
}
|
|
290
|
+
var relativeParent = (0, dom_1.findRelativeZIndexParent)(root);
|
|
290
291
|
_this.accessor.popupService.openPopover(el, {
|
|
291
292
|
x: event.clientX,
|
|
292
293
|
y: event.clientY,
|
|
294
|
+
zIndex: (relativeParent === null || relativeParent === void 0 ? void 0 : relativeParent.style.zIndex)
|
|
295
|
+
? "calc(".concat(relativeParent.style.zIndex, " * 2)")
|
|
296
|
+
: undefined,
|
|
293
297
|
});
|
|
294
298
|
}));
|
|
295
299
|
};
|
|
@@ -1782,24 +1782,26 @@ var DockviewComponent = /** @class */ (function (_super) {
|
|
|
1782
1782
|
selectedPopoutGroup.disposable.dispose();
|
|
1783
1783
|
}
|
|
1784
1784
|
}
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1785
|
+
if (from.api.location.type !== 'popout') {
|
|
1786
|
+
var referenceLocation = (0, gridview_1.getGridLocation)(to.element);
|
|
1787
|
+
var dropLocation = (0, gridview_1.getRelativeLocation)(this.gridview.orientation, referenceLocation, target);
|
|
1788
|
+
var size = void 0;
|
|
1789
|
+
switch (this.gridview.orientation) {
|
|
1790
|
+
case splitview_1.Orientation.VERTICAL:
|
|
1791
|
+
size =
|
|
1792
|
+
referenceLocation.length % 2 == 0
|
|
1793
|
+
? from.api.width
|
|
1794
|
+
: from.api.height;
|
|
1795
|
+
break;
|
|
1796
|
+
case splitview_1.Orientation.HORIZONTAL:
|
|
1797
|
+
size =
|
|
1798
|
+
referenceLocation.length % 2 == 0
|
|
1799
|
+
? from.api.height
|
|
1800
|
+
: from.api.width;
|
|
1801
|
+
break;
|
|
1802
|
+
}
|
|
1803
|
+
this.gridview.addView(from, size, dropLocation);
|
|
1801
1804
|
}
|
|
1802
|
-
this.gridview.addView(from, size, dropLocation);
|
|
1803
1805
|
}
|
|
1804
1806
|
from.panels.forEach(function (panel) {
|
|
1805
1807
|
_this._onDidMovePanel.fire({ panel: panel, from: from });
|
package/dist/cjs/dom.d.ts
CHANGED
|
@@ -50,3 +50,7 @@ export declare class Classnames {
|
|
|
50
50
|
export declare function isChildEntirelyVisibleWithinParent(child: HTMLElement, parent: HTMLElement): boolean;
|
|
51
51
|
export declare function onDidWindowMoveEnd(window: Window): Emitter<void>;
|
|
52
52
|
export declare function onDidWindowResizeEnd(element: Window, cb: () => void): CompositeDisposable;
|
|
53
|
+
export declare function shiftAbsoluteElementIntoView(element: HTMLElement, root: HTMLElement, options?: {
|
|
54
|
+
buffer: number;
|
|
55
|
+
}): void;
|
|
56
|
+
export declare function findRelativeZIndexParent(el: HTMLElement): HTMLElement | null;
|
package/dist/cjs/dom.js
CHANGED
|
@@ -26,7 +26,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
26
26
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.onDidWindowResizeEnd = exports.onDidWindowMoveEnd = exports.isChildEntirelyVisibleWithinParent = exports.Classnames = exports.getDockviewTheme = exports.disableIframePointEvents = exports.addTestId = exports.isInDocument = exports.getDomNodePagePosition = exports.addStyles = exports.quasiDefaultPrevented = exports.quasiPreventDefault = exports.trackFocus = exports.getElementsByTagName = exports.isAncestor = exports.toggleClass = exports.addClasses = exports.removeClasses = exports.watchElementResize = exports.OverflowObserver = void 0;
|
|
29
|
+
exports.findRelativeZIndexParent = exports.shiftAbsoluteElementIntoView = exports.onDidWindowResizeEnd = exports.onDidWindowMoveEnd = exports.isChildEntirelyVisibleWithinParent = exports.Classnames = exports.getDockviewTheme = exports.disableIframePointEvents = exports.addTestId = exports.isInDocument = exports.getDomNodePagePosition = exports.addStyles = exports.quasiDefaultPrevented = exports.quasiPreventDefault = exports.trackFocus = exports.getElementsByTagName = exports.isAncestor = exports.toggleClass = exports.addClasses = exports.removeClasses = exports.watchElementResize = exports.OverflowObserver = void 0;
|
|
30
30
|
var events_1 = require("./events");
|
|
31
31
|
var lifecycle_1 = require("./lifecycle");
|
|
32
32
|
var OverflowObserver = /** @class */ (function (_super) {
|
|
@@ -478,3 +478,42 @@ function onDidWindowResizeEnd(element, cb) {
|
|
|
478
478
|
return disposable;
|
|
479
479
|
}
|
|
480
480
|
exports.onDidWindowResizeEnd = onDidWindowResizeEnd;
|
|
481
|
+
function shiftAbsoluteElementIntoView(element, root, options) {
|
|
482
|
+
if (options === void 0) { options = { buffer: 10 }; }
|
|
483
|
+
var buffer = options.buffer;
|
|
484
|
+
var rect = element.getBoundingClientRect();
|
|
485
|
+
var rootRect = root.getBoundingClientRect();
|
|
486
|
+
var translateX = 0;
|
|
487
|
+
var translateY = 0;
|
|
488
|
+
var left = rect.left - rootRect.left;
|
|
489
|
+
var top = rect.top - rootRect.top;
|
|
490
|
+
var bottom = rect.bottom - rootRect.bottom;
|
|
491
|
+
var right = rect.right - rootRect.right;
|
|
492
|
+
// Check horizontal overflow
|
|
493
|
+
if (left < buffer) {
|
|
494
|
+
translateX = buffer - left;
|
|
495
|
+
}
|
|
496
|
+
else if (right > buffer) {
|
|
497
|
+
translateX = -buffer - right;
|
|
498
|
+
}
|
|
499
|
+
// Check vertical overflow
|
|
500
|
+
if (top < buffer) {
|
|
501
|
+
translateY = buffer - top;
|
|
502
|
+
}
|
|
503
|
+
else if (bottom > buffer) {
|
|
504
|
+
translateY = -bottom - buffer;
|
|
505
|
+
}
|
|
506
|
+
// Apply the translation if needed
|
|
507
|
+
if (translateX !== 0 || translateY !== 0) {
|
|
508
|
+
element.style.transform = "translate(".concat(translateX, "px, ").concat(translateY, "px)");
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
exports.shiftAbsoluteElementIntoView = shiftAbsoluteElementIntoView;
|
|
512
|
+
function findRelativeZIndexParent(el) {
|
|
513
|
+
var tmp = el;
|
|
514
|
+
while (tmp && (tmp.style.zIndex === 'auto' || tmp.style.zIndex === '')) {
|
|
515
|
+
tmp = tmp.parentElement;
|
|
516
|
+
}
|
|
517
|
+
return tmp;
|
|
518
|
+
}
|
|
519
|
+
exports.findRelativeZIndexParent = findRelativeZIndexParent;
|
|
@@ -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
|
*/
|
|
@@ -668,6 +668,42 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
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 = root.getBoundingClientRect();
|
|
675
|
+
let translateX = 0;
|
|
676
|
+
let translateY = 0;
|
|
677
|
+
const left = rect.left - rootRect.left;
|
|
678
|
+
const top = rect.top - rootRect.top;
|
|
679
|
+
const bottom = rect.bottom - rootRect.bottom;
|
|
680
|
+
const right = rect.right - rootRect.right;
|
|
681
|
+
// Check horizontal overflow
|
|
682
|
+
if (left < buffer) {
|
|
683
|
+
translateX = buffer - left;
|
|
684
|
+
}
|
|
685
|
+
else if (right > buffer) {
|
|
686
|
+
translateX = -buffer - right;
|
|
687
|
+
}
|
|
688
|
+
// Check vertical overflow
|
|
689
|
+
if (top < buffer) {
|
|
690
|
+
translateY = buffer - top;
|
|
691
|
+
}
|
|
692
|
+
else if (bottom > buffer) {
|
|
693
|
+
translateY = -bottom - buffer;
|
|
694
|
+
}
|
|
695
|
+
// Apply the translation if needed
|
|
696
|
+
if (translateX !== 0 || translateY !== 0) {
|
|
697
|
+
element.style.transform = `translate(${translateX}px, ${translateY}px)`;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
function findRelativeZIndexParent(el) {
|
|
701
|
+
let tmp = el;
|
|
702
|
+
while (tmp && (tmp.style.zIndex === 'auto' || tmp.style.zIndex === '')) {
|
|
703
|
+
tmp = tmp.parentElement;
|
|
704
|
+
}
|
|
705
|
+
return tmp;
|
|
706
|
+
}
|
|
671
707
|
|
|
672
708
|
function tail(arr) {
|
|
673
709
|
if (arr.length === 0) {
|
|
@@ -4935,6 +4971,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
4935
4971
|
var _a, _b;
|
|
4936
4972
|
// class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
|
|
4937
4973
|
addClasses(ghostElement, 'dv-dragged');
|
|
4974
|
+
// move the element off-screen initially otherwise it may in some cases be rendered at (0,0) momentarily
|
|
4975
|
+
ghostElement.style.top = '-9999px';
|
|
4938
4976
|
document.body.appendChild(ghostElement);
|
|
4939
4977
|
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);
|
|
4940
4978
|
setTimeout(() => {
|
|
@@ -5635,7 +5673,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
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 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
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 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
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 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
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 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
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 });
|