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