dockview-core 6.2.1 → 6.3.0
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/dockviewGroupPanelApi.d.ts +10 -1
- package/dist/cjs/api/dockviewGroupPanelApi.js +16 -0
- package/dist/cjs/dnd/groupDragHandler.js +34 -12
- package/dist/cjs/dockview/components/titlebar/tabGroupIndicator.js +2 -2
- package/dist/cjs/dockview/components/titlebar/tabs.js +9 -2
- package/dist/cjs/dockview/components/titlebar/voidContainer.js +6 -0
- package/dist/cjs/dockview/dockviewComponent.d.ts +1 -0
- package/dist/cjs/dockview/dockviewComponent.js +187 -125
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +1 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +9 -0
- package/dist/cjs/dockview/dockviewPanel.js +5 -0
- package/dist/cjs/dockview/dockviewPanelModel.d.ts +2 -0
- package/dist/cjs/dockview/dockviewPanelModel.js +8 -0
- package/dist/cjs/dockview/framework.d.ts +8 -0
- package/dist/cjs/dockview/options.d.ts +13 -2
- package/dist/cjs/dockview/options.js +2 -0
- package/dist/cjs/dom.d.ts +5 -1
- package/dist/cjs/dom.js +14 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/overlay/overlayRenderContainer.js +13 -3
- package/dist/cjs/popoutWindow.d.ts +2 -0
- package/dist/cjs/popoutWindow.js +3 -1
- package/dist/dockview-core.js +169 -30
- 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 +169 -30
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +10 -1
- package/dist/esm/api/dockviewGroupPanelApi.js +12 -0
- package/dist/esm/dnd/groupDragHandler.js +34 -12
- package/dist/esm/dockview/components/titlebar/tabGroupIndicator.js +2 -2
- package/dist/esm/dockview/components/titlebar/tabs.js +12 -2
- package/dist/esm/dockview/components/titlebar/voidContainer.js +6 -0
- package/dist/esm/dockview/dockviewComponent.d.ts +1 -0
- package/dist/esm/dockview/dockviewComponent.js +49 -7
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +1 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js +9 -0
- package/dist/esm/dockview/dockviewPanel.js +5 -0
- package/dist/esm/dockview/dockviewPanelModel.d.ts +2 -0
- package/dist/esm/dockview/dockviewPanelModel.js +8 -0
- package/dist/esm/dockview/framework.d.ts +8 -0
- package/dist/esm/dockview/options.d.ts +13 -2
- package/dist/esm/dockview/options.js +2 -0
- package/dist/esm/dom.d.ts +5 -1
- package/dist/esm/dom.js +13 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/overlay/overlayRenderContainer.js +13 -3
- package/dist/esm/popoutWindow.d.ts +2 -0
- package/dist/esm/popoutWindow.js +3 -1
- package/dist/package/main.cjs.js +169 -30
- package/dist/package/main.cjs.min.js +2 -2
- package/dist/package/main.esm.min.mjs +2 -2
- package/dist/package/main.esm.mjs +169 -30
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Position } from '../dnd/droptarget';
|
|
2
2
|
import { DockviewComponent } from '../dockview/dockviewComponent';
|
|
3
3
|
import { DockviewGroupPanel } from '../dockview/dockviewGroupPanel';
|
|
4
|
-
import { DockviewGroupChangeEvent, DockviewGroupLocation } from '../dockview/dockviewGroupPanelModel';
|
|
4
|
+
import { DockviewGroupChangeEvent, DockviewGroupLocation, DockviewGroupPanelLocked } from '../dockview/dockviewGroupPanelModel';
|
|
5
5
|
import { DockviewHeaderPosition } from '../dockview/options';
|
|
6
6
|
import { Emitter, Event } from '../events';
|
|
7
7
|
import { GridviewPanelApi, GridviewPanelApiImpl, SizeEvent } from './gridviewPanelApi';
|
|
@@ -29,6 +29,13 @@ export interface DockviewGroupPanelApi extends GridviewPanelApi {
|
|
|
29
29
|
*/
|
|
30
30
|
readonly onDidCollapsedChange: Event<DockviewGroupPanelCollapsedChangeEvent>;
|
|
31
31
|
readonly location: DockviewGroupLocation;
|
|
32
|
+
/**
|
|
33
|
+
* Whether this group is locked against drop interactions.
|
|
34
|
+
* - `true`: panels cannot be dropped into the group (center / tabs),
|
|
35
|
+
* but the group can still be split from its edges.
|
|
36
|
+
* - `'no-drop-target'`: all drop zones are disabled for this group.
|
|
37
|
+
*/
|
|
38
|
+
locked: DockviewGroupPanelLocked;
|
|
32
39
|
/**
|
|
33
40
|
* If you require the Window object
|
|
34
41
|
*/
|
|
@@ -68,6 +75,8 @@ export declare class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|
|
68
75
|
readonly _onDidCollapsedChange: Emitter<DockviewGroupPanelCollapsedChangeEvent>;
|
|
69
76
|
readonly onDidCollapsedChange: Event<DockviewGroupPanelCollapsedChangeEvent>;
|
|
70
77
|
get location(): DockviewGroupLocation;
|
|
78
|
+
get locked(): DockviewGroupPanelLocked;
|
|
79
|
+
set locked(value: DockviewGroupPanelLocked);
|
|
71
80
|
constructor(id: string, accessor: DockviewComponent);
|
|
72
81
|
setSize(event: SizeEvent): void;
|
|
73
82
|
close(): void;
|
|
@@ -61,6 +61,22 @@ var DockviewGroupPanelApiImpl = /** @class */ (function (_super) {
|
|
|
61
61
|
enumerable: false,
|
|
62
62
|
configurable: true
|
|
63
63
|
});
|
|
64
|
+
Object.defineProperty(DockviewGroupPanelApiImpl.prototype, "locked", {
|
|
65
|
+
get: function () {
|
|
66
|
+
if (!this._group) {
|
|
67
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
68
|
+
}
|
|
69
|
+
return this._group.locked;
|
|
70
|
+
},
|
|
71
|
+
set: function (value) {
|
|
72
|
+
if (!this._group) {
|
|
73
|
+
throw new Error(NOT_INITIALIZED_MESSAGE);
|
|
74
|
+
}
|
|
75
|
+
this._group.locked = value;
|
|
76
|
+
},
|
|
77
|
+
enumerable: false,
|
|
78
|
+
configurable: true
|
|
79
|
+
});
|
|
64
80
|
DockviewGroupPanelApiImpl.prototype.setSize = function (event) {
|
|
65
81
|
// Always store the requested size
|
|
66
82
|
this._pendingSize = __assign({}, event);
|
|
@@ -57,19 +57,41 @@ var GroupDragHandler = /** @class */ (function (_super) {
|
|
|
57
57
|
var bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
|
|
58
58
|
var color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
|
|
59
59
|
if (dataTransfer) {
|
|
60
|
-
var
|
|
61
|
-
ghostElement
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
var createGhost = this.accessor.options.createGroupDragGhostComponent;
|
|
61
|
+
var ghostElement = void 0;
|
|
62
|
+
var customRenderer = void 0;
|
|
63
|
+
if (createGhost) {
|
|
64
|
+
customRenderer = createGhost(this.group);
|
|
65
|
+
customRenderer.init({
|
|
66
|
+
group: this.group,
|
|
67
|
+
api: this.accessor.api,
|
|
68
|
+
});
|
|
69
|
+
ghostElement = customRenderer.element;
|
|
70
|
+
ghostElement.style.position = 'absolute';
|
|
71
|
+
ghostElement.style.pointerEvents = 'none';
|
|
72
|
+
ghostElement.style.top = '-9999px';
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
ghostElement = document.createElement('div');
|
|
76
|
+
ghostElement.style.backgroundColor = bgColor;
|
|
77
|
+
ghostElement.style.color = color;
|
|
78
|
+
ghostElement.style.padding = '2px 8px';
|
|
79
|
+
ghostElement.style.height = '24px';
|
|
80
|
+
ghostElement.style.fontSize = '11px';
|
|
81
|
+
ghostElement.style.lineHeight = '20px';
|
|
82
|
+
ghostElement.style.borderRadius = '12px';
|
|
83
|
+
ghostElement.style.position = 'absolute';
|
|
84
|
+
ghostElement.style.pointerEvents = 'none';
|
|
85
|
+
ghostElement.style.top = '-9999px';
|
|
86
|
+
ghostElement.textContent = "Multiple Panels (".concat(this.group.size, ")");
|
|
87
|
+
}
|
|
72
88
|
(0, ghost_1.addGhostImage)(dataTransfer, ghostElement, { y: -10, x: 30 });
|
|
89
|
+
if (customRenderer === null || customRenderer === void 0 ? void 0 : customRenderer.dispose) {
|
|
90
|
+
// addGhostImage removes the element from the DOM on the next
|
|
91
|
+
// tick; dispose the framework renderer on the same schedule.
|
|
92
|
+
var renderer_1 = customRenderer;
|
|
93
|
+
setTimeout(function () { var _a; return (_a = renderer_1.dispose) === null || _a === void 0 ? void 0 : _a.call(renderer_1); }, 0);
|
|
94
|
+
}
|
|
73
95
|
}
|
|
74
96
|
return {
|
|
75
97
|
dispose: function () {
|
|
@@ -350,7 +350,7 @@ var WrapTabGroupIndicator = /** @class */ (function (_super) {
|
|
|
350
350
|
var svg = underline.firstElementChild;
|
|
351
351
|
var path;
|
|
352
352
|
if (!svg || svg.tagName !== 'svg') {
|
|
353
|
-
underline.
|
|
353
|
+
underline.replaceChildren();
|
|
354
354
|
svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
355
355
|
svg.style.display = 'block';
|
|
356
356
|
path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
@@ -454,7 +454,7 @@ var NoneTabGroupIndicator = /** @class */ (function (_super) {
|
|
|
454
454
|
underline.style.display = '';
|
|
455
455
|
// Clear any SVG content left over from a mode switch
|
|
456
456
|
if (underline.firstElementChild) {
|
|
457
|
-
underline.
|
|
457
|
+
underline.replaceChildren();
|
|
458
458
|
}
|
|
459
459
|
underline.style.backgroundColor = color;
|
|
460
460
|
if (isVertical) {
|
|
@@ -1213,11 +1213,15 @@ var Tabs = /** @class */ (function (_super) {
|
|
|
1213
1213
|
if (!isInsideRange && !isJustBeforeGroup) {
|
|
1214
1214
|
return "continue";
|
|
1215
1215
|
}
|
|
1216
|
-
if (isGroupDrag) {
|
|
1216
|
+
if (isGroupDrag && isInsideRange) {
|
|
1217
1217
|
// A group cannot be dropped inside another group.
|
|
1218
1218
|
// Snap the insertion index to just before or just
|
|
1219
1219
|
// after this group based on cursor position relative
|
|
1220
|
-
// to the group's midpoint.
|
|
1220
|
+
// to the group's midpoint. Only applies when the
|
|
1221
|
+
// insertion would land *inside* the group — for
|
|
1222
|
+
// `isJustBeforeGroup`, the index is already outside
|
|
1223
|
+
// (immediately left of the group) and is a valid
|
|
1224
|
+
// drop position, so leave it untouched (issue #1264).
|
|
1221
1225
|
var groupMid = (firstIdx + lastIdx + 1) / 2;
|
|
1222
1226
|
if (insertionIndex < groupMid) {
|
|
1223
1227
|
insertionIndex = firstIdx;
|
|
@@ -1227,6 +1231,9 @@ var Tabs = /** @class */ (function (_super) {
|
|
|
1227
1231
|
}
|
|
1228
1232
|
return "break";
|
|
1229
1233
|
}
|
|
1234
|
+
if (isGroupDrag && isJustBeforeGroup) {
|
|
1235
|
+
return "break";
|
|
1236
|
+
}
|
|
1230
1237
|
if (isJustBeforeGroup) {
|
|
1231
1238
|
// Check whether only the source tab (or source group
|
|
1232
1239
|
// tabs) sits between insertionIndex and firstIdx.
|
|
@@ -43,6 +43,12 @@ var VoidContainer = /** @class */ (function (_super) {
|
|
|
43
43
|
_this.dropTarget = new droptarget_1.Droptarget(_this._element, {
|
|
44
44
|
acceptedTargetZones: ['center'],
|
|
45
45
|
canDisplayOverlay: function (event, position) {
|
|
46
|
+
if (_this.group.api.locked) {
|
|
47
|
+
// Dropping on the void/header space adds the panel
|
|
48
|
+
// to this group, which `locked` is meant to prevent
|
|
49
|
+
// (both `true` and `'no-drop-target'`).
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
46
52
|
var data = (0, dataTransfer_1.getPanelData)();
|
|
47
53
|
if (data && _this.accessor.id === data.viewId) {
|
|
48
54
|
return true;
|
|
@@ -262,6 +262,7 @@ export declare class DockviewComponent extends BaseGrid<DockviewGroupPanel> impl
|
|
|
262
262
|
private readonly _popoutGroups;
|
|
263
263
|
private readonly _rootDropTarget;
|
|
264
264
|
private _popoutRestorationPromise;
|
|
265
|
+
private readonly _popoutRestorationCleanups;
|
|
265
266
|
private readonly _onDidRemoveGroup;
|
|
266
267
|
readonly onDidRemoveGroup: Event<DockviewGroupPanel>;
|
|
267
268
|
protected readonly _onDidAddGroup: Emitter<DockviewGroupPanel>;
|