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