dockview 1.8.1 → 1.8.3
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/dockview/defaultTab.d.ts +4 -1
- package/dist/cjs/dockview/defaultTab.d.ts.map +1 -1
- package/dist/cjs/dockview/defaultTab.js +18 -11
- package/dist/cjs/dockview/defaultTab.js.map +1 -1
- package/dist/cjs/dockview/dockview.d.ts +4 -0
- package/dist/cjs/dockview/dockview.d.ts.map +1 -1
- package/dist/cjs/dockview/dockview.js +9 -0
- package/dist/cjs/dockview/dockview.js.map +1 -1
- package/dist/cjs/react.d.ts.map +1 -1
- package/dist/cjs/react.js.map +1 -1
- package/dist/cjs/types.d.ts +2 -1
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/dockview.amd.js +229 -116
- package/dist/dockview.amd.js.map +1 -1
- package/dist/dockview.amd.min.js +2 -2
- package/dist/dockview.amd.min.js.map +1 -1
- package/dist/dockview.amd.min.noStyle.js +2 -2
- package/dist/dockview.amd.min.noStyle.js.map +1 -1
- package/dist/dockview.amd.noStyle.js +228 -115
- package/dist/dockview.amd.noStyle.js.map +1 -1
- package/dist/dockview.cjs.js +229 -116
- package/dist/dockview.cjs.js.map +1 -1
- package/dist/dockview.esm.js +229 -116
- package/dist/dockview.esm.js.map +1 -1
- package/dist/dockview.esm.min.js +2 -2
- package/dist/dockview.esm.min.js.map +1 -1
- package/dist/dockview.js +229 -116
- package/dist/dockview.js.map +1 -1
- package/dist/dockview.min.js +2 -2
- package/dist/dockview.min.js.map +1 -1
- package/dist/dockview.min.noStyle.js +2 -2
- package/dist/dockview.min.noStyle.js.map +1 -1
- package/dist/dockview.noStyle.js +228 -115
- package/dist/dockview.noStyle.js.map +1 -1
- package/dist/esm/dockview/defaultTab.d.ts +4 -1
- package/dist/esm/dockview/defaultTab.d.ts.map +1 -1
- package/dist/esm/dockview/defaultTab.js +18 -11
- package/dist/esm/dockview/defaultTab.js.map +1 -1
- package/dist/esm/dockview/dockview.d.ts +4 -0
- package/dist/esm/dockview/dockview.d.ts.map +1 -1
- package/dist/esm/dockview/dockview.js +9 -0
- package/dist/esm/dockview/dockview.js.map +1 -1
- package/dist/esm/react.d.ts.map +1 -1
- package/dist/esm/react.js.map +1 -1
- package/dist/esm/types.d.ts +2 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/styles/dockview.css +3 -3
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dockview
|
|
3
|
-
* @version 1.8.
|
|
3
|
+
* @version 1.8.3
|
|
4
4
|
* @link https://github.com/mathuo/dockview
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -260,9 +260,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
260
260
|
get isDisposed() {
|
|
261
261
|
return this._isDisposed;
|
|
262
262
|
}
|
|
263
|
-
static from(...args) {
|
|
264
|
-
return new CompositeDisposable(...args);
|
|
265
|
-
}
|
|
266
263
|
constructor(...args) {
|
|
267
264
|
this._isDisposed = false;
|
|
268
265
|
this._disposables = args;
|
|
@@ -2466,6 +2463,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2466
2463
|
get onDidDrop() {
|
|
2467
2464
|
return this.component.onDidDrop;
|
|
2468
2465
|
}
|
|
2466
|
+
get onWillDragGroup() {
|
|
2467
|
+
return this.component.onWillDragGroup;
|
|
2468
|
+
}
|
|
2469
|
+
get onWillDragPanel() {
|
|
2470
|
+
return this.component.onWillDragPanel;
|
|
2471
|
+
}
|
|
2469
2472
|
get panels() {
|
|
2470
2473
|
return this.component.panels;
|
|
2471
2474
|
}
|
|
@@ -2928,7 +2931,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2928
2931
|
}
|
|
2929
2932
|
configure() {
|
|
2930
2933
|
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2931
|
-
if (this.isCancelled(event)) {
|
|
2934
|
+
if (event.defaultPrevented || this.isCancelled(event)) {
|
|
2932
2935
|
event.preventDefault();
|
|
2933
2936
|
return;
|
|
2934
2937
|
}
|
|
@@ -2948,19 +2951,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2948
2951
|
}
|
|
2949
2952
|
this.el.classList.add('dv-dragged');
|
|
2950
2953
|
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
2951
|
-
this.dataDisposable.value = this.getData(event
|
|
2954
|
+
this.dataDisposable.value = this.getData(event);
|
|
2955
|
+
this._onDragStart.fire(event);
|
|
2952
2956
|
if (event.dataTransfer) {
|
|
2953
2957
|
event.dataTransfer.effectAllowed = 'move';
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2958
|
+
const hasData = event.dataTransfer.items.length > 0;
|
|
2959
|
+
if (!hasData) {
|
|
2960
|
+
/**
|
|
2961
|
+
* Although this is not used by dockview many third party dnd libraries will check
|
|
2962
|
+
* dataTransfer.types to determine valid drag events.
|
|
2963
|
+
*
|
|
2964
|
+
* For example: in react-dnd if dataTransfer.types is not set then the dragStart event will be cancelled
|
|
2965
|
+
* through .preventDefault(). Since this is applied globally to all drag events this would break dockviews
|
|
2966
|
+
* dnd logic. You can see the code at
|
|
2967
|
+
* https://github.com/react-dnd/react-dnd/blob/main/packages/backend-html5/src/HTML5BackendImpl.ts#L542
|
|
2968
|
+
*/
|
|
2969
|
+
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
2970
|
+
}
|
|
2964
2971
|
}
|
|
2965
2972
|
}), addDisposableListener(this.el, 'dragend', () => {
|
|
2966
2973
|
this.pointerEventsDisposable.dispose();
|
|
@@ -2969,44 +2976,45 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
2969
2976
|
}
|
|
2970
2977
|
}
|
|
2971
2978
|
|
|
2979
|
+
class TabDragHandler extends DragHandler {
|
|
2980
|
+
constructor(element, accessor, group, panel) {
|
|
2981
|
+
super(element);
|
|
2982
|
+
this.accessor = accessor;
|
|
2983
|
+
this.group = group;
|
|
2984
|
+
this.panel = panel;
|
|
2985
|
+
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
2986
|
+
}
|
|
2987
|
+
getData(event) {
|
|
2988
|
+
this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, this.panel.id)], PanelTransfer.prototype);
|
|
2989
|
+
return {
|
|
2990
|
+
dispose: () => {
|
|
2991
|
+
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
2992
|
+
},
|
|
2993
|
+
};
|
|
2994
|
+
}
|
|
2995
|
+
}
|
|
2972
2996
|
class Tab extends CompositeDisposable {
|
|
2973
2997
|
get element() {
|
|
2974
2998
|
return this._element;
|
|
2975
2999
|
}
|
|
2976
|
-
constructor(
|
|
3000
|
+
constructor(panel, accessor, group) {
|
|
2977
3001
|
super();
|
|
2978
|
-
this.
|
|
3002
|
+
this.panel = panel;
|
|
2979
3003
|
this.accessor = accessor;
|
|
2980
3004
|
this.group = group;
|
|
3005
|
+
this.content = undefined;
|
|
2981
3006
|
this._onChanged = new Emitter();
|
|
2982
3007
|
this.onChanged = this._onChanged.event;
|
|
2983
3008
|
this._onDropped = new Emitter();
|
|
2984
3009
|
this.onDrop = this._onDropped.event;
|
|
3010
|
+
this._onDragStart = new Emitter();
|
|
3011
|
+
this.onDragStart = this._onDragStart.event;
|
|
2985
3012
|
this._element = document.createElement('div');
|
|
2986
3013
|
this._element.className = 'tab';
|
|
2987
3014
|
this._element.tabIndex = 0;
|
|
2988
3015
|
this._element.draggable = true;
|
|
2989
3016
|
toggleClass(this.element, 'inactive-tab', true);
|
|
2990
|
-
this.
|
|
2991
|
-
constructor() {
|
|
2992
|
-
super(...arguments);
|
|
2993
|
-
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
2994
|
-
}
|
|
2995
|
-
getData() {
|
|
2996
|
-
this.panelTransfer.setData([new PanelTransfer(accessor.id, group.id, panelId)], PanelTransfer.prototype);
|
|
2997
|
-
return {
|
|
2998
|
-
dispose: () => {
|
|
2999
|
-
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
3000
|
-
},
|
|
3001
|
-
};
|
|
3002
|
-
}
|
|
3003
|
-
})(this._element));
|
|
3004
|
-
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
3005
|
-
if (event.defaultPrevented) {
|
|
3006
|
-
return;
|
|
3007
|
-
}
|
|
3008
|
-
this._onChanged.fire(event);
|
|
3009
|
-
}));
|
|
3017
|
+
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
3010
3018
|
this.droptarget = new Droptarget(this._element, {
|
|
3011
3019
|
acceptedTargetZones: ['center'],
|
|
3012
3020
|
canDisplayOverlay: (event, position) => {
|
|
@@ -3020,12 +3028,19 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3020
3028
|
// don't allow group move to drop on self
|
|
3021
3029
|
return false;
|
|
3022
3030
|
}
|
|
3023
|
-
return this.
|
|
3031
|
+
return this.panel.id !== data.panelId;
|
|
3024
3032
|
}
|
|
3025
3033
|
return this.group.model.canDisplayOverlay(event, position, exports.DockviewDropTargets.Tab);
|
|
3026
3034
|
},
|
|
3027
3035
|
});
|
|
3028
|
-
this.addDisposables(this.
|
|
3036
|
+
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
3037
|
+
this._onDragStart.fire(event);
|
|
3038
|
+
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
3039
|
+
if (event.defaultPrevented) {
|
|
3040
|
+
return;
|
|
3041
|
+
}
|
|
3042
|
+
this._onChanged.fire(event);
|
|
3043
|
+
}), this.droptarget.onDrop((event) => {
|
|
3029
3044
|
this._onDropped.fire(event);
|
|
3030
3045
|
}), this.droptarget);
|
|
3031
3046
|
}
|
|
@@ -3057,9 +3072,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3057
3072
|
}
|
|
3058
3073
|
|
|
3059
3074
|
class GroupDragHandler extends DragHandler {
|
|
3060
|
-
constructor(element,
|
|
3075
|
+
constructor(element, accessor, group) {
|
|
3061
3076
|
super(element);
|
|
3062
|
-
this.
|
|
3077
|
+
this.accessor = accessor;
|
|
3063
3078
|
this.group = group;
|
|
3064
3079
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
3065
3080
|
this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
|
|
@@ -3079,8 +3094,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3079
3094
|
}
|
|
3080
3095
|
return false;
|
|
3081
3096
|
}
|
|
3082
|
-
getData(
|
|
3083
|
-
|
|
3097
|
+
getData(dragEvent) {
|
|
3098
|
+
const dataTransfer = dragEvent.dataTransfer;
|
|
3099
|
+
this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, null)], PanelTransfer.prototype);
|
|
3084
3100
|
const style = window.getComputedStyle(this.el);
|
|
3085
3101
|
const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
|
|
3086
3102
|
const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
|
|
@@ -3115,14 +3131,16 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3115
3131
|
this.group = group;
|
|
3116
3132
|
this._onDrop = new Emitter();
|
|
3117
3133
|
this.onDrop = this._onDrop.event;
|
|
3134
|
+
this._onDragStart = new Emitter();
|
|
3135
|
+
this.onDragStart = this._onDragStart.event;
|
|
3118
3136
|
this._element = document.createElement('div');
|
|
3119
3137
|
this._element.className = 'void-container';
|
|
3120
3138
|
this._element.tabIndex = 0;
|
|
3121
3139
|
this._element.draggable = true;
|
|
3122
|
-
this.addDisposables(this._onDrop, addDisposableListener(this._element, 'click', () => {
|
|
3140
|
+
this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'click', () => {
|
|
3123
3141
|
this.accessor.doSetGroupActive(this.group);
|
|
3124
3142
|
}));
|
|
3125
|
-
const handler = new GroupDragHandler(this._element, accessor
|
|
3143
|
+
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3126
3144
|
this.voidDropTarget = new Droptarget(this._element, {
|
|
3127
3145
|
acceptedTargetZones: ['center'],
|
|
3128
3146
|
canDisplayOverlay: (event, position) => {
|
|
@@ -3140,7 +3158,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3140
3158
|
return group.model.canDisplayOverlay(event, position, exports.DockviewDropTargets.Panel);
|
|
3141
3159
|
},
|
|
3142
3160
|
});
|
|
3143
|
-
this.addDisposables(handler,
|
|
3161
|
+
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3162
|
+
this._onDragStart.fire(event);
|
|
3163
|
+
}), this.voidDropTarget.onDrop((event) => {
|
|
3144
3164
|
this._onDrop.fire(event);
|
|
3145
3165
|
}), this.voidDropTarget);
|
|
3146
3166
|
}
|
|
@@ -3148,7 +3168,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3148
3168
|
|
|
3149
3169
|
class TabsContainer extends CompositeDisposable {
|
|
3150
3170
|
get panels() {
|
|
3151
|
-
return this.tabs.map((_) => _.value.
|
|
3171
|
+
return this.tabs.map((_) => _.value.panel.id);
|
|
3152
3172
|
}
|
|
3153
3173
|
get size() {
|
|
3154
3174
|
return this.tabs.length;
|
|
@@ -3202,7 +3222,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3202
3222
|
this.tabs[this.selectedIndex].value === tab);
|
|
3203
3223
|
}
|
|
3204
3224
|
indexOf(id) {
|
|
3205
|
-
return this.tabs.findIndex((tab) => tab.value.
|
|
3225
|
+
return this.tabs.findIndex((tab) => tab.value.panel.id === id);
|
|
3206
3226
|
}
|
|
3207
3227
|
constructor(accessor, group) {
|
|
3208
3228
|
super();
|
|
@@ -3213,7 +3233,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3213
3233
|
this._hidden = false;
|
|
3214
3234
|
this._onDrop = new Emitter();
|
|
3215
3235
|
this.onDrop = this._onDrop.event;
|
|
3216
|
-
this.
|
|
3236
|
+
this._onTabDragStart = new Emitter();
|
|
3237
|
+
this.onTabDragStart = this._onTabDragStart.event;
|
|
3238
|
+
this._onGroupDragStart = new Emitter();
|
|
3239
|
+
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3240
|
+
this.addDisposables(this._onDrop, this._onTabDragStart, this._onGroupDragStart);
|
|
3217
3241
|
this._element = document.createElement('div');
|
|
3218
3242
|
this._element.className = 'tabs-and-actions-container';
|
|
3219
3243
|
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
@@ -3237,7 +3261,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3237
3261
|
this._element.appendChild(this.leftActionsContainer);
|
|
3238
3262
|
this._element.appendChild(this.voidContainer.element);
|
|
3239
3263
|
this._element.appendChild(this.rightActionsContainer);
|
|
3240
|
-
this.addDisposables(this.voidContainer, this.voidContainer.
|
|
3264
|
+
this.addDisposables(this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3265
|
+
this._onGroupDragStart.fire({
|
|
3266
|
+
nativeEvent: event,
|
|
3267
|
+
group: this.group,
|
|
3268
|
+
});
|
|
3269
|
+
}), this.voidContainer.onDrop((event) => {
|
|
3241
3270
|
this._onDrop.fire({
|
|
3242
3271
|
event: event.nativeEvent,
|
|
3243
3272
|
index: this.tabs.length,
|
|
@@ -3283,7 +3312,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3283
3312
|
}
|
|
3284
3313
|
}
|
|
3285
3314
|
delete(id) {
|
|
3286
|
-
const index = this.tabs.findIndex((tab) => tab.value.
|
|
3315
|
+
const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
|
|
3287
3316
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
3288
3317
|
const { value, disposable } = tabToRemove;
|
|
3289
3318
|
disposable.dispose();
|
|
@@ -3292,21 +3321,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3292
3321
|
}
|
|
3293
3322
|
setActivePanel(panel) {
|
|
3294
3323
|
this.tabs.forEach((tab) => {
|
|
3295
|
-
const isActivePanel = panel.id === tab.value.
|
|
3324
|
+
const isActivePanel = panel.id === tab.value.panel.id;
|
|
3296
3325
|
tab.value.setActive(isActivePanel);
|
|
3297
3326
|
});
|
|
3298
3327
|
}
|
|
3299
3328
|
openPanel(panel, index = this.tabs.length) {
|
|
3300
3329
|
var _a;
|
|
3301
|
-
if (this.tabs.find((tab) => tab.value.
|
|
3330
|
+
if (this.tabs.find((tab) => tab.value.panel.id === panel.id)) {
|
|
3302
3331
|
return;
|
|
3303
3332
|
}
|
|
3304
|
-
const
|
|
3333
|
+
const tab = new Tab(panel, this.accessor, this.group);
|
|
3305
3334
|
if (!((_a = panel.view) === null || _a === void 0 ? void 0 : _a.tab)) {
|
|
3306
3335
|
throw new Error('invalid header component');
|
|
3307
3336
|
}
|
|
3308
|
-
|
|
3309
|
-
const disposable = CompositeDisposable
|
|
3337
|
+
tab.setContent(panel.view.tab);
|
|
3338
|
+
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
3339
|
+
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
3340
|
+
}), tab.onChanged((event) => {
|
|
3310
3341
|
var _a;
|
|
3311
3342
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3312
3343
|
const isFloatingWithOnePanel = this.group.api.isFloating && this.size === 1;
|
|
@@ -3314,8 +3345,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3314
3345
|
!isFloatingWithOnePanel &&
|
|
3315
3346
|
event.shiftKey) {
|
|
3316
3347
|
event.preventDefault();
|
|
3317
|
-
const panel = this.accessor.getGroupPanel(
|
|
3318
|
-
const { top, left } =
|
|
3348
|
+
const panel = this.accessor.getGroupPanel(tab.panel.id);
|
|
3349
|
+
const { top, left } = tab.element.getBoundingClientRect();
|
|
3319
3350
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
3320
3351
|
this.accessor.addFloatingGroup(panel, {
|
|
3321
3352
|
x: left - rootLeft,
|
|
@@ -3332,13 +3363,13 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3332
3363
|
this.group.model.openPanel(panel, {
|
|
3333
3364
|
skipFocus: alreadyFocused,
|
|
3334
3365
|
});
|
|
3335
|
-
}),
|
|
3366
|
+
}), tab.onDrop((event) => {
|
|
3336
3367
|
this._onDrop.fire({
|
|
3337
3368
|
event: event.nativeEvent,
|
|
3338
|
-
index: this.tabs.findIndex((x) => x.value ===
|
|
3369
|
+
index: this.tabs.findIndex((x) => x.value === tab),
|
|
3339
3370
|
});
|
|
3340
3371
|
}));
|
|
3341
|
-
const value = { value:
|
|
3372
|
+
const value = { value: tab, disposable };
|
|
3342
3373
|
this.addTab(value, index);
|
|
3343
3374
|
}
|
|
3344
3375
|
closePanel(panel) {
|
|
@@ -3366,7 +3397,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3366
3397
|
}
|
|
3367
3398
|
set locked(value) {
|
|
3368
3399
|
this._locked = value;
|
|
3369
|
-
toggleClass(this.container, 'locked-groupview', value);
|
|
3400
|
+
toggleClass(this.container, 'locked-groupview', value === 'no-drop-target' || value);
|
|
3370
3401
|
}
|
|
3371
3402
|
get isActive() {
|
|
3372
3403
|
return this._isGroupActive;
|
|
@@ -3423,6 +3454,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3423
3454
|
this.onMove = this._onMove.event;
|
|
3424
3455
|
this._onDidDrop = new Emitter();
|
|
3425
3456
|
this.onDidDrop = this._onDidDrop.event;
|
|
3457
|
+
this._onTabDragStart = new Emitter();
|
|
3458
|
+
this.onTabDragStart = this._onTabDragStart.event;
|
|
3459
|
+
this._onGroupDragStart = new Emitter();
|
|
3460
|
+
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3426
3461
|
this._onDidAddPanel = new Emitter();
|
|
3427
3462
|
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
3428
3463
|
this._onDidRemovePanel = new Emitter();
|
|
@@ -3435,7 +3470,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3435
3470
|
this.dropTarget = new Droptarget(this.contentContainer.element, {
|
|
3436
3471
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
3437
3472
|
canDisplayOverlay: (event, position) => {
|
|
3438
|
-
if (this.locked
|
|
3473
|
+
if (this.locked === 'no-drop-target' ||
|
|
3474
|
+
(this.locked && position === 'center')) {
|
|
3439
3475
|
return false;
|
|
3440
3476
|
}
|
|
3441
3477
|
const data = getPanelData();
|
|
@@ -3461,8 +3497,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3461
3497
|
});
|
|
3462
3498
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3463
3499
|
this.header.hidden = !!options.hideHeader;
|
|
3464
|
-
this.locked =
|
|
3465
|
-
this.addDisposables(this.tabsContainer.
|
|
3500
|
+
this.locked = options.locked || false;
|
|
3501
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this.tabsContainer.onTabDragStart((event) => {
|
|
3502
|
+
this._onTabDragStart.fire(event);
|
|
3503
|
+
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
3504
|
+
this._onGroupDragStart.fire(event);
|
|
3505
|
+
}), this.tabsContainer.onDrop((event) => {
|
|
3466
3506
|
this.handleDropEvent(event.event, 'center', event.index);
|
|
3467
3507
|
}), this.contentContainer.onDidFocus(() => {
|
|
3468
3508
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
@@ -3517,8 +3557,8 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3517
3557
|
activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
|
|
3518
3558
|
id: this.id,
|
|
3519
3559
|
};
|
|
3520
|
-
if (this.locked) {
|
|
3521
|
-
result.locked =
|
|
3560
|
+
if (this.locked !== false) {
|
|
3561
|
+
result.locked = this.locked;
|
|
3522
3562
|
}
|
|
3523
3563
|
if (this.header.hidden) {
|
|
3524
3564
|
result.hideHeader = true;
|
|
@@ -3768,6 +3808,9 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
3768
3808
|
return false;
|
|
3769
3809
|
}
|
|
3770
3810
|
handleDropEvent(event, position, index) {
|
|
3811
|
+
if (this.locked === 'no-drop-target') {
|
|
3812
|
+
return;
|
|
3813
|
+
}
|
|
3771
3814
|
const data = getPanelData();
|
|
3772
3815
|
if (data && data.viewId === this.accessor.id) {
|
|
3773
3816
|
if (data.panelId === null) {
|
|
@@ -5225,6 +5268,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5225
5268
|
return pushToTop;
|
|
5226
5269
|
})();
|
|
5227
5270
|
class Overlay extends CompositeDisposable {
|
|
5271
|
+
set minimumInViewportWidth(value) {
|
|
5272
|
+
this.options.minimumInViewportWidth = value;
|
|
5273
|
+
}
|
|
5274
|
+
set minimumInViewportHeight(value) {
|
|
5275
|
+
this.options.minimumInViewportHeight = value;
|
|
5276
|
+
}
|
|
5228
5277
|
constructor(options) {
|
|
5229
5278
|
super();
|
|
5230
5279
|
this.options = options;
|
|
@@ -5270,9 +5319,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5270
5319
|
const overlayRect = this._element.getBoundingClientRect();
|
|
5271
5320
|
// region: ensure bounds within allowable limits
|
|
5272
5321
|
// a minimum width of minimumViewportWidth must be inside the viewport
|
|
5273
|
-
const xOffset = Math.max(0, overlayRect.width
|
|
5322
|
+
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
5274
5323
|
// a minimum height of minimumViewportHeight must be inside the viewport
|
|
5275
|
-
const yOffset =
|
|
5324
|
+
const yOffset = typeof this.options.minimumInViewportHeight === 'number'
|
|
5325
|
+
? Math.max(0, this.getMinimumHeight(overlayRect.height))
|
|
5326
|
+
: 0;
|
|
5276
5327
|
const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
5277
5328
|
const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
5278
5329
|
this._element.style.left = `${left}px`;
|
|
@@ -5318,9 +5369,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5318
5369
|
y: e.clientY - overlayRect.top,
|
|
5319
5370
|
};
|
|
5320
5371
|
}
|
|
5321
|
-
const xOffset = Math.max(0, overlayRect.width
|
|
5322
|
-
const yOffset = Math.max(0,
|
|
5323
|
-
this.
|
|
5372
|
+
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
5373
|
+
const yOffset = Math.max(0, this.options.minimumInViewportHeight
|
|
5374
|
+
? this.getMinimumHeight(overlayRect.height)
|
|
5375
|
+
: 0);
|
|
5324
5376
|
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
5325
5377
|
const top = clamp(y - offset.y, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
5326
5378
|
this.setBounds({ top, left });
|
|
@@ -5394,14 +5446,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5394
5446
|
let height = undefined;
|
|
5395
5447
|
let left = undefined;
|
|
5396
5448
|
let width = undefined;
|
|
5397
|
-
const
|
|
5398
|
-
const minimumInViewportWidth = this.options.minimumInViewportWidth;
|
|
5399
|
-
function moveTop() {
|
|
5449
|
+
const moveTop = () => {
|
|
5400
5450
|
top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
|
|
5401
5451
|
startPosition.originalHeight >
|
|
5402
5452
|
containerRect.height
|
|
5403
|
-
? containerRect.height
|
|
5404
|
-
minimumInViewportHeight
|
|
5453
|
+
? this.getMinimumHeight(containerRect.height)
|
|
5405
5454
|
: Math.max(0, startPosition.originalY +
|
|
5406
5455
|
startPosition.originalHeight -
|
|
5407
5456
|
Overlay.MINIMUM_HEIGHT));
|
|
@@ -5409,21 +5458,23 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5409
5458
|
startPosition.originalY +
|
|
5410
5459
|
startPosition.originalHeight -
|
|
5411
5460
|
top;
|
|
5412
|
-
}
|
|
5413
|
-
|
|
5461
|
+
};
|
|
5462
|
+
const moveBottom = () => {
|
|
5414
5463
|
top =
|
|
5415
5464
|
startPosition.originalY -
|
|
5416
5465
|
startPosition.originalHeight;
|
|
5417
|
-
height = clamp(y - top, top < 0
|
|
5418
|
-
|
|
5466
|
+
height = clamp(y - top, top < 0 &&
|
|
5467
|
+
typeof this.options
|
|
5468
|
+
.minimumInViewportHeight === 'number'
|
|
5469
|
+
? -top +
|
|
5470
|
+
this.options.minimumInViewportHeight
|
|
5419
5471
|
: Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
|
|
5420
|
-
}
|
|
5421
|
-
|
|
5472
|
+
};
|
|
5473
|
+
const moveLeft = () => {
|
|
5422
5474
|
left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
|
|
5423
5475
|
startPosition.originalWidth >
|
|
5424
5476
|
containerRect.width
|
|
5425
|
-
? containerRect.width
|
|
5426
|
-
minimumInViewportWidth
|
|
5477
|
+
? this.getMinimumWidth(containerRect.width)
|
|
5427
5478
|
: Math.max(0, startPosition.originalX +
|
|
5428
5479
|
startPosition.originalWidth -
|
|
5429
5480
|
Overlay.MINIMUM_WIDTH));
|
|
@@ -5431,15 +5482,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5431
5482
|
startPosition.originalX +
|
|
5432
5483
|
startPosition.originalWidth -
|
|
5433
5484
|
left;
|
|
5434
|
-
}
|
|
5435
|
-
|
|
5485
|
+
};
|
|
5486
|
+
const moveRight = () => {
|
|
5436
5487
|
left =
|
|
5437
5488
|
startPosition.originalX -
|
|
5438
5489
|
startPosition.originalWidth;
|
|
5439
|
-
width = clamp(x - left, left < 0
|
|
5440
|
-
|
|
5490
|
+
width = clamp(x - left, left < 0 &&
|
|
5491
|
+
typeof this.options
|
|
5492
|
+
.minimumInViewportWidth === 'number'
|
|
5493
|
+
? -left +
|
|
5494
|
+
this.options.minimumInViewportWidth
|
|
5441
5495
|
: Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
|
|
5442
|
-
}
|
|
5496
|
+
};
|
|
5443
5497
|
switch (direction) {
|
|
5444
5498
|
case 'top':
|
|
5445
5499
|
moveTop();
|
|
@@ -5483,6 +5537,18 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5483
5537
|
}));
|
|
5484
5538
|
}));
|
|
5485
5539
|
}
|
|
5540
|
+
getMinimumWidth(width) {
|
|
5541
|
+
if (typeof this.options.minimumInViewportWidth === 'number') {
|
|
5542
|
+
return width - this.options.minimumInViewportWidth;
|
|
5543
|
+
}
|
|
5544
|
+
return 0;
|
|
5545
|
+
}
|
|
5546
|
+
getMinimumHeight(height) {
|
|
5547
|
+
if (typeof this.options.minimumInViewportHeight === 'number') {
|
|
5548
|
+
return height - this.options.minimumInViewportHeight;
|
|
5549
|
+
}
|
|
5550
|
+
return height;
|
|
5551
|
+
}
|
|
5486
5552
|
dispose() {
|
|
5487
5553
|
this._element.remove();
|
|
5488
5554
|
super.dispose();
|
|
@@ -5503,6 +5569,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5503
5569
|
}
|
|
5504
5570
|
}
|
|
5505
5571
|
|
|
5572
|
+
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
5506
5573
|
class DockviewComponent extends BaseGrid {
|
|
5507
5574
|
get orientation() {
|
|
5508
5575
|
return this.gridview.orientation;
|
|
@@ -5533,6 +5600,10 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5533
5600
|
this.nextGroupId = sequentialNumberGenerator();
|
|
5534
5601
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
5535
5602
|
this.watermark = null;
|
|
5603
|
+
this._onWillDragPanel = new Emitter();
|
|
5604
|
+
this.onWillDragPanel = this._onWillDragPanel.event;
|
|
5605
|
+
this._onWillDragGroup = new Emitter();
|
|
5606
|
+
this.onWillDragGroup = this._onWillDragGroup.event;
|
|
5536
5607
|
this._onDidDrop = new Emitter();
|
|
5537
5608
|
this.onDidDrop = this._onDidDrop.event;
|
|
5538
5609
|
this._onDidRemovePanel = new Emitter();
|
|
@@ -5545,7 +5616,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5545
5616
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
5546
5617
|
this.floatingGroups = [];
|
|
5547
5618
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
5548
|
-
this.addDisposables(this._onDidDrop, exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
|
|
5619
|
+
this.addDisposables(this._onWillDragPanel, this._onWillDragGroup, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
|
|
5549
5620
|
this.updateWatermark();
|
|
5550
5621
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
5551
5622
|
this._bufferOnDidLayoutChange.fire();
|
|
@@ -5582,7 +5653,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5582
5653
|
return true;
|
|
5583
5654
|
}
|
|
5584
5655
|
if (this.options.showDndOverlay) {
|
|
5585
|
-
if (position === 'center') {
|
|
5656
|
+
if (position === 'center' && this.gridview.length !== 0) {
|
|
5586
5657
|
/**
|
|
5587
5658
|
* for external events only show the four-corner drag overlays, disable
|
|
5588
5659
|
* the center position so that external drag events can fall through to the group
|
|
@@ -5618,7 +5689,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5618
5689
|
this.updateWatermark();
|
|
5619
5690
|
}
|
|
5620
5691
|
addFloatingGroup(item, coord, options) {
|
|
5621
|
-
var _a, _b;
|
|
5692
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5622
5693
|
let group;
|
|
5623
5694
|
if (item instanceof DockviewPanel) {
|
|
5624
5695
|
group = this.createGroup();
|
|
@@ -5646,8 +5717,12 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5646
5717
|
width: (_b = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _b !== void 0 ? _b : 300,
|
|
5647
5718
|
left: overlayLeft,
|
|
5648
5719
|
top: overlayTop,
|
|
5649
|
-
minimumInViewportWidth:
|
|
5650
|
-
|
|
5720
|
+
minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
5721
|
+
? undefined
|
|
5722
|
+
: (_d = (_c = this.options.floatingGroupBounds) === null || _c === void 0 ? void 0 : _c.minimumWidthWithinViewport) !== null && _d !== void 0 ? _d : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
5723
|
+
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
5724
|
+
? undefined
|
|
5725
|
+
: (_f = (_e = this.options.floatingGroupBounds) === null || _e === void 0 ? void 0 : _e.minimumHeightWithinViewport) !== null && _f !== void 0 ? _f : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
5651
5726
|
});
|
|
5652
5727
|
const el = group.element.querySelector('.void-container');
|
|
5653
5728
|
if (!el) {
|
|
@@ -5718,12 +5793,37 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
5718
5793
|
}
|
|
5719
5794
|
}
|
|
5720
5795
|
updateOptions(options) {
|
|
5796
|
+
var _a, _b;
|
|
5721
5797
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
5722
5798
|
this.gridview.orientation !== options.orientation;
|
|
5799
|
+
const hasFloatingGroupOptionsChanged = options.floatingGroupBounds !== undefined &&
|
|
5800
|
+
options.floatingGroupBounds !== this.options.floatingGroupBounds;
|
|
5723
5801
|
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
5724
5802
|
if (hasOrientationChanged) {
|
|
5725
5803
|
this.gridview.orientation = options.orientation;
|
|
5726
5804
|
}
|
|
5805
|
+
if (hasFloatingGroupOptionsChanged) {
|
|
5806
|
+
for (const group of this.floatingGroups) {
|
|
5807
|
+
switch (this.options.floatingGroupBounds) {
|
|
5808
|
+
case 'boundedWithinViewport':
|
|
5809
|
+
group.overlay.minimumInViewportHeight = undefined;
|
|
5810
|
+
group.overlay.minimumInViewportWidth = undefined;
|
|
5811
|
+
break;
|
|
5812
|
+
case undefined:
|
|
5813
|
+
group.overlay.minimumInViewportHeight =
|
|
5814
|
+
DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE;
|
|
5815
|
+
group.overlay.minimumInViewportWidth =
|
|
5816
|
+
DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE;
|
|
5817
|
+
break;
|
|
5818
|
+
default:
|
|
5819
|
+
group.overlay.minimumInViewportHeight =
|
|
5820
|
+
(_a = this.options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
|
|
5821
|
+
group.overlay.minimumInViewportWidth =
|
|
5822
|
+
(_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
|
|
5823
|
+
}
|
|
5824
|
+
group.overlay.setBounds({});
|
|
5825
|
+
}
|
|
5826
|
+
}
|
|
5727
5827
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
5728
5828
|
}
|
|
5729
5829
|
layout(width, height, forceResize) {
|
|
@@ -6206,7 +6306,11 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6206
6306
|
const view = new DockviewGroupPanel(this, id, options);
|
|
6207
6307
|
view.init({ params: {}, accessor: null }); // required to initialized .part and allow for correct disposal of group
|
|
6208
6308
|
if (!this._groups.has(view.id)) {
|
|
6209
|
-
const disposable = new CompositeDisposable(view.model.
|
|
6309
|
+
const disposable = new CompositeDisposable(view.model.onTabDragStart((event) => {
|
|
6310
|
+
this._onWillDragPanel.fire(event);
|
|
6311
|
+
}), view.model.onGroupDragStart((event) => {
|
|
6312
|
+
this._onWillDragGroup.fire(event);
|
|
6313
|
+
}), view.model.onMove((event) => {
|
|
6210
6314
|
const { groupId, itemId, target, index } = event;
|
|
6211
6315
|
this.moveGroupOrPanel(view, groupId, itemId, target, index);
|
|
6212
6316
|
}), view.model.onDidDrop((event) => {
|
|
@@ -6245,13 +6349,6 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
6245
6349
|
var _a;
|
|
6246
6350
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
6247
6351
|
}
|
|
6248
|
-
dispose() {
|
|
6249
|
-
this._onDidActivePanelChange.dispose();
|
|
6250
|
-
this._onDidAddPanel.dispose();
|
|
6251
|
-
this._onDidRemovePanel.dispose();
|
|
6252
|
-
this._onDidLayoutFromJSON.dispose();
|
|
6253
|
-
super.dispose();
|
|
6254
|
-
}
|
|
6255
6352
|
}
|
|
6256
6353
|
|
|
6257
6354
|
class GridviewComponent extends BaseGrid {
|
|
@@ -7549,6 +7646,7 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7549
7646
|
createRightHeaderActionsElement: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
|
|
7550
7647
|
singleTabMode: props.singleTabMode,
|
|
7551
7648
|
disableFloatingGroups: props.disableFloatingGroups,
|
|
7649
|
+
floatingGroupBounds: props.floatingGroupBounds,
|
|
7552
7650
|
});
|
|
7553
7651
|
const { clientWidth, clientHeight } = domRef.current;
|
|
7554
7652
|
dockview.layout(clientWidth, clientHeight);
|
|
@@ -7583,6 +7681,14 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7583
7681
|
frameworkComponents: props.components,
|
|
7584
7682
|
});
|
|
7585
7683
|
}, [props.components]);
|
|
7684
|
+
React__namespace.useEffect(() => {
|
|
7685
|
+
if (!dockviewRef.current) {
|
|
7686
|
+
return;
|
|
7687
|
+
}
|
|
7688
|
+
dockviewRef.current.updateOptions({
|
|
7689
|
+
floatingGroupBounds: props.floatingGroupBounds,
|
|
7690
|
+
});
|
|
7691
|
+
}, [props.floatingGroupBounds]);
|
|
7586
7692
|
React__namespace.useEffect(() => {
|
|
7587
7693
|
if (!dockviewRef.current) {
|
|
7588
7694
|
return;
|
|
@@ -7689,25 +7795,32 @@ define(['exports', 'react', 'react-dom'], (function (exports, React, ReactDOM) {
|
|
|
7689
7795
|
React__namespace.createElement("path", { d: "M2.1 27.3L0 25.2L11.55 13.65L0 2.1L2.1 0L13.65 11.55L25.2 0L27.3 2.1L15.75 13.65L27.3 25.2L25.2 27.3L13.65 15.75L2.1 27.3Z" })));
|
|
7690
7796
|
|
|
7691
7797
|
const DockviewDefaultTab = (_a) => {
|
|
7692
|
-
var { api, containerApi: _containerApi, params: _params } = _a, rest = __rest(_a, ["api", "containerApi", "params"]);
|
|
7798
|
+
var { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride } = _a, rest = __rest(_a, ["api", "containerApi", "params", "hideClose", "closeActionOverride"]);
|
|
7693
7799
|
const onClose = React__namespace.useCallback((event) => {
|
|
7694
|
-
event.
|
|
7695
|
-
|
|
7696
|
-
|
|
7800
|
+
event.preventDefault();
|
|
7801
|
+
if (closeActionOverride) {
|
|
7802
|
+
closeActionOverride();
|
|
7803
|
+
}
|
|
7804
|
+
else {
|
|
7805
|
+
api.close();
|
|
7806
|
+
}
|
|
7807
|
+
}, [api, closeActionOverride]);
|
|
7808
|
+
const onMouseDown = React__namespace.useCallback((e) => {
|
|
7809
|
+
e.preventDefault();
|
|
7810
|
+
}, []);
|
|
7697
7811
|
const onClick = React__namespace.useCallback((event) => {
|
|
7812
|
+
if (event.defaultPrevented) {
|
|
7813
|
+
return;
|
|
7814
|
+
}
|
|
7698
7815
|
api.setActive();
|
|
7699
7816
|
if (rest.onClick) {
|
|
7700
7817
|
rest.onClick(event);
|
|
7701
7818
|
}
|
|
7702
7819
|
}, [api, rest.onClick]);
|
|
7703
|
-
|
|
7704
|
-
const cn = ['dockview-react-tab-action'];
|
|
7705
|
-
return cn.join(',');
|
|
7706
|
-
}, []);
|
|
7707
|
-
return (React__namespace.createElement("div", Object.assign({}, rest, { onClick: onClick, className: "dockview-react-tab" }),
|
|
7820
|
+
return (React__namespace.createElement("div", Object.assign({ "data-testid": "dockview-default-tab" }, rest, { onClick: onClick, className: "dockview-react-tab" }),
|
|
7708
7821
|
React__namespace.createElement("span", { className: "dockview-react-tab-title" }, api.title),
|
|
7709
|
-
React__namespace.createElement("div", { className:
|
|
7710
|
-
React__namespace.createElement(CloseButton, null))));
|
|
7822
|
+
!hideClose && (React__namespace.createElement("div", { className: "dv-react-tab-close-btn", onMouseDown: onMouseDown, onClick: onClose },
|
|
7823
|
+
React__namespace.createElement(CloseButton, null)))));
|
|
7711
7824
|
};
|
|
7712
7825
|
|
|
7713
7826
|
class ReactPanelView extends SplitviewPanel {
|