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