dockview 1.7.4 → 1.7.6
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.amd.js +65 -50
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.noStyle.js +65 -50
- package/dist/dockview.cjs.js +65 -50
- package/dist/dockview.esm.js +65 -50
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.js +65 -50
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.noStyle.js +65 -50
- package/package.json +3 -3
package/dist/dockview.amd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.7.
|
|
3
|
+
* @version 1.7.6
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -247,7 +247,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
247
247
|
element.addEventListener(type, listener, options);
|
|
248
248
|
return {
|
|
249
249
|
dispose: () => {
|
|
250
|
-
element.removeEventListener(type, listener);
|
|
250
|
+
element.removeEventListener(type, listener, options);
|
|
251
251
|
},
|
|
252
252
|
};
|
|
253
253
|
}
|
|
@@ -255,7 +255,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
255
255
|
element.addEventListener(type, listener, options);
|
|
256
256
|
return {
|
|
257
257
|
dispose: () => {
|
|
258
|
-
element.removeEventListener(type, listener);
|
|
258
|
+
element.removeEventListener(type, listener, options);
|
|
259
259
|
},
|
|
260
260
|
};
|
|
261
261
|
}
|
|
@@ -940,7 +940,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
940
940
|
//add sash
|
|
941
941
|
const sash = document.createElement('div');
|
|
942
942
|
sash.className = 'sash';
|
|
943
|
-
const
|
|
943
|
+
const onPointerStart = (event) => {
|
|
944
944
|
for (const item of this.viewItems) {
|
|
945
945
|
item.enabled = false;
|
|
946
946
|
}
|
|
@@ -999,11 +999,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
999
999
|
size: snappedViewItem.size,
|
|
1000
1000
|
};
|
|
1001
1001
|
}
|
|
1002
|
-
|
|
1003
|
-
const mousemove = (mousemoveEvent) => {
|
|
1002
|
+
const onPointerMove = (event) => {
|
|
1004
1003
|
const current = this._orientation === exports.Orientation.HORIZONTAL
|
|
1005
|
-
?
|
|
1006
|
-
:
|
|
1004
|
+
? event.clientX
|
|
1005
|
+
: event.clientY;
|
|
1007
1006
|
const delta = current - start;
|
|
1008
1007
|
this.resize(sashIndex, delta, sizes, undefined, undefined, minDelta, maxDelta, snapBefore, snapAfter);
|
|
1009
1008
|
this.distributeEmptySpace();
|
|
@@ -1017,20 +1016,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
1017
1016
|
iframe.style.pointerEvents = 'auto';
|
|
1018
1017
|
}
|
|
1019
1018
|
this.saveProportions();
|
|
1020
|
-
document.removeEventListener('
|
|
1021
|
-
document.removeEventListener('
|
|
1022
|
-
document.removeEventListener('
|
|
1019
|
+
document.removeEventListener('pointermove', onPointerMove);
|
|
1020
|
+
document.removeEventListener('pointerup', end);
|
|
1021
|
+
document.removeEventListener('pointercancel', end);
|
|
1023
1022
|
this._onDidSashEnd.fire(undefined);
|
|
1024
1023
|
};
|
|
1025
|
-
document.addEventListener('
|
|
1026
|
-
document.addEventListener('
|
|
1027
|
-
document.addEventListener('
|
|
1024
|
+
document.addEventListener('pointermove', onPointerMove);
|
|
1025
|
+
document.addEventListener('pointerup', end);
|
|
1026
|
+
document.addEventListener('pointercancel', end);
|
|
1028
1027
|
};
|
|
1029
|
-
sash.addEventListener('
|
|
1028
|
+
sash.addEventListener('pointerdown', onPointerStart);
|
|
1030
1029
|
const sashItem = {
|
|
1031
1030
|
container: sash,
|
|
1032
1031
|
disposable: () => {
|
|
1033
|
-
sash.removeEventListener('
|
|
1032
|
+
sash.removeEventListener('pointerdown', onPointerStart);
|
|
1034
1033
|
this.sashContainer.removeChild(sash);
|
|
1035
1034
|
},
|
|
1036
1035
|
};
|
|
@@ -2123,58 +2122,70 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2123
2122
|
if (!(parent instanceof BranchNode)) {
|
|
2124
2123
|
throw new Error('Invalid location');
|
|
2125
2124
|
}
|
|
2126
|
-
const
|
|
2127
|
-
if (!(
|
|
2125
|
+
const nodeToRemove = parent.children[index];
|
|
2126
|
+
if (!(nodeToRemove instanceof LeafNode)) {
|
|
2128
2127
|
throw new Error('Invalid location');
|
|
2129
2128
|
}
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
if (parent.children.length === 0) {
|
|
2135
|
-
return view;
|
|
2136
|
-
}
|
|
2137
|
-
if (parent.children.length > 1) {
|
|
2138
|
-
return view;
|
|
2129
|
+
parent.removeChild(index, sizing);
|
|
2130
|
+
nodeToRemove.dispose();
|
|
2131
|
+
if (parent.children.length !== 1) {
|
|
2132
|
+
return nodeToRemove.view;
|
|
2139
2133
|
}
|
|
2134
|
+
// if the parent has only one child and we know the parent is a BranchNode we can make the tree
|
|
2135
|
+
// more efficiently spaced by replacing the parent BranchNode with the child.
|
|
2136
|
+
// if that child is a LeafNode then we simply replace the BranchNode with the child otherwise if the child
|
|
2137
|
+
// is a BranchNode too we should spread it's children into the grandparent.
|
|
2138
|
+
// refer to the remaining child as the sibling
|
|
2140
2139
|
const sibling = parent.children[0];
|
|
2141
2140
|
if (pathToParent.length === 0) {
|
|
2142
|
-
// parent is root
|
|
2141
|
+
// if the parent is root
|
|
2143
2142
|
if (sibling instanceof LeafNode) {
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2143
|
+
// if the sibling is a leaf node no action is required
|
|
2144
|
+
return nodeToRemove.view;
|
|
2145
|
+
}
|
|
2146
|
+
// otherwise the sibling is a branch node. since the parent is the root and the root has only one child
|
|
2147
|
+
// which is a branch node we can just set this branch node to be the new root node
|
|
2148
|
+
// for good housekeeping we'll removing the sibling from it's existing tree
|
|
2149
|
+
parent.removeChild(0, sizing);
|
|
2150
|
+
// and set that sibling node to be root
|
|
2149
2151
|
this.root = sibling;
|
|
2150
|
-
return view;
|
|
2152
|
+
return nodeToRemove.view;
|
|
2151
2153
|
}
|
|
2154
|
+
// otherwise the parent is apart of a large sub-tree
|
|
2152
2155
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
|
2153
2156
|
const [parentIndex, ...__] = [...rest].reverse();
|
|
2154
2157
|
const isSiblingVisible = parent.isChildVisible(0);
|
|
2155
|
-
|
|
2156
|
-
|
|
2158
|
+
// either way we need to remove the sibling from it's existing tree
|
|
2159
|
+
parent.removeChild(0, sizing);
|
|
2160
|
+
// note the sizes of all of the grandparents children
|
|
2157
2161
|
const sizes = grandParent.children.map((_size, i) => grandParent.getChildSize(i));
|
|
2158
|
-
|
|
2159
|
-
|
|
2162
|
+
// remove the parent from the grandparent since we are moving the sibling to take the parents place
|
|
2163
|
+
// this parent is no longer used and can be disposed of
|
|
2164
|
+
grandParent.removeChild(parentIndex, sizing).dispose();
|
|
2160
2165
|
if (sibling instanceof BranchNode) {
|
|
2166
|
+
// replace the parent with the siblings children
|
|
2161
2167
|
sizes.splice(parentIndex, 1, ...sibling.children.map((c) => c.size));
|
|
2168
|
+
// and add those siblings to the grandparent
|
|
2162
2169
|
for (let i = 0; i < sibling.children.length; i++) {
|
|
2163
2170
|
const child = sibling.children[i];
|
|
2164
2171
|
grandParent.addChild(child, child.size, parentIndex + i);
|
|
2165
2172
|
}
|
|
2166
2173
|
}
|
|
2167
2174
|
else {
|
|
2175
|
+
// otherwise create a new leaf node and add that to the grandparent
|
|
2168
2176
|
const newSibling = new LeafNode(sibling.view, orthogonal(sibling.orientation), sibling.size);
|
|
2169
2177
|
const siblingSizing = isSiblingVisible
|
|
2170
2178
|
? sibling.orthogonalSize
|
|
2171
2179
|
: exports.Sizing.Invisible(sibling.orthogonalSize);
|
|
2172
2180
|
grandParent.addChild(newSibling, siblingSizing, parentIndex);
|
|
2173
2181
|
}
|
|
2182
|
+
// the containing node of the sibling is no longer required and can be disposed of
|
|
2183
|
+
sibling.dispose();
|
|
2184
|
+
// resize everything
|
|
2174
2185
|
for (let i = 0; i < sizes.length; i++) {
|
|
2175
2186
|
grandParent.resizeChild(i, sizes[i]);
|
|
2176
2187
|
}
|
|
2177
|
-
return view;
|
|
2188
|
+
return nodeToRemove.view;
|
|
2178
2189
|
}
|
|
2179
2190
|
layout(width, height) {
|
|
2180
2191
|
const [size, orthogonalSize] = this.root.orientation === exports.Orientation.HORIZONTAL
|
|
@@ -2887,25 +2898,32 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2887
2898
|
constructor(el) {
|
|
2888
2899
|
super();
|
|
2889
2900
|
this.el = el;
|
|
2890
|
-
this.
|
|
2901
|
+
this.dataDisposable = new MutableDisposable();
|
|
2902
|
+
this.pointerEventsDisposable = new MutableDisposable();
|
|
2891
2903
|
this._onDragStart = new Emitter();
|
|
2892
2904
|
this.onDragStart = this._onDragStart.event;
|
|
2893
|
-
this.
|
|
2894
|
-
this.addDisposables(this._onDragStart);
|
|
2905
|
+
this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
|
|
2895
2906
|
this.configure();
|
|
2896
2907
|
}
|
|
2897
2908
|
configure() {
|
|
2898
2909
|
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2899
|
-
|
|
2910
|
+
const iframes = [
|
|
2900
2911
|
...getElementsByTagName('iframe'),
|
|
2901
2912
|
...getElementsByTagName('webview'),
|
|
2902
2913
|
];
|
|
2903
|
-
|
|
2914
|
+
this.pointerEventsDisposable.value = {
|
|
2915
|
+
dispose: () => {
|
|
2916
|
+
for (const iframe of iframes) {
|
|
2917
|
+
iframe.style.pointerEvents = 'auto';
|
|
2918
|
+
}
|
|
2919
|
+
},
|
|
2920
|
+
};
|
|
2921
|
+
for (const iframe of iframes) {
|
|
2904
2922
|
iframe.style.pointerEvents = 'none';
|
|
2905
2923
|
}
|
|
2906
2924
|
this.el.classList.add('dv-dragged');
|
|
2907
2925
|
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
2908
|
-
this.
|
|
2926
|
+
this.dataDisposable.value = this.getData(event.dataTransfer);
|
|
2909
2927
|
if (event.dataTransfer) {
|
|
2910
2928
|
event.dataTransfer.effectAllowed = 'move';
|
|
2911
2929
|
/**
|
|
@@ -2920,11 +2938,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2920
2938
|
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
2921
2939
|
}
|
|
2922
2940
|
}), addDisposableListener(this.el, 'dragend', () => {
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
}
|
|
2926
|
-
this.iframes = [];
|
|
2927
|
-
this.disposable.dispose();
|
|
2941
|
+
this.pointerEventsDisposable.dispose();
|
|
2942
|
+
this.dataDisposable.dispose();
|
|
2928
2943
|
}));
|
|
2929
2944
|
}
|
|
2930
2945
|
}
|