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