dockview-core 3.2.0 → 4.0.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/api/component.api.d.ts +0 -2
- package/dist/cjs/api/component.api.js +0 -10
- package/dist/cjs/dnd/abstractDragHandler.js +4 -2
- package/dist/cjs/dnd/dropTargetAnchorContainer.d.ts +16 -0
- package/dist/cjs/dnd/dropTargetAnchorContainer.js +105 -0
- package/dist/cjs/dnd/droptarget.d.ts +16 -0
- package/dist/cjs/dnd/droptarget.js +138 -14
- package/dist/cjs/dnd/ghost.d.ts +4 -1
- package/dist/cjs/dnd/ghost.js +3 -2
- package/dist/cjs/dnd/groupDragHandler.js +3 -1
- package/dist/cjs/dockview/components/panel/content.js +10 -13
- package/dist/cjs/dockview/components/popupService.d.ts +13 -0
- package/dist/cjs/dockview/components/popupService.js +76 -0
- package/dist/cjs/dockview/components/tab/tab.js +17 -7
- package/dist/cjs/dockview/components/titlebar/tabOverflowControl.d.ts +8 -0
- package/dist/cjs/dockview/components/titlebar/tabOverflowControl.js +20 -0
- package/dist/cjs/dockview/components/titlebar/tabs.d.ts +45 -0
- package/dist/cjs/dockview/components/titlebar/tabs.js +288 -0
- package/dist/cjs/dockview/components/titlebar/tabsContainer.d.ts +8 -9
- package/dist/cjs/dockview/components/titlebar/tabsContainer.js +108 -152
- package/dist/cjs/dockview/components/titlebar/voidContainer.js +2 -9
- package/dist/cjs/dockview/dockviewComponent.d.ts +10 -3
- package/dist/cjs/dockview/dockviewComponent.js +71 -30
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +4 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +31 -0
- package/dist/cjs/dockview/dockviewPanelModel.d.ts +5 -3
- package/dist/cjs/dockview/dockviewPanelModel.js +25 -4
- package/dist/cjs/dockview/framework.d.ts +4 -1
- package/dist/cjs/dockview/options.d.ts +8 -5
- package/dist/cjs/dockview/options.js +3 -1
- package/dist/cjs/dockview/theme.d.ts +31 -0
- package/dist/cjs/dockview/theme.js +42 -0
- package/dist/cjs/dockview/types.d.ts +5 -1
- package/dist/cjs/dom.d.ts +1 -0
- package/dist/cjs/dom.js +15 -1
- package/dist/cjs/gridview/baseComponentGridview.d.ts +3 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/paneview/paneviewComponent.js +1 -0
- package/dist/cjs/scrollbar.d.ts +12 -0
- package/dist/cjs/scrollbar.js +106 -0
- package/dist/cjs/splitview/splitview.js +1 -0
- package/dist/cjs/splitview/splitviewComponent.js +1 -0
- package/dist/dockview-core.amd.js +930 -293
- 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 +929 -292
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +930 -293
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +923 -294
- 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 +930 -293
- 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 +929 -292
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/component.api.d.ts +0 -2
- package/dist/esm/api/component.api.js +0 -6
- package/dist/esm/dnd/abstractDragHandler.js +4 -2
- package/dist/esm/dnd/dropTargetAnchorContainer.d.ts +16 -0
- package/dist/esm/dnd/dropTargetAnchorContainer.js +74 -0
- package/dist/esm/dnd/droptarget.d.ts +16 -0
- package/dist/esm/dnd/droptarget.js +134 -14
- package/dist/esm/dnd/ghost.d.ts +4 -1
- package/dist/esm/dnd/ghost.js +3 -2
- package/dist/esm/dnd/groupDragHandler.js +3 -1
- package/dist/esm/dockview/components/panel/content.js +10 -13
- package/dist/esm/dockview/components/popupService.d.ts +13 -0
- package/dist/esm/dockview/components/popupService.js +53 -0
- package/dist/esm/dockview/components/tab/tab.js +15 -7
- package/dist/esm/dockview/components/titlebar/tabOverflowControl.d.ts +8 -0
- package/dist/esm/dockview/components/titlebar/tabOverflowControl.js +16 -0
- package/dist/esm/dockview/components/titlebar/tabs.d.ts +45 -0
- package/dist/esm/dockview/components/titlebar/tabs.js +183 -0
- package/dist/esm/dockview/components/titlebar/tabsContainer.d.ts +8 -9
- package/dist/esm/dockview/components/titlebar/tabsContainer.js +133 -162
- package/dist/esm/dockview/components/titlebar/voidContainer.js +2 -9
- package/dist/esm/dockview/dockviewComponent.d.ts +10 -3
- package/dist/esm/dockview/dockviewComponent.js +69 -24
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +4 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js +27 -0
- package/dist/esm/dockview/dockviewPanelModel.d.ts +5 -3
- package/dist/esm/dockview/dockviewPanelModel.js +14 -4
- package/dist/esm/dockview/framework.d.ts +4 -1
- package/dist/esm/dockview/options.d.ts +8 -5
- package/dist/esm/dockview/options.js +3 -1
- package/dist/esm/dockview/theme.d.ts +31 -0
- package/dist/esm/dockview/theme.js +39 -0
- package/dist/esm/dockview/types.d.ts +5 -1
- package/dist/esm/dom.d.ts +1 -0
- package/dist/esm/dom.js +13 -0
- package/dist/esm/gridview/baseComponentGridview.d.ts +3 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/paneview/paneviewComponent.js +1 -0
- package/dist/esm/scrollbar.d.ts +12 -0
- package/dist/esm/scrollbar.js +80 -0
- package/dist/esm/splitview/splitview.js +1 -0
- package/dist/esm/splitview/splitviewComponent.js +1 -0
- package/dist/styles/dockview.css +423 -69
- package/package.json +1 -1
|
@@ -352,7 +352,6 @@ export declare class DockviewApi implements CommonApi<SerializedDockview> {
|
|
|
352
352
|
* Total number of panels.
|
|
353
353
|
*/
|
|
354
354
|
get totalPanels(): number;
|
|
355
|
-
get gap(): number;
|
|
356
355
|
/**
|
|
357
356
|
* Invoked when the active group changes. May be undefined if no group is active.
|
|
358
357
|
*/
|
|
@@ -514,7 +513,6 @@ export declare class DockviewApi implements CommonApi<SerializedDockview> {
|
|
|
514
513
|
window: Window;
|
|
515
514
|
}) => void;
|
|
516
515
|
}): Promise<boolean>;
|
|
517
|
-
setGap(gap: number | undefined): void;
|
|
518
516
|
updateOptions(options: Partial<DockviewComponentOptions>): void;
|
|
519
517
|
/**
|
|
520
518
|
* Release resources and teardown component. Do not call when using framework versions of dockview.
|
|
@@ -662,13 +662,6 @@ var DockviewApi = /** @class */ (function () {
|
|
|
662
662
|
enumerable: false,
|
|
663
663
|
configurable: true
|
|
664
664
|
});
|
|
665
|
-
Object.defineProperty(DockviewApi.prototype, "gap", {
|
|
666
|
-
get: function () {
|
|
667
|
-
return this.component.gap;
|
|
668
|
-
},
|
|
669
|
-
enumerable: false,
|
|
670
|
-
configurable: true
|
|
671
|
-
});
|
|
672
665
|
Object.defineProperty(DockviewApi.prototype, "onDidActiveGroupChange", {
|
|
673
666
|
/**
|
|
674
667
|
* Invoked when the active group changes. May be undefined if no group is active.
|
|
@@ -977,9 +970,6 @@ var DockviewApi = /** @class */ (function () {
|
|
|
977
970
|
DockviewApi.prototype.addPopoutGroup = function (item, options) {
|
|
978
971
|
return this.component.addPopoutGroup(item, options);
|
|
979
972
|
};
|
|
980
|
-
DockviewApi.prototype.setGap = function (gap) {
|
|
981
|
-
this.component.updateOptions({ gap: gap });
|
|
982
|
-
};
|
|
983
973
|
DockviewApi.prototype.updateOptions = function (options) {
|
|
984
974
|
this.component.updateOptions(options);
|
|
985
975
|
};
|
|
@@ -63,14 +63,16 @@ var DragHandler = /** @class */ (function (_super) {
|
|
|
63
63
|
* For example: in react-dnd if dataTransfer.types is not set then the dragStart event will be cancelled
|
|
64
64
|
* through .preventDefault(). Since this is applied globally to all drag events this would break dockviews
|
|
65
65
|
* dnd logic. You can see the code at
|
|
66
|
-
|
|
66
|
+
P * https://github.com/react-dnd/react-dnd/blob/main/packages/backend-html5/src/HTML5BackendImpl.ts#L542
|
|
67
67
|
*/
|
|
68
68
|
event.dataTransfer.setData('text/plain', '');
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}), (0, events_1.addDisposableListener)(this.el, 'dragend', function () {
|
|
72
72
|
_this.pointerEventsDisposable.dispose();
|
|
73
|
-
|
|
73
|
+
setTimeout(function () {
|
|
74
|
+
_this.dataDisposable.dispose(); // allow the data to be read by other handlers before disposing
|
|
75
|
+
}, 0);
|
|
74
76
|
}));
|
|
75
77
|
};
|
|
76
78
|
return DragHandler;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CompositeDisposable } from '../lifecycle';
|
|
2
|
+
import { DropTargetTargetModel } from './droptarget';
|
|
3
|
+
export declare class DropTargetAnchorContainer extends CompositeDisposable {
|
|
4
|
+
readonly element: HTMLElement;
|
|
5
|
+
private _model;
|
|
6
|
+
private _outline;
|
|
7
|
+
private _disabled;
|
|
8
|
+
get disabled(): boolean;
|
|
9
|
+
set disabled(value: boolean);
|
|
10
|
+
get model(): DropTargetTargetModel | undefined;
|
|
11
|
+
constructor(element: HTMLElement, options: {
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
});
|
|
14
|
+
private createContainer;
|
|
15
|
+
private createAnchor;
|
|
16
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.DropTargetAnchorContainer = void 0;
|
|
19
|
+
var lifecycle_1 = require("../lifecycle");
|
|
20
|
+
var DropTargetAnchorContainer = /** @class */ (function (_super) {
|
|
21
|
+
__extends(DropTargetAnchorContainer, _super);
|
|
22
|
+
function DropTargetAnchorContainer(element, options) {
|
|
23
|
+
var _this = _super.call(this) || this;
|
|
24
|
+
_this.element = element;
|
|
25
|
+
_this._disabled = false;
|
|
26
|
+
_this._disabled = options.disabled;
|
|
27
|
+
_this.addDisposables(lifecycle_1.Disposable.from(function () {
|
|
28
|
+
var _a;
|
|
29
|
+
(_a = _this.model) === null || _a === void 0 ? void 0 : _a.clear();
|
|
30
|
+
}));
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
Object.defineProperty(DropTargetAnchorContainer.prototype, "disabled", {
|
|
34
|
+
get: function () {
|
|
35
|
+
return this._disabled;
|
|
36
|
+
},
|
|
37
|
+
set: function (value) {
|
|
38
|
+
var _a;
|
|
39
|
+
if (this.disabled === value) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
this._disabled = value;
|
|
43
|
+
if (value) {
|
|
44
|
+
(_a = this.model) === null || _a === void 0 ? void 0 : _a.clear();
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
enumerable: false,
|
|
48
|
+
configurable: true
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(DropTargetAnchorContainer.prototype, "model", {
|
|
51
|
+
get: function () {
|
|
52
|
+
var _this = this;
|
|
53
|
+
if (this.disabled) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
clear: function () {
|
|
58
|
+
var _a;
|
|
59
|
+
if (_this._model) {
|
|
60
|
+
(_a = _this._model.root.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(_this._model.root);
|
|
61
|
+
}
|
|
62
|
+
_this._model = undefined;
|
|
63
|
+
},
|
|
64
|
+
exists: function () {
|
|
65
|
+
return !!_this._model;
|
|
66
|
+
},
|
|
67
|
+
getElements: function (event, outline) {
|
|
68
|
+
var changed = _this._outline !== outline;
|
|
69
|
+
_this._outline = outline;
|
|
70
|
+
if (_this._model) {
|
|
71
|
+
_this._model.changed = changed;
|
|
72
|
+
return _this._model;
|
|
73
|
+
}
|
|
74
|
+
var container = _this.createContainer();
|
|
75
|
+
var anchor = _this.createAnchor();
|
|
76
|
+
_this._model = { root: container, overlay: anchor, changed: changed };
|
|
77
|
+
container.appendChild(anchor);
|
|
78
|
+
_this.element.appendChild(container);
|
|
79
|
+
if ((event === null || event === void 0 ? void 0 : event.target) instanceof HTMLElement) {
|
|
80
|
+
var targetBox = event.target.getBoundingClientRect();
|
|
81
|
+
var box = _this.element.getBoundingClientRect();
|
|
82
|
+
anchor.style.left = "".concat(targetBox.left - box.left, "px");
|
|
83
|
+
anchor.style.top = "".concat(targetBox.top - box.top, "px");
|
|
84
|
+
}
|
|
85
|
+
return _this._model;
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
enumerable: false,
|
|
90
|
+
configurable: true
|
|
91
|
+
});
|
|
92
|
+
DropTargetAnchorContainer.prototype.createContainer = function () {
|
|
93
|
+
var el = document.createElement('div');
|
|
94
|
+
el.className = 'dv-drop-target-container';
|
|
95
|
+
return el;
|
|
96
|
+
};
|
|
97
|
+
DropTargetAnchorContainer.prototype.createAnchor = function () {
|
|
98
|
+
var el = document.createElement('div');
|
|
99
|
+
el.className = 'dv-drop-target-anchor';
|
|
100
|
+
el.style.visibility = 'hidden';
|
|
101
|
+
return el;
|
|
102
|
+
};
|
|
103
|
+
return DropTargetAnchorContainer;
|
|
104
|
+
}(lifecycle_1.CompositeDisposable));
|
|
105
|
+
exports.DropTargetAnchorContainer = DropTargetAnchorContainer;
|
|
@@ -27,10 +27,22 @@ export type DroptargetOverlayModel = {
|
|
|
27
27
|
size?: MeasuredValue;
|
|
28
28
|
activationSize?: MeasuredValue;
|
|
29
29
|
};
|
|
30
|
+
export interface DropTargetTargetModel {
|
|
31
|
+
getElements(event?: DragEvent, outline?: HTMLElement): {
|
|
32
|
+
root: HTMLElement;
|
|
33
|
+
overlay: HTMLElement;
|
|
34
|
+
changed: boolean;
|
|
35
|
+
};
|
|
36
|
+
exists(): boolean;
|
|
37
|
+
clear(): void;
|
|
38
|
+
}
|
|
30
39
|
export interface DroptargetOptions {
|
|
31
40
|
canDisplayOverlay: CanDisplayOverlay;
|
|
32
41
|
acceptedTargetZones: Position[];
|
|
33
42
|
overlayModel?: DroptargetOverlayModel;
|
|
43
|
+
getOverrideTarget?: () => DropTargetTargetModel | undefined;
|
|
44
|
+
className?: string;
|
|
45
|
+
getOverlayOutline?: () => HTMLElement | null;
|
|
34
46
|
}
|
|
35
47
|
export declare class Droptarget extends CompositeDisposable {
|
|
36
48
|
private readonly element;
|
|
@@ -45,6 +57,10 @@ export declare class Droptarget extends CompositeDisposable {
|
|
|
45
57
|
readonly onWillShowOverlay: Event<WillShowOverlayEvent>;
|
|
46
58
|
readonly dnd: DragAndDropObserver;
|
|
47
59
|
private static USED_EVENT_ID;
|
|
60
|
+
private static ACTUAL_TARGET;
|
|
61
|
+
private _disabled;
|
|
62
|
+
get disabled(): boolean;
|
|
63
|
+
set disabled(value: boolean);
|
|
48
64
|
get state(): Position | undefined;
|
|
49
65
|
constructor(element: HTMLElement, options: DroptargetOptions);
|
|
50
66
|
setTargetZones(acceptedTargetZones: Position[]): void;
|
|
@@ -99,23 +99,34 @@ var Droptarget = /** @class */ (function (_super) {
|
|
|
99
99
|
_this.onDrop = _this._onDrop.event;
|
|
100
100
|
_this._onWillShowOverlay = new events_1.Emitter();
|
|
101
101
|
_this.onWillShowOverlay = _this._onWillShowOverlay.event;
|
|
102
|
+
_this._disabled = false;
|
|
102
103
|
// use a set to take advantage of #<set>.has
|
|
103
104
|
_this._acceptedTargetZonesSet = new Set(_this.options.acceptedTargetZones);
|
|
104
105
|
_this.dnd = new dnd_1.DragAndDropObserver(_this.element, {
|
|
105
|
-
onDragEnter: function () {
|
|
106
|
+
onDragEnter: function () {
|
|
107
|
+
var _a, _b, _c;
|
|
108
|
+
(_c = (_b = (_a = _this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.getElements();
|
|
109
|
+
},
|
|
106
110
|
onDragOver: function (e) {
|
|
111
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
112
|
+
Droptarget.ACTUAL_TARGET = _this;
|
|
113
|
+
var overrideTraget = (_b = (_a = _this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
107
114
|
if (_this._acceptedTargetZonesSet.size === 0) {
|
|
115
|
+
if (overrideTraget) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
108
118
|
_this.removeDropTarget();
|
|
109
119
|
return;
|
|
110
120
|
}
|
|
111
|
-
var
|
|
112
|
-
var
|
|
121
|
+
var target = (_e = (_d = (_c = _this.options).getOverlayOutline) === null || _d === void 0 ? void 0 : _d.call(_c)) !== null && _e !== void 0 ? _e : _this.element;
|
|
122
|
+
var width = target.offsetWidth;
|
|
123
|
+
var height = target.offsetHeight;
|
|
113
124
|
if (width === 0 || height === 0) {
|
|
114
125
|
return; // avoid div!0
|
|
115
126
|
}
|
|
116
127
|
var rect = e.currentTarget.getBoundingClientRect();
|
|
117
|
-
var x = e.clientX - rect.left;
|
|
118
|
-
var y = e.clientY - rect.top;
|
|
128
|
+
var x = ((_f = e.clientX) !== null && _f !== void 0 ? _f : 0) - rect.left;
|
|
129
|
+
var y = ((_g = e.clientY) !== null && _g !== void 0 ? _g : 0) - rect.top;
|
|
119
130
|
var quadrant = _this.calculateQuadrant(_this._acceptedTargetZonesSet, x, y, width, height);
|
|
120
131
|
/**
|
|
121
132
|
* If the event has already been used by another DropTarget instance
|
|
@@ -128,6 +139,9 @@ var Droptarget = /** @class */ (function (_super) {
|
|
|
128
139
|
return;
|
|
129
140
|
}
|
|
130
141
|
if (!_this.options.canDisplayOverlay(e, quadrant)) {
|
|
142
|
+
if (overrideTraget) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
131
145
|
_this.removeDropTarget();
|
|
132
146
|
return;
|
|
133
147
|
}
|
|
@@ -145,29 +159,59 @@ var Droptarget = /** @class */ (function (_super) {
|
|
|
145
159
|
return;
|
|
146
160
|
}
|
|
147
161
|
_this.markAsUsed(e);
|
|
148
|
-
if (
|
|
162
|
+
if (overrideTraget) {
|
|
163
|
+
//
|
|
164
|
+
}
|
|
165
|
+
else if (!_this.targetElement) {
|
|
149
166
|
_this.targetElement = document.createElement('div');
|
|
150
167
|
_this.targetElement.className = 'dv-drop-target-dropzone';
|
|
151
168
|
_this.overlayElement = document.createElement('div');
|
|
152
169
|
_this.overlayElement.className = 'dv-drop-target-selection';
|
|
153
170
|
_this._state = 'center';
|
|
154
171
|
_this.targetElement.appendChild(_this.overlayElement);
|
|
155
|
-
|
|
156
|
-
|
|
172
|
+
target.classList.add('dv-drop-target');
|
|
173
|
+
target.append(_this.targetElement);
|
|
174
|
+
// this.overlayElement.style.opacity = '0';
|
|
175
|
+
// requestAnimationFrame(() => {
|
|
176
|
+
// if (this.overlayElement) {
|
|
177
|
+
// this.overlayElement.style.opacity = '';
|
|
178
|
+
// }
|
|
179
|
+
// });
|
|
157
180
|
}
|
|
158
181
|
_this.toggleClasses(quadrant, width, height);
|
|
159
182
|
_this._state = quadrant;
|
|
160
183
|
},
|
|
161
184
|
onDragLeave: function () {
|
|
185
|
+
var _a, _b;
|
|
186
|
+
var target = (_b = (_a = _this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
187
|
+
if (target) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
162
190
|
_this.removeDropTarget();
|
|
163
191
|
},
|
|
164
|
-
onDragEnd: function () {
|
|
192
|
+
onDragEnd: function (e) {
|
|
193
|
+
var _a, _b;
|
|
194
|
+
var target = (_b = (_a = _this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
195
|
+
if (target && Droptarget.ACTUAL_TARGET === _this) {
|
|
196
|
+
if (_this._state) {
|
|
197
|
+
// only stop the propagation of the event if we are dealing with it
|
|
198
|
+
// which is only when the target has state
|
|
199
|
+
e.stopPropagation();
|
|
200
|
+
_this._onDrop.fire({
|
|
201
|
+
position: _this._state,
|
|
202
|
+
nativeEvent: e,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
165
206
|
_this.removeDropTarget();
|
|
207
|
+
target === null || target === void 0 ? void 0 : target.clear();
|
|
166
208
|
},
|
|
167
209
|
onDrop: function (e) {
|
|
210
|
+
var _a, _b, _c;
|
|
168
211
|
e.preventDefault();
|
|
169
212
|
var state = _this._state;
|
|
170
213
|
_this.removeDropTarget();
|
|
214
|
+
(_c = (_b = (_a = _this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a)) === null || _c === void 0 ? void 0 : _c.clear();
|
|
171
215
|
if (state) {
|
|
172
216
|
// only stop the propagation of the event if we are dealing with it
|
|
173
217
|
// which is only when the target has state
|
|
@@ -179,6 +223,16 @@ var Droptarget = /** @class */ (function (_super) {
|
|
|
179
223
|
_this.addDisposables(_this._onDrop, _this._onWillShowOverlay, _this.dnd);
|
|
180
224
|
return _this;
|
|
181
225
|
}
|
|
226
|
+
Object.defineProperty(Droptarget.prototype, "disabled", {
|
|
227
|
+
get: function () {
|
|
228
|
+
return this._disabled;
|
|
229
|
+
},
|
|
230
|
+
set: function (value) {
|
|
231
|
+
this._disabled = value;
|
|
232
|
+
},
|
|
233
|
+
enumerable: false,
|
|
234
|
+
configurable: true
|
|
235
|
+
});
|
|
182
236
|
Object.defineProperty(Droptarget.prototype, "state", {
|
|
183
237
|
get: function () {
|
|
184
238
|
return this._state;
|
|
@@ -210,8 +264,9 @@ var Droptarget = /** @class */ (function (_super) {
|
|
|
210
264
|
return typeof value === 'boolean' && value;
|
|
211
265
|
};
|
|
212
266
|
Droptarget.prototype.toggleClasses = function (quadrant, width, height) {
|
|
213
|
-
var _a, _b;
|
|
214
|
-
|
|
267
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
268
|
+
var target = (_b = (_a = this.options).getOverrideTarget) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
269
|
+
if (!target && !this.overlayElement) {
|
|
215
270
|
return;
|
|
216
271
|
}
|
|
217
272
|
var isSmallX = width < SMALL_WIDTH_BOUNDARY;
|
|
@@ -225,7 +280,7 @@ var Droptarget = /** @class */ (function (_super) {
|
|
|
225
280
|
var topClass = !isSmallY && isTop;
|
|
226
281
|
var bottomClass = !isSmallY && isBottom;
|
|
227
282
|
var size = 1;
|
|
228
|
-
var sizeOptions = (
|
|
283
|
+
var sizeOptions = (_d = (_c = this.options.overlayModel) === null || _c === void 0 ? void 0 : _c.size) !== null && _d !== void 0 ? _d : DEFAULT_SIZE;
|
|
229
284
|
if (sizeOptions.type === 'percentage') {
|
|
230
285
|
size = (0, math_1.clamp)(sizeOptions.value, 0, 100) / 100;
|
|
231
286
|
}
|
|
@@ -237,6 +292,74 @@ var Droptarget = /** @class */ (function (_super) {
|
|
|
237
292
|
size = (0, math_1.clamp)(0, sizeOptions.value, height) / height;
|
|
238
293
|
}
|
|
239
294
|
}
|
|
295
|
+
if (target) {
|
|
296
|
+
var outlineEl = (_g = (_f = (_e = this.options).getOverlayOutline) === null || _f === void 0 ? void 0 : _f.call(_e)) !== null && _g !== void 0 ? _g : this.element;
|
|
297
|
+
var elBox = outlineEl.getBoundingClientRect();
|
|
298
|
+
var ta = target.getElements(undefined, outlineEl);
|
|
299
|
+
var el = ta.root;
|
|
300
|
+
var overlay_1 = ta.overlay;
|
|
301
|
+
var bigbox = el.getBoundingClientRect();
|
|
302
|
+
var rootTop = elBox.top - bigbox.top;
|
|
303
|
+
var rootLeft = elBox.left - bigbox.left;
|
|
304
|
+
var box_1 = {
|
|
305
|
+
top: rootTop,
|
|
306
|
+
left: rootLeft,
|
|
307
|
+
width: width,
|
|
308
|
+
height: height,
|
|
309
|
+
};
|
|
310
|
+
if (rightClass) {
|
|
311
|
+
box_1.left = rootLeft + width * (1 - size);
|
|
312
|
+
box_1.width = width * size;
|
|
313
|
+
}
|
|
314
|
+
else if (leftClass) {
|
|
315
|
+
box_1.width = width * size;
|
|
316
|
+
}
|
|
317
|
+
else if (topClass) {
|
|
318
|
+
box_1.height = height * size;
|
|
319
|
+
}
|
|
320
|
+
else if (bottomClass) {
|
|
321
|
+
box_1.top = rootTop + height * (1 - size);
|
|
322
|
+
box_1.height = height * size;
|
|
323
|
+
}
|
|
324
|
+
if (isSmallX && isLeft) {
|
|
325
|
+
box_1.width = 4;
|
|
326
|
+
}
|
|
327
|
+
if (isSmallX && isRight) {
|
|
328
|
+
box_1.left = rootLeft + width - 4;
|
|
329
|
+
box_1.width = 4;
|
|
330
|
+
}
|
|
331
|
+
var topPx = "".concat(Math.round(box_1.top), "px");
|
|
332
|
+
var leftPx = "".concat(Math.round(box_1.left), "px");
|
|
333
|
+
var widthPx = "".concat(Math.round(box_1.width), "px");
|
|
334
|
+
var heightPx = "".concat(Math.round(box_1.height), "px");
|
|
335
|
+
if (overlay_1.style.top === topPx &&
|
|
336
|
+
overlay_1.style.left === leftPx &&
|
|
337
|
+
overlay_1.style.width === widthPx &&
|
|
338
|
+
overlay_1.style.height === heightPx) {
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
overlay_1.style.top = topPx;
|
|
342
|
+
overlay_1.style.left = leftPx;
|
|
343
|
+
overlay_1.style.width = widthPx;
|
|
344
|
+
overlay_1.style.height = heightPx;
|
|
345
|
+
overlay_1.style.visibility = 'visible';
|
|
346
|
+
overlay_1.className = "dv-drop-target-anchor".concat(this.options.className ? " ".concat(this.options.className) : '');
|
|
347
|
+
(0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-left', isLeft);
|
|
348
|
+
(0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-right', isRight);
|
|
349
|
+
(0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-top', isTop);
|
|
350
|
+
(0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-bottom', isBottom);
|
|
351
|
+
(0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-center', quadrant === 'center');
|
|
352
|
+
if (ta.changed) {
|
|
353
|
+
(0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-anchor-container-changed', true);
|
|
354
|
+
setTimeout(function () {
|
|
355
|
+
(0, dom_1.toggleClass)(overlay_1, 'dv-drop-target-anchor-container-changed', false);
|
|
356
|
+
}, 10);
|
|
357
|
+
}
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
if (!this.overlayElement) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
240
363
|
var box = { top: '0px', left: '0px', width: '100%', height: '100%' };
|
|
241
364
|
/**
|
|
242
365
|
* You can also achieve the overlay placement using the transform CSS property
|
|
@@ -293,12 +416,13 @@ var Droptarget = /** @class */ (function (_super) {
|
|
|
293
416
|
return calculateQuadrantAsPixels(overlayType, x, y, width, height, activationSizeOptions.value);
|
|
294
417
|
};
|
|
295
418
|
Droptarget.prototype.removeDropTarget = function () {
|
|
419
|
+
var _a;
|
|
296
420
|
if (this.targetElement) {
|
|
297
421
|
this._state = undefined;
|
|
298
|
-
|
|
422
|
+
(_a = this.targetElement.parentElement) === null || _a === void 0 ? void 0 : _a.classList.remove('dv-drop-target');
|
|
423
|
+
this.targetElement.remove();
|
|
299
424
|
this.targetElement = undefined;
|
|
300
425
|
this.overlayElement = undefined;
|
|
301
|
-
this.element.classList.remove('dv-drop-target');
|
|
302
426
|
}
|
|
303
427
|
};
|
|
304
428
|
Droptarget.USED_EVENT_ID = '__dockview_droptarget_event_is_used__';
|
package/dist/cjs/dnd/ghost.d.ts
CHANGED
package/dist/cjs/dnd/ghost.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addGhostImage = void 0;
|
|
4
4
|
var dom_1 = require("../dom");
|
|
5
|
-
function addGhostImage(dataTransfer, ghostElement) {
|
|
5
|
+
function addGhostImage(dataTransfer, ghostElement, options) {
|
|
6
|
+
var _a, _b;
|
|
6
7
|
// class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
|
|
7
8
|
(0, dom_1.addClasses)(ghostElement, 'dv-dragged');
|
|
8
9
|
document.body.appendChild(ghostElement);
|
|
9
|
-
dataTransfer.setDragImage(ghostElement, 0, 0);
|
|
10
|
+
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);
|
|
10
11
|
setTimeout(function () {
|
|
11
12
|
(0, dom_1.removeClasses)(ghostElement, 'dv-dragged');
|
|
12
13
|
ghostElement.remove();
|
|
@@ -63,8 +63,10 @@ var GroupDragHandler = /** @class */ (function (_super) {
|
|
|
63
63
|
ghostElement.style.lineHeight = '20px';
|
|
64
64
|
ghostElement.style.borderRadius = '12px';
|
|
65
65
|
ghostElement.style.position = 'absolute';
|
|
66
|
+
ghostElement.style.pointerEvents = 'none';
|
|
67
|
+
ghostElement.style.top = '-9999px';
|
|
66
68
|
ghostElement.textContent = "Multiple Panels (".concat(this.group.size, ")");
|
|
67
|
-
(0, ghost_1.addGhostImage)(dataTransfer, ghostElement);
|
|
69
|
+
(0, ghost_1.addGhostImage)(dataTransfer, ghostElement, { y: -10, x: 30 });
|
|
68
70
|
}
|
|
69
71
|
return {
|
|
70
72
|
dispose: function () {
|
|
@@ -36,7 +36,15 @@ var ContentContainer = /** @class */ (function (_super) {
|
|
|
36
36
|
_this._element.className = 'dv-content-container';
|
|
37
37
|
_this._element.tabIndex = -1;
|
|
38
38
|
_this.addDisposables(_this._onDidFocus, _this._onDidBlur);
|
|
39
|
+
var target = group.dropTargetContainer;
|
|
39
40
|
_this.dropTarget = new droptarget_1.Droptarget(_this.element, {
|
|
41
|
+
getOverlayOutline: function () {
|
|
42
|
+
var _a;
|
|
43
|
+
return ((_a = accessor.options.theme) === null || _a === void 0 ? void 0 : _a.dndPanelOverlay) === 'group'
|
|
44
|
+
? _this.element.parentElement
|
|
45
|
+
: null;
|
|
46
|
+
},
|
|
47
|
+
className: 'dv-drop-target-content',
|
|
40
48
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
41
49
|
canDisplayOverlay: function (event, position) {
|
|
42
50
|
if (_this.group.locked === 'no-drop-target' ||
|
|
@@ -50,22 +58,11 @@ var ContentContainer = /** @class */ (function (_super) {
|
|
|
50
58
|
return false;
|
|
51
59
|
}
|
|
52
60
|
if (data && data.viewId === _this.accessor.id) {
|
|
53
|
-
|
|
54
|
-
if (position === 'center') {
|
|
55
|
-
// don't allow to drop on self for center position
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
if (data.panelId === null) {
|
|
59
|
-
// don't allow group move to drop anywhere on self
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
var groupHasOnePanelAndIsActiveDragElement = _this.group.panels.length === 1 &&
|
|
64
|
-
data.groupId === _this.group.id;
|
|
65
|
-
return !groupHasOnePanelAndIsActiveDragElement;
|
|
61
|
+
return true;
|
|
66
62
|
}
|
|
67
63
|
return _this.group.canDisplayOverlay(event, position, 'content');
|
|
68
64
|
},
|
|
65
|
+
getOverrideTarget: target ? function () { return target.model; } : undefined,
|
|
69
66
|
});
|
|
70
67
|
_this.addDisposables(_this.dropTarget);
|
|
71
68
|
return _this;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CompositeDisposable } from '../../lifecycle';
|
|
2
|
+
export declare class PopupService extends CompositeDisposable {
|
|
3
|
+
private readonly root;
|
|
4
|
+
private readonly _element;
|
|
5
|
+
private _active;
|
|
6
|
+
private readonly _activeDisposable;
|
|
7
|
+
constructor(root: HTMLElement);
|
|
8
|
+
openPopover(element: HTMLElement, position: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}): void;
|
|
12
|
+
close(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.PopupService = void 0;
|
|
19
|
+
var events_1 = require("../../events");
|
|
20
|
+
var lifecycle_1 = require("../../lifecycle");
|
|
21
|
+
var PopupService = /** @class */ (function (_super) {
|
|
22
|
+
__extends(PopupService, _super);
|
|
23
|
+
function PopupService(root) {
|
|
24
|
+
var _this = _super.call(this) || this;
|
|
25
|
+
_this.root = root;
|
|
26
|
+
_this._active = null;
|
|
27
|
+
_this._activeDisposable = new lifecycle_1.MutableDisposable();
|
|
28
|
+
_this._element = document.createElement('div');
|
|
29
|
+
_this._element.className = 'dv-popover-anchor';
|
|
30
|
+
_this._element.style.position = 'relative';
|
|
31
|
+
_this.root.prepend(_this._element);
|
|
32
|
+
_this.addDisposables(lifecycle_1.Disposable.from(function () {
|
|
33
|
+
_this.close();
|
|
34
|
+
}), _this._activeDisposable);
|
|
35
|
+
return _this;
|
|
36
|
+
}
|
|
37
|
+
PopupService.prototype.openPopover = function (element, position) {
|
|
38
|
+
var _this = this;
|
|
39
|
+
this.close();
|
|
40
|
+
var wrapper = document.createElement('div');
|
|
41
|
+
wrapper.style.position = 'absolute';
|
|
42
|
+
wrapper.style.zIndex = '99';
|
|
43
|
+
wrapper.appendChild(element);
|
|
44
|
+
var anchorBox = this._element.getBoundingClientRect();
|
|
45
|
+
var offsetX = anchorBox.left;
|
|
46
|
+
var offsetY = anchorBox.top;
|
|
47
|
+
wrapper.style.top = "".concat(position.y - offsetY, "px");
|
|
48
|
+
wrapper.style.left = "".concat(position.x - offsetX, "px");
|
|
49
|
+
this._element.appendChild(wrapper);
|
|
50
|
+
this._active = wrapper;
|
|
51
|
+
this._activeDisposable.value = new lifecycle_1.CompositeDisposable((0, events_1.addDisposableWindowListener)(window, 'pointerdown', function (event) {
|
|
52
|
+
var _a;
|
|
53
|
+
var target = event.target;
|
|
54
|
+
if (!(target instanceof HTMLElement)) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
var el = target;
|
|
58
|
+
while (el && el !== wrapper) {
|
|
59
|
+
el = (_a = el === null || el === void 0 ? void 0 : el.parentElement) !== null && _a !== void 0 ? _a : null;
|
|
60
|
+
}
|
|
61
|
+
if (el) {
|
|
62
|
+
return; // clicked within popover
|
|
63
|
+
}
|
|
64
|
+
_this.close();
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
PopupService.prototype.close = function () {
|
|
68
|
+
if (this._active) {
|
|
69
|
+
this._active.remove();
|
|
70
|
+
this._activeDisposable.dispose();
|
|
71
|
+
this._active = null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return PopupService;
|
|
75
|
+
}(lifecycle_1.CompositeDisposable));
|
|
76
|
+
exports.PopupService = PopupService;
|