Skip to content

Commit

Permalink
fix(DockLayout): Invalid use of "this" in private namespace
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Jan 13, 2022
1 parent 948eec9 commit 08a839e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@
"pre-commit": "lint-staged"
}
}
}
}
31 changes: 19 additions & 12 deletions packages/widgets/src/docklayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,14 @@ export class DockLayout extends Layout {

// Create the root node for the new config.
if (mainConfig) {
this._root = Private.realizeAreaConfig(mainConfig, {
createTabBar: () => this._createTabBar(),
createHandle: () => this._createHandle()
});
this._root = Private.realizeAreaConfig(
mainConfig,
{
createTabBar: () => this._createTabBar(),
createHandle: () => this._createHandle()
},
this._document
);
} else {
this._root = null;
}
Expand Down Expand Up @@ -1190,7 +1194,7 @@ export namespace DockLayout {
*
* @returns A new tab bar for a dock layout.
*/
createTabBar(document?: Document | ShadowRoot): TabBar<Widget>;
createTabBar(document: Document | ShadowRoot): TabBar<Widget>;

/**
* Create a new handle node for use with a dock layout.
Expand Down Expand Up @@ -1482,13 +1486,14 @@ namespace Private {
*/
export function realizeAreaConfig(
config: DockLayout.AreaConfig,
renderer: DockLayout.IRenderer
renderer: DockLayout.IRenderer,
document: Document | ShadowRoot
): LayoutNode {
let node: LayoutNode;
if (config.type === 'tab-area') {
node = realizeTabAreaConfig(config, renderer);
node = realizeTabAreaConfig(config, renderer, document);
} else {
node = realizeSplitAreaConfig(config, renderer);
node = realizeSplitAreaConfig(config, renderer, document);
}
return node;
}
Expand Down Expand Up @@ -2190,10 +2195,11 @@ namespace Private {
*/
function realizeTabAreaConfig(
config: DockLayout.ITabAreaConfig,
renderer: DockLayout.IRenderer
renderer: DockLayout.IRenderer,
document: Document | ShadowRoot
): TabLayoutNode {
// Create the tab bar for the layout node.
let tabBar = renderer.createTabBar(this._document);
let tabBar = renderer.createTabBar(document);

// Hide each widget and add it to the tab bar.
each(config.widgets, widget => {
Expand All @@ -2214,15 +2220,16 @@ namespace Private {
*/
function realizeSplitAreaConfig(
config: DockLayout.ISplitAreaConfig,
renderer: DockLayout.IRenderer
renderer: DockLayout.IRenderer,
document: Document | ShadowRoot
): SplitLayoutNode {
// Create the split layout node.
let node = new SplitLayoutNode(config.orientation);

// Add each child to the layout node.
each(config.children, (child, i) => {
// Create the child data for the layout node.
let childNode = realizeAreaConfig(child, renderer);
let childNode = realizeAreaConfig(child, renderer, document);
let sizer = createSizer(config.sizes[i]);
let handle = renderer.createHandle();

Expand Down
2 changes: 1 addition & 1 deletion packages/widgets/src/dockpanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ export namespace DockPanel {
*
* @returns A new tab bar for a dock panel.
*/
createTabBar(document?: Document | ShadowRoot): TabBar<Widget> {
createTabBar(document: Document | ShadowRoot): TabBar<Widget> {
let bar = new TabBar<Widget>({ document });
bar.addClass('lm-DockPanel-tabBar');
/* <DEPRECATED> */
Expand Down

0 comments on commit 08a839e

Please sign in to comment.