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