dockview-core 1.12.0 → 1.13.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 +2 -1
- package/dist/cjs/api/component.api.js +7 -0
- package/dist/cjs/api/dockviewGroupPanelApi.d.ts +5 -1
- package/dist/cjs/api/dockviewGroupPanelApi.js +19 -1
- package/dist/cjs/dnd/droptarget.d.ts +1 -1
- package/dist/cjs/dnd/droptarget.js +4 -10
- package/dist/cjs/dockview/components/panel/content.js +0 -8
- package/dist/cjs/dockview/dockviewComponent.d.ts +6 -4
- package/dist/cjs/dockview/dockviewComponent.js +73 -68
- package/dist/cjs/dockview/dockviewGroupPanelModel.d.ts +3 -0
- package/dist/cjs/dockview/dockviewGroupPanelModel.js +18 -19
- package/dist/cjs/dockview/dockviewPanelModel.js +21 -24
- package/dist/cjs/dockview/framework.d.ts +38 -0
- package/dist/cjs/dockview/framework.js +2 -0
- package/dist/cjs/dockview/options.d.ts +68 -46
- package/dist/cjs/dockview/options.js +43 -1
- package/dist/cjs/dockview/types.d.ts +4 -10
- package/dist/cjs/events.d.ts +13 -2
- package/dist/cjs/events.js +44 -12
- package/dist/cjs/framwork.d.ts +4 -0
- package/dist/cjs/framwork.js +2 -0
- package/dist/cjs/gridview/baseComponentGridview.d.ts +3 -4
- package/dist/cjs/gridview/baseComponentGridview.js +3 -7
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +1 -1
- package/dist/dockview-core.amd.js +2121 -2040
- 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 +2121 -2040
- package/dist/dockview-core.amd.noStyle.js.map +1 -1
- package/dist/dockview-core.cjs.js +2121 -2040
- package/dist/dockview-core.cjs.js.map +1 -1
- package/dist/dockview-core.esm.js +2120 -2041
- 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 +2121 -2040
- 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 +2121 -2040
- package/dist/dockview-core.noStyle.js.map +1 -1
- package/dist/esm/api/component.api.d.ts +2 -1
- package/dist/esm/api/component.api.js +3 -0
- package/dist/esm/api/dockviewGroupPanelApi.d.ts +5 -1
- package/dist/esm/api/dockviewGroupPanelApi.js +18 -1
- package/dist/esm/dnd/droptarget.d.ts +1 -1
- package/dist/esm/dnd/droptarget.js +4 -10
- package/dist/esm/dockview/components/panel/content.js +0 -8
- package/dist/esm/dockview/dockviewComponent.d.ts +6 -4
- package/dist/esm/dockview/dockviewComponent.js +72 -69
- package/dist/esm/dockview/dockviewGroupPanelModel.d.ts +3 -0
- package/dist/esm/dockview/dockviewGroupPanelModel.js +18 -19
- package/dist/esm/dockview/dockviewPanelModel.js +21 -13
- package/dist/esm/dockview/framework.d.ts +38 -0
- package/dist/esm/dockview/framework.js +1 -0
- package/dist/esm/dockview/options.d.ts +68 -46
- package/dist/esm/dockview/options.js +36 -0
- package/dist/esm/dockview/types.d.ts +4 -10
- package/dist/esm/events.d.ts +13 -2
- package/dist/esm/events.js +37 -6
- package/dist/esm/framwork.d.ts +4 -0
- package/dist/esm/framwork.js +1 -0
- package/dist/esm/gridview/baseComponentGridview.d.ts +3 -4
- package/dist/esm/gridview/baseComponentGridview.js +4 -8
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview-core
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.13.1
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -220,18 +220,49 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
220
220
|
},
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
|
-
|
|
223
|
+
/**
|
|
224
|
+
*
|
|
225
|
+
* Event Emitter that fires events from a Microtask callback, only one event will fire per event-loop cycle.
|
|
226
|
+
*
|
|
227
|
+
* It's kind of like using an `asapScheduler` in RxJs with additional logic to only fire once per event-loop cycle.
|
|
228
|
+
* This implementation exists to avoid external dependencies.
|
|
229
|
+
*
|
|
230
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask
|
|
231
|
+
* @see https://rxjs.dev/api/index/const/asapScheduler
|
|
232
|
+
*/
|
|
233
|
+
class AsapEvent {
|
|
224
234
|
constructor() {
|
|
225
235
|
this._onFired = new Emitter();
|
|
226
|
-
this.
|
|
236
|
+
this._currentFireCount = 0;
|
|
237
|
+
this._queued = false;
|
|
238
|
+
this.onEvent = (e) => {
|
|
239
|
+
/**
|
|
240
|
+
* when the event is first subscribed to take note of the current fire count
|
|
241
|
+
*/
|
|
242
|
+
const fireCountAtTimeOfEventSubscription = this._currentFireCount;
|
|
243
|
+
return this._onFired.event(() => {
|
|
244
|
+
/**
|
|
245
|
+
* if the current fire count is greater than the fire count at event subscription
|
|
246
|
+
* then the event has been fired since we subscribed and it's ok to "on_next" the event.
|
|
247
|
+
*
|
|
248
|
+
* if the count is not greater then what we are recieving is an event from the microtask
|
|
249
|
+
* queue that was triggered before we actually subscribed and therfore we should ignore it.
|
|
250
|
+
*/
|
|
251
|
+
if (this._currentFireCount > fireCountAtTimeOfEventSubscription) {
|
|
252
|
+
e();
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
};
|
|
227
256
|
}
|
|
228
257
|
fire() {
|
|
229
|
-
|
|
230
|
-
|
|
258
|
+
this._currentFireCount++;
|
|
259
|
+
if (this._queued) {
|
|
260
|
+
return;
|
|
231
261
|
}
|
|
232
|
-
this.
|
|
262
|
+
this._queued = true;
|
|
263
|
+
queueMicrotask(() => {
|
|
264
|
+
this._queued = false;
|
|
233
265
|
this._onFired.fire();
|
|
234
|
-
clearTimeout(this.timer);
|
|
235
266
|
});
|
|
236
267
|
}
|
|
237
268
|
dispose() {
|
|
@@ -2438,143 +2469,394 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2438
2469
|
}
|
|
2439
2470
|
}
|
|
2440
2471
|
|
|
2441
|
-
class
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
*/
|
|
2445
|
-
get minimumSize() {
|
|
2446
|
-
return this.component.minimumSize;
|
|
2472
|
+
class Resizable extends CompositeDisposable {
|
|
2473
|
+
get element() {
|
|
2474
|
+
return this._element;
|
|
2447
2475
|
}
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
*/
|
|
2451
|
-
get maximumSize() {
|
|
2452
|
-
return this.component.maximumSize;
|
|
2476
|
+
get disableResizing() {
|
|
2477
|
+
return this._disableResizing;
|
|
2453
2478
|
}
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
*/
|
|
2457
|
-
get width() {
|
|
2458
|
-
return this.component.width;
|
|
2479
|
+
set disableResizing(value) {
|
|
2480
|
+
this._disableResizing = value;
|
|
2459
2481
|
}
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2482
|
+
constructor(parentElement, disableResizing = false) {
|
|
2483
|
+
super();
|
|
2484
|
+
this._disableResizing = disableResizing;
|
|
2485
|
+
this._element = parentElement;
|
|
2486
|
+
this.addDisposables(watchElementResize(this._element, (entry) => {
|
|
2487
|
+
if (this.isDisposed) {
|
|
2488
|
+
/**
|
|
2489
|
+
* resize is delayed through requestAnimationFrame so there is a small chance
|
|
2490
|
+
* the component has already been disposed of
|
|
2491
|
+
*/
|
|
2492
|
+
return;
|
|
2493
|
+
}
|
|
2494
|
+
if (this.disableResizing) {
|
|
2495
|
+
return;
|
|
2496
|
+
}
|
|
2497
|
+
if (!this._element.offsetParent) {
|
|
2498
|
+
/**
|
|
2499
|
+
* offsetParent === null is equivalent to display: none being set on the element or one
|
|
2500
|
+
* of it's parents. In the display: none case the size will become (0, 0) which we do
|
|
2501
|
+
* not want to propagate.
|
|
2502
|
+
*
|
|
2503
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
|
|
2504
|
+
*
|
|
2505
|
+
* You could use checkVisibility() but at the time of writing it's not supported across
|
|
2506
|
+
* all Browsers
|
|
2507
|
+
*
|
|
2508
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility
|
|
2509
|
+
*/
|
|
2510
|
+
return;
|
|
2511
|
+
}
|
|
2512
|
+
if (!isInDocument(this._element)) {
|
|
2513
|
+
/**
|
|
2514
|
+
* since the event is dispatched through requestAnimationFrame there is a small chance
|
|
2515
|
+
* the component is no longer attached to the DOM, if that is the case the dimensions
|
|
2516
|
+
* are mostly likely all zero and meaningless. we should skip this case.
|
|
2517
|
+
*/
|
|
2518
|
+
return;
|
|
2519
|
+
}
|
|
2520
|
+
const { width, height } = entry.contentRect;
|
|
2521
|
+
this.layout(width, height);
|
|
2522
|
+
}));
|
|
2465
2523
|
}
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
const nextLayoutId$1 = sequentialNumberGenerator();
|
|
2527
|
+
function toTarget(direction) {
|
|
2528
|
+
switch (direction) {
|
|
2529
|
+
case 'left':
|
|
2530
|
+
return 'left';
|
|
2531
|
+
case 'right':
|
|
2532
|
+
return 'right';
|
|
2533
|
+
case 'above':
|
|
2534
|
+
return 'top';
|
|
2535
|
+
case 'below':
|
|
2536
|
+
return 'bottom';
|
|
2537
|
+
case 'within':
|
|
2538
|
+
default:
|
|
2539
|
+
return 'center';
|
|
2471
2540
|
}
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
return this.component.orientation;
|
|
2541
|
+
}
|
|
2542
|
+
class BaseGrid extends Resizable {
|
|
2543
|
+
get id() {
|
|
2544
|
+
return this._id;
|
|
2477
2545
|
}
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
*/
|
|
2481
|
-
get panels() {
|
|
2482
|
-
return this.component.panels;
|
|
2546
|
+
get size() {
|
|
2547
|
+
return this._groups.size;
|
|
2483
2548
|
}
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
*/
|
|
2487
|
-
get onDidLayoutFromJSON() {
|
|
2488
|
-
return this.component.onDidLayoutFromJSON;
|
|
2549
|
+
get groups() {
|
|
2550
|
+
return Array.from(this._groups.values()).map((_) => _.value);
|
|
2489
2551
|
}
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
* If listening to this event it may be worth debouncing ouputs.
|
|
2493
|
-
*/
|
|
2494
|
-
get onDidLayoutChange() {
|
|
2495
|
-
return this.component.onDidLayoutChange;
|
|
2552
|
+
get width() {
|
|
2553
|
+
return this.gridview.width;
|
|
2496
2554
|
}
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
*/
|
|
2500
|
-
get onDidAddView() {
|
|
2501
|
-
return this.component.onDidAddView;
|
|
2555
|
+
get height() {
|
|
2556
|
+
return this.gridview.height;
|
|
2502
2557
|
}
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
*/
|
|
2506
|
-
get onDidRemoveView() {
|
|
2507
|
-
return this.component.onDidRemoveView;
|
|
2558
|
+
get minimumHeight() {
|
|
2559
|
+
return this.gridview.minimumHeight;
|
|
2508
2560
|
}
|
|
2509
|
-
|
|
2510
|
-
this.
|
|
2561
|
+
get maximumHeight() {
|
|
2562
|
+
return this.gridview.maximumHeight;
|
|
2511
2563
|
}
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
*/
|
|
2515
|
-
updateOptions(options) {
|
|
2516
|
-
this.component.updateOptions(options);
|
|
2564
|
+
get minimumWidth() {
|
|
2565
|
+
return this.gridview.minimumWidth;
|
|
2517
2566
|
}
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
* for the subsequent resize.
|
|
2521
|
-
*/
|
|
2522
|
-
removePanel(panel, sizing) {
|
|
2523
|
-
this.component.removePanel(panel, sizing);
|
|
2567
|
+
get maximumWidth() {
|
|
2568
|
+
return this.gridview.maximumWidth;
|
|
2524
2569
|
}
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
*/
|
|
2528
|
-
focus() {
|
|
2529
|
-
this.component.focus();
|
|
2570
|
+
get activeGroup() {
|
|
2571
|
+
return this._activeGroup;
|
|
2530
2572
|
}
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
*/
|
|
2534
|
-
getPanel(id) {
|
|
2535
|
-
return this.component.getPanel(id);
|
|
2573
|
+
get locked() {
|
|
2574
|
+
return this.gridview.locked;
|
|
2536
2575
|
}
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
*/
|
|
2540
|
-
layout(width, height) {
|
|
2541
|
-
return this.component.layout(width, height);
|
|
2576
|
+
set locked(value) {
|
|
2577
|
+
this.gridview.locked = value;
|
|
2542
2578
|
}
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2579
|
+
constructor(options) {
|
|
2580
|
+
super(document.createElement('div'), options.disableAutoResizing);
|
|
2581
|
+
this._id = nextLayoutId$1.next();
|
|
2582
|
+
this._groups = new Map();
|
|
2583
|
+
this._onDidRemove = new Emitter();
|
|
2584
|
+
this.onDidRemove = this._onDidRemove.event;
|
|
2585
|
+
this._onDidAdd = new Emitter();
|
|
2586
|
+
this.onDidAdd = this._onDidAdd.event;
|
|
2587
|
+
this._onDidActiveChange = new Emitter();
|
|
2588
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
2589
|
+
this._bufferOnDidLayoutChange = new AsapEvent();
|
|
2590
|
+
this.onDidLayoutChange = this._bufferOnDidLayoutChange.onEvent;
|
|
2591
|
+
this.element.style.height = '100%';
|
|
2592
|
+
this.element.style.width = '100%';
|
|
2593
|
+
options.parentElement.appendChild(this.element);
|
|
2594
|
+
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
2595
|
+
this.gridview.locked = !!options.locked;
|
|
2596
|
+
this.element.appendChild(this.gridview.element);
|
|
2597
|
+
this.layout(0, 0, true); // set some elements height/widths
|
|
2598
|
+
this.addDisposables(Disposable.from(() => {
|
|
2599
|
+
var _a;
|
|
2600
|
+
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
2601
|
+
}), this.gridview.onDidChange(() => {
|
|
2602
|
+
this._bufferOnDidLayoutChange.fire();
|
|
2603
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
2604
|
+
this._bufferOnDidLayoutChange.fire();
|
|
2605
|
+
}), this._bufferOnDidLayoutChange);
|
|
2548
2606
|
}
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
movePanel(from, to) {
|
|
2553
|
-
this.component.movePanel(from, to);
|
|
2607
|
+
setVisible(panel, visible) {
|
|
2608
|
+
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
2609
|
+
this._bufferOnDidLayoutChange.fire();
|
|
2554
2610
|
}
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
*/
|
|
2558
|
-
fromJSON(data) {
|
|
2559
|
-
this.component.fromJSON(data);
|
|
2611
|
+
isVisible(panel) {
|
|
2612
|
+
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
2560
2613
|
}
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2614
|
+
maximizeGroup(panel) {
|
|
2615
|
+
this.gridview.maximizeView(panel);
|
|
2616
|
+
this.doSetGroupActive(panel);
|
|
2564
2617
|
}
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
*/
|
|
2568
|
-
clear() {
|
|
2569
|
-
this.component.clear();
|
|
2618
|
+
isMaximizedGroup(panel) {
|
|
2619
|
+
return this.gridview.maximizedView() === panel;
|
|
2570
2620
|
}
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2621
|
+
exitMaximizedGroup() {
|
|
2622
|
+
this.gridview.exitMaximizedView();
|
|
2623
|
+
}
|
|
2624
|
+
hasMaximizedGroup() {
|
|
2625
|
+
return this.gridview.hasMaximizedView();
|
|
2626
|
+
}
|
|
2627
|
+
get onDidMaximizedGroupChange() {
|
|
2628
|
+
return this.gridview.onDidMaximizedNodeChange;
|
|
2629
|
+
}
|
|
2630
|
+
doAddGroup(group, location = [0], size) {
|
|
2631
|
+
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
2632
|
+
this._onDidAdd.fire(group);
|
|
2633
|
+
}
|
|
2634
|
+
doRemoveGroup(group, options) {
|
|
2635
|
+
if (!this._groups.has(group.id)) {
|
|
2636
|
+
throw new Error('invalid operation');
|
|
2637
|
+
}
|
|
2638
|
+
const item = this._groups.get(group.id);
|
|
2639
|
+
const view = this.gridview.remove(group, exports.Sizing.Distribute);
|
|
2640
|
+
if (item && !(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
2641
|
+
item.disposable.dispose();
|
|
2642
|
+
item.value.dispose();
|
|
2643
|
+
this._groups.delete(group.id);
|
|
2644
|
+
this._onDidRemove.fire(group);
|
|
2645
|
+
}
|
|
2646
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
2647
|
+
const groups = Array.from(this._groups.values());
|
|
2648
|
+
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
2649
|
+
}
|
|
2650
|
+
return view;
|
|
2651
|
+
}
|
|
2652
|
+
getPanel(id) {
|
|
2653
|
+
var _a;
|
|
2654
|
+
return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
2655
|
+
}
|
|
2656
|
+
doSetGroupActive(group) {
|
|
2657
|
+
if (this._activeGroup === group) {
|
|
2658
|
+
return;
|
|
2659
|
+
}
|
|
2660
|
+
if (this._activeGroup) {
|
|
2661
|
+
this._activeGroup.setActive(false);
|
|
2662
|
+
}
|
|
2663
|
+
if (group) {
|
|
2664
|
+
group.setActive(true);
|
|
2665
|
+
}
|
|
2666
|
+
this._activeGroup = group;
|
|
2667
|
+
this._onDidActiveChange.fire(group);
|
|
2668
|
+
}
|
|
2669
|
+
removeGroup(group) {
|
|
2670
|
+
this.doRemoveGroup(group);
|
|
2671
|
+
}
|
|
2672
|
+
moveToNext(options) {
|
|
2673
|
+
var _a;
|
|
2674
|
+
if (!options) {
|
|
2675
|
+
options = {};
|
|
2676
|
+
}
|
|
2677
|
+
if (!options.group) {
|
|
2678
|
+
if (!this.activeGroup) {
|
|
2679
|
+
return;
|
|
2680
|
+
}
|
|
2681
|
+
options.group = this.activeGroup;
|
|
2682
|
+
}
|
|
2683
|
+
const location = getGridLocation(options.group.element);
|
|
2684
|
+
const next = (_a = this.gridview.next(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
2685
|
+
this.doSetGroupActive(next);
|
|
2686
|
+
}
|
|
2687
|
+
moveToPrevious(options) {
|
|
2688
|
+
var _a;
|
|
2689
|
+
if (!options) {
|
|
2690
|
+
options = {};
|
|
2691
|
+
}
|
|
2692
|
+
if (!options.group) {
|
|
2693
|
+
if (!this.activeGroup) {
|
|
2694
|
+
return;
|
|
2695
|
+
}
|
|
2696
|
+
options.group = this.activeGroup;
|
|
2697
|
+
}
|
|
2698
|
+
const location = getGridLocation(options.group.element);
|
|
2699
|
+
const next = (_a = this.gridview.previous(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
2700
|
+
this.doSetGroupActive(next);
|
|
2701
|
+
}
|
|
2702
|
+
layout(width, height, forceResize) {
|
|
2703
|
+
const different = forceResize !== null && forceResize !== void 0 ? forceResize : (width !== this.width || height !== this.height);
|
|
2704
|
+
if (!different) {
|
|
2705
|
+
return;
|
|
2706
|
+
}
|
|
2707
|
+
this.gridview.element.style.height = `${height}px`;
|
|
2708
|
+
this.gridview.element.style.width = `${width}px`;
|
|
2709
|
+
this.gridview.layout(width, height);
|
|
2710
|
+
}
|
|
2711
|
+
dispose() {
|
|
2712
|
+
this._onDidActiveChange.dispose();
|
|
2713
|
+
this._onDidAdd.dispose();
|
|
2714
|
+
this._onDidRemove.dispose();
|
|
2715
|
+
for (const group of this.groups) {
|
|
2716
|
+
group.dispose();
|
|
2717
|
+
}
|
|
2718
|
+
this.gridview.dispose();
|
|
2719
|
+
super.dispose();
|
|
2720
|
+
}
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
class SplitviewApi {
|
|
2724
|
+
/**
|
|
2725
|
+
* The minimum size the component can reach where size is measured in the direction of orientation provided.
|
|
2726
|
+
*/
|
|
2727
|
+
get minimumSize() {
|
|
2728
|
+
return this.component.minimumSize;
|
|
2729
|
+
}
|
|
2730
|
+
/**
|
|
2731
|
+
* The maximum size the component can reach where size is measured in the direction of orientation provided.
|
|
2732
|
+
*/
|
|
2733
|
+
get maximumSize() {
|
|
2734
|
+
return this.component.maximumSize;
|
|
2735
|
+
}
|
|
2736
|
+
/**
|
|
2737
|
+
* Width of the component.
|
|
2738
|
+
*/
|
|
2739
|
+
get width() {
|
|
2740
|
+
return this.component.width;
|
|
2741
|
+
}
|
|
2742
|
+
/**
|
|
2743
|
+
* Height of the component.
|
|
2744
|
+
*/
|
|
2745
|
+
get height() {
|
|
2746
|
+
return this.component.height;
|
|
2747
|
+
}
|
|
2748
|
+
/**
|
|
2749
|
+
* The current number of panels.
|
|
2750
|
+
*/
|
|
2751
|
+
get length() {
|
|
2752
|
+
return this.component.length;
|
|
2753
|
+
}
|
|
2754
|
+
/**
|
|
2755
|
+
* The current orientation of the component.
|
|
2756
|
+
*/
|
|
2757
|
+
get orientation() {
|
|
2758
|
+
return this.component.orientation;
|
|
2759
|
+
}
|
|
2760
|
+
/**
|
|
2761
|
+
* The list of current panels.
|
|
2762
|
+
*/
|
|
2763
|
+
get panels() {
|
|
2764
|
+
return this.component.panels;
|
|
2765
|
+
}
|
|
2766
|
+
/**
|
|
2767
|
+
* Invoked after a layout is loaded through the `fromJSON` method.
|
|
2768
|
+
*/
|
|
2769
|
+
get onDidLayoutFromJSON() {
|
|
2770
|
+
return this.component.onDidLayoutFromJSON;
|
|
2771
|
+
}
|
|
2772
|
+
/**
|
|
2773
|
+
* Invoked whenever any aspect of the layout changes.
|
|
2774
|
+
* If listening to this event it may be worth debouncing ouputs.
|
|
2775
|
+
*/
|
|
2776
|
+
get onDidLayoutChange() {
|
|
2777
|
+
return this.component.onDidLayoutChange;
|
|
2778
|
+
}
|
|
2779
|
+
/**
|
|
2780
|
+
* Invoked when a view is added.
|
|
2781
|
+
*/
|
|
2782
|
+
get onDidAddView() {
|
|
2783
|
+
return this.component.onDidAddView;
|
|
2784
|
+
}
|
|
2785
|
+
/**
|
|
2786
|
+
* Invoked when a view is removed.
|
|
2787
|
+
*/
|
|
2788
|
+
get onDidRemoveView() {
|
|
2789
|
+
return this.component.onDidRemoveView;
|
|
2790
|
+
}
|
|
2791
|
+
constructor(component) {
|
|
2792
|
+
this.component = component;
|
|
2793
|
+
}
|
|
2794
|
+
/**
|
|
2795
|
+
* Update configuratable options.
|
|
2796
|
+
*/
|
|
2797
|
+
updateOptions(options) {
|
|
2798
|
+
this.component.updateOptions(options);
|
|
2799
|
+
}
|
|
2800
|
+
/**
|
|
2801
|
+
* Removes an existing panel and optionally provide a `Sizing` method
|
|
2802
|
+
* for the subsequent resize.
|
|
2803
|
+
*/
|
|
2804
|
+
removePanel(panel, sizing) {
|
|
2805
|
+
this.component.removePanel(panel, sizing);
|
|
2806
|
+
}
|
|
2807
|
+
/**
|
|
2808
|
+
* Focus the component.
|
|
2809
|
+
*/
|
|
2810
|
+
focus() {
|
|
2811
|
+
this.component.focus();
|
|
2812
|
+
}
|
|
2813
|
+
/**
|
|
2814
|
+
* Get the reference to a panel given it's `string` id.
|
|
2815
|
+
*/
|
|
2816
|
+
getPanel(id) {
|
|
2817
|
+
return this.component.getPanel(id);
|
|
2818
|
+
}
|
|
2819
|
+
/**
|
|
2820
|
+
* Layout the panel with a width and height.
|
|
2821
|
+
*/
|
|
2822
|
+
layout(width, height) {
|
|
2823
|
+
return this.component.layout(width, height);
|
|
2824
|
+
}
|
|
2825
|
+
/**
|
|
2826
|
+
* Add a new panel and return the created instance.
|
|
2827
|
+
*/
|
|
2828
|
+
addPanel(options) {
|
|
2829
|
+
return this.component.addPanel(options);
|
|
2830
|
+
}
|
|
2831
|
+
/**
|
|
2832
|
+
* Move a panel given it's current and desired index.
|
|
2833
|
+
*/
|
|
2834
|
+
movePanel(from, to) {
|
|
2835
|
+
this.component.movePanel(from, to);
|
|
2836
|
+
}
|
|
2837
|
+
/**
|
|
2838
|
+
* Deserialize a layout to built a splitivew.
|
|
2839
|
+
*/
|
|
2840
|
+
fromJSON(data) {
|
|
2841
|
+
this.component.fromJSON(data);
|
|
2842
|
+
}
|
|
2843
|
+
/** Serialize a layout */
|
|
2844
|
+
toJSON() {
|
|
2845
|
+
return this.component.toJSON();
|
|
2846
|
+
}
|
|
2847
|
+
/**
|
|
2848
|
+
* Remove all panels and clear the component.
|
|
2849
|
+
*/
|
|
2850
|
+
clear() {
|
|
2851
|
+
this.component.clear();
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2854
|
+
class PaneviewApi {
|
|
2855
|
+
/**
|
|
2856
|
+
* The minimum size the component can reach where size is measured in the direction of orientation provided.
|
|
2857
|
+
*/
|
|
2858
|
+
get minimumSize() {
|
|
2859
|
+
return this.component.minimumSize;
|
|
2578
2860
|
}
|
|
2579
2861
|
/**
|
|
2580
2862
|
* The maximum size the component can reach where size is measured in the direction of orientation provided.
|
|
@@ -2980,6 +3262,9 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
2980
3262
|
get onWillDragPanel() {
|
|
2981
3263
|
return this.component.onWillDragPanel;
|
|
2982
3264
|
}
|
|
3265
|
+
get onUnhandledDragOverEvent() {
|
|
3266
|
+
return this.component.onUnhandledDragOverEvent;
|
|
3267
|
+
}
|
|
2983
3268
|
/**
|
|
2984
3269
|
* All panel objects.
|
|
2985
3270
|
*/
|
|
@@ -3117,17 +3402,78 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3117
3402
|
}
|
|
3118
3403
|
}
|
|
3119
3404
|
|
|
3120
|
-
class
|
|
3121
|
-
constructor(
|
|
3405
|
+
class DragHandler extends CompositeDisposable {
|
|
3406
|
+
constructor(el) {
|
|
3122
3407
|
super();
|
|
3123
|
-
this.
|
|
3124
|
-
this.
|
|
3125
|
-
this.
|
|
3126
|
-
this.
|
|
3408
|
+
this.el = el;
|
|
3409
|
+
this.dataDisposable = new MutableDisposable();
|
|
3410
|
+
this.pointerEventsDisposable = new MutableDisposable();
|
|
3411
|
+
this._onDragStart = new Emitter();
|
|
3412
|
+
this.onDragStart = this._onDragStart.event;
|
|
3413
|
+
this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
|
|
3414
|
+
this.configure();
|
|
3127
3415
|
}
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3416
|
+
isCancelled(_event) {
|
|
3417
|
+
return false;
|
|
3418
|
+
}
|
|
3419
|
+
configure() {
|
|
3420
|
+
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
3421
|
+
if (event.defaultPrevented || this.isCancelled(event)) {
|
|
3422
|
+
event.preventDefault();
|
|
3423
|
+
return;
|
|
3424
|
+
}
|
|
3425
|
+
const iframes = [
|
|
3426
|
+
...getElementsByTagName('iframe'),
|
|
3427
|
+
...getElementsByTagName('webview'),
|
|
3428
|
+
];
|
|
3429
|
+
this.pointerEventsDisposable.value = {
|
|
3430
|
+
dispose: () => {
|
|
3431
|
+
for (const iframe of iframes) {
|
|
3432
|
+
iframe.style.pointerEvents = 'auto';
|
|
3433
|
+
}
|
|
3434
|
+
},
|
|
3435
|
+
};
|
|
3436
|
+
for (const iframe of iframes) {
|
|
3437
|
+
iframe.style.pointerEvents = 'none';
|
|
3438
|
+
}
|
|
3439
|
+
this.el.classList.add('dv-dragged');
|
|
3440
|
+
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
3441
|
+
this.dataDisposable.value = this.getData(event);
|
|
3442
|
+
this._onDragStart.fire(event);
|
|
3443
|
+
if (event.dataTransfer) {
|
|
3444
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
3445
|
+
const hasData = event.dataTransfer.items.length > 0;
|
|
3446
|
+
if (!hasData) {
|
|
3447
|
+
/**
|
|
3448
|
+
* Although this is not used by dockview many third party dnd libraries will check
|
|
3449
|
+
* dataTransfer.types to determine valid drag events.
|
|
3450
|
+
*
|
|
3451
|
+
* For example: in react-dnd if dataTransfer.types is not set then the dragStart event will be cancelled
|
|
3452
|
+
* through .preventDefault(). Since this is applied globally to all drag events this would break dockviews
|
|
3453
|
+
* dnd logic. You can see the code at
|
|
3454
|
+
* https://github.com/react-dnd/react-dnd/blob/main/packages/backend-html5/src/HTML5BackendImpl.ts#L542
|
|
3455
|
+
*/
|
|
3456
|
+
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
}), addDisposableListener(this.el, 'dragend', () => {
|
|
3460
|
+
this.pointerEventsDisposable.dispose();
|
|
3461
|
+
this.dataDisposable.dispose();
|
|
3462
|
+
}));
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
|
|
3466
|
+
class DragAndDropObserver extends CompositeDisposable {
|
|
3467
|
+
constructor(element, callbacks) {
|
|
3468
|
+
super();
|
|
3469
|
+
this.element = element;
|
|
3470
|
+
this.callbacks = callbacks;
|
|
3471
|
+
this.target = null;
|
|
3472
|
+
this.registerListeners();
|
|
3473
|
+
}
|
|
3474
|
+
onDragEnter(e) {
|
|
3475
|
+
this.target = e.target;
|
|
3476
|
+
this.callbacks.onDragEnter(e);
|
|
3131
3477
|
}
|
|
3132
3478
|
onDragOver(e) {
|
|
3133
3479
|
e.preventDefault(); // needed so that the drop event fires (https://stackoverflow.com/questions/21339924/drop-event-not-firing-in-chrome)
|
|
@@ -3261,6 +3607,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3261
3607
|
this.removeDropTarget();
|
|
3262
3608
|
return;
|
|
3263
3609
|
}
|
|
3610
|
+
if (!this.options.canDisplayOverlay(e, quadrant)) {
|
|
3611
|
+
this.removeDropTarget();
|
|
3612
|
+
return;
|
|
3613
|
+
}
|
|
3264
3614
|
const willShowOverlayEvent = new WillShowOverlayEvent({
|
|
3265
3615
|
nativeEvent: e,
|
|
3266
3616
|
position: quadrant,
|
|
@@ -3274,16 +3624,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3274
3624
|
this.removeDropTarget();
|
|
3275
3625
|
return;
|
|
3276
3626
|
}
|
|
3277
|
-
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
|
3278
|
-
if (!this.options.canDisplayOverlay) {
|
|
3279
|
-
this.removeDropTarget();
|
|
3280
|
-
return;
|
|
3281
|
-
}
|
|
3282
|
-
}
|
|
3283
|
-
else if (!this.options.canDisplayOverlay(e, quadrant)) {
|
|
3284
|
-
this.removeDropTarget();
|
|
3285
|
-
return;
|
|
3286
|
-
}
|
|
3287
3627
|
this.markAsUsed(e);
|
|
3288
3628
|
if (!this.targetElement) {
|
|
3289
3629
|
this.targetElement = document.createElement('div');
|
|
@@ -3474,2023 +3814,1758 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
3474
3814
|
return 'center';
|
|
3475
3815
|
}
|
|
3476
3816
|
|
|
3477
|
-
class
|
|
3478
|
-
|
|
3479
|
-
return this._element;
|
|
3480
|
-
}
|
|
3481
|
-
constructor(accessor, group) {
|
|
3817
|
+
class WillFocusEvent extends DockviewEvent {
|
|
3818
|
+
constructor() {
|
|
3482
3819
|
super();
|
|
3483
|
-
this.accessor = accessor;
|
|
3484
|
-
this.group = group;
|
|
3485
|
-
this.disposable = new MutableDisposable();
|
|
3486
|
-
this._onDidFocus = new Emitter();
|
|
3487
|
-
this.onDidFocus = this._onDidFocus.event;
|
|
3488
|
-
this._onDidBlur = new Emitter();
|
|
3489
|
-
this.onDidBlur = this._onDidBlur.event;
|
|
3490
|
-
this._element = document.createElement('div');
|
|
3491
|
-
this._element.className = 'content-container';
|
|
3492
|
-
this._element.tabIndex = -1;
|
|
3493
|
-
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
3494
|
-
this.dropTarget = new Droptarget(this.element, {
|
|
3495
|
-
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
3496
|
-
canDisplayOverlay: (event, position) => {
|
|
3497
|
-
if (this.group.locked === 'no-drop-target' ||
|
|
3498
|
-
(this.group.locked && position === 'center')) {
|
|
3499
|
-
return false;
|
|
3500
|
-
}
|
|
3501
|
-
const data = getPanelData();
|
|
3502
|
-
if (!data &&
|
|
3503
|
-
event.shiftKey &&
|
|
3504
|
-
this.group.location.type !== 'floating') {
|
|
3505
|
-
return false;
|
|
3506
|
-
}
|
|
3507
|
-
if (data && data.viewId === this.accessor.id) {
|
|
3508
|
-
if (data.groupId === this.group.id) {
|
|
3509
|
-
if (position === 'center') {
|
|
3510
|
-
// don't allow to drop on self for center position
|
|
3511
|
-
return false;
|
|
3512
|
-
}
|
|
3513
|
-
if (data.panelId === null) {
|
|
3514
|
-
// don't allow group move to drop anywhere on self
|
|
3515
|
-
return false;
|
|
3516
|
-
}
|
|
3517
|
-
}
|
|
3518
|
-
const groupHasOnePanelAndIsActiveDragElement = this.group.panels.length === 1 &&
|
|
3519
|
-
data.groupId === this.group.id;
|
|
3520
|
-
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3521
|
-
}
|
|
3522
|
-
return this.group.canDisplayOverlay(event, position, 'content');
|
|
3523
|
-
},
|
|
3524
|
-
});
|
|
3525
|
-
this.addDisposables(this.dropTarget);
|
|
3526
3820
|
}
|
|
3527
|
-
|
|
3528
|
-
|
|
3821
|
+
}
|
|
3822
|
+
/**
|
|
3823
|
+
* A core api implementation that should be used across all panel-like objects
|
|
3824
|
+
*/
|
|
3825
|
+
class PanelApiImpl extends CompositeDisposable {
|
|
3826
|
+
get isFocused() {
|
|
3827
|
+
return this._isFocused;
|
|
3529
3828
|
}
|
|
3530
|
-
|
|
3531
|
-
this.
|
|
3829
|
+
get isActive() {
|
|
3830
|
+
return this._isActive;
|
|
3532
3831
|
}
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
(this.panel && this.group.isPanelActive(this.panel));
|
|
3536
|
-
if (this.panel &&
|
|
3537
|
-
this.panel.view.content.element.parentElement === this._element) {
|
|
3538
|
-
/**
|
|
3539
|
-
* If the currently attached panel is mounted directly to the content then remove it
|
|
3540
|
-
*/
|
|
3541
|
-
this._element.removeChild(this.panel.view.content.element);
|
|
3542
|
-
}
|
|
3543
|
-
this.panel = panel;
|
|
3544
|
-
let container;
|
|
3545
|
-
switch (panel.api.renderer) {
|
|
3546
|
-
case 'onlyWhenVisible':
|
|
3547
|
-
this.group.renderContainer.detatch(panel);
|
|
3548
|
-
if (this.panel) {
|
|
3549
|
-
if (doRender) {
|
|
3550
|
-
this._element.appendChild(this.panel.view.content.element);
|
|
3551
|
-
}
|
|
3552
|
-
}
|
|
3553
|
-
container = this._element;
|
|
3554
|
-
break;
|
|
3555
|
-
case 'always':
|
|
3556
|
-
if (panel.view.content.element.parentElement === this._element) {
|
|
3557
|
-
this._element.removeChild(panel.view.content.element);
|
|
3558
|
-
}
|
|
3559
|
-
container = this.group.renderContainer.attach({
|
|
3560
|
-
panel,
|
|
3561
|
-
referenceContainer: this,
|
|
3562
|
-
});
|
|
3563
|
-
break;
|
|
3564
|
-
}
|
|
3565
|
-
if (doRender) {
|
|
3566
|
-
const _onDidFocus = panel.view.content.onDidFocus;
|
|
3567
|
-
const _onDidBlur = panel.view.content.onDidBlur;
|
|
3568
|
-
const focusTracker = trackFocus(container);
|
|
3569
|
-
const disposable = new CompositeDisposable();
|
|
3570
|
-
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
3571
|
-
if (_onDidFocus) {
|
|
3572
|
-
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
3573
|
-
}
|
|
3574
|
-
if (_onDidBlur) {
|
|
3575
|
-
disposable.addDisposables(_onDidBlur(() => this._onDidBlur.fire()));
|
|
3576
|
-
}
|
|
3577
|
-
this.disposable.value = disposable;
|
|
3578
|
-
}
|
|
3832
|
+
get isVisible() {
|
|
3833
|
+
return this._isVisible;
|
|
3579
3834
|
}
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
return;
|
|
3583
|
-
}
|
|
3584
|
-
this.renderPanel(panel);
|
|
3835
|
+
get width() {
|
|
3836
|
+
return this._width;
|
|
3585
3837
|
}
|
|
3586
|
-
|
|
3587
|
-
|
|
3838
|
+
get height() {
|
|
3839
|
+
return this._height;
|
|
3588
3840
|
}
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
this.
|
|
3841
|
+
constructor(id, component) {
|
|
3842
|
+
super();
|
|
3843
|
+
this.id = id;
|
|
3844
|
+
this.component = component;
|
|
3845
|
+
this._isFocused = false;
|
|
3846
|
+
this._isActive = false;
|
|
3847
|
+
this._isVisible = true;
|
|
3848
|
+
this._width = 0;
|
|
3849
|
+
this._height = 0;
|
|
3850
|
+
this._parameters = {};
|
|
3851
|
+
this.panelUpdatesDisposable = new MutableDisposable();
|
|
3852
|
+
this._onDidDimensionChange = new Emitter();
|
|
3853
|
+
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
3854
|
+
this._onDidChangeFocus = new Emitter();
|
|
3855
|
+
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
3856
|
+
//
|
|
3857
|
+
this._onWillFocus = new Emitter();
|
|
3858
|
+
this.onWillFocus = this._onWillFocus.event;
|
|
3859
|
+
//
|
|
3860
|
+
this._onDidVisibilityChange = new Emitter();
|
|
3861
|
+
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
3862
|
+
this._onWillVisibilityChange = new Emitter();
|
|
3863
|
+
this.onWillVisibilityChange = this._onWillVisibilityChange.event;
|
|
3864
|
+
this._onDidActiveChange = new Emitter();
|
|
3865
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
3866
|
+
this._onActiveChange = new Emitter();
|
|
3867
|
+
this.onActiveChange = this._onActiveChange.event;
|
|
3868
|
+
this._onDidParametersChange = new Emitter();
|
|
3869
|
+
this.onDidParametersChange = this._onDidParametersChange.event;
|
|
3870
|
+
this.addDisposables(this.onDidFocusChange((event) => {
|
|
3871
|
+
this._isFocused = event.isFocused;
|
|
3872
|
+
}), this.onDidActiveChange((event) => {
|
|
3873
|
+
this._isActive = event.isActive;
|
|
3874
|
+
}), this.onDidVisibilityChange((event) => {
|
|
3875
|
+
this._isVisible = event.isVisible;
|
|
3876
|
+
}), this.onDidDimensionsChange((event) => {
|
|
3877
|
+
this._width = event.width;
|
|
3878
|
+
this._height = event.height;
|
|
3879
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);
|
|
3597
3880
|
}
|
|
3598
|
-
|
|
3599
|
-
this.
|
|
3600
|
-
|
|
3881
|
+
getParameters() {
|
|
3882
|
+
return this._parameters;
|
|
3883
|
+
}
|
|
3884
|
+
initialize(panel) {
|
|
3885
|
+
this.panelUpdatesDisposable.value = this._onDidParametersChange.event((parameters) => {
|
|
3886
|
+
this._parameters = parameters;
|
|
3887
|
+
panel.update({
|
|
3888
|
+
params: parameters,
|
|
3889
|
+
});
|
|
3890
|
+
});
|
|
3891
|
+
}
|
|
3892
|
+
setVisible(isVisible) {
|
|
3893
|
+
this._onWillVisibilityChange.fire({ isVisible });
|
|
3894
|
+
}
|
|
3895
|
+
setActive() {
|
|
3896
|
+
this._onActiveChange.fire();
|
|
3897
|
+
}
|
|
3898
|
+
updateParameters(parameters) {
|
|
3899
|
+
this._onDidParametersChange.fire(parameters);
|
|
3601
3900
|
}
|
|
3602
3901
|
}
|
|
3603
3902
|
|
|
3604
|
-
class
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
this.
|
|
3609
|
-
this.
|
|
3610
|
-
|
|
3611
|
-
this.
|
|
3612
|
-
|
|
3613
|
-
|
|
3903
|
+
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
3904
|
+
//
|
|
3905
|
+
constructor(id, component) {
|
|
3906
|
+
super(id, component);
|
|
3907
|
+
this._onDidConstraintsChangeInternal = new Emitter();
|
|
3908
|
+
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
3909
|
+
//
|
|
3910
|
+
this._onDidConstraintsChange = new Emitter({
|
|
3911
|
+
replay: true,
|
|
3912
|
+
});
|
|
3913
|
+
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
3914
|
+
//
|
|
3915
|
+
this._onDidSizeChange = new Emitter();
|
|
3916
|
+
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
3917
|
+
this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
|
|
3614
3918
|
}
|
|
3615
|
-
|
|
3616
|
-
|
|
3919
|
+
setConstraints(value) {
|
|
3920
|
+
this._onDidConstraintsChangeInternal.fire(value);
|
|
3617
3921
|
}
|
|
3618
|
-
|
|
3619
|
-
this.
|
|
3620
|
-
if (event.defaultPrevented || this.isCancelled(event)) {
|
|
3621
|
-
event.preventDefault();
|
|
3622
|
-
return;
|
|
3623
|
-
}
|
|
3624
|
-
const iframes = [
|
|
3625
|
-
...getElementsByTagName('iframe'),
|
|
3626
|
-
...getElementsByTagName('webview'),
|
|
3627
|
-
];
|
|
3628
|
-
this.pointerEventsDisposable.value = {
|
|
3629
|
-
dispose: () => {
|
|
3630
|
-
for (const iframe of iframes) {
|
|
3631
|
-
iframe.style.pointerEvents = 'auto';
|
|
3632
|
-
}
|
|
3633
|
-
},
|
|
3634
|
-
};
|
|
3635
|
-
for (const iframe of iframes) {
|
|
3636
|
-
iframe.style.pointerEvents = 'none';
|
|
3637
|
-
}
|
|
3638
|
-
this.el.classList.add('dv-dragged');
|
|
3639
|
-
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
3640
|
-
this.dataDisposable.value = this.getData(event);
|
|
3641
|
-
this._onDragStart.fire(event);
|
|
3642
|
-
if (event.dataTransfer) {
|
|
3643
|
-
event.dataTransfer.effectAllowed = 'move';
|
|
3644
|
-
const hasData = event.dataTransfer.items.length > 0;
|
|
3645
|
-
if (!hasData) {
|
|
3646
|
-
/**
|
|
3647
|
-
* Although this is not used by dockview many third party dnd libraries will check
|
|
3648
|
-
* dataTransfer.types to determine valid drag events.
|
|
3649
|
-
*
|
|
3650
|
-
* For example: in react-dnd if dataTransfer.types is not set then the dragStart event will be cancelled
|
|
3651
|
-
* through .preventDefault(). Since this is applied globally to all drag events this would break dockviews
|
|
3652
|
-
* dnd logic. You can see the code at
|
|
3653
|
-
* https://github.com/react-dnd/react-dnd/blob/main/packages/backend-html5/src/HTML5BackendImpl.ts#L542
|
|
3654
|
-
*/
|
|
3655
|
-
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
3656
|
-
}
|
|
3657
|
-
}
|
|
3658
|
-
}), addDisposableListener(this.el, 'dragend', () => {
|
|
3659
|
-
this.pointerEventsDisposable.dispose();
|
|
3660
|
-
this.dataDisposable.dispose();
|
|
3661
|
-
}));
|
|
3922
|
+
setSize(event) {
|
|
3923
|
+
this._onDidSizeChange.fire(event);
|
|
3662
3924
|
}
|
|
3663
3925
|
}
|
|
3664
3926
|
|
|
3665
|
-
class
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
this.accessor = accessor;
|
|
3669
|
-
this.group = group;
|
|
3670
|
-
this.panel = panel;
|
|
3671
|
-
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
3927
|
+
class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
|
|
3928
|
+
set pane(pane) {
|
|
3929
|
+
this._pane = pane;
|
|
3672
3930
|
}
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
};
|
|
3931
|
+
constructor(id, component) {
|
|
3932
|
+
super(id, component);
|
|
3933
|
+
this._onDidExpansionChange = new Emitter({
|
|
3934
|
+
replay: true,
|
|
3935
|
+
});
|
|
3936
|
+
this.onDidExpansionChange = this._onDidExpansionChange.event;
|
|
3937
|
+
this._onMouseEnter = new Emitter({});
|
|
3938
|
+
this.onMouseEnter = this._onMouseEnter.event;
|
|
3939
|
+
this._onMouseLeave = new Emitter({});
|
|
3940
|
+
this.onMouseLeave = this._onMouseLeave.event;
|
|
3941
|
+
this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
|
|
3942
|
+
}
|
|
3943
|
+
setExpanded(isExpanded) {
|
|
3944
|
+
var _a;
|
|
3945
|
+
(_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
|
|
3946
|
+
}
|
|
3947
|
+
get isExpanded() {
|
|
3948
|
+
var _a;
|
|
3949
|
+
return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
|
|
3680
3950
|
}
|
|
3681
3951
|
}
|
|
3682
|
-
|
|
3952
|
+
|
|
3953
|
+
class BasePanelView extends CompositeDisposable {
|
|
3683
3954
|
get element() {
|
|
3684
3955
|
return this._element;
|
|
3685
3956
|
}
|
|
3686
|
-
|
|
3957
|
+
get width() {
|
|
3958
|
+
return this._width;
|
|
3959
|
+
}
|
|
3960
|
+
get height() {
|
|
3961
|
+
return this._height;
|
|
3962
|
+
}
|
|
3963
|
+
get params() {
|
|
3964
|
+
var _a;
|
|
3965
|
+
return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
|
|
3966
|
+
}
|
|
3967
|
+
constructor(id, component, api) {
|
|
3687
3968
|
super();
|
|
3688
|
-
this.
|
|
3689
|
-
this.
|
|
3690
|
-
this.
|
|
3691
|
-
this.
|
|
3692
|
-
this.
|
|
3693
|
-
this.onChanged = this._onChanged.event;
|
|
3694
|
-
this._onDropped = new Emitter();
|
|
3695
|
-
this.onDrop = this._onDropped.event;
|
|
3696
|
-
this._onDragStart = new Emitter();
|
|
3697
|
-
this.onDragStart = this._onDragStart.event;
|
|
3969
|
+
this.id = id;
|
|
3970
|
+
this.component = component;
|
|
3971
|
+
this.api = api;
|
|
3972
|
+
this._height = 0;
|
|
3973
|
+
this._width = 0;
|
|
3698
3974
|
this._element = document.createElement('div');
|
|
3699
|
-
this._element.
|
|
3700
|
-
this._element.
|
|
3701
|
-
this._element.
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
this.
|
|
3723
|
-
|
|
3724
|
-
this.
|
|
3725
|
-
|
|
3726
|
-
if (event.defaultPrevented) {
|
|
3727
|
-
return;
|
|
3975
|
+
this._element.tabIndex = -1;
|
|
3976
|
+
this._element.style.outline = 'none';
|
|
3977
|
+
this._element.style.height = '100%';
|
|
3978
|
+
this._element.style.width = '100%';
|
|
3979
|
+
this._element.style.overflow = 'hidden';
|
|
3980
|
+
const focusTracker = trackFocus(this._element);
|
|
3981
|
+
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
3982
|
+
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
3983
|
+
}), focusTracker.onDidBlur(() => {
|
|
3984
|
+
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
3985
|
+
}), focusTracker);
|
|
3986
|
+
}
|
|
3987
|
+
focus() {
|
|
3988
|
+
const event = new WillFocusEvent();
|
|
3989
|
+
this.api._onWillFocus.fire(event);
|
|
3990
|
+
if (event.defaultPrevented) {
|
|
3991
|
+
return;
|
|
3992
|
+
}
|
|
3993
|
+
this._element.focus();
|
|
3994
|
+
}
|
|
3995
|
+
layout(width, height) {
|
|
3996
|
+
this._width = width;
|
|
3997
|
+
this._height = height;
|
|
3998
|
+
this.api._onDidDimensionChange.fire({ width, height });
|
|
3999
|
+
if (this.part) {
|
|
4000
|
+
if (this._params) {
|
|
4001
|
+
this.part.update(this._params.params);
|
|
3728
4002
|
}
|
|
3729
|
-
|
|
3730
|
-
}), this.dropTarget.onDrop((event) => {
|
|
3731
|
-
this._onDropped.fire(event);
|
|
3732
|
-
}), this.dropTarget);
|
|
4003
|
+
}
|
|
3733
4004
|
}
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
4005
|
+
init(parameters) {
|
|
4006
|
+
this._params = parameters;
|
|
4007
|
+
this.part = this.getComponent();
|
|
3737
4008
|
}
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
4009
|
+
update(event) {
|
|
4010
|
+
var _a, _b;
|
|
4011
|
+
// merge the new parameters with the existing parameters
|
|
4012
|
+
this._params = Object.assign(Object.assign({}, this._params), { params: Object.assign(Object.assign({}, (_a = this._params) === null || _a === void 0 ? void 0 : _a.params), event.params) });
|
|
4013
|
+
/**
|
|
4014
|
+
* delete new keys that have a value of undefined,
|
|
4015
|
+
* allow values of null
|
|
4016
|
+
*/
|
|
4017
|
+
for (const key of Object.keys(event.params)) {
|
|
4018
|
+
if (event.params[key] === undefined) {
|
|
4019
|
+
delete this._params.params[key];
|
|
4020
|
+
}
|
|
3741
4021
|
}
|
|
3742
|
-
|
|
3743
|
-
this.
|
|
4022
|
+
// update the view with the updated props
|
|
4023
|
+
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
4024
|
+
}
|
|
4025
|
+
toJSON() {
|
|
4026
|
+
var _a, _b;
|
|
4027
|
+
const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
4028
|
+
return {
|
|
4029
|
+
id: this.id,
|
|
4030
|
+
component: this.component,
|
|
4031
|
+
params: Object.keys(params).length > 0 ? params : undefined,
|
|
4032
|
+
};
|
|
3744
4033
|
}
|
|
3745
4034
|
dispose() {
|
|
4035
|
+
var _a;
|
|
4036
|
+
this.api.dispose();
|
|
4037
|
+
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
3746
4038
|
super.dispose();
|
|
3747
4039
|
}
|
|
3748
4040
|
}
|
|
3749
4041
|
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
document.body.appendChild(ghostElement);
|
|
3754
|
-
dataTransfer.setDragImage(ghostElement, 0, 0);
|
|
3755
|
-
setTimeout(() => {
|
|
3756
|
-
removeClasses(ghostElement, 'dv-dragged');
|
|
3757
|
-
ghostElement.remove();
|
|
3758
|
-
}, 0);
|
|
3759
|
-
}
|
|
3760
|
-
|
|
3761
|
-
class GroupDragHandler extends DragHandler {
|
|
3762
|
-
constructor(element, accessor, group) {
|
|
3763
|
-
super(element);
|
|
3764
|
-
this.accessor = accessor;
|
|
3765
|
-
this.group = group;
|
|
3766
|
-
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
3767
|
-
this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
|
|
3768
|
-
if (e.shiftKey) {
|
|
3769
|
-
/**
|
|
3770
|
-
* You cannot call e.preventDefault() because that will prevent drag events from firing
|
|
3771
|
-
* but we also need to stop any group overlay drag events from occuring
|
|
3772
|
-
* Use a custom event marker that can be checked by the overlay drag events
|
|
3773
|
-
*/
|
|
3774
|
-
quasiPreventDefault(e);
|
|
3775
|
-
}
|
|
3776
|
-
}, true));
|
|
4042
|
+
class PaneviewPanel extends BasePanelView {
|
|
4043
|
+
set orientation(value) {
|
|
4044
|
+
this._orientation = value;
|
|
3777
4045
|
}
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
return true;
|
|
3781
|
-
}
|
|
3782
|
-
return false;
|
|
4046
|
+
get orientation() {
|
|
4047
|
+
return this._orientation;
|
|
3783
4048
|
}
|
|
3784
|
-
|
|
3785
|
-
const
|
|
3786
|
-
|
|
3787
|
-
const
|
|
3788
|
-
|
|
3789
|
-
const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
|
|
3790
|
-
if (dataTransfer) {
|
|
3791
|
-
const ghostElement = document.createElement('div');
|
|
3792
|
-
ghostElement.style.backgroundColor = bgColor;
|
|
3793
|
-
ghostElement.style.color = color;
|
|
3794
|
-
ghostElement.style.padding = '2px 8px';
|
|
3795
|
-
ghostElement.style.height = '24px';
|
|
3796
|
-
ghostElement.style.fontSize = '11px';
|
|
3797
|
-
ghostElement.style.lineHeight = '20px';
|
|
3798
|
-
ghostElement.style.borderRadius = '12px';
|
|
3799
|
-
ghostElement.style.position = 'absolute';
|
|
3800
|
-
ghostElement.textContent = `Multiple Panels (${this.group.size})`;
|
|
3801
|
-
addGhostImage(dataTransfer, ghostElement);
|
|
3802
|
-
}
|
|
3803
|
-
return {
|
|
3804
|
-
dispose: () => {
|
|
3805
|
-
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
3806
|
-
},
|
|
3807
|
-
};
|
|
4049
|
+
get minimumSize() {
|
|
4050
|
+
const headerSize = this.headerSize;
|
|
4051
|
+
const expanded = this.isExpanded();
|
|
4052
|
+
const minimumBodySize = expanded ? this._minimumBodySize : 0;
|
|
4053
|
+
return headerSize + minimumBodySize;
|
|
3808
4054
|
}
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
return
|
|
4055
|
+
get maximumSize() {
|
|
4056
|
+
const headerSize = this.headerSize;
|
|
4057
|
+
const expanded = this.isExpanded();
|
|
4058
|
+
const maximumBodySize = expanded ? this._maximumBodySize : 0;
|
|
4059
|
+
return headerSize + maximumBodySize;
|
|
3814
4060
|
}
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
this.accessor = accessor;
|
|
3818
|
-
this.group = group;
|
|
3819
|
-
this._onDrop = new Emitter();
|
|
3820
|
-
this.onDrop = this._onDrop.event;
|
|
3821
|
-
this._onDragStart = new Emitter();
|
|
3822
|
-
this.onDragStart = this._onDragStart.event;
|
|
3823
|
-
this._element = document.createElement('div');
|
|
3824
|
-
this._element.className = 'void-container';
|
|
3825
|
-
this._element.tabIndex = 0;
|
|
3826
|
-
this._element.draggable = true;
|
|
3827
|
-
this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'click', () => {
|
|
3828
|
-
this.accessor.doSetGroupActive(this.group);
|
|
3829
|
-
}));
|
|
3830
|
-
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3831
|
-
this.dropTraget = new Droptarget(this._element, {
|
|
3832
|
-
acceptedTargetZones: ['center'],
|
|
3833
|
-
canDisplayOverlay: (event, position) => {
|
|
3834
|
-
var _a;
|
|
3835
|
-
const data = getPanelData();
|
|
3836
|
-
if (data && this.accessor.id === data.viewId) {
|
|
3837
|
-
if (data.panelId === null &&
|
|
3838
|
-
data.groupId === this.group.id) {
|
|
3839
|
-
// don't allow group move to drop on self
|
|
3840
|
-
return false;
|
|
3841
|
-
}
|
|
3842
|
-
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
3843
|
-
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
3844
|
-
}
|
|
3845
|
-
return group.model.canDisplayOverlay(event, position, 'header_space');
|
|
3846
|
-
},
|
|
3847
|
-
});
|
|
3848
|
-
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
3849
|
-
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3850
|
-
this._onDragStart.fire(event);
|
|
3851
|
-
}), this.dropTraget.onDrop((event) => {
|
|
3852
|
-
this._onDrop.fire(event);
|
|
3853
|
-
}), this.dropTraget);
|
|
4061
|
+
get size() {
|
|
4062
|
+
return this._size;
|
|
3854
4063
|
}
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
class TabsContainer extends CompositeDisposable {
|
|
3858
|
-
get panels() {
|
|
3859
|
-
return this.tabs.map((_) => _.value.panel.id);
|
|
4064
|
+
get orthogonalSize() {
|
|
4065
|
+
return this._orthogonalSize;
|
|
3860
4066
|
}
|
|
3861
|
-
|
|
3862
|
-
|
|
4067
|
+
set orthogonalSize(size) {
|
|
4068
|
+
this._orthogonalSize = size;
|
|
3863
4069
|
}
|
|
3864
|
-
get
|
|
3865
|
-
return this.
|
|
4070
|
+
get minimumBodySize() {
|
|
4071
|
+
return this._minimumBodySize;
|
|
3866
4072
|
}
|
|
3867
|
-
set
|
|
3868
|
-
this.
|
|
3869
|
-
this.element.style.display = value ? 'none' : '';
|
|
4073
|
+
set minimumBodySize(value) {
|
|
4074
|
+
this._minimumBodySize = typeof value === 'number' ? value : 0;
|
|
3870
4075
|
}
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
this.element.style.display = '';
|
|
3874
|
-
}
|
|
4076
|
+
get maximumBodySize() {
|
|
4077
|
+
return this._maximumBodySize;
|
|
3875
4078
|
}
|
|
3876
|
-
|
|
3877
|
-
this.
|
|
4079
|
+
set maximumBodySize(value) {
|
|
4080
|
+
this._maximumBodySize =
|
|
4081
|
+
typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
|
|
3878
4082
|
}
|
|
3879
|
-
|
|
3880
|
-
|
|
4083
|
+
get headerVisible() {
|
|
4084
|
+
return this._headerVisible;
|
|
4085
|
+
}
|
|
4086
|
+
set headerVisible(value) {
|
|
4087
|
+
this._headerVisible = value;
|
|
4088
|
+
this.header.style.display = value ? '' : 'none';
|
|
4089
|
+
}
|
|
4090
|
+
constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
|
|
4091
|
+
super(id, component, new PaneviewPanelApiImpl(id, component));
|
|
4092
|
+
this.headerComponent = headerComponent;
|
|
4093
|
+
this._onDidChangeExpansionState = new Emitter({ replay: true });
|
|
4094
|
+
this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
|
|
4095
|
+
this._onDidChange = new Emitter();
|
|
4096
|
+
this.onDidChange = this._onDidChange.event;
|
|
4097
|
+
this.headerSize = 22;
|
|
4098
|
+
this._orthogonalSize = 0;
|
|
4099
|
+
this._size = 0;
|
|
4100
|
+
this._minimumBodySize = 100;
|
|
4101
|
+
this._maximumBodySize = Number.POSITIVE_INFINITY;
|
|
4102
|
+
this._isExpanded = false;
|
|
4103
|
+
this.expandedSize = 0;
|
|
4104
|
+
this.api.pane = this; // TODO cannot use 'this' before 'super'
|
|
4105
|
+
this.api.initialize(this);
|
|
4106
|
+
this._isExpanded = isExpanded;
|
|
4107
|
+
this._headerVisible = isHeaderVisible;
|
|
4108
|
+
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
|
|
4109
|
+
this._orientation = orientation;
|
|
4110
|
+
this.element.classList.add('pane');
|
|
4111
|
+
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
4112
|
+
const { isVisible } = event;
|
|
4113
|
+
const { accessor } = this._params;
|
|
4114
|
+
accessor.setVisible(this, isVisible);
|
|
4115
|
+
}), this.api.onDidSizeChange((event) => {
|
|
4116
|
+
this._onDidChange.fire({ size: event.size });
|
|
4117
|
+
}), addDisposableListener(this.element, 'mouseenter', (ev) => {
|
|
4118
|
+
this.api._onMouseEnter.fire(ev);
|
|
4119
|
+
}), addDisposableListener(this.element, 'mouseleave', (ev) => {
|
|
4120
|
+
this.api._onMouseLeave.fire(ev);
|
|
4121
|
+
}));
|
|
4122
|
+
this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {
|
|
4123
|
+
this.api._onDidExpansionChange.fire({
|
|
4124
|
+
isExpanded: isPanelExpanded,
|
|
4125
|
+
});
|
|
4126
|
+
}), this.api.onDidFocusChange((e) => {
|
|
4127
|
+
if (!this.header) {
|
|
4128
|
+
return;
|
|
4129
|
+
}
|
|
4130
|
+
if (e.isFocused) {
|
|
4131
|
+
addClasses(this.header, 'focused');
|
|
4132
|
+
}
|
|
4133
|
+
else {
|
|
4134
|
+
removeClasses(this.header, 'focused');
|
|
4135
|
+
}
|
|
4136
|
+
}));
|
|
4137
|
+
this.renderOnce();
|
|
4138
|
+
}
|
|
4139
|
+
setVisible(isVisible) {
|
|
4140
|
+
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
4141
|
+
}
|
|
4142
|
+
setActive(isActive) {
|
|
4143
|
+
this.api._onDidActiveChange.fire({ isActive });
|
|
4144
|
+
}
|
|
4145
|
+
isExpanded() {
|
|
4146
|
+
return this._isExpanded;
|
|
4147
|
+
}
|
|
4148
|
+
setExpanded(expanded) {
|
|
4149
|
+
if (this._isExpanded === expanded) {
|
|
3881
4150
|
return;
|
|
3882
4151
|
}
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
this.
|
|
4152
|
+
this._isExpanded = expanded;
|
|
4153
|
+
if (expanded) {
|
|
4154
|
+
if (this.animationTimer) {
|
|
4155
|
+
clearTimeout(this.animationTimer);
|
|
4156
|
+
}
|
|
4157
|
+
if (this.body) {
|
|
4158
|
+
this.element.appendChild(this.body);
|
|
4159
|
+
}
|
|
3886
4160
|
}
|
|
3887
|
-
|
|
3888
|
-
this.
|
|
3889
|
-
|
|
4161
|
+
else {
|
|
4162
|
+
this.animationTimer = setTimeout(() => {
|
|
4163
|
+
var _a;
|
|
4164
|
+
(_a = this.body) === null || _a === void 0 ? void 0 : _a.remove();
|
|
4165
|
+
}, 200);
|
|
3890
4166
|
}
|
|
4167
|
+
this._onDidChange.fire(expanded ? { size: this.width } : {});
|
|
4168
|
+
this._onDidChangeExpansionState.fire(expanded);
|
|
3891
4169
|
}
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
if (element) {
|
|
3901
|
-
this.leftActionsContainer.appendChild(element);
|
|
3902
|
-
this.leftActions = element;
|
|
4170
|
+
layout(size, orthogonalSize) {
|
|
4171
|
+
this._size = size;
|
|
4172
|
+
this._orthogonalSize = orthogonalSize;
|
|
4173
|
+
const [width, height] = this.orientation === exports.Orientation.HORIZONTAL
|
|
4174
|
+
? [size, orthogonalSize]
|
|
4175
|
+
: [orthogonalSize, size];
|
|
4176
|
+
if (this.isExpanded()) {
|
|
4177
|
+
this.expandedSize = width;
|
|
3903
4178
|
}
|
|
4179
|
+
super.layout(width, height);
|
|
3904
4180
|
}
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
4181
|
+
init(parameters) {
|
|
4182
|
+
var _a, _b;
|
|
4183
|
+
super.init(parameters);
|
|
4184
|
+
if (typeof parameters.minimumBodySize === 'number') {
|
|
4185
|
+
this.minimumBodySize = parameters.minimumBodySize;
|
|
3908
4186
|
}
|
|
3909
|
-
if (
|
|
3910
|
-
this.
|
|
3911
|
-
this.preActions = undefined;
|
|
4187
|
+
if (typeof parameters.maximumBodySize === 'number') {
|
|
4188
|
+
this.maximumBodySize = parameters.maximumBodySize;
|
|
3912
4189
|
}
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
4190
|
+
this.bodyPart = this.getBodyComponent();
|
|
4191
|
+
this.headerPart = this.getHeaderComponent();
|
|
4192
|
+
this.bodyPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
|
|
4193
|
+
this.headerPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
|
|
4194
|
+
(_a = this.body) === null || _a === void 0 ? void 0 : _a.append(this.bodyPart.element);
|
|
4195
|
+
(_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);
|
|
4196
|
+
if (typeof parameters.isExpanded === 'boolean') {
|
|
4197
|
+
this.setExpanded(parameters.isExpanded);
|
|
3916
4198
|
}
|
|
3917
4199
|
}
|
|
3918
|
-
|
|
3919
|
-
|
|
4200
|
+
toJSON() {
|
|
4201
|
+
const params = this._params;
|
|
4202
|
+
return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
|
|
3920
4203
|
}
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
4204
|
+
renderOnce() {
|
|
4205
|
+
this.header = document.createElement('div');
|
|
4206
|
+
this.header.tabIndex = 0;
|
|
4207
|
+
this.header.className = 'pane-header';
|
|
4208
|
+
this.header.style.height = `${this.headerSize}px`;
|
|
4209
|
+
this.header.style.lineHeight = `${this.headerSize}px`;
|
|
4210
|
+
this.header.style.minHeight = `${this.headerSize}px`;
|
|
4211
|
+
this.header.style.maxHeight = `${this.headerSize}px`;
|
|
4212
|
+
this.element.appendChild(this.header);
|
|
4213
|
+
this.body = document.createElement('div');
|
|
4214
|
+
this.body.className = 'pane-body';
|
|
4215
|
+
this.element.appendChild(this.body);
|
|
3924
4216
|
}
|
|
3925
|
-
|
|
3926
|
-
|
|
4217
|
+
// TODO slightly hacky by-pass of the component to create a body and header component
|
|
4218
|
+
getComponent() {
|
|
4219
|
+
return {
|
|
4220
|
+
update: (params) => {
|
|
4221
|
+
var _a, _b;
|
|
4222
|
+
(_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.update({ params });
|
|
4223
|
+
(_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.update({ params });
|
|
4224
|
+
},
|
|
4225
|
+
dispose: () => {
|
|
4226
|
+
var _a, _b;
|
|
4227
|
+
(_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4228
|
+
(_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
4229
|
+
},
|
|
4230
|
+
};
|
|
3927
4231
|
}
|
|
3928
|
-
|
|
3929
|
-
|
|
4232
|
+
}
|
|
4233
|
+
|
|
4234
|
+
class DraggablePaneviewPanel extends PaneviewPanel {
|
|
4235
|
+
constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
4236
|
+
super(id, component, headerComponent, orientation, isExpanded, true);
|
|
3930
4237
|
this.accessor = accessor;
|
|
3931
|
-
this.
|
|
3932
|
-
this.
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
this._onDrop = new Emitter();
|
|
3936
|
-
this.onDrop = this._onDrop.event;
|
|
3937
|
-
this._onTabDragStart = new Emitter();
|
|
3938
|
-
this.onTabDragStart = this._onTabDragStart.event;
|
|
3939
|
-
this._onGroupDragStart = new Emitter();
|
|
3940
|
-
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3941
|
-
this._onWillShowOverlay = new Emitter();
|
|
3942
|
-
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3943
|
-
this._element = document.createElement('div');
|
|
3944
|
-
this._element.className = 'tabs-and-actions-container';
|
|
3945
|
-
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
3946
|
-
this.rightActionsContainer = document.createElement('div');
|
|
3947
|
-
this.rightActionsContainer.className = 'right-actions-container';
|
|
3948
|
-
this.leftActionsContainer = document.createElement('div');
|
|
3949
|
-
this.leftActionsContainer.className = 'left-actions-container';
|
|
3950
|
-
this.preActionsContainer = document.createElement('div');
|
|
3951
|
-
this.preActionsContainer.className = 'pre-actions-container';
|
|
3952
|
-
this.tabContainer = document.createElement('div');
|
|
3953
|
-
this.tabContainer.className = 'tabs-container';
|
|
3954
|
-
this.voidContainer = new VoidContainer(this.accessor, this.group);
|
|
3955
|
-
this._element.appendChild(this.preActionsContainer);
|
|
3956
|
-
this._element.appendChild(this.tabContainer);
|
|
3957
|
-
this._element.appendChild(this.leftActionsContainer);
|
|
3958
|
-
this._element.appendChild(this.voidContainer.element);
|
|
3959
|
-
this._element.appendChild(this.rightActionsContainer);
|
|
3960
|
-
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3961
|
-
if (e.api.group === this.group) {
|
|
3962
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3963
|
-
}
|
|
3964
|
-
}), this.accessor.onDidRemovePanel((e) => {
|
|
3965
|
-
if (e.api.group === this.group) {
|
|
3966
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3967
|
-
}
|
|
3968
|
-
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3969
|
-
this._onGroupDragStart.fire({
|
|
3970
|
-
nativeEvent: event,
|
|
3971
|
-
group: this.group,
|
|
3972
|
-
});
|
|
3973
|
-
}), this.voidContainer.onDrop((event) => {
|
|
3974
|
-
this._onDrop.fire({
|
|
3975
|
-
event: event.nativeEvent,
|
|
3976
|
-
index: this.tabs.length,
|
|
3977
|
-
});
|
|
3978
|
-
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
3979
|
-
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
3980
|
-
kind: 'header_space',
|
|
3981
|
-
panel: this.group.activePanel,
|
|
3982
|
-
api: this.accessor.api,
|
|
3983
|
-
group: this.group,
|
|
3984
|
-
getData: getPanelData,
|
|
3985
|
-
}));
|
|
3986
|
-
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
3987
|
-
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3988
|
-
if (isFloatingGroupsEnabled &&
|
|
3989
|
-
event.shiftKey &&
|
|
3990
|
-
this.group.api.location.type !== 'floating') {
|
|
3991
|
-
event.preventDefault();
|
|
3992
|
-
const { top, left } = this.element.getBoundingClientRect();
|
|
3993
|
-
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
3994
|
-
this.accessor.addFloatingGroup(this.group, {
|
|
3995
|
-
x: left - rootLeft + 20,
|
|
3996
|
-
y: top - rootTop + 20,
|
|
3997
|
-
}, { inDragMode: true });
|
|
3998
|
-
}
|
|
3999
|
-
}), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
4000
|
-
if (event.defaultPrevented) {
|
|
4001
|
-
return;
|
|
4002
|
-
}
|
|
4003
|
-
const isLeftClick = event.button === 0;
|
|
4004
|
-
if (isLeftClick) {
|
|
4005
|
-
this.accessor.doSetGroupActive(this.group);
|
|
4006
|
-
}
|
|
4007
|
-
}));
|
|
4008
|
-
}
|
|
4009
|
-
setActive(_isGroupActive) {
|
|
4010
|
-
// noop
|
|
4011
|
-
}
|
|
4012
|
-
addTab(tab, index = this.tabs.length) {
|
|
4013
|
-
if (index < 0 || index > this.tabs.length) {
|
|
4014
|
-
throw new Error('invalid location');
|
|
4015
|
-
}
|
|
4016
|
-
this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
|
|
4017
|
-
this.tabs = [
|
|
4018
|
-
...this.tabs.slice(0, index),
|
|
4019
|
-
tab,
|
|
4020
|
-
...this.tabs.slice(index),
|
|
4021
|
-
];
|
|
4022
|
-
if (this.selectedIndex < 0) {
|
|
4023
|
-
this.selectedIndex = index;
|
|
4238
|
+
this._onDidDrop = new Emitter();
|
|
4239
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
4240
|
+
if (!disableDnd) {
|
|
4241
|
+
this.initDragFeatures();
|
|
4024
4242
|
}
|
|
4025
4243
|
}
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4244
|
+
initDragFeatures() {
|
|
4245
|
+
if (!this.header) {
|
|
4246
|
+
return;
|
|
4247
|
+
}
|
|
4248
|
+
const id = this.id;
|
|
4249
|
+
const accessorId = this.accessor.id;
|
|
4250
|
+
this.header.draggable = true;
|
|
4251
|
+
this.handler = new (class PaneDragHandler extends DragHandler {
|
|
4252
|
+
getData() {
|
|
4253
|
+
LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
|
|
4254
|
+
return {
|
|
4255
|
+
dispose: () => {
|
|
4256
|
+
LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
|
|
4257
|
+
},
|
|
4258
|
+
};
|
|
4259
|
+
}
|
|
4260
|
+
})(this.header);
|
|
4261
|
+
this.target = new Droptarget(this.element, {
|
|
4262
|
+
acceptedTargetZones: ['top', 'bottom'],
|
|
4263
|
+
overlayModel: {
|
|
4264
|
+
activationSize: { type: 'percentage', value: 50 },
|
|
4265
|
+
},
|
|
4266
|
+
canDisplayOverlay: (event) => {
|
|
4267
|
+
const data = getPaneData();
|
|
4268
|
+
if (data) {
|
|
4269
|
+
if (data.paneId !== this.id &&
|
|
4270
|
+
data.viewId === this.accessor.id) {
|
|
4271
|
+
return true;
|
|
4272
|
+
}
|
|
4273
|
+
}
|
|
4274
|
+
if (this.accessor.options.showDndOverlay) {
|
|
4275
|
+
return this.accessor.options.showDndOverlay({
|
|
4276
|
+
nativeEvent: event,
|
|
4277
|
+
getData: getPaneData,
|
|
4278
|
+
panel: this,
|
|
4279
|
+
});
|
|
4280
|
+
}
|
|
4281
|
+
return false;
|
|
4282
|
+
},
|
|
4038
4283
|
});
|
|
4284
|
+
this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
|
|
4285
|
+
this.onDrop(event);
|
|
4286
|
+
}));
|
|
4039
4287
|
}
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
if (
|
|
4288
|
+
onDrop(event) {
|
|
4289
|
+
const data = getPaneData();
|
|
4290
|
+
if (!data || data.viewId !== this.accessor.id) {
|
|
4291
|
+
// if there is no local drag event for this panel
|
|
4292
|
+
// or if the drag event was creating by another Paneview instance
|
|
4293
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, api: new PaneviewApi(this.accessor), getData: getPaneData }));
|
|
4043
4294
|
return;
|
|
4044
4295
|
}
|
|
4045
|
-
const
|
|
4046
|
-
|
|
4047
|
-
|
|
4296
|
+
const containerApi = this._params
|
|
4297
|
+
.containerApi;
|
|
4298
|
+
const panelId = data.paneId;
|
|
4299
|
+
const existingPanel = containerApi.getPanel(panelId);
|
|
4300
|
+
if (!existingPanel) {
|
|
4301
|
+
// if the panel doesn't exist
|
|
4302
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData, api: new PaneviewApi(this.accessor) }));
|
|
4303
|
+
return;
|
|
4048
4304
|
}
|
|
4049
|
-
|
|
4050
|
-
const
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
if (
|
|
4057
|
-
|
|
4058
|
-
event.shiftKey) {
|
|
4059
|
-
event.preventDefault();
|
|
4060
|
-
const panel = this.accessor.getGroupPanel(tab.panel.id);
|
|
4061
|
-
const { top, left } = tab.element.getBoundingClientRect();
|
|
4062
|
-
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
4063
|
-
this.accessor.addFloatingGroup(panel, {
|
|
4064
|
-
x: left - rootLeft,
|
|
4065
|
-
y: top - rootTop,
|
|
4066
|
-
}, { inDragMode: true });
|
|
4067
|
-
return;
|
|
4068
|
-
}
|
|
4069
|
-
const isLeftClick = event.button === 0;
|
|
4070
|
-
if (!isLeftClick || event.defaultPrevented) {
|
|
4071
|
-
return;
|
|
4305
|
+
const allPanels = containerApi.panels;
|
|
4306
|
+
const fromIndex = allPanels.indexOf(existingPanel);
|
|
4307
|
+
let toIndex = containerApi.panels.indexOf(this);
|
|
4308
|
+
if (event.position === 'left' || event.position === 'top') {
|
|
4309
|
+
toIndex = Math.max(0, toIndex - 1);
|
|
4310
|
+
}
|
|
4311
|
+
if (event.position === 'right' || event.position === 'bottom') {
|
|
4312
|
+
if (fromIndex > toIndex) {
|
|
4313
|
+
toIndex++;
|
|
4072
4314
|
}
|
|
4073
|
-
|
|
4074
|
-
this.group.model.openPanel(panel);
|
|
4075
|
-
}
|
|
4076
|
-
}), tab.onDrop((event) => {
|
|
4077
|
-
this._onDrop.fire({
|
|
4078
|
-
event: event.nativeEvent,
|
|
4079
|
-
index: this.tabs.findIndex((x) => x.value === tab),
|
|
4080
|
-
});
|
|
4081
|
-
}), tab.onWillShowOverlay((event) => {
|
|
4082
|
-
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4083
|
-
kind: 'tab',
|
|
4084
|
-
panel: this.group.activePanel,
|
|
4085
|
-
api: this.accessor.api,
|
|
4086
|
-
group: this.group,
|
|
4087
|
-
getData: getPanelData,
|
|
4088
|
-
}));
|
|
4089
|
-
}));
|
|
4090
|
-
const value = { value: tab, disposable };
|
|
4091
|
-
this.addTab(value, index);
|
|
4092
|
-
}
|
|
4093
|
-
closePanel(panel) {
|
|
4094
|
-
this.delete(panel.id);
|
|
4095
|
-
}
|
|
4096
|
-
dispose() {
|
|
4097
|
-
super.dispose();
|
|
4098
|
-
for (const { value, disposable } of this.tabs) {
|
|
4099
|
-
disposable.dispose();
|
|
4100
|
-
value.dispose();
|
|
4315
|
+
toIndex = Math.min(allPanels.length - 1, toIndex);
|
|
4101
4316
|
}
|
|
4102
|
-
|
|
4317
|
+
containerApi.movePanel(fromIndex, toIndex);
|
|
4103
4318
|
}
|
|
4104
4319
|
}
|
|
4105
4320
|
|
|
4106
|
-
class
|
|
4107
|
-
get nativeEvent() {
|
|
4108
|
-
return this.options.nativeEvent;
|
|
4109
|
-
}
|
|
4110
|
-
get position() {
|
|
4111
|
-
return this.options.position;
|
|
4112
|
-
}
|
|
4113
|
-
get panel() {
|
|
4114
|
-
return this.options.panel;
|
|
4115
|
-
}
|
|
4116
|
-
get group() {
|
|
4117
|
-
return this.options.group;
|
|
4118
|
-
}
|
|
4119
|
-
get api() {
|
|
4120
|
-
return this.options.api;
|
|
4121
|
-
}
|
|
4122
|
-
constructor(options) {
|
|
4123
|
-
super();
|
|
4124
|
-
this.options = options;
|
|
4125
|
-
}
|
|
4126
|
-
getData() {
|
|
4127
|
-
return this.options.getData();
|
|
4128
|
-
}
|
|
4129
|
-
}
|
|
4130
|
-
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4131
|
-
get kind() {
|
|
4132
|
-
return this._kind;
|
|
4133
|
-
}
|
|
4134
|
-
constructor(options) {
|
|
4135
|
-
super(options);
|
|
4136
|
-
this._kind = options.kind;
|
|
4137
|
-
}
|
|
4138
|
-
}
|
|
4139
|
-
class WillShowOverlayLocationEvent {
|
|
4140
|
-
get kind() {
|
|
4141
|
-
return this.options.kind;
|
|
4142
|
-
}
|
|
4143
|
-
get nativeEvent() {
|
|
4144
|
-
return this.event.nativeEvent;
|
|
4145
|
-
}
|
|
4146
|
-
get position() {
|
|
4147
|
-
return this.event.position;
|
|
4148
|
-
}
|
|
4149
|
-
get defaultPrevented() {
|
|
4150
|
-
return this.event.defaultPrevented;
|
|
4151
|
-
}
|
|
4152
|
-
get panel() {
|
|
4153
|
-
return this.options.panel;
|
|
4154
|
-
}
|
|
4155
|
-
get api() {
|
|
4156
|
-
return this.options.api;
|
|
4157
|
-
}
|
|
4158
|
-
get group() {
|
|
4159
|
-
return this.options.group;
|
|
4160
|
-
}
|
|
4161
|
-
preventDefault() {
|
|
4162
|
-
this.event.preventDefault();
|
|
4163
|
-
}
|
|
4164
|
-
getData() {
|
|
4165
|
-
return this.options.getData();
|
|
4166
|
-
}
|
|
4167
|
-
constructor(event, options) {
|
|
4168
|
-
this.event = event;
|
|
4169
|
-
this.options = options;
|
|
4170
|
-
}
|
|
4171
|
-
}
|
|
4172
|
-
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
4321
|
+
class ContentContainer extends CompositeDisposable {
|
|
4173
4322
|
get element() {
|
|
4174
|
-
|
|
4175
|
-
}
|
|
4176
|
-
get activePanel() {
|
|
4177
|
-
return this._activePanel;
|
|
4178
|
-
}
|
|
4179
|
-
get locked() {
|
|
4180
|
-
return this._locked;
|
|
4181
|
-
}
|
|
4182
|
-
set locked(value) {
|
|
4183
|
-
this._locked = value;
|
|
4184
|
-
toggleClass(this.container, 'locked-groupview', value === 'no-drop-target' || value);
|
|
4185
|
-
}
|
|
4186
|
-
get isActive() {
|
|
4187
|
-
return this._isGroupActive;
|
|
4188
|
-
}
|
|
4189
|
-
get panels() {
|
|
4190
|
-
return this._panels;
|
|
4191
|
-
}
|
|
4192
|
-
get size() {
|
|
4193
|
-
return this._panels.length;
|
|
4194
|
-
}
|
|
4195
|
-
get isEmpty() {
|
|
4196
|
-
return this._panels.length === 0;
|
|
4197
|
-
}
|
|
4198
|
-
get hasWatermark() {
|
|
4199
|
-
return !!(this.watermark && this.container.contains(this.watermark.element));
|
|
4200
|
-
}
|
|
4201
|
-
get header() {
|
|
4202
|
-
return this.tabsContainer;
|
|
4203
|
-
}
|
|
4204
|
-
get isContentFocused() {
|
|
4205
|
-
if (!document.activeElement) {
|
|
4206
|
-
return false;
|
|
4207
|
-
}
|
|
4208
|
-
return isAncestor(document.activeElement, this.contentContainer.element);
|
|
4209
|
-
}
|
|
4210
|
-
get location() {
|
|
4211
|
-
return this._location;
|
|
4212
|
-
}
|
|
4213
|
-
set location(value) {
|
|
4214
|
-
this._location = value;
|
|
4215
|
-
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4216
|
-
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4217
|
-
switch (value.type) {
|
|
4218
|
-
case 'grid':
|
|
4219
|
-
this.contentContainer.dropTarget.setTargetZones([
|
|
4220
|
-
'top',
|
|
4221
|
-
'bottom',
|
|
4222
|
-
'left',
|
|
4223
|
-
'right',
|
|
4224
|
-
'center',
|
|
4225
|
-
]);
|
|
4226
|
-
break;
|
|
4227
|
-
case 'floating':
|
|
4228
|
-
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
4229
|
-
this.contentContainer.dropTarget.setTargetZones(value
|
|
4230
|
-
? ['center']
|
|
4231
|
-
: ['top', 'bottom', 'left', 'right', 'center']);
|
|
4232
|
-
toggleClass(this.container, 'dv-groupview-floating', true);
|
|
4233
|
-
break;
|
|
4234
|
-
case 'popout':
|
|
4235
|
-
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
4236
|
-
toggleClass(this.container, 'dv-groupview-popout', true);
|
|
4237
|
-
break;
|
|
4238
|
-
}
|
|
4239
|
-
this.groupPanel.api._onDidLocationChange.fire({
|
|
4240
|
-
location: this.location,
|
|
4241
|
-
});
|
|
4323
|
+
return this._element;
|
|
4242
4324
|
}
|
|
4243
|
-
constructor(
|
|
4244
|
-
var _a;
|
|
4325
|
+
constructor(accessor, group) {
|
|
4245
4326
|
super();
|
|
4246
|
-
this.container = container;
|
|
4247
4327
|
this.accessor = accessor;
|
|
4248
|
-
this.
|
|
4249
|
-
this.
|
|
4250
|
-
this.
|
|
4251
|
-
this.
|
|
4252
|
-
this.
|
|
4253
|
-
this.
|
|
4254
|
-
this.
|
|
4255
|
-
this.
|
|
4256
|
-
this.
|
|
4257
|
-
this.
|
|
4258
|
-
this.
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
this.
|
|
4290
|
-
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
4291
|
-
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
4292
|
-
this._onTabDragStart.fire(event);
|
|
4293
|
-
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
4294
|
-
this._onGroupDragStart.fire(event);
|
|
4295
|
-
}), this.tabsContainer.onDrop((event) => {
|
|
4296
|
-
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
4297
|
-
}), this.contentContainer.onDidFocus(() => {
|
|
4298
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4299
|
-
}), this.contentContainer.onDidBlur(() => {
|
|
4300
|
-
// noop
|
|
4301
|
-
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
4302
|
-
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
4303
|
-
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
4304
|
-
this._onWillShowOverlay.fire(event);
|
|
4305
|
-
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
4306
|
-
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4307
|
-
kind: 'content',
|
|
4308
|
-
panel: this.activePanel,
|
|
4309
|
-
api: this._api,
|
|
4310
|
-
group: this.groupPanel,
|
|
4311
|
-
getData: getPanelData,
|
|
4312
|
-
}));
|
|
4313
|
-
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
4314
|
-
}
|
|
4315
|
-
focusContent() {
|
|
4316
|
-
this.contentContainer.element.focus();
|
|
4317
|
-
}
|
|
4318
|
-
set renderContainer(value) {
|
|
4319
|
-
this.panels.forEach((panel) => {
|
|
4320
|
-
this.renderContainer.detatch(panel);
|
|
4321
|
-
});
|
|
4322
|
-
this._overwriteRenderContainer = value;
|
|
4323
|
-
this.panels.forEach((panel) => {
|
|
4324
|
-
this.rerender(panel);
|
|
4325
|
-
});
|
|
4326
|
-
}
|
|
4327
|
-
get renderContainer() {
|
|
4328
|
-
var _a;
|
|
4329
|
-
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
4330
|
-
}
|
|
4331
|
-
initialize() {
|
|
4332
|
-
if (this.options.panels) {
|
|
4333
|
-
this.options.panels.forEach((panel) => {
|
|
4334
|
-
this.doAddPanel(panel);
|
|
4335
|
-
});
|
|
4336
|
-
}
|
|
4337
|
-
if (this.options.activePanel) {
|
|
4338
|
-
this.openPanel(this.options.activePanel);
|
|
4339
|
-
}
|
|
4340
|
-
// must be run after the constructor otherwise this.parent may not be
|
|
4341
|
-
// correctly initialized
|
|
4342
|
-
this.setActive(this.isActive, true);
|
|
4343
|
-
this.updateContainer();
|
|
4344
|
-
if (this.accessor.options.createRightHeaderActionsElement) {
|
|
4345
|
-
this._rightHeaderActions =
|
|
4346
|
-
this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
|
|
4347
|
-
this.addDisposables(this._rightHeaderActions);
|
|
4348
|
-
this._rightHeaderActions.init({
|
|
4349
|
-
containerApi: this._api,
|
|
4350
|
-
api: this.groupPanel.api,
|
|
4351
|
-
});
|
|
4352
|
-
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
4353
|
-
}
|
|
4354
|
-
if (this.accessor.options.createLeftHeaderActionsElement) {
|
|
4355
|
-
this._leftHeaderActions =
|
|
4356
|
-
this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
|
|
4357
|
-
this.addDisposables(this._leftHeaderActions);
|
|
4358
|
-
this._leftHeaderActions.init({
|
|
4359
|
-
containerApi: this._api,
|
|
4360
|
-
api: this.groupPanel.api,
|
|
4361
|
-
});
|
|
4362
|
-
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
4363
|
-
}
|
|
4364
|
-
if (this.accessor.options.createPrefixHeaderActionsElement) {
|
|
4365
|
-
this._prefixHeaderActions =
|
|
4366
|
-
this.accessor.options.createPrefixHeaderActionsElement(this.groupPanel);
|
|
4367
|
-
this.addDisposables(this._prefixHeaderActions);
|
|
4368
|
-
this._prefixHeaderActions.init({
|
|
4369
|
-
containerApi: this._api,
|
|
4370
|
-
api: this.groupPanel.api,
|
|
4371
|
-
});
|
|
4372
|
-
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
4373
|
-
}
|
|
4374
|
-
}
|
|
4375
|
-
rerender(panel) {
|
|
4376
|
-
this.contentContainer.renderPanel(panel, { asActive: false });
|
|
4377
|
-
}
|
|
4378
|
-
indexOf(panel) {
|
|
4379
|
-
return this.tabsContainer.indexOf(panel.id);
|
|
4380
|
-
}
|
|
4381
|
-
toJSON() {
|
|
4382
|
-
var _a;
|
|
4383
|
-
const result = {
|
|
4384
|
-
views: this.tabsContainer.panels,
|
|
4385
|
-
activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
|
|
4386
|
-
id: this.id,
|
|
4387
|
-
};
|
|
4388
|
-
if (this.locked !== false) {
|
|
4389
|
-
result.locked = this.locked;
|
|
4390
|
-
}
|
|
4391
|
-
if (this.header.hidden) {
|
|
4392
|
-
result.hideHeader = true;
|
|
4393
|
-
}
|
|
4394
|
-
return result;
|
|
4328
|
+
this.group = group;
|
|
4329
|
+
this.disposable = new MutableDisposable();
|
|
4330
|
+
this._onDidFocus = new Emitter();
|
|
4331
|
+
this.onDidFocus = this._onDidFocus.event;
|
|
4332
|
+
this._onDidBlur = new Emitter();
|
|
4333
|
+
this.onDidBlur = this._onDidBlur.event;
|
|
4334
|
+
this._element = document.createElement('div');
|
|
4335
|
+
this._element.className = 'content-container';
|
|
4336
|
+
this._element.tabIndex = -1;
|
|
4337
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
4338
|
+
this.dropTarget = new Droptarget(this.element, {
|
|
4339
|
+
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
4340
|
+
canDisplayOverlay: (event, position) => {
|
|
4341
|
+
if (this.group.locked === 'no-drop-target' ||
|
|
4342
|
+
(this.group.locked && position === 'center')) {
|
|
4343
|
+
return false;
|
|
4344
|
+
}
|
|
4345
|
+
const data = getPanelData();
|
|
4346
|
+
if (!data &&
|
|
4347
|
+
event.shiftKey &&
|
|
4348
|
+
this.group.location.type !== 'floating') {
|
|
4349
|
+
return false;
|
|
4350
|
+
}
|
|
4351
|
+
if (data && data.viewId === this.accessor.id) {
|
|
4352
|
+
if (data.groupId === this.group.id) {
|
|
4353
|
+
if (position === 'center') {
|
|
4354
|
+
// don't allow to drop on self for center position
|
|
4355
|
+
return false;
|
|
4356
|
+
}
|
|
4357
|
+
if (data.panelId === null) {
|
|
4358
|
+
// don't allow group move to drop anywhere on self
|
|
4359
|
+
return false;
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
const groupHasOnePanelAndIsActiveDragElement = this.group.panels.length === 1 &&
|
|
4363
|
+
data.groupId === this.group.id;
|
|
4364
|
+
return !groupHasOnePanelAndIsActiveDragElement;
|
|
4365
|
+
}
|
|
4366
|
+
return this.group.canDisplayOverlay(event, position, 'content');
|
|
4367
|
+
},
|
|
4368
|
+
});
|
|
4369
|
+
this.addDisposables(this.dropTarget);
|
|
4395
4370
|
}
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
const
|
|
4404
|
-
|
|
4405
|
-
if (
|
|
4406
|
-
|
|
4371
|
+
show() {
|
|
4372
|
+
this.element.style.display = '';
|
|
4373
|
+
}
|
|
4374
|
+
hide() {
|
|
4375
|
+
this.element.style.display = 'none';
|
|
4376
|
+
}
|
|
4377
|
+
renderPanel(panel, options = { asActive: true }) {
|
|
4378
|
+
const doRender = options.asActive ||
|
|
4379
|
+
(this.panel && this.group.isPanelActive(this.panel));
|
|
4380
|
+
if (this.panel &&
|
|
4381
|
+
this.panel.view.content.element.parentElement === this._element) {
|
|
4382
|
+
/**
|
|
4383
|
+
* If the currently attached panel is mounted directly to the content then remove it
|
|
4384
|
+
*/
|
|
4385
|
+
this._element.removeChild(this.panel.view.content.element);
|
|
4407
4386
|
}
|
|
4408
|
-
|
|
4409
|
-
|
|
4387
|
+
this.panel = panel;
|
|
4388
|
+
let container;
|
|
4389
|
+
switch (panel.api.renderer) {
|
|
4390
|
+
case 'onlyWhenVisible':
|
|
4391
|
+
this.group.renderContainer.detatch(panel);
|
|
4392
|
+
if (this.panel) {
|
|
4393
|
+
if (doRender) {
|
|
4394
|
+
this._element.appendChild(this.panel.view.content.element);
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
container = this._element;
|
|
4398
|
+
break;
|
|
4399
|
+
case 'always':
|
|
4400
|
+
if (panel.view.content.element.parentElement === this._element) {
|
|
4401
|
+
this._element.removeChild(panel.view.content.element);
|
|
4402
|
+
}
|
|
4403
|
+
container = this.group.renderContainer.attach({
|
|
4404
|
+
panel,
|
|
4405
|
+
referenceContainer: this,
|
|
4406
|
+
});
|
|
4407
|
+
break;
|
|
4410
4408
|
}
|
|
4411
|
-
|
|
4412
|
-
|
|
4409
|
+
if (doRender) {
|
|
4410
|
+
const focusTracker = trackFocus(container);
|
|
4411
|
+
const disposable = new CompositeDisposable();
|
|
4412
|
+
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
4413
|
+
this.disposable.value = disposable;
|
|
4413
4414
|
}
|
|
4414
|
-
this.openPanel(this.panels[normalizedIndex]);
|
|
4415
4415
|
}
|
|
4416
|
-
|
|
4417
|
-
if (
|
|
4418
|
-
options = {};
|
|
4419
|
-
}
|
|
4420
|
-
if (!options.panel) {
|
|
4421
|
-
options.panel = this.activePanel;
|
|
4422
|
-
}
|
|
4423
|
-
if (!options.panel) {
|
|
4416
|
+
openPanel(panel) {
|
|
4417
|
+
if (this.panel === panel) {
|
|
4424
4418
|
return;
|
|
4425
4419
|
}
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4420
|
+
this.renderPanel(panel);
|
|
4421
|
+
}
|
|
4422
|
+
layout(_width, _height) {
|
|
4423
|
+
// noop
|
|
4424
|
+
}
|
|
4425
|
+
closePanel() {
|
|
4426
|
+
var _a;
|
|
4427
|
+
if (this.panel) {
|
|
4428
|
+
if (this.panel.api.renderer === 'onlyWhenVisible') {
|
|
4429
|
+
(_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
|
|
4430
|
+
}
|
|
4436
4431
|
}
|
|
4437
|
-
this.
|
|
4432
|
+
this.panel = undefined;
|
|
4438
4433
|
}
|
|
4439
|
-
|
|
4440
|
-
|
|
4434
|
+
dispose() {
|
|
4435
|
+
this.disposable.dispose();
|
|
4436
|
+
super.dispose();
|
|
4441
4437
|
}
|
|
4442
|
-
|
|
4443
|
-
|
|
4438
|
+
}
|
|
4439
|
+
|
|
4440
|
+
class TabDragHandler extends DragHandler {
|
|
4441
|
+
constructor(element, accessor, group, panel) {
|
|
4442
|
+
super(element);
|
|
4443
|
+
this.accessor = accessor;
|
|
4444
|
+
this.group = group;
|
|
4445
|
+
this.panel = panel;
|
|
4446
|
+
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
4444
4447
|
}
|
|
4445
|
-
|
|
4446
|
-
|
|
4448
|
+
getData(event) {
|
|
4449
|
+
this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, this.panel.id)], PanelTransfer.prototype);
|
|
4450
|
+
return {
|
|
4451
|
+
dispose: () => {
|
|
4452
|
+
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
4453
|
+
},
|
|
4454
|
+
};
|
|
4447
4455
|
}
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4456
|
+
}
|
|
4457
|
+
class Tab extends CompositeDisposable {
|
|
4458
|
+
get element() {
|
|
4459
|
+
return this._element;
|
|
4451
4460
|
}
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
this.
|
|
4469
|
-
|
|
4461
|
+
constructor(panel, accessor, group) {
|
|
4462
|
+
super();
|
|
4463
|
+
this.panel = panel;
|
|
4464
|
+
this.accessor = accessor;
|
|
4465
|
+
this.group = group;
|
|
4466
|
+
this.content = undefined;
|
|
4467
|
+
this._onChanged = new Emitter();
|
|
4468
|
+
this.onChanged = this._onChanged.event;
|
|
4469
|
+
this._onDropped = new Emitter();
|
|
4470
|
+
this.onDrop = this._onDropped.event;
|
|
4471
|
+
this._onDragStart = new Emitter();
|
|
4472
|
+
this.onDragStart = this._onDragStart.event;
|
|
4473
|
+
this._element = document.createElement('div');
|
|
4474
|
+
this._element.className = 'tab';
|
|
4475
|
+
this._element.tabIndex = 0;
|
|
4476
|
+
this._element.draggable = true;
|
|
4477
|
+
toggleClass(this.element, 'inactive-tab', true);
|
|
4478
|
+
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
4479
|
+
this.dropTarget = new Droptarget(this._element, {
|
|
4480
|
+
acceptedTargetZones: ['center'],
|
|
4481
|
+
canDisplayOverlay: (event, position) => {
|
|
4482
|
+
if (this.group.locked) {
|
|
4483
|
+
return false;
|
|
4484
|
+
}
|
|
4485
|
+
const data = getPanelData();
|
|
4486
|
+
if (data && this.accessor.id === data.viewId) {
|
|
4487
|
+
if (data.panelId === null &&
|
|
4488
|
+
data.groupId === this.group.id) {
|
|
4489
|
+
// don't allow group move to drop on self
|
|
4490
|
+
return false;
|
|
4491
|
+
}
|
|
4492
|
+
return this.panel.id !== data.panelId;
|
|
4493
|
+
}
|
|
4494
|
+
return this.group.model.canDisplayOverlay(event, position, 'tab');
|
|
4495
|
+
},
|
|
4470
4496
|
});
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
}
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
this.updateContainer();
|
|
4483
|
-
}
|
|
4497
|
+
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
4498
|
+
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
4499
|
+
this._onDragStart.fire(event);
|
|
4500
|
+
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
4501
|
+
if (event.defaultPrevented) {
|
|
4502
|
+
return;
|
|
4503
|
+
}
|
|
4504
|
+
this._onChanged.fire(event);
|
|
4505
|
+
}), this.dropTarget.onDrop((event) => {
|
|
4506
|
+
this._onDropped.fire(event);
|
|
4507
|
+
}), this.dropTarget);
|
|
4484
4508
|
}
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
if (!panelToRemove) {
|
|
4493
|
-
throw new Error('invalid operation');
|
|
4509
|
+
setActive(isActive) {
|
|
4510
|
+
toggleClass(this.element, 'active-tab', isActive);
|
|
4511
|
+
toggleClass(this.element, 'inactive-tab', !isActive);
|
|
4512
|
+
}
|
|
4513
|
+
setContent(part) {
|
|
4514
|
+
if (this.content) {
|
|
4515
|
+
this._element.removeChild(this.content.element);
|
|
4494
4516
|
}
|
|
4495
|
-
|
|
4517
|
+
this.content = part;
|
|
4518
|
+
this._element.appendChild(this.content.element);
|
|
4496
4519
|
}
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4520
|
+
dispose() {
|
|
4521
|
+
super.dispose();
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4524
|
+
|
|
4525
|
+
function addGhostImage(dataTransfer, ghostElement) {
|
|
4526
|
+
// class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
|
|
4527
|
+
addClasses(ghostElement, 'dv-dragged');
|
|
4528
|
+
document.body.appendChild(ghostElement);
|
|
4529
|
+
dataTransfer.setDragImage(ghostElement, 0, 0);
|
|
4530
|
+
setTimeout(() => {
|
|
4531
|
+
removeClasses(ghostElement, 'dv-dragged');
|
|
4532
|
+
ghostElement.remove();
|
|
4533
|
+
}, 0);
|
|
4534
|
+
}
|
|
4535
|
+
|
|
4536
|
+
class GroupDragHandler extends DragHandler {
|
|
4537
|
+
constructor(element, accessor, group) {
|
|
4538
|
+
super(element);
|
|
4539
|
+
this.accessor = accessor;
|
|
4540
|
+
this.group = group;
|
|
4541
|
+
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
4542
|
+
this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
|
|
4543
|
+
if (e.shiftKey) {
|
|
4544
|
+
/**
|
|
4545
|
+
* You cannot call e.preventDefault() because that will prevent drag events from firing
|
|
4546
|
+
* but we also need to stop any group overlay drag events from occuring
|
|
4547
|
+
* Use a custom event marker that can be checked by the overlay drag events
|
|
4548
|
+
*/
|
|
4549
|
+
quasiPreventDefault(e);
|
|
4503
4550
|
}
|
|
4551
|
+
}, true));
|
|
4552
|
+
}
|
|
4553
|
+
isCancelled(_event) {
|
|
4554
|
+
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
4555
|
+
return true;
|
|
4504
4556
|
}
|
|
4505
|
-
|
|
4506
|
-
this.accessor.removeGroup(this.groupPanel);
|
|
4507
|
-
}
|
|
4557
|
+
return false;
|
|
4508
4558
|
}
|
|
4509
|
-
|
|
4510
|
-
|
|
4559
|
+
getData(dragEvent) {
|
|
4560
|
+
const dataTransfer = dragEvent.dataTransfer;
|
|
4561
|
+
this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, null)], PanelTransfer.prototype);
|
|
4562
|
+
const style = window.getComputedStyle(this.el);
|
|
4563
|
+
const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
|
|
4564
|
+
const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
|
|
4565
|
+
if (dataTransfer) {
|
|
4566
|
+
const ghostElement = document.createElement('div');
|
|
4567
|
+
ghostElement.style.backgroundColor = bgColor;
|
|
4568
|
+
ghostElement.style.color = color;
|
|
4569
|
+
ghostElement.style.padding = '2px 8px';
|
|
4570
|
+
ghostElement.style.height = '24px';
|
|
4571
|
+
ghostElement.style.fontSize = '11px';
|
|
4572
|
+
ghostElement.style.lineHeight = '20px';
|
|
4573
|
+
ghostElement.style.borderRadius = '12px';
|
|
4574
|
+
ghostElement.style.position = 'absolute';
|
|
4575
|
+
ghostElement.textContent = `Multiple Panels (${this.group.size})`;
|
|
4576
|
+
addGhostImage(dataTransfer, ghostElement);
|
|
4577
|
+
}
|
|
4578
|
+
return {
|
|
4579
|
+
dispose: () => {
|
|
4580
|
+
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
4581
|
+
},
|
|
4582
|
+
};
|
|
4511
4583
|
}
|
|
4512
|
-
|
|
4513
|
-
|
|
4584
|
+
}
|
|
4585
|
+
|
|
4586
|
+
class VoidContainer extends CompositeDisposable {
|
|
4587
|
+
get element() {
|
|
4588
|
+
return this._element;
|
|
4514
4589
|
}
|
|
4515
|
-
|
|
4516
|
-
|
|
4590
|
+
constructor(accessor, group) {
|
|
4591
|
+
super();
|
|
4592
|
+
this.accessor = accessor;
|
|
4593
|
+
this.group = group;
|
|
4594
|
+
this._onDrop = new Emitter();
|
|
4595
|
+
this.onDrop = this._onDrop.event;
|
|
4596
|
+
this._onDragStart = new Emitter();
|
|
4597
|
+
this.onDragStart = this._onDragStart.event;
|
|
4598
|
+
this._element = document.createElement('div');
|
|
4599
|
+
this._element.className = 'void-container';
|
|
4600
|
+
this._element.tabIndex = 0;
|
|
4601
|
+
this._element.draggable = true;
|
|
4602
|
+
this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'click', () => {
|
|
4603
|
+
this.accessor.doSetGroupActive(this.group);
|
|
4604
|
+
}));
|
|
4605
|
+
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
4606
|
+
this.dropTraget = new Droptarget(this._element, {
|
|
4607
|
+
acceptedTargetZones: ['center'],
|
|
4608
|
+
canDisplayOverlay: (event, position) => {
|
|
4609
|
+
var _a;
|
|
4610
|
+
const data = getPanelData();
|
|
4611
|
+
if (data && this.accessor.id === data.viewId) {
|
|
4612
|
+
if (data.panelId === null &&
|
|
4613
|
+
data.groupId === this.group.id) {
|
|
4614
|
+
// don't allow group move to drop on self
|
|
4615
|
+
return false;
|
|
4616
|
+
}
|
|
4617
|
+
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
4618
|
+
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
4619
|
+
}
|
|
4620
|
+
return group.model.canDisplayOverlay(event, position, 'header_space');
|
|
4621
|
+
},
|
|
4622
|
+
});
|
|
4623
|
+
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
4624
|
+
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
4625
|
+
this._onDragStart.fire(event);
|
|
4626
|
+
}), this.dropTraget.onDrop((event) => {
|
|
4627
|
+
this._onDrop.fire(event);
|
|
4628
|
+
}), this.dropTraget);
|
|
4517
4629
|
}
|
|
4518
|
-
|
|
4519
|
-
|
|
4630
|
+
}
|
|
4631
|
+
|
|
4632
|
+
class TabsContainer extends CompositeDisposable {
|
|
4633
|
+
get panels() {
|
|
4634
|
+
return this.tabs.map((_) => _.value.panel.id);
|
|
4520
4635
|
}
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
return;
|
|
4524
|
-
}
|
|
4525
|
-
this._isGroupActive = isGroupActive;
|
|
4526
|
-
toggleClass(this.container, 'active-group', isGroupActive);
|
|
4527
|
-
toggleClass(this.container, 'inactive-group', !isGroupActive);
|
|
4528
|
-
this.tabsContainer.setActive(this.isActive);
|
|
4529
|
-
if (!this._activePanel && this.panels.length > 0) {
|
|
4530
|
-
this.doSetActivePanel(this.panels[0]);
|
|
4531
|
-
}
|
|
4532
|
-
this.updateContainer();
|
|
4636
|
+
get size() {
|
|
4637
|
+
return this.tabs.length;
|
|
4533
4638
|
}
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
this._width = width;
|
|
4537
|
-
this._height = height;
|
|
4538
|
-
this.contentContainer.layout(this._width, this._height);
|
|
4539
|
-
if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
|
|
4540
|
-
this._activePanel.layout(this._width, this._height);
|
|
4541
|
-
}
|
|
4639
|
+
get hidden() {
|
|
4640
|
+
return this._hidden;
|
|
4542
4641
|
}
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
this.
|
|
4546
|
-
if (isActivePanel && this.panels.length > 0) {
|
|
4547
|
-
const nextPanel = this.mostRecentlyUsed[0];
|
|
4548
|
-
this.openPanel(nextPanel, {
|
|
4549
|
-
skipSetActive: options.skipSetActive,
|
|
4550
|
-
skipSetGroupActive: options.skipSetActiveGroup,
|
|
4551
|
-
});
|
|
4552
|
-
}
|
|
4553
|
-
if (this._activePanel && this.panels.length === 0) {
|
|
4554
|
-
this.doSetActivePanel(undefined);
|
|
4555
|
-
}
|
|
4556
|
-
if (!options.skipSetActive) {
|
|
4557
|
-
this.updateContainer();
|
|
4558
|
-
}
|
|
4559
|
-
return panel;
|
|
4642
|
+
set hidden(value) {
|
|
4643
|
+
this._hidden = value;
|
|
4644
|
+
this.element.style.display = value ? 'none' : '';
|
|
4560
4645
|
}
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
this.contentContainer.closePanel();
|
|
4565
|
-
}
|
|
4566
|
-
this.tabsContainer.delete(panel.id);
|
|
4567
|
-
this._panels.splice(index, 1);
|
|
4568
|
-
if (this.mostRecentlyUsed.includes(panel)) {
|
|
4569
|
-
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
4570
|
-
}
|
|
4571
|
-
const disposable = this._panelDisposables.get(panel.id);
|
|
4572
|
-
if (disposable) {
|
|
4573
|
-
disposable.dispose();
|
|
4574
|
-
this._panelDisposables.delete(panel.id);
|
|
4646
|
+
show() {
|
|
4647
|
+
if (!this.hidden) {
|
|
4648
|
+
this.element.style.display = '';
|
|
4575
4649
|
}
|
|
4576
|
-
this._onDidRemovePanel.fire({ panel });
|
|
4577
4650
|
}
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
const hasExistingPanel = existingPanel > -1;
|
|
4581
|
-
this.tabsContainer.show();
|
|
4582
|
-
this.contentContainer.show();
|
|
4583
|
-
this.tabsContainer.openPanel(panel, index);
|
|
4584
|
-
if (!options.skipSetActive) {
|
|
4585
|
-
this.contentContainer.openPanel(panel);
|
|
4586
|
-
}
|
|
4587
|
-
if (hasExistingPanel) {
|
|
4588
|
-
// TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
|
|
4589
|
-
return;
|
|
4590
|
-
}
|
|
4591
|
-
this.updateMru(panel);
|
|
4592
|
-
this.panels.splice(index, 0, panel);
|
|
4593
|
-
this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
|
|
4594
|
-
this._onDidAddPanel.fire({ panel });
|
|
4651
|
+
hide() {
|
|
4652
|
+
this._element.style.display = 'none';
|
|
4595
4653
|
}
|
|
4596
|
-
|
|
4597
|
-
if (this.
|
|
4654
|
+
setRightActionsElement(element) {
|
|
4655
|
+
if (this.rightActions === element) {
|
|
4598
4656
|
return;
|
|
4599
4657
|
}
|
|
4600
|
-
this.
|
|
4601
|
-
|
|
4602
|
-
this.
|
|
4603
|
-
panel.layout(this._width, this._height);
|
|
4604
|
-
this.updateMru(panel);
|
|
4605
|
-
this._onDidActivePanelChange.fire({
|
|
4606
|
-
panel,
|
|
4607
|
-
});
|
|
4608
|
-
}
|
|
4609
|
-
}
|
|
4610
|
-
updateMru(panel) {
|
|
4611
|
-
if (this.mostRecentlyUsed.includes(panel)) {
|
|
4612
|
-
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
4613
|
-
}
|
|
4614
|
-
this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
|
|
4615
|
-
}
|
|
4616
|
-
updateContainer() {
|
|
4617
|
-
var _a, _b;
|
|
4618
|
-
toggleClass(this.container, 'empty', this.isEmpty);
|
|
4619
|
-
this.panels.forEach((panel) => panel.runEvents());
|
|
4620
|
-
if (this.isEmpty && !this.watermark) {
|
|
4621
|
-
const watermark = this.accessor.createWatermarkComponent();
|
|
4622
|
-
watermark.init({
|
|
4623
|
-
containerApi: this._api,
|
|
4624
|
-
group: this.groupPanel,
|
|
4625
|
-
});
|
|
4626
|
-
this.watermark = watermark;
|
|
4627
|
-
addDisposableListener(this.watermark.element, 'click', () => {
|
|
4628
|
-
if (!this.isActive) {
|
|
4629
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4630
|
-
}
|
|
4631
|
-
});
|
|
4632
|
-
this.tabsContainer.hide();
|
|
4633
|
-
this.contentContainer.element.appendChild(this.watermark.element);
|
|
4634
|
-
this.watermark.updateParentGroup(this.groupPanel, true);
|
|
4635
|
-
}
|
|
4636
|
-
if (!this.isEmpty && this.watermark) {
|
|
4637
|
-
this.watermark.element.remove();
|
|
4638
|
-
(_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4639
|
-
this.watermark = undefined;
|
|
4640
|
-
this.tabsContainer.show();
|
|
4658
|
+
if (this.rightActions) {
|
|
4659
|
+
this.rightActions.remove();
|
|
4660
|
+
this.rightActions = undefined;
|
|
4641
4661
|
}
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
if (this.accessor.options.showDndOverlay) {
|
|
4646
|
-
return this.accessor.options.showDndOverlay({
|
|
4647
|
-
nativeEvent: event,
|
|
4648
|
-
target,
|
|
4649
|
-
group: this.accessor.getPanel(this.id),
|
|
4650
|
-
position,
|
|
4651
|
-
getData: getPanelData,
|
|
4652
|
-
});
|
|
4662
|
+
if (element) {
|
|
4663
|
+
this.rightActionsContainer.appendChild(element);
|
|
4664
|
+
this.rightActions = element;
|
|
4653
4665
|
}
|
|
4654
|
-
return false;
|
|
4655
4666
|
}
|
|
4656
|
-
|
|
4657
|
-
if (this.
|
|
4658
|
-
return;
|
|
4659
|
-
}
|
|
4660
|
-
function getKind() {
|
|
4661
|
-
switch (type) {
|
|
4662
|
-
case 'header':
|
|
4663
|
-
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
4664
|
-
case 'content':
|
|
4665
|
-
return 'content';
|
|
4666
|
-
}
|
|
4667
|
-
}
|
|
4668
|
-
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
4669
|
-
const willDropEvent = new DockviewWillDropEvent({
|
|
4670
|
-
nativeEvent: event,
|
|
4671
|
-
position,
|
|
4672
|
-
panel,
|
|
4673
|
-
getData: () => getPanelData(),
|
|
4674
|
-
kind: getKind(),
|
|
4675
|
-
group: this.groupPanel,
|
|
4676
|
-
api: this._api,
|
|
4677
|
-
});
|
|
4678
|
-
this._onWillDrop.fire(willDropEvent);
|
|
4679
|
-
if (willDropEvent.defaultPrevented) {
|
|
4667
|
+
setLeftActionsElement(element) {
|
|
4668
|
+
if (this.leftActions === element) {
|
|
4680
4669
|
return;
|
|
4681
4670
|
}
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
// this is a group move dnd event
|
|
4686
|
-
const { groupId } = data;
|
|
4687
|
-
this._onMove.fire({
|
|
4688
|
-
target: position,
|
|
4689
|
-
groupId: groupId,
|
|
4690
|
-
index,
|
|
4691
|
-
});
|
|
4692
|
-
return;
|
|
4693
|
-
}
|
|
4694
|
-
const fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
|
|
4695
|
-
if (fromSameGroup && this.tabsContainer.size === 1) {
|
|
4696
|
-
return;
|
|
4697
|
-
}
|
|
4698
|
-
const { groupId, panelId } = data;
|
|
4699
|
-
const isSameGroup = this.id === groupId;
|
|
4700
|
-
if (isSameGroup && !position) {
|
|
4701
|
-
const oldIndex = this.tabsContainer.indexOf(panelId);
|
|
4702
|
-
if (oldIndex === index) {
|
|
4703
|
-
return;
|
|
4704
|
-
}
|
|
4705
|
-
}
|
|
4706
|
-
this._onMove.fire({
|
|
4707
|
-
target: position,
|
|
4708
|
-
groupId: data.groupId,
|
|
4709
|
-
itemId: data.panelId,
|
|
4710
|
-
index,
|
|
4711
|
-
});
|
|
4671
|
+
if (this.leftActions) {
|
|
4672
|
+
this.leftActions.remove();
|
|
4673
|
+
this.leftActions = undefined;
|
|
4712
4674
|
}
|
|
4713
|
-
|
|
4714
|
-
this.
|
|
4715
|
-
|
|
4716
|
-
position,
|
|
4717
|
-
panel,
|
|
4718
|
-
getData: () => getPanelData(),
|
|
4719
|
-
group: this.groupPanel,
|
|
4720
|
-
api: this._api,
|
|
4721
|
-
}));
|
|
4675
|
+
if (element) {
|
|
4676
|
+
this.leftActionsContainer.appendChild(element);
|
|
4677
|
+
this.leftActions = element;
|
|
4722
4678
|
}
|
|
4723
4679
|
}
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4680
|
+
setPrefixActionsElement(element) {
|
|
4681
|
+
if (this.preActions === element) {
|
|
4682
|
+
return;
|
|
4683
|
+
}
|
|
4684
|
+
if (this.preActions) {
|
|
4685
|
+
this.preActions.remove();
|
|
4686
|
+
this.preActions = undefined;
|
|
4687
|
+
}
|
|
4688
|
+
if (element) {
|
|
4689
|
+
this.preActionsContainer.appendChild(element);
|
|
4690
|
+
this.preActions = element;
|
|
4732
4691
|
}
|
|
4733
|
-
this.tabsContainer.dispose();
|
|
4734
|
-
this.contentContainer.dispose();
|
|
4735
4692
|
}
|
|
4736
|
-
}
|
|
4737
|
-
|
|
4738
|
-
class Resizable extends CompositeDisposable {
|
|
4739
4693
|
get element() {
|
|
4740
4694
|
return this._element;
|
|
4741
4695
|
}
|
|
4742
|
-
|
|
4743
|
-
return this.
|
|
4696
|
+
isActive(tab) {
|
|
4697
|
+
return (this.selectedIndex > -1 &&
|
|
4698
|
+
this.tabs[this.selectedIndex].value === tab);
|
|
4744
4699
|
}
|
|
4745
|
-
|
|
4746
|
-
this.
|
|
4700
|
+
indexOf(id) {
|
|
4701
|
+
return this.tabs.findIndex((tab) => tab.value.panel.id === id);
|
|
4747
4702
|
}
|
|
4748
|
-
constructor(
|
|
4703
|
+
constructor(accessor, group) {
|
|
4749
4704
|
super();
|
|
4750
|
-
this.
|
|
4751
|
-
this.
|
|
4752
|
-
this.
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4705
|
+
this.accessor = accessor;
|
|
4706
|
+
this.group = group;
|
|
4707
|
+
this.tabs = [];
|
|
4708
|
+
this.selectedIndex = -1;
|
|
4709
|
+
this._hidden = false;
|
|
4710
|
+
this._onDrop = new Emitter();
|
|
4711
|
+
this.onDrop = this._onDrop.event;
|
|
4712
|
+
this._onTabDragStart = new Emitter();
|
|
4713
|
+
this.onTabDragStart = this._onTabDragStart.event;
|
|
4714
|
+
this._onGroupDragStart = new Emitter();
|
|
4715
|
+
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
4716
|
+
this._onWillShowOverlay = new Emitter();
|
|
4717
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
4718
|
+
this._element = document.createElement('div');
|
|
4719
|
+
this._element.className = 'tabs-and-actions-container';
|
|
4720
|
+
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
4721
|
+
this.rightActionsContainer = document.createElement('div');
|
|
4722
|
+
this.rightActionsContainer.className = 'right-actions-container';
|
|
4723
|
+
this.leftActionsContainer = document.createElement('div');
|
|
4724
|
+
this.leftActionsContainer.className = 'left-actions-container';
|
|
4725
|
+
this.preActionsContainer = document.createElement('div');
|
|
4726
|
+
this.preActionsContainer.className = 'pre-actions-container';
|
|
4727
|
+
this.tabContainer = document.createElement('div');
|
|
4728
|
+
this.tabContainer.className = 'tabs-container';
|
|
4729
|
+
this.voidContainer = new VoidContainer(this.accessor, this.group);
|
|
4730
|
+
this._element.appendChild(this.preActionsContainer);
|
|
4731
|
+
this._element.appendChild(this.tabContainer);
|
|
4732
|
+
this._element.appendChild(this.leftActionsContainer);
|
|
4733
|
+
this._element.appendChild(this.voidContainer.element);
|
|
4734
|
+
this._element.appendChild(this.rightActionsContainer);
|
|
4735
|
+
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
4736
|
+
if (e.api.group === this.group) {
|
|
4737
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
4759
4738
|
}
|
|
4760
|
-
|
|
4739
|
+
}), this.accessor.onDidRemovePanel((e) => {
|
|
4740
|
+
if (e.api.group === this.group) {
|
|
4741
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
4742
|
+
}
|
|
4743
|
+
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
4744
|
+
this._onGroupDragStart.fire({
|
|
4745
|
+
nativeEvent: event,
|
|
4746
|
+
group: this.group,
|
|
4747
|
+
});
|
|
4748
|
+
}), this.voidContainer.onDrop((event) => {
|
|
4749
|
+
this._onDrop.fire({
|
|
4750
|
+
event: event.nativeEvent,
|
|
4751
|
+
index: this.tabs.length,
|
|
4752
|
+
});
|
|
4753
|
+
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
4754
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4755
|
+
kind: 'header_space',
|
|
4756
|
+
panel: this.group.activePanel,
|
|
4757
|
+
api: this.accessor.api,
|
|
4758
|
+
group: this.group,
|
|
4759
|
+
getData: getPanelData,
|
|
4760
|
+
}));
|
|
4761
|
+
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
4762
|
+
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
4763
|
+
if (isFloatingGroupsEnabled &&
|
|
4764
|
+
event.shiftKey &&
|
|
4765
|
+
this.group.api.location.type !== 'floating') {
|
|
4766
|
+
event.preventDefault();
|
|
4767
|
+
const { top, left } = this.element.getBoundingClientRect();
|
|
4768
|
+
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
4769
|
+
this.accessor.addFloatingGroup(this.group, {
|
|
4770
|
+
x: left - rootLeft + 20,
|
|
4771
|
+
y: top - rootTop + 20,
|
|
4772
|
+
}, { inDragMode: true });
|
|
4773
|
+
}
|
|
4774
|
+
}), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
4775
|
+
if (event.defaultPrevented) {
|
|
4761
4776
|
return;
|
|
4762
4777
|
}
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4778
|
+
const isLeftClick = event.button === 0;
|
|
4779
|
+
if (isLeftClick) {
|
|
4780
|
+
this.accessor.doSetGroupActive(this.group);
|
|
4781
|
+
}
|
|
4782
|
+
}));
|
|
4783
|
+
}
|
|
4784
|
+
setActive(_isGroupActive) {
|
|
4785
|
+
// noop
|
|
4786
|
+
}
|
|
4787
|
+
addTab(tab, index = this.tabs.length) {
|
|
4788
|
+
if (index < 0 || index > this.tabs.length) {
|
|
4789
|
+
throw new Error('invalid location');
|
|
4790
|
+
}
|
|
4791
|
+
this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
|
|
4792
|
+
this.tabs = [
|
|
4793
|
+
...this.tabs.slice(0, index),
|
|
4794
|
+
tab,
|
|
4795
|
+
...this.tabs.slice(index),
|
|
4796
|
+
];
|
|
4797
|
+
if (this.selectedIndex < 0) {
|
|
4798
|
+
this.selectedIndex = index;
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
delete(id) {
|
|
4802
|
+
const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
|
|
4803
|
+
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
4804
|
+
const { value, disposable } = tabToRemove;
|
|
4805
|
+
disposable.dispose();
|
|
4806
|
+
value.dispose();
|
|
4807
|
+
value.element.remove();
|
|
4808
|
+
}
|
|
4809
|
+
setActivePanel(panel) {
|
|
4810
|
+
this.tabs.forEach((tab) => {
|
|
4811
|
+
const isActivePanel = panel.id === tab.value.panel.id;
|
|
4812
|
+
tab.value.setActive(isActivePanel);
|
|
4813
|
+
});
|
|
4814
|
+
}
|
|
4815
|
+
openPanel(panel, index = this.tabs.length) {
|
|
4816
|
+
var _a;
|
|
4817
|
+
if (this.tabs.find((tab) => tab.value.panel.id === panel.id)) {
|
|
4818
|
+
return;
|
|
4819
|
+
}
|
|
4820
|
+
const tab = new Tab(panel, this.accessor, this.group);
|
|
4821
|
+
if (!((_a = panel.view) === null || _a === void 0 ? void 0 : _a.tab)) {
|
|
4822
|
+
throw new Error('invalid header component');
|
|
4823
|
+
}
|
|
4824
|
+
tab.setContent(panel.view.tab);
|
|
4825
|
+
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
4826
|
+
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
4827
|
+
}), tab.onChanged((event) => {
|
|
4828
|
+
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
4829
|
+
const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&
|
|
4830
|
+
this.size === 1;
|
|
4831
|
+
if (isFloatingGroupsEnabled &&
|
|
4832
|
+
!isFloatingWithOnePanel &&
|
|
4833
|
+
event.shiftKey) {
|
|
4834
|
+
event.preventDefault();
|
|
4835
|
+
const panel = this.accessor.getGroupPanel(tab.panel.id);
|
|
4836
|
+
const { top, left } = tab.element.getBoundingClientRect();
|
|
4837
|
+
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
4838
|
+
this.accessor.addFloatingGroup(panel, {
|
|
4839
|
+
x: left - rootLeft,
|
|
4840
|
+
y: top - rootTop,
|
|
4841
|
+
}, { inDragMode: true });
|
|
4776
4842
|
return;
|
|
4777
4843
|
}
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
* since the event is dispatched through requestAnimationFrame there is a small chance
|
|
4781
|
-
* the component is no longer attached to the DOM, if that is the case the dimensions
|
|
4782
|
-
* are mostly likely all zero and meaningless. we should skip this case.
|
|
4783
|
-
*/
|
|
4844
|
+
const isLeftClick = event.button === 0;
|
|
4845
|
+
if (!isLeftClick || event.defaultPrevented) {
|
|
4784
4846
|
return;
|
|
4785
4847
|
}
|
|
4786
|
-
|
|
4787
|
-
|
|
4848
|
+
if (this.group.activePanel !== panel) {
|
|
4849
|
+
this.group.model.openPanel(panel);
|
|
4850
|
+
}
|
|
4851
|
+
}), tab.onDrop((event) => {
|
|
4852
|
+
this._onDrop.fire({
|
|
4853
|
+
event: event.nativeEvent,
|
|
4854
|
+
index: this.tabs.findIndex((x) => x.value === tab),
|
|
4855
|
+
});
|
|
4856
|
+
}), tab.onWillShowOverlay((event) => {
|
|
4857
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4858
|
+
kind: 'tab',
|
|
4859
|
+
panel: this.group.activePanel,
|
|
4860
|
+
api: this.accessor.api,
|
|
4861
|
+
group: this.group,
|
|
4862
|
+
getData: getPanelData,
|
|
4863
|
+
}));
|
|
4788
4864
|
}));
|
|
4865
|
+
const value = { value: tab, disposable };
|
|
4866
|
+
this.addTab(value, index);
|
|
4789
4867
|
}
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
return 'top';
|
|
4801
|
-
case 'below':
|
|
4802
|
-
return 'bottom';
|
|
4803
|
-
case 'within':
|
|
4804
|
-
default:
|
|
4805
|
-
return 'center';
|
|
4868
|
+
closePanel(panel) {
|
|
4869
|
+
this.delete(panel.id);
|
|
4870
|
+
}
|
|
4871
|
+
dispose() {
|
|
4872
|
+
super.dispose();
|
|
4873
|
+
for (const { value, disposable } of this.tabs) {
|
|
4874
|
+
disposable.dispose();
|
|
4875
|
+
value.dispose();
|
|
4876
|
+
}
|
|
4877
|
+
this.tabs = [];
|
|
4806
4878
|
}
|
|
4807
4879
|
}
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4880
|
+
|
|
4881
|
+
class DockviewUnhandledDragOverEvent {
|
|
4882
|
+
get isAccepted() {
|
|
4883
|
+
return this._isAccepted;
|
|
4811
4884
|
}
|
|
4812
|
-
|
|
4813
|
-
|
|
4885
|
+
constructor(nativeEvent, target, position, getData, group) {
|
|
4886
|
+
this.nativeEvent = nativeEvent;
|
|
4887
|
+
this.target = target;
|
|
4888
|
+
this.position = position;
|
|
4889
|
+
this.getData = getData;
|
|
4890
|
+
this.group = group;
|
|
4891
|
+
this._isAccepted = false;
|
|
4814
4892
|
}
|
|
4815
|
-
|
|
4816
|
-
|
|
4893
|
+
accept() {
|
|
4894
|
+
this._isAccepted = true;
|
|
4817
4895
|
}
|
|
4818
|
-
|
|
4819
|
-
|
|
4896
|
+
}
|
|
4897
|
+
const PROPERTY_KEYS = (() => {
|
|
4898
|
+
/**
|
|
4899
|
+
* by readong the keys from an empty value object TypeScript will error
|
|
4900
|
+
* when we add or remove new properties to `DockviewOptions`
|
|
4901
|
+
*/
|
|
4902
|
+
const properties = {
|
|
4903
|
+
disableAutoResizing: undefined,
|
|
4904
|
+
hideBorders: undefined,
|
|
4905
|
+
singleTabMode: undefined,
|
|
4906
|
+
disableFloatingGroups: undefined,
|
|
4907
|
+
floatingGroupBounds: undefined,
|
|
4908
|
+
popoutUrl: undefined,
|
|
4909
|
+
defaultRenderer: undefined,
|
|
4910
|
+
debug: undefined,
|
|
4911
|
+
rootOverlayModel: undefined,
|
|
4912
|
+
locked: undefined,
|
|
4913
|
+
disableDnd: undefined,
|
|
4914
|
+
};
|
|
4915
|
+
return Object.keys(properties);
|
|
4916
|
+
})();
|
|
4917
|
+
function isPanelOptionsWithPanel(data) {
|
|
4918
|
+
if (data.referencePanel) {
|
|
4919
|
+
return true;
|
|
4820
4920
|
}
|
|
4821
|
-
|
|
4822
|
-
|
|
4921
|
+
return false;
|
|
4922
|
+
}
|
|
4923
|
+
function isPanelOptionsWithGroup(data) {
|
|
4924
|
+
if (data.referenceGroup) {
|
|
4925
|
+
return true;
|
|
4823
4926
|
}
|
|
4824
|
-
|
|
4825
|
-
|
|
4927
|
+
return false;
|
|
4928
|
+
}
|
|
4929
|
+
function isGroupOptionsWithPanel(data) {
|
|
4930
|
+
if (data.referencePanel) {
|
|
4931
|
+
return true;
|
|
4826
4932
|
}
|
|
4827
|
-
|
|
4828
|
-
|
|
4933
|
+
return false;
|
|
4934
|
+
}
|
|
4935
|
+
function isGroupOptionsWithGroup(data) {
|
|
4936
|
+
if (data.referenceGroup) {
|
|
4937
|
+
return true;
|
|
4829
4938
|
}
|
|
4830
|
-
|
|
4831
|
-
|
|
4939
|
+
return false;
|
|
4940
|
+
}
|
|
4941
|
+
|
|
4942
|
+
class DockviewDidDropEvent extends DockviewEvent {
|
|
4943
|
+
get nativeEvent() {
|
|
4944
|
+
return this.options.nativeEvent;
|
|
4832
4945
|
}
|
|
4833
|
-
get
|
|
4834
|
-
return this.
|
|
4946
|
+
get position() {
|
|
4947
|
+
return this.options.position;
|
|
4835
4948
|
}
|
|
4836
|
-
get
|
|
4837
|
-
return this.
|
|
4949
|
+
get panel() {
|
|
4950
|
+
return this.options.panel;
|
|
4838
4951
|
}
|
|
4839
|
-
get
|
|
4840
|
-
return this.
|
|
4952
|
+
get group() {
|
|
4953
|
+
return this.options.group;
|
|
4841
4954
|
}
|
|
4842
|
-
|
|
4843
|
-
this.
|
|
4955
|
+
get api() {
|
|
4956
|
+
return this.options.api;
|
|
4844
4957
|
}
|
|
4845
4958
|
constructor(options) {
|
|
4846
|
-
super(
|
|
4847
|
-
this.
|
|
4848
|
-
this._groups = new Map();
|
|
4849
|
-
this._onDidLayoutChange = new Emitter();
|
|
4850
|
-
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
4851
|
-
this._onDidRemove = new Emitter();
|
|
4852
|
-
this.onDidRemove = this._onDidRemove.event;
|
|
4853
|
-
this._onDidAdd = new Emitter();
|
|
4854
|
-
this.onDidAdd = this._onDidAdd.event;
|
|
4855
|
-
this._onDidActiveChange = new Emitter();
|
|
4856
|
-
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
4857
|
-
this._bufferOnDidLayoutChange = new TickDelayedEvent();
|
|
4858
|
-
this.element.style.height = '100%';
|
|
4859
|
-
this.element.style.width = '100%';
|
|
4860
|
-
options.parentElement.appendChild(this.element);
|
|
4861
|
-
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
4862
|
-
this.gridview.locked = !!options.locked;
|
|
4863
|
-
this.element.appendChild(this.gridview.element);
|
|
4864
|
-
this.layout(0, 0, true); // set some elements height/widths
|
|
4865
|
-
this.addDisposables(Disposable.from(() => {
|
|
4866
|
-
var _a;
|
|
4867
|
-
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
4868
|
-
}), this.gridview.onDidChange(() => {
|
|
4869
|
-
this._bufferOnDidLayoutChange.fire();
|
|
4870
|
-
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
4871
|
-
this._bufferOnDidLayoutChange.fire();
|
|
4872
|
-
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
4873
|
-
this._onDidLayoutChange.fire();
|
|
4874
|
-
}), this._bufferOnDidLayoutChange);
|
|
4875
|
-
}
|
|
4876
|
-
setVisible(panel, visible) {
|
|
4877
|
-
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
4878
|
-
this._onDidLayoutChange.fire();
|
|
4879
|
-
}
|
|
4880
|
-
isVisible(panel) {
|
|
4881
|
-
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
4882
|
-
}
|
|
4883
|
-
maximizeGroup(panel) {
|
|
4884
|
-
this.gridview.maximizeView(panel);
|
|
4885
|
-
this.doSetGroupActive(panel);
|
|
4886
|
-
}
|
|
4887
|
-
isMaximizedGroup(panel) {
|
|
4888
|
-
return this.gridview.maximizedView() === panel;
|
|
4889
|
-
}
|
|
4890
|
-
exitMaximizedGroup() {
|
|
4891
|
-
this.gridview.exitMaximizedView();
|
|
4892
|
-
}
|
|
4893
|
-
hasMaximizedGroup() {
|
|
4894
|
-
return this.gridview.hasMaximizedView();
|
|
4895
|
-
}
|
|
4896
|
-
get onDidMaximizedGroupChange() {
|
|
4897
|
-
return this.gridview.onDidMaximizedNodeChange;
|
|
4959
|
+
super();
|
|
4960
|
+
this.options = options;
|
|
4898
4961
|
}
|
|
4899
|
-
|
|
4900
|
-
this.
|
|
4901
|
-
this._onDidAdd.fire(group);
|
|
4962
|
+
getData() {
|
|
4963
|
+
return this.options.getData();
|
|
4902
4964
|
}
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
const item = this._groups.get(group.id);
|
|
4908
|
-
const view = this.gridview.remove(group, exports.Sizing.Distribute);
|
|
4909
|
-
if (item && !(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
4910
|
-
item.disposable.dispose();
|
|
4911
|
-
item.value.dispose();
|
|
4912
|
-
this._groups.delete(group.id);
|
|
4913
|
-
this._onDidRemove.fire(group);
|
|
4914
|
-
}
|
|
4915
|
-
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
4916
|
-
const groups = Array.from(this._groups.values());
|
|
4917
|
-
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
4918
|
-
}
|
|
4919
|
-
return view;
|
|
4965
|
+
}
|
|
4966
|
+
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4967
|
+
get kind() {
|
|
4968
|
+
return this._kind;
|
|
4920
4969
|
}
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4970
|
+
constructor(options) {
|
|
4971
|
+
super(options);
|
|
4972
|
+
this._kind = options.kind;
|
|
4924
4973
|
}
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
if (this._activeGroup) {
|
|
4930
|
-
this._activeGroup.setActive(false);
|
|
4931
|
-
}
|
|
4932
|
-
if (group) {
|
|
4933
|
-
group.setActive(true);
|
|
4934
|
-
}
|
|
4935
|
-
this._activeGroup = group;
|
|
4936
|
-
this._onDidActiveChange.fire(group);
|
|
4974
|
+
}
|
|
4975
|
+
class WillShowOverlayLocationEvent {
|
|
4976
|
+
get kind() {
|
|
4977
|
+
return this.options.kind;
|
|
4937
4978
|
}
|
|
4938
|
-
|
|
4939
|
-
this.
|
|
4979
|
+
get nativeEvent() {
|
|
4980
|
+
return this.event.nativeEvent;
|
|
4940
4981
|
}
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
if (!options) {
|
|
4944
|
-
options = {};
|
|
4945
|
-
}
|
|
4946
|
-
if (!options.group) {
|
|
4947
|
-
if (!this.activeGroup) {
|
|
4948
|
-
return;
|
|
4949
|
-
}
|
|
4950
|
-
options.group = this.activeGroup;
|
|
4951
|
-
}
|
|
4952
|
-
const location = getGridLocation(options.group.element);
|
|
4953
|
-
const next = (_a = this.gridview.next(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
4954
|
-
this.doSetGroupActive(next);
|
|
4982
|
+
get position() {
|
|
4983
|
+
return this.event.position;
|
|
4955
4984
|
}
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
if (!options) {
|
|
4959
|
-
options = {};
|
|
4960
|
-
}
|
|
4961
|
-
if (!options.group) {
|
|
4962
|
-
if (!this.activeGroup) {
|
|
4963
|
-
return;
|
|
4964
|
-
}
|
|
4965
|
-
options.group = this.activeGroup;
|
|
4966
|
-
}
|
|
4967
|
-
const location = getGridLocation(options.group.element);
|
|
4968
|
-
const next = (_a = this.gridview.previous(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
4969
|
-
this.doSetGroupActive(next);
|
|
4985
|
+
get defaultPrevented() {
|
|
4986
|
+
return this.event.defaultPrevented;
|
|
4970
4987
|
}
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
if (!different) {
|
|
4974
|
-
return;
|
|
4975
|
-
}
|
|
4976
|
-
this.gridview.element.style.height = `${height}px`;
|
|
4977
|
-
this.gridview.element.style.width = `${width}px`;
|
|
4978
|
-
this.gridview.layout(width, height);
|
|
4988
|
+
get panel() {
|
|
4989
|
+
return this.options.panel;
|
|
4979
4990
|
}
|
|
4980
|
-
|
|
4981
|
-
this.
|
|
4982
|
-
this._onDidAdd.dispose();
|
|
4983
|
-
this._onDidRemove.dispose();
|
|
4984
|
-
this._onDidLayoutChange.dispose();
|
|
4985
|
-
for (const group of this.groups) {
|
|
4986
|
-
group.dispose();
|
|
4987
|
-
}
|
|
4988
|
-
this.gridview.dispose();
|
|
4989
|
-
super.dispose();
|
|
4991
|
+
get api() {
|
|
4992
|
+
return this.options.api;
|
|
4990
4993
|
}
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
class WillFocusEvent extends DockviewEvent {
|
|
4994
|
-
constructor() {
|
|
4995
|
-
super();
|
|
4994
|
+
get group() {
|
|
4995
|
+
return this.options.group;
|
|
4996
4996
|
}
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
* A core api implementation that should be used across all panel-like objects
|
|
5000
|
-
*/
|
|
5001
|
-
class PanelApiImpl extends CompositeDisposable {
|
|
5002
|
-
get isFocused() {
|
|
5003
|
-
return this._isFocused;
|
|
4997
|
+
preventDefault() {
|
|
4998
|
+
this.event.preventDefault();
|
|
5004
4999
|
}
|
|
5005
|
-
|
|
5006
|
-
return this.
|
|
5000
|
+
getData() {
|
|
5001
|
+
return this.options.getData();
|
|
5007
5002
|
}
|
|
5008
|
-
|
|
5009
|
-
|
|
5003
|
+
constructor(event, options) {
|
|
5004
|
+
this.event = event;
|
|
5005
|
+
this.options = options;
|
|
5010
5006
|
}
|
|
5011
|
-
|
|
5012
|
-
|
|
5007
|
+
}
|
|
5008
|
+
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
5009
|
+
get element() {
|
|
5010
|
+
throw new Error('not supported');
|
|
5013
5011
|
}
|
|
5014
|
-
get
|
|
5015
|
-
return this.
|
|
5012
|
+
get activePanel() {
|
|
5013
|
+
return this._activePanel;
|
|
5016
5014
|
}
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
this.id = id;
|
|
5020
|
-
this.component = component;
|
|
5021
|
-
this._isFocused = false;
|
|
5022
|
-
this._isActive = false;
|
|
5023
|
-
this._isVisible = true;
|
|
5024
|
-
this._width = 0;
|
|
5025
|
-
this._height = 0;
|
|
5026
|
-
this._parameters = {};
|
|
5027
|
-
this.panelUpdatesDisposable = new MutableDisposable();
|
|
5028
|
-
this._onDidDimensionChange = new Emitter();
|
|
5029
|
-
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
5030
|
-
this._onDidChangeFocus = new Emitter();
|
|
5031
|
-
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
5032
|
-
//
|
|
5033
|
-
this._onWillFocus = new Emitter();
|
|
5034
|
-
this.onWillFocus = this._onWillFocus.event;
|
|
5035
|
-
//
|
|
5036
|
-
this._onDidVisibilityChange = new Emitter();
|
|
5037
|
-
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
5038
|
-
this._onWillVisibilityChange = new Emitter();
|
|
5039
|
-
this.onWillVisibilityChange = this._onWillVisibilityChange.event;
|
|
5040
|
-
this._onDidActiveChange = new Emitter();
|
|
5041
|
-
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
5042
|
-
this._onActiveChange = new Emitter();
|
|
5043
|
-
this.onActiveChange = this._onActiveChange.event;
|
|
5044
|
-
this._onDidParametersChange = new Emitter();
|
|
5045
|
-
this.onDidParametersChange = this._onDidParametersChange.event;
|
|
5046
|
-
this.addDisposables(this.onDidFocusChange((event) => {
|
|
5047
|
-
this._isFocused = event.isFocused;
|
|
5048
|
-
}), this.onDidActiveChange((event) => {
|
|
5049
|
-
this._isActive = event.isActive;
|
|
5050
|
-
}), this.onDidVisibilityChange((event) => {
|
|
5051
|
-
this._isVisible = event.isVisible;
|
|
5052
|
-
}), this.onDidDimensionsChange((event) => {
|
|
5053
|
-
this._width = event.width;
|
|
5054
|
-
this._height = event.height;
|
|
5055
|
-
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);
|
|
5015
|
+
get locked() {
|
|
5016
|
+
return this._locked;
|
|
5056
5017
|
}
|
|
5057
|
-
|
|
5058
|
-
|
|
5018
|
+
set locked(value) {
|
|
5019
|
+
this._locked = value;
|
|
5020
|
+
toggleClass(this.container, 'locked-groupview', value === 'no-drop-target' || value);
|
|
5059
5021
|
}
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
this._parameters = parameters;
|
|
5063
|
-
panel.update({
|
|
5064
|
-
params: parameters,
|
|
5065
|
-
});
|
|
5066
|
-
});
|
|
5022
|
+
get isActive() {
|
|
5023
|
+
return this._isGroupActive;
|
|
5067
5024
|
}
|
|
5068
|
-
|
|
5069
|
-
this.
|
|
5025
|
+
get panels() {
|
|
5026
|
+
return this._panels;
|
|
5070
5027
|
}
|
|
5071
|
-
|
|
5072
|
-
this.
|
|
5028
|
+
get size() {
|
|
5029
|
+
return this._panels.length;
|
|
5073
5030
|
}
|
|
5074
|
-
|
|
5075
|
-
this.
|
|
5031
|
+
get isEmpty() {
|
|
5032
|
+
return this._panels.length === 0;
|
|
5076
5033
|
}
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
5080
|
-
//
|
|
5081
|
-
constructor(id, component) {
|
|
5082
|
-
super(id, component);
|
|
5083
|
-
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5084
|
-
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5085
|
-
//
|
|
5086
|
-
this._onDidConstraintsChange = new Emitter({
|
|
5087
|
-
replay: true,
|
|
5088
|
-
});
|
|
5089
|
-
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
5090
|
-
//
|
|
5091
|
-
this._onDidSizeChange = new Emitter();
|
|
5092
|
-
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
5093
|
-
this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
|
|
5034
|
+
get hasWatermark() {
|
|
5035
|
+
return !!(this.watermark && this.container.contains(this.watermark.element));
|
|
5094
5036
|
}
|
|
5095
|
-
|
|
5096
|
-
this.
|
|
5037
|
+
get header() {
|
|
5038
|
+
return this.tabsContainer;
|
|
5097
5039
|
}
|
|
5098
|
-
|
|
5099
|
-
|
|
5040
|
+
get isContentFocused() {
|
|
5041
|
+
if (!document.activeElement) {
|
|
5042
|
+
return false;
|
|
5043
|
+
}
|
|
5044
|
+
return isAncestor(document.activeElement, this.contentContainer.element);
|
|
5100
5045
|
}
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
|
|
5104
|
-
set pane(pane) {
|
|
5105
|
-
this._pane = pane;
|
|
5046
|
+
get location() {
|
|
5047
|
+
return this._location;
|
|
5106
5048
|
}
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
this.
|
|
5110
|
-
|
|
5049
|
+
set location(value) {
|
|
5050
|
+
this._location = value;
|
|
5051
|
+
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
5052
|
+
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
5053
|
+
switch (value.type) {
|
|
5054
|
+
case 'grid':
|
|
5055
|
+
this.contentContainer.dropTarget.setTargetZones([
|
|
5056
|
+
'top',
|
|
5057
|
+
'bottom',
|
|
5058
|
+
'left',
|
|
5059
|
+
'right',
|
|
5060
|
+
'center',
|
|
5061
|
+
]);
|
|
5062
|
+
break;
|
|
5063
|
+
case 'floating':
|
|
5064
|
+
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
5065
|
+
this.contentContainer.dropTarget.setTargetZones(value
|
|
5066
|
+
? ['center']
|
|
5067
|
+
: ['top', 'bottom', 'left', 'right', 'center']);
|
|
5068
|
+
toggleClass(this.container, 'dv-groupview-floating', true);
|
|
5069
|
+
break;
|
|
5070
|
+
case 'popout':
|
|
5071
|
+
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
5072
|
+
toggleClass(this.container, 'dv-groupview-popout', true);
|
|
5073
|
+
break;
|
|
5074
|
+
}
|
|
5075
|
+
this.groupPanel.api._onDidLocationChange.fire({
|
|
5076
|
+
location: this.location,
|
|
5111
5077
|
});
|
|
5112
|
-
this.onDidExpansionChange = this._onDidExpansionChange.event;
|
|
5113
|
-
this._onMouseEnter = new Emitter({});
|
|
5114
|
-
this.onMouseEnter = this._onMouseEnter.event;
|
|
5115
|
-
this._onMouseLeave = new Emitter({});
|
|
5116
|
-
this.onMouseLeave = this._onMouseLeave.event;
|
|
5117
|
-
this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
|
|
5118
|
-
}
|
|
5119
|
-
setExpanded(isExpanded) {
|
|
5120
|
-
var _a;
|
|
5121
|
-
(_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
|
|
5122
5078
|
}
|
|
5123
|
-
|
|
5079
|
+
constructor(container, accessor, id, options, groupPanel) {
|
|
5124
5080
|
var _a;
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5081
|
+
super();
|
|
5082
|
+
this.container = container;
|
|
5083
|
+
this.accessor = accessor;
|
|
5084
|
+
this.id = id;
|
|
5085
|
+
this.options = options;
|
|
5086
|
+
this.groupPanel = groupPanel;
|
|
5087
|
+
this._isGroupActive = false;
|
|
5088
|
+
this._locked = false;
|
|
5089
|
+
this._location = { type: 'grid' };
|
|
5090
|
+
this.mostRecentlyUsed = [];
|
|
5091
|
+
this._onDidChange = new Emitter();
|
|
5092
|
+
this.onDidChange = this._onDidChange.event;
|
|
5093
|
+
this._width = 0;
|
|
5094
|
+
this._height = 0;
|
|
5095
|
+
this._panels = [];
|
|
5096
|
+
this._panelDisposables = new Map();
|
|
5097
|
+
this._onMove = new Emitter();
|
|
5098
|
+
this.onMove = this._onMove.event;
|
|
5099
|
+
this._onDidDrop = new Emitter();
|
|
5100
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
5101
|
+
this._onWillDrop = new Emitter();
|
|
5102
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
5103
|
+
this._onWillShowOverlay = new Emitter();
|
|
5104
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
5105
|
+
this._onTabDragStart = new Emitter();
|
|
5106
|
+
this.onTabDragStart = this._onTabDragStart.event;
|
|
5107
|
+
this._onGroupDragStart = new Emitter();
|
|
5108
|
+
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
5109
|
+
this._onDidAddPanel = new Emitter();
|
|
5110
|
+
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
5111
|
+
this._onDidPanelTitleChange = new Emitter();
|
|
5112
|
+
this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;
|
|
5113
|
+
this._onDidPanelParametersChange = new Emitter();
|
|
5114
|
+
this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;
|
|
5115
|
+
this._onDidRemovePanel = new Emitter();
|
|
5116
|
+
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
5117
|
+
this._onDidActivePanelChange = new Emitter();
|
|
5118
|
+
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
5119
|
+
this._onUnhandledDragOverEvent = new Emitter();
|
|
5120
|
+
this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
|
|
5121
|
+
this._overwriteRenderContainer = null;
|
|
5122
|
+
toggleClass(this.container, 'groupview', true);
|
|
5123
|
+
this._api = new DockviewApi(this.accessor);
|
|
5124
|
+
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
5125
|
+
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
5126
|
+
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
5127
|
+
this.header.hidden = !!options.hideHeader;
|
|
5128
|
+
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
5129
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
5130
|
+
this._onTabDragStart.fire(event);
|
|
5131
|
+
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
5132
|
+
this._onGroupDragStart.fire(event);
|
|
5133
|
+
}), this.tabsContainer.onDrop((event) => {
|
|
5134
|
+
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
5135
|
+
}), this.contentContainer.onDidFocus(() => {
|
|
5136
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
5137
|
+
}), this.contentContainer.onDidBlur(() => {
|
|
5138
|
+
// noop
|
|
5139
|
+
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
5140
|
+
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
5141
|
+
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
5142
|
+
this._onWillShowOverlay.fire(event);
|
|
5143
|
+
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
5144
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
5145
|
+
kind: 'content',
|
|
5146
|
+
panel: this.activePanel,
|
|
5147
|
+
api: this._api,
|
|
5148
|
+
group: this.groupPanel,
|
|
5149
|
+
getData: getPanelData,
|
|
5150
|
+
}));
|
|
5151
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this._onUnhandledDragOverEvent);
|
|
5132
5152
|
}
|
|
5133
|
-
|
|
5134
|
-
|
|
5153
|
+
focusContent() {
|
|
5154
|
+
this.contentContainer.element.focus();
|
|
5135
5155
|
}
|
|
5136
|
-
|
|
5137
|
-
|
|
5156
|
+
set renderContainer(value) {
|
|
5157
|
+
this.panels.forEach((panel) => {
|
|
5158
|
+
this.renderContainer.detatch(panel);
|
|
5159
|
+
});
|
|
5160
|
+
this._overwriteRenderContainer = value;
|
|
5161
|
+
this.panels.forEach((panel) => {
|
|
5162
|
+
this.rerender(panel);
|
|
5163
|
+
});
|
|
5138
5164
|
}
|
|
5139
|
-
get
|
|
5165
|
+
get renderContainer() {
|
|
5140
5166
|
var _a;
|
|
5141
|
-
return (_a = this.
|
|
5142
|
-
}
|
|
5143
|
-
constructor(id, component, api) {
|
|
5144
|
-
super();
|
|
5145
|
-
this.id = id;
|
|
5146
|
-
this.component = component;
|
|
5147
|
-
this.api = api;
|
|
5148
|
-
this._height = 0;
|
|
5149
|
-
this._width = 0;
|
|
5150
|
-
this._element = document.createElement('div');
|
|
5151
|
-
this._element.tabIndex = -1;
|
|
5152
|
-
this._element.style.outline = 'none';
|
|
5153
|
-
this._element.style.height = '100%';
|
|
5154
|
-
this._element.style.width = '100%';
|
|
5155
|
-
this._element.style.overflow = 'hidden';
|
|
5156
|
-
const focusTracker = trackFocus(this._element);
|
|
5157
|
-
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
5158
|
-
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
5159
|
-
}), focusTracker.onDidBlur(() => {
|
|
5160
|
-
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
5161
|
-
}), focusTracker);
|
|
5167
|
+
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
5162
5168
|
}
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5169
|
+
initialize() {
|
|
5170
|
+
if (this.options.panels) {
|
|
5171
|
+
this.options.panels.forEach((panel) => {
|
|
5172
|
+
this.doAddPanel(panel);
|
|
5173
|
+
});
|
|
5168
5174
|
}
|
|
5169
|
-
this.
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
this.
|
|
5173
|
-
|
|
5174
|
-
this.
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5175
|
+
if (this.options.activePanel) {
|
|
5176
|
+
this.openPanel(this.options.activePanel);
|
|
5177
|
+
}
|
|
5178
|
+
// must be run after the constructor otherwise this.parent may not be
|
|
5179
|
+
// correctly initialized
|
|
5180
|
+
this.setActive(this.isActive, true);
|
|
5181
|
+
this.updateContainer();
|
|
5182
|
+
if (this.accessor.options.createRightHeaderActionComponent) {
|
|
5183
|
+
this._rightHeaderActions =
|
|
5184
|
+
this.accessor.options.createRightHeaderActionComponent(this.groupPanel);
|
|
5185
|
+
this.addDisposables(this._rightHeaderActions);
|
|
5186
|
+
this._rightHeaderActions.init({
|
|
5187
|
+
containerApi: this._api,
|
|
5188
|
+
api: this.groupPanel.api,
|
|
5189
|
+
group: this.groupPanel,
|
|
5190
|
+
});
|
|
5191
|
+
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
5192
|
+
}
|
|
5193
|
+
if (this.accessor.options.createLeftHeaderActionComponent) {
|
|
5194
|
+
this._leftHeaderActions =
|
|
5195
|
+
this.accessor.options.createLeftHeaderActionComponent(this.groupPanel);
|
|
5196
|
+
this.addDisposables(this._leftHeaderActions);
|
|
5197
|
+
this._leftHeaderActions.init({
|
|
5198
|
+
containerApi: this._api,
|
|
5199
|
+
api: this.groupPanel.api,
|
|
5200
|
+
group: this.groupPanel,
|
|
5201
|
+
});
|
|
5202
|
+
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
5203
|
+
}
|
|
5204
|
+
if (this.accessor.options.createPrefixHeaderActionComponent) {
|
|
5205
|
+
this._prefixHeaderActions =
|
|
5206
|
+
this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel);
|
|
5207
|
+
this.addDisposables(this._prefixHeaderActions);
|
|
5208
|
+
this._prefixHeaderActions.init({
|
|
5209
|
+
containerApi: this._api,
|
|
5210
|
+
api: this.groupPanel.api,
|
|
5211
|
+
group: this.groupPanel,
|
|
5212
|
+
});
|
|
5213
|
+
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
5179
5214
|
}
|
|
5180
5215
|
}
|
|
5181
|
-
|
|
5182
|
-
this.
|
|
5183
|
-
this.part = this.getComponent();
|
|
5216
|
+
rerender(panel) {
|
|
5217
|
+
this.contentContainer.renderPanel(panel, { asActive: false });
|
|
5184
5218
|
}
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
// merge the new parameters with the existing parameters
|
|
5188
|
-
this._params = Object.assign(Object.assign({}, this._params), { params: Object.assign(Object.assign({}, (_a = this._params) === null || _a === void 0 ? void 0 : _a.params), event.params) });
|
|
5189
|
-
/**
|
|
5190
|
-
* delete new keys that have a value of undefined,
|
|
5191
|
-
* allow values of null
|
|
5192
|
-
*/
|
|
5193
|
-
for (const key of Object.keys(event.params)) {
|
|
5194
|
-
if (event.params[key] === undefined) {
|
|
5195
|
-
delete this._params.params[key];
|
|
5196
|
-
}
|
|
5197
|
-
}
|
|
5198
|
-
// update the view with the updated props
|
|
5199
|
-
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
5219
|
+
indexOf(panel) {
|
|
5220
|
+
return this.tabsContainer.indexOf(panel.id);
|
|
5200
5221
|
}
|
|
5201
5222
|
toJSON() {
|
|
5202
|
-
var _a
|
|
5203
|
-
const
|
|
5204
|
-
|
|
5223
|
+
var _a;
|
|
5224
|
+
const result = {
|
|
5225
|
+
views: this.tabsContainer.panels,
|
|
5226
|
+
activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
|
|
5205
5227
|
id: this.id,
|
|
5206
|
-
component: this.component,
|
|
5207
|
-
params: Object.keys(params).length > 0 ? params : undefined,
|
|
5208
5228
|
};
|
|
5229
|
+
if (this.locked !== false) {
|
|
5230
|
+
result.locked = this.locked;
|
|
5231
|
+
}
|
|
5232
|
+
if (this.header.hidden) {
|
|
5233
|
+
result.hideHeader = true;
|
|
5234
|
+
}
|
|
5235
|
+
return result;
|
|
5209
5236
|
}
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
return headerSize + minimumBodySize;
|
|
5230
|
-
}
|
|
5231
|
-
get maximumSize() {
|
|
5232
|
-
const headerSize = this.headerSize;
|
|
5233
|
-
const expanded = this.isExpanded();
|
|
5234
|
-
const maximumBodySize = expanded ? this._maximumBodySize : 0;
|
|
5235
|
-
return headerSize + maximumBodySize;
|
|
5236
|
-
}
|
|
5237
|
-
get size() {
|
|
5238
|
-
return this._size;
|
|
5239
|
-
}
|
|
5240
|
-
get orthogonalSize() {
|
|
5241
|
-
return this._orthogonalSize;
|
|
5242
|
-
}
|
|
5243
|
-
set orthogonalSize(size) {
|
|
5244
|
-
this._orthogonalSize = size;
|
|
5245
|
-
}
|
|
5246
|
-
get minimumBodySize() {
|
|
5247
|
-
return this._minimumBodySize;
|
|
5248
|
-
}
|
|
5249
|
-
set minimumBodySize(value) {
|
|
5250
|
-
this._minimumBodySize = typeof value === 'number' ? value : 0;
|
|
5251
|
-
}
|
|
5252
|
-
get maximumBodySize() {
|
|
5253
|
-
return this._maximumBodySize;
|
|
5254
|
-
}
|
|
5255
|
-
set maximumBodySize(value) {
|
|
5256
|
-
this._maximumBodySize =
|
|
5257
|
-
typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
|
|
5258
|
-
}
|
|
5259
|
-
get headerVisible() {
|
|
5260
|
-
return this._headerVisible;
|
|
5261
|
-
}
|
|
5262
|
-
set headerVisible(value) {
|
|
5263
|
-
this._headerVisible = value;
|
|
5264
|
-
this.header.style.display = value ? '' : 'none';
|
|
5237
|
+
moveToNext(options) {
|
|
5238
|
+
if (!options) {
|
|
5239
|
+
options = {};
|
|
5240
|
+
}
|
|
5241
|
+
if (!options.panel) {
|
|
5242
|
+
options.panel = this.activePanel;
|
|
5243
|
+
}
|
|
5244
|
+
const index = options.panel ? this.panels.indexOf(options.panel) : -1;
|
|
5245
|
+
let normalizedIndex;
|
|
5246
|
+
if (index < this.panels.length - 1) {
|
|
5247
|
+
normalizedIndex = index + 1;
|
|
5248
|
+
}
|
|
5249
|
+
else if (!options.suppressRoll) {
|
|
5250
|
+
normalizedIndex = 0;
|
|
5251
|
+
}
|
|
5252
|
+
else {
|
|
5253
|
+
return;
|
|
5254
|
+
}
|
|
5255
|
+
this.openPanel(this.panels[normalizedIndex]);
|
|
5265
5256
|
}
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
this.
|
|
5288
|
-
const { isVisible } = event;
|
|
5289
|
-
const { accessor } = this._params;
|
|
5290
|
-
accessor.setVisible(this, isVisible);
|
|
5291
|
-
}), this.api.onDidSizeChange((event) => {
|
|
5292
|
-
this._onDidChange.fire({ size: event.size });
|
|
5293
|
-
}), addDisposableListener(this.element, 'mouseenter', (ev) => {
|
|
5294
|
-
this.api._onMouseEnter.fire(ev);
|
|
5295
|
-
}), addDisposableListener(this.element, 'mouseleave', (ev) => {
|
|
5296
|
-
this.api._onMouseLeave.fire(ev);
|
|
5297
|
-
}));
|
|
5298
|
-
this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {
|
|
5299
|
-
this.api._onDidExpansionChange.fire({
|
|
5300
|
-
isExpanded: isPanelExpanded,
|
|
5301
|
-
});
|
|
5302
|
-
}), this.api.onDidFocusChange((e) => {
|
|
5303
|
-
if (!this.header) {
|
|
5304
|
-
return;
|
|
5305
|
-
}
|
|
5306
|
-
if (e.isFocused) {
|
|
5307
|
-
addClasses(this.header, 'focused');
|
|
5308
|
-
}
|
|
5309
|
-
else {
|
|
5310
|
-
removeClasses(this.header, 'focused');
|
|
5311
|
-
}
|
|
5312
|
-
}));
|
|
5313
|
-
this.renderOnce();
|
|
5257
|
+
moveToPrevious(options) {
|
|
5258
|
+
if (!options) {
|
|
5259
|
+
options = {};
|
|
5260
|
+
}
|
|
5261
|
+
if (!options.panel) {
|
|
5262
|
+
options.panel = this.activePanel;
|
|
5263
|
+
}
|
|
5264
|
+
if (!options.panel) {
|
|
5265
|
+
return;
|
|
5266
|
+
}
|
|
5267
|
+
const index = this.panels.indexOf(options.panel);
|
|
5268
|
+
let normalizedIndex;
|
|
5269
|
+
if (index > 0) {
|
|
5270
|
+
normalizedIndex = index - 1;
|
|
5271
|
+
}
|
|
5272
|
+
else if (!options.suppressRoll) {
|
|
5273
|
+
normalizedIndex = this.panels.length - 1;
|
|
5274
|
+
}
|
|
5275
|
+
else {
|
|
5276
|
+
return;
|
|
5277
|
+
}
|
|
5278
|
+
this.openPanel(this.panels[normalizedIndex]);
|
|
5314
5279
|
}
|
|
5315
|
-
|
|
5316
|
-
this.
|
|
5280
|
+
containsPanel(panel) {
|
|
5281
|
+
return this.panels.includes(panel);
|
|
5317
5282
|
}
|
|
5318
|
-
|
|
5319
|
-
|
|
5283
|
+
init(_params) {
|
|
5284
|
+
//noop
|
|
5320
5285
|
}
|
|
5321
|
-
|
|
5322
|
-
|
|
5286
|
+
update(_params) {
|
|
5287
|
+
//noop
|
|
5323
5288
|
}
|
|
5324
|
-
|
|
5325
|
-
|
|
5289
|
+
focus() {
|
|
5290
|
+
var _a;
|
|
5291
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
5292
|
+
}
|
|
5293
|
+
openPanel(panel, options = {}) {
|
|
5294
|
+
/**
|
|
5295
|
+
* set the panel group
|
|
5296
|
+
* add the panel
|
|
5297
|
+
* check if group active
|
|
5298
|
+
* check if panel active
|
|
5299
|
+
*/
|
|
5300
|
+
if (typeof options.index !== 'number' ||
|
|
5301
|
+
options.index > this.panels.length) {
|
|
5302
|
+
options.index = this.panels.length;
|
|
5303
|
+
}
|
|
5304
|
+
const skipSetActive = !!options.skipSetActive;
|
|
5305
|
+
// ensure the group is updated before we fire any events
|
|
5306
|
+
panel.updateParentGroup(this.groupPanel, {
|
|
5307
|
+
skipSetActive: options.skipSetActive,
|
|
5308
|
+
});
|
|
5309
|
+
this.doAddPanel(panel, options.index, {
|
|
5310
|
+
skipSetActive: skipSetActive,
|
|
5311
|
+
});
|
|
5312
|
+
if (this._activePanel === panel) {
|
|
5313
|
+
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
5326
5314
|
return;
|
|
5327
5315
|
}
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5316
|
+
if (!skipSetActive) {
|
|
5317
|
+
this.doSetActivePanel(panel);
|
|
5318
|
+
}
|
|
5319
|
+
if (!options.skipSetGroupActive) {
|
|
5320
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
5321
|
+
}
|
|
5322
|
+
if (!options.skipSetActive) {
|
|
5323
|
+
this.updateContainer();
|
|
5324
|
+
}
|
|
5325
|
+
}
|
|
5326
|
+
removePanel(groupItemOrId, options = {
|
|
5327
|
+
skipSetActive: false,
|
|
5328
|
+
}) {
|
|
5329
|
+
const id = typeof groupItemOrId === 'string'
|
|
5330
|
+
? groupItemOrId
|
|
5331
|
+
: groupItemOrId.id;
|
|
5332
|
+
const panelToRemove = this._panels.find((panel) => panel.id === id);
|
|
5333
|
+
if (!panelToRemove) {
|
|
5334
|
+
throw new Error('invalid operation');
|
|
5335
|
+
}
|
|
5336
|
+
return this._removePanel(panelToRemove, options);
|
|
5337
|
+
}
|
|
5338
|
+
closeAllPanels() {
|
|
5339
|
+
if (this.panels.length > 0) {
|
|
5340
|
+
// take a copy since we will be edting the array as we iterate through
|
|
5341
|
+
const arrPanelCpy = [...this.panels];
|
|
5342
|
+
for (const panel of arrPanelCpy) {
|
|
5343
|
+
this.doClose(panel);
|
|
5335
5344
|
}
|
|
5336
5345
|
}
|
|
5337
5346
|
else {
|
|
5338
|
-
this.
|
|
5339
|
-
var _a;
|
|
5340
|
-
(_a = this.body) === null || _a === void 0 ? void 0 : _a.remove();
|
|
5341
|
-
}, 200);
|
|
5347
|
+
this.accessor.removeGroup(this.groupPanel);
|
|
5342
5348
|
}
|
|
5343
|
-
this._onDidChange.fire(expanded ? { size: this.width } : {});
|
|
5344
|
-
this._onDidChangeExpansionState.fire(expanded);
|
|
5345
5349
|
}
|
|
5346
|
-
|
|
5347
|
-
this.
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5350
|
+
closePanel(panel) {
|
|
5351
|
+
this.doClose(panel);
|
|
5352
|
+
}
|
|
5353
|
+
doClose(panel) {
|
|
5354
|
+
this.accessor.removePanel(panel);
|
|
5355
|
+
}
|
|
5356
|
+
isPanelActive(panel) {
|
|
5357
|
+
return this._activePanel === panel;
|
|
5358
|
+
}
|
|
5359
|
+
updateActions(element) {
|
|
5360
|
+
this.tabsContainer.setRightActionsElement(element);
|
|
5361
|
+
}
|
|
5362
|
+
setActive(isGroupActive, force = false) {
|
|
5363
|
+
if (!force && this.isActive === isGroupActive) {
|
|
5364
|
+
return;
|
|
5354
5365
|
}
|
|
5355
|
-
|
|
5366
|
+
this._isGroupActive = isGroupActive;
|
|
5367
|
+
toggleClass(this.container, 'active-group', isGroupActive);
|
|
5368
|
+
toggleClass(this.container, 'inactive-group', !isGroupActive);
|
|
5369
|
+
this.tabsContainer.setActive(this.isActive);
|
|
5370
|
+
if (!this._activePanel && this.panels.length > 0) {
|
|
5371
|
+
this.doSetActivePanel(this.panels[0]);
|
|
5372
|
+
}
|
|
5373
|
+
this.updateContainer();
|
|
5356
5374
|
}
|
|
5357
|
-
|
|
5358
|
-
var _a
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5375
|
+
layout(width, height) {
|
|
5376
|
+
var _a;
|
|
5377
|
+
this._width = width;
|
|
5378
|
+
this._height = height;
|
|
5379
|
+
this.contentContainer.layout(this._width, this._height);
|
|
5380
|
+
if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
|
|
5381
|
+
this._activePanel.layout(this._width, this._height);
|
|
5362
5382
|
}
|
|
5363
|
-
|
|
5364
|
-
|
|
5383
|
+
}
|
|
5384
|
+
_removePanel(panel, options) {
|
|
5385
|
+
const isActivePanel = this._activePanel === panel;
|
|
5386
|
+
this.doRemovePanel(panel);
|
|
5387
|
+
if (isActivePanel && this.panels.length > 0) {
|
|
5388
|
+
const nextPanel = this.mostRecentlyUsed[0];
|
|
5389
|
+
this.openPanel(nextPanel, {
|
|
5390
|
+
skipSetActive: options.skipSetActive,
|
|
5391
|
+
skipSetGroupActive: options.skipSetActiveGroup,
|
|
5392
|
+
});
|
|
5365
5393
|
}
|
|
5366
|
-
this.
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
(_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);
|
|
5372
|
-
if (typeof parameters.isExpanded === 'boolean') {
|
|
5373
|
-
this.setExpanded(parameters.isExpanded);
|
|
5394
|
+
if (this._activePanel && this.panels.length === 0) {
|
|
5395
|
+
this.doSetActivePanel(undefined);
|
|
5396
|
+
}
|
|
5397
|
+
if (!options.skipSetActive) {
|
|
5398
|
+
this.updateContainer();
|
|
5374
5399
|
}
|
|
5400
|
+
return panel;
|
|
5375
5401
|
}
|
|
5376
|
-
|
|
5377
|
-
const
|
|
5378
|
-
|
|
5402
|
+
doRemovePanel(panel) {
|
|
5403
|
+
const index = this.panels.indexOf(panel);
|
|
5404
|
+
if (this._activePanel === panel) {
|
|
5405
|
+
this.contentContainer.closePanel();
|
|
5406
|
+
}
|
|
5407
|
+
this.tabsContainer.delete(panel.id);
|
|
5408
|
+
this._panels.splice(index, 1);
|
|
5409
|
+
if (this.mostRecentlyUsed.includes(panel)) {
|
|
5410
|
+
const index = this.mostRecentlyUsed.indexOf(panel);
|
|
5411
|
+
this.mostRecentlyUsed.splice(index, 1);
|
|
5412
|
+
}
|
|
5413
|
+
const disposable = this._panelDisposables.get(panel.id);
|
|
5414
|
+
if (disposable) {
|
|
5415
|
+
disposable.dispose();
|
|
5416
|
+
this._panelDisposables.delete(panel.id);
|
|
5417
|
+
}
|
|
5418
|
+
this._onDidRemovePanel.fire({ panel });
|
|
5379
5419
|
}
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
this.
|
|
5384
|
-
this.
|
|
5385
|
-
this.
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5420
|
+
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
5421
|
+
const existingPanel = this._panels.indexOf(panel);
|
|
5422
|
+
const hasExistingPanel = existingPanel > -1;
|
|
5423
|
+
this.tabsContainer.show();
|
|
5424
|
+
this.contentContainer.show();
|
|
5425
|
+
this.tabsContainer.openPanel(panel, index);
|
|
5426
|
+
if (!options.skipSetActive) {
|
|
5427
|
+
this.contentContainer.openPanel(panel);
|
|
5428
|
+
}
|
|
5429
|
+
if (hasExistingPanel) {
|
|
5430
|
+
// TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
|
|
5431
|
+
return;
|
|
5432
|
+
}
|
|
5433
|
+
this.updateMru(panel);
|
|
5434
|
+
this.panels.splice(index, 0, panel);
|
|
5435
|
+
this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
|
|
5436
|
+
this._onDidAddPanel.fire({ panel });
|
|
5392
5437
|
}
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
};
|
|
5438
|
+
doSetActivePanel(panel) {
|
|
5439
|
+
if (this._activePanel === panel) {
|
|
5440
|
+
return;
|
|
5441
|
+
}
|
|
5442
|
+
this._activePanel = panel;
|
|
5443
|
+
if (panel) {
|
|
5444
|
+
this.tabsContainer.setActivePanel(panel);
|
|
5445
|
+
panel.layout(this._width, this._height);
|
|
5446
|
+
this.updateMru(panel);
|
|
5447
|
+
this._onDidActivePanelChange.fire({
|
|
5448
|
+
panel,
|
|
5449
|
+
});
|
|
5450
|
+
}
|
|
5407
5451
|
}
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
5412
|
-
super(id, component, headerComponent, orientation, isExpanded, true);
|
|
5413
|
-
this.accessor = accessor;
|
|
5414
|
-
this._onDidDrop = new Emitter();
|
|
5415
|
-
this.onDidDrop = this._onDidDrop.event;
|
|
5416
|
-
if (!disableDnd) {
|
|
5417
|
-
this.initDragFeatures();
|
|
5452
|
+
updateMru(panel) {
|
|
5453
|
+
if (this.mostRecentlyUsed.includes(panel)) {
|
|
5454
|
+
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
5418
5455
|
}
|
|
5456
|
+
this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
|
|
5419
5457
|
}
|
|
5420
|
-
|
|
5421
|
-
|
|
5458
|
+
updateContainer() {
|
|
5459
|
+
var _a, _b;
|
|
5460
|
+
toggleClass(this.container, 'empty', this.isEmpty);
|
|
5461
|
+
this.panels.forEach((panel) => panel.runEvents());
|
|
5462
|
+
if (this.isEmpty && !this.watermark) {
|
|
5463
|
+
const watermark = this.accessor.createWatermarkComponent();
|
|
5464
|
+
watermark.init({
|
|
5465
|
+
containerApi: this._api,
|
|
5466
|
+
group: this.groupPanel,
|
|
5467
|
+
});
|
|
5468
|
+
this.watermark = watermark;
|
|
5469
|
+
addDisposableListener(this.watermark.element, 'click', () => {
|
|
5470
|
+
if (!this.isActive) {
|
|
5471
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
5472
|
+
}
|
|
5473
|
+
});
|
|
5474
|
+
this.tabsContainer.hide();
|
|
5475
|
+
this.contentContainer.element.appendChild(this.watermark.element);
|
|
5476
|
+
this.watermark.updateParentGroup(this.groupPanel, true);
|
|
5477
|
+
}
|
|
5478
|
+
if (!this.isEmpty && this.watermark) {
|
|
5479
|
+
this.watermark.element.remove();
|
|
5480
|
+
(_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
5481
|
+
this.watermark = undefined;
|
|
5482
|
+
this.tabsContainer.show();
|
|
5483
|
+
}
|
|
5484
|
+
}
|
|
5485
|
+
canDisplayOverlay(event, position, target) {
|
|
5486
|
+
const firedEvent = new DockviewUnhandledDragOverEvent(event, target, position, getPanelData, this.accessor.getPanel(this.id));
|
|
5487
|
+
this._onUnhandledDragOverEvent.fire(firedEvent);
|
|
5488
|
+
return firedEvent.isAccepted;
|
|
5489
|
+
}
|
|
5490
|
+
handleDropEvent(type, event, position, index) {
|
|
5491
|
+
if (this.locked === 'no-drop-target') {
|
|
5422
5492
|
return;
|
|
5423
5493
|
}
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
return {
|
|
5431
|
-
dispose: () => {
|
|
5432
|
-
LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
|
|
5433
|
-
},
|
|
5434
|
-
};
|
|
5494
|
+
function getKind() {
|
|
5495
|
+
switch (type) {
|
|
5496
|
+
case 'header':
|
|
5497
|
+
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
5498
|
+
case 'content':
|
|
5499
|
+
return 'content';
|
|
5435
5500
|
}
|
|
5436
|
-
}
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
data.viewId === this.accessor.id) {
|
|
5447
|
-
return true;
|
|
5448
|
-
}
|
|
5449
|
-
}
|
|
5450
|
-
if (this.accessor.options.showDndOverlay) {
|
|
5451
|
-
return this.accessor.options.showDndOverlay({
|
|
5452
|
-
nativeEvent: event,
|
|
5453
|
-
getData: getPaneData,
|
|
5454
|
-
panel: this,
|
|
5455
|
-
});
|
|
5456
|
-
}
|
|
5457
|
-
return false;
|
|
5458
|
-
},
|
|
5501
|
+
}
|
|
5502
|
+
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
5503
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
5504
|
+
nativeEvent: event,
|
|
5505
|
+
position,
|
|
5506
|
+
panel,
|
|
5507
|
+
getData: () => getPanelData(),
|
|
5508
|
+
kind: getKind(),
|
|
5509
|
+
group: this.groupPanel,
|
|
5510
|
+
api: this._api,
|
|
5459
5511
|
});
|
|
5460
|
-
this.
|
|
5461
|
-
|
|
5462
|
-
}));
|
|
5463
|
-
}
|
|
5464
|
-
onDrop(event) {
|
|
5465
|
-
const data = getPaneData();
|
|
5466
|
-
if (!data || data.viewId !== this.accessor.id) {
|
|
5467
|
-
// if there is no local drag event for this panel
|
|
5468
|
-
// or if the drag event was creating by another Paneview instance
|
|
5469
|
-
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, api: new PaneviewApi(this.accessor), getData: getPaneData }));
|
|
5512
|
+
this._onWillDrop.fire(willDropEvent);
|
|
5513
|
+
if (willDropEvent.defaultPrevented) {
|
|
5470
5514
|
return;
|
|
5471
5515
|
}
|
|
5472
|
-
const
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5516
|
+
const data = getPanelData();
|
|
5517
|
+
if (data && data.viewId === this.accessor.id) {
|
|
5518
|
+
if (data.panelId === null) {
|
|
5519
|
+
// this is a group move dnd event
|
|
5520
|
+
const { groupId } = data;
|
|
5521
|
+
this._onMove.fire({
|
|
5522
|
+
target: position,
|
|
5523
|
+
groupId: groupId,
|
|
5524
|
+
index,
|
|
5525
|
+
});
|
|
5526
|
+
return;
|
|
5527
|
+
}
|
|
5528
|
+
const fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
|
|
5529
|
+
if (fromSameGroup && this.tabsContainer.size === 1) {
|
|
5530
|
+
return;
|
|
5531
|
+
}
|
|
5532
|
+
const { groupId, panelId } = data;
|
|
5533
|
+
const isSameGroup = this.id === groupId;
|
|
5534
|
+
if (isSameGroup && !position) {
|
|
5535
|
+
const oldIndex = this.tabsContainer.indexOf(panelId);
|
|
5536
|
+
if (oldIndex === index) {
|
|
5537
|
+
return;
|
|
5538
|
+
}
|
|
5539
|
+
}
|
|
5540
|
+
this._onMove.fire({
|
|
5541
|
+
target: position,
|
|
5542
|
+
groupId: data.groupId,
|
|
5543
|
+
itemId: data.panelId,
|
|
5544
|
+
index,
|
|
5545
|
+
});
|
|
5480
5546
|
}
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5547
|
+
else {
|
|
5548
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
5549
|
+
nativeEvent: event,
|
|
5550
|
+
position,
|
|
5551
|
+
panel,
|
|
5552
|
+
getData: () => getPanelData(),
|
|
5553
|
+
group: this.groupPanel,
|
|
5554
|
+
api: this._api,
|
|
5555
|
+
}));
|
|
5486
5556
|
}
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5557
|
+
}
|
|
5558
|
+
dispose() {
|
|
5559
|
+
var _a, _b, _c;
|
|
5560
|
+
super.dispose();
|
|
5561
|
+
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
5562
|
+
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
5563
|
+
this.watermark = undefined;
|
|
5564
|
+
for (const panel of this.panels) {
|
|
5565
|
+
panel.dispose();
|
|
5492
5566
|
}
|
|
5493
|
-
|
|
5567
|
+
this.tabsContainer.dispose();
|
|
5568
|
+
this.contentContainer.dispose();
|
|
5494
5569
|
}
|
|
5495
5570
|
}
|
|
5496
5571
|
|
|
@@ -5677,9 +5752,12 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5677
5752
|
constructor(id, accessor) {
|
|
5678
5753
|
super(id, '__dockviewgroup__');
|
|
5679
5754
|
this.accessor = accessor;
|
|
5755
|
+
this._mutableDisposable = new MutableDisposable();
|
|
5680
5756
|
this._onDidLocationChange = new Emitter();
|
|
5681
5757
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5682
|
-
this.
|
|
5758
|
+
this._onDidActivePanelChange = new Emitter();
|
|
5759
|
+
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
5760
|
+
this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._mutableDisposable);
|
|
5683
5761
|
}
|
|
5684
5762
|
close() {
|
|
5685
5763
|
if (!this._group) {
|
|
@@ -5737,6 +5815,19 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5737
5815
|
}
|
|
5738
5816
|
initialize(group) {
|
|
5739
5817
|
this._group = group;
|
|
5818
|
+
/**
|
|
5819
|
+
* TODO: Annoying initialization order caveat
|
|
5820
|
+
*
|
|
5821
|
+
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
|
5822
|
+
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
|
5823
|
+
* finished ensuring the `model` is defined.
|
|
5824
|
+
*/
|
|
5825
|
+
queueMicrotask(() => {
|
|
5826
|
+
this._mutableDisposable.value =
|
|
5827
|
+
this._group.model.onDidActivePanelChange((event) => {
|
|
5828
|
+
this._onDidActivePanelChange.fire(event);
|
|
5829
|
+
});
|
|
5830
|
+
});
|
|
5740
5831
|
}
|
|
5741
5832
|
}
|
|
5742
5833
|
|
|
@@ -5797,31 +5888,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
5797
5888
|
}
|
|
5798
5889
|
}
|
|
5799
5890
|
|
|
5800
|
-
function isPanelOptionsWithPanel(data) {
|
|
5801
|
-
if (data.referencePanel) {
|
|
5802
|
-
return true;
|
|
5803
|
-
}
|
|
5804
|
-
return false;
|
|
5805
|
-
}
|
|
5806
|
-
function isPanelOptionsWithGroup(data) {
|
|
5807
|
-
if (data.referenceGroup) {
|
|
5808
|
-
return true;
|
|
5809
|
-
}
|
|
5810
|
-
return false;
|
|
5811
|
-
}
|
|
5812
|
-
function isGroupOptionsWithPanel(data) {
|
|
5813
|
-
if (data.referencePanel) {
|
|
5814
|
-
return true;
|
|
5815
|
-
}
|
|
5816
|
-
return false;
|
|
5817
|
-
}
|
|
5818
|
-
function isGroupOptionsWithGroup(data) {
|
|
5819
|
-
if (data.referenceGroup) {
|
|
5820
|
-
return true;
|
|
5821
|
-
}
|
|
5822
|
-
return false;
|
|
5823
|
-
}
|
|
5824
|
-
|
|
5825
5891
|
class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
5826
5892
|
get location() {
|
|
5827
5893
|
return this.group.api.location;
|
|
@@ -6189,7 +6255,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6189
6255
|
this._tab = this.createTabComponent(this.id, tabComponent);
|
|
6190
6256
|
}
|
|
6191
6257
|
init(params) {
|
|
6192
|
-
this.content.init(
|
|
6258
|
+
this.content.init(params);
|
|
6193
6259
|
this.tab.init(params);
|
|
6194
6260
|
}
|
|
6195
6261
|
updateParentGroup(_group, _isPanelVisible) {
|
|
@@ -6210,20 +6276,29 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6210
6276
|
(_d = (_c = this.tab).dispose) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
6211
6277
|
}
|
|
6212
6278
|
createContentComponent(id, componentName) {
|
|
6213
|
-
|
|
6214
|
-
|
|
6279
|
+
return this.accessor.options.createComponent({
|
|
6280
|
+
id,
|
|
6281
|
+
name: componentName,
|
|
6282
|
+
});
|
|
6215
6283
|
}
|
|
6216
6284
|
createTabComponent(id, componentName) {
|
|
6217
|
-
|
|
6218
|
-
if (
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6285
|
+
const name = componentName !== null && componentName !== void 0 ? componentName : this.accessor.options.defaultTabComponent;
|
|
6286
|
+
if (name) {
|
|
6287
|
+
if (this.accessor.options.createTabComponent) {
|
|
6288
|
+
const component = this.accessor.options.createTabComponent({
|
|
6289
|
+
id,
|
|
6290
|
+
name,
|
|
6291
|
+
});
|
|
6292
|
+
if (component) {
|
|
6293
|
+
return component;
|
|
6294
|
+
}
|
|
6295
|
+
else {
|
|
6296
|
+
return new DefaultTab();
|
|
6297
|
+
}
|
|
6298
|
+
}
|
|
6299
|
+
console.warn(`dockview: tabComponent '${componentName}' was not found. falling back to the default tab.`);
|
|
6226
6300
|
}
|
|
6301
|
+
return new DefaultTab();
|
|
6227
6302
|
}
|
|
6228
6303
|
}
|
|
6229
6304
|
|
|
@@ -6983,11 +7058,13 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
6983
7058
|
return this._api;
|
|
6984
7059
|
}
|
|
6985
7060
|
constructor(options) {
|
|
6986
|
-
var _a
|
|
7061
|
+
var _a;
|
|
6987
7062
|
super({
|
|
6988
7063
|
proportionalLayout: true,
|
|
6989
|
-
orientation:
|
|
6990
|
-
styles: options.
|
|
7064
|
+
orientation: exports.Orientation.HORIZONTAL,
|
|
7065
|
+
styles: options.hideBorders
|
|
7066
|
+
? { separatorBorder: 'transparent' }
|
|
7067
|
+
: undefined,
|
|
6991
7068
|
parentElement: options.parentElement,
|
|
6992
7069
|
disableAutoResizing: options.disableAutoResizing,
|
|
6993
7070
|
locked: options.locked,
|
|
@@ -7005,6 +7082,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7005
7082
|
this.onWillDrop = this._onWillDrop.event;
|
|
7006
7083
|
this._onWillShowOverlay = new Emitter();
|
|
7007
7084
|
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
7085
|
+
this._onUnhandledDragOverEvent = new Emitter();
|
|
7086
|
+
this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
|
|
7008
7087
|
this._onDidRemovePanel = new Emitter();
|
|
7009
7088
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
7010
7089
|
this._onDidAddPanel = new Emitter();
|
|
@@ -7030,7 +7109,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7030
7109
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7031
7110
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
7032
7111
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
7033
|
-
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this.onDidAdd((event) => {
|
|
7112
|
+
this.addDisposables(this.overlayRenderContainer, this._onWillDragPanel, this._onWillDragGroup, this._onWillShowOverlay, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, this._onWillDrop, this._onDidMovePanel, this._onDidAddGroup, this._onDidRemoveGroup, this._onDidActiveGroupChange, this._onUnhandledDragOverEvent, this.onDidAdd((event) => {
|
|
7034
7113
|
if (!this._moving) {
|
|
7035
7114
|
this._onDidAddGroup.fire(event);
|
|
7036
7115
|
}
|
|
@@ -7057,22 +7136,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7057
7136
|
}
|
|
7058
7137
|
}));
|
|
7059
7138
|
this._options = options;
|
|
7060
|
-
if (!this.options.components) {
|
|
7061
|
-
this.options.components = {};
|
|
7062
|
-
}
|
|
7063
|
-
if (!this.options.frameworkComponents) {
|
|
7064
|
-
this.options.frameworkComponents = {};
|
|
7065
|
-
}
|
|
7066
|
-
if (!this.options.frameworkTabComponents) {
|
|
7067
|
-
this.options.frameworkTabComponents = {};
|
|
7068
|
-
}
|
|
7069
|
-
if (!this.options.tabComponents) {
|
|
7070
|
-
this.options.tabComponents = {};
|
|
7071
|
-
}
|
|
7072
|
-
if (!this.options.watermarkComponent &&
|
|
7073
|
-
!this.options.watermarkFrameworkComponent) {
|
|
7074
|
-
this.options.watermarkComponent = Watermark;
|
|
7075
|
-
}
|
|
7076
7139
|
this._rootDropTarget = new Droptarget(this.element, {
|
|
7077
7140
|
canDisplayOverlay: (event, position) => {
|
|
7078
7141
|
const data = getPanelData();
|
|
@@ -7087,26 +7150,20 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7087
7150
|
}
|
|
7088
7151
|
return true;
|
|
7089
7152
|
}
|
|
7090
|
-
if (this.
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
return false;
|
|
7098
|
-
}
|
|
7099
|
-
return this.options.showDndOverlay({
|
|
7100
|
-
nativeEvent: event,
|
|
7101
|
-
position: position,
|
|
7102
|
-
target: 'edge',
|
|
7103
|
-
getData: getPanelData,
|
|
7104
|
-
});
|
|
7153
|
+
if (position === 'center' && this.gridview.length !== 0) {
|
|
7154
|
+
/**
|
|
7155
|
+
* for external events only show the four-corner drag overlays, disable
|
|
7156
|
+
* the center position so that external drag events can fall through to the group
|
|
7157
|
+
* and panel drop target handlers
|
|
7158
|
+
*/
|
|
7159
|
+
return false;
|
|
7105
7160
|
}
|
|
7106
|
-
|
|
7161
|
+
const firedEvent = new DockviewUnhandledDragOverEvent(event, 'edge', position, getPanelData);
|
|
7162
|
+
this._onUnhandledDragOverEvent.fire(firedEvent);
|
|
7163
|
+
return firedEvent.isAccepted;
|
|
7107
7164
|
},
|
|
7108
7165
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
7109
|
-
overlayModel: (
|
|
7166
|
+
overlayModel: (_a = this.options.rootOverlayModel) !== null && _a !== void 0 ? _a : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
7110
7167
|
});
|
|
7111
7168
|
this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
|
|
7112
7169
|
if (this.gridview.length > 0 && event.position === 'center') {
|
|
@@ -7330,7 +7387,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7330
7387
|
skipDispose: true,
|
|
7331
7388
|
skipSetActiveGroup: true,
|
|
7332
7389
|
}));
|
|
7333
|
-
group.model.openPanel(item, { skipSetGroupActive: true });
|
|
7390
|
+
this.movingLock(() => group.model.openPanel(item, { skipSetGroupActive: true }));
|
|
7334
7391
|
}
|
|
7335
7392
|
else {
|
|
7336
7393
|
group = item;
|
|
@@ -7403,7 +7460,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7403
7460
|
// this is either a resize or a move
|
|
7404
7461
|
// to inform the panels .layout(...) the group with it's current size
|
|
7405
7462
|
// don't care about resize since the above watcher handles that
|
|
7406
|
-
group.layout(group.
|
|
7463
|
+
group.layout(group.width, group.height);
|
|
7407
7464
|
}), overlay.onDidChangeEnd(() => {
|
|
7408
7465
|
this._bufferOnDidLayoutChange.fire();
|
|
7409
7466
|
}), group.onDidChange((event) => {
|
|
@@ -7458,16 +7515,11 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7458
7515
|
}
|
|
7459
7516
|
updateOptions(options) {
|
|
7460
7517
|
var _a, _b;
|
|
7461
|
-
const
|
|
7462
|
-
this.gridview.orientation !== options.orientation;
|
|
7463
|
-
const changed_floatingGroupBounds = options.floatingGroupBounds !== undefined &&
|
|
7518
|
+
const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
|
|
7464
7519
|
options.floatingGroupBounds !== this.options.floatingGroupBounds;
|
|
7465
|
-
const changed_rootOverlayOptions =
|
|
7520
|
+
const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
|
|
7466
7521
|
options.rootOverlayModel !== this.options.rootOverlayModel;
|
|
7467
7522
|
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
7468
|
-
if (changed_orientation) {
|
|
7469
|
-
this.gridview.orientation = options.orientation;
|
|
7470
|
-
}
|
|
7471
7523
|
if (changed_floatingGroupBounds) {
|
|
7472
7524
|
for (const group of this._floatingGroups) {
|
|
7473
7525
|
switch (this.options.floatingGroupBounds) {
|
|
@@ -7755,7 +7807,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7755
7807
|
? this.getGroupPanel(options.position.referencePanel)
|
|
7756
7808
|
: options.position.referencePanel;
|
|
7757
7809
|
if (!referencePanel) {
|
|
7758
|
-
throw new Error(`referencePanel ${options.position.referencePanel} does not exist`);
|
|
7810
|
+
throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
|
|
7759
7811
|
}
|
|
7760
7812
|
referenceGroup = this.findGroup(referencePanel);
|
|
7761
7813
|
}
|
|
@@ -7765,14 +7817,19 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7765
7817
|
? (_a = this._groups.get(options.position.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
|
|
7766
7818
|
: options.position.referenceGroup;
|
|
7767
7819
|
if (!referenceGroup) {
|
|
7768
|
-
throw new Error(`
|
|
7820
|
+
throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
|
|
7769
7821
|
}
|
|
7770
7822
|
}
|
|
7771
7823
|
else {
|
|
7772
7824
|
const group = this.orthogonalize(directionToPosition(options.position.direction));
|
|
7773
7825
|
const panel = this.createPanel(options, group);
|
|
7774
|
-
group.model.openPanel(panel
|
|
7775
|
-
|
|
7826
|
+
group.model.openPanel(panel, {
|
|
7827
|
+
skipSetActive: options.inactive,
|
|
7828
|
+
skipSetGroupActive: options.inactive,
|
|
7829
|
+
});
|
|
7830
|
+
if (!options.inactive) {
|
|
7831
|
+
this.doSetGroupAndPanelActive(group);
|
|
7832
|
+
}
|
|
7776
7833
|
return panel;
|
|
7777
7834
|
}
|
|
7778
7835
|
}
|
|
@@ -7795,43 +7852,64 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7795
7852
|
skipActiveGroup: true,
|
|
7796
7853
|
});
|
|
7797
7854
|
panel = this.createPanel(options, group);
|
|
7798
|
-
group.model.openPanel(panel
|
|
7855
|
+
group.model.openPanel(panel, {
|
|
7856
|
+
skipSetActive: options.inactive,
|
|
7857
|
+
skipSetGroupActive: options.inactive,
|
|
7858
|
+
});
|
|
7799
7859
|
}
|
|
7800
7860
|
else if (referenceGroup.api.location.type === 'floating' ||
|
|
7801
7861
|
target === 'center') {
|
|
7802
7862
|
panel = this.createPanel(options, referenceGroup);
|
|
7803
|
-
referenceGroup.model.openPanel(panel
|
|
7804
|
-
|
|
7863
|
+
referenceGroup.model.openPanel(panel, {
|
|
7864
|
+
skipSetActive: options.inactive,
|
|
7865
|
+
skipSetGroupActive: options.inactive,
|
|
7866
|
+
});
|
|
7867
|
+
if (!options.inactive) {
|
|
7868
|
+
this.doSetGroupAndPanelActive(referenceGroup);
|
|
7869
|
+
}
|
|
7805
7870
|
}
|
|
7806
7871
|
else {
|
|
7807
7872
|
const location = getGridLocation(referenceGroup.element);
|
|
7808
7873
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7809
7874
|
const group = this.createGroupAtLocation(relativeLocation);
|
|
7810
7875
|
panel = this.createPanel(options, group);
|
|
7811
|
-
group.model.openPanel(panel
|
|
7812
|
-
|
|
7876
|
+
group.model.openPanel(panel, {
|
|
7877
|
+
skipSetActive: options.inactive,
|
|
7878
|
+
skipSetGroupActive: options.inactive,
|
|
7879
|
+
});
|
|
7880
|
+
if (!options.inactive) {
|
|
7881
|
+
this.doSetGroupAndPanelActive(group);
|
|
7882
|
+
}
|
|
7813
7883
|
}
|
|
7814
7884
|
}
|
|
7815
7885
|
else if (options.floating) {
|
|
7816
7886
|
const group = this.createGroup();
|
|
7817
7887
|
this._onDidAddGroup.fire(group);
|
|
7818
|
-
const
|
|
7888
|
+
const coordinates = typeof options.floating === 'object' &&
|
|
7819
7889
|
options.floating !== null
|
|
7820
7890
|
? options.floating
|
|
7821
7891
|
: {};
|
|
7822
|
-
this.addFloatingGroup(group,
|
|
7892
|
+
this.addFloatingGroup(group, coordinates, {
|
|
7823
7893
|
inDragMode: false,
|
|
7824
7894
|
skipRemoveGroup: true,
|
|
7825
7895
|
skipActiveGroup: true,
|
|
7826
7896
|
});
|
|
7827
7897
|
panel = this.createPanel(options, group);
|
|
7828
|
-
group.model.openPanel(panel
|
|
7898
|
+
group.model.openPanel(panel, {
|
|
7899
|
+
skipSetActive: options.inactive,
|
|
7900
|
+
skipSetGroupActive: options.inactive,
|
|
7901
|
+
});
|
|
7829
7902
|
}
|
|
7830
7903
|
else {
|
|
7831
7904
|
const group = this.createGroupAtLocation();
|
|
7832
7905
|
panel = this.createPanel(options, group);
|
|
7833
|
-
group.model.openPanel(panel
|
|
7834
|
-
|
|
7906
|
+
group.model.openPanel(panel, {
|
|
7907
|
+
skipSetActive: options.inactive,
|
|
7908
|
+
skipSetGroupActive: options.inactive,
|
|
7909
|
+
});
|
|
7910
|
+
if (!options.inactive) {
|
|
7911
|
+
this.doSetGroupAndPanelActive(group);
|
|
7912
|
+
}
|
|
7835
7913
|
}
|
|
7836
7914
|
return panel;
|
|
7837
7915
|
}
|
|
@@ -7855,12 +7933,10 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7855
7933
|
}
|
|
7856
7934
|
}
|
|
7857
7935
|
createWatermarkComponent() {
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
? { 'watermark-name': this.options.watermarkFrameworkComponent }
|
|
7863
|
-
: {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
|
|
7936
|
+
if (this.options.createWatermarkComponent) {
|
|
7937
|
+
return this.options.createWatermarkComponent();
|
|
7938
|
+
}
|
|
7939
|
+
return new Watermark();
|
|
7864
7940
|
}
|
|
7865
7941
|
updateWatermark() {
|
|
7866
7942
|
var _a, _b;
|
|
@@ -7884,7 +7960,6 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7884
7960
|
}
|
|
7885
7961
|
addGroup(options) {
|
|
7886
7962
|
var _a;
|
|
7887
|
-
const group = this.createGroup(options);
|
|
7888
7963
|
if (options) {
|
|
7889
7964
|
let referenceGroup;
|
|
7890
7965
|
if (isGroupOptionsWithPanel(options)) {
|
|
@@ -7918,6 +7993,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7918
7993
|
const target = toTarget(options.direction || 'within');
|
|
7919
7994
|
const location = getGridLocation(referenceGroup.element);
|
|
7920
7995
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7996
|
+
const group = this.createGroup(options);
|
|
7921
7997
|
this.doAddGroup(group, relativeLocation);
|
|
7922
7998
|
if (!options.skipSetActive) {
|
|
7923
7999
|
this.doSetGroupAndPanelActive(group);
|
|
@@ -7925,6 +8001,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
7925
8001
|
return group;
|
|
7926
8002
|
}
|
|
7927
8003
|
else {
|
|
8004
|
+
const group = this.createGroup(options);
|
|
7928
8005
|
this.doAddGroup(group);
|
|
7929
8006
|
this.doSetGroupAndPanelActive(group);
|
|
7930
8007
|
return group;
|
|
@@ -8241,6 +8318,8 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
8241
8318
|
return;
|
|
8242
8319
|
}
|
|
8243
8320
|
this._onWillShowOverlay.fire(event);
|
|
8321
|
+
}), view.model.onUnhandledDragOverEvent((event) => {
|
|
8322
|
+
this._onUnhandledDragOverEvent.fire(event);
|
|
8244
8323
|
}), view.model.onDidAddPanel((event) => {
|
|
8245
8324
|
if (this._moving) {
|
|
8246
8325
|
return;
|
|
@@ -9274,6 +9353,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
9274
9353
|
exports.DockviewGroupPanelModel = DockviewGroupPanelModel;
|
|
9275
9354
|
exports.DockviewMutableDisposable = MutableDisposable;
|
|
9276
9355
|
exports.DockviewPanel = DockviewPanel;
|
|
9356
|
+
exports.DockviewUnhandledDragOverEvent = DockviewUnhandledDragOverEvent;
|
|
9277
9357
|
exports.DockviewWillDropEvent = DockviewWillDropEvent;
|
|
9278
9358
|
exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
|
|
9279
9359
|
exports.Gridview = Gridview;
|
|
@@ -9281,6 +9361,7 @@ define(['exports'], (function (exports) { 'use strict';
|
|
|
9281
9361
|
exports.GridviewComponent = GridviewComponent;
|
|
9282
9362
|
exports.GridviewPanel = GridviewPanel;
|
|
9283
9363
|
exports.LocalSelectionTransfer = LocalSelectionTransfer;
|
|
9364
|
+
exports.PROPERTY_KEYS = PROPERTY_KEYS;
|
|
9284
9365
|
exports.PaneFramework = PaneFramework;
|
|
9285
9366
|
exports.PaneTransfer = PaneTransfer;
|
|
9286
9367
|
exports.PanelTransfer = PanelTransfer;
|