dockview-core
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import { DockviewMaximizedGroupChanged, FloatingGroupOptions, IDockviewComponent, MovePanelEvent, SerializedDockview } from '../dockview/dockviewComponent'; | ||
import { DockviewMaximizedGroupChanged, FloatingGroupOptions, IDockviewComponent, MovePanelEvent, PopoutGroupChangePositionEvent, PopoutGroupChangeSizeEvent, SerializedDockview } from '../dockview/dockviewComponent'; | ||
import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, DockviewDndOverlayEvent, MovementOptions } from '../dockview/options'; | ||
@@ -420,2 +420,4 @@ import { Parameters } from '../panel/types'; | ||
get onUnhandledDragOverEvent(): Event<DockviewDndOverlayEvent>; | ||
get onDidPopoutGroupSizeChange(): Event<PopoutGroupChangeSizeEvent>; | ||
get onDidPopoutGroupPositionChange(): Event<PopoutGroupChangePositionEvent>; | ||
/** | ||
@@ -422,0 +424,0 @@ * All panel objects. |
@@ -820,2 +820,16 @@ "use strict"; | ||
}); | ||
Object.defineProperty(DockviewApi.prototype, "onDidPopoutGroupSizeChange", { | ||
get: function () { | ||
return this.component.onDidPopoutGroupSizeChange; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DockviewApi.prototype, "onDidPopoutGroupPositionChange", { | ||
get: function () { | ||
return this.component.onDidPopoutGroupPositionChange; | ||
}, | ||
enumerable: false, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DockviewApi.prototype, "panels", { | ||
@@ -822,0 +836,0 @@ /** |
@@ -51,3 +51,3 @@ "use strict"; | ||
this._active = wrapper; | ||
this._activeDisposable.value = new lifecycle_1.CompositeDisposable((0, events_1.addDisposableWindowListener)(window, 'pointerdown', function (event) { | ||
this._activeDisposable.value = new lifecycle_1.CompositeDisposable((0, events_1.addDisposableListener)(window, 'pointerdown', function (event) { | ||
var _a; | ||
@@ -54,0 +54,0 @@ var target = event.target; |
@@ -110,2 +110,12 @@ import { SerializedGridObject } from '../gridview/gridview'; | ||
} | ||
export interface PopoutGroupChangeSizeEvent { | ||
width: number; | ||
height: number; | ||
group: DockviewGroupPanel; | ||
} | ||
export interface PopoutGroupChangePositionEvent { | ||
screenX: number; | ||
screenY: number; | ||
group: DockviewGroupPanel; | ||
} | ||
export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> { | ||
@@ -131,2 +141,4 @@ readonly activePanel: IDockviewPanel | undefined; | ||
readonly onDidMaximizedGroupChange: Event<DockviewMaximizedGroupChanged>; | ||
readonly onDidPopoutGroupSizeChange: Event<PopoutGroupChangeSizeEvent>; | ||
readonly onDidPopoutGroupPositionChange: Event<PopoutGroupChangePositionEvent>; | ||
readonly options: DockviewComponentOptions; | ||
@@ -190,2 +202,6 @@ updateOptions(options: DockviewOptions): void; | ||
readonly onDidAddPanel: Event<IDockviewPanel>; | ||
private readonly _onDidPopoutGroupSizeChange; | ||
readonly onDidPopoutGroupSizeChange: Event<PopoutGroupChangeSizeEvent>; | ||
private readonly _onDidPopoutGroupPositionChange; | ||
readonly onDidPopoutGroupPositionChange: Event<PopoutGroupChangePositionEvent>; | ||
private readonly _onDidLayoutFromJSON; | ||
@@ -192,0 +208,0 @@ readonly onDidLayoutFromJSON: Event<void>; |
@@ -1,2 +0,2 @@ | ||
import { Event as DockviewEvent } from './events'; | ||
import { Event as DockviewEvent, Emitter } from './events'; | ||
import { IDisposable, CompositeDisposable } from './lifecycle'; | ||
@@ -18,3 +18,3 @@ export interface OverflowEvent { | ||
export declare function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean; | ||
export declare function getElementsByTagName(tag: string): HTMLElement[]; | ||
export declare function getElementsByTagName(tag: string, document: ParentNode): HTMLElement[]; | ||
export interface IFocusTracker extends IDisposable { | ||
@@ -25,3 +25,3 @@ readonly onDidFocus: DockviewEvent<void>; | ||
} | ||
export declare function trackFocus(element: HTMLElement | Window): IFocusTracker; | ||
export declare function trackFocus(element: HTMLElement): IFocusTracker; | ||
export declare function quasiPreventDefault(event: Event): void; | ||
@@ -42,3 +42,3 @@ export declare function quasiDefaultPrevented(event: Event): boolean; | ||
export declare function addTestId(element: HTMLElement, id: string): void; | ||
export declare function disableIframePointEvents(): { | ||
export declare function disableIframePointEvents(rootNode?: ParentNode): { | ||
release: () => void; | ||
@@ -54,1 +54,3 @@ }; | ||
export declare function isChildEntirelyVisibleWithinParent(child: HTMLElement, parent: HTMLElement): boolean; | ||
export declare function onDidWindowMoveEnd(window: Window): Emitter<void>; | ||
export declare function onDidWindowResizeEnd(element: Window, cb: () => void): CompositeDisposable; |
@@ -28,29 +28,4 @@ "use strict"; | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isChildEntirelyVisibleWithinParent = exports.Classnames = exports.getDockviewTheme = exports.disableIframePointEvents = exports.addTestId = exports.isInDocument = exports.getDomNodePagePosition = exports.addStyles = exports.quasiDefaultPrevented = exports.quasiPreventDefault = exports.trackFocus = exports.getElementsByTagName = exports.isAncestor = exports.toggleClass = exports.addClasses = exports.removeClasses = exports.watchElementResize = exports.OverflowObserver = void 0; | ||
exports.onDidWindowResizeEnd = exports.onDidWindowMoveEnd = exports.isChildEntirelyVisibleWithinParent = exports.Classnames = exports.getDockviewTheme = exports.disableIframePointEvents = exports.addTestId = exports.isInDocument = exports.getDomNodePagePosition = exports.addStyles = exports.quasiDefaultPrevented = exports.quasiPreventDefault = exports.trackFocus = exports.getElementsByTagName = exports.isAncestor = exports.toggleClass = exports.addClasses = exports.removeClasses = exports.watchElementResize = exports.OverflowObserver = void 0; | ||
var events_1 = require("./events"); | ||
@@ -163,4 +138,4 @@ var lifecycle_1 = require("./lifecycle"); | ||
exports.isAncestor = isAncestor; | ||
function getElementsByTagName(tag) { | ||
return Array.prototype.slice.call(document.getElementsByTagName(tag), 0); | ||
function getElementsByTagName(tag, document) { | ||
return Array.prototype.slice.call(document.querySelectorAll(tag), 0); | ||
} | ||
@@ -216,10 +191,4 @@ exports.getElementsByTagName = getElementsByTagName; | ||
}; | ||
if (element instanceof HTMLElement) { | ||
_this.addDisposables((0, events_1.addDisposableListener)(element, 'focus', onFocus, true)); | ||
_this.addDisposables((0, events_1.addDisposableListener)(element, 'blur', onBlur, true)); | ||
} | ||
else { | ||
_this.addDisposables((0, events_1.addDisposableWindowListener)(element, 'focus', onFocus, true)); | ||
_this.addDisposables((0, events_1.addDisposableWindowListener)(element, 'blur', onBlur, true)); | ||
} | ||
_this.addDisposables((0, events_1.addDisposableListener)(element, 'focus', onFocus, true)); | ||
_this.addDisposables((0, events_1.addDisposableListener)(element, 'blur', onBlur, true)); | ||
return _this; | ||
@@ -327,5 +296,39 @@ } | ||
exports.addTestId = addTestId; | ||
function disableIframePointEvents() { | ||
var e_5, _a; | ||
var iframes = __spreadArray(__spreadArray([], __read(getElementsByTagName('iframe')), false), __read(getElementsByTagName('webview')), false); | ||
/** | ||
* Should be more efficient than element.querySelectorAll("*") since there | ||
* is no need to store every element in-memory using this approach | ||
*/ | ||
function allTagsNamesInclusiveOfShadowDoms(tagNames) { | ||
var iframes = []; | ||
function findIframesInNode(node) { | ||
var e_5, _a; | ||
if (node.nodeType === Node.ELEMENT_NODE) { | ||
if (tagNames.includes(node.tagName)) { | ||
iframes.push(node); | ||
} | ||
if (node.shadowRoot) { | ||
findIframesInNode(node.shadowRoot); | ||
} | ||
try { | ||
for (var _b = __values(node.children), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var child = _c.value; | ||
findIframesInNode(child); | ||
} | ||
} | ||
catch (e_5_1) { e_5 = { error: e_5_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
finally { if (e_5) throw e_5.error; } | ||
} | ||
} | ||
} | ||
findIframesInNode(document.documentElement); | ||
return iframes; | ||
} | ||
function disableIframePointEvents(rootNode) { | ||
var e_6, _a; | ||
if (rootNode === void 0) { rootNode = document; } | ||
var iframes = allTagsNamesInclusiveOfShadowDoms(['IFRAME', 'WEBVIEW']); | ||
var original = new WeakMap(); // don't hold onto HTMLElement references longer than required | ||
@@ -339,3 +342,3 @@ try { | ||
} | ||
catch (e_5_1) { e_5 = { error: e_5_1 }; } | ||
catch (e_6_1) { e_6 = { error: e_6_1 }; } | ||
finally { | ||
@@ -345,7 +348,7 @@ try { | ||
} | ||
finally { if (e_5) throw e_5.error; } | ||
finally { if (e_6) throw e_6.error; } | ||
} | ||
return { | ||
release: function () { | ||
var e_6, _a; | ||
var e_7, _a; | ||
var _b; | ||
@@ -358,3 +361,3 @@ try { | ||
} | ||
catch (e_6_1) { e_6 = { error: e_6_1 }; } | ||
catch (e_7_1) { e_7 = { error: e_7_1 }; } | ||
finally { | ||
@@ -364,3 +367,3 @@ try { | ||
} | ||
finally { if (e_6) throw e_6.error; } | ||
finally { if (e_7) throw e_7.error; } | ||
} | ||
@@ -400,3 +403,3 @@ iframes.splice(0, iframes.length); // don't hold onto HTMLElement references longer than required | ||
Classnames.prototype.setClassNames = function (classNames) { | ||
var e_7, _a, e_8, _b; | ||
var e_8, _a, e_9, _b; | ||
try { | ||
@@ -408,3 +411,3 @@ for (var _c = __values(this._classNames), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
} | ||
catch (e_7_1) { e_7 = { error: e_7_1 }; } | ||
catch (e_8_1) { e_8 = { error: e_8_1 }; } | ||
finally { | ||
@@ -414,3 +417,3 @@ try { | ||
} | ||
finally { if (e_7) throw e_7.error; } | ||
finally { if (e_8) throw e_8.error; } | ||
} | ||
@@ -426,3 +429,3 @@ this._classNames = classNames | ||
} | ||
catch (e_8_1) { e_8 = { error: e_8_1 }; } | ||
catch (e_9_1) { e_9 = { error: e_9_1 }; } | ||
finally { | ||
@@ -432,3 +435,3 @@ try { | ||
} | ||
finally { if (e_8) throw e_8.error; } | ||
finally { if (e_9) throw e_9.error; } | ||
} | ||
@@ -439,2 +442,3 @@ }; | ||
exports.Classnames = Classnames; | ||
var DEBOUCE_DELAY = 100; | ||
function isChildEntirelyVisibleWithinParent(child, parent) { | ||
@@ -454,1 +458,38 @@ // | ||
exports.isChildEntirelyVisibleWithinParent = isChildEntirelyVisibleWithinParent; | ||
function onDidWindowMoveEnd(window) { | ||
var emitter = new events_1.Emitter(); | ||
var previousScreenX = window.screenX; | ||
var previousScreenY = window.screenY; | ||
var timeout; | ||
var checkMovement = function () { | ||
if (window.closed) { | ||
return; | ||
} | ||
var currentScreenX = window.screenX; | ||
var currentScreenY = window.screenY; | ||
if (currentScreenX !== previousScreenX || | ||
currentScreenY !== previousScreenY) { | ||
clearTimeout(timeout); | ||
timeout = setTimeout(function () { | ||
emitter.fire(); | ||
}, DEBOUCE_DELAY); | ||
previousScreenX = currentScreenX; | ||
previousScreenY = currentScreenY; | ||
} | ||
requestAnimationFrame(checkMovement); | ||
}; | ||
checkMovement(); | ||
return emitter; | ||
} | ||
exports.onDidWindowMoveEnd = onDidWindowMoveEnd; | ||
function onDidWindowResizeEnd(element, cb) { | ||
var resizeTimeout; | ||
var disposable = new lifecycle_1.CompositeDisposable((0, events_1.addDisposableListener)(element, 'resize', function () { | ||
clearTimeout(resizeTimeout); | ||
resizeTimeout = setTimeout(function () { | ||
cb(); | ||
}, DEBOUCE_DELAY); | ||
})); | ||
return disposable; | ||
} | ||
exports.onDidWindowResizeEnd = onDidWindowResizeEnd; |
@@ -57,3 +57,3 @@ import { IDisposable } from './lifecycle'; | ||
} | ||
export declare function addDisposableWindowListener<K extends keyof WindowEventMap>(element: Window, type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable; | ||
export declare function addDisposableListener<K extends keyof WindowEventMap>(element: Window, type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable; | ||
export declare function addDisposableListener<K extends keyof HTMLElementEventMap>(element: HTMLElement, type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable; | ||
@@ -60,0 +60,0 @@ /** |
@@ -14,3 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AsapEvent = exports.addDisposableListener = exports.addDisposableWindowListener = exports.Emitter = exports.AcceptableEvent = exports.DockviewEvent = exports.Event = void 0; | ||
exports.AsapEvent = exports.addDisposableListener = exports.Emitter = exports.AcceptableEvent = exports.DockviewEvent = exports.Event = void 0; | ||
var Event; | ||
@@ -220,11 +220,2 @@ (function (Event) { | ||
exports.Emitter = Emitter; | ||
function addDisposableWindowListener(element, type, listener, options) { | ||
element.addEventListener(type, listener, options); | ||
return { | ||
dispose: function () { | ||
element.removeEventListener(type, listener, options); | ||
}, | ||
}; | ||
} | ||
exports.addDisposableWindowListener = addDisposableWindowListener; | ||
function addDisposableListener(element, type, listener, options) { | ||
@@ -231,0 +222,0 @@ element.addEventListener(type, listener, options); |
@@ -242,3 +242,3 @@ "use strict"; | ||
}, | ||
}, (0, events_1.addDisposableWindowListener)(window, 'pointermove', function (e) { | ||
}, (0, events_1.addDisposableListener)(window, 'pointermove', function (e) { | ||
var containerRect = _this.options.container.getBoundingClientRect(); | ||
@@ -280,3 +280,3 @@ var x = e.clientX - containerRect.left; | ||
_this.setBounds(bounds); | ||
}), (0, events_1.addDisposableWindowListener)(window, 'pointerup', function () { | ||
}), (0, events_1.addDisposableListener)(window, 'pointerup', function () { | ||
(0, dom_1.toggleClass)(_this._element, 'dv-resize-container-dragging', false); | ||
@@ -327,3 +327,3 @@ move.dispose(); | ||
var iframes = (0, dom_1.disableIframePointEvents)(); | ||
move.value = new lifecycle_1.CompositeDisposable((0, events_1.addDisposableWindowListener)(window, 'pointermove', function (e) { | ||
move.value = new lifecycle_1.CompositeDisposable((0, events_1.addDisposableListener)(window, 'pointermove', function (e) { | ||
var containerRect = _this.options.container.getBoundingClientRect(); | ||
@@ -452,3 +452,3 @@ var overlayRect = _this._element.getBoundingClientRect(); | ||
}, | ||
}, (0, events_1.addDisposableWindowListener)(window, 'pointerup', function () { | ||
}, (0, events_1.addDisposableListener)(window, 'pointerup', function () { | ||
move.dispose(); | ||
@@ -455,0 +455,0 @@ _this._onDidChangeEnd.fire(); |
@@ -15,3 +15,2 @@ import { PaneviewApi } from '../api/component.api'; | ||
export declare abstract class DraggablePaneviewPanel extends PaneviewPanel { | ||
private readonly accessor; | ||
private handler; | ||
@@ -23,5 +22,17 @@ private target; | ||
readonly onUnhandledDragOverEvent: Event<PaneviewDndOverlayEvent>; | ||
constructor(accessor: IPaneviewComponent, id: string, component: string, headerComponent: string | undefined, orientation: Orientation, isExpanded: boolean, disableDnd: boolean); | ||
readonly accessor: IPaneviewComponent; | ||
constructor(options: { | ||
accessor: IPaneviewComponent; | ||
id: string; | ||
component: string; | ||
headerComponent: string | undefined; | ||
orientation: Orientation; | ||
isExpanded: boolean; | ||
disableDnd: boolean; | ||
headerSize: number; | ||
minimumBodySize: number; | ||
maximumBodySize: number; | ||
}); | ||
private initDragFeatures; | ||
private onDrop; | ||
} |
@@ -39,5 +39,14 @@ "use strict"; | ||
__extends(DraggablePaneviewPanel, _super); | ||
function DraggablePaneviewPanel(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) { | ||
var _this = _super.call(this, id, component, headerComponent, orientation, isExpanded, true) || this; | ||
_this.accessor = accessor; | ||
function DraggablePaneviewPanel(options) { | ||
var _this = _super.call(this, { | ||
id: options.id, | ||
component: options.component, | ||
headerComponent: options.headerComponent, | ||
orientation: options.orientation, | ||
isExpanded: options.isExpanded, | ||
isHeaderVisible: true, | ||
headerSize: options.headerSize, | ||
minimumBodySize: options.minimumBodySize, | ||
maximumBodySize: options.maximumBodySize, | ||
}) || this; | ||
_this._onDidDrop = new events_1.Emitter(); | ||
@@ -47,4 +56,5 @@ _this.onDidDrop = _this._onDidDrop.event; | ||
_this.onUnhandledDragOverEvent = _this._onUnhandledDragOverEvent.event; | ||
_this.accessor = options.accessor; | ||
_this.addDisposables(_this._onDidDrop, _this._onUnhandledDragOverEvent); | ||
if (!disableDnd) { | ||
if (!options.disableDnd) { | ||
_this.initDragFeatures(); | ||
@@ -51,0 +61,0 @@ } |
@@ -15,2 +15,3 @@ import { Event } from '../events'; | ||
maximumSize?: number; | ||
headerSize?: number; | ||
data: { | ||
@@ -44,2 +45,5 @@ id: string; | ||
accessor: IPaneviewComponent; | ||
headerSize: number; | ||
minimumBodySize: number; | ||
maximumBodySize: number; | ||
}); | ||
@@ -56,2 +60,3 @@ getBodyComponent(): IPanePart; | ||
maximumBodySize?: number; | ||
headerSize?: number; | ||
isExpanded?: boolean; | ||
@@ -58,0 +63,0 @@ title: string; |
@@ -68,6 +68,20 @@ "use strict"; | ||
var nextLayoutId = (0, math_1.sequentialNumberGenerator)(); | ||
var HEADER_SIZE = 22; | ||
var MINIMUM_BODY_SIZE = 0; | ||
var MAXIMUM_BODY_SIZE = Number.MAX_SAFE_INTEGER; | ||
var PaneFramework = /** @class */ (function (_super) { | ||
__extends(PaneFramework, _super); | ||
function PaneFramework(options) { | ||
var _this = _super.call(this, options.accessor, options.id, options.component, options.headerComponent, options.orientation, options.isExpanded, options.disableDnd) || this; | ||
var _this = _super.call(this, { | ||
accessor: options.accessor, | ||
id: options.id, | ||
component: options.component, | ||
headerComponent: options.headerComponent, | ||
orientation: options.orientation, | ||
isExpanded: options.isExpanded, | ||
disableDnd: options.disableDnd, | ||
headerSize: options.headerSize, | ||
minimumBodySize: options.minimumBodySize, | ||
maximumBodySize: options.maximumBodySize, | ||
}) || this; | ||
_this.options = options; | ||
@@ -205,3 +219,3 @@ return _this; | ||
PaneviewComponent.prototype.addPanel = function (options) { | ||
var _a; | ||
var _a, _b; | ||
var body = this.options.createComponent({ | ||
@@ -231,2 +245,5 @@ id: options.id, | ||
accessor: this, | ||
headerSize: (_a = options.headerSize) !== null && _a !== void 0 ? _a : HEADER_SIZE, | ||
minimumBodySize: MINIMUM_BODY_SIZE, | ||
maximumBodySize: MAXIMUM_BODY_SIZE, | ||
}); | ||
@@ -237,3 +254,3 @@ this.doAddPanel(view); | ||
view.init({ | ||
params: (_a = options.params) !== null && _a !== void 0 ? _a : {}, | ||
params: (_b = options.params) !== null && _b !== void 0 ? _b : {}, | ||
minimumBodySize: options.minimumBodySize, | ||
@@ -286,2 +303,3 @@ maximumBodySize: options.maximumBodySize, | ||
maximumSize: maximum(view.maximumBodySize), | ||
headerSize: view.headerSize, | ||
expanded: view.isExpanded(), | ||
@@ -308,2 +326,3 @@ }; | ||
views: views.map(function (view) { | ||
var _a, _b, _c; | ||
var data = view.data; | ||
@@ -335,2 +354,5 @@ var body = _this.options.createComponent({ | ||
accessor: _this, | ||
headerSize: (_a = view.headerSize) !== null && _a !== void 0 ? _a : HEADER_SIZE, | ||
minimumBodySize: (_b = view.minimumSize) !== null && _b !== void 0 ? _b : MINIMUM_BODY_SIZE, | ||
maximumBodySize: (_c = view.maximumSize) !== null && _c !== void 0 ? _c : MAXIMUM_BODY_SIZE, | ||
}); | ||
@@ -337,0 +359,0 @@ _this.doAddPanel(panel); |
@@ -42,3 +42,2 @@ import { PaneviewApi } from '../api/component.api'; | ||
export declare abstract class PaneviewPanel extends BasePanelView<PaneviewPanelApiImpl> implements IPaneview, IPaneviewPanel { | ||
private readonly headerComponent; | ||
private readonly _onDidChangeExpansionState; | ||
@@ -51,3 +50,2 @@ onDidChangeExpansionState: Event<boolean>; | ||
}>; | ||
private readonly headerSize; | ||
private _orthogonalSize; | ||
@@ -62,6 +60,7 @@ private _size; | ||
private headerPart?; | ||
private expandedSize; | ||
private animationTimer; | ||
private _orientation; | ||
private _headerVisible; | ||
readonly headerSize: number; | ||
readonly headerComponent: string | undefined; | ||
set orientation(value: Orientation); | ||
@@ -80,3 +79,13 @@ get orientation(): Orientation; | ||
set headerVisible(value: boolean); | ||
constructor(id: string, component: string, headerComponent: string | undefined, orientation: Orientation, isExpanded: boolean, isHeaderVisible: boolean); | ||
constructor(options: { | ||
id: string; | ||
component: string; | ||
headerComponent: string | undefined; | ||
orientation: Orientation; | ||
isExpanded: boolean; | ||
isHeaderVisible: boolean; | ||
headerSize: number; | ||
minimumBodySize: number; | ||
maximumBodySize: number; | ||
}); | ||
setVisible(isVisible: boolean): void; | ||
@@ -83,0 +92,0 @@ setActive(isActive: boolean): void; |
@@ -53,5 +53,4 @@ "use strict"; | ||
__extends(PaneviewPanel, _super); | ||
function PaneviewPanel(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) { | ||
var _this = _super.call(this, id, component, new paneviewPanelApi_1.PaneviewPanelApiImpl(id, component)) || this; | ||
_this.headerComponent = headerComponent; | ||
function PaneviewPanel(options) { | ||
var _this = _super.call(this, options.id, options.component, new paneviewPanelApi_1.PaneviewPanelApiImpl(options.id, options.component)) || this; | ||
_this._onDidChangeExpansionState = new events_1.Emitter({ replay: true }); | ||
@@ -61,15 +60,15 @@ _this.onDidChangeExpansionState = _this._onDidChangeExpansionState.event; | ||
_this.onDidChange = _this._onDidChange.event; | ||
_this.headerSize = 22; | ||
_this._orthogonalSize = 0; | ||
_this._size = 0; | ||
_this._minimumBodySize = 100; | ||
_this._maximumBodySize = Number.POSITIVE_INFINITY; | ||
_this._isExpanded = false; | ||
_this.expandedSize = 0; | ||
_this.api.pane = _this; // TODO cannot use 'this' before 'super' | ||
_this.api.initialize(_this); | ||
_this._isExpanded = isExpanded; | ||
_this._headerVisible = isHeaderVisible; | ||
_this.headerSize = options.headerSize; | ||
_this.headerComponent = options.headerComponent; | ||
_this._minimumBodySize = options.minimumBodySize; | ||
_this._maximumBodySize = options.maximumBodySize; | ||
_this._isExpanded = options.isExpanded; | ||
_this._headerVisible = options.isHeaderVisible; | ||
_this._onDidChangeExpansionState.fire(_this.isExpanded()); // initialize value | ||
_this._orientation = orientation; | ||
_this._orientation = options.orientation; | ||
_this.element.classList.add('dv-pane'); | ||
@@ -222,5 +221,2 @@ _this.addDisposables(_this.api.onWillVisibilityChange(function (event) { | ||
: [orthogonalSize, size], 2), width = _a[0], height = _a[1]; | ||
if (this.isExpanded()) { | ||
this.expandedSize = width; | ||
} | ||
_super.prototype.layout.call(this, width, height); | ||
@@ -227,0 +223,0 @@ }; |
@@ -156,3 +156,3 @@ "use strict"; | ||
externalWindow.close(); | ||
}), (0, events_1.addDisposableWindowListener)(window, 'beforeunload', function () { | ||
}), (0, events_1.addDisposableListener)(window, 'beforeunload', function () { | ||
/** | ||
@@ -192,3 +192,3 @@ * before the main window closes we should close this popup too | ||
*/ | ||
(0, events_1.addDisposableWindowListener)(externalWindow, 'beforeunload', function () { | ||
(0, events_1.addDisposableListener)(externalWindow, 'beforeunload', function () { | ||
/** | ||
@@ -195,0 +195,0 @@ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event |
@@ -125,2 +125,5 @@ "use strict"; | ||
var _this = this; | ||
if (this._splitview) { | ||
this._splitview.dispose(); | ||
} | ||
this._splitview = value; | ||
@@ -127,0 +130,0 @@ this._splitviewChangeDisposable.value = new lifecycle_1.CompositeDisposable(this._splitview.onDidSashEnd(function () { |
@@ -1,2 +0,2 @@ | ||
import { DockviewMaximizedGroupChanged, FloatingGroupOptions, IDockviewComponent, MovePanelEvent, SerializedDockview } from '../dockview/dockviewComponent'; | ||
import { DockviewMaximizedGroupChanged, FloatingGroupOptions, IDockviewComponent, MovePanelEvent, PopoutGroupChangePositionEvent, PopoutGroupChangeSizeEvent, SerializedDockview } from '../dockview/dockviewComponent'; | ||
import { AddGroupOptions, AddPanelOptions, DockviewComponentOptions, DockviewDndOverlayEvent, MovementOptions } from '../dockview/options'; | ||
@@ -420,2 +420,4 @@ import { Parameters } from '../panel/types'; | ||
get onUnhandledDragOverEvent(): Event<DockviewDndOverlayEvent>; | ||
get onDidPopoutGroupSizeChange(): Event<PopoutGroupChangeSizeEvent>; | ||
get onDidPopoutGroupPositionChange(): Event<PopoutGroupChangePositionEvent>; | ||
/** | ||
@@ -422,0 +424,0 @@ * All panel objects. |
@@ -571,2 +571,8 @@ export class SplitviewApi { | ||
} | ||
get onDidPopoutGroupSizeChange() { | ||
return this.component.onDidPopoutGroupSizeChange; | ||
} | ||
get onDidPopoutGroupPositionChange() { | ||
return this.component.onDidPopoutGroupPositionChange; | ||
} | ||
/** | ||
@@ -573,0 +579,0 @@ * All panel objects. |
@@ -1,2 +0,2 @@ | ||
import { addDisposableWindowListener } from '../../events'; | ||
import { addDisposableListener } from '../../events'; | ||
import { CompositeDisposable, Disposable, MutableDisposable, } from '../../lifecycle'; | ||
@@ -30,3 +30,3 @@ export class PopupService extends CompositeDisposable { | ||
this._active = wrapper; | ||
this._activeDisposable.value = new CompositeDisposable(addDisposableWindowListener(window, 'pointerdown', (event) => { | ||
this._activeDisposable.value = new CompositeDisposable(addDisposableListener(window, 'pointerdown', (event) => { | ||
var _a; | ||
@@ -33,0 +33,0 @@ const target = event.target; |
@@ -110,2 +110,12 @@ import { SerializedGridObject } from '../gridview/gridview'; | ||
} | ||
export interface PopoutGroupChangeSizeEvent { | ||
width: number; | ||
height: number; | ||
group: DockviewGroupPanel; | ||
} | ||
export interface PopoutGroupChangePositionEvent { | ||
screenX: number; | ||
screenY: number; | ||
group: DockviewGroupPanel; | ||
} | ||
export interface IDockviewComponent extends IBaseGrid<DockviewGroupPanel> { | ||
@@ -131,2 +141,4 @@ readonly activePanel: IDockviewPanel | undefined; | ||
readonly onDidMaximizedGroupChange: Event<DockviewMaximizedGroupChanged>; | ||
readonly onDidPopoutGroupSizeChange: Event<PopoutGroupChangeSizeEvent>; | ||
readonly onDidPopoutGroupPositionChange: Event<PopoutGroupChangePositionEvent>; | ||
readonly options: DockviewComponentOptions; | ||
@@ -190,2 +202,6 @@ updateOptions(options: DockviewOptions): void; | ||
readonly onDidAddPanel: Event<IDockviewPanel>; | ||
private readonly _onDidPopoutGroupSizeChange; | ||
readonly onDidPopoutGroupSizeChange: Event<PopoutGroupChangeSizeEvent>; | ||
private readonly _onDidPopoutGroupPositionChange; | ||
readonly onDidPopoutGroupPositionChange: Event<PopoutGroupChangePositionEvent>; | ||
private readonly _onDidLayoutFromJSON; | ||
@@ -192,0 +208,0 @@ readonly onDidLayoutFromJSON: Event<void>; |
@@ -1,2 +0,2 @@ | ||
import { Event as DockviewEvent } from './events'; | ||
import { Event as DockviewEvent, Emitter } from './events'; | ||
import { IDisposable, CompositeDisposable } from './lifecycle'; | ||
@@ -18,3 +18,3 @@ export interface OverflowEvent { | ||
export declare function isAncestor(testChild: Node | null, testAncestor: Node | null): boolean; | ||
export declare function getElementsByTagName(tag: string): HTMLElement[]; | ||
export declare function getElementsByTagName(tag: string, document: ParentNode): HTMLElement[]; | ||
export interface IFocusTracker extends IDisposable { | ||
@@ -25,3 +25,3 @@ readonly onDidFocus: DockviewEvent<void>; | ||
} | ||
export declare function trackFocus(element: HTMLElement | Window): IFocusTracker; | ||
export declare function trackFocus(element: HTMLElement): IFocusTracker; | ||
export declare function quasiPreventDefault(event: Event): void; | ||
@@ -42,3 +42,3 @@ export declare function quasiDefaultPrevented(event: Event): boolean; | ||
export declare function addTestId(element: HTMLElement, id: string): void; | ||
export declare function disableIframePointEvents(): { | ||
export declare function disableIframePointEvents(rootNode?: ParentNode): { | ||
release: () => void; | ||
@@ -54,1 +54,3 @@ }; | ||
export declare function isChildEntirelyVisibleWithinParent(child: HTMLElement, parent: HTMLElement): boolean; | ||
export declare function onDidWindowMoveEnd(window: Window): Emitter<void>; | ||
export declare function onDidWindowResizeEnd(element: Window, cb: () => void): CompositeDisposable; |
@@ -1,2 +0,2 @@ | ||
import { Emitter, addDisposableListener, addDisposableWindowListener, } from './events'; | ||
import { Emitter, addDisposableListener, } from './events'; | ||
import { CompositeDisposable } from './lifecycle'; | ||
@@ -69,4 +69,4 @@ export class OverflowObserver extends CompositeDisposable { | ||
} | ||
export function getElementsByTagName(tag) { | ||
return Array.prototype.slice.call(document.getElementsByTagName(tag), 0); | ||
export function getElementsByTagName(tag, document) { | ||
return Array.prototype.slice.call(document.querySelectorAll(tag), 0); | ||
} | ||
@@ -119,10 +119,4 @@ export function trackFocus(element) { | ||
}; | ||
if (element instanceof HTMLElement) { | ||
this.addDisposables(addDisposableListener(element, 'focus', onFocus, true)); | ||
this.addDisposables(addDisposableListener(element, 'blur', onBlur, true)); | ||
} | ||
else { | ||
this.addDisposables(addDisposableWindowListener(element, 'focus', onFocus, true)); | ||
this.addDisposables(addDisposableWindowListener(element, 'blur', onBlur, true)); | ||
} | ||
this.addDisposables(addDisposableListener(element, 'focus', onFocus, true)); | ||
this.addDisposables(addDisposableListener(element, 'blur', onBlur, true)); | ||
} | ||
@@ -201,7 +195,26 @@ refreshState() { | ||
} | ||
export function disableIframePointEvents() { | ||
const iframes = [ | ||
...getElementsByTagName('iframe'), | ||
...getElementsByTagName('webview'), | ||
]; | ||
/** | ||
* Should be more efficient than element.querySelectorAll("*") since there | ||
* is no need to store every element in-memory using this approach | ||
*/ | ||
function allTagsNamesInclusiveOfShadowDoms(tagNames) { | ||
const iframes = []; | ||
function findIframesInNode(node) { | ||
if (node.nodeType === Node.ELEMENT_NODE) { | ||
if (tagNames.includes(node.tagName)) { | ||
iframes.push(node); | ||
} | ||
if (node.shadowRoot) { | ||
findIframesInNode(node.shadowRoot); | ||
} | ||
for (const child of node.children) { | ||
findIframesInNode(child); | ||
} | ||
} | ||
} | ||
findIframesInNode(document.documentElement); | ||
return iframes; | ||
} | ||
export function disableIframePointEvents(rootNode = document) { | ||
const iframes = allTagsNamesInclusiveOfShadowDoms(['IFRAME', 'WEBVIEW']); | ||
const original = new WeakMap(); // don't hold onto HTMLElement references longer than required | ||
@@ -258,2 +271,3 @@ for (const iframe of iframes) { | ||
} | ||
const DEBOUCE_DELAY = 100; | ||
export function isChildEntirelyVisibleWithinParent(child, parent) { | ||
@@ -272,1 +286,36 @@ // | ||
} | ||
export function onDidWindowMoveEnd(window) { | ||
const emitter = new Emitter(); | ||
let previousScreenX = window.screenX; | ||
let previousScreenY = window.screenY; | ||
let timeout; | ||
const checkMovement = () => { | ||
if (window.closed) { | ||
return; | ||
} | ||
const currentScreenX = window.screenX; | ||
const currentScreenY = window.screenY; | ||
if (currentScreenX !== previousScreenX || | ||
currentScreenY !== previousScreenY) { | ||
clearTimeout(timeout); | ||
timeout = setTimeout(() => { | ||
emitter.fire(); | ||
}, DEBOUCE_DELAY); | ||
previousScreenX = currentScreenX; | ||
previousScreenY = currentScreenY; | ||
} | ||
requestAnimationFrame(checkMovement); | ||
}; | ||
checkMovement(); | ||
return emitter; | ||
} | ||
export function onDidWindowResizeEnd(element, cb) { | ||
let resizeTimeout; | ||
const disposable = new CompositeDisposable(addDisposableListener(element, 'resize', () => { | ||
clearTimeout(resizeTimeout); | ||
resizeTimeout = setTimeout(() => { | ||
cb(); | ||
}, DEBOUCE_DELAY); | ||
})); | ||
return disposable; | ||
} |
@@ -57,3 +57,3 @@ import { IDisposable } from './lifecycle'; | ||
} | ||
export declare function addDisposableWindowListener<K extends keyof WindowEventMap>(element: Window, type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable; | ||
export declare function addDisposableListener<K extends keyof WindowEventMap>(element: Window, type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable; | ||
export declare function addDisposableListener<K extends keyof HTMLElementEventMap>(element: HTMLElement, type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): IDisposable; | ||
@@ -60,0 +60,0 @@ /** |
@@ -148,10 +148,2 @@ export var Event; | ||
Emitter.MEMORY_LEAK_WATCHER = new LeakageMonitor(); | ||
export function addDisposableWindowListener(element, type, listener, options) { | ||
element.addEventListener(type, listener, options); | ||
return { | ||
dispose: () => { | ||
element.removeEventListener(type, listener, options); | ||
}, | ||
}; | ||
} | ||
export function addDisposableListener(element, type, listener, options) { | ||
@@ -158,0 +150,0 @@ element.addEventListener(type, listener, options); |
import { disableIframePointEvents, quasiDefaultPrevented, toggleClass, } from '../dom'; | ||
import { Emitter, addDisposableListener, addDisposableWindowListener, } from '../events'; | ||
import { Emitter, addDisposableListener, } from '../events'; | ||
import { CompositeDisposable, MutableDisposable } from '../lifecycle'; | ||
@@ -167,3 +167,3 @@ import { clamp } from '../math'; | ||
}, | ||
}, addDisposableWindowListener(window, 'pointermove', (e) => { | ||
}, addDisposableListener(window, 'pointermove', (e) => { | ||
const containerRect = this.options.container.getBoundingClientRect(); | ||
@@ -205,3 +205,3 @@ const x = e.clientX - containerRect.left; | ||
this.setBounds(bounds); | ||
}), addDisposableWindowListener(window, 'pointerup', () => { | ||
}), addDisposableListener(window, 'pointerup', () => { | ||
toggleClass(this._element, 'dv-resize-container-dragging', false); | ||
@@ -251,3 +251,3 @@ move.dispose(); | ||
const iframes = disableIframePointEvents(); | ||
move.value = new CompositeDisposable(addDisposableWindowListener(window, 'pointermove', (e) => { | ||
move.value = new CompositeDisposable(addDisposableListener(window, 'pointermove', (e) => { | ||
const containerRect = this.options.container.getBoundingClientRect(); | ||
@@ -376,3 +376,3 @@ const overlayRect = this._element.getBoundingClientRect(); | ||
}, | ||
}, addDisposableWindowListener(window, 'pointerup', () => { | ||
}, addDisposableListener(window, 'pointerup', () => { | ||
move.dispose(); | ||
@@ -379,0 +379,0 @@ this._onDidChangeEnd.fire(); |
@@ -15,3 +15,2 @@ import { PaneviewApi } from '../api/component.api'; | ||
export declare abstract class DraggablePaneviewPanel extends PaneviewPanel { | ||
private readonly accessor; | ||
private handler; | ||
@@ -23,5 +22,17 @@ private target; | ||
readonly onUnhandledDragOverEvent: Event<PaneviewDndOverlayEvent>; | ||
constructor(accessor: IPaneviewComponent, id: string, component: string, headerComponent: string | undefined, orientation: Orientation, isExpanded: boolean, disableDnd: boolean); | ||
readonly accessor: IPaneviewComponent; | ||
constructor(options: { | ||
accessor: IPaneviewComponent; | ||
id: string; | ||
component: string; | ||
headerComponent: string | undefined; | ||
orientation: Orientation; | ||
isExpanded: boolean; | ||
disableDnd: boolean; | ||
headerSize: number; | ||
minimumBodySize: number; | ||
maximumBodySize: number; | ||
}); | ||
private initDragFeatures; | ||
private onDrop; | ||
} |
@@ -9,5 +9,14 @@ import { PaneviewApi } from '../api/component.api'; | ||
export class DraggablePaneviewPanel extends PaneviewPanel { | ||
constructor(accessor, id, component, headerComponent, orientation, isExpanded, disableDnd) { | ||
super(id, component, headerComponent, orientation, isExpanded, true); | ||
this.accessor = accessor; | ||
constructor(options) { | ||
super({ | ||
id: options.id, | ||
component: options.component, | ||
headerComponent: options.headerComponent, | ||
orientation: options.orientation, | ||
isExpanded: options.isExpanded, | ||
isHeaderVisible: true, | ||
headerSize: options.headerSize, | ||
minimumBodySize: options.minimumBodySize, | ||
maximumBodySize: options.maximumBodySize, | ||
}); | ||
this._onDidDrop = new Emitter(); | ||
@@ -17,4 +26,5 @@ this.onDidDrop = this._onDidDrop.event; | ||
this.onUnhandledDragOverEvent = this._onUnhandledDragOverEvent.event; | ||
this.accessor = options.accessor; | ||
this.addDisposables(this._onDidDrop, this._onUnhandledDragOverEvent); | ||
if (!disableDnd) { | ||
if (!options.disableDnd) { | ||
this.initDragFeatures(); | ||
@@ -21,0 +31,0 @@ } |
@@ -15,2 +15,3 @@ import { Event } from '../events'; | ||
maximumSize?: number; | ||
headerSize?: number; | ||
data: { | ||
@@ -44,2 +45,5 @@ id: string; | ||
accessor: IPaneviewComponent; | ||
headerSize: number; | ||
minimumBodySize: number; | ||
maximumBodySize: number; | ||
}); | ||
@@ -56,2 +60,3 @@ getBodyComponent(): IPanePart; | ||
maximumBodySize?: number; | ||
headerSize?: number; | ||
isExpanded?: boolean; | ||
@@ -58,0 +63,0 @@ title: string; |
@@ -12,5 +12,19 @@ import { PaneviewApi } from '../api/component.api'; | ||
const nextLayoutId = sequentialNumberGenerator(); | ||
const HEADER_SIZE = 22; | ||
const MINIMUM_BODY_SIZE = 0; | ||
const MAXIMUM_BODY_SIZE = Number.MAX_SAFE_INTEGER; | ||
export class PaneFramework extends DraggablePaneviewPanel { | ||
constructor(options) { | ||
super(options.accessor, options.id, options.component, options.headerComponent, options.orientation, options.isExpanded, options.disableDnd); | ||
super({ | ||
accessor: options.accessor, | ||
id: options.id, | ||
component: options.component, | ||
headerComponent: options.headerComponent, | ||
orientation: options.orientation, | ||
isExpanded: options.isExpanded, | ||
disableDnd: options.disableDnd, | ||
headerSize: options.headerSize, | ||
minimumBodySize: options.minimumBodySize, | ||
maximumBodySize: options.maximumBodySize, | ||
}); | ||
this.options = options; | ||
@@ -110,3 +124,3 @@ } | ||
addPanel(options) { | ||
var _a; | ||
var _a, _b; | ||
const body = this.options.createComponent({ | ||
@@ -136,2 +150,5 @@ id: options.id, | ||
accessor: this, | ||
headerSize: (_a = options.headerSize) !== null && _a !== void 0 ? _a : HEADER_SIZE, | ||
minimumBodySize: MINIMUM_BODY_SIZE, | ||
maximumBodySize: MAXIMUM_BODY_SIZE, | ||
}); | ||
@@ -142,3 +159,3 @@ this.doAddPanel(view); | ||
view.init({ | ||
params: (_a = options.params) !== null && _a !== void 0 ? _a : {}, | ||
params: (_b = options.params) !== null && _b !== void 0 ? _b : {}, | ||
minimumBodySize: options.minimumBodySize, | ||
@@ -188,2 +205,3 @@ maximumBodySize: options.maximumBodySize, | ||
maximumSize: maximum(view.maximumBodySize), | ||
headerSize: view.headerSize, | ||
expanded: view.isExpanded(), | ||
@@ -209,2 +227,3 @@ }; | ||
views: views.map((view) => { | ||
var _a, _b, _c; | ||
const data = view.data; | ||
@@ -236,2 +255,5 @@ const body = this.options.createComponent({ | ||
accessor: this, | ||
headerSize: (_a = view.headerSize) !== null && _a !== void 0 ? _a : HEADER_SIZE, | ||
minimumBodySize: (_b = view.minimumSize) !== null && _b !== void 0 ? _b : MINIMUM_BODY_SIZE, | ||
maximumBodySize: (_c = view.maximumSize) !== null && _c !== void 0 ? _c : MAXIMUM_BODY_SIZE, | ||
}); | ||
@@ -238,0 +260,0 @@ this.doAddPanel(panel); |
@@ -42,3 +42,2 @@ import { PaneviewApi } from '../api/component.api'; | ||
export declare abstract class PaneviewPanel extends BasePanelView<PaneviewPanelApiImpl> implements IPaneview, IPaneviewPanel { | ||
private readonly headerComponent; | ||
private readonly _onDidChangeExpansionState; | ||
@@ -51,3 +50,2 @@ onDidChangeExpansionState: Event<boolean>; | ||
}>; | ||
private readonly headerSize; | ||
private _orthogonalSize; | ||
@@ -62,6 +60,7 @@ private _size; | ||
private headerPart?; | ||
private expandedSize; | ||
private animationTimer; | ||
private _orientation; | ||
private _headerVisible; | ||
readonly headerSize: number; | ||
readonly headerComponent: string | undefined; | ||
set orientation(value: Orientation); | ||
@@ -80,3 +79,13 @@ get orientation(): Orientation; | ||
set headerVisible(value: boolean); | ||
constructor(id: string, component: string, headerComponent: string | undefined, orientation: Orientation, isExpanded: boolean, isHeaderVisible: boolean); | ||
constructor(options: { | ||
id: string; | ||
component: string; | ||
headerComponent: string | undefined; | ||
orientation: Orientation; | ||
isExpanded: boolean; | ||
isHeaderVisible: boolean; | ||
headerSize: number; | ||
minimumBodySize: number; | ||
maximumBodySize: number; | ||
}); | ||
setVisible(isVisible: boolean): void; | ||
@@ -83,0 +92,0 @@ setActive(isActive: boolean): void; |
@@ -54,5 +54,4 @@ import { PaneviewPanelApiImpl } from '../api/paneviewPanelApi'; | ||
} | ||
constructor(id, component, headerComponent, orientation, isExpanded, isHeaderVisible) { | ||
super(id, component, new PaneviewPanelApiImpl(id, component)); | ||
this.headerComponent = headerComponent; | ||
constructor(options) { | ||
super(options.id, options.component, new PaneviewPanelApiImpl(options.id, options.component)); | ||
this._onDidChangeExpansionState = new Emitter({ replay: true }); | ||
@@ -62,15 +61,15 @@ this.onDidChangeExpansionState = this._onDidChangeExpansionState.event; | ||
this.onDidChange = this._onDidChange.event; | ||
this.headerSize = 22; | ||
this._orthogonalSize = 0; | ||
this._size = 0; | ||
this._minimumBodySize = 100; | ||
this._maximumBodySize = Number.POSITIVE_INFINITY; | ||
this._isExpanded = false; | ||
this.expandedSize = 0; | ||
this.api.pane = this; // TODO cannot use 'this' before 'super' | ||
this.api.initialize(this); | ||
this._isExpanded = isExpanded; | ||
this._headerVisible = isHeaderVisible; | ||
this.headerSize = options.headerSize; | ||
this.headerComponent = options.headerComponent; | ||
this._minimumBodySize = options.minimumBodySize; | ||
this._maximumBodySize = options.maximumBodySize; | ||
this._isExpanded = options.isExpanded; | ||
this._headerVisible = options.isHeaderVisible; | ||
this._onDidChangeExpansionState.fire(this.isExpanded()); // initialize value | ||
this._orientation = orientation; | ||
this._orientation = options.orientation; | ||
this.element.classList.add('dv-pane'); | ||
@@ -142,5 +141,2 @@ this.addDisposables(this.api.onWillVisibilityChange((event) => { | ||
: [orthogonalSize, size]; | ||
if (this.isExpanded()) { | ||
this.expandedSize = width; | ||
} | ||
super.layout(width, height); | ||
@@ -147,0 +143,0 @@ } |
@@ -11,3 +11,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { addStyles } from './dom'; | ||
import { Emitter, addDisposableWindowListener } from './events'; | ||
import { Emitter, addDisposableListener } from './events'; | ||
import { CompositeDisposable, Disposable } from './lifecycle'; | ||
@@ -87,3 +87,3 @@ export class PopoutWindow extends CompositeDisposable { | ||
externalWindow.close(); | ||
}), addDisposableWindowListener(window, 'beforeunload', () => { | ||
}), addDisposableListener(window, 'beforeunload', () => { | ||
/** | ||
@@ -123,3 +123,3 @@ * before the main window closes we should close this popup too | ||
*/ | ||
addDisposableWindowListener(externalWindow, 'beforeunload', () => { | ||
addDisposableListener(externalWindow, 'beforeunload', () => { | ||
/** | ||
@@ -126,0 +126,0 @@ * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event |
@@ -26,2 +26,5 @@ import { CompositeDisposable, MutableDisposable, } from '../lifecycle'; | ||
set splitview(value) { | ||
if (this._splitview) { | ||
this._splitview.dispose(); | ||
} | ||
this._splitview = value; | ||
@@ -28,0 +31,0 @@ this._splitviewChangeDisposable.value = new CompositeDisposable(this._splitview.onDidSashEnd(() => { |
{ | ||
"name": "dockview-core", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"description": "Zero dependency layout manager supporting tabs, grids and splitviews", | ||
@@ -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
13916966
0.88%104252
0.84%