dockview-react 3.0.2 → 3.1.1
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 +47 -48
- 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 +46 -47
- package/dist/dockview-react.amd.noStyle.js.map +1 -1
- package/dist/dockview-react.cjs.js +47 -48
- package/dist/dockview-react.cjs.js.map +1 -1
- package/dist/dockview-react.esm.js +47 -48
- 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 +47 -48
- 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 +46 -47
- package/dist/dockview-react.noStyle.js.map +1 -1
- package/dist/styles/dockview.css +2 -2
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-react
|
|
3
|
-
* @version 3.
|
|
3
|
+
* @version 3.1.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -4746,8 +4746,8 @@
|
|
|
4746
4746
|
this.accessor = accessor;
|
|
4747
4747
|
this.group = group;
|
|
4748
4748
|
this.content = undefined;
|
|
4749
|
-
this.
|
|
4750
|
-
this.
|
|
4749
|
+
this._onPointDown = new Emitter();
|
|
4750
|
+
this.onPointerDown = this._onPointDown.event;
|
|
4751
4751
|
this._onDropped = new Emitter();
|
|
4752
4752
|
this.onDrop = this._onDropped.event;
|
|
4753
4753
|
this._onDragStart = new Emitter();
|
|
@@ -4777,13 +4777,10 @@
|
|
|
4777
4777
|
},
|
|
4778
4778
|
});
|
|
4779
4779
|
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
4780
|
-
this.addDisposables(this.
|
|
4780
|
+
this.addDisposables(this._onPointDown, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
4781
4781
|
this._onDragStart.fire(event);
|
|
4782
4782
|
}), dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
|
|
4783
|
-
|
|
4784
|
-
return;
|
|
4785
|
-
}
|
|
4786
|
-
this._onChanged.fire(event);
|
|
4783
|
+
this._onPointDown.fire(event);
|
|
4787
4784
|
}), this.dropTarget.onDrop((event) => {
|
|
4788
4785
|
this._onDropped.fire(event);
|
|
4789
4786
|
}), this.dropTarget);
|
|
@@ -5061,6 +5058,9 @@
|
|
|
5061
5058
|
delete(id) {
|
|
5062
5059
|
const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
|
|
5063
5060
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
5061
|
+
if (!tabToRemove) {
|
|
5062
|
+
throw new Error(`dockview: Tab not found`);
|
|
5063
|
+
}
|
|
5064
5064
|
const { value, disposable } = tabToRemove;
|
|
5065
5065
|
disposable.dispose();
|
|
5066
5066
|
value.dispose();
|
|
@@ -5081,7 +5081,10 @@
|
|
|
5081
5081
|
tab.setContent(panel.view.tab);
|
|
5082
5082
|
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
5083
5083
|
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
5084
|
-
}), tab.
|
|
5084
|
+
}), tab.onPointerDown((event) => {
|
|
5085
|
+
if (event.defaultPrevented) {
|
|
5086
|
+
return;
|
|
5087
|
+
}
|
|
5085
5088
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
5086
5089
|
const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&
|
|
5087
5090
|
this.size === 1;
|
|
@@ -5099,12 +5102,12 @@
|
|
|
5099
5102
|
});
|
|
5100
5103
|
return;
|
|
5101
5104
|
}
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5105
|
+
switch (event.button) {
|
|
5106
|
+
case 0: // left click or touch
|
|
5107
|
+
if (this.group.activePanel !== panel) {
|
|
5108
|
+
this.group.model.openPanel(panel);
|
|
5109
|
+
}
|
|
5110
|
+
break;
|
|
5108
5111
|
}
|
|
5109
5112
|
}), tab.onDrop((event) => {
|
|
5110
5113
|
this._onDrop.fire({
|
|
@@ -6054,12 +6057,11 @@
|
|
|
6054
6057
|
constructor(id, accessor) {
|
|
6055
6058
|
super(id, '__dockviewgroup__');
|
|
6056
6059
|
this.accessor = accessor;
|
|
6057
|
-
this._mutableDisposable = new MutableDisposable();
|
|
6058
6060
|
this._onDidLocationChange = new Emitter();
|
|
6059
6061
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
6060
6062
|
this._onDidActivePanelChange = new Emitter();
|
|
6061
6063
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
6062
|
-
this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange
|
|
6064
|
+
this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange);
|
|
6063
6065
|
}
|
|
6064
6066
|
close() {
|
|
6065
6067
|
if (!this._group) {
|
|
@@ -6117,20 +6119,7 @@
|
|
|
6117
6119
|
}
|
|
6118
6120
|
}
|
|
6119
6121
|
initialize(group) {
|
|
6120
|
-
/**
|
|
6121
|
-
* TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
|
|
6122
|
-
*
|
|
6123
|
-
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
|
6124
|
-
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
|
6125
|
-
* finished ensuring the `model` is defined.
|
|
6126
|
-
*/
|
|
6127
6122
|
this._group = group;
|
|
6128
|
-
queueMicrotask(() => {
|
|
6129
|
-
this._mutableDisposable.value =
|
|
6130
|
-
this._group.model.onDidActivePanelChange((event) => {
|
|
6131
|
-
this._onDidActivePanelChange.fire(event);
|
|
6132
|
-
});
|
|
6133
|
-
});
|
|
6134
6123
|
}
|
|
6135
6124
|
}
|
|
6136
6125
|
|
|
@@ -6200,6 +6189,9 @@
|
|
|
6200
6189
|
}, new DockviewGroupPanelApiImpl(id, accessor));
|
|
6201
6190
|
this.api.initialize(this); // cannot use 'this' after after 'super' call
|
|
6202
6191
|
this._model = new DockviewGroupPanelModel(this.element, accessor, id, options, this);
|
|
6192
|
+
this.addDisposables(this.model.onDidActivePanelChange((event) => {
|
|
6193
|
+
this.api._onDidActivePanelChange.fire(event);
|
|
6194
|
+
}));
|
|
6203
6195
|
}
|
|
6204
6196
|
focus() {
|
|
6205
6197
|
if (!this.api.isActive) {
|
|
@@ -6547,9 +6539,6 @@
|
|
|
6547
6539
|
this.action.appendChild(createCloseButton());
|
|
6548
6540
|
this._element.appendChild(this._content);
|
|
6549
6541
|
this._element.appendChild(this.action);
|
|
6550
|
-
this.addDisposables(addDisposableListener(this.action, 'pointerdown', (ev) => {
|
|
6551
|
-
ev.preventDefault();
|
|
6552
|
-
}));
|
|
6553
6542
|
this.render();
|
|
6554
6543
|
}
|
|
6555
6544
|
init(params) {
|
|
@@ -7831,6 +7820,9 @@
|
|
|
7831
7820
|
addDisposableWindowListener(_window.window, 'resize', () => {
|
|
7832
7821
|
group.layout(_window.window.innerWidth, _window.window.innerHeight);
|
|
7833
7822
|
}), overlayRenderContainer, exports.DockviewDisposable.from(() => {
|
|
7823
|
+
if (this.isDisposed) {
|
|
7824
|
+
return; // cleanup may run after instance is disposed
|
|
7825
|
+
}
|
|
7834
7826
|
if (isGroupAddedToDom &&
|
|
7835
7827
|
this.getPanel(referenceGroup.id)) {
|
|
7836
7828
|
this.movingLock(() => moveGroupWithoutDestroying({
|
|
@@ -10530,8 +10522,9 @@
|
|
|
10530
10522
|
return title;
|
|
10531
10523
|
}
|
|
10532
10524
|
const DockviewDefaultTab = (_a) => {
|
|
10533
|
-
var { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride } = _a, rest = __rest(_a, ["api", "containerApi", "params", "hideClose", "closeActionOverride"]);
|
|
10525
|
+
var { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride, onPointerDown, onPointerUp, onPointerLeave } = _a, rest = __rest(_a, ["api", "containerApi", "params", "hideClose", "closeActionOverride", "onPointerDown", "onPointerUp", "onPointerLeave"]);
|
|
10534
10526
|
const title = useTitle(api);
|
|
10527
|
+
const isMiddleMouseButton = React.useRef(false);
|
|
10535
10528
|
const onClose = React.useCallback((event) => {
|
|
10536
10529
|
event.preventDefault();
|
|
10537
10530
|
if (closeActionOverride) {
|
|
@@ -10541,21 +10534,27 @@
|
|
|
10541
10534
|
api.close();
|
|
10542
10535
|
}
|
|
10543
10536
|
}, [api, closeActionOverride]);
|
|
10544
|
-
const
|
|
10545
|
-
|
|
10537
|
+
const onBtnPointerDown = React.useCallback((event) => {
|
|
10538
|
+
event.preventDefault();
|
|
10546
10539
|
}, []);
|
|
10547
|
-
const
|
|
10548
|
-
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
if (
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10540
|
+
const _onPointerDown = React.useCallback((event) => {
|
|
10541
|
+
isMiddleMouseButton.current = event.button === 1;
|
|
10542
|
+
onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown(event);
|
|
10543
|
+
}, [onPointerDown]);
|
|
10544
|
+
const _onPointerUp = React.useCallback((event) => {
|
|
10545
|
+
if (isMiddleMouseButton && event.button === 1 && !hideClose) {
|
|
10546
|
+
isMiddleMouseButton.current = false;
|
|
10547
|
+
onClose(event);
|
|
10548
|
+
}
|
|
10549
|
+
onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp(event);
|
|
10550
|
+
}, [onPointerUp, onClose, hideClose]);
|
|
10551
|
+
const _onPointerLeave = React.useCallback((event) => {
|
|
10552
|
+
isMiddleMouseButton.current = false;
|
|
10553
|
+
onPointerLeave === null || onPointerLeave === void 0 ? void 0 : onPointerLeave(event);
|
|
10554
|
+
}, [onPointerLeave]);
|
|
10555
|
+
return (React.createElement("div", Object.assign({ "data-testid": "dockview-dv-default-tab" }, rest, { onPointerDown: _onPointerDown, onPointerUp: _onPointerUp, onPointerLeave: _onPointerLeave, className: "dv-default-tab" }),
|
|
10557
10556
|
React.createElement("span", { className: "dv-default-tab-content" }, title),
|
|
10558
|
-
!hideClose && (React.createElement("div", { className: "dv-default-tab-action", onPointerDown:
|
|
10557
|
+
!hideClose && (React.createElement("div", { className: "dv-default-tab-action", onPointerDown: onBtnPointerDown, onClick: onClose },
|
|
10559
10558
|
React.createElement(CloseButton, null)))));
|
|
10560
10559
|
};
|
|
10561
10560
|
|