mirror of
https://github.com/mathuo/dockview
synced 2025-03-13 09:22:06 +00:00
code
This commit is contained in:
parent
2126e33e60
commit
72b0f8861c
@ -95,6 +95,7 @@ export const Application = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<GridviewComponent
|
<GridviewComponent
|
||||||
|
// className={'visual-studio-theme'}
|
||||||
components={rootcomponents}
|
components={rootcomponents}
|
||||||
onReady={onReady}
|
onReady={onReady}
|
||||||
orientation={Orientation.VERTICAL}
|
orientation={Orientation.VERTICAL}
|
||||||
|
@ -97,8 +97,5 @@
|
|||||||
"state": {}
|
"state": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options":{
|
|
||||||
"tabHeight": 35
|
|
||||||
},
|
|
||||||
"activeGroup": "group_2"
|
"activeGroup": "group_2"
|
||||||
}
|
}
|
@ -17,6 +17,10 @@ export const Settings = (props: IGroupPanelProps) => {
|
|||||||
props.containerApi.setTabHeight(tabHeight);
|
props.containerApi.setTabHeight(tabHeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onRemove = () => {
|
||||||
|
props.containerApi.setTabHeight(undefined);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ height: '100%', color: 'white' }}>
|
<div style={{ height: '100%', color: 'white' }}>
|
||||||
<label>
|
<label>
|
||||||
@ -27,6 +31,7 @@ export const Settings = (props: IGroupPanelProps) => {
|
|||||||
type="number"
|
type="number"
|
||||||
/>
|
/>
|
||||||
<button onClick={onClick}>Apply</button>
|
<button onClick={onClick}>Apply</button>
|
||||||
|
<button onClick={onRemove}>Remove</button>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -290,7 +290,7 @@ export class DockviewApi {
|
|||||||
return this.component.getTabHeight();
|
return this.component.getTabHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
setTabHeight(height: number) {
|
setTabHeight(height: number | undefined) {
|
||||||
this.component.setTabHeight(height);
|
this.component.setTabHeight(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ export interface IComponentDockview extends IBaseGrid<IGroupview> {
|
|||||||
fireMouseEvent(event: LayoutMouseEvent): void;
|
fireMouseEvent(event: LayoutMouseEvent): void;
|
||||||
createWatermarkComponent(): WatermarkPart;
|
createWatermarkComponent(): WatermarkPart;
|
||||||
setAutoResizeToFit(enabled: boolean): void;
|
setAutoResizeToFit(enabled: boolean): void;
|
||||||
setTabHeight(height: number): void;
|
setTabHeight(height: number | undefined): void;
|
||||||
getTabHeight(): number;
|
getTabHeight(): number;
|
||||||
totalPanels: number;
|
totalPanels: number;
|
||||||
// lifecycle
|
// lifecycle
|
||||||
@ -162,9 +162,6 @@ export class ComponentDockview
|
|||||||
if (!this.options.components) {
|
if (!this.options.components) {
|
||||||
this.options.components = {};
|
this.options.components = {};
|
||||||
}
|
}
|
||||||
if (typeof this.options.tabHeight !== 'number') {
|
|
||||||
this.options.tabHeight = DEFAULT_TAB_HEIGHT;
|
|
||||||
}
|
|
||||||
if (!this.options.frameworkComponents) {
|
if (!this.options.frameworkComponents) {
|
||||||
this.options.frameworkComponents = {};
|
this.options.frameworkComponents = {};
|
||||||
}
|
}
|
||||||
@ -428,7 +425,7 @@ export class ComponentDockview
|
|||||||
}
|
}
|
||||||
const { grid, panels, options, activeGroup } = data;
|
const { grid, panels, options, activeGroup } = data;
|
||||||
|
|
||||||
if (typeof options.tabHeight === 'number') {
|
if (typeof options?.tabHeight === 'number') {
|
||||||
this.setTabHeight(options.tabHeight);
|
this.setTabHeight(options.tabHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +461,7 @@ export class ComponentDockview
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public setTabHeight(height: number) {
|
public setTabHeight(height: number | undefined) {
|
||||||
this.options.tabHeight = height;
|
this.options.tabHeight = height;
|
||||||
this.groups.forEach((value) => {
|
this.groups.forEach((value) => {
|
||||||
value.value.tabHeight = height;
|
value.value.tabHeight = height;
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: elipsis;
|
text-overflow: elipsis;
|
||||||
font-size: 13px;
|
|
||||||
|
|
||||||
.tab-content {
|
.tab-content {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
overflow: overlay;
|
overflow: overlay;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
height: var(--title-height);
|
||||||
|
font-size: var(--title-font-size);
|
||||||
|
|
||||||
&.hidden {
|
&.hidden {
|
||||||
display: none;
|
display: none;
|
||||||
@ -27,7 +29,6 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
font-size: 13px;
|
|
||||||
overflow-x: overlay;
|
overflow-x: overlay;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
|
|
||||||
|
@ -5,13 +5,7 @@ import {
|
|||||||
} from '../../lifecycle';
|
} from '../../lifecycle';
|
||||||
import { addDisposableListener, Emitter, Event } from '../../events';
|
import { addDisposableListener, Emitter, Event } from '../../events';
|
||||||
import { ITab, Tab } from '../panel/tab/tab';
|
import { ITab, Tab } from '../panel/tab/tab';
|
||||||
import {
|
import { removeClasses, addClasses, toggleClass } from '../../dom';
|
||||||
removeClasses,
|
|
||||||
addClasses,
|
|
||||||
toggleClass,
|
|
||||||
isInTree,
|
|
||||||
isAncestor,
|
|
||||||
} from '../../dom';
|
|
||||||
import { hasProcessed, Position } from '../droptarget/droptarget';
|
import { hasProcessed, Position } from '../droptarget/droptarget';
|
||||||
import { TabDropEvent } from '../events';
|
import { TabDropEvent } from '../events';
|
||||||
|
|
||||||
@ -71,7 +65,16 @@ export class TabContainer extends CompositeDisposable implements ITabContainer {
|
|||||||
|
|
||||||
set height(value: number) {
|
set height(value: number) {
|
||||||
this._height = value;
|
this._height = value;
|
||||||
this._element.style.height = `${this.height}px`;
|
if (typeof value !== 'number') {
|
||||||
|
// removeClasses(this.element, 'separator-border');
|
||||||
|
this.element.style.removeProperty('--title-height');
|
||||||
|
} else {
|
||||||
|
// addClasses(this.element, 'separator-border');
|
||||||
|
// if (styles?.separatorBorder) {
|
||||||
|
this.element.style.setProperty('--title-height', `${value}px`);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
// this._element.style.height = `${this.height}px`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get element() {
|
public get element() {
|
||||||
|
@ -37,6 +37,7 @@ export interface IDockviewComponentProps {
|
|||||||
enableExternalDragEvents?: boolean;
|
enableExternalDragEvents?: boolean;
|
||||||
onTabContextMenu?: (event: TabContextMenuEvent) => void;
|
onTabContextMenu?: (event: TabContextMenuEvent) => void;
|
||||||
hideBorders?: boolean;
|
hideBorders?: boolean;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DockviewComponent: React.FunctionComponent<IDockviewComponentProps> = (
|
export const DockviewComponent: React.FunctionComponent<IDockviewComponentProps> = (
|
||||||
@ -132,7 +133,11 @@ export const DockviewComponent: React.FunctionComponent<IDockviewComponentProps>
|
|||||||
}, [props.onTabContextMenu]);
|
}, [props.onTabContextMenu]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ height: '100%', width: '100%' }} ref={domRef}>
|
<div
|
||||||
|
className={props.className}
|
||||||
|
style={{ height: '100%', width: '100%' }}
|
||||||
|
ref={domRef}
|
||||||
|
>
|
||||||
{portals}
|
{portals}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -24,6 +24,7 @@ export interface IGridviewComponentProps {
|
|||||||
onReady?: (event: GridviewReadyEvent) => void;
|
onReady?: (event: GridviewReadyEvent) => void;
|
||||||
components?: PanelCollection<IGridviewPanelProps>;
|
components?: PanelCollection<IGridviewPanelProps>;
|
||||||
hideBorders?: boolean;
|
hideBorders?: boolean;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GridviewComponent: React.FunctionComponent<IGridviewComponentProps> = (
|
export const GridviewComponent: React.FunctionComponent<IGridviewComponentProps> = (
|
||||||
@ -61,7 +62,11 @@ export const GridviewComponent: React.FunctionComponent<IGridviewComponentProps>
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ height: '100%', width: '100%' }} ref={domRef}>
|
<div
|
||||||
|
className={props.className}
|
||||||
|
style={{ height: '100%', width: '100%' }}
|
||||||
|
ref={domRef}
|
||||||
|
>
|
||||||
{portals}
|
{portals}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -23,6 +23,7 @@ export interface IPaneviewComponentProps {
|
|||||||
onReady?: (event: PaneviewReadyEvent) => void;
|
onReady?: (event: PaneviewReadyEvent) => void;
|
||||||
components?: PanelCollection<IPaneviewPanelProps>;
|
components?: PanelCollection<IPaneviewPanelProps>;
|
||||||
headerComponents?: PanelCollection<IPaneviewPanelProps>;
|
headerComponents?: PanelCollection<IPaneviewPanelProps>;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PaneviewComponent: React.FunctionComponent<IPaneviewComponentProps> = (
|
export const PaneviewComponent: React.FunctionComponent<IPaneviewComponentProps> = (
|
||||||
@ -78,7 +79,11 @@ export const PaneviewComponent: React.FunctionComponent<IPaneviewComponentProps>
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ height: '100%', width: '100%' }} ref={domRef}>
|
<div
|
||||||
|
className={props.className}
|
||||||
|
style={{ height: '100%', width: '100%' }}
|
||||||
|
ref={domRef}
|
||||||
|
>
|
||||||
{portals}
|
{portals}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -25,6 +25,7 @@ export interface ISplitviewComponentProps {
|
|||||||
components: PanelCollection<ISplitviewPanelProps>;
|
components: PanelCollection<ISplitviewPanelProps>;
|
||||||
proportionalLayout?: boolean;
|
proportionalLayout?: boolean;
|
||||||
hideBorders?: boolean;
|
hideBorders?: boolean;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const SplitviewComponent: React.FunctionComponent<ISplitviewComponentProps> = (
|
export const SplitviewComponent: React.FunctionComponent<ISplitviewComponentProps> = (
|
||||||
@ -65,7 +66,11 @@ export const SplitviewComponent: React.FunctionComponent<ISplitviewComponentProp
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ height: '100%', width: '100%' }} ref={domRef}>
|
<div
|
||||||
|
className={props.className}
|
||||||
|
style={{ height: '100%', width: '100%' }}
|
||||||
|
ref={domRef}
|
||||||
|
>
|
||||||
{portals}
|
{portals}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -21,10 +21,15 @@
|
|||||||
--tab-dirty-icon: url('https://fonts.gstatic.com/s/i/materialicons/lens/v6/24px.svg');
|
--tab-dirty-icon: url('https://fonts.gstatic.com/s/i/materialicons/lens/v6/24px.svg');
|
||||||
//
|
//
|
||||||
--separator-border: rgb(68, 68, 68);
|
--separator-border: rgb(68, 68, 68);
|
||||||
|
|
||||||
|
--title-font-size: 13px;
|
||||||
|
--title-height: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.visual-studio-theme {
|
.visual-studio-theme {
|
||||||
--active-tab-background-visible: dodgerblue;
|
--active-tab-background-visible: dodgerblue;
|
||||||
|
--title-height: 18px;
|
||||||
|
--title-font-size: 11px;
|
||||||
|
|
||||||
.groupview {
|
.groupview {
|
||||||
&.active-group {
|
&.active-group {
|
||||||
|
Loading…
Reference in New Issue
Block a user