mirror of
https://github.com/mathuo/dockview
synced 2025-09-12 20:28:04 +00:00
chore: fix sonar code smells
This commit is contained in:
parent
979cb9aa5c
commit
306a54a5b4
@ -43,7 +43,7 @@ export abstract class DragHandler extends CompositeDisposable {
|
|||||||
event.dataTransfer.effectAllowed = 'move';
|
event.dataTransfer.effectAllowed = 'move';
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
addDisposableListener(this.el, 'dragend', (ev) => {
|
addDisposableListener(this.el, 'dragend', () => {
|
||||||
for (const iframe of this.iframes) {
|
for (const iframe of this.iframes) {
|
||||||
iframe.style.pointerEvents = 'auto';
|
iframe.style.pointerEvents = 'auto';
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ export class Droptarget extends CompositeDisposable {
|
|||||||
this.addDisposables(
|
this.addDisposables(
|
||||||
this._onDrop,
|
this._onDrop,
|
||||||
new DragAndDropObserver(this.element, {
|
new DragAndDropObserver(this.element, {
|
||||||
onDragEnter: (e) => undefined,
|
onDragEnter: () => undefined,
|
||||||
onDragOver: (e) => {
|
onDragOver: (e) => {
|
||||||
if (isBooleanValue(this.options.canDisplayOverlay)) {
|
if (isBooleanValue(this.options.canDisplayOverlay)) {
|
||||||
if (!this.options.canDisplayOverlay) {
|
if (!this.options.canDisplayOverlay) {
|
||||||
@ -115,10 +115,10 @@ export class Droptarget extends CompositeDisposable {
|
|||||||
|
|
||||||
this.setState(quadrant);
|
this.setState(quadrant);
|
||||||
},
|
},
|
||||||
onDragLeave: (e) => {
|
onDragLeave: () => {
|
||||||
this.removeDropTarget();
|
this.removeDropTarget();
|
||||||
},
|
},
|
||||||
onDragEnd: (e) => {
|
onDragEnd: () => {
|
||||||
this.removeDropTarget();
|
this.removeDropTarget();
|
||||||
},
|
},
|
||||||
onDrop: (e) => {
|
onDrop: (e) => {
|
||||||
|
@ -154,7 +154,7 @@ export class DefaultTab extends CompositeDisposable implements ITabRenderer {
|
|||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public layout(width: number, height: number) {
|
public layout(_width: number, _height: number) {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@ import { PanelUpdateEvent } from '../../../panel/types';
|
|||||||
|
|
||||||
export class Watermark
|
export class Watermark
|
||||||
extends CompositeDisposable
|
extends CompositeDisposable
|
||||||
implements IWatermarkRenderer {
|
implements IWatermarkRenderer
|
||||||
|
{
|
||||||
private _element: HTMLElement;
|
private _element: HTMLElement;
|
||||||
private group: GroupviewPanel | undefined;
|
private group: GroupviewPanel | undefined;
|
||||||
private params: GroupPanelPartInitParameters | undefined;
|
private params: GroupPanelPartInitParameters | undefined;
|
||||||
@ -56,7 +57,7 @@ export class Watermark
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
update(event: PanelUpdateEvent) {
|
update(_event: PanelUpdateEvent) {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ export class Watermark
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
layout(width: number, height: number) {
|
layout(_width: number, _height: number) {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ export class Watermark
|
|||||||
this.params = params;
|
this.params = params;
|
||||||
|
|
||||||
this.addDisposables(
|
this.addDisposables(
|
||||||
this.params.containerApi.onDidLayoutChange((event) => {
|
this.params.containerApi.onDidLayoutChange(() => {
|
||||||
this.render();
|
this.render();
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -84,7 +85,7 @@ export class Watermark
|
|||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateParentGroup(group: GroupviewPanel, visible: boolean): void {
|
updateParentGroup(group: GroupviewPanel, _visible: boolean): void {
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ export class BranchNode extends CompositeDisposable implements IView {
|
|||||||
|
|
||||||
this._childrenDisposable = Event.any(
|
this._childrenDisposable = Event.any(
|
||||||
...this.children.map((c) => c.onDidChange)
|
...this.children.map((c) => c.onDidChange)
|
||||||
)((e) => {
|
)(() => {
|
||||||
/**
|
/**
|
||||||
* indicate a change has occured to allows any re-rendering but don't bubble
|
* indicate a change has occured to allows any re-rendering but don't bubble
|
||||||
* event because that was specific to this branch
|
* event because that was specific to this branch
|
||||||
|
@ -644,7 +644,7 @@ export class Gridview implements IDisposable {
|
|||||||
const isSiblingVisible = parent.isChildVisible(0);
|
const isSiblingVisible = parent.isChildVisible(0);
|
||||||
parent.removeChild(0, sizing);
|
parent.removeChild(0, sizing);
|
||||||
|
|
||||||
const sizes = grandParent.children.map((size, i) =>
|
const sizes = grandParent.children.map((_size, i) =>
|
||||||
grandParent.getChildSize(i)
|
grandParent.getChildSize(i)
|
||||||
);
|
);
|
||||||
grandParent.removeChild(parentIndex, sizing);
|
grandParent.removeChild(parentIndex, sizing);
|
||||||
|
@ -169,7 +169,7 @@ export class GridviewComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
setActive(panel: GridviewPanel): void {
|
setActive(panel: GridviewPanel): void {
|
||||||
this._groups.forEach((value, key) => {
|
this._groups.forEach((value, _key) => {
|
||||||
value.value.setActive(panel === value.value);
|
value.value.setActive(panel === value.value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -342,11 +342,11 @@ export class Groupview extends CompositeDisposable implements IGroupview {
|
|||||||
return this.panels.includes(panel);
|
return this.panels.includes(panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
init(params: PanelInitParameters) {
|
init(_params: PanelInitParameters) {
|
||||||
//noop
|
//noop
|
||||||
}
|
}
|
||||||
|
|
||||||
update(params: PanelUpdateEvent) {
|
update(_params: PanelUpdateEvent) {
|
||||||
//noop
|
//noop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ export class ContentContainer
|
|||||||
this.disposable.value = disposable;
|
this.disposable.value = disposable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public layout(width: number, height: number): void {
|
public layout(_width: number, _height: number): void {
|
||||||
// noop
|
// noop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,10 +42,10 @@ export class HostedContainer implements IDisposable {
|
|||||||
* When dragging somebody
|
* When dragging somebody
|
||||||
*/
|
*/
|
||||||
|
|
||||||
window.addEventListener('dragstart', (ev) => {
|
window.addEventListener('dragstart', () => {
|
||||||
this.element.style.pointerEvents = 'none';
|
this.element.style.pointerEvents = 'none';
|
||||||
});
|
});
|
||||||
window.addEventListener('dragend', (ev) => {
|
window.addEventListener('dragend', () => {
|
||||||
this.element.style.pointerEvents = '';
|
this.element.style.pointerEvents = '';
|
||||||
});
|
});
|
||||||
window.addEventListener('mousemove', (ev) => {
|
window.addEventListener('mousemove', (ev) => {
|
||||||
@ -73,7 +73,8 @@ export class HostedContainer implements IDisposable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const frameRect = element.getBoundingClientRect();
|
const frameRect = element.getBoundingClientRect();
|
||||||
const containerRect = this.element.parentElement.getBoundingClientRect();
|
const containerRect =
|
||||||
|
this.element.parentElement.getBoundingClientRect();
|
||||||
this.element.style.position = 'absolute';
|
this.element.style.position = 'absolute';
|
||||||
this.element.style.top = `${frameRect.top - containerRect.top}px`;
|
this.element.style.top = `${frameRect.top - containerRect.top}px`;
|
||||||
this.element.style.left = `${frameRect.left - containerRect.left}px`;
|
this.element.style.left = `${frameRect.left - containerRect.left}px`;
|
||||||
|
@ -47,7 +47,7 @@ export class DefaultHeader
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
update(params: PanelUpdateEvent) {
|
update(_params: PanelUpdateEvent) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ export abstract class DraggablePaneviewPanel extends PaneviewPanel {
|
|||||||
|
|
||||||
this.target = new Droptarget(this.element, {
|
this.target = new Droptarget(this.element, {
|
||||||
validOverlays: 'vertical',
|
validOverlays: 'vertical',
|
||||||
canDisplayOverlay: (event: DragEvent) => {
|
canDisplayOverlay: () => {
|
||||||
const data = getPaneData();
|
const data = getPaneData();
|
||||||
|
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
@ -73,7 +73,7 @@ export class Paneview extends CompositeDisposable implements IDisposable {
|
|||||||
|
|
||||||
// if we've added views from the descriptor we need to
|
// if we've added views from the descriptor we need to
|
||||||
// add the panes to our Pane array and setup animation
|
// add the panes to our Pane array and setup animation
|
||||||
this.getPanes().forEach((pane, index) => {
|
this.getPanes().forEach((pane) => {
|
||||||
const disposable = new CompositeDisposable(
|
const disposable = new CompositeDisposable(
|
||||||
pane.onDidChangeExpansionState(() => {
|
pane.onDidChangeExpansionState(() => {
|
||||||
this.setupAnimation();
|
this.setupAnimation();
|
||||||
|
@ -79,7 +79,7 @@ export const DockviewReact = React.forwardRef(
|
|||||||
const factory: GroupPanelFrameworkComponentFactory = {
|
const factory: GroupPanelFrameworkComponentFactory = {
|
||||||
content: {
|
content: {
|
||||||
createComponent: (
|
createComponent: (
|
||||||
id: string,
|
_id: string,
|
||||||
componentId: string,
|
componentId: string,
|
||||||
component: React.FunctionComponent<IDockviewPanelProps>
|
component: React.FunctionComponent<IDockviewPanelProps>
|
||||||
): IContentRenderer => {
|
): IContentRenderer => {
|
||||||
@ -94,7 +94,7 @@ export const DockviewReact = React.forwardRef(
|
|||||||
},
|
},
|
||||||
tab: {
|
tab: {
|
||||||
createComponent: (
|
createComponent: (
|
||||||
id: string,
|
_id: string,
|
||||||
componentId: string,
|
componentId: string,
|
||||||
component: React.FunctionComponent<IDockviewPanelHeaderProps>
|
component: React.FunctionComponent<IDockviewPanelHeaderProps>
|
||||||
): ITabRenderer => {
|
): ITabRenderer => {
|
||||||
@ -109,7 +109,7 @@ export const DockviewReact = React.forwardRef(
|
|||||||
},
|
},
|
||||||
watermark: {
|
watermark: {
|
||||||
createComponent: (
|
createComponent: (
|
||||||
id: string,
|
_id: string,
|
||||||
componentId: string,
|
componentId: string,
|
||||||
component: React.FunctionComponent<{}>
|
component: React.FunctionComponent<{}>
|
||||||
) => {
|
) => {
|
||||||
|
@ -32,8 +32,6 @@ export class ReactPanelContentPart implements IContentRenderer {
|
|||||||
private actionsPart?: ReactPart<any>;
|
private actionsPart?: ReactPart<any>;
|
||||||
private _group: GroupviewPanel | undefined;
|
private _group: GroupviewPanel | undefined;
|
||||||
|
|
||||||
// private hostedContainer: HostedContainer;
|
|
||||||
|
|
||||||
private readonly _onDidFocus = new Emitter<void>();
|
private readonly _onDidFocus = new Emitter<void>();
|
||||||
readonly onDidFocus: Event<void> = this._onDidFocus.event;
|
readonly onDidFocus: Event<void> = this._onDidFocus.event;
|
||||||
|
|
||||||
@ -56,13 +54,6 @@ export class ReactPanelContentPart implements IContentRenderer {
|
|||||||
this._element = document.createElement('div');
|
this._element = document.createElement('div');
|
||||||
this._element.className = 'dockview-react-part';
|
this._element.className = 'dockview-react-part';
|
||||||
|
|
||||||
// this.hostedContainer = new HostedContainer({
|
|
||||||
// id,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// this.hostedContainer.onDidFocus(() => this._onDidFocus.fire());
|
|
||||||
// this.hostedContainer.onDidBlur(() => this._onDidBlur.fire());
|
|
||||||
|
|
||||||
this._actionsElement = document.createElement('div');
|
this._actionsElement = document.createElement('div');
|
||||||
this._actionsElement.className = 'dockview-react-part';
|
this._actionsElement.className = 'dockview-react-part';
|
||||||
}
|
}
|
||||||
@ -104,17 +95,13 @@ export class ReactPanelContentPart implements IContentRenderer {
|
|||||||
|
|
||||||
public updateParentGroup(
|
public updateParentGroup(
|
||||||
group: GroupviewPanel,
|
group: GroupviewPanel,
|
||||||
isPanelVisible: boolean
|
_isPanelVisible: boolean
|
||||||
): void {
|
): void {
|
||||||
this._group = group;
|
this._group = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public layout(width: number, height: number): void {
|
public layout(_width: number, _height: number): void {
|
||||||
// noop
|
// noop
|
||||||
// this.hostedContainer.layout(
|
|
||||||
// this.element
|
|
||||||
// // { width, height }
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public close(): Promise<boolean> {
|
public close(): Promise<boolean> {
|
||||||
@ -125,7 +112,6 @@ export class ReactPanelContentPart implements IContentRenderer {
|
|||||||
this._onDidFocus.dispose();
|
this._onDidFocus.dispose();
|
||||||
this._onDidBlur.dispose();
|
this._onDidBlur.dispose();
|
||||||
this.part?.dispose();
|
this.part?.dispose();
|
||||||
// this.hostedContainer?.dispose();
|
|
||||||
this.actionsPart?.dispose();
|
this.actionsPart?.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,11 +73,11 @@ export class ReactWatermarkPart implements IWatermarkRenderer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
layout(width: number, height: number) {
|
layout(_width: number, _height: number) {
|
||||||
// noop - retrieval from api
|
// noop - retrieval from api
|
||||||
}
|
}
|
||||||
|
|
||||||
updateParentGroup(group: GroupviewPanel, isPanelVisible: boolean): void {
|
updateParentGroup(group: GroupviewPanel, _isPanelVisible: boolean): void {
|
||||||
// noop - retrieval from api
|
// noop - retrieval from api
|
||||||
this._groupRef.value = group;
|
this._groupRef.value = group;
|
||||||
}
|
}
|
||||||
|
@ -90,12 +90,12 @@ export class ReactContentRenderer implements IContentRenderer {
|
|||||||
|
|
||||||
public updateParentGroup(
|
public updateParentGroup(
|
||||||
group: GroupviewPanel,
|
group: GroupviewPanel,
|
||||||
isPanelVisible: boolean
|
_isPanelVisible: boolean
|
||||||
): void {
|
): void {
|
||||||
this._group = group;
|
this._group = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public layout(width: number, height: number): void {
|
public layout(_width: number, _height: number): void {
|
||||||
this._hostedContainer.layout(this.element);
|
this._hostedContainer.layout(this.element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,13 +43,13 @@ export class WebviewContentRenderer implements IContentRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public updateParentGroup(
|
public updateParentGroup(
|
||||||
group: GroupviewPanel,
|
_group: GroupviewPanel,
|
||||||
isPanelVisible: boolean
|
_isPanelVisible: boolean
|
||||||
): void {
|
): void {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
public layout(width: number, height: number): void {
|
public layout(_width: number, _height: number): void {
|
||||||
this._hostedContainer.layout(this._element);
|
this._hostedContainer.layout(this._element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ export const PaneviewReact = React.forwardRef(
|
|||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const createComponent = (
|
const createComponent = (
|
||||||
id: string,
|
id: string,
|
||||||
componentId: string,
|
_componentId: string,
|
||||||
component: any
|
component: any
|
||||||
) =>
|
) =>
|
||||||
new PanePanelSection(id, component, {
|
new PanePanelSection(id, component, {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user