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