dockview-core 4.7.0 → 4.7.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/cjs/dnd/abstractDragHandler.d.ts +3 -1
- package/dist/cjs/dnd/abstractDragHandler.js +6 -2
- package/dist/cjs/dnd/groupDragHandler.d.ts +1 -1
- package/dist/cjs/dnd/groupDragHandler.js +2 -2
- package/dist/cjs/dockview/components/tab/tab.d.ts +1 -0
- package/dist/cjs/dockview/components/tab/tab.js +6 -5
- package/dist/cjs/dockview/components/titlebar/voidContainer.d.ts +1 -0
- package/dist/cjs/dockview/components/titlebar/voidContainer.js +3 -2
- package/dist/cjs/dockview/dockviewComponent.js +3 -1
- package/dist/dockview-core.amd.js +21 -13
- 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 +21 -13
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +21 -13
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +21 -13
- 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 +21 -13
- 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 +21 -13
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/dnd/abstractDragHandler.d.ts +3 -1
- package/dist/esm/dnd/abstractDragHandler.js +6 -2
- package/dist/esm/dnd/groupDragHandler.d.ts +1 -1
- package/dist/esm/dnd/groupDragHandler.js +2 -2
- package/dist/esm/dockview/components/tab/tab.d.ts +1 -0
- package/dist/esm/dockview/components/tab/tab.js +6 -5
- package/dist/esm/dockview/components/titlebar/voidContainer.d.ts +1 -0
- package/dist/esm/dockview/components/titlebar/voidContainer.js +3 -2
- package/dist/esm/dockview/dockviewComponent.js +3 -1
- package/package.json +1 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { CompositeDisposable, IDisposable } from '../lifecycle';
|
|
2
2
|
export declare abstract class DragHandler extends CompositeDisposable {
|
|
3
3
|
protected readonly el: HTMLElement;
|
|
4
|
+
private disabled?;
|
|
4
5
|
private readonly dataDisposable;
|
|
5
6
|
private readonly pointerEventsDisposable;
|
|
6
7
|
private readonly _onDragStart;
|
|
7
8
|
readonly onDragStart: import("../events").Event<DragEvent>;
|
|
8
|
-
constructor(el: HTMLElement);
|
|
9
|
+
constructor(el: HTMLElement, disabled?: boolean | undefined);
|
|
10
|
+
setDisabled(disabled: boolean): void;
|
|
9
11
|
abstract getData(event: DragEvent): IDisposable;
|
|
10
12
|
protected isCancelled(_event: DragEvent): boolean;
|
|
11
13
|
private configure;
|
|
@@ -2,9 +2,10 @@ import { disableIframePointEvents } from '../dom';
|
|
|
2
2
|
import { addDisposableListener, Emitter } from '../events';
|
|
3
3
|
import { CompositeDisposable, MutableDisposable, } from '../lifecycle';
|
|
4
4
|
export class DragHandler extends CompositeDisposable {
|
|
5
|
-
constructor(el) {
|
|
5
|
+
constructor(el, disabled) {
|
|
6
6
|
super();
|
|
7
7
|
this.el = el;
|
|
8
|
+
this.disabled = disabled;
|
|
8
9
|
this.dataDisposable = new MutableDisposable();
|
|
9
10
|
this.pointerEventsDisposable = new MutableDisposable();
|
|
10
11
|
this._onDragStart = new Emitter();
|
|
@@ -12,12 +13,15 @@ export class DragHandler extends CompositeDisposable {
|
|
|
12
13
|
this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
|
|
13
14
|
this.configure();
|
|
14
15
|
}
|
|
16
|
+
setDisabled(disabled) {
|
|
17
|
+
this.disabled = disabled;
|
|
18
|
+
}
|
|
15
19
|
isCancelled(_event) {
|
|
16
20
|
return false;
|
|
17
21
|
}
|
|
18
22
|
configure() {
|
|
19
23
|
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
20
|
-
if (event.defaultPrevented || this.isCancelled(event)) {
|
|
24
|
+
if (event.defaultPrevented || this.isCancelled(event) || this.disabled) {
|
|
21
25
|
event.preventDefault();
|
|
22
26
|
return;
|
|
23
27
|
}
|
|
@@ -6,7 +6,7 @@ export declare class GroupDragHandler extends DragHandler {
|
|
|
6
6
|
private readonly accessor;
|
|
7
7
|
private readonly group;
|
|
8
8
|
private readonly panelTransfer;
|
|
9
|
-
constructor(element: HTMLElement, accessor: DockviewComponent, group: DockviewGroupPanel);
|
|
9
|
+
constructor(element: HTMLElement, accessor: DockviewComponent, group: DockviewGroupPanel, disabled?: boolean);
|
|
10
10
|
isCancelled(_event: DragEvent): boolean;
|
|
11
11
|
getData(dragEvent: DragEvent): IDisposable;
|
|
12
12
|
}
|
|
@@ -4,8 +4,8 @@ import { DragHandler } from './abstractDragHandler';
|
|
|
4
4
|
import { LocalSelectionTransfer, PanelTransfer } from './dataTransfer';
|
|
5
5
|
import { addGhostImage } from './ghost';
|
|
6
6
|
export class GroupDragHandler extends DragHandler {
|
|
7
|
-
constructor(element, accessor, group) {
|
|
8
|
-
super(element);
|
|
7
|
+
constructor(element, accessor, group, disabled) {
|
|
8
|
+
super(element, disabled);
|
|
9
9
|
this.accessor = accessor;
|
|
10
10
|
this.group = group;
|
|
11
11
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
@@ -12,6 +12,7 @@ export declare class Tab extends CompositeDisposable {
|
|
|
12
12
|
private readonly _element;
|
|
13
13
|
private readonly dropTarget;
|
|
14
14
|
private content;
|
|
15
|
+
private readonly dragHandler;
|
|
15
16
|
private readonly _onPointDown;
|
|
16
17
|
readonly onPointerDown: Event<MouseEvent>;
|
|
17
18
|
private readonly _onDropped;
|
|
@@ -6,8 +6,8 @@ import { Droptarget, } from '../../../dnd/droptarget';
|
|
|
6
6
|
import { DragHandler } from '../../../dnd/abstractDragHandler';
|
|
7
7
|
import { addGhostImage } from '../../../dnd/ghost';
|
|
8
8
|
class TabDragHandler extends DragHandler {
|
|
9
|
-
constructor(element, accessor, group, panel) {
|
|
10
|
-
super(element);
|
|
9
|
+
constructor(element, accessor, group, panel, disabled) {
|
|
10
|
+
super(element, disabled);
|
|
11
11
|
this.accessor = accessor;
|
|
12
12
|
this.group = group;
|
|
13
13
|
this.panel = panel;
|
|
@@ -43,7 +43,7 @@ export class Tab extends CompositeDisposable {
|
|
|
43
43
|
this._element.tabIndex = 0;
|
|
44
44
|
this._element.draggable = !this.accessor.options.disableDnd;
|
|
45
45
|
toggleClass(this.element, 'dv-inactive-tab', true);
|
|
46
|
-
|
|
46
|
+
this.dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel, !!this.accessor.options.disableDnd);
|
|
47
47
|
this.dropTarget = new Droptarget(this._element, {
|
|
48
48
|
acceptedTargetZones: ['left', 'right'],
|
|
49
49
|
overlayModel: { activationSize: { value: 50, type: 'percentage' } },
|
|
@@ -60,7 +60,7 @@ export class Tab extends CompositeDisposable {
|
|
|
60
60
|
getOverrideTarget: () => { var _a; return (_a = group.model.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },
|
|
61
61
|
});
|
|
62
62
|
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
63
|
-
this.addDisposables(this._onPointDown, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
63
|
+
this.addDisposables(this._onPointDown, this._onDropped, this._onDragStart, this.dragHandler.onDragStart((event) => {
|
|
64
64
|
if (event.dataTransfer) {
|
|
65
65
|
const style = getComputedStyle(this.element);
|
|
66
66
|
const newNode = this.element.cloneNode(true);
|
|
@@ -72,7 +72,7 @@ export class Tab extends CompositeDisposable {
|
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
this._onDragStart.fire(event);
|
|
75
|
-
}), dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
|
|
75
|
+
}), this.dragHandler, addDisposableListener(this._element, 'pointerdown', (event) => {
|
|
76
76
|
this._onPointDown.fire(event);
|
|
77
77
|
}), this.dropTarget.onDrop((event) => {
|
|
78
78
|
this._onDropped.fire(event);
|
|
@@ -91,6 +91,7 @@ export class Tab extends CompositeDisposable {
|
|
|
91
91
|
}
|
|
92
92
|
updateDragAndDropState() {
|
|
93
93
|
this._element.draggable = !this.accessor.options.disableDnd;
|
|
94
|
+
this.dragHandler.setDisabled(!!this.accessor.options.disableDnd);
|
|
94
95
|
}
|
|
95
96
|
dispose() {
|
|
96
97
|
super.dispose();
|
|
@@ -8,6 +8,7 @@ export declare class VoidContainer extends CompositeDisposable {
|
|
|
8
8
|
private readonly group;
|
|
9
9
|
private readonly _element;
|
|
10
10
|
private readonly dropTarget;
|
|
11
|
+
private readonly handler;
|
|
11
12
|
private readonly _onDrop;
|
|
12
13
|
readonly onDrop: Event<DroptargetEvent>;
|
|
13
14
|
private readonly _onDragStart;
|
|
@@ -23,7 +23,7 @@ export class VoidContainer extends CompositeDisposable {
|
|
|
23
23
|
this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'pointerdown', () => {
|
|
24
24
|
this.accessor.doSetGroupActive(this.group);
|
|
25
25
|
}));
|
|
26
|
-
|
|
26
|
+
this.handler = new GroupDragHandler(this._element, accessor, group, !!this.accessor.options.disableDnd);
|
|
27
27
|
this.dropTarget = new Droptarget(this._element, {
|
|
28
28
|
acceptedTargetZones: ['center'],
|
|
29
29
|
canDisplayOverlay: (event, position) => {
|
|
@@ -36,7 +36,7 @@ export class VoidContainer extends CompositeDisposable {
|
|
|
36
36
|
getOverrideTarget: () => { var _a; return (_a = group.model.dropTargetContainer) === null || _a === void 0 ? void 0 : _a.model; },
|
|
37
37
|
});
|
|
38
38
|
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
39
|
-
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
39
|
+
this.addDisposables(this.handler, this.handler.onDragStart((event) => {
|
|
40
40
|
this._onDragStart.fire(event);
|
|
41
41
|
}), this.dropTarget.onDrop((event) => {
|
|
42
42
|
this._onDrop.fire(event);
|
|
@@ -45,5 +45,6 @@ export class VoidContainer extends CompositeDisposable {
|
|
|
45
45
|
updateDragAndDropState() {
|
|
46
46
|
this._element.draggable = !this.accessor.options.disableDnd;
|
|
47
47
|
toggleClass(this._element, 'dv-draggable', !this.accessor.options.disableDnd);
|
|
48
|
+
this.handler.setDisabled(!!this.accessor.options.disableDnd);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -1386,11 +1386,13 @@ export class DockviewComponent extends BaseGrid {
|
|
|
1386
1386
|
// remove the group and do not set a new group as active
|
|
1387
1387
|
this.doRemoveGroup(sourceGroup, { skipActive: true });
|
|
1388
1388
|
}
|
|
1389
|
+
// Check if destination group is empty - if so, force render the component
|
|
1390
|
+
const isDestinationGroupEmpty = destinationGroup.model.size === 0;
|
|
1389
1391
|
this.movingLock(() => {
|
|
1390
1392
|
var _a;
|
|
1391
1393
|
return destinationGroup.model.openPanel(removedPanel, {
|
|
1392
1394
|
index: destinationIndex,
|
|
1393
|
-
skipSetActive: (_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false,
|
|
1395
|
+
skipSetActive: ((_a = options.skipSetActive) !== null && _a !== void 0 ? _a : false) && !isDestinationGroupEmpty,
|
|
1394
1396
|
skipSetGroupActive: true,
|
|
1395
1397
|
});
|
|
1396
1398
|
});
|