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