Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
nealus committed Jun 13, 2021
1 parent 3196ded commit 40bb65e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
5 changes: 3 additions & 2 deletions examples/demo/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as ReactDOM from "react-dom";
import * as FlexLayout from "../../src/index";
import Utils from "./Utils";
import { Node, TabSetNode, TabNode, DropInfo, BorderNode, Action } from "../../src/index";
import { ITabRenderValues, ITabSetRenderValues } from "../../src/view/Layout";

var fields = ["Name", "Field1", "Field2", "Field3", "Field4", "Field5"];

Expand Down Expand Up @@ -281,13 +282,13 @@ class App extends React.Component<any, { layoutFile: string | null, model: FlexL
this.setState({ fontSize: target.value });
}

onRenderTab = (node: TabNode, renderValues: any) => {
onRenderTab = (node: TabNode, renderValues: ITabRenderValues) => {
// renderValues.content += " *";
// renderValues.name = "tab " + node.getId(); // name used in overflow menu
// renderValues.buttons.push(<img src="images/grey_ball.png"/>);
}

onRenderTabSet = (node: (TabSetNode | BorderNode), renderValues: any) => {
onRenderTabSet = (node: (TabSetNode | BorderNode), renderValues: ITabSetRenderValues) => {
if (this.state.layoutFile === "default") {
//renderValues.headerContent = "-- " + renderValues.headerContent + " --";
//renderValues.buttons.push(<img src="images/grey_ball.png"/>);
Expand Down
39 changes: 22 additions & 17 deletions src/view/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ import { IJsonTabNode } from "../model/IJsonModel";
export interface ILayoutProps {
model: Model;
factory: (node: TabNode) => React.ReactNode;
font?: {
size?: string;
family?: string;
style?: string;
weight?: string;
};
font?: IFontValues;
fontFamily?: string;
iconFactory?: (node: TabNode) => React.ReactNode | undefined;
titleFactory?: (node: TabNode) => ITitleObject | React.ReactNode | undefined;
Expand All @@ -41,20 +36,11 @@ export interface ILayoutProps {
onAction?: (action: Action) => Action | undefined;
onRenderTab?: (
node: TabNode,
renderValues: {
leading: React.ReactNode;
content: React.ReactNode;
name: string;
buttons: React.ReactNode[];
}
renderValues: ITabRenderValues,
) => void;
onRenderTabSet?: (
tabSetNode: TabSetNode | BorderNode,
renderValues: {
headerContent?: React.ReactNode;
stickyButtons: React.ReactNode[];
buttons: React.ReactNode[];
}
renderValues: ITabSetRenderValues,
) => void;
onModelChange?: (model: Model) => void;
onExternalDrag?: (event: React.DragEvent<HTMLDivElement>) => undefined | {
Expand All @@ -67,6 +53,25 @@ export interface ILayoutProps {
supportsPopout?: boolean | undefined;
popoutURL?: string | undefined;
}
export interface IFontValues {
size?: string;
family?: string;
style?: string;
weight?: string;
}

export interface ITabSetRenderValues {
headerContent?: React.ReactNode;
stickyButtons: React.ReactNode[];
buttons: React.ReactNode[];
}

export interface ITabRenderValues {
leading: React.ReactNode;
content: React.ReactNode;
name: string;
buttons: React.ReactNode[];
}

export interface ITitleObject {
titleContent: React.ReactNode;
Expand Down

0 comments on commit 40bb65e

Please sign in to comment.