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