mirror of
https://github.com/mathuo/dockview
synced 2025-02-15 21:05:45 +00:00
Merge pull request #197 from mathuo/196-make-dockview-panel-title-optional
feat: dockview title to be optional
This commit is contained in:
commit
722152c80c
@ -79,7 +79,8 @@ export class DefaultTab extends CompositeDisposable implements ITabRenderer {
|
||||
|
||||
public init(params: GroupPanelPartInitParameters) {
|
||||
this.params = params;
|
||||
this._content.textContent = params.title;
|
||||
this._content.textContent =
|
||||
typeof params.title === 'string' ? params.title : this.id;
|
||||
|
||||
addDisposableListener(this.action, 'click', (ev) => {
|
||||
ev.preventDefault(); //
|
||||
@ -106,7 +107,10 @@ export class DefaultTab extends CompositeDisposable implements ITabRenderer {
|
||||
|
||||
private render() {
|
||||
if (this._content.textContent !== this.params.title) {
|
||||
this._content.textContent = this.params.title;
|
||||
this._content.textContent =
|
||||
typeof this.params.title === 'string'
|
||||
? this.params.title
|
||||
: this.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,7 @@ import {
|
||||
IGroupPanelInitParameters,
|
||||
} from '../groupview/types';
|
||||
import { GroupPanel } from '../groupview/groupviewPanel';
|
||||
import {
|
||||
CompositeDisposable,
|
||||
IDisposable,
|
||||
MutableDisposable,
|
||||
} from '../lifecycle';
|
||||
import { CompositeDisposable, IDisposable } from '../lifecycle';
|
||||
import { IPanel, Parameters } from '../panel/types';
|
||||
import { IGroupPanelView } from './defaultGroupPanelView';
|
||||
import { DockviewComponent } from './dockviewComponent';
|
||||
@ -34,8 +30,6 @@ export class DockviewPanel
|
||||
extends CompositeDisposable
|
||||
implements IDockviewPanel
|
||||
{
|
||||
private readonly mutableDisposable = new MutableDisposable();
|
||||
|
||||
readonly api: DockviewPanelApiImpl;
|
||||
private _group: GroupPanel;
|
||||
private _params?: Parameters;
|
||||
@ -88,7 +82,9 @@ export class DockviewPanel
|
||||
this._params = params.params;
|
||||
this._view = params.view;
|
||||
|
||||
this.setTitle(params.title);
|
||||
if (typeof params.title === 'string') {
|
||||
this.setTitle(params.title);
|
||||
}
|
||||
|
||||
this.view?.init({
|
||||
...params,
|
||||
@ -183,7 +179,6 @@ export class DockviewPanel
|
||||
|
||||
public dispose(): void {
|
||||
this.api.dispose();
|
||||
this.mutableDisposable.dispose();
|
||||
|
||||
this.view?.dispose();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export interface IRenderable {
|
||||
}
|
||||
|
||||
export interface HeaderPartInitParameters {
|
||||
title: string;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export interface GroupPanelPartInitParameters
|
||||
@ -88,6 +88,6 @@ export type GroupPanelUpdateEvent = PanelUpdateEvent<{
|
||||
export interface GroupviewPanelState {
|
||||
id: string;
|
||||
view?: any;
|
||||
title: string;
|
||||
title?: string;
|
||||
params?: { [key: string]: any };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user