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