mirror of
https://github.com/mathuo/dockview
synced 2025-02-18 22:25:46 +00:00
Merge pull request #31 from mathuo/23-increase-test-coverage
chore: reduce sonar smells
This commit is contained in:
commit
2e7711486b
@ -221,11 +221,6 @@ export class DockviewComponent
|
|||||||
typeof options.orientation === 'string' &&
|
typeof options.orientation === 'string' &&
|
||||||
this.options.orientation !== options.orientation;
|
this.options.orientation !== options.orientation;
|
||||||
|
|
||||||
// TODO support style update
|
|
||||||
// const hasStylesChanged =
|
|
||||||
// typeof options.styles === 'object' &&
|
|
||||||
// this.options.styles !== options.styles;
|
|
||||||
|
|
||||||
this._options = { ...this.options, ...options };
|
this._options = { ...this.options, ...options };
|
||||||
|
|
||||||
if (hasOrientationChanged) {
|
if (hasOrientationChanged) {
|
||||||
@ -409,16 +404,14 @@ export class DockviewComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
fireMouseEvent(event: LayoutMouseEvent): void {
|
fireMouseEvent(event: LayoutMouseEvent): void {
|
||||||
switch (event.kind) {
|
if (event.kind === MouseEventKind.CONTEXT_MENU) {
|
||||||
case MouseEventKind.CONTEXT_MENU:
|
if (event.tab && event.panel) {
|
||||||
if (event.tab && event.panel) {
|
this._onTabContextMenu.fire({
|
||||||
this._onTabContextMenu.fire({
|
event: event.event,
|
||||||
event: event.event,
|
api: this._api,
|
||||||
api: this._api,
|
panel: event.panel,
|
||||||
panel: event.panel,
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@ export class Emitter<T> implements IDisposable {
|
|||||||
listener(this._last);
|
listener(this._last);
|
||||||
}
|
}
|
||||||
|
|
||||||
const firstListener = this._listeners.length === 0;
|
|
||||||
|
|
||||||
this._listeners.push(listener);
|
this._listeners.push(listener);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -618,9 +618,10 @@ export class Gridview implements IDisposable {
|
|||||||
return node.view;
|
return node.view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sibling = parent.children[0];
|
||||||
|
|
||||||
if (pathToParent.length === 0) {
|
if (pathToParent.length === 0) {
|
||||||
// parent is root
|
// parent is root
|
||||||
const sibling = parent.children[0];
|
|
||||||
|
|
||||||
if (sibling instanceof LeafNode) {
|
if (sibling instanceof LeafNode) {
|
||||||
return node.view;
|
return node.view;
|
||||||
@ -635,7 +636,6 @@ export class Gridview implements IDisposable {
|
|||||||
const [grandParent, ..._] = [...pathToParent].reverse();
|
const [grandParent, ..._] = [...pathToParent].reverse();
|
||||||
const [parentIndex, ...__] = [...rest].reverse();
|
const [parentIndex, ...__] = [...rest].reverse();
|
||||||
|
|
||||||
const sibling = parent.children[0];
|
|
||||||
const isSiblingVisible = parent.isChildVisible(0);
|
const isSiblingVisible = parent.isChildVisible(0);
|
||||||
parent.removeChild(0, sizing);
|
parent.removeChild(0, sizing);
|
||||||
|
|
||||||
|
@ -261,12 +261,10 @@ export class TabsContainer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (event.kind) {
|
if (event.kind === MouseEventKind.CLICK) {
|
||||||
case MouseEventKind.CLICK:
|
this.group.model.openPanel(panel, {
|
||||||
this.group.model.openPanel(panel, {
|
skipFocus: alreadyFocused,
|
||||||
skipFocus: alreadyFocused,
|
});
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
tabToAdd.onDrop((event) => {
|
tabToAdd.onDrop((event) => {
|
||||||
|
@ -92,7 +92,6 @@ export class ReactPart<P extends object, C extends object = {}>
|
|||||||
throw new Error('invalid operation: resource is already disposed');
|
throw new Error('invalid operation: resource is already disposed');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO use a better check for isReactFunctionalComponent
|
|
||||||
if (typeof this.component !== 'function') {
|
if (typeof this.component !== 'function') {
|
||||||
/**
|
/**
|
||||||
* we know this isn't a React.FunctionComponent so throw an error here.
|
* we know this isn't a React.FunctionComponent so throw an error here.
|
||||||
@ -100,7 +99,7 @@ export class ReactPart<P extends object, C extends object = {}>
|
|||||||
* for the same reason, at least at this point we will emit a sensible stacktrace.
|
* for the same reason, at least at this point we will emit a sensible stacktrace.
|
||||||
*/
|
*/
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'invalid operation: only functional components are supported'
|
'Invalid Operation. dockview only supports React Functional Components.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user