dockview 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dockview/defaultTab.d.ts +1 -1
- package/dist/cjs/dockview/dockview.d.ts +12 -40
- package/dist/cjs/dockview/dockview.js +102 -112
- package/dist/cjs/dockview/headerActionsRenderer.d.ts +3 -13
- package/dist/cjs/dockview/headerActionsRenderer.js +4 -14
- package/dist/cjs/dockview/reactContentPart.d.ts +2 -3
- package/dist/cjs/dockview/reactHeaderPart.d.ts +1 -2
- package/dist/cjs/dockview/reactWatermarkPart.d.ts +1 -6
- package/dist/cjs/dockview/reactWatermarkPart.js +0 -5
- package/dist/cjs/gridview/gridview.d.ts +2 -2
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/paneview/paneview.d.ts +3 -3
- package/dist/cjs/splitview/splitview.d.ts +2 -2
- package/dist/cjs/types.d.ts +0 -4
- package/dist/dockview.amd.js +2072 -2054
- package/dist/dockview.amd.js.map +1 -1
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.js.map +1 -1
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.min.noStyle.js.map +1 -1
- package/dist/dockview.amd.noStyle.js +2072 -2054
- package/dist/dockview.amd.noStyle.js.map +1 -1
- package/dist/dockview.cjs.js +2072 -2054
- package/dist/dockview.cjs.js.map +1 -1
- package/dist/dockview.esm.js +2071 -2055
- package/dist/dockview.esm.js.map +1 -1
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.esm.min.js.map +1 -1
- package/dist/dockview.js +2072 -2054
- package/dist/dockview.js.map +1 -1
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.js.map +1 -1
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.min.noStyle.js.map +1 -1
- package/dist/dockview.noStyle.js +2072 -2054
- package/dist/dockview.noStyle.js.map +1 -1
- package/dist/esm/dockview/defaultTab.d.ts +1 -1
- package/dist/esm/dockview/dockview.d.ts +12 -40
- package/dist/esm/dockview/dockview.js +93 -114
- package/dist/esm/dockview/headerActionsRenderer.d.ts +3 -13
- package/dist/esm/dockview/headerActionsRenderer.js +4 -10
- package/dist/esm/dockview/reactContentPart.d.ts +2 -3
- package/dist/esm/dockview/reactHeaderPart.d.ts +1 -2
- package/dist/esm/dockview/reactWatermarkPart.d.ts +1 -6
- package/dist/esm/dockview/reactWatermarkPart.js +0 -5
- package/dist/esm/gridview/gridview.d.ts +2 -2
- package/dist/esm/index.d.ts +0 -2
- package/dist/esm/paneview/paneview.d.ts +3 -3
- package/dist/esm/splitview/splitview.d.ts +2 -2
- package/dist/esm/types.d.ts +0 -4
- package/package.json +3 -3
package/dist/dockview.amd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.
|
|
3
|
+
* @version 1.13.0
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -2468,6 +2468,261 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2468
2468
|
}
|
|
2469
2469
|
}
|
|
2470
2470
|
|
|
2471
|
+
class Resizable extends CompositeDisposable {
|
|
2472
|
+
get element() {
|
|
2473
|
+
return this._element;
|
|
2474
|
+
}
|
|
2475
|
+
get disableResizing() {
|
|
2476
|
+
return this._disableResizing;
|
|
2477
|
+
}
|
|
2478
|
+
set disableResizing(value) {
|
|
2479
|
+
this._disableResizing = value;
|
|
2480
|
+
}
|
|
2481
|
+
constructor(parentElement, disableResizing = false) {
|
|
2482
|
+
super();
|
|
2483
|
+
this._disableResizing = disableResizing;
|
|
2484
|
+
this._element = parentElement;
|
|
2485
|
+
this.addDisposables(watchElementResize(this._element, (entry) => {
|
|
2486
|
+
if (this.isDisposed) {
|
|
2487
|
+
/**
|
|
2488
|
+
* resize is delayed through requestAnimationFrame so there is a small chance
|
|
2489
|
+
* the component has already been disposed of
|
|
2490
|
+
*/
|
|
2491
|
+
return;
|
|
2492
|
+
}
|
|
2493
|
+
if (this.disableResizing) {
|
|
2494
|
+
return;
|
|
2495
|
+
}
|
|
2496
|
+
if (!this._element.offsetParent) {
|
|
2497
|
+
/**
|
|
2498
|
+
* offsetParent === null is equivalent to display: none being set on the element or one
|
|
2499
|
+
* of it's parents. In the display: none case the size will become (0, 0) which we do
|
|
2500
|
+
* not want to propagate.
|
|
2501
|
+
*
|
|
2502
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
|
|
2503
|
+
*
|
|
2504
|
+
* You could use checkVisibility() but at the time of writing it's not supported across
|
|
2505
|
+
* all Browsers
|
|
2506
|
+
*
|
|
2507
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility
|
|
2508
|
+
*/
|
|
2509
|
+
return;
|
|
2510
|
+
}
|
|
2511
|
+
if (!isInDocument(this._element)) {
|
|
2512
|
+
/**
|
|
2513
|
+
* since the event is dispatched through requestAnimationFrame there is a small chance
|
|
2514
|
+
* the component is no longer attached to the DOM, if that is the case the dimensions
|
|
2515
|
+
* are mostly likely all zero and meaningless. we should skip this case.
|
|
2516
|
+
*/
|
|
2517
|
+
return;
|
|
2518
|
+
}
|
|
2519
|
+
const { width, height } = entry.contentRect;
|
|
2520
|
+
this.layout(width, height);
|
|
2521
|
+
}));
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
const nextLayoutId$1 = sequentialNumberGenerator();
|
|
2526
|
+
function toTarget(direction) {
|
|
2527
|
+
switch (direction) {
|
|
2528
|
+
case 'left':
|
|
2529
|
+
return 'left';
|
|
2530
|
+
case 'right':
|
|
2531
|
+
return 'right';
|
|
2532
|
+
case 'above':
|
|
2533
|
+
return 'top';
|
|
2534
|
+
case 'below':
|
|
2535
|
+
return 'bottom';
|
|
2536
|
+
case 'within':
|
|
2537
|
+
default:
|
|
2538
|
+
return 'center';
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
class BaseGrid extends Resizable {
|
|
2542
|
+
get id() {
|
|
2543
|
+
return this._id;
|
|
2544
|
+
}
|
|
2545
|
+
get size() {
|
|
2546
|
+
return this._groups.size;
|
|
2547
|
+
}
|
|
2548
|
+
get groups() {
|
|
2549
|
+
return Array.from(this._groups.values()).map((_) => _.value);
|
|
2550
|
+
}
|
|
2551
|
+
get width() {
|
|
2552
|
+
return this.gridview.width;
|
|
2553
|
+
}
|
|
2554
|
+
get height() {
|
|
2555
|
+
return this.gridview.height;
|
|
2556
|
+
}
|
|
2557
|
+
get minimumHeight() {
|
|
2558
|
+
return this.gridview.minimumHeight;
|
|
2559
|
+
}
|
|
2560
|
+
get maximumHeight() {
|
|
2561
|
+
return this.gridview.maximumHeight;
|
|
2562
|
+
}
|
|
2563
|
+
get minimumWidth() {
|
|
2564
|
+
return this.gridview.minimumWidth;
|
|
2565
|
+
}
|
|
2566
|
+
get maximumWidth() {
|
|
2567
|
+
return this.gridview.maximumWidth;
|
|
2568
|
+
}
|
|
2569
|
+
get activeGroup() {
|
|
2570
|
+
return this._activeGroup;
|
|
2571
|
+
}
|
|
2572
|
+
get locked() {
|
|
2573
|
+
return this.gridview.locked;
|
|
2574
|
+
}
|
|
2575
|
+
set locked(value) {
|
|
2576
|
+
this.gridview.locked = value;
|
|
2577
|
+
}
|
|
2578
|
+
constructor(options) {
|
|
2579
|
+
super(document.createElement('div'), options.disableAutoResizing);
|
|
2580
|
+
this._id = nextLayoutId$1.next();
|
|
2581
|
+
this._groups = new Map();
|
|
2582
|
+
this._onDidLayoutChange = new Emitter();
|
|
2583
|
+
this.onDidLayoutChange = this._onDidLayoutChange.event;
|
|
2584
|
+
this._onDidRemove = new Emitter();
|
|
2585
|
+
this.onDidRemove = this._onDidRemove.event;
|
|
2586
|
+
this._onDidAdd = new Emitter();
|
|
2587
|
+
this.onDidAdd = this._onDidAdd.event;
|
|
2588
|
+
this._onDidActiveChange = new Emitter();
|
|
2589
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
2590
|
+
this._bufferOnDidLayoutChange = new TickDelayedEvent();
|
|
2591
|
+
this.element.style.height = '100%';
|
|
2592
|
+
this.element.style.width = '100%';
|
|
2593
|
+
options.parentElement.appendChild(this.element);
|
|
2594
|
+
this.gridview = new Gridview(!!options.proportionalLayout, options.styles, options.orientation);
|
|
2595
|
+
this.gridview.locked = !!options.locked;
|
|
2596
|
+
this.element.appendChild(this.gridview.element);
|
|
2597
|
+
this.layout(0, 0, true); // set some elements height/widths
|
|
2598
|
+
this.addDisposables(Disposable.from(() => {
|
|
2599
|
+
var _a;
|
|
2600
|
+
(_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.element);
|
|
2601
|
+
}), this.gridview.onDidChange(() => {
|
|
2602
|
+
this._bufferOnDidLayoutChange.fire();
|
|
2603
|
+
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
2604
|
+
this._bufferOnDidLayoutChange.fire();
|
|
2605
|
+
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
2606
|
+
this._onDidLayoutChange.fire();
|
|
2607
|
+
}), this._bufferOnDidLayoutChange);
|
|
2608
|
+
}
|
|
2609
|
+
setVisible(panel, visible) {
|
|
2610
|
+
this.gridview.setViewVisible(getGridLocation(panel.element), visible);
|
|
2611
|
+
this._onDidLayoutChange.fire();
|
|
2612
|
+
}
|
|
2613
|
+
isVisible(panel) {
|
|
2614
|
+
return this.gridview.isViewVisible(getGridLocation(panel.element));
|
|
2615
|
+
}
|
|
2616
|
+
maximizeGroup(panel) {
|
|
2617
|
+
this.gridview.maximizeView(panel);
|
|
2618
|
+
this.doSetGroupActive(panel);
|
|
2619
|
+
}
|
|
2620
|
+
isMaximizedGroup(panel) {
|
|
2621
|
+
return this.gridview.maximizedView() === panel;
|
|
2622
|
+
}
|
|
2623
|
+
exitMaximizedGroup() {
|
|
2624
|
+
this.gridview.exitMaximizedView();
|
|
2625
|
+
}
|
|
2626
|
+
hasMaximizedGroup() {
|
|
2627
|
+
return this.gridview.hasMaximizedView();
|
|
2628
|
+
}
|
|
2629
|
+
get onDidMaximizedGroupChange() {
|
|
2630
|
+
return this.gridview.onDidMaximizedNodeChange;
|
|
2631
|
+
}
|
|
2632
|
+
doAddGroup(group, location = [0], size) {
|
|
2633
|
+
this.gridview.addView(group, size !== null && size !== void 0 ? size : exports.Sizing.Distribute, location);
|
|
2634
|
+
this._onDidAdd.fire(group);
|
|
2635
|
+
}
|
|
2636
|
+
doRemoveGroup(group, options) {
|
|
2637
|
+
if (!this._groups.has(group.id)) {
|
|
2638
|
+
throw new Error('invalid operation');
|
|
2639
|
+
}
|
|
2640
|
+
const item = this._groups.get(group.id);
|
|
2641
|
+
const view = this.gridview.remove(group, exports.Sizing.Distribute);
|
|
2642
|
+
if (item && !(options === null || options === void 0 ? void 0 : options.skipDispose)) {
|
|
2643
|
+
item.disposable.dispose();
|
|
2644
|
+
item.value.dispose();
|
|
2645
|
+
this._groups.delete(group.id);
|
|
2646
|
+
this._onDidRemove.fire(group);
|
|
2647
|
+
}
|
|
2648
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipActive) && this._activeGroup === group) {
|
|
2649
|
+
const groups = Array.from(this._groups.values());
|
|
2650
|
+
this.doSetGroupActive(groups.length > 0 ? groups[0].value : undefined);
|
|
2651
|
+
}
|
|
2652
|
+
return view;
|
|
2653
|
+
}
|
|
2654
|
+
getPanel(id) {
|
|
2655
|
+
var _a;
|
|
2656
|
+
return (_a = this._groups.get(id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
2657
|
+
}
|
|
2658
|
+
doSetGroupActive(group) {
|
|
2659
|
+
if (this._activeGroup === group) {
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
if (this._activeGroup) {
|
|
2663
|
+
this._activeGroup.setActive(false);
|
|
2664
|
+
}
|
|
2665
|
+
if (group) {
|
|
2666
|
+
group.setActive(true);
|
|
2667
|
+
}
|
|
2668
|
+
this._activeGroup = group;
|
|
2669
|
+
this._onDidActiveChange.fire(group);
|
|
2670
|
+
}
|
|
2671
|
+
removeGroup(group) {
|
|
2672
|
+
this.doRemoveGroup(group);
|
|
2673
|
+
}
|
|
2674
|
+
moveToNext(options) {
|
|
2675
|
+
var _a;
|
|
2676
|
+
if (!options) {
|
|
2677
|
+
options = {};
|
|
2678
|
+
}
|
|
2679
|
+
if (!options.group) {
|
|
2680
|
+
if (!this.activeGroup) {
|
|
2681
|
+
return;
|
|
2682
|
+
}
|
|
2683
|
+
options.group = this.activeGroup;
|
|
2684
|
+
}
|
|
2685
|
+
const location = getGridLocation(options.group.element);
|
|
2686
|
+
const next = (_a = this.gridview.next(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
2687
|
+
this.doSetGroupActive(next);
|
|
2688
|
+
}
|
|
2689
|
+
moveToPrevious(options) {
|
|
2690
|
+
var _a;
|
|
2691
|
+
if (!options) {
|
|
2692
|
+
options = {};
|
|
2693
|
+
}
|
|
2694
|
+
if (!options.group) {
|
|
2695
|
+
if (!this.activeGroup) {
|
|
2696
|
+
return;
|
|
2697
|
+
}
|
|
2698
|
+
options.group = this.activeGroup;
|
|
2699
|
+
}
|
|
2700
|
+
const location = getGridLocation(options.group.element);
|
|
2701
|
+
const next = (_a = this.gridview.previous(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
2702
|
+
this.doSetGroupActive(next);
|
|
2703
|
+
}
|
|
2704
|
+
layout(width, height, forceResize) {
|
|
2705
|
+
const different = forceResize !== null && forceResize !== void 0 ? forceResize : (width !== this.width || height !== this.height);
|
|
2706
|
+
if (!different) {
|
|
2707
|
+
return;
|
|
2708
|
+
}
|
|
2709
|
+
this.gridview.element.style.height = `${height}px`;
|
|
2710
|
+
this.gridview.element.style.width = `${width}px`;
|
|
2711
|
+
this.gridview.layout(width, height);
|
|
2712
|
+
}
|
|
2713
|
+
dispose() {
|
|
2714
|
+
this._onDidActiveChange.dispose();
|
|
2715
|
+
this._onDidAdd.dispose();
|
|
2716
|
+
this._onDidRemove.dispose();
|
|
2717
|
+
this._onDidLayoutChange.dispose();
|
|
2718
|
+
for (const group of this.groups) {
|
|
2719
|
+
group.dispose();
|
|
2720
|
+
}
|
|
2721
|
+
this.gridview.dispose();
|
|
2722
|
+
super.dispose();
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2471
2726
|
class SplitviewApi {
|
|
2472
2727
|
/**
|
|
2473
2728
|
* The minimum size the component can reach where size is measured in the direction of orientation provided.
|
|
@@ -3010,6 +3265,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3010
3265
|
get onWillDragPanel() {
|
|
3011
3266
|
return this.component.onWillDragPanel;
|
|
3012
3267
|
}
|
|
3268
|
+
get onUnhandledDragOverEvent() {
|
|
3269
|
+
return this.component.onUnhandledDragOverEvent;
|
|
3270
|
+
}
|
|
3013
3271
|
/**
|
|
3014
3272
|
* All panel objects.
|
|
3015
3273
|
*/
|
|
@@ -3147,6 +3405,67 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3147
3405
|
}
|
|
3148
3406
|
}
|
|
3149
3407
|
|
|
3408
|
+
class DragHandler extends CompositeDisposable {
|
|
3409
|
+
constructor(el) {
|
|
3410
|
+
super();
|
|
3411
|
+
this.el = el;
|
|
3412
|
+
this.dataDisposable = new MutableDisposable();
|
|
3413
|
+
this.pointerEventsDisposable = new MutableDisposable();
|
|
3414
|
+
this._onDragStart = new Emitter();
|
|
3415
|
+
this.onDragStart = this._onDragStart.event;
|
|
3416
|
+
this.addDisposables(this._onDragStart, this.dataDisposable, this.pointerEventsDisposable);
|
|
3417
|
+
this.configure();
|
|
3418
|
+
}
|
|
3419
|
+
isCancelled(_event) {
|
|
3420
|
+
return false;
|
|
3421
|
+
}
|
|
3422
|
+
configure() {
|
|
3423
|
+
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
3424
|
+
if (event.defaultPrevented || this.isCancelled(event)) {
|
|
3425
|
+
event.preventDefault();
|
|
3426
|
+
return;
|
|
3427
|
+
}
|
|
3428
|
+
const iframes = [
|
|
3429
|
+
...getElementsByTagName('iframe'),
|
|
3430
|
+
...getElementsByTagName('webview'),
|
|
3431
|
+
];
|
|
3432
|
+
this.pointerEventsDisposable.value = {
|
|
3433
|
+
dispose: () => {
|
|
3434
|
+
for (const iframe of iframes) {
|
|
3435
|
+
iframe.style.pointerEvents = 'auto';
|
|
3436
|
+
}
|
|
3437
|
+
},
|
|
3438
|
+
};
|
|
3439
|
+
for (const iframe of iframes) {
|
|
3440
|
+
iframe.style.pointerEvents = 'none';
|
|
3441
|
+
}
|
|
3442
|
+
this.el.classList.add('dv-dragged');
|
|
3443
|
+
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
3444
|
+
this.dataDisposable.value = this.getData(event);
|
|
3445
|
+
this._onDragStart.fire(event);
|
|
3446
|
+
if (event.dataTransfer) {
|
|
3447
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
3448
|
+
const hasData = event.dataTransfer.items.length > 0;
|
|
3449
|
+
if (!hasData) {
|
|
3450
|
+
/**
|
|
3451
|
+
* Although this is not used by dockview many third party dnd libraries will check
|
|
3452
|
+
* dataTransfer.types to determine valid drag events.
|
|
3453
|
+
*
|
|
3454
|
+
* For example: in react-dnd if dataTransfer.types is not set then the dragStart event will be cancelled
|
|
3455
|
+
* through .preventDefault(). Since this is applied globally to all drag events this would break dockviews
|
|
3456
|
+
* dnd logic. You can see the code at
|
|
3457
|
+
* https://github.com/react-dnd/react-dnd/blob/main/packages/backend-html5/src/HTML5BackendImpl.ts#L542
|
|
3458
|
+
*/
|
|
3459
|
+
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
}), addDisposableListener(this.el, 'dragend', () => {
|
|
3463
|
+
this.pointerEventsDisposable.dispose();
|
|
3464
|
+
this.dataDisposable.dispose();
|
|
3465
|
+
}));
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3150
3469
|
class DragAndDropObserver extends CompositeDisposable {
|
|
3151
3470
|
constructor(element, callbacks) {
|
|
3152
3471
|
super();
|
|
@@ -3291,6 +3610,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3291
3610
|
this.removeDropTarget();
|
|
3292
3611
|
return;
|
|
3293
3612
|
}
|
|
3613
|
+
if (!this.options.canDisplayOverlay(e, quadrant)) {
|
|
3614
|
+
this.removeDropTarget();
|
|
3615
|
+
return;
|
|
3616
|
+
}
|
|
3294
3617
|
const willShowOverlayEvent = new WillShowOverlayEvent({
|
|
3295
3618
|
nativeEvent: e,
|
|
3296
3619
|
position: quadrant,
|
|
@@ -3304,16 +3627,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3304
3627
|
this.removeDropTarget();
|
|
3305
3628
|
return;
|
|
3306
3629
|
}
|
|
3307
|
-
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
|
3308
|
-
if (!this.options.canDisplayOverlay) {
|
|
3309
|
-
this.removeDropTarget();
|
|
3310
|
-
return;
|
|
3311
|
-
}
|
|
3312
|
-
}
|
|
3313
|
-
else if (!this.options.canDisplayOverlay(e, quadrant)) {
|
|
3314
|
-
this.removeDropTarget();
|
|
3315
|
-
return;
|
|
3316
|
-
}
|
|
3317
3630
|
this.markAsUsed(e);
|
|
3318
3631
|
if (!this.targetElement) {
|
|
3319
3632
|
this.targetElement = document.createElement('div');
|
|
@@ -3504,2023 +3817,1758 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3504
3817
|
return 'center';
|
|
3505
3818
|
}
|
|
3506
3819
|
|
|
3507
|
-
class
|
|
3508
|
-
|
|
3509
|
-
return this._element;
|
|
3510
|
-
}
|
|
3511
|
-
constructor(accessor, group) {
|
|
3820
|
+
class WillFocusEvent extends DockviewEvent {
|
|
3821
|
+
constructor() {
|
|
3512
3822
|
super();
|
|
3513
|
-
this.accessor = accessor;
|
|
3514
|
-
this.group = group;
|
|
3515
|
-
this.disposable = new MutableDisposable();
|
|
3516
|
-
this._onDidFocus = new Emitter();
|
|
3517
|
-
this.onDidFocus = this._onDidFocus.event;
|
|
3518
|
-
this._onDidBlur = new Emitter();
|
|
3519
|
-
this.onDidBlur = this._onDidBlur.event;
|
|
3520
|
-
this._element = document.createElement('div');
|
|
3521
|
-
this._element.className = 'content-container';
|
|
3522
|
-
this._element.tabIndex = -1;
|
|
3523
|
-
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
3524
|
-
this.dropTarget = new Droptarget(this.element, {
|
|
3525
|
-
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
3526
|
-
canDisplayOverlay: (event, position) => {
|
|
3527
|
-
if (this.group.locked === 'no-drop-target' ||
|
|
3528
|
-
(this.group.locked && position === 'center')) {
|
|
3529
|
-
return false;
|
|
3530
|
-
}
|
|
3531
|
-
const data = getPanelData();
|
|
3532
|
-
if (!data &&
|
|
3533
|
-
event.shiftKey &&
|
|
3534
|
-
this.group.location.type !== 'floating') {
|
|
3535
|
-
return false;
|
|
3536
|
-
}
|
|
3537
|
-
if (data && data.viewId === this.accessor.id) {
|
|
3538
|
-
if (data.groupId === this.group.id) {
|
|
3539
|
-
if (position === 'center') {
|
|
3540
|
-
// don't allow to drop on self for center position
|
|
3541
|
-
return false;
|
|
3542
|
-
}
|
|
3543
|
-
if (data.panelId === null) {
|
|
3544
|
-
// don't allow group move to drop anywhere on self
|
|
3545
|
-
return false;
|
|
3546
|
-
}
|
|
3547
|
-
}
|
|
3548
|
-
const groupHasOnePanelAndIsActiveDragElement = this.group.panels.length === 1 &&
|
|
3549
|
-
data.groupId === this.group.id;
|
|
3550
|
-
return !groupHasOnePanelAndIsActiveDragElement;
|
|
3551
|
-
}
|
|
3552
|
-
return this.group.canDisplayOverlay(event, position, 'content');
|
|
3553
|
-
},
|
|
3554
|
-
});
|
|
3555
|
-
this.addDisposables(this.dropTarget);
|
|
3556
3823
|
}
|
|
3557
|
-
|
|
3558
|
-
|
|
3824
|
+
}
|
|
3825
|
+
/**
|
|
3826
|
+
* A core api implementation that should be used across all panel-like objects
|
|
3827
|
+
*/
|
|
3828
|
+
class PanelApiImpl extends CompositeDisposable {
|
|
3829
|
+
get isFocused() {
|
|
3830
|
+
return this._isFocused;
|
|
3559
3831
|
}
|
|
3560
|
-
|
|
3561
|
-
this.
|
|
3832
|
+
get isActive() {
|
|
3833
|
+
return this._isActive;
|
|
3562
3834
|
}
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
(this.panel && this.group.isPanelActive(this.panel));
|
|
3566
|
-
if (this.panel &&
|
|
3567
|
-
this.panel.view.content.element.parentElement === this._element) {
|
|
3568
|
-
/**
|
|
3569
|
-
* If the currently attached panel is mounted directly to the content then remove it
|
|
3570
|
-
*/
|
|
3571
|
-
this._element.removeChild(this.panel.view.content.element);
|
|
3572
|
-
}
|
|
3573
|
-
this.panel = panel;
|
|
3574
|
-
let container;
|
|
3575
|
-
switch (panel.api.renderer) {
|
|
3576
|
-
case 'onlyWhenVisible':
|
|
3577
|
-
this.group.renderContainer.detatch(panel);
|
|
3578
|
-
if (this.panel) {
|
|
3579
|
-
if (doRender) {
|
|
3580
|
-
this._element.appendChild(this.panel.view.content.element);
|
|
3581
|
-
}
|
|
3582
|
-
}
|
|
3583
|
-
container = this._element;
|
|
3584
|
-
break;
|
|
3585
|
-
case 'always':
|
|
3586
|
-
if (panel.view.content.element.parentElement === this._element) {
|
|
3587
|
-
this._element.removeChild(panel.view.content.element);
|
|
3588
|
-
}
|
|
3589
|
-
container = this.group.renderContainer.attach({
|
|
3590
|
-
panel,
|
|
3591
|
-
referenceContainer: this,
|
|
3592
|
-
});
|
|
3593
|
-
break;
|
|
3594
|
-
}
|
|
3595
|
-
if (doRender) {
|
|
3596
|
-
const _onDidFocus = panel.view.content.onDidFocus;
|
|
3597
|
-
const _onDidBlur = panel.view.content.onDidBlur;
|
|
3598
|
-
const focusTracker = trackFocus(container);
|
|
3599
|
-
const disposable = new CompositeDisposable();
|
|
3600
|
-
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
3601
|
-
if (_onDidFocus) {
|
|
3602
|
-
disposable.addDisposables(_onDidFocus(() => this._onDidFocus.fire()));
|
|
3603
|
-
}
|
|
3604
|
-
if (_onDidBlur) {
|
|
3605
|
-
disposable.addDisposables(_onDidBlur(() => this._onDidBlur.fire()));
|
|
3606
|
-
}
|
|
3607
|
-
this.disposable.value = disposable;
|
|
3608
|
-
}
|
|
3835
|
+
get isVisible() {
|
|
3836
|
+
return this._isVisible;
|
|
3609
3837
|
}
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
return;
|
|
3613
|
-
}
|
|
3614
|
-
this.renderPanel(panel);
|
|
3838
|
+
get width() {
|
|
3839
|
+
return this._width;
|
|
3615
3840
|
}
|
|
3616
|
-
|
|
3617
|
-
|
|
3841
|
+
get height() {
|
|
3842
|
+
return this._height;
|
|
3618
3843
|
}
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
this.
|
|
3844
|
+
constructor(id, component) {
|
|
3845
|
+
super();
|
|
3846
|
+
this.id = id;
|
|
3847
|
+
this.component = component;
|
|
3848
|
+
this._isFocused = false;
|
|
3849
|
+
this._isActive = false;
|
|
3850
|
+
this._isVisible = true;
|
|
3851
|
+
this._width = 0;
|
|
3852
|
+
this._height = 0;
|
|
3853
|
+
this._parameters = {};
|
|
3854
|
+
this.panelUpdatesDisposable = new MutableDisposable();
|
|
3855
|
+
this._onDidDimensionChange = new Emitter();
|
|
3856
|
+
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
3857
|
+
this._onDidChangeFocus = new Emitter();
|
|
3858
|
+
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
3859
|
+
//
|
|
3860
|
+
this._onWillFocus = new Emitter();
|
|
3861
|
+
this.onWillFocus = this._onWillFocus.event;
|
|
3862
|
+
//
|
|
3863
|
+
this._onDidVisibilityChange = new Emitter();
|
|
3864
|
+
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
3865
|
+
this._onWillVisibilityChange = new Emitter();
|
|
3866
|
+
this.onWillVisibilityChange = this._onWillVisibilityChange.event;
|
|
3867
|
+
this._onDidActiveChange = new Emitter();
|
|
3868
|
+
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
3869
|
+
this._onActiveChange = new Emitter();
|
|
3870
|
+
this.onActiveChange = this._onActiveChange.event;
|
|
3871
|
+
this._onDidParametersChange = new Emitter();
|
|
3872
|
+
this.onDidParametersChange = this._onDidParametersChange.event;
|
|
3873
|
+
this.addDisposables(this.onDidFocusChange((event) => {
|
|
3874
|
+
this._isFocused = event.isFocused;
|
|
3875
|
+
}), this.onDidActiveChange((event) => {
|
|
3876
|
+
this._isActive = event.isActive;
|
|
3877
|
+
}), this.onDidVisibilityChange((event) => {
|
|
3878
|
+
this._isVisible = event.isVisible;
|
|
3879
|
+
}), this.onDidDimensionsChange((event) => {
|
|
3880
|
+
this._width = event.width;
|
|
3881
|
+
this._height = event.height;
|
|
3882
|
+
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);
|
|
3627
3883
|
}
|
|
3628
|
-
|
|
3629
|
-
this.
|
|
3630
|
-
|
|
3884
|
+
getParameters() {
|
|
3885
|
+
return this._parameters;
|
|
3886
|
+
}
|
|
3887
|
+
initialize(panel) {
|
|
3888
|
+
this.panelUpdatesDisposable.value = this._onDidParametersChange.event((parameters) => {
|
|
3889
|
+
this._parameters = parameters;
|
|
3890
|
+
panel.update({
|
|
3891
|
+
params: parameters,
|
|
3892
|
+
});
|
|
3893
|
+
});
|
|
3894
|
+
}
|
|
3895
|
+
setVisible(isVisible) {
|
|
3896
|
+
this._onWillVisibilityChange.fire({ isVisible });
|
|
3897
|
+
}
|
|
3898
|
+
setActive() {
|
|
3899
|
+
this._onActiveChange.fire();
|
|
3900
|
+
}
|
|
3901
|
+
updateParameters(parameters) {
|
|
3902
|
+
this._onDidParametersChange.fire(parameters);
|
|
3631
3903
|
}
|
|
3632
3904
|
}
|
|
3633
3905
|
|
|
3634
|
-
class
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
this.
|
|
3639
|
-
this.
|
|
3640
|
-
|
|
3641
|
-
this.
|
|
3642
|
-
|
|
3643
|
-
|
|
3906
|
+
class SplitviewPanelApiImpl extends PanelApiImpl {
|
|
3907
|
+
//
|
|
3908
|
+
constructor(id, component) {
|
|
3909
|
+
super(id, component);
|
|
3910
|
+
this._onDidConstraintsChangeInternal = new Emitter();
|
|
3911
|
+
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
3912
|
+
//
|
|
3913
|
+
this._onDidConstraintsChange = new Emitter({
|
|
3914
|
+
replay: true,
|
|
3915
|
+
});
|
|
3916
|
+
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
3917
|
+
//
|
|
3918
|
+
this._onDidSizeChange = new Emitter();
|
|
3919
|
+
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
3920
|
+
this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
|
|
3644
3921
|
}
|
|
3645
|
-
|
|
3646
|
-
|
|
3922
|
+
setConstraints(value) {
|
|
3923
|
+
this._onDidConstraintsChangeInternal.fire(value);
|
|
3647
3924
|
}
|
|
3648
|
-
|
|
3649
|
-
this.
|
|
3650
|
-
if (event.defaultPrevented || this.isCancelled(event)) {
|
|
3651
|
-
event.preventDefault();
|
|
3652
|
-
return;
|
|
3653
|
-
}
|
|
3654
|
-
const iframes = [
|
|
3655
|
-
...getElementsByTagName('iframe'),
|
|
3656
|
-
...getElementsByTagName('webview'),
|
|
3657
|
-
];
|
|
3658
|
-
this.pointerEventsDisposable.value = {
|
|
3659
|
-
dispose: () => {
|
|
3660
|
-
for (const iframe of iframes) {
|
|
3661
|
-
iframe.style.pointerEvents = 'auto';
|
|
3662
|
-
}
|
|
3663
|
-
},
|
|
3664
|
-
};
|
|
3665
|
-
for (const iframe of iframes) {
|
|
3666
|
-
iframe.style.pointerEvents = 'none';
|
|
3667
|
-
}
|
|
3668
|
-
this.el.classList.add('dv-dragged');
|
|
3669
|
-
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
3670
|
-
this.dataDisposable.value = this.getData(event);
|
|
3671
|
-
this._onDragStart.fire(event);
|
|
3672
|
-
if (event.dataTransfer) {
|
|
3673
|
-
event.dataTransfer.effectAllowed = 'move';
|
|
3674
|
-
const hasData = event.dataTransfer.items.length > 0;
|
|
3675
|
-
if (!hasData) {
|
|
3676
|
-
/**
|
|
3677
|
-
* Although this is not used by dockview many third party dnd libraries will check
|
|
3678
|
-
* dataTransfer.types to determine valid drag events.
|
|
3679
|
-
*
|
|
3680
|
-
* For example: in react-dnd if dataTransfer.types is not set then the dragStart event will be cancelled
|
|
3681
|
-
* through .preventDefault(). Since this is applied globally to all drag events this would break dockviews
|
|
3682
|
-
* dnd logic. You can see the code at
|
|
3683
|
-
* https://github.com/react-dnd/react-dnd/blob/main/packages/backend-html5/src/HTML5BackendImpl.ts#L542
|
|
3684
|
-
*/
|
|
3685
|
-
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
3686
|
-
}
|
|
3687
|
-
}
|
|
3688
|
-
}), addDisposableListener(this.el, 'dragend', () => {
|
|
3689
|
-
this.pointerEventsDisposable.dispose();
|
|
3690
|
-
this.dataDisposable.dispose();
|
|
3691
|
-
}));
|
|
3925
|
+
setSize(event) {
|
|
3926
|
+
this._onDidSizeChange.fire(event);
|
|
3692
3927
|
}
|
|
3693
3928
|
}
|
|
3694
3929
|
|
|
3695
|
-
class
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
this.accessor = accessor;
|
|
3699
|
-
this.group = group;
|
|
3700
|
-
this.panel = panel;
|
|
3701
|
-
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
3930
|
+
class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
|
|
3931
|
+
set pane(pane) {
|
|
3932
|
+
this._pane = pane;
|
|
3702
3933
|
}
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
};
|
|
3934
|
+
constructor(id, component) {
|
|
3935
|
+
super(id, component);
|
|
3936
|
+
this._onDidExpansionChange = new Emitter({
|
|
3937
|
+
replay: true,
|
|
3938
|
+
});
|
|
3939
|
+
this.onDidExpansionChange = this._onDidExpansionChange.event;
|
|
3940
|
+
this._onMouseEnter = new Emitter({});
|
|
3941
|
+
this.onMouseEnter = this._onMouseEnter.event;
|
|
3942
|
+
this._onMouseLeave = new Emitter({});
|
|
3943
|
+
this.onMouseLeave = this._onMouseLeave.event;
|
|
3944
|
+
this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
|
|
3945
|
+
}
|
|
3946
|
+
setExpanded(isExpanded) {
|
|
3947
|
+
var _a;
|
|
3948
|
+
(_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
|
|
3949
|
+
}
|
|
3950
|
+
get isExpanded() {
|
|
3951
|
+
var _a;
|
|
3952
|
+
return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
|
|
3710
3953
|
}
|
|
3711
3954
|
}
|
|
3712
|
-
|
|
3955
|
+
|
|
3956
|
+
class BasePanelView extends CompositeDisposable {
|
|
3713
3957
|
get element() {
|
|
3714
3958
|
return this._element;
|
|
3715
3959
|
}
|
|
3716
|
-
|
|
3960
|
+
get width() {
|
|
3961
|
+
return this._width;
|
|
3962
|
+
}
|
|
3963
|
+
get height() {
|
|
3964
|
+
return this._height;
|
|
3965
|
+
}
|
|
3966
|
+
get params() {
|
|
3967
|
+
var _a;
|
|
3968
|
+
return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
|
|
3969
|
+
}
|
|
3970
|
+
constructor(id, component, api) {
|
|
3717
3971
|
super();
|
|
3718
|
-
this.
|
|
3719
|
-
this.
|
|
3720
|
-
this.
|
|
3721
|
-
this.
|
|
3722
|
-
this.
|
|
3723
|
-
this.onChanged = this._onChanged.event;
|
|
3724
|
-
this._onDropped = new Emitter();
|
|
3725
|
-
this.onDrop = this._onDropped.event;
|
|
3726
|
-
this._onDragStart = new Emitter();
|
|
3727
|
-
this.onDragStart = this._onDragStart.event;
|
|
3972
|
+
this.id = id;
|
|
3973
|
+
this.component = component;
|
|
3974
|
+
this.api = api;
|
|
3975
|
+
this._height = 0;
|
|
3976
|
+
this._width = 0;
|
|
3728
3977
|
this._element = document.createElement('div');
|
|
3729
|
-
this._element.
|
|
3730
|
-
this._element.
|
|
3731
|
-
this._element.
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
this.
|
|
3753
|
-
|
|
3754
|
-
this.
|
|
3755
|
-
|
|
3756
|
-
if (event.defaultPrevented) {
|
|
3757
|
-
return;
|
|
3978
|
+
this._element.tabIndex = -1;
|
|
3979
|
+
this._element.style.outline = 'none';
|
|
3980
|
+
this._element.style.height = '100%';
|
|
3981
|
+
this._element.style.width = '100%';
|
|
3982
|
+
this._element.style.overflow = 'hidden';
|
|
3983
|
+
const focusTracker = trackFocus(this._element);
|
|
3984
|
+
this.addDisposables(this.api, focusTracker.onDidFocus(() => {
|
|
3985
|
+
this.api._onDidChangeFocus.fire({ isFocused: true });
|
|
3986
|
+
}), focusTracker.onDidBlur(() => {
|
|
3987
|
+
this.api._onDidChangeFocus.fire({ isFocused: false });
|
|
3988
|
+
}), focusTracker);
|
|
3989
|
+
}
|
|
3990
|
+
focus() {
|
|
3991
|
+
const event = new WillFocusEvent();
|
|
3992
|
+
this.api._onWillFocus.fire(event);
|
|
3993
|
+
if (event.defaultPrevented) {
|
|
3994
|
+
return;
|
|
3995
|
+
}
|
|
3996
|
+
this._element.focus();
|
|
3997
|
+
}
|
|
3998
|
+
layout(width, height) {
|
|
3999
|
+
this._width = width;
|
|
4000
|
+
this._height = height;
|
|
4001
|
+
this.api._onDidDimensionChange.fire({ width, height });
|
|
4002
|
+
if (this.part) {
|
|
4003
|
+
if (this._params) {
|
|
4004
|
+
this.part.update(this._params.params);
|
|
3758
4005
|
}
|
|
3759
|
-
|
|
3760
|
-
}), this.dropTarget.onDrop((event) => {
|
|
3761
|
-
this._onDropped.fire(event);
|
|
3762
|
-
}), this.dropTarget);
|
|
4006
|
+
}
|
|
3763
4007
|
}
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
4008
|
+
init(parameters) {
|
|
4009
|
+
this._params = parameters;
|
|
4010
|
+
this.part = this.getComponent();
|
|
3767
4011
|
}
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
4012
|
+
update(event) {
|
|
4013
|
+
var _a, _b;
|
|
4014
|
+
// merge the new parameters with the existing parameters
|
|
4015
|
+
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) });
|
|
4016
|
+
/**
|
|
4017
|
+
* delete new keys that have a value of undefined,
|
|
4018
|
+
* allow values of null
|
|
4019
|
+
*/
|
|
4020
|
+
for (const key of Object.keys(event.params)) {
|
|
4021
|
+
if (event.params[key] === undefined) {
|
|
4022
|
+
delete this._params.params[key];
|
|
4023
|
+
}
|
|
3771
4024
|
}
|
|
3772
|
-
|
|
3773
|
-
this.
|
|
4025
|
+
// update the view with the updated props
|
|
4026
|
+
(_b = this.part) === null || _b === void 0 ? void 0 : _b.update({ params: this._params.params });
|
|
4027
|
+
}
|
|
4028
|
+
toJSON() {
|
|
4029
|
+
var _a, _b;
|
|
4030
|
+
const params = (_b = (_a = this._params) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : {};
|
|
4031
|
+
return {
|
|
4032
|
+
id: this.id,
|
|
4033
|
+
component: this.component,
|
|
4034
|
+
params: Object.keys(params).length > 0 ? params : undefined,
|
|
4035
|
+
};
|
|
3774
4036
|
}
|
|
3775
4037
|
dispose() {
|
|
4038
|
+
var _a;
|
|
4039
|
+
this.api.dispose();
|
|
4040
|
+
(_a = this.part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
3776
4041
|
super.dispose();
|
|
3777
4042
|
}
|
|
3778
4043
|
}
|
|
3779
4044
|
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
document.body.appendChild(ghostElement);
|
|
3784
|
-
dataTransfer.setDragImage(ghostElement, 0, 0);
|
|
3785
|
-
setTimeout(() => {
|
|
3786
|
-
removeClasses(ghostElement, 'dv-dragged');
|
|
3787
|
-
ghostElement.remove();
|
|
3788
|
-
}, 0);
|
|
3789
|
-
}
|
|
3790
|
-
|
|
3791
|
-
class GroupDragHandler extends DragHandler {
|
|
3792
|
-
constructor(element, accessor, group) {
|
|
3793
|
-
super(element);
|
|
3794
|
-
this.accessor = accessor;
|
|
3795
|
-
this.group = group;
|
|
3796
|
-
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
3797
|
-
this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
|
|
3798
|
-
if (e.shiftKey) {
|
|
3799
|
-
/**
|
|
3800
|
-
* You cannot call e.preventDefault() because that will prevent drag events from firing
|
|
3801
|
-
* but we also need to stop any group overlay drag events from occuring
|
|
3802
|
-
* Use a custom event marker that can be checked by the overlay drag events
|
|
3803
|
-
*/
|
|
3804
|
-
quasiPreventDefault(e);
|
|
3805
|
-
}
|
|
3806
|
-
}, true));
|
|
4045
|
+
class PaneviewPanel extends BasePanelView {
|
|
4046
|
+
set orientation(value) {
|
|
4047
|
+
this._orientation = value;
|
|
3807
4048
|
}
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
return true;
|
|
3811
|
-
}
|
|
3812
|
-
return false;
|
|
4049
|
+
get orientation() {
|
|
4050
|
+
return this._orientation;
|
|
3813
4051
|
}
|
|
3814
|
-
|
|
3815
|
-
const
|
|
3816
|
-
|
|
3817
|
-
const
|
|
3818
|
-
|
|
3819
|
-
const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
|
|
3820
|
-
if (dataTransfer) {
|
|
3821
|
-
const ghostElement = document.createElement('div');
|
|
3822
|
-
ghostElement.style.backgroundColor = bgColor;
|
|
3823
|
-
ghostElement.style.color = color;
|
|
3824
|
-
ghostElement.style.padding = '2px 8px';
|
|
3825
|
-
ghostElement.style.height = '24px';
|
|
3826
|
-
ghostElement.style.fontSize = '11px';
|
|
3827
|
-
ghostElement.style.lineHeight = '20px';
|
|
3828
|
-
ghostElement.style.borderRadius = '12px';
|
|
3829
|
-
ghostElement.style.position = 'absolute';
|
|
3830
|
-
ghostElement.textContent = `Multiple Panels (${this.group.size})`;
|
|
3831
|
-
addGhostImage(dataTransfer, ghostElement);
|
|
3832
|
-
}
|
|
3833
|
-
return {
|
|
3834
|
-
dispose: () => {
|
|
3835
|
-
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
3836
|
-
},
|
|
3837
|
-
};
|
|
4052
|
+
get minimumSize() {
|
|
4053
|
+
const headerSize = this.headerSize;
|
|
4054
|
+
const expanded = this.isExpanded();
|
|
4055
|
+
const minimumBodySize = expanded ? this._minimumBodySize : 0;
|
|
4056
|
+
return headerSize + minimumBodySize;
|
|
3838
4057
|
}
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
return
|
|
4058
|
+
get maximumSize() {
|
|
4059
|
+
const headerSize = this.headerSize;
|
|
4060
|
+
const expanded = this.isExpanded();
|
|
4061
|
+
const maximumBodySize = expanded ? this._maximumBodySize : 0;
|
|
4062
|
+
return headerSize + maximumBodySize;
|
|
3844
4063
|
}
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
this.accessor = accessor;
|
|
3848
|
-
this.group = group;
|
|
3849
|
-
this._onDrop = new Emitter();
|
|
3850
|
-
this.onDrop = this._onDrop.event;
|
|
3851
|
-
this._onDragStart = new Emitter();
|
|
3852
|
-
this.onDragStart = this._onDragStart.event;
|
|
3853
|
-
this._element = document.createElement('div');
|
|
3854
|
-
this._element.className = 'void-container';
|
|
3855
|
-
this._element.tabIndex = 0;
|
|
3856
|
-
this._element.draggable = true;
|
|
3857
|
-
this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'click', () => {
|
|
3858
|
-
this.accessor.doSetGroupActive(this.group);
|
|
3859
|
-
}));
|
|
3860
|
-
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3861
|
-
this.dropTraget = new Droptarget(this._element, {
|
|
3862
|
-
acceptedTargetZones: ['center'],
|
|
3863
|
-
canDisplayOverlay: (event, position) => {
|
|
3864
|
-
var _a;
|
|
3865
|
-
const data = getPanelData();
|
|
3866
|
-
if (data && this.accessor.id === data.viewId) {
|
|
3867
|
-
if (data.panelId === null &&
|
|
3868
|
-
data.groupId === this.group.id) {
|
|
3869
|
-
// don't allow group move to drop on self
|
|
3870
|
-
return false;
|
|
3871
|
-
}
|
|
3872
|
-
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
3873
|
-
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
3874
|
-
}
|
|
3875
|
-
return group.model.canDisplayOverlay(event, position, 'header_space');
|
|
3876
|
-
},
|
|
3877
|
-
});
|
|
3878
|
-
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
3879
|
-
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3880
|
-
this._onDragStart.fire(event);
|
|
3881
|
-
}), this.dropTraget.onDrop((event) => {
|
|
3882
|
-
this._onDrop.fire(event);
|
|
3883
|
-
}), this.dropTraget);
|
|
4064
|
+
get size() {
|
|
4065
|
+
return this._size;
|
|
3884
4066
|
}
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
class TabsContainer extends CompositeDisposable {
|
|
3888
|
-
get panels() {
|
|
3889
|
-
return this.tabs.map((_) => _.value.panel.id);
|
|
4067
|
+
get orthogonalSize() {
|
|
4068
|
+
return this._orthogonalSize;
|
|
3890
4069
|
}
|
|
3891
|
-
|
|
3892
|
-
|
|
4070
|
+
set orthogonalSize(size) {
|
|
4071
|
+
this._orthogonalSize = size;
|
|
3893
4072
|
}
|
|
3894
|
-
get
|
|
3895
|
-
return this.
|
|
4073
|
+
get minimumBodySize() {
|
|
4074
|
+
return this._minimumBodySize;
|
|
3896
4075
|
}
|
|
3897
|
-
set
|
|
3898
|
-
this.
|
|
3899
|
-
this.element.style.display = value ? 'none' : '';
|
|
4076
|
+
set minimumBodySize(value) {
|
|
4077
|
+
this._minimumBodySize = typeof value === 'number' ? value : 0;
|
|
3900
4078
|
}
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
this.element.style.display = '';
|
|
3904
|
-
}
|
|
4079
|
+
get maximumBodySize() {
|
|
4080
|
+
return this._maximumBodySize;
|
|
3905
4081
|
}
|
|
3906
|
-
|
|
3907
|
-
this.
|
|
4082
|
+
set maximumBodySize(value) {
|
|
4083
|
+
this._maximumBodySize =
|
|
4084
|
+
typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
|
|
3908
4085
|
}
|
|
3909
|
-
|
|
3910
|
-
|
|
4086
|
+
get headerVisible() {
|
|
4087
|
+
return this._headerVisible;
|
|
4088
|
+
}
|
|
4089
|
+
set headerVisible(value) {
|
|
4090
|
+
this._headerVisible = value;
|
|
4091
|
+
this.header.style.display = value ? '' : 'none';
|
|
4092
|
+
}
|
|
4093
|
+
constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) {
|
|
4094
|
+
super(id, component, new PaneviewPanelApiImpl(id, component));
|
|
4095
|
+
this.headerComponent = headerComponent;
|
|
4096
|
+
this._onDidChangeExpansionState = new Emitter({ replay: true });
|
|
4097
|
+
this.onDidChangeExpansionState = this._onDidChangeExpansionState.event;
|
|
4098
|
+
this._onDidChange = new Emitter();
|
|
4099
|
+
this.onDidChange = this._onDidChange.event;
|
|
4100
|
+
this.headerSize = 22;
|
|
4101
|
+
this._orthogonalSize = 0;
|
|
4102
|
+
this._size = 0;
|
|
4103
|
+
this._minimumBodySize = 100;
|
|
4104
|
+
this._maximumBodySize = Number.POSITIVE_INFINITY;
|
|
4105
|
+
this._isExpanded = false;
|
|
4106
|
+
this.expandedSize = 0;
|
|
4107
|
+
this.api.pane = this; // TODO cannot use 'this' before 'super'
|
|
4108
|
+
this.api.initialize(this);
|
|
4109
|
+
this._isExpanded = isExpanded;
|
|
4110
|
+
this._headerVisible = isHeaderVisible;
|
|
4111
|
+
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
|
|
4112
|
+
this._orientation = orientation;
|
|
4113
|
+
this.element.classList.add('pane');
|
|
4114
|
+
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
4115
|
+
const { isVisible } = event;
|
|
4116
|
+
const { accessor } = this._params;
|
|
4117
|
+
accessor.setVisible(this, isVisible);
|
|
4118
|
+
}), this.api.onDidSizeChange((event) => {
|
|
4119
|
+
this._onDidChange.fire({ size: event.size });
|
|
4120
|
+
}), addDisposableListener(this.element, 'mouseenter', (ev) => {
|
|
4121
|
+
this.api._onMouseEnter.fire(ev);
|
|
4122
|
+
}), addDisposableListener(this.element, 'mouseleave', (ev) => {
|
|
4123
|
+
this.api._onMouseLeave.fire(ev);
|
|
4124
|
+
}));
|
|
4125
|
+
this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {
|
|
4126
|
+
this.api._onDidExpansionChange.fire({
|
|
4127
|
+
isExpanded: isPanelExpanded,
|
|
4128
|
+
});
|
|
4129
|
+
}), this.api.onDidFocusChange((e) => {
|
|
4130
|
+
if (!this.header) {
|
|
4131
|
+
return;
|
|
4132
|
+
}
|
|
4133
|
+
if (e.isFocused) {
|
|
4134
|
+
addClasses(this.header, 'focused');
|
|
4135
|
+
}
|
|
4136
|
+
else {
|
|
4137
|
+
removeClasses(this.header, 'focused');
|
|
4138
|
+
}
|
|
4139
|
+
}));
|
|
4140
|
+
this.renderOnce();
|
|
4141
|
+
}
|
|
4142
|
+
setVisible(isVisible) {
|
|
4143
|
+
this.api._onDidVisibilityChange.fire({ isVisible });
|
|
4144
|
+
}
|
|
4145
|
+
setActive(isActive) {
|
|
4146
|
+
this.api._onDidActiveChange.fire({ isActive });
|
|
4147
|
+
}
|
|
4148
|
+
isExpanded() {
|
|
4149
|
+
return this._isExpanded;
|
|
4150
|
+
}
|
|
4151
|
+
setExpanded(expanded) {
|
|
4152
|
+
if (this._isExpanded === expanded) {
|
|
3911
4153
|
return;
|
|
3912
4154
|
}
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
this.
|
|
4155
|
+
this._isExpanded = expanded;
|
|
4156
|
+
if (expanded) {
|
|
4157
|
+
if (this.animationTimer) {
|
|
4158
|
+
clearTimeout(this.animationTimer);
|
|
4159
|
+
}
|
|
4160
|
+
if (this.body) {
|
|
4161
|
+
this.element.appendChild(this.body);
|
|
4162
|
+
}
|
|
3916
4163
|
}
|
|
3917
|
-
|
|
3918
|
-
this.
|
|
3919
|
-
|
|
4164
|
+
else {
|
|
4165
|
+
this.animationTimer = setTimeout(() => {
|
|
4166
|
+
var _a;
|
|
4167
|
+
(_a = this.body) === null || _a === void 0 ? void 0 : _a.remove();
|
|
4168
|
+
}, 200);
|
|
3920
4169
|
}
|
|
4170
|
+
this._onDidChange.fire(expanded ? { size: this.width } : {});
|
|
4171
|
+
this._onDidChangeExpansionState.fire(expanded);
|
|
3921
4172
|
}
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
if (element) {
|
|
3931
|
-
this.leftActionsContainer.appendChild(element);
|
|
3932
|
-
this.leftActions = element;
|
|
4173
|
+
layout(size, orthogonalSize) {
|
|
4174
|
+
this._size = size;
|
|
4175
|
+
this._orthogonalSize = orthogonalSize;
|
|
4176
|
+
const [width, height] = this.orientation === exports.Orientation.HORIZONTAL
|
|
4177
|
+
? [size, orthogonalSize]
|
|
4178
|
+
: [orthogonalSize, size];
|
|
4179
|
+
if (this.isExpanded()) {
|
|
4180
|
+
this.expandedSize = width;
|
|
3933
4181
|
}
|
|
4182
|
+
super.layout(width, height);
|
|
3934
4183
|
}
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
4184
|
+
init(parameters) {
|
|
4185
|
+
var _a, _b;
|
|
4186
|
+
super.init(parameters);
|
|
4187
|
+
if (typeof parameters.minimumBodySize === 'number') {
|
|
4188
|
+
this.minimumBodySize = parameters.minimumBodySize;
|
|
3938
4189
|
}
|
|
3939
|
-
if (
|
|
3940
|
-
this.
|
|
3941
|
-
this.preActions = undefined;
|
|
4190
|
+
if (typeof parameters.maximumBodySize === 'number') {
|
|
4191
|
+
this.maximumBodySize = parameters.maximumBodySize;
|
|
3942
4192
|
}
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
4193
|
+
this.bodyPart = this.getBodyComponent();
|
|
4194
|
+
this.headerPart = this.getHeaderComponent();
|
|
4195
|
+
this.bodyPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
|
|
4196
|
+
this.headerPart.init(Object.assign(Object.assign({}, parameters), { api: this.api }));
|
|
4197
|
+
(_a = this.body) === null || _a === void 0 ? void 0 : _a.append(this.bodyPart.element);
|
|
4198
|
+
(_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);
|
|
4199
|
+
if (typeof parameters.isExpanded === 'boolean') {
|
|
4200
|
+
this.setExpanded(parameters.isExpanded);
|
|
3946
4201
|
}
|
|
3947
4202
|
}
|
|
3948
|
-
|
|
3949
|
-
|
|
4203
|
+
toJSON() {
|
|
4204
|
+
const params = this._params;
|
|
4205
|
+
return Object.assign(Object.assign({}, super.toJSON()), { headerComponent: this.headerComponent, title: params.title });
|
|
3950
4206
|
}
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
4207
|
+
renderOnce() {
|
|
4208
|
+
this.header = document.createElement('div');
|
|
4209
|
+
this.header.tabIndex = 0;
|
|
4210
|
+
this.header.className = 'pane-header';
|
|
4211
|
+
this.header.style.height = `${this.headerSize}px`;
|
|
4212
|
+
this.header.style.lineHeight = `${this.headerSize}px`;
|
|
4213
|
+
this.header.style.minHeight = `${this.headerSize}px`;
|
|
4214
|
+
this.header.style.maxHeight = `${this.headerSize}px`;
|
|
4215
|
+
this.element.appendChild(this.header);
|
|
4216
|
+
this.body = document.createElement('div');
|
|
4217
|
+
this.body.className = 'pane-body';
|
|
4218
|
+
this.element.appendChild(this.body);
|
|
3954
4219
|
}
|
|
3955
|
-
|
|
3956
|
-
|
|
4220
|
+
// TODO slightly hacky by-pass of the component to create a body and header component
|
|
4221
|
+
getComponent() {
|
|
4222
|
+
return {
|
|
4223
|
+
update: (params) => {
|
|
4224
|
+
var _a, _b;
|
|
4225
|
+
(_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.update({ params });
|
|
4226
|
+
(_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.update({ params });
|
|
4227
|
+
},
|
|
4228
|
+
dispose: () => {
|
|
4229
|
+
var _a, _b;
|
|
4230
|
+
(_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
4231
|
+
(_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
4232
|
+
},
|
|
4233
|
+
};
|
|
3957
4234
|
}
|
|
3958
|
-
|
|
3959
|
-
|
|
4235
|
+
}
|
|
4236
|
+
|
|
4237
|
+
class DraggablePaneviewPanel extends PaneviewPanel {
|
|
4238
|
+
constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
4239
|
+
super(id, component, headerComponent, orientation, isExpanded, true);
|
|
3960
4240
|
this.accessor = accessor;
|
|
3961
|
-
this.
|
|
3962
|
-
this.
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
this._onDrop = new Emitter();
|
|
3966
|
-
this.onDrop = this._onDrop.event;
|
|
3967
|
-
this._onTabDragStart = new Emitter();
|
|
3968
|
-
this.onTabDragStart = this._onTabDragStart.event;
|
|
3969
|
-
this._onGroupDragStart = new Emitter();
|
|
3970
|
-
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3971
|
-
this._onWillShowOverlay = new Emitter();
|
|
3972
|
-
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
3973
|
-
this._element = document.createElement('div');
|
|
3974
|
-
this._element.className = 'tabs-and-actions-container';
|
|
3975
|
-
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
3976
|
-
this.rightActionsContainer = document.createElement('div');
|
|
3977
|
-
this.rightActionsContainer.className = 'right-actions-container';
|
|
3978
|
-
this.leftActionsContainer = document.createElement('div');
|
|
3979
|
-
this.leftActionsContainer.className = 'left-actions-container';
|
|
3980
|
-
this.preActionsContainer = document.createElement('div');
|
|
3981
|
-
this.preActionsContainer.className = 'pre-actions-container';
|
|
3982
|
-
this.tabContainer = document.createElement('div');
|
|
3983
|
-
this.tabContainer.className = 'tabs-container';
|
|
3984
|
-
this.voidContainer = new VoidContainer(this.accessor, this.group);
|
|
3985
|
-
this._element.appendChild(this.preActionsContainer);
|
|
3986
|
-
this._element.appendChild(this.tabContainer);
|
|
3987
|
-
this._element.appendChild(this.leftActionsContainer);
|
|
3988
|
-
this._element.appendChild(this.voidContainer.element);
|
|
3989
|
-
this._element.appendChild(this.rightActionsContainer);
|
|
3990
|
-
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
3991
|
-
if (e.api.group === this.group) {
|
|
3992
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3993
|
-
}
|
|
3994
|
-
}), this.accessor.onDidRemovePanel((e) => {
|
|
3995
|
-
if (e.api.group === this.group) {
|
|
3996
|
-
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
3997
|
-
}
|
|
3998
|
-
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3999
|
-
this._onGroupDragStart.fire({
|
|
4000
|
-
nativeEvent: event,
|
|
4001
|
-
group: this.group,
|
|
4002
|
-
});
|
|
4003
|
-
}), this.voidContainer.onDrop((event) => {
|
|
4004
|
-
this._onDrop.fire({
|
|
4005
|
-
event: event.nativeEvent,
|
|
4006
|
-
index: this.tabs.length,
|
|
4007
|
-
});
|
|
4008
|
-
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
4009
|
-
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4010
|
-
kind: 'header_space',
|
|
4011
|
-
panel: this.group.activePanel,
|
|
4012
|
-
api: this.accessor.api,
|
|
4013
|
-
group: this.group,
|
|
4014
|
-
getData: getPanelData,
|
|
4015
|
-
}));
|
|
4016
|
-
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
4017
|
-
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
4018
|
-
if (isFloatingGroupsEnabled &&
|
|
4019
|
-
event.shiftKey &&
|
|
4020
|
-
this.group.api.location.type !== 'floating') {
|
|
4021
|
-
event.preventDefault();
|
|
4022
|
-
const { top, left } = this.element.getBoundingClientRect();
|
|
4023
|
-
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
4024
|
-
this.accessor.addFloatingGroup(this.group, {
|
|
4025
|
-
x: left - rootLeft + 20,
|
|
4026
|
-
y: top - rootTop + 20,
|
|
4027
|
-
}, { inDragMode: true });
|
|
4028
|
-
}
|
|
4029
|
-
}), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
4030
|
-
if (event.defaultPrevented) {
|
|
4031
|
-
return;
|
|
4032
|
-
}
|
|
4033
|
-
const isLeftClick = event.button === 0;
|
|
4034
|
-
if (isLeftClick) {
|
|
4035
|
-
this.accessor.doSetGroupActive(this.group);
|
|
4036
|
-
}
|
|
4037
|
-
}));
|
|
4038
|
-
}
|
|
4039
|
-
setActive(_isGroupActive) {
|
|
4040
|
-
// noop
|
|
4041
|
-
}
|
|
4042
|
-
addTab(tab, index = this.tabs.length) {
|
|
4043
|
-
if (index < 0 || index > this.tabs.length) {
|
|
4044
|
-
throw new Error('invalid location');
|
|
4045
|
-
}
|
|
4046
|
-
this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
|
|
4047
|
-
this.tabs = [
|
|
4048
|
-
...this.tabs.slice(0, index),
|
|
4049
|
-
tab,
|
|
4050
|
-
...this.tabs.slice(index),
|
|
4051
|
-
];
|
|
4052
|
-
if (this.selectedIndex < 0) {
|
|
4053
|
-
this.selectedIndex = index;
|
|
4241
|
+
this._onDidDrop = new Emitter();
|
|
4242
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
4243
|
+
if (!disableDnd) {
|
|
4244
|
+
this.initDragFeatures();
|
|
4054
4245
|
}
|
|
4055
4246
|
}
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
4059
|
-
const { value, disposable } = tabToRemove;
|
|
4060
|
-
disposable.dispose();
|
|
4061
|
-
value.dispose();
|
|
4062
|
-
value.element.remove();
|
|
4063
|
-
}
|
|
4064
|
-
setActivePanel(panel) {
|
|
4065
|
-
this.tabs.forEach((tab) => {
|
|
4066
|
-
const isActivePanel = panel.id === tab.value.panel.id;
|
|
4067
|
-
tab.value.setActive(isActivePanel);
|
|
4068
|
-
});
|
|
4069
|
-
}
|
|
4070
|
-
openPanel(panel, index = this.tabs.length) {
|
|
4071
|
-
var _a;
|
|
4072
|
-
if (this.tabs.find((tab) => tab.value.panel.id === panel.id)) {
|
|
4247
|
+
initDragFeatures() {
|
|
4248
|
+
if (!this.header) {
|
|
4073
4249
|
return;
|
|
4074
4250
|
}
|
|
4075
|
-
const
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
if (isFloatingGroupsEnabled &&
|
|
4087
|
-
!isFloatingWithOnePanel &&
|
|
4088
|
-
event.shiftKey) {
|
|
4089
|
-
event.preventDefault();
|
|
4090
|
-
const panel = this.accessor.getGroupPanel(tab.panel.id);
|
|
4091
|
-
const { top, left } = tab.element.getBoundingClientRect();
|
|
4092
|
-
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
4093
|
-
this.accessor.addFloatingGroup(panel, {
|
|
4094
|
-
x: left - rootLeft,
|
|
4095
|
-
y: top - rootTop,
|
|
4096
|
-
}, { inDragMode: true });
|
|
4097
|
-
return;
|
|
4098
|
-
}
|
|
4099
|
-
const isLeftClick = event.button === 0;
|
|
4100
|
-
if (!isLeftClick || event.defaultPrevented) {
|
|
4101
|
-
return;
|
|
4102
|
-
}
|
|
4103
|
-
if (this.group.activePanel !== panel) {
|
|
4104
|
-
this.group.model.openPanel(panel);
|
|
4251
|
+
const id = this.id;
|
|
4252
|
+
const accessorId = this.accessor.id;
|
|
4253
|
+
this.header.draggable = true;
|
|
4254
|
+
this.handler = new (class PaneDragHandler extends DragHandler {
|
|
4255
|
+
getData() {
|
|
4256
|
+
LocalSelectionTransfer.getInstance().setData([new PaneTransfer(accessorId, id)], PaneTransfer.prototype);
|
|
4257
|
+
return {
|
|
4258
|
+
dispose: () => {
|
|
4259
|
+
LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
|
|
4260
|
+
},
|
|
4261
|
+
};
|
|
4105
4262
|
}
|
|
4106
|
-
})
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
dispose() {
|
|
4127
|
-
super.dispose();
|
|
4128
|
-
for (const { value, disposable } of this.tabs) {
|
|
4129
|
-
disposable.dispose();
|
|
4130
|
-
value.dispose();
|
|
4131
|
-
}
|
|
4132
|
-
this.tabs = [];
|
|
4133
|
-
}
|
|
4134
|
-
}
|
|
4135
|
-
|
|
4136
|
-
class DockviewDidDropEvent extends DockviewEvent {
|
|
4137
|
-
get nativeEvent() {
|
|
4138
|
-
return this.options.nativeEvent;
|
|
4139
|
-
}
|
|
4140
|
-
get position() {
|
|
4141
|
-
return this.options.position;
|
|
4142
|
-
}
|
|
4143
|
-
get panel() {
|
|
4144
|
-
return this.options.panel;
|
|
4145
|
-
}
|
|
4146
|
-
get group() {
|
|
4147
|
-
return this.options.group;
|
|
4148
|
-
}
|
|
4149
|
-
get api() {
|
|
4150
|
-
return this.options.api;
|
|
4151
|
-
}
|
|
4152
|
-
constructor(options) {
|
|
4153
|
-
super();
|
|
4154
|
-
this.options = options;
|
|
4155
|
-
}
|
|
4156
|
-
getData() {
|
|
4157
|
-
return this.options.getData();
|
|
4158
|
-
}
|
|
4159
|
-
}
|
|
4160
|
-
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4161
|
-
get kind() {
|
|
4162
|
-
return this._kind;
|
|
4163
|
-
}
|
|
4164
|
-
constructor(options) {
|
|
4165
|
-
super(options);
|
|
4166
|
-
this._kind = options.kind;
|
|
4167
|
-
}
|
|
4168
|
-
}
|
|
4169
|
-
class WillShowOverlayLocationEvent {
|
|
4170
|
-
get kind() {
|
|
4171
|
-
return this.options.kind;
|
|
4172
|
-
}
|
|
4173
|
-
get nativeEvent() {
|
|
4174
|
-
return this.event.nativeEvent;
|
|
4175
|
-
}
|
|
4176
|
-
get position() {
|
|
4177
|
-
return this.event.position;
|
|
4178
|
-
}
|
|
4179
|
-
get defaultPrevented() {
|
|
4180
|
-
return this.event.defaultPrevented;
|
|
4181
|
-
}
|
|
4182
|
-
get panel() {
|
|
4183
|
-
return this.options.panel;
|
|
4184
|
-
}
|
|
4185
|
-
get api() {
|
|
4186
|
-
return this.options.api;
|
|
4187
|
-
}
|
|
4188
|
-
get group() {
|
|
4189
|
-
return this.options.group;
|
|
4190
|
-
}
|
|
4191
|
-
preventDefault() {
|
|
4192
|
-
this.event.preventDefault();
|
|
4193
|
-
}
|
|
4194
|
-
getData() {
|
|
4195
|
-
return this.options.getData();
|
|
4196
|
-
}
|
|
4197
|
-
constructor(event, options) {
|
|
4198
|
-
this.event = event;
|
|
4199
|
-
this.options = options;
|
|
4200
|
-
}
|
|
4201
|
-
}
|
|
4202
|
-
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
4203
|
-
get element() {
|
|
4204
|
-
throw new Error('not supported');
|
|
4205
|
-
}
|
|
4206
|
-
get activePanel() {
|
|
4207
|
-
return this._activePanel;
|
|
4208
|
-
}
|
|
4209
|
-
get locked() {
|
|
4210
|
-
return this._locked;
|
|
4211
|
-
}
|
|
4212
|
-
set locked(value) {
|
|
4213
|
-
this._locked = value;
|
|
4214
|
-
toggleClass(this.container, 'locked-groupview', value === 'no-drop-target' || value);
|
|
4215
|
-
}
|
|
4216
|
-
get isActive() {
|
|
4217
|
-
return this._isGroupActive;
|
|
4218
|
-
}
|
|
4219
|
-
get panels() {
|
|
4220
|
-
return this._panels;
|
|
4221
|
-
}
|
|
4222
|
-
get size() {
|
|
4223
|
-
return this._panels.length;
|
|
4224
|
-
}
|
|
4225
|
-
get isEmpty() {
|
|
4226
|
-
return this._panels.length === 0;
|
|
4227
|
-
}
|
|
4228
|
-
get hasWatermark() {
|
|
4229
|
-
return !!(this.watermark && this.container.contains(this.watermark.element));
|
|
4230
|
-
}
|
|
4231
|
-
get header() {
|
|
4232
|
-
return this.tabsContainer;
|
|
4233
|
-
}
|
|
4234
|
-
get isContentFocused() {
|
|
4235
|
-
if (!document.activeElement) {
|
|
4236
|
-
return false;
|
|
4237
|
-
}
|
|
4238
|
-
return isAncestor(document.activeElement, this.contentContainer.element);
|
|
4239
|
-
}
|
|
4240
|
-
get location() {
|
|
4241
|
-
return this._location;
|
|
4242
|
-
}
|
|
4243
|
-
set location(value) {
|
|
4244
|
-
this._location = value;
|
|
4245
|
-
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
4246
|
-
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
4247
|
-
switch (value.type) {
|
|
4248
|
-
case 'grid':
|
|
4249
|
-
this.contentContainer.dropTarget.setTargetZones([
|
|
4250
|
-
'top',
|
|
4251
|
-
'bottom',
|
|
4252
|
-
'left',
|
|
4253
|
-
'right',
|
|
4254
|
-
'center',
|
|
4255
|
-
]);
|
|
4256
|
-
break;
|
|
4257
|
-
case 'floating':
|
|
4258
|
-
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
4259
|
-
this.contentContainer.dropTarget.setTargetZones(value
|
|
4260
|
-
? ['center']
|
|
4261
|
-
: ['top', 'bottom', 'left', 'right', 'center']);
|
|
4262
|
-
toggleClass(this.container, 'dv-groupview-floating', true);
|
|
4263
|
-
break;
|
|
4264
|
-
case 'popout':
|
|
4265
|
-
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
4266
|
-
toggleClass(this.container, 'dv-groupview-popout', true);
|
|
4267
|
-
break;
|
|
4268
|
-
}
|
|
4269
|
-
this.groupPanel.api._onDidLocationChange.fire({
|
|
4270
|
-
location: this.location,
|
|
4271
|
-
});
|
|
4272
|
-
}
|
|
4273
|
-
constructor(container, accessor, id, options, groupPanel) {
|
|
4274
|
-
var _a;
|
|
4275
|
-
super();
|
|
4276
|
-
this.container = container;
|
|
4277
|
-
this.accessor = accessor;
|
|
4278
|
-
this.id = id;
|
|
4279
|
-
this.options = options;
|
|
4280
|
-
this.groupPanel = groupPanel;
|
|
4281
|
-
this._isGroupActive = false;
|
|
4282
|
-
this._locked = false;
|
|
4283
|
-
this._location = { type: 'grid' };
|
|
4284
|
-
this.mostRecentlyUsed = [];
|
|
4285
|
-
this._onDidChange = new Emitter();
|
|
4286
|
-
this.onDidChange = this._onDidChange.event;
|
|
4287
|
-
this._width = 0;
|
|
4288
|
-
this._height = 0;
|
|
4289
|
-
this._panels = [];
|
|
4290
|
-
this._panelDisposables = new Map();
|
|
4291
|
-
this._onMove = new Emitter();
|
|
4292
|
-
this.onMove = this._onMove.event;
|
|
4293
|
-
this._onDidDrop = new Emitter();
|
|
4294
|
-
this.onDidDrop = this._onDidDrop.event;
|
|
4295
|
-
this._onWillDrop = new Emitter();
|
|
4296
|
-
this.onWillDrop = this._onWillDrop.event;
|
|
4297
|
-
this._onWillShowOverlay = new Emitter();
|
|
4298
|
-
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
4299
|
-
this._onTabDragStart = new Emitter();
|
|
4300
|
-
this.onTabDragStart = this._onTabDragStart.event;
|
|
4301
|
-
this._onGroupDragStart = new Emitter();
|
|
4302
|
-
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
4303
|
-
this._onDidAddPanel = new Emitter();
|
|
4304
|
-
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
4305
|
-
this._onDidPanelTitleChange = new Emitter();
|
|
4306
|
-
this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;
|
|
4307
|
-
this._onDidPanelParametersChange = new Emitter();
|
|
4308
|
-
this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;
|
|
4309
|
-
this._onDidRemovePanel = new Emitter();
|
|
4310
|
-
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
4311
|
-
this._onDidActivePanelChange = new Emitter();
|
|
4312
|
-
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
4313
|
-
this._overwriteRenderContainer = null;
|
|
4314
|
-
toggleClass(this.container, 'groupview', true);
|
|
4315
|
-
this._api = new DockviewApi(this.accessor);
|
|
4316
|
-
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
4317
|
-
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
4318
|
-
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
4319
|
-
this.header.hidden = !!options.hideHeader;
|
|
4320
|
-
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
4321
|
-
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
4322
|
-
this._onTabDragStart.fire(event);
|
|
4323
|
-
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
4324
|
-
this._onGroupDragStart.fire(event);
|
|
4325
|
-
}), this.tabsContainer.onDrop((event) => {
|
|
4326
|
-
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
4327
|
-
}), this.contentContainer.onDidFocus(() => {
|
|
4328
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4329
|
-
}), this.contentContainer.onDidBlur(() => {
|
|
4330
|
-
// noop
|
|
4331
|
-
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
4332
|
-
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
4333
|
-
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
4334
|
-
this._onWillShowOverlay.fire(event);
|
|
4335
|
-
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
4336
|
-
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4337
|
-
kind: 'content',
|
|
4338
|
-
panel: this.activePanel,
|
|
4339
|
-
api: this._api,
|
|
4340
|
-
group: this.groupPanel,
|
|
4341
|
-
getData: getPanelData,
|
|
4342
|
-
}));
|
|
4343
|
-
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange);
|
|
4344
|
-
}
|
|
4345
|
-
focusContent() {
|
|
4346
|
-
this.contentContainer.element.focus();
|
|
4347
|
-
}
|
|
4348
|
-
set renderContainer(value) {
|
|
4349
|
-
this.panels.forEach((panel) => {
|
|
4350
|
-
this.renderContainer.detatch(panel);
|
|
4351
|
-
});
|
|
4352
|
-
this._overwriteRenderContainer = value;
|
|
4353
|
-
this.panels.forEach((panel) => {
|
|
4354
|
-
this.rerender(panel);
|
|
4355
|
-
});
|
|
4356
|
-
}
|
|
4357
|
-
get renderContainer() {
|
|
4358
|
-
var _a;
|
|
4359
|
-
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
4360
|
-
}
|
|
4361
|
-
initialize() {
|
|
4362
|
-
if (this.options.panels) {
|
|
4363
|
-
this.options.panels.forEach((panel) => {
|
|
4364
|
-
this.doAddPanel(panel);
|
|
4365
|
-
});
|
|
4366
|
-
}
|
|
4367
|
-
if (this.options.activePanel) {
|
|
4368
|
-
this.openPanel(this.options.activePanel);
|
|
4369
|
-
}
|
|
4370
|
-
// must be run after the constructor otherwise this.parent may not be
|
|
4371
|
-
// correctly initialized
|
|
4372
|
-
this.setActive(this.isActive, true);
|
|
4373
|
-
this.updateContainer();
|
|
4374
|
-
if (this.accessor.options.createRightHeaderActionsElement) {
|
|
4375
|
-
this._rightHeaderActions =
|
|
4376
|
-
this.accessor.options.createRightHeaderActionsElement(this.groupPanel);
|
|
4377
|
-
this.addDisposables(this._rightHeaderActions);
|
|
4378
|
-
this._rightHeaderActions.init({
|
|
4379
|
-
containerApi: this._api,
|
|
4380
|
-
api: this.groupPanel.api,
|
|
4381
|
-
});
|
|
4382
|
-
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
4383
|
-
}
|
|
4384
|
-
if (this.accessor.options.createLeftHeaderActionsElement) {
|
|
4385
|
-
this._leftHeaderActions =
|
|
4386
|
-
this.accessor.options.createLeftHeaderActionsElement(this.groupPanel);
|
|
4387
|
-
this.addDisposables(this._leftHeaderActions);
|
|
4388
|
-
this._leftHeaderActions.init({
|
|
4389
|
-
containerApi: this._api,
|
|
4390
|
-
api: this.groupPanel.api,
|
|
4391
|
-
});
|
|
4392
|
-
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
4393
|
-
}
|
|
4394
|
-
if (this.accessor.options.createPrefixHeaderActionsElement) {
|
|
4395
|
-
this._prefixHeaderActions =
|
|
4396
|
-
this.accessor.options.createPrefixHeaderActionsElement(this.groupPanel);
|
|
4397
|
-
this.addDisposables(this._prefixHeaderActions);
|
|
4398
|
-
this._prefixHeaderActions.init({
|
|
4399
|
-
containerApi: this._api,
|
|
4400
|
-
api: this.groupPanel.api,
|
|
4401
|
-
});
|
|
4402
|
-
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
4403
|
-
}
|
|
4404
|
-
}
|
|
4405
|
-
rerender(panel) {
|
|
4406
|
-
this.contentContainer.renderPanel(panel, { asActive: false });
|
|
4407
|
-
}
|
|
4408
|
-
indexOf(panel) {
|
|
4409
|
-
return this.tabsContainer.indexOf(panel.id);
|
|
4410
|
-
}
|
|
4411
|
-
toJSON() {
|
|
4412
|
-
var _a;
|
|
4413
|
-
const result = {
|
|
4414
|
-
views: this.tabsContainer.panels,
|
|
4415
|
-
activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
|
|
4416
|
-
id: this.id,
|
|
4417
|
-
};
|
|
4418
|
-
if (this.locked !== false) {
|
|
4419
|
-
result.locked = this.locked;
|
|
4420
|
-
}
|
|
4421
|
-
if (this.header.hidden) {
|
|
4422
|
-
result.hideHeader = true;
|
|
4423
|
-
}
|
|
4424
|
-
return result;
|
|
4425
|
-
}
|
|
4426
|
-
moveToNext(options) {
|
|
4427
|
-
if (!options) {
|
|
4428
|
-
options = {};
|
|
4429
|
-
}
|
|
4430
|
-
if (!options.panel) {
|
|
4431
|
-
options.panel = this.activePanel;
|
|
4432
|
-
}
|
|
4433
|
-
const index = options.panel ? this.panels.indexOf(options.panel) : -1;
|
|
4434
|
-
let normalizedIndex;
|
|
4435
|
-
if (index < this.panels.length - 1) {
|
|
4436
|
-
normalizedIndex = index + 1;
|
|
4437
|
-
}
|
|
4438
|
-
else if (!options.suppressRoll) {
|
|
4439
|
-
normalizedIndex = 0;
|
|
4440
|
-
}
|
|
4441
|
-
else {
|
|
4442
|
-
return;
|
|
4443
|
-
}
|
|
4444
|
-
this.openPanel(this.panels[normalizedIndex]);
|
|
4445
|
-
}
|
|
4446
|
-
moveToPrevious(options) {
|
|
4447
|
-
if (!options) {
|
|
4448
|
-
options = {};
|
|
4449
|
-
}
|
|
4450
|
-
if (!options.panel) {
|
|
4451
|
-
options.panel = this.activePanel;
|
|
4452
|
-
}
|
|
4453
|
-
if (!options.panel) {
|
|
4454
|
-
return;
|
|
4455
|
-
}
|
|
4456
|
-
const index = this.panels.indexOf(options.panel);
|
|
4457
|
-
let normalizedIndex;
|
|
4458
|
-
if (index > 0) {
|
|
4459
|
-
normalizedIndex = index - 1;
|
|
4460
|
-
}
|
|
4461
|
-
else if (!options.suppressRoll) {
|
|
4462
|
-
normalizedIndex = this.panels.length - 1;
|
|
4463
|
-
}
|
|
4464
|
-
else {
|
|
4465
|
-
return;
|
|
4466
|
-
}
|
|
4467
|
-
this.openPanel(this.panels[normalizedIndex]);
|
|
4468
|
-
}
|
|
4469
|
-
containsPanel(panel) {
|
|
4470
|
-
return this.panels.includes(panel);
|
|
4471
|
-
}
|
|
4472
|
-
init(_params) {
|
|
4473
|
-
//noop
|
|
4474
|
-
}
|
|
4475
|
-
update(_params) {
|
|
4476
|
-
//noop
|
|
4477
|
-
}
|
|
4478
|
-
focus() {
|
|
4479
|
-
var _a;
|
|
4480
|
-
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
4481
|
-
}
|
|
4482
|
-
openPanel(panel, options = {}) {
|
|
4483
|
-
/**
|
|
4484
|
-
* set the panel group
|
|
4485
|
-
* add the panel
|
|
4486
|
-
* check if group active
|
|
4487
|
-
* check if panel active
|
|
4488
|
-
*/
|
|
4489
|
-
if (typeof options.index !== 'number' ||
|
|
4490
|
-
options.index > this.panels.length) {
|
|
4491
|
-
options.index = this.panels.length;
|
|
4492
|
-
}
|
|
4493
|
-
const skipSetActive = !!options.skipSetActive;
|
|
4494
|
-
// ensure the group is updated before we fire any events
|
|
4495
|
-
panel.updateParentGroup(this.groupPanel, {
|
|
4496
|
-
skipSetActive: options.skipSetActive,
|
|
4497
|
-
});
|
|
4498
|
-
this.doAddPanel(panel, options.index, {
|
|
4499
|
-
skipSetActive: skipSetActive,
|
|
4500
|
-
});
|
|
4501
|
-
if (this._activePanel === panel) {
|
|
4502
|
-
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
4503
|
-
return;
|
|
4504
|
-
}
|
|
4505
|
-
if (!skipSetActive) {
|
|
4506
|
-
this.doSetActivePanel(panel);
|
|
4507
|
-
}
|
|
4508
|
-
if (!options.skipSetGroupActive) {
|
|
4509
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4510
|
-
}
|
|
4511
|
-
if (!options.skipSetActive) {
|
|
4512
|
-
this.updateContainer();
|
|
4513
|
-
}
|
|
4514
|
-
}
|
|
4515
|
-
removePanel(groupItemOrId, options = {
|
|
4516
|
-
skipSetActive: false,
|
|
4517
|
-
}) {
|
|
4518
|
-
const id = typeof groupItemOrId === 'string'
|
|
4519
|
-
? groupItemOrId
|
|
4520
|
-
: groupItemOrId.id;
|
|
4521
|
-
const panelToRemove = this._panels.find((panel) => panel.id === id);
|
|
4522
|
-
if (!panelToRemove) {
|
|
4523
|
-
throw new Error('invalid operation');
|
|
4524
|
-
}
|
|
4525
|
-
return this._removePanel(panelToRemove, options);
|
|
4526
|
-
}
|
|
4527
|
-
closeAllPanels() {
|
|
4528
|
-
if (this.panels.length > 0) {
|
|
4529
|
-
// take a copy since we will be edting the array as we iterate through
|
|
4530
|
-
const arrPanelCpy = [...this.panels];
|
|
4531
|
-
for (const panel of arrPanelCpy) {
|
|
4532
|
-
this.doClose(panel);
|
|
4533
|
-
}
|
|
4534
|
-
}
|
|
4535
|
-
else {
|
|
4536
|
-
this.accessor.removeGroup(this.groupPanel);
|
|
4537
|
-
}
|
|
4538
|
-
}
|
|
4539
|
-
closePanel(panel) {
|
|
4540
|
-
this.doClose(panel);
|
|
4541
|
-
}
|
|
4542
|
-
doClose(panel) {
|
|
4543
|
-
this.accessor.removePanel(panel);
|
|
4544
|
-
}
|
|
4545
|
-
isPanelActive(panel) {
|
|
4546
|
-
return this._activePanel === panel;
|
|
4547
|
-
}
|
|
4548
|
-
updateActions(element) {
|
|
4549
|
-
this.tabsContainer.setRightActionsElement(element);
|
|
4550
|
-
}
|
|
4551
|
-
setActive(isGroupActive, force = false) {
|
|
4552
|
-
if (!force && this.isActive === isGroupActive) {
|
|
4553
|
-
return;
|
|
4554
|
-
}
|
|
4555
|
-
this._isGroupActive = isGroupActive;
|
|
4556
|
-
toggleClass(this.container, 'active-group', isGroupActive);
|
|
4557
|
-
toggleClass(this.container, 'inactive-group', !isGroupActive);
|
|
4558
|
-
this.tabsContainer.setActive(this.isActive);
|
|
4559
|
-
if (!this._activePanel && this.panels.length > 0) {
|
|
4560
|
-
this.doSetActivePanel(this.panels[0]);
|
|
4561
|
-
}
|
|
4562
|
-
this.updateContainer();
|
|
4563
|
-
}
|
|
4564
|
-
layout(width, height) {
|
|
4565
|
-
var _a;
|
|
4566
|
-
this._width = width;
|
|
4567
|
-
this._height = height;
|
|
4568
|
-
this.contentContainer.layout(this._width, this._height);
|
|
4569
|
-
if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
|
|
4570
|
-
this._activePanel.layout(this._width, this._height);
|
|
4571
|
-
}
|
|
4572
|
-
}
|
|
4573
|
-
_removePanel(panel, options) {
|
|
4574
|
-
const isActivePanel = this._activePanel === panel;
|
|
4575
|
-
this.doRemovePanel(panel);
|
|
4576
|
-
if (isActivePanel && this.panels.length > 0) {
|
|
4577
|
-
const nextPanel = this.mostRecentlyUsed[0];
|
|
4578
|
-
this.openPanel(nextPanel, {
|
|
4579
|
-
skipSetActive: options.skipSetActive,
|
|
4580
|
-
skipSetGroupActive: options.skipSetActiveGroup,
|
|
4581
|
-
});
|
|
4582
|
-
}
|
|
4583
|
-
if (this._activePanel && this.panels.length === 0) {
|
|
4584
|
-
this.doSetActivePanel(undefined);
|
|
4585
|
-
}
|
|
4586
|
-
if (!options.skipSetActive) {
|
|
4587
|
-
this.updateContainer();
|
|
4588
|
-
}
|
|
4589
|
-
return panel;
|
|
4590
|
-
}
|
|
4591
|
-
doRemovePanel(panel) {
|
|
4592
|
-
const index = this.panels.indexOf(panel);
|
|
4593
|
-
if (this._activePanel === panel) {
|
|
4594
|
-
this.contentContainer.closePanel();
|
|
4595
|
-
}
|
|
4596
|
-
this.tabsContainer.delete(panel.id);
|
|
4597
|
-
this._panels.splice(index, 1);
|
|
4598
|
-
if (this.mostRecentlyUsed.includes(panel)) {
|
|
4599
|
-
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
4600
|
-
}
|
|
4601
|
-
const disposable = this._panelDisposables.get(panel.id);
|
|
4602
|
-
if (disposable) {
|
|
4603
|
-
disposable.dispose();
|
|
4604
|
-
this._panelDisposables.delete(panel.id);
|
|
4605
|
-
}
|
|
4606
|
-
this._onDidRemovePanel.fire({ panel });
|
|
4607
|
-
}
|
|
4608
|
-
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
4609
|
-
const existingPanel = this._panels.indexOf(panel);
|
|
4610
|
-
const hasExistingPanel = existingPanel > -1;
|
|
4611
|
-
this.tabsContainer.show();
|
|
4612
|
-
this.contentContainer.show();
|
|
4613
|
-
this.tabsContainer.openPanel(panel, index);
|
|
4614
|
-
if (!options.skipSetActive) {
|
|
4615
|
-
this.contentContainer.openPanel(panel);
|
|
4616
|
-
}
|
|
4617
|
-
if (hasExistingPanel) {
|
|
4618
|
-
// TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
|
|
4619
|
-
return;
|
|
4620
|
-
}
|
|
4621
|
-
this.updateMru(panel);
|
|
4622
|
-
this.panels.splice(index, 0, panel);
|
|
4623
|
-
this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
|
|
4624
|
-
this._onDidAddPanel.fire({ panel });
|
|
4625
|
-
}
|
|
4626
|
-
doSetActivePanel(panel) {
|
|
4627
|
-
if (this._activePanel === panel) {
|
|
4628
|
-
return;
|
|
4629
|
-
}
|
|
4630
|
-
this._activePanel = panel;
|
|
4631
|
-
if (panel) {
|
|
4632
|
-
this.tabsContainer.setActivePanel(panel);
|
|
4633
|
-
panel.layout(this._width, this._height);
|
|
4634
|
-
this.updateMru(panel);
|
|
4635
|
-
this._onDidActivePanelChange.fire({
|
|
4636
|
-
panel,
|
|
4637
|
-
});
|
|
4638
|
-
}
|
|
4639
|
-
}
|
|
4640
|
-
updateMru(panel) {
|
|
4641
|
-
if (this.mostRecentlyUsed.includes(panel)) {
|
|
4642
|
-
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
4643
|
-
}
|
|
4644
|
-
this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
|
|
4645
|
-
}
|
|
4646
|
-
updateContainer() {
|
|
4647
|
-
var _a, _b;
|
|
4648
|
-
toggleClass(this.container, 'empty', this.isEmpty);
|
|
4649
|
-
this.panels.forEach((panel) => panel.runEvents());
|
|
4650
|
-
if (this.isEmpty && !this.watermark) {
|
|
4651
|
-
const watermark = this.accessor.createWatermarkComponent();
|
|
4652
|
-
watermark.init({
|
|
4653
|
-
containerApi: this._api,
|
|
4654
|
-
group: this.groupPanel,
|
|
4655
|
-
});
|
|
4656
|
-
this.watermark = watermark;
|
|
4657
|
-
addDisposableListener(this.watermark.element, 'click', () => {
|
|
4658
|
-
if (!this.isActive) {
|
|
4659
|
-
this.accessor.doSetGroupActive(this.groupPanel);
|
|
4263
|
+
})(this.header);
|
|
4264
|
+
this.target = new Droptarget(this.element, {
|
|
4265
|
+
acceptedTargetZones: ['top', 'bottom'],
|
|
4266
|
+
overlayModel: {
|
|
4267
|
+
activationSize: { type: 'percentage', value: 50 },
|
|
4268
|
+
},
|
|
4269
|
+
canDisplayOverlay: (event) => {
|
|
4270
|
+
const data = getPaneData();
|
|
4271
|
+
if (data) {
|
|
4272
|
+
if (data.paneId !== this.id &&
|
|
4273
|
+
data.viewId === this.accessor.id) {
|
|
4274
|
+
return true;
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
if (this.accessor.options.showDndOverlay) {
|
|
4278
|
+
return this.accessor.options.showDndOverlay({
|
|
4279
|
+
nativeEvent: event,
|
|
4280
|
+
getData: getPaneData,
|
|
4281
|
+
panel: this,
|
|
4282
|
+
});
|
|
4660
4283
|
}
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
this.watermark.element.remove();
|
|
4668
|
-
(_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4669
|
-
this.watermark = undefined;
|
|
4670
|
-
this.tabsContainer.show();
|
|
4671
|
-
}
|
|
4672
|
-
}
|
|
4673
|
-
canDisplayOverlay(event, position, target) {
|
|
4674
|
-
// custom overlay handler
|
|
4675
|
-
if (this.accessor.options.showDndOverlay) {
|
|
4676
|
-
return this.accessor.options.showDndOverlay({
|
|
4677
|
-
nativeEvent: event,
|
|
4678
|
-
target,
|
|
4679
|
-
group: this.accessor.getPanel(this.id),
|
|
4680
|
-
position,
|
|
4681
|
-
getData: getPanelData,
|
|
4682
|
-
});
|
|
4683
|
-
}
|
|
4684
|
-
return false;
|
|
4284
|
+
return false;
|
|
4285
|
+
},
|
|
4286
|
+
});
|
|
4287
|
+
this.addDisposables(this._onDidDrop, this.handler, this.target, this.target.onDrop((event) => {
|
|
4288
|
+
this.onDrop(event);
|
|
4289
|
+
}));
|
|
4685
4290
|
}
|
|
4686
|
-
|
|
4687
|
-
|
|
4291
|
+
onDrop(event) {
|
|
4292
|
+
const data = getPaneData();
|
|
4293
|
+
if (!data || data.viewId !== this.accessor.id) {
|
|
4294
|
+
// if there is no local drag event for this panel
|
|
4295
|
+
// or if the drag event was creating by another Paneview instance
|
|
4296
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, api: new PaneviewApi(this.accessor), getData: getPaneData }));
|
|
4688
4297
|
return;
|
|
4689
4298
|
}
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
}
|
|
4697
|
-
}
|
|
4698
|
-
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
4699
|
-
const willDropEvent = new DockviewWillDropEvent({
|
|
4700
|
-
nativeEvent: event,
|
|
4701
|
-
position,
|
|
4702
|
-
panel,
|
|
4703
|
-
getData: () => getPanelData(),
|
|
4704
|
-
kind: getKind(),
|
|
4705
|
-
group: this.groupPanel,
|
|
4706
|
-
api: this._api,
|
|
4707
|
-
});
|
|
4708
|
-
this._onWillDrop.fire(willDropEvent);
|
|
4709
|
-
if (willDropEvent.defaultPrevented) {
|
|
4299
|
+
const containerApi = this._params
|
|
4300
|
+
.containerApi;
|
|
4301
|
+
const panelId = data.paneId;
|
|
4302
|
+
const existingPanel = containerApi.getPanel(panelId);
|
|
4303
|
+
if (!existingPanel) {
|
|
4304
|
+
// if the panel doesn't exist
|
|
4305
|
+
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, getData: getPaneData, api: new PaneviewApi(this.accessor) }));
|
|
4710
4306
|
return;
|
|
4711
4307
|
}
|
|
4712
|
-
const
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
this._onMove.fire({
|
|
4718
|
-
target: position,
|
|
4719
|
-
groupId: groupId,
|
|
4720
|
-
index,
|
|
4721
|
-
});
|
|
4722
|
-
return;
|
|
4723
|
-
}
|
|
4724
|
-
const fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
|
|
4725
|
-
if (fromSameGroup && this.tabsContainer.size === 1) {
|
|
4726
|
-
return;
|
|
4727
|
-
}
|
|
4728
|
-
const { groupId, panelId } = data;
|
|
4729
|
-
const isSameGroup = this.id === groupId;
|
|
4730
|
-
if (isSameGroup && !position) {
|
|
4731
|
-
const oldIndex = this.tabsContainer.indexOf(panelId);
|
|
4732
|
-
if (oldIndex === index) {
|
|
4733
|
-
return;
|
|
4734
|
-
}
|
|
4735
|
-
}
|
|
4736
|
-
this._onMove.fire({
|
|
4737
|
-
target: position,
|
|
4738
|
-
groupId: data.groupId,
|
|
4739
|
-
itemId: data.panelId,
|
|
4740
|
-
index,
|
|
4741
|
-
});
|
|
4742
|
-
}
|
|
4743
|
-
else {
|
|
4744
|
-
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
4745
|
-
nativeEvent: event,
|
|
4746
|
-
position,
|
|
4747
|
-
panel,
|
|
4748
|
-
getData: () => getPanelData(),
|
|
4749
|
-
group: this.groupPanel,
|
|
4750
|
-
api: this._api,
|
|
4751
|
-
}));
|
|
4308
|
+
const allPanels = containerApi.panels;
|
|
4309
|
+
const fromIndex = allPanels.indexOf(existingPanel);
|
|
4310
|
+
let toIndex = containerApi.panels.indexOf(this);
|
|
4311
|
+
if (event.position === 'left' || event.position === 'top') {
|
|
4312
|
+
toIndex = Math.max(0, toIndex - 1);
|
|
4752
4313
|
}
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
4759
|
-
this.watermark = undefined;
|
|
4760
|
-
for (const panel of this.panels) {
|
|
4761
|
-
panel.dispose();
|
|
4314
|
+
if (event.position === 'right' || event.position === 'bottom') {
|
|
4315
|
+
if (fromIndex > toIndex) {
|
|
4316
|
+
toIndex++;
|
|
4317
|
+
}
|
|
4318
|
+
toIndex = Math.min(allPanels.length - 1, toIndex);
|
|
4762
4319
|
}
|
|
4763
|
-
|
|
4764
|
-
this.contentContainer.dispose();
|
|
4320
|
+
containerApi.movePanel(fromIndex, toIndex);
|
|
4765
4321
|
}
|
|
4766
4322
|
}
|
|
4767
4323
|
|
|
4768
|
-
class
|
|
4324
|
+
class ContentContainer extends CompositeDisposable {
|
|
4769
4325
|
get element() {
|
|
4770
4326
|
return this._element;
|
|
4771
4327
|
}
|
|
4772
|
-
|
|
4773
|
-
|
|
4328
|
+
constructor(accessor, group) {
|
|
4329
|
+
super();
|
|
4330
|
+
this.accessor = accessor;
|
|
4331
|
+
this.group = group;
|
|
4332
|
+
this.disposable = new MutableDisposable();
|
|
4333
|
+
this._onDidFocus = new Emitter();
|
|
4334
|
+
this.onDidFocus = this._onDidFocus.event;
|
|
4335
|
+
this._onDidBlur = new Emitter();
|
|
4336
|
+
this.onDidBlur = this._onDidBlur.event;
|
|
4337
|
+
this._element = document.createElement('div');
|
|
4338
|
+
this._element.className = 'content-container';
|
|
4339
|
+
this._element.tabIndex = -1;
|
|
4340
|
+
this.addDisposables(this._onDidFocus, this._onDidBlur);
|
|
4341
|
+
this.dropTarget = new Droptarget(this.element, {
|
|
4342
|
+
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
4343
|
+
canDisplayOverlay: (event, position) => {
|
|
4344
|
+
if (this.group.locked === 'no-drop-target' ||
|
|
4345
|
+
(this.group.locked && position === 'center')) {
|
|
4346
|
+
return false;
|
|
4347
|
+
}
|
|
4348
|
+
const data = getPanelData();
|
|
4349
|
+
if (!data &&
|
|
4350
|
+
event.shiftKey &&
|
|
4351
|
+
this.group.location.type !== 'floating') {
|
|
4352
|
+
return false;
|
|
4353
|
+
}
|
|
4354
|
+
if (data && data.viewId === this.accessor.id) {
|
|
4355
|
+
if (data.groupId === this.group.id) {
|
|
4356
|
+
if (position === 'center') {
|
|
4357
|
+
// don't allow to drop on self for center position
|
|
4358
|
+
return false;
|
|
4359
|
+
}
|
|
4360
|
+
if (data.panelId === null) {
|
|
4361
|
+
// don't allow group move to drop anywhere on self
|
|
4362
|
+
return false;
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
const groupHasOnePanelAndIsActiveDragElement = this.group.panels.length === 1 &&
|
|
4366
|
+
data.groupId === this.group.id;
|
|
4367
|
+
return !groupHasOnePanelAndIsActiveDragElement;
|
|
4368
|
+
}
|
|
4369
|
+
return this.group.canDisplayOverlay(event, position, 'content');
|
|
4370
|
+
},
|
|
4371
|
+
});
|
|
4372
|
+
this.addDisposables(this.dropTarget);
|
|
4774
4373
|
}
|
|
4775
|
-
|
|
4776
|
-
this.
|
|
4374
|
+
show() {
|
|
4375
|
+
this.element.style.display = '';
|
|
4777
4376
|
}
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
this.
|
|
4818
|
-
}
|
|
4377
|
+
hide() {
|
|
4378
|
+
this.element.style.display = 'none';
|
|
4379
|
+
}
|
|
4380
|
+
renderPanel(panel, options = { asActive: true }) {
|
|
4381
|
+
const doRender = options.asActive ||
|
|
4382
|
+
(this.panel && this.group.isPanelActive(this.panel));
|
|
4383
|
+
if (this.panel &&
|
|
4384
|
+
this.panel.view.content.element.parentElement === this._element) {
|
|
4385
|
+
/**
|
|
4386
|
+
* If the currently attached panel is mounted directly to the content then remove it
|
|
4387
|
+
*/
|
|
4388
|
+
this._element.removeChild(this.panel.view.content.element);
|
|
4389
|
+
}
|
|
4390
|
+
this.panel = panel;
|
|
4391
|
+
let container;
|
|
4392
|
+
switch (panel.api.renderer) {
|
|
4393
|
+
case 'onlyWhenVisible':
|
|
4394
|
+
this.group.renderContainer.detatch(panel);
|
|
4395
|
+
if (this.panel) {
|
|
4396
|
+
if (doRender) {
|
|
4397
|
+
this._element.appendChild(this.panel.view.content.element);
|
|
4398
|
+
}
|
|
4399
|
+
}
|
|
4400
|
+
container = this._element;
|
|
4401
|
+
break;
|
|
4402
|
+
case 'always':
|
|
4403
|
+
if (panel.view.content.element.parentElement === this._element) {
|
|
4404
|
+
this._element.removeChild(panel.view.content.element);
|
|
4405
|
+
}
|
|
4406
|
+
container = this.group.renderContainer.attach({
|
|
4407
|
+
panel,
|
|
4408
|
+
referenceContainer: this,
|
|
4409
|
+
});
|
|
4410
|
+
break;
|
|
4411
|
+
}
|
|
4412
|
+
if (doRender) {
|
|
4413
|
+
const focusTracker = trackFocus(container);
|
|
4414
|
+
const disposable = new CompositeDisposable();
|
|
4415
|
+
disposable.addDisposables(focusTracker, focusTracker.onDidFocus(() => this._onDidFocus.fire()), focusTracker.onDidBlur(() => this._onDidBlur.fire()));
|
|
4416
|
+
this.disposable.value = disposable;
|
|
4417
|
+
}
|
|
4819
4418
|
}
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
case 'left':
|
|
4826
|
-
return 'left';
|
|
4827
|
-
case 'right':
|
|
4828
|
-
return 'right';
|
|
4829
|
-
case 'above':
|
|
4830
|
-
return 'top';
|
|
4831
|
-
case 'below':
|
|
4832
|
-
return 'bottom';
|
|
4833
|
-
case 'within':
|
|
4834
|
-
default:
|
|
4835
|
-
return 'center';
|
|
4419
|
+
openPanel(panel) {
|
|
4420
|
+
if (this.panel === panel) {
|
|
4421
|
+
return;
|
|
4422
|
+
}
|
|
4423
|
+
this.renderPanel(panel);
|
|
4836
4424
|
}
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
get id() {
|
|
4840
|
-
return this._id;
|
|
4425
|
+
layout(_width, _height) {
|
|
4426
|
+
// noop
|
|
4841
4427
|
}
|
|
4842
|
-
|
|
4843
|
-
|
|
4428
|
+
closePanel() {
|
|
4429
|
+
var _a;
|
|
4430
|
+
if (this.panel) {
|
|
4431
|
+
if (this.panel.api.renderer === 'onlyWhenVisible') {
|
|
4432
|
+
(_a = this.panel.view.content.element.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.panel.view.content.element);
|
|
4433
|
+
}
|
|
4434
|
+
}
|
|
4435
|
+
this.panel = undefined;
|
|
4844
4436
|
}
|
|
4845
|
-
|
|
4846
|
-
|
|
4437
|
+
dispose() {
|
|
4438
|
+
this.disposable.dispose();
|
|
4439
|
+
super.dispose();
|
|
4847
4440
|
}
|
|
4848
|
-
|
|
4849
|
-
|
|
4441
|
+
}
|
|
4442
|
+
|
|
4443
|
+
class TabDragHandler extends DragHandler {
|
|
4444
|
+
constructor(element, accessor, group, panel) {
|
|
4445
|
+
super(element);
|
|
4446
|
+
this.accessor = accessor;
|
|
4447
|
+
this.group = group;
|
|
4448
|
+
this.panel = panel;
|
|
4449
|
+
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
4850
4450
|
}
|
|
4851
|
-
|
|
4852
|
-
|
|
4451
|
+
getData(event) {
|
|
4452
|
+
this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, this.panel.id)], PanelTransfer.prototype);
|
|
4453
|
+
return {
|
|
4454
|
+
dispose: () => {
|
|
4455
|
+
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
4456
|
+
},
|
|
4457
|
+
};
|
|
4853
4458
|
}
|
|
4854
|
-
|
|
4855
|
-
|
|
4459
|
+
}
|
|
4460
|
+
class Tab extends CompositeDisposable {
|
|
4461
|
+
get element() {
|
|
4462
|
+
return this._element;
|
|
4856
4463
|
}
|
|
4857
|
-
|
|
4858
|
-
|
|
4464
|
+
constructor(panel, accessor, group) {
|
|
4465
|
+
super();
|
|
4466
|
+
this.panel = panel;
|
|
4467
|
+
this.accessor = accessor;
|
|
4468
|
+
this.group = group;
|
|
4469
|
+
this.content = undefined;
|
|
4470
|
+
this._onChanged = new Emitter();
|
|
4471
|
+
this.onChanged = this._onChanged.event;
|
|
4472
|
+
this._onDropped = new Emitter();
|
|
4473
|
+
this.onDrop = this._onDropped.event;
|
|
4474
|
+
this._onDragStart = new Emitter();
|
|
4475
|
+
this.onDragStart = this._onDragStart.event;
|
|
4476
|
+
this._element = document.createElement('div');
|
|
4477
|
+
this._element.className = 'tab';
|
|
4478
|
+
this._element.tabIndex = 0;
|
|
4479
|
+
this._element.draggable = true;
|
|
4480
|
+
toggleClass(this.element, 'inactive-tab', true);
|
|
4481
|
+
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
4482
|
+
this.dropTarget = new Droptarget(this._element, {
|
|
4483
|
+
acceptedTargetZones: ['center'],
|
|
4484
|
+
canDisplayOverlay: (event, position) => {
|
|
4485
|
+
if (this.group.locked) {
|
|
4486
|
+
return false;
|
|
4487
|
+
}
|
|
4488
|
+
const data = getPanelData();
|
|
4489
|
+
if (data && this.accessor.id === data.viewId) {
|
|
4490
|
+
if (data.panelId === null &&
|
|
4491
|
+
data.groupId === this.group.id) {
|
|
4492
|
+
// don't allow group move to drop on self
|
|
4493
|
+
return false;
|
|
4494
|
+
}
|
|
4495
|
+
return this.panel.id !== data.panelId;
|
|
4496
|
+
}
|
|
4497
|
+
return this.group.model.canDisplayOverlay(event, position, 'tab');
|
|
4498
|
+
},
|
|
4499
|
+
});
|
|
4500
|
+
this.onWillShowOverlay = this.dropTarget.onWillShowOverlay;
|
|
4501
|
+
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
4502
|
+
this._onDragStart.fire(event);
|
|
4503
|
+
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
4504
|
+
if (event.defaultPrevented) {
|
|
4505
|
+
return;
|
|
4506
|
+
}
|
|
4507
|
+
this._onChanged.fire(event);
|
|
4508
|
+
}), this.dropTarget.onDrop((event) => {
|
|
4509
|
+
this._onDropped.fire(event);
|
|
4510
|
+
}), this.dropTarget);
|
|
4859
4511
|
}
|
|
4860
|
-
|
|
4861
|
-
|
|
4512
|
+
setActive(isActive) {
|
|
4513
|
+
toggleClass(this.element, 'active-tab', isActive);
|
|
4514
|
+
toggleClass(this.element, 'inactive-tab', !isActive);
|
|
4862
4515
|
}
|
|
4863
|
-
|
|
4864
|
-
|
|
4516
|
+
setContent(part) {
|
|
4517
|
+
if (this.content) {
|
|
4518
|
+
this._element.removeChild(this.content.element);
|
|
4519
|
+
}
|
|
4520
|
+
this.content = part;
|
|
4521
|
+
this._element.appendChild(this.content.element);
|
|
4865
4522
|
}
|
|
4866
|
-
|
|
4867
|
-
|
|
4523
|
+
dispose() {
|
|
4524
|
+
super.dispose();
|
|
4868
4525
|
}
|
|
4869
|
-
|
|
4870
|
-
|
|
4526
|
+
}
|
|
4527
|
+
|
|
4528
|
+
function addGhostImage(dataTransfer, ghostElement) {
|
|
4529
|
+
// class dockview provides to force ghost image to be drawn on a different layer and prevent weird rendering issues
|
|
4530
|
+
addClasses(ghostElement, 'dv-dragged');
|
|
4531
|
+
document.body.appendChild(ghostElement);
|
|
4532
|
+
dataTransfer.setDragImage(ghostElement, 0, 0);
|
|
4533
|
+
setTimeout(() => {
|
|
4534
|
+
removeClasses(ghostElement, 'dv-dragged');
|
|
4535
|
+
ghostElement.remove();
|
|
4536
|
+
}, 0);
|
|
4537
|
+
}
|
|
4538
|
+
|
|
4539
|
+
class GroupDragHandler extends DragHandler {
|
|
4540
|
+
constructor(element, accessor, group) {
|
|
4541
|
+
super(element);
|
|
4542
|
+
this.accessor = accessor;
|
|
4543
|
+
this.group = group;
|
|
4544
|
+
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
4545
|
+
this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
|
|
4546
|
+
if (e.shiftKey) {
|
|
4547
|
+
/**
|
|
4548
|
+
* You cannot call e.preventDefault() because that will prevent drag events from firing
|
|
4549
|
+
* but we also need to stop any group overlay drag events from occuring
|
|
4550
|
+
* Use a custom event marker that can be checked by the overlay drag events
|
|
4551
|
+
*/
|
|
4552
|
+
quasiPreventDefault(e);
|
|
4553
|
+
}
|
|
4554
|
+
}, true));
|
|
4871
4555
|
}
|
|
4872
|
-
|
|
4873
|
-
this.
|
|
4556
|
+
isCancelled(_event) {
|
|
4557
|
+
if (this.group.api.location.type === 'floating' && !_event.shiftKey) {
|
|
4558
|
+
return true;
|
|
4559
|
+
}
|
|
4560
|
+
return false;
|
|
4874
4561
|
}
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
this.
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
}
|
|
4899
|
-
this._bufferOnDidLayoutChange.fire();
|
|
4900
|
-
}), exports.DockviewEvent.any(this.onDidAdd, this.onDidRemove, this.onDidActiveChange)(() => {
|
|
4901
|
-
this._bufferOnDidLayoutChange.fire();
|
|
4902
|
-
}), this._bufferOnDidLayoutChange.onEvent(() => {
|
|
4903
|
-
this._onDidLayoutChange.fire();
|
|
4904
|
-
}), this._bufferOnDidLayoutChange);
|
|
4562
|
+
getData(dragEvent) {
|
|
4563
|
+
const dataTransfer = dragEvent.dataTransfer;
|
|
4564
|
+
this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, null)], PanelTransfer.prototype);
|
|
4565
|
+
const style = window.getComputedStyle(this.el);
|
|
4566
|
+
const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
|
|
4567
|
+
const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
|
|
4568
|
+
if (dataTransfer) {
|
|
4569
|
+
const ghostElement = document.createElement('div');
|
|
4570
|
+
ghostElement.style.backgroundColor = bgColor;
|
|
4571
|
+
ghostElement.style.color = color;
|
|
4572
|
+
ghostElement.style.padding = '2px 8px';
|
|
4573
|
+
ghostElement.style.height = '24px';
|
|
4574
|
+
ghostElement.style.fontSize = '11px';
|
|
4575
|
+
ghostElement.style.lineHeight = '20px';
|
|
4576
|
+
ghostElement.style.borderRadius = '12px';
|
|
4577
|
+
ghostElement.style.position = 'absolute';
|
|
4578
|
+
ghostElement.textContent = `Multiple Panels (${this.group.size})`;
|
|
4579
|
+
addGhostImage(dataTransfer, ghostElement);
|
|
4580
|
+
}
|
|
4581
|
+
return {
|
|
4582
|
+
dispose: () => {
|
|
4583
|
+
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
4584
|
+
},
|
|
4585
|
+
};
|
|
4905
4586
|
}
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4587
|
+
}
|
|
4588
|
+
|
|
4589
|
+
class VoidContainer extends CompositeDisposable {
|
|
4590
|
+
get element() {
|
|
4591
|
+
return this._element;
|
|
4909
4592
|
}
|
|
4910
|
-
|
|
4911
|
-
|
|
4593
|
+
constructor(accessor, group) {
|
|
4594
|
+
super();
|
|
4595
|
+
this.accessor = accessor;
|
|
4596
|
+
this.group = group;
|
|
4597
|
+
this._onDrop = new Emitter();
|
|
4598
|
+
this.onDrop = this._onDrop.event;
|
|
4599
|
+
this._onDragStart = new Emitter();
|
|
4600
|
+
this.onDragStart = this._onDragStart.event;
|
|
4601
|
+
this._element = document.createElement('div');
|
|
4602
|
+
this._element.className = 'void-container';
|
|
4603
|
+
this._element.tabIndex = 0;
|
|
4604
|
+
this._element.draggable = true;
|
|
4605
|
+
this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'click', () => {
|
|
4606
|
+
this.accessor.doSetGroupActive(this.group);
|
|
4607
|
+
}));
|
|
4608
|
+
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
4609
|
+
this.dropTraget = new Droptarget(this._element, {
|
|
4610
|
+
acceptedTargetZones: ['center'],
|
|
4611
|
+
canDisplayOverlay: (event, position) => {
|
|
4612
|
+
var _a;
|
|
4613
|
+
const data = getPanelData();
|
|
4614
|
+
if (data && this.accessor.id === data.viewId) {
|
|
4615
|
+
if (data.panelId === null &&
|
|
4616
|
+
data.groupId === this.group.id) {
|
|
4617
|
+
// don't allow group move to drop on self
|
|
4618
|
+
return false;
|
|
4619
|
+
}
|
|
4620
|
+
// don't show the overlay if the tab being dragged is the last panel of this group
|
|
4621
|
+
return ((_a = last(this.group.panels)) === null || _a === void 0 ? void 0 : _a.id) !== data.panelId;
|
|
4622
|
+
}
|
|
4623
|
+
return group.model.canDisplayOverlay(event, position, 'header_space');
|
|
4624
|
+
},
|
|
4625
|
+
});
|
|
4626
|
+
this.onWillShowOverlay = this.dropTraget.onWillShowOverlay;
|
|
4627
|
+
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
4628
|
+
this._onDragStart.fire(event);
|
|
4629
|
+
}), this.dropTraget.onDrop((event) => {
|
|
4630
|
+
this._onDrop.fire(event);
|
|
4631
|
+
}), this.dropTraget);
|
|
4912
4632
|
}
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4635
|
+
class TabsContainer extends CompositeDisposable {
|
|
4636
|
+
get panels() {
|
|
4637
|
+
return this.tabs.map((_) => _.value.panel.id);
|
|
4916
4638
|
}
|
|
4917
|
-
|
|
4918
|
-
return this.
|
|
4639
|
+
get size() {
|
|
4640
|
+
return this.tabs.length;
|
|
4919
4641
|
}
|
|
4920
|
-
|
|
4921
|
-
this.
|
|
4642
|
+
get hidden() {
|
|
4643
|
+
return this._hidden;
|
|
4922
4644
|
}
|
|
4923
|
-
|
|
4924
|
-
|
|
4645
|
+
set hidden(value) {
|
|
4646
|
+
this._hidden = value;
|
|
4647
|
+
this.element.style.display = value ? 'none' : '';
|
|
4925
4648
|
}
|
|
4926
|
-
|
|
4927
|
-
|
|
4649
|
+
show() {
|
|
4650
|
+
if (!this.hidden) {
|
|
4651
|
+
this.element.style.display = '';
|
|
4652
|
+
}
|
|
4928
4653
|
}
|
|
4929
|
-
|
|
4930
|
-
this.
|
|
4931
|
-
this._onDidAdd.fire(group);
|
|
4654
|
+
hide() {
|
|
4655
|
+
this._element.style.display = 'none';
|
|
4932
4656
|
}
|
|
4933
|
-
|
|
4934
|
-
if (
|
|
4935
|
-
|
|
4657
|
+
setRightActionsElement(element) {
|
|
4658
|
+
if (this.rightActions === element) {
|
|
4659
|
+
return;
|
|
4936
4660
|
}
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
item.disposable.dispose();
|
|
4941
|
-
item.value.dispose();
|
|
4942
|
-
this._groups.delete(group.id);
|
|
4943
|
-
this._onDidRemove.fire(group);
|
|
4661
|
+
if (this.rightActions) {
|
|
4662
|
+
this.rightActions.remove();
|
|
4663
|
+
this.rightActions = undefined;
|
|
4944
4664
|
}
|
|
4945
|
-
if (
|
|
4946
|
-
|
|
4947
|
-
this.
|
|
4665
|
+
if (element) {
|
|
4666
|
+
this.rightActionsContainer.appendChild(element);
|
|
4667
|
+
this.rightActions = element;
|
|
4948
4668
|
}
|
|
4949
|
-
return view;
|
|
4950
4669
|
}
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4670
|
+
setLeftActionsElement(element) {
|
|
4671
|
+
if (this.leftActions === element) {
|
|
4672
|
+
return;
|
|
4673
|
+
}
|
|
4674
|
+
if (this.leftActions) {
|
|
4675
|
+
this.leftActions.remove();
|
|
4676
|
+
this.leftActions = undefined;
|
|
4677
|
+
}
|
|
4678
|
+
if (element) {
|
|
4679
|
+
this.leftActionsContainer.appendChild(element);
|
|
4680
|
+
this.leftActions = element;
|
|
4681
|
+
}
|
|
4954
4682
|
}
|
|
4955
|
-
|
|
4956
|
-
if (this.
|
|
4683
|
+
setPrefixActionsElement(element) {
|
|
4684
|
+
if (this.preActions === element) {
|
|
4957
4685
|
return;
|
|
4958
4686
|
}
|
|
4959
|
-
if (this.
|
|
4960
|
-
this.
|
|
4687
|
+
if (this.preActions) {
|
|
4688
|
+
this.preActions.remove();
|
|
4689
|
+
this.preActions = undefined;
|
|
4961
4690
|
}
|
|
4962
|
-
if (
|
|
4963
|
-
|
|
4691
|
+
if (element) {
|
|
4692
|
+
this.preActionsContainer.appendChild(element);
|
|
4693
|
+
this.preActions = element;
|
|
4964
4694
|
}
|
|
4965
|
-
this._activeGroup = group;
|
|
4966
|
-
this._onDidActiveChange.fire(group);
|
|
4967
4695
|
}
|
|
4968
|
-
|
|
4969
|
-
this.
|
|
4696
|
+
get element() {
|
|
4697
|
+
return this._element;
|
|
4970
4698
|
}
|
|
4971
|
-
|
|
4699
|
+
isActive(tab) {
|
|
4700
|
+
return (this.selectedIndex > -1 &&
|
|
4701
|
+
this.tabs[this.selectedIndex].value === tab);
|
|
4702
|
+
}
|
|
4703
|
+
indexOf(id) {
|
|
4704
|
+
return this.tabs.findIndex((tab) => tab.value.panel.id === id);
|
|
4705
|
+
}
|
|
4706
|
+
constructor(accessor, group) {
|
|
4707
|
+
super();
|
|
4708
|
+
this.accessor = accessor;
|
|
4709
|
+
this.group = group;
|
|
4710
|
+
this.tabs = [];
|
|
4711
|
+
this.selectedIndex = -1;
|
|
4712
|
+
this._hidden = false;
|
|
4713
|
+
this._onDrop = new Emitter();
|
|
4714
|
+
this.onDrop = this._onDrop.event;
|
|
4715
|
+
this._onTabDragStart = new Emitter();
|
|
4716
|
+
this.onTabDragStart = this._onTabDragStart.event;
|
|
4717
|
+
this._onGroupDragStart = new Emitter();
|
|
4718
|
+
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
4719
|
+
this._onWillShowOverlay = new Emitter();
|
|
4720
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
4721
|
+
this._element = document.createElement('div');
|
|
4722
|
+
this._element.className = 'tabs-and-actions-container';
|
|
4723
|
+
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
4724
|
+
this.rightActionsContainer = document.createElement('div');
|
|
4725
|
+
this.rightActionsContainer.className = 'right-actions-container';
|
|
4726
|
+
this.leftActionsContainer = document.createElement('div');
|
|
4727
|
+
this.leftActionsContainer.className = 'left-actions-container';
|
|
4728
|
+
this.preActionsContainer = document.createElement('div');
|
|
4729
|
+
this.preActionsContainer.className = 'pre-actions-container';
|
|
4730
|
+
this.tabContainer = document.createElement('div');
|
|
4731
|
+
this.tabContainer.className = 'tabs-container';
|
|
4732
|
+
this.voidContainer = new VoidContainer(this.accessor, this.group);
|
|
4733
|
+
this._element.appendChild(this.preActionsContainer);
|
|
4734
|
+
this._element.appendChild(this.tabContainer);
|
|
4735
|
+
this._element.appendChild(this.leftActionsContainer);
|
|
4736
|
+
this._element.appendChild(this.voidContainer.element);
|
|
4737
|
+
this._element.appendChild(this.rightActionsContainer);
|
|
4738
|
+
this.addDisposables(this.accessor.onDidAddPanel((e) => {
|
|
4739
|
+
if (e.api.group === this.group) {
|
|
4740
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
4741
|
+
}
|
|
4742
|
+
}), this.accessor.onDidRemovePanel((e) => {
|
|
4743
|
+
if (e.api.group === this.group) {
|
|
4744
|
+
toggleClass(this._element, 'dv-single-tab', this.size === 1);
|
|
4745
|
+
}
|
|
4746
|
+
}), this._onWillShowOverlay, this._onDrop, this._onTabDragStart, this._onGroupDragStart, this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
4747
|
+
this._onGroupDragStart.fire({
|
|
4748
|
+
nativeEvent: event,
|
|
4749
|
+
group: this.group,
|
|
4750
|
+
});
|
|
4751
|
+
}), this.voidContainer.onDrop((event) => {
|
|
4752
|
+
this._onDrop.fire({
|
|
4753
|
+
event: event.nativeEvent,
|
|
4754
|
+
index: this.tabs.length,
|
|
4755
|
+
});
|
|
4756
|
+
}), this.voidContainer.onWillShowOverlay((event) => {
|
|
4757
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4758
|
+
kind: 'header_space',
|
|
4759
|
+
panel: this.group.activePanel,
|
|
4760
|
+
api: this.accessor.api,
|
|
4761
|
+
group: this.group,
|
|
4762
|
+
getData: getPanelData,
|
|
4763
|
+
}));
|
|
4764
|
+
}), addDisposableListener(this.voidContainer.element, 'mousedown', (event) => {
|
|
4765
|
+
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
4766
|
+
if (isFloatingGroupsEnabled &&
|
|
4767
|
+
event.shiftKey &&
|
|
4768
|
+
this.group.api.location.type !== 'floating') {
|
|
4769
|
+
event.preventDefault();
|
|
4770
|
+
const { top, left } = this.element.getBoundingClientRect();
|
|
4771
|
+
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
4772
|
+
this.accessor.addFloatingGroup(this.group, {
|
|
4773
|
+
x: left - rootLeft + 20,
|
|
4774
|
+
y: top - rootTop + 20,
|
|
4775
|
+
}, { inDragMode: true });
|
|
4776
|
+
}
|
|
4777
|
+
}), addDisposableListener(this.tabContainer, 'mousedown', (event) => {
|
|
4778
|
+
if (event.defaultPrevented) {
|
|
4779
|
+
return;
|
|
4780
|
+
}
|
|
4781
|
+
const isLeftClick = event.button === 0;
|
|
4782
|
+
if (isLeftClick) {
|
|
4783
|
+
this.accessor.doSetGroupActive(this.group);
|
|
4784
|
+
}
|
|
4785
|
+
}));
|
|
4786
|
+
}
|
|
4787
|
+
setActive(_isGroupActive) {
|
|
4788
|
+
// noop
|
|
4789
|
+
}
|
|
4790
|
+
addTab(tab, index = this.tabs.length) {
|
|
4791
|
+
if (index < 0 || index > this.tabs.length) {
|
|
4792
|
+
throw new Error('invalid location');
|
|
4793
|
+
}
|
|
4794
|
+
this.tabContainer.insertBefore(tab.value.element, this.tabContainer.children[index]);
|
|
4795
|
+
this.tabs = [
|
|
4796
|
+
...this.tabs.slice(0, index),
|
|
4797
|
+
tab,
|
|
4798
|
+
...this.tabs.slice(index),
|
|
4799
|
+
];
|
|
4800
|
+
if (this.selectedIndex < 0) {
|
|
4801
|
+
this.selectedIndex = index;
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
delete(id) {
|
|
4805
|
+
const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
|
|
4806
|
+
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
4807
|
+
const { value, disposable } = tabToRemove;
|
|
4808
|
+
disposable.dispose();
|
|
4809
|
+
value.dispose();
|
|
4810
|
+
value.element.remove();
|
|
4811
|
+
}
|
|
4812
|
+
setActivePanel(panel) {
|
|
4813
|
+
this.tabs.forEach((tab) => {
|
|
4814
|
+
const isActivePanel = panel.id === tab.value.panel.id;
|
|
4815
|
+
tab.value.setActive(isActivePanel);
|
|
4816
|
+
});
|
|
4817
|
+
}
|
|
4818
|
+
openPanel(panel, index = this.tabs.length) {
|
|
4972
4819
|
var _a;
|
|
4973
|
-
if (
|
|
4974
|
-
|
|
4820
|
+
if (this.tabs.find((tab) => tab.value.panel.id === panel.id)) {
|
|
4821
|
+
return;
|
|
4975
4822
|
}
|
|
4976
|
-
|
|
4977
|
-
|
|
4823
|
+
const tab = new Tab(panel, this.accessor, this.group);
|
|
4824
|
+
if (!((_a = panel.view) === null || _a === void 0 ? void 0 : _a.tab)) {
|
|
4825
|
+
throw new Error('invalid header component');
|
|
4826
|
+
}
|
|
4827
|
+
tab.setContent(panel.view.tab);
|
|
4828
|
+
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
4829
|
+
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
4830
|
+
}), tab.onChanged((event) => {
|
|
4831
|
+
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
4832
|
+
const isFloatingWithOnePanel = this.group.api.location.type === 'floating' &&
|
|
4833
|
+
this.size === 1;
|
|
4834
|
+
if (isFloatingGroupsEnabled &&
|
|
4835
|
+
!isFloatingWithOnePanel &&
|
|
4836
|
+
event.shiftKey) {
|
|
4837
|
+
event.preventDefault();
|
|
4838
|
+
const panel = this.accessor.getGroupPanel(tab.panel.id);
|
|
4839
|
+
const { top, left } = tab.element.getBoundingClientRect();
|
|
4840
|
+
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
4841
|
+
this.accessor.addFloatingGroup(panel, {
|
|
4842
|
+
x: left - rootLeft,
|
|
4843
|
+
y: top - rootTop,
|
|
4844
|
+
}, { inDragMode: true });
|
|
4978
4845
|
return;
|
|
4979
4846
|
}
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
const location = getGridLocation(options.group.element);
|
|
4983
|
-
const next = (_a = this.gridview.next(location)) === null || _a === void 0 ? void 0 : _a.view;
|
|
4984
|
-
this.doSetGroupActive(next);
|
|
4985
|
-
}
|
|
4986
|
-
moveToPrevious(options) {
|
|
4987
|
-
var _a;
|
|
4988
|
-
if (!options) {
|
|
4989
|
-
options = {};
|
|
4990
|
-
}
|
|
4991
|
-
if (!options.group) {
|
|
4992
|
-
if (!this.activeGroup) {
|
|
4847
|
+
const isLeftClick = event.button === 0;
|
|
4848
|
+
if (!isLeftClick || event.defaultPrevented) {
|
|
4993
4849
|
return;
|
|
4994
4850
|
}
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
4851
|
+
if (this.group.activePanel !== panel) {
|
|
4852
|
+
this.group.model.openPanel(panel);
|
|
4853
|
+
}
|
|
4854
|
+
}), tab.onDrop((event) => {
|
|
4855
|
+
this._onDrop.fire({
|
|
4856
|
+
event: event.nativeEvent,
|
|
4857
|
+
index: this.tabs.findIndex((x) => x.value === tab),
|
|
4858
|
+
});
|
|
4859
|
+
}), tab.onWillShowOverlay((event) => {
|
|
4860
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
4861
|
+
kind: 'tab',
|
|
4862
|
+
panel: this.group.activePanel,
|
|
4863
|
+
api: this.accessor.api,
|
|
4864
|
+
group: this.group,
|
|
4865
|
+
getData: getPanelData,
|
|
4866
|
+
}));
|
|
4867
|
+
}));
|
|
4868
|
+
const value = { value: tab, disposable };
|
|
4869
|
+
this.addTab(value, index);
|
|
5000
4870
|
}
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
if (!different) {
|
|
5004
|
-
return;
|
|
5005
|
-
}
|
|
5006
|
-
this.gridview.element.style.height = `${height}px`;
|
|
5007
|
-
this.gridview.element.style.width = `${width}px`;
|
|
5008
|
-
this.gridview.layout(width, height);
|
|
4871
|
+
closePanel(panel) {
|
|
4872
|
+
this.delete(panel.id);
|
|
5009
4873
|
}
|
|
5010
4874
|
dispose() {
|
|
5011
|
-
this._onDidActiveChange.dispose();
|
|
5012
|
-
this._onDidAdd.dispose();
|
|
5013
|
-
this._onDidRemove.dispose();
|
|
5014
|
-
this._onDidLayoutChange.dispose();
|
|
5015
|
-
for (const group of this.groups) {
|
|
5016
|
-
group.dispose();
|
|
5017
|
-
}
|
|
5018
|
-
this.gridview.dispose();
|
|
5019
4875
|
super.dispose();
|
|
4876
|
+
for (const { value, disposable } of this.tabs) {
|
|
4877
|
+
disposable.dispose();
|
|
4878
|
+
value.dispose();
|
|
4879
|
+
}
|
|
4880
|
+
this.tabs = [];
|
|
5020
4881
|
}
|
|
5021
4882
|
}
|
|
5022
4883
|
|
|
5023
|
-
class
|
|
5024
|
-
|
|
5025
|
-
|
|
4884
|
+
class DockviewUnhandledDragOverEvent {
|
|
4885
|
+
get isAccepted() {
|
|
4886
|
+
return this._isAccepted;
|
|
4887
|
+
}
|
|
4888
|
+
constructor(nativeEvent, target, position, getData, group) {
|
|
4889
|
+
this.nativeEvent = nativeEvent;
|
|
4890
|
+
this.target = target;
|
|
4891
|
+
this.position = position;
|
|
4892
|
+
this.getData = getData;
|
|
4893
|
+
this.group = group;
|
|
4894
|
+
this._isAccepted = false;
|
|
4895
|
+
}
|
|
4896
|
+
accept() {
|
|
4897
|
+
this._isAccepted = true;
|
|
5026
4898
|
}
|
|
5027
4899
|
}
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
4900
|
+
const PROPERTY_KEYS = (() => {
|
|
4901
|
+
/**
|
|
4902
|
+
* by readong the keys from an empty value object TypeScript will error
|
|
4903
|
+
* when we add or remove new properties to `DockviewOptions`
|
|
4904
|
+
*/
|
|
4905
|
+
const properties = {
|
|
4906
|
+
disableAutoResizing: undefined,
|
|
4907
|
+
hideBorders: undefined,
|
|
4908
|
+
singleTabMode: undefined,
|
|
4909
|
+
disableFloatingGroups: undefined,
|
|
4910
|
+
floatingGroupBounds: undefined,
|
|
4911
|
+
popoutUrl: undefined,
|
|
4912
|
+
defaultRenderer: undefined,
|
|
4913
|
+
debug: undefined,
|
|
4914
|
+
rootOverlayModel: undefined,
|
|
4915
|
+
locked: undefined,
|
|
4916
|
+
disableDnd: undefined,
|
|
4917
|
+
};
|
|
4918
|
+
return Object.keys(properties);
|
|
4919
|
+
})();
|
|
4920
|
+
function isPanelOptionsWithPanel(data) {
|
|
4921
|
+
if (data.referencePanel) {
|
|
4922
|
+
return true;
|
|
5034
4923
|
}
|
|
5035
|
-
|
|
5036
|
-
|
|
4924
|
+
return false;
|
|
4925
|
+
}
|
|
4926
|
+
function isPanelOptionsWithGroup(data) {
|
|
4927
|
+
if (data.referenceGroup) {
|
|
4928
|
+
return true;
|
|
5037
4929
|
}
|
|
5038
|
-
|
|
5039
|
-
|
|
4930
|
+
return false;
|
|
4931
|
+
}
|
|
4932
|
+
function isGroupOptionsWithPanel(data) {
|
|
4933
|
+
if (data.referencePanel) {
|
|
4934
|
+
return true;
|
|
5040
4935
|
}
|
|
5041
|
-
|
|
5042
|
-
|
|
4936
|
+
return false;
|
|
4937
|
+
}
|
|
4938
|
+
function isGroupOptionsWithGroup(data) {
|
|
4939
|
+
if (data.referenceGroup) {
|
|
4940
|
+
return true;
|
|
5043
4941
|
}
|
|
5044
|
-
|
|
5045
|
-
|
|
4942
|
+
return false;
|
|
4943
|
+
}
|
|
4944
|
+
|
|
4945
|
+
class DockviewDidDropEvent extends DockviewEvent {
|
|
4946
|
+
get nativeEvent() {
|
|
4947
|
+
return this.options.nativeEvent;
|
|
5046
4948
|
}
|
|
5047
|
-
|
|
4949
|
+
get position() {
|
|
4950
|
+
return this.options.position;
|
|
4951
|
+
}
|
|
4952
|
+
get panel() {
|
|
4953
|
+
return this.options.panel;
|
|
4954
|
+
}
|
|
4955
|
+
get group() {
|
|
4956
|
+
return this.options.group;
|
|
4957
|
+
}
|
|
4958
|
+
get api() {
|
|
4959
|
+
return this.options.api;
|
|
4960
|
+
}
|
|
4961
|
+
constructor(options) {
|
|
5048
4962
|
super();
|
|
5049
|
-
this.
|
|
5050
|
-
this.component = component;
|
|
5051
|
-
this._isFocused = false;
|
|
5052
|
-
this._isActive = false;
|
|
5053
|
-
this._isVisible = true;
|
|
5054
|
-
this._width = 0;
|
|
5055
|
-
this._height = 0;
|
|
5056
|
-
this._parameters = {};
|
|
5057
|
-
this.panelUpdatesDisposable = new MutableDisposable();
|
|
5058
|
-
this._onDidDimensionChange = new Emitter();
|
|
5059
|
-
this.onDidDimensionsChange = this._onDidDimensionChange.event;
|
|
5060
|
-
this._onDidChangeFocus = new Emitter();
|
|
5061
|
-
this.onDidFocusChange = this._onDidChangeFocus.event;
|
|
5062
|
-
//
|
|
5063
|
-
this._onWillFocus = new Emitter();
|
|
5064
|
-
this.onWillFocus = this._onWillFocus.event;
|
|
5065
|
-
//
|
|
5066
|
-
this._onDidVisibilityChange = new Emitter();
|
|
5067
|
-
this.onDidVisibilityChange = this._onDidVisibilityChange.event;
|
|
5068
|
-
this._onWillVisibilityChange = new Emitter();
|
|
5069
|
-
this.onWillVisibilityChange = this._onWillVisibilityChange.event;
|
|
5070
|
-
this._onDidActiveChange = new Emitter();
|
|
5071
|
-
this.onDidActiveChange = this._onDidActiveChange.event;
|
|
5072
|
-
this._onActiveChange = new Emitter();
|
|
5073
|
-
this.onActiveChange = this._onActiveChange.event;
|
|
5074
|
-
this._onDidParametersChange = new Emitter();
|
|
5075
|
-
this.onDidParametersChange = this._onDidParametersChange.event;
|
|
5076
|
-
this.addDisposables(this.onDidFocusChange((event) => {
|
|
5077
|
-
this._isFocused = event.isFocused;
|
|
5078
|
-
}), this.onDidActiveChange((event) => {
|
|
5079
|
-
this._isActive = event.isActive;
|
|
5080
|
-
}), this.onDidVisibilityChange((event) => {
|
|
5081
|
-
this._isVisible = event.isVisible;
|
|
5082
|
-
}), this.onDidDimensionsChange((event) => {
|
|
5083
|
-
this._width = event.width;
|
|
5084
|
-
this._height = event.height;
|
|
5085
|
-
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onWillFocus, this._onWillVisibilityChange, this._onDidParametersChange);
|
|
4963
|
+
this.options = options;
|
|
5086
4964
|
}
|
|
5087
|
-
|
|
5088
|
-
return this.
|
|
4965
|
+
getData() {
|
|
4966
|
+
return this.options.getData();
|
|
5089
4967
|
}
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
params: parameters,
|
|
5095
|
-
});
|
|
5096
|
-
});
|
|
4968
|
+
}
|
|
4969
|
+
class DockviewWillDropEvent extends DockviewDidDropEvent {
|
|
4970
|
+
get kind() {
|
|
4971
|
+
return this._kind;
|
|
5097
4972
|
}
|
|
5098
|
-
|
|
5099
|
-
|
|
4973
|
+
constructor(options) {
|
|
4974
|
+
super(options);
|
|
4975
|
+
this._kind = options.kind;
|
|
5100
4976
|
}
|
|
5101
|
-
|
|
5102
|
-
|
|
4977
|
+
}
|
|
4978
|
+
class WillShowOverlayLocationEvent {
|
|
4979
|
+
get kind() {
|
|
4980
|
+
return this.options.kind;
|
|
5103
4981
|
}
|
|
5104
|
-
|
|
5105
|
-
this.
|
|
4982
|
+
get nativeEvent() {
|
|
4983
|
+
return this.event.nativeEvent;
|
|
4984
|
+
}
|
|
4985
|
+
get position() {
|
|
4986
|
+
return this.event.position;
|
|
4987
|
+
}
|
|
4988
|
+
get defaultPrevented() {
|
|
4989
|
+
return this.event.defaultPrevented;
|
|
4990
|
+
}
|
|
4991
|
+
get panel() {
|
|
4992
|
+
return this.options.panel;
|
|
4993
|
+
}
|
|
4994
|
+
get api() {
|
|
4995
|
+
return this.options.api;
|
|
4996
|
+
}
|
|
4997
|
+
get group() {
|
|
4998
|
+
return this.options.group;
|
|
4999
|
+
}
|
|
5000
|
+
preventDefault() {
|
|
5001
|
+
this.event.preventDefault();
|
|
5002
|
+
}
|
|
5003
|
+
getData() {
|
|
5004
|
+
return this.options.getData();
|
|
5005
|
+
}
|
|
5006
|
+
constructor(event, options) {
|
|
5007
|
+
this.event = event;
|
|
5008
|
+
this.options = options;
|
|
5106
5009
|
}
|
|
5107
5010
|
}
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
constructor(id, component) {
|
|
5112
|
-
super(id, component);
|
|
5113
|
-
this._onDidConstraintsChangeInternal = new Emitter();
|
|
5114
|
-
this.onDidConstraintsChangeInternal = this._onDidConstraintsChangeInternal.event;
|
|
5115
|
-
//
|
|
5116
|
-
this._onDidConstraintsChange = new Emitter({
|
|
5117
|
-
replay: true,
|
|
5118
|
-
});
|
|
5119
|
-
this.onDidConstraintsChange = this._onDidConstraintsChange.event;
|
|
5120
|
-
//
|
|
5121
|
-
this._onDidSizeChange = new Emitter();
|
|
5122
|
-
this.onDidSizeChange = this._onDidSizeChange.event;
|
|
5123
|
-
this.addDisposables(this._onDidConstraintsChangeInternal, this._onDidConstraintsChange, this._onDidSizeChange);
|
|
5011
|
+
class DockviewGroupPanelModel extends CompositeDisposable {
|
|
5012
|
+
get element() {
|
|
5013
|
+
throw new Error('not supported');
|
|
5124
5014
|
}
|
|
5125
|
-
|
|
5126
|
-
this.
|
|
5015
|
+
get activePanel() {
|
|
5016
|
+
return this._activePanel;
|
|
5017
|
+
}
|
|
5018
|
+
get locked() {
|
|
5019
|
+
return this._locked;
|
|
5020
|
+
}
|
|
5021
|
+
set locked(value) {
|
|
5022
|
+
this._locked = value;
|
|
5023
|
+
toggleClass(this.container, 'locked-groupview', value === 'no-drop-target' || value);
|
|
5024
|
+
}
|
|
5025
|
+
get isActive() {
|
|
5026
|
+
return this._isGroupActive;
|
|
5127
5027
|
}
|
|
5128
|
-
|
|
5129
|
-
this.
|
|
5028
|
+
get panels() {
|
|
5029
|
+
return this._panels;
|
|
5130
5030
|
}
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
class PaneviewPanelApiImpl extends SplitviewPanelApiImpl {
|
|
5134
|
-
set pane(pane) {
|
|
5135
|
-
this._pane = pane;
|
|
5031
|
+
get size() {
|
|
5032
|
+
return this._panels.length;
|
|
5136
5033
|
}
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
this._onDidExpansionChange = new Emitter({
|
|
5140
|
-
replay: true,
|
|
5141
|
-
});
|
|
5142
|
-
this.onDidExpansionChange = this._onDidExpansionChange.event;
|
|
5143
|
-
this._onMouseEnter = new Emitter({});
|
|
5144
|
-
this.onMouseEnter = this._onMouseEnter.event;
|
|
5145
|
-
this._onMouseLeave = new Emitter({});
|
|
5146
|
-
this.onMouseLeave = this._onMouseLeave.event;
|
|
5147
|
-
this.addDisposables(this._onDidExpansionChange, this._onMouseEnter, this._onMouseLeave);
|
|
5034
|
+
get isEmpty() {
|
|
5035
|
+
return this._panels.length === 0;
|
|
5148
5036
|
}
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
(_a = this._pane) === null || _a === void 0 ? void 0 : _a.setExpanded(isExpanded);
|
|
5037
|
+
get hasWatermark() {
|
|
5038
|
+
return !!(this.watermark && this.container.contains(this.watermark.element));
|
|
5152
5039
|
}
|
|
5153
|
-
get
|
|
5154
|
-
|
|
5155
|
-
return !!((_a = this._pane) === null || _a === void 0 ? void 0 : _a.isExpanded());
|
|
5040
|
+
get header() {
|
|
5041
|
+
return this.tabsContainer;
|
|
5156
5042
|
}
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
return this.
|
|
5043
|
+
get isContentFocused() {
|
|
5044
|
+
if (!document.activeElement) {
|
|
5045
|
+
return false;
|
|
5046
|
+
}
|
|
5047
|
+
return isAncestor(document.activeElement, this.contentContainer.element);
|
|
5162
5048
|
}
|
|
5163
|
-
get
|
|
5164
|
-
return this.
|
|
5049
|
+
get location() {
|
|
5050
|
+
return this._location;
|
|
5165
5051
|
}
|
|
5166
|
-
|
|
5167
|
-
|
|
5052
|
+
set location(value) {
|
|
5053
|
+
this._location = value;
|
|
5054
|
+
toggleClass(this.container, 'dv-groupview-floating', false);
|
|
5055
|
+
toggleClass(this.container, 'dv-groupview-popout', false);
|
|
5056
|
+
switch (value.type) {
|
|
5057
|
+
case 'grid':
|
|
5058
|
+
this.contentContainer.dropTarget.setTargetZones([
|
|
5059
|
+
'top',
|
|
5060
|
+
'bottom',
|
|
5061
|
+
'left',
|
|
5062
|
+
'right',
|
|
5063
|
+
'center',
|
|
5064
|
+
]);
|
|
5065
|
+
break;
|
|
5066
|
+
case 'floating':
|
|
5067
|
+
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
5068
|
+
this.contentContainer.dropTarget.setTargetZones(value
|
|
5069
|
+
? ['center']
|
|
5070
|
+
: ['top', 'bottom', 'left', 'right', 'center']);
|
|
5071
|
+
toggleClass(this.container, 'dv-groupview-floating', true);
|
|
5072
|
+
break;
|
|
5073
|
+
case 'popout':
|
|
5074
|
+
this.contentContainer.dropTarget.setTargetZones(['center']);
|
|
5075
|
+
toggleClass(this.container, 'dv-groupview-popout', true);
|
|
5076
|
+
break;
|
|
5077
|
+
}
|
|
5078
|
+
this.groupPanel.api._onDidLocationChange.fire({
|
|
5079
|
+
location: this.location,
|
|
5080
|
+
});
|
|
5168
5081
|
}
|
|
5169
|
-
|
|
5082
|
+
constructor(container, accessor, id, options, groupPanel) {
|
|
5170
5083
|
var _a;
|
|
5171
|
-
return (_a = this._params) === null || _a === void 0 ? void 0 : _a.params;
|
|
5172
|
-
}
|
|
5173
|
-
constructor(id, component, api) {
|
|
5174
5084
|
super();
|
|
5085
|
+
this.container = container;
|
|
5086
|
+
this.accessor = accessor;
|
|
5175
5087
|
this.id = id;
|
|
5176
|
-
this.
|
|
5177
|
-
this.
|
|
5178
|
-
this.
|
|
5088
|
+
this.options = options;
|
|
5089
|
+
this.groupPanel = groupPanel;
|
|
5090
|
+
this._isGroupActive = false;
|
|
5091
|
+
this._locked = false;
|
|
5092
|
+
this._location = { type: 'grid' };
|
|
5093
|
+
this.mostRecentlyUsed = [];
|
|
5094
|
+
this._onDidChange = new Emitter();
|
|
5095
|
+
this.onDidChange = this._onDidChange.event;
|
|
5179
5096
|
this._width = 0;
|
|
5180
|
-
this.
|
|
5181
|
-
this.
|
|
5182
|
-
this.
|
|
5183
|
-
this.
|
|
5184
|
-
this.
|
|
5185
|
-
this.
|
|
5186
|
-
|
|
5187
|
-
this.
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5097
|
+
this._height = 0;
|
|
5098
|
+
this._panels = [];
|
|
5099
|
+
this._panelDisposables = new Map();
|
|
5100
|
+
this._onMove = new Emitter();
|
|
5101
|
+
this.onMove = this._onMove.event;
|
|
5102
|
+
this._onDidDrop = new Emitter();
|
|
5103
|
+
this.onDidDrop = this._onDidDrop.event;
|
|
5104
|
+
this._onWillDrop = new Emitter();
|
|
5105
|
+
this.onWillDrop = this._onWillDrop.event;
|
|
5106
|
+
this._onWillShowOverlay = new Emitter();
|
|
5107
|
+
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
5108
|
+
this._onTabDragStart = new Emitter();
|
|
5109
|
+
this.onTabDragStart = this._onTabDragStart.event;
|
|
5110
|
+
this._onGroupDragStart = new Emitter();
|
|
5111
|
+
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
5112
|
+
this._onDidAddPanel = new Emitter();
|
|
5113
|
+
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
5114
|
+
this._onDidPanelTitleChange = new Emitter();
|
|
5115
|
+
this.onDidPanelTitleChange = this._onDidPanelTitleChange.event;
|
|
5116
|
+
this._onDidPanelParametersChange = new Emitter();
|
|
5117
|
+
this.onDidPanelParametersChange = this._onDidPanelParametersChange.event;
|
|
5118
|
+
this._onDidRemovePanel = new Emitter();
|
|
5119
|
+
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
5120
|
+
this._onDidActivePanelChange = new Emitter();
|
|
5121
|
+
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
5122
|
+
this._onUnhandledDragOverEvent = new Emitter();
|
|
5123
|
+
this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
|
|
5124
|
+
this._overwriteRenderContainer = null;
|
|
5125
|
+
toggleClass(this.container, 'groupview', true);
|
|
5126
|
+
this._api = new DockviewApi(this.accessor);
|
|
5127
|
+
this.tabsContainer = new TabsContainer(this.accessor, this.groupPanel);
|
|
5128
|
+
this.contentContainer = new ContentContainer(this.accessor, this);
|
|
5129
|
+
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
5130
|
+
this.header.hidden = !!options.hideHeader;
|
|
5131
|
+
this.locked = (_a = options.locked) !== null && _a !== void 0 ? _a : false;
|
|
5132
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this._onWillShowOverlay, this.tabsContainer.onTabDragStart((event) => {
|
|
5133
|
+
this._onTabDragStart.fire(event);
|
|
5134
|
+
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
5135
|
+
this._onGroupDragStart.fire(event);
|
|
5136
|
+
}), this.tabsContainer.onDrop((event) => {
|
|
5137
|
+
this.handleDropEvent('header', event.event, 'center', event.index);
|
|
5138
|
+
}), this.contentContainer.onDidFocus(() => {
|
|
5139
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
5140
|
+
}), this.contentContainer.onDidBlur(() => {
|
|
5141
|
+
// noop
|
|
5142
|
+
}), this.contentContainer.dropTarget.onDrop((event) => {
|
|
5143
|
+
this.handleDropEvent('content', event.nativeEvent, event.position);
|
|
5144
|
+
}), this.tabsContainer.onWillShowOverlay((event) => {
|
|
5145
|
+
this._onWillShowOverlay.fire(event);
|
|
5146
|
+
}), this.contentContainer.dropTarget.onWillShowOverlay((event) => {
|
|
5147
|
+
this._onWillShowOverlay.fire(new WillShowOverlayLocationEvent(event, {
|
|
5148
|
+
kind: 'content',
|
|
5149
|
+
panel: this.activePanel,
|
|
5150
|
+
api: this._api,
|
|
5151
|
+
group: this.groupPanel,
|
|
5152
|
+
getData: getPanelData,
|
|
5153
|
+
}));
|
|
5154
|
+
}), this._onMove, this._onDidChange, this._onDidDrop, this._onWillDrop, this._onDidAddPanel, this._onDidRemovePanel, this._onDidActivePanelChange, this._onUnhandledDragOverEvent);
|
|
5192
5155
|
}
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
this.api._onWillFocus.fire(event);
|
|
5196
|
-
if (event.defaultPrevented) {
|
|
5197
|
-
return;
|
|
5198
|
-
}
|
|
5199
|
-
this._element.focus();
|
|
5156
|
+
focusContent() {
|
|
5157
|
+
this.contentContainer.element.focus();
|
|
5200
5158
|
}
|
|
5201
|
-
|
|
5202
|
-
this.
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
}
|
|
5159
|
+
set renderContainer(value) {
|
|
5160
|
+
this.panels.forEach((panel) => {
|
|
5161
|
+
this.renderContainer.detatch(panel);
|
|
5162
|
+
});
|
|
5163
|
+
this._overwriteRenderContainer = value;
|
|
5164
|
+
this.panels.forEach((panel) => {
|
|
5165
|
+
this.rerender(panel);
|
|
5166
|
+
});
|
|
5210
5167
|
}
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
this.
|
|
5168
|
+
get renderContainer() {
|
|
5169
|
+
var _a;
|
|
5170
|
+
return ((_a = this._overwriteRenderContainer) !== null && _a !== void 0 ? _a : this.accessor.overlayRenderContainer);
|
|
5214
5171
|
}
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
* delete new keys that have a value of undefined,
|
|
5221
|
-
* allow values of null
|
|
5222
|
-
*/
|
|
5223
|
-
for (const key of Object.keys(event.params)) {
|
|
5224
|
-
if (event.params[key] === undefined) {
|
|
5225
|
-
delete this._params.params[key];
|
|
5226
|
-
}
|
|
5172
|
+
initialize() {
|
|
5173
|
+
if (this.options.panels) {
|
|
5174
|
+
this.options.panels.forEach((panel) => {
|
|
5175
|
+
this.doAddPanel(panel);
|
|
5176
|
+
});
|
|
5227
5177
|
}
|
|
5228
|
-
|
|
5229
|
-
|
|
5178
|
+
if (this.options.activePanel) {
|
|
5179
|
+
this.openPanel(this.options.activePanel);
|
|
5180
|
+
}
|
|
5181
|
+
// must be run after the constructor otherwise this.parent may not be
|
|
5182
|
+
// correctly initialized
|
|
5183
|
+
this.setActive(this.isActive, true);
|
|
5184
|
+
this.updateContainer();
|
|
5185
|
+
if (this.accessor.options.createRightHeaderActionComponent) {
|
|
5186
|
+
this._rightHeaderActions =
|
|
5187
|
+
this.accessor.options.createRightHeaderActionComponent(this.groupPanel);
|
|
5188
|
+
this.addDisposables(this._rightHeaderActions);
|
|
5189
|
+
this._rightHeaderActions.init({
|
|
5190
|
+
containerApi: this._api,
|
|
5191
|
+
api: this.groupPanel.api,
|
|
5192
|
+
group: this.groupPanel,
|
|
5193
|
+
});
|
|
5194
|
+
this.tabsContainer.setRightActionsElement(this._rightHeaderActions.element);
|
|
5195
|
+
}
|
|
5196
|
+
if (this.accessor.options.createLeftHeaderActionComponent) {
|
|
5197
|
+
this._leftHeaderActions =
|
|
5198
|
+
this.accessor.options.createLeftHeaderActionComponent(this.groupPanel);
|
|
5199
|
+
this.addDisposables(this._leftHeaderActions);
|
|
5200
|
+
this._leftHeaderActions.init({
|
|
5201
|
+
containerApi: this._api,
|
|
5202
|
+
api: this.groupPanel.api,
|
|
5203
|
+
group: this.groupPanel,
|
|
5204
|
+
});
|
|
5205
|
+
this.tabsContainer.setLeftActionsElement(this._leftHeaderActions.element);
|
|
5206
|
+
}
|
|
5207
|
+
if (this.accessor.options.createPrefixHeaderActionComponent) {
|
|
5208
|
+
this._prefixHeaderActions =
|
|
5209
|
+
this.accessor.options.createPrefixHeaderActionComponent(this.groupPanel);
|
|
5210
|
+
this.addDisposables(this._prefixHeaderActions);
|
|
5211
|
+
this._prefixHeaderActions.init({
|
|
5212
|
+
containerApi: this._api,
|
|
5213
|
+
api: this.groupPanel.api,
|
|
5214
|
+
group: this.groupPanel,
|
|
5215
|
+
});
|
|
5216
|
+
this.tabsContainer.setPrefixActionsElement(this._prefixHeaderActions.element);
|
|
5217
|
+
}
|
|
5218
|
+
}
|
|
5219
|
+
rerender(panel) {
|
|
5220
|
+
this.contentContainer.renderPanel(panel, { asActive: false });
|
|
5221
|
+
}
|
|
5222
|
+
indexOf(panel) {
|
|
5223
|
+
return this.tabsContainer.indexOf(panel.id);
|
|
5230
5224
|
}
|
|
5231
5225
|
toJSON() {
|
|
5232
|
-
var _a
|
|
5233
|
-
const
|
|
5234
|
-
|
|
5226
|
+
var _a;
|
|
5227
|
+
const result = {
|
|
5228
|
+
views: this.tabsContainer.panels,
|
|
5229
|
+
activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
|
|
5235
5230
|
id: this.id,
|
|
5236
|
-
component: this.component,
|
|
5237
|
-
params: Object.keys(params).length > 0 ? params : undefined,
|
|
5238
5231
|
};
|
|
5232
|
+
if (this.locked !== false) {
|
|
5233
|
+
result.locked = this.locked;
|
|
5234
|
+
}
|
|
5235
|
+
if (this.header.hidden) {
|
|
5236
|
+
result.hideHeader = true;
|
|
5237
|
+
}
|
|
5238
|
+
return result;
|
|
5239
5239
|
}
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5240
|
+
moveToNext(options) {
|
|
5241
|
+
if (!options) {
|
|
5242
|
+
options = {};
|
|
5243
|
+
}
|
|
5244
|
+
if (!options.panel) {
|
|
5245
|
+
options.panel = this.activePanel;
|
|
5246
|
+
}
|
|
5247
|
+
const index = options.panel ? this.panels.indexOf(options.panel) : -1;
|
|
5248
|
+
let normalizedIndex;
|
|
5249
|
+
if (index < this.panels.length - 1) {
|
|
5250
|
+
normalizedIndex = index + 1;
|
|
5251
|
+
}
|
|
5252
|
+
else if (!options.suppressRoll) {
|
|
5253
|
+
normalizedIndex = 0;
|
|
5254
|
+
}
|
|
5255
|
+
else {
|
|
5256
|
+
return;
|
|
5257
|
+
}
|
|
5258
|
+
this.openPanel(this.panels[normalizedIndex]);
|
|
5251
5259
|
}
|
|
5252
|
-
|
|
5253
|
-
|
|
5260
|
+
moveToPrevious(options) {
|
|
5261
|
+
if (!options) {
|
|
5262
|
+
options = {};
|
|
5263
|
+
}
|
|
5264
|
+
if (!options.panel) {
|
|
5265
|
+
options.panel = this.activePanel;
|
|
5266
|
+
}
|
|
5267
|
+
if (!options.panel) {
|
|
5268
|
+
return;
|
|
5269
|
+
}
|
|
5270
|
+
const index = this.panels.indexOf(options.panel);
|
|
5271
|
+
let normalizedIndex;
|
|
5272
|
+
if (index > 0) {
|
|
5273
|
+
normalizedIndex = index - 1;
|
|
5274
|
+
}
|
|
5275
|
+
else if (!options.suppressRoll) {
|
|
5276
|
+
normalizedIndex = this.panels.length - 1;
|
|
5277
|
+
}
|
|
5278
|
+
else {
|
|
5279
|
+
return;
|
|
5280
|
+
}
|
|
5281
|
+
this.openPanel(this.panels[normalizedIndex]);
|
|
5254
5282
|
}
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
const expanded = this.isExpanded();
|
|
5258
|
-
const minimumBodySize = expanded ? this._minimumBodySize : 0;
|
|
5259
|
-
return headerSize + minimumBodySize;
|
|
5283
|
+
containsPanel(panel) {
|
|
5284
|
+
return this.panels.includes(panel);
|
|
5260
5285
|
}
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
const expanded = this.isExpanded();
|
|
5264
|
-
const maximumBodySize = expanded ? this._maximumBodySize : 0;
|
|
5265
|
-
return headerSize + maximumBodySize;
|
|
5286
|
+
init(_params) {
|
|
5287
|
+
//noop
|
|
5266
5288
|
}
|
|
5267
|
-
|
|
5268
|
-
|
|
5289
|
+
update(_params) {
|
|
5290
|
+
//noop
|
|
5269
5291
|
}
|
|
5270
|
-
|
|
5271
|
-
|
|
5292
|
+
focus() {
|
|
5293
|
+
var _a;
|
|
5294
|
+
(_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.focus();
|
|
5272
5295
|
}
|
|
5273
|
-
|
|
5274
|
-
|
|
5296
|
+
openPanel(panel, options = {}) {
|
|
5297
|
+
/**
|
|
5298
|
+
* set the panel group
|
|
5299
|
+
* add the panel
|
|
5300
|
+
* check if group active
|
|
5301
|
+
* check if panel active
|
|
5302
|
+
*/
|
|
5303
|
+
if (typeof options.index !== 'number' ||
|
|
5304
|
+
options.index > this.panels.length) {
|
|
5305
|
+
options.index = this.panels.length;
|
|
5306
|
+
}
|
|
5307
|
+
const skipSetActive = !!options.skipSetActive;
|
|
5308
|
+
// ensure the group is updated before we fire any events
|
|
5309
|
+
panel.updateParentGroup(this.groupPanel, {
|
|
5310
|
+
skipSetActive: options.skipSetActive,
|
|
5311
|
+
});
|
|
5312
|
+
this.doAddPanel(panel, options.index, {
|
|
5313
|
+
skipSetActive: skipSetActive,
|
|
5314
|
+
});
|
|
5315
|
+
if (this._activePanel === panel) {
|
|
5316
|
+
this.contentContainer.renderPanel(panel, { asActive: true });
|
|
5317
|
+
return;
|
|
5318
|
+
}
|
|
5319
|
+
if (!skipSetActive) {
|
|
5320
|
+
this.doSetActivePanel(panel);
|
|
5321
|
+
}
|
|
5322
|
+
if (!options.skipSetGroupActive) {
|
|
5323
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
5324
|
+
}
|
|
5325
|
+
if (!options.skipSetActive) {
|
|
5326
|
+
this.updateContainer();
|
|
5327
|
+
}
|
|
5275
5328
|
}
|
|
5276
|
-
|
|
5277
|
-
|
|
5329
|
+
removePanel(groupItemOrId, options = {
|
|
5330
|
+
skipSetActive: false,
|
|
5331
|
+
}) {
|
|
5332
|
+
const id = typeof groupItemOrId === 'string'
|
|
5333
|
+
? groupItemOrId
|
|
5334
|
+
: groupItemOrId.id;
|
|
5335
|
+
const panelToRemove = this._panels.find((panel) => panel.id === id);
|
|
5336
|
+
if (!panelToRemove) {
|
|
5337
|
+
throw new Error('invalid operation');
|
|
5338
|
+
}
|
|
5339
|
+
return this._removePanel(panelToRemove, options);
|
|
5278
5340
|
}
|
|
5279
|
-
|
|
5280
|
-
this.
|
|
5341
|
+
closeAllPanels() {
|
|
5342
|
+
if (this.panels.length > 0) {
|
|
5343
|
+
// take a copy since we will be edting the array as we iterate through
|
|
5344
|
+
const arrPanelCpy = [...this.panels];
|
|
5345
|
+
for (const panel of arrPanelCpy) {
|
|
5346
|
+
this.doClose(panel);
|
|
5347
|
+
}
|
|
5348
|
+
}
|
|
5349
|
+
else {
|
|
5350
|
+
this.accessor.removeGroup(this.groupPanel);
|
|
5351
|
+
}
|
|
5281
5352
|
}
|
|
5282
|
-
|
|
5283
|
-
|
|
5353
|
+
closePanel(panel) {
|
|
5354
|
+
this.doClose(panel);
|
|
5284
5355
|
}
|
|
5285
|
-
|
|
5286
|
-
this.
|
|
5287
|
-
typeof value === 'number' ? value : Number.POSITIVE_INFINITY;
|
|
5356
|
+
doClose(panel) {
|
|
5357
|
+
this.accessor.removePanel(panel);
|
|
5288
5358
|
}
|
|
5289
|
-
|
|
5290
|
-
return this.
|
|
5359
|
+
isPanelActive(panel) {
|
|
5360
|
+
return this._activePanel === panel;
|
|
5291
5361
|
}
|
|
5292
|
-
|
|
5293
|
-
this.
|
|
5294
|
-
this.header.style.display = value ? '' : 'none';
|
|
5362
|
+
updateActions(element) {
|
|
5363
|
+
this.tabsContainer.setRightActionsElement(element);
|
|
5295
5364
|
}
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
this.
|
|
5301
|
-
this.
|
|
5302
|
-
this.
|
|
5303
|
-
this.
|
|
5304
|
-
this.
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
this.
|
|
5308
|
-
this._isExpanded = false;
|
|
5309
|
-
this.expandedSize = 0;
|
|
5310
|
-
this.api.pane = this; // TODO cannot use 'this' before 'super'
|
|
5311
|
-
this.api.initialize(this);
|
|
5312
|
-
this._isExpanded = isExpanded;
|
|
5313
|
-
this._headerVisible = isHeaderVisible;
|
|
5314
|
-
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value
|
|
5315
|
-
this._orientation = orientation;
|
|
5316
|
-
this.element.classList.add('pane');
|
|
5317
|
-
this.addDisposables(this.api.onWillVisibilityChange((event) => {
|
|
5318
|
-
const { isVisible } = event;
|
|
5319
|
-
const { accessor } = this._params;
|
|
5320
|
-
accessor.setVisible(this, isVisible);
|
|
5321
|
-
}), this.api.onDidSizeChange((event) => {
|
|
5322
|
-
this._onDidChange.fire({ size: event.size });
|
|
5323
|
-
}), addDisposableListener(this.element, 'mouseenter', (ev) => {
|
|
5324
|
-
this.api._onMouseEnter.fire(ev);
|
|
5325
|
-
}), addDisposableListener(this.element, 'mouseleave', (ev) => {
|
|
5326
|
-
this.api._onMouseLeave.fire(ev);
|
|
5327
|
-
}));
|
|
5328
|
-
this.addDisposables(this._onDidChangeExpansionState, this.onDidChangeExpansionState((isPanelExpanded) => {
|
|
5329
|
-
this.api._onDidExpansionChange.fire({
|
|
5330
|
-
isExpanded: isPanelExpanded,
|
|
5331
|
-
});
|
|
5332
|
-
}), this.api.onDidFocusChange((e) => {
|
|
5333
|
-
if (!this.header) {
|
|
5334
|
-
return;
|
|
5335
|
-
}
|
|
5336
|
-
if (e.isFocused) {
|
|
5337
|
-
addClasses(this.header, 'focused');
|
|
5338
|
-
}
|
|
5339
|
-
else {
|
|
5340
|
-
removeClasses(this.header, 'focused');
|
|
5341
|
-
}
|
|
5342
|
-
}));
|
|
5343
|
-
this.renderOnce();
|
|
5365
|
+
setActive(isGroupActive, force = false) {
|
|
5366
|
+
if (!force && this.isActive === isGroupActive) {
|
|
5367
|
+
return;
|
|
5368
|
+
}
|
|
5369
|
+
this._isGroupActive = isGroupActive;
|
|
5370
|
+
toggleClass(this.container, 'active-group', isGroupActive);
|
|
5371
|
+
toggleClass(this.container, 'inactive-group', !isGroupActive);
|
|
5372
|
+
this.tabsContainer.setActive(this.isActive);
|
|
5373
|
+
if (!this._activePanel && this.panels.length > 0) {
|
|
5374
|
+
this.doSetActivePanel(this.panels[0]);
|
|
5375
|
+
}
|
|
5376
|
+
this.updateContainer();
|
|
5344
5377
|
}
|
|
5345
|
-
|
|
5346
|
-
|
|
5378
|
+
layout(width, height) {
|
|
5379
|
+
var _a;
|
|
5380
|
+
this._width = width;
|
|
5381
|
+
this._height = height;
|
|
5382
|
+
this.contentContainer.layout(this._width, this._height);
|
|
5383
|
+
if ((_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.layout) {
|
|
5384
|
+
this._activePanel.layout(this._width, this._height);
|
|
5385
|
+
}
|
|
5347
5386
|
}
|
|
5348
|
-
|
|
5349
|
-
this.
|
|
5387
|
+
_removePanel(panel, options) {
|
|
5388
|
+
const isActivePanel = this._activePanel === panel;
|
|
5389
|
+
this.doRemovePanel(panel);
|
|
5390
|
+
if (isActivePanel && this.panels.length > 0) {
|
|
5391
|
+
const nextPanel = this.mostRecentlyUsed[0];
|
|
5392
|
+
this.openPanel(nextPanel, {
|
|
5393
|
+
skipSetActive: options.skipSetActive,
|
|
5394
|
+
skipSetGroupActive: options.skipSetActiveGroup,
|
|
5395
|
+
});
|
|
5396
|
+
}
|
|
5397
|
+
if (this._activePanel && this.panels.length === 0) {
|
|
5398
|
+
this.doSetActivePanel(undefined);
|
|
5399
|
+
}
|
|
5400
|
+
if (!options.skipSetActive) {
|
|
5401
|
+
this.updateContainer();
|
|
5402
|
+
}
|
|
5403
|
+
return panel;
|
|
5350
5404
|
}
|
|
5351
|
-
|
|
5352
|
-
|
|
5405
|
+
doRemovePanel(panel) {
|
|
5406
|
+
const index = this.panels.indexOf(panel);
|
|
5407
|
+
if (this._activePanel === panel) {
|
|
5408
|
+
this.contentContainer.closePanel();
|
|
5409
|
+
}
|
|
5410
|
+
this.tabsContainer.delete(panel.id);
|
|
5411
|
+
this._panels.splice(index, 1);
|
|
5412
|
+
if (this.mostRecentlyUsed.includes(panel)) {
|
|
5413
|
+
const index = this.mostRecentlyUsed.indexOf(panel);
|
|
5414
|
+
this.mostRecentlyUsed.splice(index, 1);
|
|
5415
|
+
}
|
|
5416
|
+
const disposable = this._panelDisposables.get(panel.id);
|
|
5417
|
+
if (disposable) {
|
|
5418
|
+
disposable.dispose();
|
|
5419
|
+
this._panelDisposables.delete(panel.id);
|
|
5420
|
+
}
|
|
5421
|
+
this._onDidRemovePanel.fire({ panel });
|
|
5353
5422
|
}
|
|
5354
|
-
|
|
5355
|
-
|
|
5423
|
+
doAddPanel(panel, index = this.panels.length, options = { skipSetActive: false }) {
|
|
5424
|
+
const existingPanel = this._panels.indexOf(panel);
|
|
5425
|
+
const hasExistingPanel = existingPanel > -1;
|
|
5426
|
+
this.tabsContainer.show();
|
|
5427
|
+
this.contentContainer.show();
|
|
5428
|
+
this.tabsContainer.openPanel(panel, index);
|
|
5429
|
+
if (!options.skipSetActive) {
|
|
5430
|
+
this.contentContainer.openPanel(panel);
|
|
5431
|
+
}
|
|
5432
|
+
if (hasExistingPanel) {
|
|
5433
|
+
// TODO - need to ensure ordering hasn't changed and if it has need to re-order this.panels
|
|
5356
5434
|
return;
|
|
5357
5435
|
}
|
|
5358
|
-
this.
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5436
|
+
this.updateMru(panel);
|
|
5437
|
+
this.panels.splice(index, 0, panel);
|
|
5438
|
+
this._panelDisposables.set(panel.id, new CompositeDisposable(panel.api.onDidTitleChange((event) => this._onDidPanelTitleChange.fire(event)), panel.api.onDidParametersChange((event) => this._onDidPanelParametersChange.fire(event))));
|
|
5439
|
+
this._onDidAddPanel.fire({ panel });
|
|
5440
|
+
}
|
|
5441
|
+
doSetActivePanel(panel) {
|
|
5442
|
+
if (this._activePanel === panel) {
|
|
5443
|
+
return;
|
|
5366
5444
|
}
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5445
|
+
this._activePanel = panel;
|
|
5446
|
+
if (panel) {
|
|
5447
|
+
this.tabsContainer.setActivePanel(panel);
|
|
5448
|
+
panel.layout(this._width, this._height);
|
|
5449
|
+
this.updateMru(panel);
|
|
5450
|
+
this._onDidActivePanelChange.fire({
|
|
5451
|
+
panel,
|
|
5452
|
+
});
|
|
5372
5453
|
}
|
|
5373
|
-
this._onDidChange.fire(expanded ? { size: this.width } : {});
|
|
5374
|
-
this._onDidChangeExpansionState.fire(expanded);
|
|
5375
5454
|
}
|
|
5376
|
-
|
|
5377
|
-
this.
|
|
5378
|
-
|
|
5379
|
-
const [width, height] = this.orientation === exports.Orientation.HORIZONTAL
|
|
5380
|
-
? [size, orthogonalSize]
|
|
5381
|
-
: [orthogonalSize, size];
|
|
5382
|
-
if (this.isExpanded()) {
|
|
5383
|
-
this.expandedSize = width;
|
|
5455
|
+
updateMru(panel) {
|
|
5456
|
+
if (this.mostRecentlyUsed.includes(panel)) {
|
|
5457
|
+
this.mostRecentlyUsed.splice(this.mostRecentlyUsed.indexOf(panel), 1);
|
|
5384
5458
|
}
|
|
5385
|
-
|
|
5459
|
+
this.mostRecentlyUsed = [panel, ...this.mostRecentlyUsed];
|
|
5386
5460
|
}
|
|
5387
|
-
|
|
5461
|
+
updateContainer() {
|
|
5388
5462
|
var _a, _b;
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5463
|
+
toggleClass(this.container, 'empty', this.isEmpty);
|
|
5464
|
+
this.panels.forEach((panel) => panel.runEvents());
|
|
5465
|
+
if (this.isEmpty && !this.watermark) {
|
|
5466
|
+
const watermark = this.accessor.createWatermarkComponent();
|
|
5467
|
+
watermark.init({
|
|
5468
|
+
containerApi: this._api,
|
|
5469
|
+
group: this.groupPanel,
|
|
5470
|
+
});
|
|
5471
|
+
this.watermark = watermark;
|
|
5472
|
+
addDisposableListener(this.watermark.element, 'click', () => {
|
|
5473
|
+
if (!this.isActive) {
|
|
5474
|
+
this.accessor.doSetGroupActive(this.groupPanel);
|
|
5475
|
+
}
|
|
5476
|
+
});
|
|
5477
|
+
this.tabsContainer.hide();
|
|
5478
|
+
this.contentContainer.element.appendChild(this.watermark.element);
|
|
5479
|
+
this.watermark.updateParentGroup(this.groupPanel, true);
|
|
5395
5480
|
}
|
|
5396
|
-
this.
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
(_b = this.header) === null || _b === void 0 ? void 0 : _b.append(this.headerPart.element);
|
|
5402
|
-
if (typeof parameters.isExpanded === 'boolean') {
|
|
5403
|
-
this.setExpanded(parameters.isExpanded);
|
|
5481
|
+
if (!this.isEmpty && this.watermark) {
|
|
5482
|
+
this.watermark.element.remove();
|
|
5483
|
+
(_b = (_a = this.watermark).dispose) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
5484
|
+
this.watermark = undefined;
|
|
5485
|
+
this.tabsContainer.show();
|
|
5404
5486
|
}
|
|
5405
5487
|
}
|
|
5406
|
-
|
|
5407
|
-
const
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
renderOnce() {
|
|
5411
|
-
this.header = document.createElement('div');
|
|
5412
|
-
this.header.tabIndex = 0;
|
|
5413
|
-
this.header.className = 'pane-header';
|
|
5414
|
-
this.header.style.height = `${this.headerSize}px`;
|
|
5415
|
-
this.header.style.lineHeight = `${this.headerSize}px`;
|
|
5416
|
-
this.header.style.minHeight = `${this.headerSize}px`;
|
|
5417
|
-
this.header.style.maxHeight = `${this.headerSize}px`;
|
|
5418
|
-
this.element.appendChild(this.header);
|
|
5419
|
-
this.body = document.createElement('div');
|
|
5420
|
-
this.body.className = 'pane-body';
|
|
5421
|
-
this.element.appendChild(this.body);
|
|
5422
|
-
}
|
|
5423
|
-
// TODO slightly hacky by-pass of the component to create a body and header component
|
|
5424
|
-
getComponent() {
|
|
5425
|
-
return {
|
|
5426
|
-
update: (params) => {
|
|
5427
|
-
var _a, _b;
|
|
5428
|
-
(_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.update({ params });
|
|
5429
|
-
(_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.update({ params });
|
|
5430
|
-
},
|
|
5431
|
-
dispose: () => {
|
|
5432
|
-
var _a, _b;
|
|
5433
|
-
(_a = this.bodyPart) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
5434
|
-
(_b = this.headerPart) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
5435
|
-
},
|
|
5436
|
-
};
|
|
5437
|
-
}
|
|
5438
|
-
}
|
|
5439
|
-
|
|
5440
|
-
class DraggablePaneviewPanel extends PaneviewPanel {
|
|
5441
|
-
constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) {
|
|
5442
|
-
super(id, component, headerComponent, orientation, isExpanded, true);
|
|
5443
|
-
this.accessor = accessor;
|
|
5444
|
-
this._onDidDrop = new Emitter();
|
|
5445
|
-
this.onDidDrop = this._onDidDrop.event;
|
|
5446
|
-
if (!disableDnd) {
|
|
5447
|
-
this.initDragFeatures();
|
|
5448
|
-
}
|
|
5488
|
+
canDisplayOverlay(event, position, target) {
|
|
5489
|
+
const firedEvent = new DockviewUnhandledDragOverEvent(event, target, position, getPanelData, this.accessor.getPanel(this.id));
|
|
5490
|
+
this._onUnhandledDragOverEvent.fire(firedEvent);
|
|
5491
|
+
return firedEvent.isAccepted;
|
|
5449
5492
|
}
|
|
5450
|
-
|
|
5451
|
-
if (
|
|
5493
|
+
handleDropEvent(type, event, position, index) {
|
|
5494
|
+
if (this.locked === 'no-drop-target') {
|
|
5452
5495
|
return;
|
|
5453
5496
|
}
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
return {
|
|
5461
|
-
dispose: () => {
|
|
5462
|
-
LocalSelectionTransfer.getInstance().clearData(PaneTransfer.prototype);
|
|
5463
|
-
},
|
|
5464
|
-
};
|
|
5497
|
+
function getKind() {
|
|
5498
|
+
switch (type) {
|
|
5499
|
+
case 'header':
|
|
5500
|
+
return typeof index === 'number' ? 'tab' : 'header_space';
|
|
5501
|
+
case 'content':
|
|
5502
|
+
return 'content';
|
|
5465
5503
|
}
|
|
5466
|
-
}
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
data.viewId === this.accessor.id) {
|
|
5477
|
-
return true;
|
|
5478
|
-
}
|
|
5479
|
-
}
|
|
5480
|
-
if (this.accessor.options.showDndOverlay) {
|
|
5481
|
-
return this.accessor.options.showDndOverlay({
|
|
5482
|
-
nativeEvent: event,
|
|
5483
|
-
getData: getPaneData,
|
|
5484
|
-
panel: this,
|
|
5485
|
-
});
|
|
5486
|
-
}
|
|
5487
|
-
return false;
|
|
5488
|
-
},
|
|
5504
|
+
}
|
|
5505
|
+
const panel = typeof index === 'number' ? this.panels[index] : undefined;
|
|
5506
|
+
const willDropEvent = new DockviewWillDropEvent({
|
|
5507
|
+
nativeEvent: event,
|
|
5508
|
+
position,
|
|
5509
|
+
panel,
|
|
5510
|
+
getData: () => getPanelData(),
|
|
5511
|
+
kind: getKind(),
|
|
5512
|
+
group: this.groupPanel,
|
|
5513
|
+
api: this._api,
|
|
5489
5514
|
});
|
|
5490
|
-
this.
|
|
5491
|
-
|
|
5492
|
-
}));
|
|
5493
|
-
}
|
|
5494
|
-
onDrop(event) {
|
|
5495
|
-
const data = getPaneData();
|
|
5496
|
-
if (!data || data.viewId !== this.accessor.id) {
|
|
5497
|
-
// if there is no local drag event for this panel
|
|
5498
|
-
// or if the drag event was creating by another Paneview instance
|
|
5499
|
-
this._onDidDrop.fire(Object.assign(Object.assign({}, event), { panel: this, api: new PaneviewApi(this.accessor), getData: getPaneData }));
|
|
5515
|
+
this._onWillDrop.fire(willDropEvent);
|
|
5516
|
+
if (willDropEvent.defaultPrevented) {
|
|
5500
5517
|
return;
|
|
5501
5518
|
}
|
|
5502
|
-
const
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5519
|
+
const data = getPanelData();
|
|
5520
|
+
if (data && data.viewId === this.accessor.id) {
|
|
5521
|
+
if (data.panelId === null) {
|
|
5522
|
+
// this is a group move dnd event
|
|
5523
|
+
const { groupId } = data;
|
|
5524
|
+
this._onMove.fire({
|
|
5525
|
+
target: position,
|
|
5526
|
+
groupId: groupId,
|
|
5527
|
+
index,
|
|
5528
|
+
});
|
|
5529
|
+
return;
|
|
5530
|
+
}
|
|
5531
|
+
const fromSameGroup = this.tabsContainer.indexOf(data.panelId) !== -1;
|
|
5532
|
+
if (fromSameGroup && this.tabsContainer.size === 1) {
|
|
5533
|
+
return;
|
|
5534
|
+
}
|
|
5535
|
+
const { groupId, panelId } = data;
|
|
5536
|
+
const isSameGroup = this.id === groupId;
|
|
5537
|
+
if (isSameGroup && !position) {
|
|
5538
|
+
const oldIndex = this.tabsContainer.indexOf(panelId);
|
|
5539
|
+
if (oldIndex === index) {
|
|
5540
|
+
return;
|
|
5541
|
+
}
|
|
5542
|
+
}
|
|
5543
|
+
this._onMove.fire({
|
|
5544
|
+
target: position,
|
|
5545
|
+
groupId: data.groupId,
|
|
5546
|
+
itemId: data.panelId,
|
|
5547
|
+
index,
|
|
5548
|
+
});
|
|
5510
5549
|
}
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5550
|
+
else {
|
|
5551
|
+
this._onDidDrop.fire(new DockviewDidDropEvent({
|
|
5552
|
+
nativeEvent: event,
|
|
5553
|
+
position,
|
|
5554
|
+
panel,
|
|
5555
|
+
getData: () => getPanelData(),
|
|
5556
|
+
group: this.groupPanel,
|
|
5557
|
+
api: this._api,
|
|
5558
|
+
}));
|
|
5516
5559
|
}
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5560
|
+
}
|
|
5561
|
+
dispose() {
|
|
5562
|
+
var _a, _b, _c;
|
|
5563
|
+
super.dispose();
|
|
5564
|
+
(_a = this.watermark) === null || _a === void 0 ? void 0 : _a.element.remove();
|
|
5565
|
+
(_c = (_b = this.watermark) === null || _b === void 0 ? void 0 : _b.dispose) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
5566
|
+
this.watermark = undefined;
|
|
5567
|
+
for (const panel of this.panels) {
|
|
5568
|
+
panel.dispose();
|
|
5522
5569
|
}
|
|
5523
|
-
|
|
5570
|
+
this.tabsContainer.dispose();
|
|
5571
|
+
this.contentContainer.dispose();
|
|
5524
5572
|
}
|
|
5525
5573
|
}
|
|
5526
5574
|
|
|
@@ -5707,9 +5755,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5707
5755
|
constructor(id, accessor) {
|
|
5708
5756
|
super(id, '__dockviewgroup__');
|
|
5709
5757
|
this.accessor = accessor;
|
|
5758
|
+
this._mutableDisposable = new MutableDisposable();
|
|
5710
5759
|
this._onDidLocationChange = new Emitter();
|
|
5711
5760
|
this.onDidLocationChange = this._onDidLocationChange.event;
|
|
5712
|
-
this.
|
|
5761
|
+
this._onDidActivePanelChange = new Emitter();
|
|
5762
|
+
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
5763
|
+
this.addDisposables(this._onDidLocationChange, this._onDidActivePanelChange, this._mutableDisposable);
|
|
5713
5764
|
}
|
|
5714
5765
|
close() {
|
|
5715
5766
|
if (!this._group) {
|
|
@@ -5767,6 +5818,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5767
5818
|
}
|
|
5768
5819
|
initialize(group) {
|
|
5769
5820
|
this._group = group;
|
|
5821
|
+
/**
|
|
5822
|
+
* TODO: Annoying initialization order caveat
|
|
5823
|
+
*
|
|
5824
|
+
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
|
5825
|
+
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
|
5826
|
+
* finished ensuring the `model` is defined.
|
|
5827
|
+
*/
|
|
5828
|
+
queueMicrotask(() => {
|
|
5829
|
+
this._mutableDisposable.value =
|
|
5830
|
+
this._group.model.onDidActivePanelChange((event) => {
|
|
5831
|
+
this._onDidActivePanelChange.fire(event);
|
|
5832
|
+
});
|
|
5833
|
+
});
|
|
5770
5834
|
}
|
|
5771
5835
|
}
|
|
5772
5836
|
|
|
@@ -5827,31 +5891,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5827
5891
|
}
|
|
5828
5892
|
}
|
|
5829
5893
|
|
|
5830
|
-
function isPanelOptionsWithPanel(data) {
|
|
5831
|
-
if (data.referencePanel) {
|
|
5832
|
-
return true;
|
|
5833
|
-
}
|
|
5834
|
-
return false;
|
|
5835
|
-
}
|
|
5836
|
-
function isPanelOptionsWithGroup(data) {
|
|
5837
|
-
if (data.referenceGroup) {
|
|
5838
|
-
return true;
|
|
5839
|
-
}
|
|
5840
|
-
return false;
|
|
5841
|
-
}
|
|
5842
|
-
function isGroupOptionsWithPanel(data) {
|
|
5843
|
-
if (data.referencePanel) {
|
|
5844
|
-
return true;
|
|
5845
|
-
}
|
|
5846
|
-
return false;
|
|
5847
|
-
}
|
|
5848
|
-
function isGroupOptionsWithGroup(data) {
|
|
5849
|
-
if (data.referenceGroup) {
|
|
5850
|
-
return true;
|
|
5851
|
-
}
|
|
5852
|
-
return false;
|
|
5853
|
-
}
|
|
5854
|
-
|
|
5855
5894
|
class DockviewPanelApiImpl extends GridviewPanelApiImpl {
|
|
5856
5895
|
get location() {
|
|
5857
5896
|
return this.group.api.location;
|
|
@@ -6219,7 +6258,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6219
6258
|
this._tab = this.createTabComponent(this.id, tabComponent);
|
|
6220
6259
|
}
|
|
6221
6260
|
init(params) {
|
|
6222
|
-
this.content.init(
|
|
6261
|
+
this.content.init(params);
|
|
6223
6262
|
this.tab.init(params);
|
|
6224
6263
|
}
|
|
6225
6264
|
updateParentGroup(_group, _isPanelVisible) {
|
|
@@ -6240,20 +6279,29 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6240
6279
|
(_d = (_c = this.tab).dispose) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
6241
6280
|
}
|
|
6242
6281
|
createContentComponent(id, componentName) {
|
|
6243
|
-
|
|
6244
|
-
|
|
6282
|
+
return this.accessor.options.createComponent({
|
|
6283
|
+
id,
|
|
6284
|
+
name: componentName,
|
|
6285
|
+
});
|
|
6245
6286
|
}
|
|
6246
6287
|
createTabComponent(id, componentName) {
|
|
6247
|
-
|
|
6248
|
-
if (
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6288
|
+
const name = componentName !== null && componentName !== void 0 ? componentName : this.accessor.options.defaultTabComponent;
|
|
6289
|
+
if (name) {
|
|
6290
|
+
if (this.accessor.options.createTabComponent) {
|
|
6291
|
+
const component = this.accessor.options.createTabComponent({
|
|
6292
|
+
id,
|
|
6293
|
+
name,
|
|
6294
|
+
});
|
|
6295
|
+
if (component) {
|
|
6296
|
+
return component;
|
|
6297
|
+
}
|
|
6298
|
+
else {
|
|
6299
|
+
return new DefaultTab();
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6302
|
+
console.warn(`dockview: tabComponent '${componentName}' was not found. falling back to the default tab.`);
|
|
6256
6303
|
}
|
|
6304
|
+
return new DefaultTab();
|
|
6257
6305
|
}
|
|
6258
6306
|
}
|
|
6259
6307
|
|
|
@@ -6990,11 +7038,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6990
7038
|
return this._api;
|
|
6991
7039
|
}
|
|
6992
7040
|
constructor(options) {
|
|
6993
|
-
var _a
|
|
7041
|
+
var _a;
|
|
6994
7042
|
super({
|
|
6995
7043
|
proportionalLayout: true,
|
|
6996
|
-
orientation:
|
|
6997
|
-
styles: options.
|
|
7044
|
+
orientation: exports.Orientation.HORIZONTAL,
|
|
7045
|
+
styles: options.hideBorders
|
|
7046
|
+
? { separatorBorder: 'transparent' }
|
|
7047
|
+
: undefined,
|
|
6998
7048
|
parentElement: options.parentElement,
|
|
6999
7049
|
disableAutoResizing: options.disableAutoResizing,
|
|
7000
7050
|
locked: options.locked,
|
|
@@ -7012,6 +7062,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7012
7062
|
this.onWillDrop = this._onWillDrop.event;
|
|
7013
7063
|
this._onWillShowOverlay = new Emitter();
|
|
7014
7064
|
this.onWillShowOverlay = this._onWillShowOverlay.event;
|
|
7065
|
+
this._onUnhandledDragOverEvent = new Emitter();
|
|
7066
|
+
this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event;
|
|
7015
7067
|
this._onDidRemovePanel = new Emitter();
|
|
7016
7068
|
this.onDidRemovePanel = this._onDidRemovePanel.event;
|
|
7017
7069
|
this._onDidAddPanel = new Emitter();
|
|
@@ -7037,7 +7089,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7037
7089
|
this.overlayRenderContainer = new OverlayRenderContainer(gready);
|
|
7038
7090
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
7039
7091
|
toggleClass(this.element, 'dv-debug', !!options.debug);
|
|
7040
|
-
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) => {
|
|
7092
|
+
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) => {
|
|
7041
7093
|
if (!this._moving) {
|
|
7042
7094
|
this._onDidAddGroup.fire(event);
|
|
7043
7095
|
}
|
|
@@ -7064,22 +7116,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7064
7116
|
}
|
|
7065
7117
|
}));
|
|
7066
7118
|
this._options = options;
|
|
7067
|
-
if (!this.options.components) {
|
|
7068
|
-
this.options.components = {};
|
|
7069
|
-
}
|
|
7070
|
-
if (!this.options.frameworkComponents) {
|
|
7071
|
-
this.options.frameworkComponents = {};
|
|
7072
|
-
}
|
|
7073
|
-
if (!this.options.frameworkTabComponents) {
|
|
7074
|
-
this.options.frameworkTabComponents = {};
|
|
7075
|
-
}
|
|
7076
|
-
if (!this.options.tabComponents) {
|
|
7077
|
-
this.options.tabComponents = {};
|
|
7078
|
-
}
|
|
7079
|
-
if (!this.options.watermarkComponent &&
|
|
7080
|
-
!this.options.watermarkFrameworkComponent) {
|
|
7081
|
-
this.options.watermarkComponent = Watermark;
|
|
7082
|
-
}
|
|
7083
7119
|
this._rootDropTarget = new Droptarget(this.element, {
|
|
7084
7120
|
canDisplayOverlay: (event, position) => {
|
|
7085
7121
|
const data = getPanelData();
|
|
@@ -7094,26 +7130,20 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7094
7130
|
}
|
|
7095
7131
|
return true;
|
|
7096
7132
|
}
|
|
7097
|
-
if (this.
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
return false;
|
|
7105
|
-
}
|
|
7106
|
-
return this.options.showDndOverlay({
|
|
7107
|
-
nativeEvent: event,
|
|
7108
|
-
position: position,
|
|
7109
|
-
target: 'edge',
|
|
7110
|
-
getData: getPanelData,
|
|
7111
|
-
});
|
|
7133
|
+
if (position === 'center' && this.gridview.length !== 0) {
|
|
7134
|
+
/**
|
|
7135
|
+
* for external events only show the four-corner drag overlays, disable
|
|
7136
|
+
* the center position so that external drag events can fall through to the group
|
|
7137
|
+
* and panel drop target handlers
|
|
7138
|
+
*/
|
|
7139
|
+
return false;
|
|
7112
7140
|
}
|
|
7113
|
-
|
|
7141
|
+
const firedEvent = new DockviewUnhandledDragOverEvent(event, 'edge', position, getPanelData);
|
|
7142
|
+
this._onUnhandledDragOverEvent.fire(firedEvent);
|
|
7143
|
+
return firedEvent.isAccepted;
|
|
7114
7144
|
},
|
|
7115
7145
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
7116
|
-
overlayModel: (
|
|
7146
|
+
overlayModel: (_a = this.options.rootOverlayModel) !== null && _a !== void 0 ? _a : DEFAULT_ROOT_OVERLAY_MODEL,
|
|
7117
7147
|
});
|
|
7118
7148
|
this.addDisposables(this._rootDropTarget, this._rootDropTarget.onWillShowOverlay((event) => {
|
|
7119
7149
|
if (this.gridview.length > 0 && event.position === 'center') {
|
|
@@ -7337,7 +7367,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7337
7367
|
skipDispose: true,
|
|
7338
7368
|
skipSetActiveGroup: true,
|
|
7339
7369
|
}));
|
|
7340
|
-
group.model.openPanel(item, { skipSetGroupActive: true });
|
|
7370
|
+
this.movingLock(() => group.model.openPanel(item, { skipSetGroupActive: true }));
|
|
7341
7371
|
}
|
|
7342
7372
|
else {
|
|
7343
7373
|
group = item;
|
|
@@ -7410,7 +7440,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7410
7440
|
// this is either a resize or a move
|
|
7411
7441
|
// to inform the panels .layout(...) the group with it's current size
|
|
7412
7442
|
// don't care about resize since the above watcher handles that
|
|
7413
|
-
group.layout(group.
|
|
7443
|
+
group.layout(group.width, group.height);
|
|
7414
7444
|
}), overlay.onDidChangeEnd(() => {
|
|
7415
7445
|
this._bufferOnDidLayoutChange.fire();
|
|
7416
7446
|
}), group.onDidChange((event) => {
|
|
@@ -7465,16 +7495,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7465
7495
|
}
|
|
7466
7496
|
updateOptions(options) {
|
|
7467
7497
|
var _a, _b;
|
|
7468
|
-
const
|
|
7469
|
-
this.gridview.orientation !== options.orientation;
|
|
7470
|
-
const changed_floatingGroupBounds = options.floatingGroupBounds !== undefined &&
|
|
7498
|
+
const changed_floatingGroupBounds = 'floatingGroupBounds' in options &&
|
|
7471
7499
|
options.floatingGroupBounds !== this.options.floatingGroupBounds;
|
|
7472
|
-
const changed_rootOverlayOptions =
|
|
7500
|
+
const changed_rootOverlayOptions = 'rootOverlayModel' in options &&
|
|
7473
7501
|
options.rootOverlayModel !== this.options.rootOverlayModel;
|
|
7474
7502
|
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
7475
|
-
if (changed_orientation) {
|
|
7476
|
-
this.gridview.orientation = options.orientation;
|
|
7477
|
-
}
|
|
7478
7503
|
if (changed_floatingGroupBounds) {
|
|
7479
7504
|
for (const group of this._floatingGroups) {
|
|
7480
7505
|
switch (this.options.floatingGroupBounds) {
|
|
@@ -7762,7 +7787,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7762
7787
|
? this.getGroupPanel(options.position.referencePanel)
|
|
7763
7788
|
: options.position.referencePanel;
|
|
7764
7789
|
if (!referencePanel) {
|
|
7765
|
-
throw new Error(`referencePanel ${options.position.referencePanel} does not exist`);
|
|
7790
|
+
throw new Error(`referencePanel '${options.position.referencePanel}' does not exist`);
|
|
7766
7791
|
}
|
|
7767
7792
|
referenceGroup = this.findGroup(referencePanel);
|
|
7768
7793
|
}
|
|
@@ -7772,14 +7797,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7772
7797
|
? (_a = this._groups.get(options.position.referenceGroup)) === null || _a === void 0 ? void 0 : _a.value
|
|
7773
7798
|
: options.position.referenceGroup;
|
|
7774
7799
|
if (!referenceGroup) {
|
|
7775
|
-
throw new Error(`
|
|
7800
|
+
throw new Error(`referenceGroup '${options.position.referenceGroup}' does not exist`);
|
|
7776
7801
|
}
|
|
7777
7802
|
}
|
|
7778
7803
|
else {
|
|
7779
7804
|
const group = this.orthogonalize(directionToPosition(options.position.direction));
|
|
7780
7805
|
const panel = this.createPanel(options, group);
|
|
7781
|
-
group.model.openPanel(panel
|
|
7782
|
-
|
|
7806
|
+
group.model.openPanel(panel, {
|
|
7807
|
+
skipSetActive: options.inactive,
|
|
7808
|
+
skipSetGroupActive: options.inactive,
|
|
7809
|
+
});
|
|
7810
|
+
if (!options.inactive) {
|
|
7811
|
+
this.doSetGroupAndPanelActive(group);
|
|
7812
|
+
}
|
|
7783
7813
|
return panel;
|
|
7784
7814
|
}
|
|
7785
7815
|
}
|
|
@@ -7802,43 +7832,64 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7802
7832
|
skipActiveGroup: true,
|
|
7803
7833
|
});
|
|
7804
7834
|
panel = this.createPanel(options, group);
|
|
7805
|
-
group.model.openPanel(panel
|
|
7835
|
+
group.model.openPanel(panel, {
|
|
7836
|
+
skipSetActive: options.inactive,
|
|
7837
|
+
skipSetGroupActive: options.inactive,
|
|
7838
|
+
});
|
|
7806
7839
|
}
|
|
7807
7840
|
else if (referenceGroup.api.location.type === 'floating' ||
|
|
7808
7841
|
target === 'center') {
|
|
7809
7842
|
panel = this.createPanel(options, referenceGroup);
|
|
7810
|
-
referenceGroup.model.openPanel(panel
|
|
7811
|
-
|
|
7843
|
+
referenceGroup.model.openPanel(panel, {
|
|
7844
|
+
skipSetActive: options.inactive,
|
|
7845
|
+
skipSetGroupActive: options.inactive,
|
|
7846
|
+
});
|
|
7847
|
+
if (!options.inactive) {
|
|
7848
|
+
this.doSetGroupAndPanelActive(referenceGroup);
|
|
7849
|
+
}
|
|
7812
7850
|
}
|
|
7813
7851
|
else {
|
|
7814
7852
|
const location = getGridLocation(referenceGroup.element);
|
|
7815
7853
|
const relativeLocation = getRelativeLocation(this.gridview.orientation, location, target);
|
|
7816
7854
|
const group = this.createGroupAtLocation(relativeLocation);
|
|
7817
7855
|
panel = this.createPanel(options, group);
|
|
7818
|
-
group.model.openPanel(panel
|
|
7819
|
-
|
|
7856
|
+
group.model.openPanel(panel, {
|
|
7857
|
+
skipSetActive: options.inactive,
|
|
7858
|
+
skipSetGroupActive: options.inactive,
|
|
7859
|
+
});
|
|
7860
|
+
if (!options.inactive) {
|
|
7861
|
+
this.doSetGroupAndPanelActive(group);
|
|
7862
|
+
}
|
|
7820
7863
|
}
|
|
7821
7864
|
}
|
|
7822
7865
|
else if (options.floating) {
|
|
7823
7866
|
const group = this.createGroup();
|
|
7824
7867
|
this._onDidAddGroup.fire(group);
|
|
7825
|
-
const
|
|
7868
|
+
const coordinates = typeof options.floating === 'object' &&
|
|
7826
7869
|
options.floating !== null
|
|
7827
7870
|
? options.floating
|
|
7828
7871
|
: {};
|
|
7829
|
-
this.addFloatingGroup(group,
|
|
7872
|
+
this.addFloatingGroup(group, coordinates, {
|
|
7830
7873
|
inDragMode: false,
|
|
7831
7874
|
skipRemoveGroup: true,
|
|
7832
7875
|
skipActiveGroup: true,
|
|
7833
7876
|
});
|
|
7834
7877
|
panel = this.createPanel(options, group);
|
|
7835
|
-
group.model.openPanel(panel
|
|
7878
|
+
group.model.openPanel(panel, {
|
|
7879
|
+
skipSetActive: options.inactive,
|
|
7880
|
+
skipSetGroupActive: options.inactive,
|
|
7881
|
+
});
|
|
7836
7882
|
}
|
|
7837
7883
|
else {
|
|
7838
7884
|
const group = this.createGroupAtLocation();
|
|
7839
7885
|
panel = this.createPanel(options, group);
|
|
7840
|
-
group.model.openPanel(panel
|
|
7841
|
-
|
|
7886
|
+
group.model.openPanel(panel, {
|
|
7887
|
+
skipSetActive: options.inactive,
|
|
7888
|
+
skipSetGroupActive: options.inactive,
|
|
7889
|
+
});
|
|
7890
|
+
if (!options.inactive) {
|
|
7891
|
+
this.doSetGroupAndPanelActive(group);
|
|
7892
|
+
}
|
|
7842
7893
|
}
|
|
7843
7894
|
return panel;
|
|
7844
7895
|
}
|
|
@@ -7862,12 +7913,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7862
7913
|
}
|
|
7863
7914
|
}
|
|
7864
7915
|
createWatermarkComponent() {
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
? { 'watermark-name': this.options.watermarkFrameworkComponent }
|
|
7870
|
-
: {}, (_a = this.options.frameworkComponentFactory) === null || _a === void 0 ? void 0 : _a.watermark);
|
|
7916
|
+
if (this.options.createWatermarkComponent) {
|
|
7917
|
+
return this.options.createWatermarkComponent();
|
|
7918
|
+
}
|
|
7919
|
+
return new Watermark();
|
|
7871
7920
|
}
|
|
7872
7921
|
updateWatermark() {
|
|
7873
7922
|
var _a, _b;
|
|
@@ -8248,6 +8297,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
8248
8297
|
return;
|
|
8249
8298
|
}
|
|
8250
8299
|
this._onWillShowOverlay.fire(event);
|
|
8300
|
+
}), view.model.onUnhandledDragOverEvent((event) => {
|
|
8301
|
+
this._onUnhandledDragOverEvent.fire(event);
|
|
8251
8302
|
}), view.model.onDidAddPanel((event) => {
|
|
8252
8303
|
if (this._moving) {
|
|
8253
8304
|
return;
|
|
@@ -9493,11 +9544,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9493
9544
|
this.part = new ReactPart(this.element, this.reactPortalStore, this.component, {
|
|
9494
9545
|
group: parameters.group,
|
|
9495
9546
|
containerApi: parameters.containerApi,
|
|
9496
|
-
close: () => {
|
|
9497
|
-
if (parameters.group) {
|
|
9498
|
-
parameters.containerApi.removeGroup(parameters.group);
|
|
9499
|
-
}
|
|
9500
|
-
},
|
|
9501
9547
|
});
|
|
9502
9548
|
}
|
|
9503
9549
|
focus() {
|
|
@@ -9529,9 +9575,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9529
9575
|
get part() {
|
|
9530
9576
|
return this._part;
|
|
9531
9577
|
}
|
|
9532
|
-
get group() {
|
|
9533
|
-
return this._group;
|
|
9534
|
-
}
|
|
9535
9578
|
constructor(component, reactPortalStore, _group) {
|
|
9536
9579
|
this.component = component;
|
|
9537
9580
|
this.reactPortalStore = reactPortalStore;
|
|
@@ -9542,9 +9585,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9542
9585
|
this._element.style.height = '100%';
|
|
9543
9586
|
this._element.style.width = '100%';
|
|
9544
9587
|
}
|
|
9545
|
-
focus() {
|
|
9546
|
-
// TODO
|
|
9547
|
-
}
|
|
9548
9588
|
init(parameters) {
|
|
9549
9589
|
this.mutableDisposable.value = new CompositeDisposable(this._group.model.onDidAddPanel(() => {
|
|
9550
9590
|
this.updatePanels();
|
|
@@ -9564,15 +9604,15 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9564
9604
|
group: this._group,
|
|
9565
9605
|
});
|
|
9566
9606
|
}
|
|
9567
|
-
update(event) {
|
|
9568
|
-
var _a;
|
|
9569
|
-
(_a = this._part) === null || _a === void 0 ? void 0 : _a.update(event.params);
|
|
9570
|
-
}
|
|
9571
9607
|
dispose() {
|
|
9572
9608
|
var _a;
|
|
9573
9609
|
this.mutableDisposable.dispose();
|
|
9574
9610
|
(_a = this._part) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
9575
9611
|
}
|
|
9612
|
+
update(event) {
|
|
9613
|
+
var _a;
|
|
9614
|
+
(_a = this._part) === null || _a === void 0 ? void 0 : _a.update(event.params);
|
|
9615
|
+
}
|
|
9576
9616
|
updatePanels() {
|
|
9577
9617
|
this.update({ params: { panels: this._group.model.panels } });
|
|
9578
9618
|
}
|
|
@@ -9600,72 +9640,72 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9600
9640
|
: undefined;
|
|
9601
9641
|
}
|
|
9602
9642
|
const DEFAULT_REACT_TAB = 'props.defaultTabComponent';
|
|
9643
|
+
function extractCoreOptions(props) {
|
|
9644
|
+
const coreOptions = PROPERTY_KEYS.reduce((obj, key) => {
|
|
9645
|
+
if (key in props) {
|
|
9646
|
+
obj[key] = props[key];
|
|
9647
|
+
}
|
|
9648
|
+
return obj;
|
|
9649
|
+
}, {});
|
|
9650
|
+
return coreOptions;
|
|
9651
|
+
}
|
|
9603
9652
|
const DockviewReact = React.forwardRef((props, ref) => {
|
|
9604
9653
|
const domRef = React.useRef(null);
|
|
9605
9654
|
const dockviewRef = React.useRef();
|
|
9606
9655
|
const [portals, addPortal] = usePortalsLifecycle();
|
|
9607
9656
|
React.useImperativeHandle(ref, () => domRef.current, []);
|
|
9657
|
+
const prevProps = React.useRef({});
|
|
9658
|
+
React.useEffect(() => {
|
|
9659
|
+
const changes = {};
|
|
9660
|
+
PROPERTY_KEYS.forEach((propKey) => {
|
|
9661
|
+
const key = propKey;
|
|
9662
|
+
const propValue = props[key];
|
|
9663
|
+
if (key in props && propValue !== prevProps.current[key]) {
|
|
9664
|
+
changes[key] = propValue;
|
|
9665
|
+
}
|
|
9666
|
+
});
|
|
9667
|
+
if (dockviewRef.current) {
|
|
9668
|
+
dockviewRef.current.updateOptions(changes);
|
|
9669
|
+
}
|
|
9670
|
+
prevProps.current = props;
|
|
9671
|
+
}, PROPERTY_KEYS.map((key) => props[key]));
|
|
9608
9672
|
React.useEffect(() => {
|
|
9609
9673
|
var _a;
|
|
9610
9674
|
if (!domRef.current) {
|
|
9611
|
-
return
|
|
9612
|
-
// noop
|
|
9613
|
-
};
|
|
9675
|
+
return;
|
|
9614
9676
|
}
|
|
9615
|
-
const factory = {
|
|
9616
|
-
content: {
|
|
9617
|
-
createComponent: (_id, componentId, component) => {
|
|
9618
|
-
return new ReactPanelContentPart(componentId, component, {
|
|
9619
|
-
addPortal,
|
|
9620
|
-
});
|
|
9621
|
-
},
|
|
9622
|
-
},
|
|
9623
|
-
tab: {
|
|
9624
|
-
createComponent: (_id, componentId, component) => {
|
|
9625
|
-
return new ReactPanelHeaderPart(componentId, component, {
|
|
9626
|
-
addPortal,
|
|
9627
|
-
});
|
|
9628
|
-
},
|
|
9629
|
-
},
|
|
9630
|
-
watermark: {
|
|
9631
|
-
createComponent: (_id, componentId, component) => {
|
|
9632
|
-
return new ReactWatermarkPart(componentId, component, {
|
|
9633
|
-
addPortal,
|
|
9634
|
-
});
|
|
9635
|
-
},
|
|
9636
|
-
},
|
|
9637
|
-
};
|
|
9638
9677
|
const frameworkTabComponents = (_a = props.tabComponents) !== null && _a !== void 0 ? _a : {};
|
|
9639
9678
|
if (props.defaultTabComponent) {
|
|
9640
9679
|
frameworkTabComponents[DEFAULT_REACT_TAB] =
|
|
9641
9680
|
props.defaultTabComponent;
|
|
9642
9681
|
}
|
|
9643
|
-
const
|
|
9682
|
+
const frameworkOptions = {
|
|
9683
|
+
createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),
|
|
9684
|
+
createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
|
|
9685
|
+
createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),
|
|
9686
|
+
createComponent: (options) => {
|
|
9687
|
+
return new ReactPanelContentPart(options.id, props.components[options.name], {
|
|
9688
|
+
addPortal,
|
|
9689
|
+
});
|
|
9690
|
+
},
|
|
9691
|
+
createTabComponent(options) {
|
|
9692
|
+
return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], {
|
|
9693
|
+
addPortal,
|
|
9694
|
+
});
|
|
9695
|
+
},
|
|
9696
|
+
createWatermarkComponent: props.watermarkComponent
|
|
9697
|
+
? () => {
|
|
9698
|
+
return new ReactWatermarkPart('watermark', props.watermarkComponent, {
|
|
9699
|
+
addPortal,
|
|
9700
|
+
});
|
|
9701
|
+
}
|
|
9702
|
+
: undefined,
|
|
9644
9703
|
parentElement: domRef.current,
|
|
9645
|
-
frameworkComponentFactory: factory,
|
|
9646
|
-
frameworkComponents: props.components,
|
|
9647
|
-
disableAutoResizing: props.disableAutoResizing,
|
|
9648
|
-
frameworkTabComponents,
|
|
9649
|
-
watermarkFrameworkComponent: props.watermarkComponent,
|
|
9650
9704
|
defaultTabComponent: props.defaultTabComponent
|
|
9651
9705
|
? DEFAULT_REACT_TAB
|
|
9652
9706
|
: undefined,
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
: undefined,
|
|
9656
|
-
showDndOverlay: props.showDndOverlay,
|
|
9657
|
-
createLeftHeaderActionsElement: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),
|
|
9658
|
-
createRightHeaderActionsElement: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
|
|
9659
|
-
createPrefixHeaderActionsElement: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),
|
|
9660
|
-
singleTabMode: props.singleTabMode,
|
|
9661
|
-
disableFloatingGroups: props.disableFloatingGroups,
|
|
9662
|
-
floatingGroupBounds: props.floatingGroupBounds,
|
|
9663
|
-
defaultRenderer: props.defaultRenderer,
|
|
9664
|
-
debug: props.debug,
|
|
9665
|
-
rootOverlayModel: props.rootOverlayModel,
|
|
9666
|
-
locked: props.locked,
|
|
9667
|
-
disableDnd: props.disableDnd,
|
|
9668
|
-
});
|
|
9707
|
+
};
|
|
9708
|
+
const dockview = new DockviewComponent(Object.assign(Object.assign({}, extractCoreOptions(props)), frameworkOptions));
|
|
9669
9709
|
const { clientWidth, clientHeight } = domRef.current;
|
|
9670
9710
|
dockview.layout(clientWidth, clientHeight);
|
|
9671
9711
|
if (props.onReady) {
|
|
@@ -9676,20 +9716,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9676
9716
|
dockview.dispose();
|
|
9677
9717
|
};
|
|
9678
9718
|
}, []);
|
|
9679
|
-
React.useEffect(() => {
|
|
9680
|
-
if (!dockviewRef.current) {
|
|
9681
|
-
return;
|
|
9682
|
-
}
|
|
9683
|
-
dockviewRef.current.locked = !!props.locked;
|
|
9684
|
-
}, [props.locked]);
|
|
9685
|
-
React.useEffect(() => {
|
|
9686
|
-
if (!dockviewRef.current) {
|
|
9687
|
-
return;
|
|
9688
|
-
}
|
|
9689
|
-
dockviewRef.current.updateOptions({
|
|
9690
|
-
disableDnd: props.disableDnd,
|
|
9691
|
-
});
|
|
9692
|
-
}, [props.disableDnd]);
|
|
9693
9719
|
React.useEffect(() => {
|
|
9694
9720
|
if (!dockviewRef.current) {
|
|
9695
9721
|
return () => {
|
|
@@ -9711,63 +9737,43 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9711
9737
|
// noop
|
|
9712
9738
|
};
|
|
9713
9739
|
}
|
|
9714
|
-
const disposable = dockviewRef.current.
|
|
9715
|
-
|
|
9716
|
-
|
|
9740
|
+
const disposable = dockviewRef.current.onUnhandledDragOverEvent((event) => {
|
|
9741
|
+
var _a;
|
|
9742
|
+
if ((_a = props.showDndOverlay) === null || _a === void 0 ? void 0 : _a.call(props, event)) {
|
|
9743
|
+
event.accept();
|
|
9717
9744
|
}
|
|
9718
9745
|
});
|
|
9719
9746
|
return () => {
|
|
9720
9747
|
disposable.dispose();
|
|
9721
9748
|
};
|
|
9722
|
-
}, [props.onWillDrop]);
|
|
9723
|
-
React.useEffect(() => {
|
|
9724
|
-
if (!dockviewRef.current) {
|
|
9725
|
-
return;
|
|
9726
|
-
}
|
|
9727
|
-
dockviewRef.current.updateOptions({
|
|
9728
|
-
frameworkComponents: props.components,
|
|
9729
|
-
});
|
|
9730
|
-
}, [props.components]);
|
|
9731
|
-
React.useEffect(() => {
|
|
9732
|
-
if (!dockviewRef.current) {
|
|
9733
|
-
return;
|
|
9734
|
-
}
|
|
9735
|
-
dockviewRef.current.updateOptions({
|
|
9736
|
-
floatingGroupBounds: props.floatingGroupBounds,
|
|
9737
|
-
});
|
|
9738
|
-
}, [props.floatingGroupBounds]);
|
|
9739
|
-
React.useEffect(() => {
|
|
9740
|
-
if (!dockviewRef.current) {
|
|
9741
|
-
return;
|
|
9742
|
-
}
|
|
9743
|
-
dockviewRef.current.updateOptions({
|
|
9744
|
-
watermarkFrameworkComponent: props.watermarkComponent,
|
|
9745
|
-
});
|
|
9746
|
-
}, [props.watermarkComponent]);
|
|
9747
|
-
React.useEffect(() => {
|
|
9748
|
-
if (!dockviewRef.current) {
|
|
9749
|
-
return;
|
|
9750
|
-
}
|
|
9751
|
-
dockviewRef.current.updateOptions({
|
|
9752
|
-
showDndOverlay: props.showDndOverlay,
|
|
9753
|
-
});
|
|
9754
9749
|
}, [props.showDndOverlay]);
|
|
9755
9750
|
React.useEffect(() => {
|
|
9756
9751
|
if (!dockviewRef.current) {
|
|
9757
|
-
return
|
|
9752
|
+
return () => {
|
|
9753
|
+
// noop
|
|
9754
|
+
};
|
|
9758
9755
|
}
|
|
9759
|
-
dockviewRef.current.
|
|
9760
|
-
|
|
9756
|
+
const disposable = dockviewRef.current.onWillDrop((event) => {
|
|
9757
|
+
if (props.onWillDrop) {
|
|
9758
|
+
props.onWillDrop(event);
|
|
9759
|
+
}
|
|
9761
9760
|
});
|
|
9762
|
-
|
|
9761
|
+
return () => {
|
|
9762
|
+
disposable.dispose();
|
|
9763
|
+
};
|
|
9764
|
+
}, [props.onWillDrop]);
|
|
9763
9765
|
React.useEffect(() => {
|
|
9764
9766
|
if (!dockviewRef.current) {
|
|
9765
9767
|
return;
|
|
9766
9768
|
}
|
|
9767
9769
|
dockviewRef.current.updateOptions({
|
|
9768
|
-
|
|
9770
|
+
createComponent: (options) => {
|
|
9771
|
+
return new ReactPanelContentPart(options.id, props.components[options.name], {
|
|
9772
|
+
addPortal,
|
|
9773
|
+
});
|
|
9774
|
+
},
|
|
9769
9775
|
});
|
|
9770
|
-
}, [props.
|
|
9776
|
+
}, [props.components]);
|
|
9771
9777
|
React.useEffect(() => {
|
|
9772
9778
|
var _a;
|
|
9773
9779
|
if (!dockviewRef.current) {
|
|
@@ -9782,39 +9788,49 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
9782
9788
|
defaultTabComponent: props.defaultTabComponent
|
|
9783
9789
|
? DEFAULT_REACT_TAB
|
|
9784
9790
|
: undefined,
|
|
9785
|
-
|
|
9791
|
+
createTabComponent(options) {
|
|
9792
|
+
return new ReactPanelHeaderPart(options.id, frameworkTabComponents[options.name], {
|
|
9793
|
+
addPortal,
|
|
9794
|
+
});
|
|
9795
|
+
},
|
|
9786
9796
|
});
|
|
9787
|
-
}, [props.defaultTabComponent]);
|
|
9797
|
+
}, [props.tabComponents, props.defaultTabComponent]);
|
|
9788
9798
|
React.useEffect(() => {
|
|
9789
9799
|
if (!dockviewRef.current) {
|
|
9790
9800
|
return;
|
|
9791
9801
|
}
|
|
9792
9802
|
dockviewRef.current.updateOptions({
|
|
9793
|
-
|
|
9803
|
+
createWatermarkComponent: props.watermarkComponent
|
|
9804
|
+
? () => {
|
|
9805
|
+
return new ReactWatermarkPart('watermark', props.watermarkComponent, {
|
|
9806
|
+
addPortal,
|
|
9807
|
+
});
|
|
9808
|
+
}
|
|
9809
|
+
: undefined,
|
|
9794
9810
|
});
|
|
9795
|
-
}, [props.
|
|
9811
|
+
}, [props.watermarkComponent]);
|
|
9796
9812
|
React.useEffect(() => {
|
|
9797
9813
|
if (!dockviewRef.current) {
|
|
9798
9814
|
return;
|
|
9799
9815
|
}
|
|
9800
9816
|
dockviewRef.current.updateOptions({
|
|
9801
|
-
|
|
9817
|
+
createRightHeaderActionComponent: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
|
|
9802
9818
|
});
|
|
9803
|
-
}, [props.
|
|
9819
|
+
}, [props.rightHeaderActionsComponent]);
|
|
9804
9820
|
React.useEffect(() => {
|
|
9805
9821
|
if (!dockviewRef.current) {
|
|
9806
9822
|
return;
|
|
9807
9823
|
}
|
|
9808
9824
|
dockviewRef.current.updateOptions({
|
|
9809
|
-
|
|
9825
|
+
createLeftHeaderActionComponent: createGroupControlElement(props.leftHeaderActionsComponent, { addPortal }),
|
|
9810
9826
|
});
|
|
9811
|
-
}, [props.
|
|
9827
|
+
}, [props.leftHeaderActionsComponent]);
|
|
9812
9828
|
React.useEffect(() => {
|
|
9813
9829
|
if (!dockviewRef.current) {
|
|
9814
9830
|
return;
|
|
9815
9831
|
}
|
|
9816
9832
|
dockviewRef.current.updateOptions({
|
|
9817
|
-
|
|
9833
|
+
createPrefixHeaderActionComponent: createGroupControlElement(props.prefixHeaderActionsComponent, { addPortal }),
|
|
9818
9834
|
});
|
|
9819
9835
|
}, [props.prefixHeaderActionsComponent]);
|
|
9820
9836
|
return (React.createElement("div", { className: props.className, style: { height: '100%', width: '100%' }, ref: domRef }, portals));
|
|
@@ -10154,6 +10170,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
10154
10170
|
exports.DockviewMutableDisposable = MutableDisposable;
|
|
10155
10171
|
exports.DockviewPanel = DockviewPanel;
|
|
10156
10172
|
exports.DockviewReact = DockviewReact;
|
|
10173
|
+
exports.DockviewUnhandledDragOverEvent = DockviewUnhandledDragOverEvent;
|
|
10157
10174
|
exports.DockviewWillDropEvent = DockviewWillDropEvent;
|
|
10158
10175
|
exports.DraggablePaneviewPanel = DraggablePaneviewPanel;
|
|
10159
10176
|
exports.Gridview = Gridview;
|
|
@@ -10162,6 +10179,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
10162
10179
|
exports.GridviewPanel = GridviewPanel;
|
|
10163
10180
|
exports.GridviewReact = GridviewReact;
|
|
10164
10181
|
exports.LocalSelectionTransfer = LocalSelectionTransfer;
|
|
10182
|
+
exports.PROPERTY_KEYS = PROPERTY_KEYS;
|
|
10165
10183
|
exports.PaneFramework = PaneFramework;
|
|
10166
10184
|
exports.PaneTransfer = PaneTransfer;
|
|
10167
10185
|
exports.PanelTransfer = PanelTransfer;
|