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
package/dist/dockview.cjs.js
CHANGED
|
@@ -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
|
*/
|
|
@@ -56,7 +56,7 @@ function styleInject(css, ref) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
var css_248z = "@import \"dockview-core/dist/styles/dockview.css\";\n.tab .dockview-react-tab {\n display: flex;\n padding: 0px 8px;\n align-items: center;\n height: 100%;\n}\n.tab .dockview-react-tab .dockview-react-tab-title {\n padding: 0px 8px;\n flex-grow: 1;\n}\n.tab .dockview-react-tab .
|
|
59
|
+
var css_248z = "@import \"dockview-core/dist/styles/dockview.css\";\n.tab .dockview-react-tab {\n display: flex;\n padding: 0px 8px;\n align-items: center;\n height: 100%;\n}\n.tab .dockview-react-tab .dockview-react-tab-title {\n padding: 0px 8px;\n flex-grow: 1;\n}\n.tab .dockview-react-tab .dv-react-tab-close-btn {\n padding: 4px;\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n}\n.tab .dockview-react-tab .dv-react-tab-close-btn:hover {\n border-radius: 2px;\n background-color: var(--dv-icon-hover-background-color);\n}\n.tab.inactive-tab:not(:hover) .dv-react-tab-close-btn {\n visibility: hidden;\n}\n.dockview-react-part {\n height: 100%;\n width: 100%;\n}";
|
|
60
60
|
styleInject(css_248z);
|
|
61
61
|
|
|
62
62
|
class TransferObject {
|
|
@@ -293,9 +293,6 @@ class CompositeDisposable {
|
|
|
293
293
|
get isDisposed() {
|
|
294
294
|
return this._isDisposed;
|
|
295
295
|
}
|
|
296
|
-
static from(...args) {
|
|
297
|
-
return new CompositeDisposable(...args);
|
|
298
|
-
}
|
|
299
296
|
constructor(...args) {
|
|
300
297
|
this._isDisposed = false;
|
|
301
298
|
this._disposables = args;
|
|
@@ -2499,6 +2496,12 @@ class DockviewApi {
|
|
|
2499
2496
|
get onDidDrop() {
|
|
2500
2497
|
return this.component.onDidDrop;
|
|
2501
2498
|
}
|
|
2499
|
+
get onWillDragGroup() {
|
|
2500
|
+
return this.component.onWillDragGroup;
|
|
2501
|
+
}
|
|
2502
|
+
get onWillDragPanel() {
|
|
2503
|
+
return this.component.onWillDragPanel;
|
|
2504
|
+
}
|
|
2502
2505
|
get panels() {
|
|
2503
2506
|
return this.component.panels;
|
|
2504
2507
|
}
|
|
@@ -2961,7 +2964,7 @@ class DragHandler extends CompositeDisposable {
|
|
|
2961
2964
|
}
|
|
2962
2965
|
configure() {
|
|
2963
2966
|
this.addDisposables(this._onDragStart, addDisposableListener(this.el, 'dragstart', (event) => {
|
|
2964
|
-
if (this.isCancelled(event)) {
|
|
2967
|
+
if (event.defaultPrevented || this.isCancelled(event)) {
|
|
2965
2968
|
event.preventDefault();
|
|
2966
2969
|
return;
|
|
2967
2970
|
}
|
|
@@ -2981,19 +2984,23 @@ class DragHandler extends CompositeDisposable {
|
|
|
2981
2984
|
}
|
|
2982
2985
|
this.el.classList.add('dv-dragged');
|
|
2983
2986
|
setTimeout(() => this.el.classList.remove('dv-dragged'), 0);
|
|
2984
|
-
this.dataDisposable.value = this.getData(event
|
|
2987
|
+
this.dataDisposable.value = this.getData(event);
|
|
2988
|
+
this._onDragStart.fire(event);
|
|
2985
2989
|
if (event.dataTransfer) {
|
|
2986
2990
|
event.dataTransfer.effectAllowed = 'move';
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2991
|
+
const hasData = event.dataTransfer.items.length > 0;
|
|
2992
|
+
if (!hasData) {
|
|
2993
|
+
/**
|
|
2994
|
+
* Although this is not used by dockview many third party dnd libraries will check
|
|
2995
|
+
* dataTransfer.types to determine valid drag events.
|
|
2996
|
+
*
|
|
2997
|
+
* For example: in react-dnd if dataTransfer.types is not set then the dragStart event will be cancelled
|
|
2998
|
+
* through .preventDefault(). Since this is applied globally to all drag events this would break dockviews
|
|
2999
|
+
* dnd logic. You can see the code at
|
|
3000
|
+
* https://github.com/react-dnd/react-dnd/blob/main/packages/backend-html5/src/HTML5BackendImpl.ts#L542
|
|
3001
|
+
*/
|
|
3002
|
+
event.dataTransfer.setData('text/plain', '__dockview_internal_drag_event__');
|
|
3003
|
+
}
|
|
2997
3004
|
}
|
|
2998
3005
|
}), addDisposableListener(this.el, 'dragend', () => {
|
|
2999
3006
|
this.pointerEventsDisposable.dispose();
|
|
@@ -3002,44 +3009,45 @@ class DragHandler extends CompositeDisposable {
|
|
|
3002
3009
|
}
|
|
3003
3010
|
}
|
|
3004
3011
|
|
|
3012
|
+
class TabDragHandler extends DragHandler {
|
|
3013
|
+
constructor(element, accessor, group, panel) {
|
|
3014
|
+
super(element);
|
|
3015
|
+
this.accessor = accessor;
|
|
3016
|
+
this.group = group;
|
|
3017
|
+
this.panel = panel;
|
|
3018
|
+
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
3019
|
+
}
|
|
3020
|
+
getData(event) {
|
|
3021
|
+
this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, this.panel.id)], PanelTransfer.prototype);
|
|
3022
|
+
return {
|
|
3023
|
+
dispose: () => {
|
|
3024
|
+
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
3025
|
+
},
|
|
3026
|
+
};
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3005
3029
|
class Tab extends CompositeDisposable {
|
|
3006
3030
|
get element() {
|
|
3007
3031
|
return this._element;
|
|
3008
3032
|
}
|
|
3009
|
-
constructor(
|
|
3033
|
+
constructor(panel, accessor, group) {
|
|
3010
3034
|
super();
|
|
3011
|
-
this.
|
|
3035
|
+
this.panel = panel;
|
|
3012
3036
|
this.accessor = accessor;
|
|
3013
3037
|
this.group = group;
|
|
3038
|
+
this.content = undefined;
|
|
3014
3039
|
this._onChanged = new Emitter();
|
|
3015
3040
|
this.onChanged = this._onChanged.event;
|
|
3016
3041
|
this._onDropped = new Emitter();
|
|
3017
3042
|
this.onDrop = this._onDropped.event;
|
|
3043
|
+
this._onDragStart = new Emitter();
|
|
3044
|
+
this.onDragStart = this._onDragStart.event;
|
|
3018
3045
|
this._element = document.createElement('div');
|
|
3019
3046
|
this._element.className = 'tab';
|
|
3020
3047
|
this._element.tabIndex = 0;
|
|
3021
3048
|
this._element.draggable = true;
|
|
3022
3049
|
toggleClass(this.element, 'inactive-tab', true);
|
|
3023
|
-
this.
|
|
3024
|
-
constructor() {
|
|
3025
|
-
super(...arguments);
|
|
3026
|
-
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
3027
|
-
}
|
|
3028
|
-
getData() {
|
|
3029
|
-
this.panelTransfer.setData([new PanelTransfer(accessor.id, group.id, panelId)], PanelTransfer.prototype);
|
|
3030
|
-
return {
|
|
3031
|
-
dispose: () => {
|
|
3032
|
-
this.panelTransfer.clearData(PanelTransfer.prototype);
|
|
3033
|
-
},
|
|
3034
|
-
};
|
|
3035
|
-
}
|
|
3036
|
-
})(this._element));
|
|
3037
|
-
this.addDisposables(addDisposableListener(this._element, 'mousedown', (event) => {
|
|
3038
|
-
if (event.defaultPrevented) {
|
|
3039
|
-
return;
|
|
3040
|
-
}
|
|
3041
|
-
this._onChanged.fire(event);
|
|
3042
|
-
}));
|
|
3050
|
+
const dragHandler = new TabDragHandler(this._element, this.accessor, this.group, this.panel);
|
|
3043
3051
|
this.droptarget = new Droptarget(this._element, {
|
|
3044
3052
|
acceptedTargetZones: ['center'],
|
|
3045
3053
|
canDisplayOverlay: (event, position) => {
|
|
@@ -3053,12 +3061,19 @@ class Tab extends CompositeDisposable {
|
|
|
3053
3061
|
// don't allow group move to drop on self
|
|
3054
3062
|
return false;
|
|
3055
3063
|
}
|
|
3056
|
-
return this.
|
|
3064
|
+
return this.panel.id !== data.panelId;
|
|
3057
3065
|
}
|
|
3058
3066
|
return this.group.model.canDisplayOverlay(event, position, exports.DockviewDropTargets.Tab);
|
|
3059
3067
|
},
|
|
3060
3068
|
});
|
|
3061
|
-
this.addDisposables(this.
|
|
3069
|
+
this.addDisposables(this._onChanged, this._onDropped, this._onDragStart, dragHandler.onDragStart((event) => {
|
|
3070
|
+
this._onDragStart.fire(event);
|
|
3071
|
+
}), dragHandler, addDisposableListener(this._element, 'mousedown', (event) => {
|
|
3072
|
+
if (event.defaultPrevented) {
|
|
3073
|
+
return;
|
|
3074
|
+
}
|
|
3075
|
+
this._onChanged.fire(event);
|
|
3076
|
+
}), this.droptarget.onDrop((event) => {
|
|
3062
3077
|
this._onDropped.fire(event);
|
|
3063
3078
|
}), this.droptarget);
|
|
3064
3079
|
}
|
|
@@ -3090,9 +3105,9 @@ function addGhostImage(dataTransfer, ghostElement) {
|
|
|
3090
3105
|
}
|
|
3091
3106
|
|
|
3092
3107
|
class GroupDragHandler extends DragHandler {
|
|
3093
|
-
constructor(element,
|
|
3108
|
+
constructor(element, accessor, group) {
|
|
3094
3109
|
super(element);
|
|
3095
|
-
this.
|
|
3110
|
+
this.accessor = accessor;
|
|
3096
3111
|
this.group = group;
|
|
3097
3112
|
this.panelTransfer = LocalSelectionTransfer.getInstance();
|
|
3098
3113
|
this.addDisposables(addDisposableListener(element, 'mousedown', (e) => {
|
|
@@ -3112,8 +3127,9 @@ class GroupDragHandler extends DragHandler {
|
|
|
3112
3127
|
}
|
|
3113
3128
|
return false;
|
|
3114
3129
|
}
|
|
3115
|
-
getData(
|
|
3116
|
-
|
|
3130
|
+
getData(dragEvent) {
|
|
3131
|
+
const dataTransfer = dragEvent.dataTransfer;
|
|
3132
|
+
this.panelTransfer.setData([new PanelTransfer(this.accessor.id, this.group.id, null)], PanelTransfer.prototype);
|
|
3117
3133
|
const style = window.getComputedStyle(this.el);
|
|
3118
3134
|
const bgColor = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-background-color');
|
|
3119
3135
|
const color = style.getPropertyValue('--dv-activegroup-visiblepanel-tab-color');
|
|
@@ -3148,14 +3164,16 @@ class VoidContainer extends CompositeDisposable {
|
|
|
3148
3164
|
this.group = group;
|
|
3149
3165
|
this._onDrop = new Emitter();
|
|
3150
3166
|
this.onDrop = this._onDrop.event;
|
|
3167
|
+
this._onDragStart = new Emitter();
|
|
3168
|
+
this.onDragStart = this._onDragStart.event;
|
|
3151
3169
|
this._element = document.createElement('div');
|
|
3152
3170
|
this._element.className = 'void-container';
|
|
3153
3171
|
this._element.tabIndex = 0;
|
|
3154
3172
|
this._element.draggable = true;
|
|
3155
|
-
this.addDisposables(this._onDrop, addDisposableListener(this._element, 'click', () => {
|
|
3173
|
+
this.addDisposables(this._onDrop, this._onDragStart, addDisposableListener(this._element, 'click', () => {
|
|
3156
3174
|
this.accessor.doSetGroupActive(this.group);
|
|
3157
3175
|
}));
|
|
3158
|
-
const handler = new GroupDragHandler(this._element, accessor
|
|
3176
|
+
const handler = new GroupDragHandler(this._element, accessor, group);
|
|
3159
3177
|
this.voidDropTarget = new Droptarget(this._element, {
|
|
3160
3178
|
acceptedTargetZones: ['center'],
|
|
3161
3179
|
canDisplayOverlay: (event, position) => {
|
|
@@ -3173,7 +3191,9 @@ class VoidContainer extends CompositeDisposable {
|
|
|
3173
3191
|
return group.model.canDisplayOverlay(event, position, exports.DockviewDropTargets.Panel);
|
|
3174
3192
|
},
|
|
3175
3193
|
});
|
|
3176
|
-
this.addDisposables(handler,
|
|
3194
|
+
this.addDisposables(handler, handler.onDragStart((event) => {
|
|
3195
|
+
this._onDragStart.fire(event);
|
|
3196
|
+
}), this.voidDropTarget.onDrop((event) => {
|
|
3177
3197
|
this._onDrop.fire(event);
|
|
3178
3198
|
}), this.voidDropTarget);
|
|
3179
3199
|
}
|
|
@@ -3181,7 +3201,7 @@ class VoidContainer extends CompositeDisposable {
|
|
|
3181
3201
|
|
|
3182
3202
|
class TabsContainer extends CompositeDisposable {
|
|
3183
3203
|
get panels() {
|
|
3184
|
-
return this.tabs.map((_) => _.value.
|
|
3204
|
+
return this.tabs.map((_) => _.value.panel.id);
|
|
3185
3205
|
}
|
|
3186
3206
|
get size() {
|
|
3187
3207
|
return this.tabs.length;
|
|
@@ -3235,7 +3255,7 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3235
3255
|
this.tabs[this.selectedIndex].value === tab);
|
|
3236
3256
|
}
|
|
3237
3257
|
indexOf(id) {
|
|
3238
|
-
return this.tabs.findIndex((tab) => tab.value.
|
|
3258
|
+
return this.tabs.findIndex((tab) => tab.value.panel.id === id);
|
|
3239
3259
|
}
|
|
3240
3260
|
constructor(accessor, group) {
|
|
3241
3261
|
super();
|
|
@@ -3246,7 +3266,11 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3246
3266
|
this._hidden = false;
|
|
3247
3267
|
this._onDrop = new Emitter();
|
|
3248
3268
|
this.onDrop = this._onDrop.event;
|
|
3249
|
-
this.
|
|
3269
|
+
this._onTabDragStart = new Emitter();
|
|
3270
|
+
this.onTabDragStart = this._onTabDragStart.event;
|
|
3271
|
+
this._onGroupDragStart = new Emitter();
|
|
3272
|
+
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3273
|
+
this.addDisposables(this._onDrop, this._onTabDragStart, this._onGroupDragStart);
|
|
3250
3274
|
this._element = document.createElement('div');
|
|
3251
3275
|
this._element.className = 'tabs-and-actions-container';
|
|
3252
3276
|
toggleClass(this._element, 'dv-full-width-single-tab', this.accessor.options.singleTabMode === 'fullwidth');
|
|
@@ -3270,7 +3294,12 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3270
3294
|
this._element.appendChild(this.leftActionsContainer);
|
|
3271
3295
|
this._element.appendChild(this.voidContainer.element);
|
|
3272
3296
|
this._element.appendChild(this.rightActionsContainer);
|
|
3273
|
-
this.addDisposables(this.voidContainer, this.voidContainer.
|
|
3297
|
+
this.addDisposables(this.voidContainer, this.voidContainer.onDragStart((event) => {
|
|
3298
|
+
this._onGroupDragStart.fire({
|
|
3299
|
+
nativeEvent: event,
|
|
3300
|
+
group: this.group,
|
|
3301
|
+
});
|
|
3302
|
+
}), this.voidContainer.onDrop((event) => {
|
|
3274
3303
|
this._onDrop.fire({
|
|
3275
3304
|
event: event.nativeEvent,
|
|
3276
3305
|
index: this.tabs.length,
|
|
@@ -3316,7 +3345,7 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3316
3345
|
}
|
|
3317
3346
|
}
|
|
3318
3347
|
delete(id) {
|
|
3319
|
-
const index = this.tabs.findIndex((tab) => tab.value.
|
|
3348
|
+
const index = this.tabs.findIndex((tab) => tab.value.panel.id === id);
|
|
3320
3349
|
const tabToRemove = this.tabs.splice(index, 1)[0];
|
|
3321
3350
|
const { value, disposable } = tabToRemove;
|
|
3322
3351
|
disposable.dispose();
|
|
@@ -3325,21 +3354,23 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3325
3354
|
}
|
|
3326
3355
|
setActivePanel(panel) {
|
|
3327
3356
|
this.tabs.forEach((tab) => {
|
|
3328
|
-
const isActivePanel = panel.id === tab.value.
|
|
3357
|
+
const isActivePanel = panel.id === tab.value.panel.id;
|
|
3329
3358
|
tab.value.setActive(isActivePanel);
|
|
3330
3359
|
});
|
|
3331
3360
|
}
|
|
3332
3361
|
openPanel(panel, index = this.tabs.length) {
|
|
3333
3362
|
var _a;
|
|
3334
|
-
if (this.tabs.find((tab) => tab.value.
|
|
3363
|
+
if (this.tabs.find((tab) => tab.value.panel.id === panel.id)) {
|
|
3335
3364
|
return;
|
|
3336
3365
|
}
|
|
3337
|
-
const
|
|
3366
|
+
const tab = new Tab(panel, this.accessor, this.group);
|
|
3338
3367
|
if (!((_a = panel.view) === null || _a === void 0 ? void 0 : _a.tab)) {
|
|
3339
3368
|
throw new Error('invalid header component');
|
|
3340
3369
|
}
|
|
3341
|
-
|
|
3342
|
-
const disposable = CompositeDisposable
|
|
3370
|
+
tab.setContent(panel.view.tab);
|
|
3371
|
+
const disposable = new CompositeDisposable(tab.onDragStart((event) => {
|
|
3372
|
+
this._onTabDragStart.fire({ nativeEvent: event, panel });
|
|
3373
|
+
}), tab.onChanged((event) => {
|
|
3343
3374
|
var _a;
|
|
3344
3375
|
const isFloatingGroupsEnabled = !this.accessor.options.disableFloatingGroups;
|
|
3345
3376
|
const isFloatingWithOnePanel = this.group.api.isFloating && this.size === 1;
|
|
@@ -3347,8 +3378,8 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3347
3378
|
!isFloatingWithOnePanel &&
|
|
3348
3379
|
event.shiftKey) {
|
|
3349
3380
|
event.preventDefault();
|
|
3350
|
-
const panel = this.accessor.getGroupPanel(
|
|
3351
|
-
const { top, left } =
|
|
3381
|
+
const panel = this.accessor.getGroupPanel(tab.panel.id);
|
|
3382
|
+
const { top, left } = tab.element.getBoundingClientRect();
|
|
3352
3383
|
const { top: rootTop, left: rootLeft } = this.accessor.element.getBoundingClientRect();
|
|
3353
3384
|
this.accessor.addFloatingGroup(panel, {
|
|
3354
3385
|
x: left - rootLeft,
|
|
@@ -3365,13 +3396,13 @@ class TabsContainer extends CompositeDisposable {
|
|
|
3365
3396
|
this.group.model.openPanel(panel, {
|
|
3366
3397
|
skipFocus: alreadyFocused,
|
|
3367
3398
|
});
|
|
3368
|
-
}),
|
|
3399
|
+
}), tab.onDrop((event) => {
|
|
3369
3400
|
this._onDrop.fire({
|
|
3370
3401
|
event: event.nativeEvent,
|
|
3371
|
-
index: this.tabs.findIndex((x) => x.value ===
|
|
3402
|
+
index: this.tabs.findIndex((x) => x.value === tab),
|
|
3372
3403
|
});
|
|
3373
3404
|
}));
|
|
3374
|
-
const value = { value:
|
|
3405
|
+
const value = { value: tab, disposable };
|
|
3375
3406
|
this.addTab(value, index);
|
|
3376
3407
|
}
|
|
3377
3408
|
closePanel(panel) {
|
|
@@ -3399,7 +3430,7 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
3399
3430
|
}
|
|
3400
3431
|
set locked(value) {
|
|
3401
3432
|
this._locked = value;
|
|
3402
|
-
toggleClass(this.container, 'locked-groupview', value);
|
|
3433
|
+
toggleClass(this.container, 'locked-groupview', value === 'no-drop-target' || value);
|
|
3403
3434
|
}
|
|
3404
3435
|
get isActive() {
|
|
3405
3436
|
return this._isGroupActive;
|
|
@@ -3456,6 +3487,10 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
3456
3487
|
this.onMove = this._onMove.event;
|
|
3457
3488
|
this._onDidDrop = new Emitter();
|
|
3458
3489
|
this.onDidDrop = this._onDidDrop.event;
|
|
3490
|
+
this._onTabDragStart = new Emitter();
|
|
3491
|
+
this.onTabDragStart = this._onTabDragStart.event;
|
|
3492
|
+
this._onGroupDragStart = new Emitter();
|
|
3493
|
+
this.onGroupDragStart = this._onGroupDragStart.event;
|
|
3459
3494
|
this._onDidAddPanel = new Emitter();
|
|
3460
3495
|
this.onDidAddPanel = this._onDidAddPanel.event;
|
|
3461
3496
|
this._onDidRemovePanel = new Emitter();
|
|
@@ -3468,7 +3503,8 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
3468
3503
|
this.dropTarget = new Droptarget(this.contentContainer.element, {
|
|
3469
3504
|
acceptedTargetZones: ['top', 'bottom', 'left', 'right', 'center'],
|
|
3470
3505
|
canDisplayOverlay: (event, position) => {
|
|
3471
|
-
if (this.locked
|
|
3506
|
+
if (this.locked === 'no-drop-target' ||
|
|
3507
|
+
(this.locked && position === 'center')) {
|
|
3472
3508
|
return false;
|
|
3473
3509
|
}
|
|
3474
3510
|
const data = getPanelData();
|
|
@@ -3494,8 +3530,12 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
3494
3530
|
});
|
|
3495
3531
|
container.append(this.tabsContainer.element, this.contentContainer.element);
|
|
3496
3532
|
this.header.hidden = !!options.hideHeader;
|
|
3497
|
-
this.locked =
|
|
3498
|
-
this.addDisposables(this.tabsContainer.
|
|
3533
|
+
this.locked = options.locked || false;
|
|
3534
|
+
this.addDisposables(this._onTabDragStart, this._onGroupDragStart, this.tabsContainer.onTabDragStart((event) => {
|
|
3535
|
+
this._onTabDragStart.fire(event);
|
|
3536
|
+
}), this.tabsContainer.onGroupDragStart((event) => {
|
|
3537
|
+
this._onGroupDragStart.fire(event);
|
|
3538
|
+
}), this.tabsContainer.onDrop((event) => {
|
|
3499
3539
|
this.handleDropEvent(event.event, 'center', event.index);
|
|
3500
3540
|
}), this.contentContainer.onDidFocus(() => {
|
|
3501
3541
|
this.accessor.doSetGroupActive(this.groupPanel, true);
|
|
@@ -3550,8 +3590,8 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
3550
3590
|
activeView: (_a = this._activePanel) === null || _a === void 0 ? void 0 : _a.id,
|
|
3551
3591
|
id: this.id,
|
|
3552
3592
|
};
|
|
3553
|
-
if (this.locked) {
|
|
3554
|
-
result.locked =
|
|
3593
|
+
if (this.locked !== false) {
|
|
3594
|
+
result.locked = this.locked;
|
|
3555
3595
|
}
|
|
3556
3596
|
if (this.header.hidden) {
|
|
3557
3597
|
result.hideHeader = true;
|
|
@@ -3801,6 +3841,9 @@ class DockviewGroupPanelModel extends CompositeDisposable {
|
|
|
3801
3841
|
return false;
|
|
3802
3842
|
}
|
|
3803
3843
|
handleDropEvent(event, position, index) {
|
|
3844
|
+
if (this.locked === 'no-drop-target') {
|
|
3845
|
+
return;
|
|
3846
|
+
}
|
|
3804
3847
|
const data = getPanelData();
|
|
3805
3848
|
if (data && data.viewId === this.accessor.id) {
|
|
3806
3849
|
if (data.panelId === null) {
|
|
@@ -5258,6 +5301,12 @@ const bringElementToFront = (() => {
|
|
|
5258
5301
|
return pushToTop;
|
|
5259
5302
|
})();
|
|
5260
5303
|
class Overlay extends CompositeDisposable {
|
|
5304
|
+
set minimumInViewportWidth(value) {
|
|
5305
|
+
this.options.minimumInViewportWidth = value;
|
|
5306
|
+
}
|
|
5307
|
+
set minimumInViewportHeight(value) {
|
|
5308
|
+
this.options.minimumInViewportHeight = value;
|
|
5309
|
+
}
|
|
5261
5310
|
constructor(options) {
|
|
5262
5311
|
super();
|
|
5263
5312
|
this.options = options;
|
|
@@ -5303,9 +5352,11 @@ class Overlay extends CompositeDisposable {
|
|
|
5303
5352
|
const overlayRect = this._element.getBoundingClientRect();
|
|
5304
5353
|
// region: ensure bounds within allowable limits
|
|
5305
5354
|
// a minimum width of minimumViewportWidth must be inside the viewport
|
|
5306
|
-
const xOffset = Math.max(0, overlayRect.width
|
|
5355
|
+
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
5307
5356
|
// a minimum height of minimumViewportHeight must be inside the viewport
|
|
5308
|
-
const yOffset =
|
|
5357
|
+
const yOffset = typeof this.options.minimumInViewportHeight === 'number'
|
|
5358
|
+
? Math.max(0, this.getMinimumHeight(overlayRect.height))
|
|
5359
|
+
: 0;
|
|
5309
5360
|
const left = clamp(overlayRect.left - containerRect.left, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
5310
5361
|
const top = clamp(overlayRect.top - containerRect.top, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
5311
5362
|
this._element.style.left = `${left}px`;
|
|
@@ -5351,9 +5402,10 @@ class Overlay extends CompositeDisposable {
|
|
|
5351
5402
|
y: e.clientY - overlayRect.top,
|
|
5352
5403
|
};
|
|
5353
5404
|
}
|
|
5354
|
-
const xOffset = Math.max(0, overlayRect.width
|
|
5355
|
-
const yOffset = Math.max(0,
|
|
5356
|
-
this.
|
|
5405
|
+
const xOffset = Math.max(0, this.getMinimumWidth(overlayRect.width));
|
|
5406
|
+
const yOffset = Math.max(0, this.options.minimumInViewportHeight
|
|
5407
|
+
? this.getMinimumHeight(overlayRect.height)
|
|
5408
|
+
: 0);
|
|
5357
5409
|
const left = clamp(x - offset.x, -xOffset, Math.max(0, containerRect.width - overlayRect.width + xOffset));
|
|
5358
5410
|
const top = clamp(y - offset.y, -yOffset, Math.max(0, containerRect.height - overlayRect.height + yOffset));
|
|
5359
5411
|
this.setBounds({ top, left });
|
|
@@ -5427,14 +5479,11 @@ class Overlay extends CompositeDisposable {
|
|
|
5427
5479
|
let height = undefined;
|
|
5428
5480
|
let left = undefined;
|
|
5429
5481
|
let width = undefined;
|
|
5430
|
-
const
|
|
5431
|
-
const minimumInViewportWidth = this.options.minimumInViewportWidth;
|
|
5432
|
-
function moveTop() {
|
|
5482
|
+
const moveTop = () => {
|
|
5433
5483
|
top = clamp(y, -Number.MAX_VALUE, startPosition.originalY +
|
|
5434
5484
|
startPosition.originalHeight >
|
|
5435
5485
|
containerRect.height
|
|
5436
|
-
? containerRect.height
|
|
5437
|
-
minimumInViewportHeight
|
|
5486
|
+
? this.getMinimumHeight(containerRect.height)
|
|
5438
5487
|
: Math.max(0, startPosition.originalY +
|
|
5439
5488
|
startPosition.originalHeight -
|
|
5440
5489
|
Overlay.MINIMUM_HEIGHT));
|
|
@@ -5442,21 +5491,23 @@ class Overlay extends CompositeDisposable {
|
|
|
5442
5491
|
startPosition.originalY +
|
|
5443
5492
|
startPosition.originalHeight -
|
|
5444
5493
|
top;
|
|
5445
|
-
}
|
|
5446
|
-
|
|
5494
|
+
};
|
|
5495
|
+
const moveBottom = () => {
|
|
5447
5496
|
top =
|
|
5448
5497
|
startPosition.originalY -
|
|
5449
5498
|
startPosition.originalHeight;
|
|
5450
|
-
height = clamp(y - top, top < 0
|
|
5451
|
-
|
|
5499
|
+
height = clamp(y - top, top < 0 &&
|
|
5500
|
+
typeof this.options
|
|
5501
|
+
.minimumInViewportHeight === 'number'
|
|
5502
|
+
? -top +
|
|
5503
|
+
this.options.minimumInViewportHeight
|
|
5452
5504
|
: Overlay.MINIMUM_HEIGHT, Number.MAX_VALUE);
|
|
5453
|
-
}
|
|
5454
|
-
|
|
5505
|
+
};
|
|
5506
|
+
const moveLeft = () => {
|
|
5455
5507
|
left = clamp(x, -Number.MAX_VALUE, startPosition.originalX +
|
|
5456
5508
|
startPosition.originalWidth >
|
|
5457
5509
|
containerRect.width
|
|
5458
|
-
? containerRect.width
|
|
5459
|
-
minimumInViewportWidth
|
|
5510
|
+
? this.getMinimumWidth(containerRect.width)
|
|
5460
5511
|
: Math.max(0, startPosition.originalX +
|
|
5461
5512
|
startPosition.originalWidth -
|
|
5462
5513
|
Overlay.MINIMUM_WIDTH));
|
|
@@ -5464,15 +5515,18 @@ class Overlay extends CompositeDisposable {
|
|
|
5464
5515
|
startPosition.originalX +
|
|
5465
5516
|
startPosition.originalWidth -
|
|
5466
5517
|
left;
|
|
5467
|
-
}
|
|
5468
|
-
|
|
5518
|
+
};
|
|
5519
|
+
const moveRight = () => {
|
|
5469
5520
|
left =
|
|
5470
5521
|
startPosition.originalX -
|
|
5471
5522
|
startPosition.originalWidth;
|
|
5472
|
-
width = clamp(x - left, left < 0
|
|
5473
|
-
|
|
5523
|
+
width = clamp(x - left, left < 0 &&
|
|
5524
|
+
typeof this.options
|
|
5525
|
+
.minimumInViewportWidth === 'number'
|
|
5526
|
+
? -left +
|
|
5527
|
+
this.options.minimumInViewportWidth
|
|
5474
5528
|
: Overlay.MINIMUM_WIDTH, Number.MAX_VALUE);
|
|
5475
|
-
}
|
|
5529
|
+
};
|
|
5476
5530
|
switch (direction) {
|
|
5477
5531
|
case 'top':
|
|
5478
5532
|
moveTop();
|
|
@@ -5516,6 +5570,18 @@ class Overlay extends CompositeDisposable {
|
|
|
5516
5570
|
}));
|
|
5517
5571
|
}));
|
|
5518
5572
|
}
|
|
5573
|
+
getMinimumWidth(width) {
|
|
5574
|
+
if (typeof this.options.minimumInViewportWidth === 'number') {
|
|
5575
|
+
return width - this.options.minimumInViewportWidth;
|
|
5576
|
+
}
|
|
5577
|
+
return 0;
|
|
5578
|
+
}
|
|
5579
|
+
getMinimumHeight(height) {
|
|
5580
|
+
if (typeof this.options.minimumInViewportHeight === 'number') {
|
|
5581
|
+
return height - this.options.minimumInViewportHeight;
|
|
5582
|
+
}
|
|
5583
|
+
return height;
|
|
5584
|
+
}
|
|
5519
5585
|
dispose() {
|
|
5520
5586
|
this._element.remove();
|
|
5521
5587
|
super.dispose();
|
|
@@ -5536,6 +5602,7 @@ class DockviewFloatingGroupPanel extends CompositeDisposable {
|
|
|
5536
5602
|
}
|
|
5537
5603
|
}
|
|
5538
5604
|
|
|
5605
|
+
const DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE = 100;
|
|
5539
5606
|
class DockviewComponent extends BaseGrid {
|
|
5540
5607
|
get orientation() {
|
|
5541
5608
|
return this.gridview.orientation;
|
|
@@ -5566,6 +5633,10 @@ class DockviewComponent extends BaseGrid {
|
|
|
5566
5633
|
this.nextGroupId = sequentialNumberGenerator();
|
|
5567
5634
|
this._deserializer = new DefaultDockviewDeserialzier(this);
|
|
5568
5635
|
this.watermark = null;
|
|
5636
|
+
this._onWillDragPanel = new Emitter();
|
|
5637
|
+
this.onWillDragPanel = this._onWillDragPanel.event;
|
|
5638
|
+
this._onWillDragGroup = new Emitter();
|
|
5639
|
+
this.onWillDragGroup = this._onWillDragGroup.event;
|
|
5569
5640
|
this._onDidDrop = new Emitter();
|
|
5570
5641
|
this.onDidDrop = this._onDidDrop.event;
|
|
5571
5642
|
this._onDidRemovePanel = new Emitter();
|
|
@@ -5578,7 +5649,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
5578
5649
|
this.onDidActivePanelChange = this._onDidActivePanelChange.event;
|
|
5579
5650
|
this.floatingGroups = [];
|
|
5580
5651
|
toggleClass(this.gridview.element, 'dv-dockview', true);
|
|
5581
|
-
this.addDisposables(this._onDidDrop, exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
|
|
5652
|
+
this.addDisposables(this._onWillDragPanel, this._onWillDragGroup, this._onDidActivePanelChange, this._onDidAddPanel, this._onDidRemovePanel, this._onDidLayoutFromJSON, this._onDidDrop, exports.DockviewEvent.any(this.onDidAddGroup, this.onDidRemoveGroup)(() => {
|
|
5582
5653
|
this.updateWatermark();
|
|
5583
5654
|
}), exports.DockviewEvent.any(this.onDidAddPanel, this.onDidRemovePanel, this.onDidActivePanelChange)(() => {
|
|
5584
5655
|
this._bufferOnDidLayoutChange.fire();
|
|
@@ -5615,7 +5686,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
5615
5686
|
return true;
|
|
5616
5687
|
}
|
|
5617
5688
|
if (this.options.showDndOverlay) {
|
|
5618
|
-
if (position === 'center') {
|
|
5689
|
+
if (position === 'center' && this.gridview.length !== 0) {
|
|
5619
5690
|
/**
|
|
5620
5691
|
* for external events only show the four-corner drag overlays, disable
|
|
5621
5692
|
* the center position so that external drag events can fall through to the group
|
|
@@ -5651,7 +5722,7 @@ class DockviewComponent extends BaseGrid {
|
|
|
5651
5722
|
this.updateWatermark();
|
|
5652
5723
|
}
|
|
5653
5724
|
addFloatingGroup(item, coord, options) {
|
|
5654
|
-
var _a, _b;
|
|
5725
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5655
5726
|
let group;
|
|
5656
5727
|
if (item instanceof DockviewPanel) {
|
|
5657
5728
|
group = this.createGroup();
|
|
@@ -5679,8 +5750,12 @@ class DockviewComponent extends BaseGrid {
|
|
|
5679
5750
|
width: (_b = coord === null || coord === void 0 ? void 0 : coord.width) !== null && _b !== void 0 ? _b : 300,
|
|
5680
5751
|
left: overlayLeft,
|
|
5681
5752
|
top: overlayTop,
|
|
5682
|
-
minimumInViewportWidth:
|
|
5683
|
-
|
|
5753
|
+
minimumInViewportWidth: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
5754
|
+
? undefined
|
|
5755
|
+
: (_d = (_c = this.options.floatingGroupBounds) === null || _c === void 0 ? void 0 : _c.minimumWidthWithinViewport) !== null && _d !== void 0 ? _d : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
5756
|
+
minimumInViewportHeight: this.options.floatingGroupBounds === 'boundedWithinViewport'
|
|
5757
|
+
? undefined
|
|
5758
|
+
: (_f = (_e = this.options.floatingGroupBounds) === null || _e === void 0 ? void 0 : _e.minimumHeightWithinViewport) !== null && _f !== void 0 ? _f : DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE,
|
|
5684
5759
|
});
|
|
5685
5760
|
const el = group.element.querySelector('.void-container');
|
|
5686
5761
|
if (!el) {
|
|
@@ -5751,12 +5826,37 @@ class DockviewComponent extends BaseGrid {
|
|
|
5751
5826
|
}
|
|
5752
5827
|
}
|
|
5753
5828
|
updateOptions(options) {
|
|
5829
|
+
var _a, _b;
|
|
5754
5830
|
const hasOrientationChanged = typeof options.orientation === 'string' &&
|
|
5755
5831
|
this.gridview.orientation !== options.orientation;
|
|
5832
|
+
const hasFloatingGroupOptionsChanged = options.floatingGroupBounds !== undefined &&
|
|
5833
|
+
options.floatingGroupBounds !== this.options.floatingGroupBounds;
|
|
5756
5834
|
this._options = Object.assign(Object.assign({}, this.options), options);
|
|
5757
5835
|
if (hasOrientationChanged) {
|
|
5758
5836
|
this.gridview.orientation = options.orientation;
|
|
5759
5837
|
}
|
|
5838
|
+
if (hasFloatingGroupOptionsChanged) {
|
|
5839
|
+
for (const group of this.floatingGroups) {
|
|
5840
|
+
switch (this.options.floatingGroupBounds) {
|
|
5841
|
+
case 'boundedWithinViewport':
|
|
5842
|
+
group.overlay.minimumInViewportHeight = undefined;
|
|
5843
|
+
group.overlay.minimumInViewportWidth = undefined;
|
|
5844
|
+
break;
|
|
5845
|
+
case undefined:
|
|
5846
|
+
group.overlay.minimumInViewportHeight =
|
|
5847
|
+
DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE;
|
|
5848
|
+
group.overlay.minimumInViewportWidth =
|
|
5849
|
+
DEFAULT_FLOATING_GROUP_OVERFLOW_SIZE;
|
|
5850
|
+
break;
|
|
5851
|
+
default:
|
|
5852
|
+
group.overlay.minimumInViewportHeight =
|
|
5853
|
+
(_a = this.options.floatingGroupBounds) === null || _a === void 0 ? void 0 : _a.minimumHeightWithinViewport;
|
|
5854
|
+
group.overlay.minimumInViewportWidth =
|
|
5855
|
+
(_b = this.options.floatingGroupBounds) === null || _b === void 0 ? void 0 : _b.minimumWidthWithinViewport;
|
|
5856
|
+
}
|
|
5857
|
+
group.overlay.setBounds({});
|
|
5858
|
+
}
|
|
5859
|
+
}
|
|
5760
5860
|
this.layout(this.gridview.width, this.gridview.height, true);
|
|
5761
5861
|
}
|
|
5762
5862
|
layout(width, height, forceResize) {
|
|
@@ -6239,7 +6339,11 @@ class DockviewComponent extends BaseGrid {
|
|
|
6239
6339
|
const view = new DockviewGroupPanel(this, id, options);
|
|
6240
6340
|
view.init({ params: {}, accessor: null }); // required to initialized .part and allow for correct disposal of group
|
|
6241
6341
|
if (!this._groups.has(view.id)) {
|
|
6242
|
-
const disposable = new CompositeDisposable(view.model.
|
|
6342
|
+
const disposable = new CompositeDisposable(view.model.onTabDragStart((event) => {
|
|
6343
|
+
this._onWillDragPanel.fire(event);
|
|
6344
|
+
}), view.model.onGroupDragStart((event) => {
|
|
6345
|
+
this._onWillDragGroup.fire(event);
|
|
6346
|
+
}), view.model.onMove((event) => {
|
|
6243
6347
|
const { groupId, itemId, target, index } = event;
|
|
6244
6348
|
this.moveGroupOrPanel(view, groupId, itemId, target, index);
|
|
6245
6349
|
}), view.model.onDidDrop((event) => {
|
|
@@ -6278,13 +6382,6 @@ class DockviewComponent extends BaseGrid {
|
|
|
6278
6382
|
var _a;
|
|
6279
6383
|
return (_a = Array.from(this._groups.values()).find((group) => group.value.model.containsPanel(panel))) === null || _a === void 0 ? void 0 : _a.value;
|
|
6280
6384
|
}
|
|
6281
|
-
dispose() {
|
|
6282
|
-
this._onDidActivePanelChange.dispose();
|
|
6283
|
-
this._onDidAddPanel.dispose();
|
|
6284
|
-
this._onDidRemovePanel.dispose();
|
|
6285
|
-
this._onDidLayoutFromJSON.dispose();
|
|
6286
|
-
super.dispose();
|
|
6287
|
-
}
|
|
6288
6385
|
}
|
|
6289
6386
|
|
|
6290
6387
|
class GridviewComponent extends BaseGrid {
|
|
@@ -7582,6 +7679,7 @@ const DockviewReact = React__namespace.forwardRef((props, ref) => {
|
|
|
7582
7679
|
createRightHeaderActionsElement: createGroupControlElement(props.rightHeaderActionsComponent, { addPortal }),
|
|
7583
7680
|
singleTabMode: props.singleTabMode,
|
|
7584
7681
|
disableFloatingGroups: props.disableFloatingGroups,
|
|
7682
|
+
floatingGroupBounds: props.floatingGroupBounds,
|
|
7585
7683
|
});
|
|
7586
7684
|
const { clientWidth, clientHeight } = domRef.current;
|
|
7587
7685
|
dockview.layout(clientWidth, clientHeight);
|
|
@@ -7616,6 +7714,14 @@ const DockviewReact = React__namespace.forwardRef((props, ref) => {
|
|
|
7616
7714
|
frameworkComponents: props.components,
|
|
7617
7715
|
});
|
|
7618
7716
|
}, [props.components]);
|
|
7717
|
+
React__namespace.useEffect(() => {
|
|
7718
|
+
if (!dockviewRef.current) {
|
|
7719
|
+
return;
|
|
7720
|
+
}
|
|
7721
|
+
dockviewRef.current.updateOptions({
|
|
7722
|
+
floatingGroupBounds: props.floatingGroupBounds,
|
|
7723
|
+
});
|
|
7724
|
+
}, [props.floatingGroupBounds]);
|
|
7619
7725
|
React__namespace.useEffect(() => {
|
|
7620
7726
|
if (!dockviewRef.current) {
|
|
7621
7727
|
return;
|
|
@@ -7722,25 +7828,32 @@ const CloseButton = () => (React__namespace.createElement("svg", { height: "11",
|
|
|
7722
7828
|
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" })));
|
|
7723
7829
|
|
|
7724
7830
|
const DockviewDefaultTab = (_a) => {
|
|
7725
|
-
var { api, containerApi: _containerApi, params: _params } = _a, rest = __rest(_a, ["api", "containerApi", "params"]);
|
|
7831
|
+
var { api, containerApi: _containerApi, params: _params, hideClose, closeActionOverride } = _a, rest = __rest(_a, ["api", "containerApi", "params", "hideClose", "closeActionOverride"]);
|
|
7726
7832
|
const onClose = React__namespace.useCallback((event) => {
|
|
7727
|
-
event.
|
|
7728
|
-
|
|
7729
|
-
|
|
7833
|
+
event.preventDefault();
|
|
7834
|
+
if (closeActionOverride) {
|
|
7835
|
+
closeActionOverride();
|
|
7836
|
+
}
|
|
7837
|
+
else {
|
|
7838
|
+
api.close();
|
|
7839
|
+
}
|
|
7840
|
+
}, [api, closeActionOverride]);
|
|
7841
|
+
const onMouseDown = React__namespace.useCallback((e) => {
|
|
7842
|
+
e.preventDefault();
|
|
7843
|
+
}, []);
|
|
7730
7844
|
const onClick = React__namespace.useCallback((event) => {
|
|
7845
|
+
if (event.defaultPrevented) {
|
|
7846
|
+
return;
|
|
7847
|
+
}
|
|
7731
7848
|
api.setActive();
|
|
7732
7849
|
if (rest.onClick) {
|
|
7733
7850
|
rest.onClick(event);
|
|
7734
7851
|
}
|
|
7735
7852
|
}, [api, rest.onClick]);
|
|
7736
|
-
|
|
7737
|
-
const cn = ['dockview-react-tab-action'];
|
|
7738
|
-
return cn.join(',');
|
|
7739
|
-
}, []);
|
|
7740
|
-
return (React__namespace.createElement("div", Object.assign({}, rest, { onClick: onClick, className: "dockview-react-tab" }),
|
|
7853
|
+
return (React__namespace.createElement("div", Object.assign({ "data-testid": "dockview-default-tab" }, rest, { onClick: onClick, className: "dockview-react-tab" }),
|
|
7741
7854
|
React__namespace.createElement("span", { className: "dockview-react-tab-title" }, api.title),
|
|
7742
|
-
React__namespace.createElement("div", { className:
|
|
7743
|
-
React__namespace.createElement(CloseButton, null))));
|
|
7855
|
+
!hideClose && (React__namespace.createElement("div", { className: "dv-react-tab-close-btn", onMouseDown: onMouseDown, onClick: onClose },
|
|
7856
|
+
React__namespace.createElement(CloseButton, null)))));
|
|
7744
7857
|
};
|
|
7745
7858
|
|
|
7746
7859
|
class ReactPanelView extends SplitviewPanel {
|