dockview-core
Advanced tools
Comparing version 1.10.0 to 1.10.1
@@ -377,11 +377,19 @@ import { IDockviewComponent, SerializedDockview } from '../dockview/dockviewComponent'; | ||
/** | ||
* Invoked before an overlay is shown indicating a drop target. | ||
* | ||
* Calling `event.preventDefault()` will prevent the overlay being shown and prevent | ||
* the any subsequent drop event. | ||
*/ | ||
get onWillShowOverlay(): Event<WillShowOverlayLocationEvent>; | ||
/** | ||
* Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality. | ||
* Invoked before a group is dragged. | ||
* | ||
* Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting. | ||
* | ||
*/ | ||
get onWillDragGroup(): Event<GroupDragEvent>; | ||
/** | ||
* Invoked before a panel is dragged. Exposed for custom Drag'n'Drop functionality. | ||
* Invoked before a panel is dragged. | ||
* | ||
* Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting. | ||
*/ | ||
@@ -388,0 +396,0 @@ get onWillDragPanel(): Event<TabDragEvent>; |
@@ -757,3 +757,6 @@ "use strict"; | ||
/** | ||
* Invoked before an overlay is shown indicating a drop target. | ||
* | ||
* Calling `event.preventDefault()` will prevent the overlay being shown and prevent | ||
* the any subsequent drop event. | ||
*/ | ||
@@ -768,3 +771,6 @@ get: function () { | ||
/** | ||
* Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality. | ||
* Invoked before a group is dragged. | ||
* | ||
* Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting. | ||
* | ||
*/ | ||
@@ -779,3 +785,5 @@ get: function () { | ||
/** | ||
* Invoked before a panel is dragged. Exposed for custom Drag'n'Drop functionality. | ||
* Invoked before a panel is dragged. | ||
* | ||
* Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting. | ||
*/ | ||
@@ -782,0 +790,0 @@ get: function () { |
@@ -81,2 +81,3 @@ import { Emitter, Event } from '../events'; | ||
exitMaximized(): void; | ||
private setupGroupEventListeners; | ||
} |
@@ -41,2 +41,3 @@ "use strict"; | ||
_this._group = group; | ||
_this.setupGroupEventListeners(); | ||
_this.addDisposables(_this.groupEventsDisposable, _this._onDidRendererChange, _this._onDidTitleChange, _this._onDidGroupChange, _this._onDidActiveGroupChange, _this._onDidLocationChange); | ||
@@ -78,29 +79,7 @@ return _this; | ||
set: function (value) { | ||
var _this = this; | ||
var isOldGroupActive = this.isGroupActive; | ||
var oldGroup = this._group; | ||
if (this._group !== value) { | ||
this._group = value; | ||
this._onDidGroupChange.fire({}); | ||
var _trackGroupActive_1 = isOldGroupActive; // prevent duplicate events with same state | ||
this.groupEventsDisposable.value = new lifecycle_1.CompositeDisposable(this.group.api.onDidLocationChange(function (event) { | ||
if (_this.group !== _this.panel.group) { | ||
return; | ||
} | ||
_this._onDidLocationChange.fire(event); | ||
}), this.group.api.onDidActiveChange(function () { | ||
if (_this.group !== _this.panel.group) { | ||
return; | ||
} | ||
if (_trackGroupActive_1 !== _this.isGroupActive) { | ||
_trackGroupActive_1 = _this.isGroupActive; | ||
_this._onDidActiveGroupChange.fire({ | ||
isActive: _this.isGroupActive, | ||
}); | ||
} | ||
})); | ||
// if (this.isGroupActive !== isOldGroupActive) { | ||
// this._onDidActiveGroupChange.fire({ | ||
// isActive: this.isGroupActive, | ||
// }); | ||
// } | ||
this.setupGroupEventListeners(oldGroup); | ||
this._onDidLocationChange.fire({ | ||
@@ -146,4 +125,34 @@ location: this.group.api.location, | ||
}; | ||
DockviewPanelApiImpl.prototype.setupGroupEventListeners = function (previousGroup) { | ||
var _this = this; | ||
var _a; | ||
var _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state | ||
this.groupEventsDisposable.value = new lifecycle_1.CompositeDisposable(this.group.api.onDidVisibilityChange(function (event) { | ||
if (!event.isVisible && _this.isVisible) { | ||
_this._onDidVisibilityChange.fire(event); | ||
} | ||
else if (event.isVisible && | ||
!_this.isVisible && | ||
_this.group.model.isPanelActive(_this.panel)) { | ||
_this._onDidVisibilityChange.fire(event); | ||
} | ||
}), this.group.api.onDidLocationChange(function (event) { | ||
if (_this.group !== _this.panel.group) { | ||
return; | ||
} | ||
_this._onDidLocationChange.fire(event); | ||
}), this.group.api.onDidActiveChange(function () { | ||
if (_this.group !== _this.panel.group) { | ||
return; | ||
} | ||
if (_trackGroupActive !== _this.isGroupActive) { | ||
_trackGroupActive = _this.isGroupActive; | ||
_this._onDidActiveGroupChange.fire({ | ||
isActive: _this.isGroupActive, | ||
}); | ||
} | ||
})); | ||
}; | ||
return DockviewPanelApiImpl; | ||
}(gridviewPanelApi_1.GridviewPanelApiImpl)); | ||
exports.DockviewPanelApiImpl = DockviewPanelApiImpl; |
@@ -14,5 +14,2 @@ import { DockviewEvent, Emitter, Event } from '../events'; | ||
} | ||
export interface HiddenEvent { | ||
readonly isHidden: boolean; | ||
} | ||
export interface ActiveEvent { | ||
@@ -26,4 +23,4 @@ readonly isActive: boolean; | ||
readonly onDidActiveChange: Event<ActiveEvent>; | ||
readonly onDidHiddenChange: Event<HiddenEvent>; | ||
setActive(): void; | ||
setVisible(isVisible: boolean): void; | ||
updateParameters(parameters: Parameters): void; | ||
@@ -47,6 +44,2 @@ /** | ||
/** | ||
* Whether the panel is hidden | ||
*/ | ||
readonly isHidden: boolean; | ||
/** | ||
* The panel width in pixels | ||
@@ -72,3 +65,2 @@ */ | ||
private _isVisible; | ||
private _isHidden; | ||
private _width; | ||
@@ -85,4 +77,4 @@ private _height; | ||
readonly onDidVisibilityChange: Event<VisibilityEvent>; | ||
readonly _onDidHiddenChange: Emitter<HiddenEvent>; | ||
readonly onDidHiddenChange: Event<HiddenEvent>; | ||
readonly _onWillVisibilityChange: Emitter<VisibilityEvent>; | ||
readonly onWillVisibilityChange: Event<VisibilityEvent>; | ||
readonly _onDidActiveChange: Emitter<ActiveEvent>; | ||
@@ -97,3 +89,2 @@ readonly onDidActiveChange: Event<ActiveEvent>; | ||
get isVisible(): boolean; | ||
get isHidden(): boolean; | ||
get width(): number; | ||
@@ -103,5 +94,5 @@ get height(): number; | ||
initialize(panel: IPanel): void; | ||
setHidden(isHidden: boolean): void; | ||
setVisible(isVisible: boolean): void; | ||
setActive(): void; | ||
updateParameters(parameters: Parameters): void; | ||
} |
@@ -40,3 +40,2 @@ "use strict"; | ||
_this._isVisible = true; | ||
_this._isHidden = false; | ||
_this._width = 0; | ||
@@ -55,4 +54,4 @@ _this._height = 0; | ||
_this.onDidVisibilityChange = _this._onDidVisibilityChange.event; | ||
_this._onDidHiddenChange = new events_1.Emitter(); | ||
_this.onDidHiddenChange = _this._onDidHiddenChange.event; | ||
_this._onWillVisibilityChange = new events_1.Emitter(); | ||
_this.onWillVisibilityChange = _this._onWillVisibilityChange.event; | ||
_this._onDidActiveChange = new events_1.Emitter(); | ||
@@ -70,8 +69,6 @@ _this.onDidActiveChange = _this._onDidActiveChange.event; | ||
_this._isVisible = event.isVisible; | ||
}), _this.onDidHiddenChange(function (event) { | ||
_this._isHidden = event.isHidden; | ||
}), _this.onDidDimensionsChange(function (event) { | ||
_this._width = event.width; | ||
_this._height = event.height; | ||
}), _this.panelUpdatesDisposable, _this._onDidDimensionChange, _this._onDidChangeFocus, _this._onDidVisibilityChange, _this._onDidActiveChange, _this._onWillFocus, _this._onActiveChange, _this._onUpdateParameters, _this._onWillFocus, _this._onDidHiddenChange, _this._onUpdateParameters); | ||
}), _this.panelUpdatesDisposable, _this._onDidDimensionChange, _this._onDidChangeFocus, _this._onDidVisibilityChange, _this._onDidActiveChange, _this._onWillFocus, _this._onActiveChange, _this._onUpdateParameters, _this._onWillFocus, _this._onWillVisibilityChange, _this._onUpdateParameters); | ||
return _this; | ||
@@ -100,9 +97,2 @@ } | ||
}); | ||
Object.defineProperty(PanelApiImpl.prototype, "isHidden", { | ||
get: function () { | ||
return this._isHidden; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(PanelApiImpl.prototype, "width", { | ||
@@ -129,4 +119,4 @@ get: function () { | ||
}; | ||
PanelApiImpl.prototype.setHidden = function (isHidden) { | ||
this._onDidHiddenChange.fire({ isHidden: isHidden }); | ||
PanelApiImpl.prototype.setVisible = function (isVisible) { | ||
this._onWillVisibilityChange.fire({ isVisible: isVisible }); | ||
}; | ||
@@ -133,0 +123,0 @@ PanelApiImpl.prototype.setActive = function () { |
@@ -67,3 +67,3 @@ "use strict"; | ||
} | ||
return _this.group.canDisplayOverlay(event, position, 'panel'); | ||
return _this.group.canDisplayOverlay(event, position, 'content'); | ||
}, | ||
@@ -70,0 +70,0 @@ }); |
@@ -57,3 +57,3 @@ "use strict"; | ||
} | ||
return group.model.canDisplayOverlay(event, position, 'panel'); | ||
return group.model.canDisplayOverlay(event, position, 'header_space'); | ||
}, | ||
@@ -60,0 +60,0 @@ }); |
@@ -10,3 +10,2 @@ import { DockviewApi } from '../api/component.api'; | ||
import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer'; | ||
import { DockviewDropTargets } from './types'; | ||
import { DockviewGroupPanel } from './dockviewGroupPanel'; | ||
@@ -73,3 +72,3 @@ import { IDockviewPanel } from './dockviewPanel'; | ||
export type DockviewGroupPanelLocked = boolean | 'no-drop-target'; | ||
export type DockviewGroupDropLocation = 'tab' | 'header_space' | 'content'; | ||
export type DockviewGroupDropLocation = 'tab' | 'header_space' | 'content' | 'edge'; | ||
export interface IDockviewGroupPanelModel extends IPanel { | ||
@@ -111,3 +110,3 @@ readonly isActive: boolean; | ||
}): void; | ||
canDisplayOverlay(event: DragEvent, position: Position, target: DockviewDropTargets): boolean; | ||
canDisplayOverlay(event: DragEvent, position: Position, target: DockviewGroupDropLocation): boolean; | ||
} | ||
@@ -231,3 +230,3 @@ export type DockviewGroupLocation = { | ||
private updateContainer; | ||
canDisplayOverlay(event: DragEvent, position: Position, target: DockviewDropTargets): boolean; | ||
canDisplayOverlay(event: DragEvent, position: Position, target: DockviewGroupDropLocation): boolean; | ||
private handleDropEvent; | ||
@@ -234,0 +233,0 @@ dispose(): void; |
import { DockviewApi } from '../api/component.api'; | ||
import { Direction } from '../gridview/baseComponentGridview'; | ||
import { IGridView } from '../gridview/gridview'; | ||
import { IContentRenderer, ITabRenderer, WatermarkConstructor, IWatermarkRenderer, DockviewDropTargets } from './types'; | ||
import { IContentRenderer, ITabRenderer, WatermarkConstructor, IWatermarkRenderer } from './types'; | ||
import { Parameters } from '../panel/types'; | ||
@@ -11,3 +11,3 @@ import { DockviewGroupPanel } from './dockviewGroupPanel'; | ||
import { DroptargetOverlayModel, Position } from '../dnd/droptarget'; | ||
import { GroupOptions } from './dockviewGroupPanelModel'; | ||
import { DockviewGroupDropLocation, GroupOptions } from './dockviewGroupPanelModel'; | ||
import { IDockviewPanel } from './dockviewPanel'; | ||
@@ -54,3 +54,3 @@ import { ComponentConstructor, FrameworkFactory } from '../panel/componentFactory'; | ||
nativeEvent: DragEvent; | ||
target: DockviewDropTargets; | ||
target: DockviewGroupDropLocation; | ||
position: Position; | ||
@@ -57,0 +57,0 @@ group?: DockviewGroupPanel; |
@@ -9,3 +9,2 @@ import { IDockviewComponent } from './dockviewComponent'; | ||
import { DockviewPanelRenderer } from '../overlayRenderContainer'; | ||
export type DockviewDropTargets = 'tab' | 'panel' | 'tabContainer' | 'edge'; | ||
export interface HeaderPartInitParameters { | ||
@@ -12,0 +11,0 @@ title: string; |
@@ -61,6 +61,6 @@ "use strict"; | ||
_this.api.initialize(_this); // TODO: required to by-pass 'super before this' requirement | ||
_this.addDisposables(_this.api.onDidHiddenChange(function (event) { | ||
var isHidden = event.isHidden; | ||
_this.addDisposables(_this.api.onWillVisibilityChange(function (event) { | ||
var isVisible = event.isVisible; | ||
var accessor = _this._params.accessor; | ||
accessor.setVisible(_this, !isHidden); | ||
accessor.setVisible(_this, isVisible); | ||
}), _this.api.onActiveChange(function () { | ||
@@ -67,0 +67,0 @@ var accessor = _this._params.accessor; |
export interface IDisposable { | ||
dispose: () => void; | ||
dispose(): void; | ||
} | ||
@@ -4,0 +4,0 @@ export interface IValueDisposable<T> { |
@@ -29,2 +29,3 @@ import { Orientation, ISplitViewDescriptor, Sizing } from '../splitview/splitview'; | ||
}); | ||
setViewVisible(index: number, visible: boolean): void; | ||
addPane(pane: PaneviewPanel, size?: number | Sizing, index?: number, skipLayout?: boolean): void; | ||
@@ -31,0 +32,0 @@ getViewSize(index: number): number; |
@@ -117,2 +117,5 @@ "use strict"; | ||
}); | ||
Paneview.prototype.setViewVisible = function (index, visible) { | ||
this.splitview.setViewVisible(index, visible); | ||
}; | ||
Paneview.prototype.addPane = function (pane, size, index, skipLayout) { | ||
@@ -119,0 +122,0 @@ var _this = this; |
@@ -87,2 +87,3 @@ import { Event } from '../events'; | ||
updateOptions(options: Partial<PaneviewComponentOptions>): void; | ||
setVisible(panel: IPaneviewPanel, visible: boolean): void; | ||
clear(): void; | ||
@@ -116,2 +117,3 @@ } | ||
constructor(options: PaneviewComponentOptions); | ||
setVisible(panel: PaneviewPanel, visible: boolean): void; | ||
focus(): void; | ||
@@ -118,0 +120,0 @@ updateOptions(options: Partial<PaneviewComponentOptions>): void; |
@@ -183,2 +183,6 @@ "use strict"; | ||
}); | ||
PaneviewComponent.prototype.setVisible = function (panel, visible) { | ||
var index = this.panels.indexOf(panel); | ||
this.paneview.setViewVisible(index, visible); | ||
}; | ||
PaneviewComponent.prototype.focus = function () { | ||
@@ -230,2 +234,3 @@ //noop | ||
containerApi: new component_api_1.PaneviewApi(this), | ||
accessor: this, | ||
}); | ||
@@ -334,2 +339,3 @@ this.paneview.addPane(view, size, index); | ||
containerApi: new component_api_1.PaneviewApi(_this), | ||
accessor: _this, | ||
}); | ||
@@ -336,0 +342,0 @@ panel.orientation = _this.paneview.orientation; |
@@ -8,2 +8,3 @@ import { PaneviewApi } from '../api/component.api'; | ||
import { IView, Orientation } from '../splitview/splitview'; | ||
import { PaneviewComponent } from './paneviewComponent'; | ||
export interface PanePanelViewState extends BasePanelViewState { | ||
@@ -19,2 +20,3 @@ headerComponent?: string; | ||
containerApi: PaneviewApi; | ||
accessor: PaneviewComponent; | ||
} | ||
@@ -21,0 +23,0 @@ export interface PanePanelComponentInitParameter extends PanePanelInitParameter { |
@@ -74,3 +74,7 @@ "use strict"; | ||
_this.element.classList.add('pane'); | ||
_this.addDisposables(_this.api.onDidSizeChange(function (event) { | ||
_this.addDisposables(_this.api.onWillVisibilityChange(function (event) { | ||
var isVisible = event.isVisible; | ||
var accessor = _this._params.accessor; | ||
accessor.setVisible(_this, isVisible); | ||
}), _this.api.onDidSizeChange(function (event) { | ||
_this._onDidChange.fire({ size: event.size }); | ||
@@ -77,0 +81,0 @@ }), (0, events_1.addDisposableListener)(_this.element, 'mouseenter', function (ev) { |
@@ -91,3 +91,3 @@ import { IDisposable } from '../lifecycle'; | ||
setVisible(panel: SplitviewPanel, visible: boolean): void; | ||
setActive(view: SplitviewPanel, skipFocus?: boolean): void; | ||
setActive(panel: SplitviewPanel, skipFocus?: boolean): void; | ||
removePanel(panel: SplitviewPanel, sizing?: Sizing): void; | ||
@@ -94,0 +94,0 @@ getPanel(id: string): SplitviewPanel | undefined; |
@@ -186,6 +186,6 @@ "use strict"; | ||
}; | ||
SplitviewComponent.prototype.setActive = function (view, skipFocus) { | ||
this._activePanel = view; | ||
SplitviewComponent.prototype.setActive = function (panel, skipFocus) { | ||
this._activePanel = panel; | ||
this.panels | ||
.filter(function (v) { return v !== view; }) | ||
.filter(function (v) { return v !== panel; }) | ||
.forEach(function (v) { | ||
@@ -197,5 +197,5 @@ v.api._onDidActiveChange.fire({ isActive: false }); | ||
}); | ||
view.api._onDidActiveChange.fire({ isActive: true }); | ||
panel.api._onDidActiveChange.fire({ isActive: true }); | ||
if (!skipFocus) { | ||
view.focus(); | ||
panel.focus(); | ||
} | ||
@@ -202,0 +202,0 @@ }; |
@@ -62,6 +62,6 @@ "use strict"; | ||
_this.api.initialize(_this); | ||
_this.addDisposables(_this._onDidChange, _this.api.onDidHiddenChange(function (event) { | ||
var isHidden = event.isHidden; | ||
_this.addDisposables(_this._onDidChange, _this.api.onWillVisibilityChange(function (event) { | ||
var isVisible = event.isVisible; | ||
var accessor = _this._params.accessor; | ||
accessor.setVisible(_this, !isHidden); | ||
accessor.setVisible(_this, isVisible); | ||
}), _this.api.onActiveChange(function () { | ||
@@ -68,0 +68,0 @@ var accessor = _this._params.accessor; |
@@ -377,11 +377,19 @@ import { IDockviewComponent, SerializedDockview } from '../dockview/dockviewComponent'; | ||
/** | ||
* Invoked before an overlay is shown indicating a drop target. | ||
* | ||
* Calling `event.preventDefault()` will prevent the overlay being shown and prevent | ||
* the any subsequent drop event. | ||
*/ | ||
get onWillShowOverlay(): Event<WillShowOverlayLocationEvent>; | ||
/** | ||
* Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality. | ||
* Invoked before a group is dragged. | ||
* | ||
* Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting. | ||
* | ||
*/ | ||
get onWillDragGroup(): Event<GroupDragEvent>; | ||
/** | ||
* Invoked before a panel is dragged. Exposed for custom Drag'n'Drop functionality. | ||
* Invoked before a panel is dragged. | ||
* | ||
* Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting. | ||
*/ | ||
@@ -388,0 +396,0 @@ get onWillDragPanel(): Event<TabDragEvent>; |
@@ -519,3 +519,6 @@ import { Emitter } from '../events'; | ||
/** | ||
* Invoked before an overlay is shown indicating a drop target. | ||
* | ||
* Calling `event.preventDefault()` will prevent the overlay being shown and prevent | ||
* the any subsequent drop event. | ||
*/ | ||
@@ -526,3 +529,6 @@ get onWillShowOverlay() { | ||
/** | ||
* Invoked before a group is dragged. Exposed for custom Drag'n'Drop functionality. | ||
* Invoked before a group is dragged. | ||
* | ||
* Calling `event.nativeEvent.preventDefault()` will prevent the group drag starting. | ||
* | ||
*/ | ||
@@ -533,3 +539,5 @@ get onWillDragGroup() { | ||
/** | ||
* Invoked before a panel is dragged. Exposed for custom Drag'n'Drop functionality. | ||
* Invoked before a panel is dragged. | ||
* | ||
* Calling `event.nativeEvent.preventDefault()` will prevent the panel drag starting. | ||
*/ | ||
@@ -536,0 +544,0 @@ get onWillDragPanel() { |
@@ -81,2 +81,3 @@ import { Emitter, Event } from '../events'; | ||
exitMaximized(): void; | ||
private setupGroupEventListeners; | ||
} |
@@ -18,28 +18,7 @@ import { Emitter } from '../events'; | ||
set group(value) { | ||
const isOldGroupActive = this.isGroupActive; | ||
const oldGroup = this._group; | ||
if (this._group !== value) { | ||
this._group = value; | ||
this._onDidGroupChange.fire({}); | ||
let _trackGroupActive = isOldGroupActive; // prevent duplicate events with same state | ||
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidLocationChange((event) => { | ||
if (this.group !== this.panel.group) { | ||
return; | ||
} | ||
this._onDidLocationChange.fire(event); | ||
}), this.group.api.onDidActiveChange(() => { | ||
if (this.group !== this.panel.group) { | ||
return; | ||
} | ||
if (_trackGroupActive !== this.isGroupActive) { | ||
_trackGroupActive = this.isGroupActive; | ||
this._onDidActiveGroupChange.fire({ | ||
isActive: this.isGroupActive, | ||
}); | ||
} | ||
})); | ||
// if (this.isGroupActive !== isOldGroupActive) { | ||
// this._onDidActiveGroupChange.fire({ | ||
// isActive: this.isGroupActive, | ||
// }); | ||
// } | ||
this.setupGroupEventListeners(oldGroup); | ||
this._onDidLocationChange.fire({ | ||
@@ -70,2 +49,3 @@ location: this.group.api.location, | ||
this._group = group; | ||
this.setupGroupEventListeners(); | ||
this.addDisposables(this.groupEventsDisposable, this._onDidRendererChange, this._onDidTitleChange, this._onDidGroupChange, this._onDidActiveGroupChange, this._onDidLocationChange); | ||
@@ -105,2 +85,31 @@ } | ||
} | ||
setupGroupEventListeners(previousGroup) { | ||
var _a; | ||
let _trackGroupActive = (_a = previousGroup === null || previousGroup === void 0 ? void 0 : previousGroup.isActive) !== null && _a !== void 0 ? _a : false; // prevent duplicate events with same state | ||
this.groupEventsDisposable.value = new CompositeDisposable(this.group.api.onDidVisibilityChange((event) => { | ||
if (!event.isVisible && this.isVisible) { | ||
this._onDidVisibilityChange.fire(event); | ||
} | ||
else if (event.isVisible && | ||
!this.isVisible && | ||
this.group.model.isPanelActive(this.panel)) { | ||
this._onDidVisibilityChange.fire(event); | ||
} | ||
}), this.group.api.onDidLocationChange((event) => { | ||
if (this.group !== this.panel.group) { | ||
return; | ||
} | ||
this._onDidLocationChange.fire(event); | ||
}), this.group.api.onDidActiveChange(() => { | ||
if (this.group !== this.panel.group) { | ||
return; | ||
} | ||
if (_trackGroupActive !== this.isGroupActive) { | ||
_trackGroupActive = this.isGroupActive; | ||
this._onDidActiveGroupChange.fire({ | ||
isActive: this.isGroupActive, | ||
}); | ||
} | ||
})); | ||
} | ||
} |
@@ -14,5 +14,2 @@ import { DockviewEvent, Emitter, Event } from '../events'; | ||
} | ||
export interface HiddenEvent { | ||
readonly isHidden: boolean; | ||
} | ||
export interface ActiveEvent { | ||
@@ -26,4 +23,4 @@ readonly isActive: boolean; | ||
readonly onDidActiveChange: Event<ActiveEvent>; | ||
readonly onDidHiddenChange: Event<HiddenEvent>; | ||
setActive(): void; | ||
setVisible(isVisible: boolean): void; | ||
updateParameters(parameters: Parameters): void; | ||
@@ -47,6 +44,2 @@ /** | ||
/** | ||
* Whether the panel is hidden | ||
*/ | ||
readonly isHidden: boolean; | ||
/** | ||
* The panel width in pixels | ||
@@ -72,3 +65,2 @@ */ | ||
private _isVisible; | ||
private _isHidden; | ||
private _width; | ||
@@ -85,4 +77,4 @@ private _height; | ||
readonly onDidVisibilityChange: Event<VisibilityEvent>; | ||
readonly _onDidHiddenChange: Emitter<HiddenEvent>; | ||
readonly onDidHiddenChange: Event<HiddenEvent>; | ||
readonly _onWillVisibilityChange: Emitter<VisibilityEvent>; | ||
readonly onWillVisibilityChange: Event<VisibilityEvent>; | ||
readonly _onDidActiveChange: Emitter<ActiveEvent>; | ||
@@ -97,3 +89,2 @@ readonly onDidActiveChange: Event<ActiveEvent>; | ||
get isVisible(): boolean; | ||
get isHidden(): boolean; | ||
get width(): number; | ||
@@ -103,5 +94,5 @@ get height(): number; | ||
initialize(panel: IPanel): void; | ||
setHidden(isHidden: boolean): void; | ||
setVisible(isVisible: boolean): void; | ||
setActive(): void; | ||
updateParameters(parameters: Parameters): void; | ||
} |
@@ -21,5 +21,2 @@ import { DockviewEvent, Emitter } from '../events'; | ||
} | ||
get isHidden() { | ||
return this._isHidden; | ||
} | ||
get width() { | ||
@@ -37,3 +34,2 @@ return this._width; | ||
this._isVisible = true; | ||
this._isHidden = false; | ||
this._width = 0; | ||
@@ -52,4 +48,4 @@ this._height = 0; | ||
this.onDidVisibilityChange = this._onDidVisibilityChange.event; | ||
this._onDidHiddenChange = new Emitter(); | ||
this.onDidHiddenChange = this._onDidHiddenChange.event; | ||
this._onWillVisibilityChange = new Emitter(); | ||
this.onWillVisibilityChange = this._onWillVisibilityChange.event; | ||
this._onDidActiveChange = new Emitter(); | ||
@@ -67,8 +63,6 @@ this.onDidActiveChange = this._onDidActiveChange.event; | ||
this._isVisible = event.isVisible; | ||
}), this.onDidHiddenChange((event) => { | ||
this._isHidden = event.isHidden; | ||
}), this.onDidDimensionsChange((event) => { | ||
this._width = event.width; | ||
this._height = event.height; | ||
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onDidHiddenChange, this._onUpdateParameters); | ||
}), this.panelUpdatesDisposable, this._onDidDimensionChange, this._onDidChangeFocus, this._onDidVisibilityChange, this._onDidActiveChange, this._onWillFocus, this._onActiveChange, this._onUpdateParameters, this._onWillFocus, this._onWillVisibilityChange, this._onUpdateParameters); | ||
} | ||
@@ -82,4 +76,4 @@ initialize(panel) { | ||
} | ||
setHidden(isHidden) { | ||
this._onDidHiddenChange.fire({ isHidden }); | ||
setVisible(isVisible) { | ||
this._onWillVisibilityChange.fire({ isVisible }); | ||
} | ||
@@ -86,0 +80,0 @@ setActive() { |
@@ -51,3 +51,3 @@ import { CompositeDisposable, MutableDisposable, } from '../../../lifecycle'; | ||
} | ||
return this.group.canDisplayOverlay(event, position, 'panel'); | ||
return this.group.canDisplayOverlay(event, position, 'content'); | ||
}, | ||
@@ -54,0 +54,0 @@ }); |
@@ -41,3 +41,3 @@ import { last } from '../../../array'; | ||
} | ||
return group.model.canDisplayOverlay(event, position, 'panel'); | ||
return group.model.canDisplayOverlay(event, position, 'header_space'); | ||
}, | ||
@@ -44,0 +44,0 @@ }); |
@@ -10,3 +10,2 @@ import { DockviewApi } from '../api/component.api'; | ||
import { GroupDragEvent, TabDragEvent } from './components/titlebar/tabsContainer'; | ||
import { DockviewDropTargets } from './types'; | ||
import { DockviewGroupPanel } from './dockviewGroupPanel'; | ||
@@ -73,3 +72,3 @@ import { IDockviewPanel } from './dockviewPanel'; | ||
export type DockviewGroupPanelLocked = boolean | 'no-drop-target'; | ||
export type DockviewGroupDropLocation = 'tab' | 'header_space' | 'content'; | ||
export type DockviewGroupDropLocation = 'tab' | 'header_space' | 'content' | 'edge'; | ||
export interface IDockviewGroupPanelModel extends IPanel { | ||
@@ -111,3 +110,3 @@ readonly isActive: boolean; | ||
}): void; | ||
canDisplayOverlay(event: DragEvent, position: Position, target: DockviewDropTargets): boolean; | ||
canDisplayOverlay(event: DragEvent, position: Position, target: DockviewGroupDropLocation): boolean; | ||
} | ||
@@ -231,3 +230,3 @@ export type DockviewGroupLocation = { | ||
private updateContainer; | ||
canDisplayOverlay(event: DragEvent, position: Position, target: DockviewDropTargets): boolean; | ||
canDisplayOverlay(event: DragEvent, position: Position, target: DockviewGroupDropLocation): boolean; | ||
private handleDropEvent; | ||
@@ -234,0 +233,0 @@ dispose(): void; |
import { DockviewApi } from '../api/component.api'; | ||
import { Direction } from '../gridview/baseComponentGridview'; | ||
import { IGridView } from '../gridview/gridview'; | ||
import { IContentRenderer, ITabRenderer, WatermarkConstructor, IWatermarkRenderer, DockviewDropTargets } from './types'; | ||
import { IContentRenderer, ITabRenderer, WatermarkConstructor, IWatermarkRenderer } from './types'; | ||
import { Parameters } from '../panel/types'; | ||
@@ -11,3 +11,3 @@ import { DockviewGroupPanel } from './dockviewGroupPanel'; | ||
import { DroptargetOverlayModel, Position } from '../dnd/droptarget'; | ||
import { GroupOptions } from './dockviewGroupPanelModel'; | ||
import { DockviewGroupDropLocation, GroupOptions } from './dockviewGroupPanelModel'; | ||
import { IDockviewPanel } from './dockviewPanel'; | ||
@@ -54,3 +54,3 @@ import { ComponentConstructor, FrameworkFactory } from '../panel/componentFactory'; | ||
nativeEvent: DragEvent; | ||
target: DockviewDropTargets; | ||
target: DockviewGroupDropLocation; | ||
position: Position; | ||
@@ -57,0 +57,0 @@ group?: DockviewGroupPanel; |
@@ -9,3 +9,2 @@ import { IDockviewComponent } from './dockviewComponent'; | ||
import { DockviewPanelRenderer } from '../overlayRenderContainer'; | ||
export type DockviewDropTargets = 'tab' | 'panel' | 'tabContainer' | 'edge'; | ||
export interface HeaderPartInitParameters { | ||
@@ -12,0 +11,0 @@ title: string; |
@@ -80,6 +80,6 @@ import { BasePanelView, } from './basePanelView'; | ||
this.api.initialize(this); // TODO: required to by-pass 'super before this' requirement | ||
this.addDisposables(this.api.onDidHiddenChange((event) => { | ||
const { isHidden } = event; | ||
this.addDisposables(this.api.onWillVisibilityChange((event) => { | ||
const { isVisible } = event; | ||
const { accessor } = this._params; | ||
accessor.setVisible(this, !isHidden); | ||
accessor.setVisible(this, isVisible); | ||
}), this.api.onActiveChange(() => { | ||
@@ -86,0 +86,0 @@ const { accessor } = this._params; |
export interface IDisposable { | ||
dispose: () => void; | ||
dispose(): void; | ||
} | ||
@@ -4,0 +4,0 @@ export interface IValueDisposable<T> { |
@@ -29,2 +29,3 @@ import { Orientation, ISplitViewDescriptor, Sizing } from '../splitview/splitview'; | ||
}); | ||
setViewVisible(index: number, visible: boolean): void; | ||
addPane(pane: PaneviewPanel, size?: number | Sizing, index?: number, skipLayout?: boolean): void; | ||
@@ -31,0 +32,0 @@ getViewSize(index: number): number; |
@@ -69,2 +69,5 @@ import { Splitview, Orientation, } from '../splitview/splitview'; | ||
} | ||
setViewVisible(index, visible) { | ||
this.splitview.setViewVisible(index, visible); | ||
} | ||
addPane(pane, size, index = this.splitview.length, skipLayout = false) { | ||
@@ -71,0 +74,0 @@ const disposable = pane.onDidChangeExpansionState(() => { |
@@ -87,2 +87,3 @@ import { Event } from '../events'; | ||
updateOptions(options: Partial<PaneviewComponentOptions>): void; | ||
setVisible(panel: IPaneviewPanel, visible: boolean): void; | ||
clear(): void; | ||
@@ -116,2 +117,3 @@ } | ||
constructor(options: PaneviewComponentOptions); | ||
setVisible(panel: PaneviewPanel, visible: boolean): void; | ||
focus(): void; | ||
@@ -118,0 +120,0 @@ updateOptions(options: Partial<PaneviewComponentOptions>): void; |
@@ -88,2 +88,6 @@ import { PaneviewApi } from '../api/component.api'; | ||
} | ||
setVisible(panel, visible) { | ||
const index = this.panels.indexOf(panel); | ||
this.paneview.setViewVisible(index, visible); | ||
} | ||
focus() { | ||
@@ -135,2 +139,3 @@ //noop | ||
containerApi: new PaneviewApi(this), | ||
accessor: this, | ||
}); | ||
@@ -235,2 +240,3 @@ this.paneview.addPane(view, size, index); | ||
containerApi: new PaneviewApi(this), | ||
accessor: this, | ||
}); | ||
@@ -237,0 +243,0 @@ panel.orientation = this.paneview.orientation; |
@@ -8,2 +8,3 @@ import { PaneviewApi } from '../api/component.api'; | ||
import { IView, Orientation } from '../splitview/splitview'; | ||
import { PaneviewComponent } from './paneviewComponent'; | ||
export interface PanePanelViewState extends BasePanelViewState { | ||
@@ -19,2 +20,3 @@ headerComponent?: string; | ||
containerApi: PaneviewApi; | ||
accessor: PaneviewComponent; | ||
} | ||
@@ -21,0 +23,0 @@ export interface PanePanelComponentInitParameter extends PanePanelInitParameter { |
@@ -75,3 +75,7 @@ import { PaneviewPanelApiImpl } from '../api/paneviewPanelApi'; | ||
this.element.classList.add('pane'); | ||
this.addDisposables(this.api.onDidSizeChange((event) => { | ||
this.addDisposables(this.api.onWillVisibilityChange((event) => { | ||
const { isVisible } = event; | ||
const { accessor } = this._params; | ||
accessor.setVisible(this, isVisible); | ||
}), this.api.onDidSizeChange((event) => { | ||
this._onDidChange.fire({ size: event.size }); | ||
@@ -78,0 +82,0 @@ }), addDisposableListener(this.element, 'mouseenter', (ev) => { |
@@ -91,3 +91,3 @@ import { IDisposable } from '../lifecycle'; | ||
setVisible(panel: SplitviewPanel, visible: boolean): void; | ||
setActive(view: SplitviewPanel, skipFocus?: boolean): void; | ||
setActive(panel: SplitviewPanel, skipFocus?: boolean): void; | ||
removePanel(panel: SplitviewPanel, sizing?: Sizing): void; | ||
@@ -94,0 +94,0 @@ getPanel(id: string): SplitviewPanel | undefined; |
@@ -89,6 +89,6 @@ import { CompositeDisposable, MutableDisposable, } from '../lifecycle'; | ||
} | ||
setActive(view, skipFocus) { | ||
this._activePanel = view; | ||
setActive(panel, skipFocus) { | ||
this._activePanel = panel; | ||
this.panels | ||
.filter((v) => v !== view) | ||
.filter((v) => v !== panel) | ||
.forEach((v) => { | ||
@@ -100,5 +100,5 @@ v.api._onDidActiveChange.fire({ isActive: false }); | ||
}); | ||
view.api._onDidActiveChange.fire({ isActive: true }); | ||
panel.api._onDidActiveChange.fire({ isActive: true }); | ||
if (!skipFocus) { | ||
view.focus(); | ||
panel.focus(); | ||
} | ||
@@ -105,0 +105,0 @@ } |
@@ -48,6 +48,6 @@ import { BasePanelView, } from '../gridview/basePanelView'; | ||
this.api.initialize(this); | ||
this.addDisposables(this._onDidChange, this.api.onDidHiddenChange((event) => { | ||
const { isHidden } = event; | ||
this.addDisposables(this._onDidChange, this.api.onWillVisibilityChange((event) => { | ||
const { isVisible } = event; | ||
const { accessor } = this._params; | ||
accessor.setVisible(this, !isHidden); | ||
accessor.setVisible(this, isVisible); | ||
}), this.api.onActiveChange(() => { | ||
@@ -54,0 +54,0 @@ const { accessor } = this._params; |
{ | ||
"name": "dockview-core", | ||
"version": "1.10.0", | ||
"version": "1.10.1", | ||
"description": "Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11794748
89415