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