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