added different tabs, dividing examples into categories

development
mcyph 2021-03-26 17:13:40 +11:00
parent 78f8919826
commit fa60cf0804
21 changed files with 346 additions and 140 deletions

50
src/pages/PageTabs.js Normal file
View File

@ -0,0 +1,50 @@
import Link from 'next/link';
const PageTabs = ({ curPageURL, children }) => {
const allPages = [
['/basic', 'Basic'],
['/backgrounds', 'Backgrounds'],
['/connections', 'Connections'],
['/dnd_copypaste', 'Drag-and-drop/copy-paste'],
['/editing', 'Editing'],
['/effects', 'Effects'],
['/events', 'Events'],
['/icons_images', 'Icons/Images'],
['/labels', 'Labels'],
['/layout', 'Layout'],
['/misc', 'Miscellaneous'],
['/printing', 'Printing'],
['/shapes_stencils', 'Shapes/stencils'],
['/styles', 'Styles'],
['/toolbars', 'Toolbars'],
['/windows', 'Windows'],
['/xml_json', 'XML/JSON'],
['/zoom_offpage', 'Zoom/offpage'],
];
const tabs = [];
for (const [pageURL, pageName] of allPages) {
tabs.push(
<li className={curPageURL === pageURL ? 'active' : ''}>
<Link href={pageURL}>
<a>{pageName}</a>
</Link>
</li>
);
}
return (
<div
style={{
width: '900px',
margin: '0 auto',
}}
>
<h1>mxGraph Reloaded Examples</h1>
<ul className="pagetabs">{tabs}</ul>
{children}
</div>
);
};
export default PageTabs;

View File

@ -0,0 +1,14 @@
import React from 'react';
import Grid from './Grid';
import Preview from '../Previews';
import ExtendCanvas from './ExtendCanvas';
import PageTabs from "../PageTabs";
export default function _Backgrounds() {
return (
<PageTabs curPageURL="/backgrounds">
<Preview sourceKey="ExtendCanvas" content={<ExtendCanvas />} />
<Preview sourceKey="Grid" content={<Grid />} />
</PageTabs>
);
}

9
src/pages/basic/index.js Normal file
View File

@ -0,0 +1,9 @@
import React from 'react';
import HelloWorld from "./HelloWorld";
import Preview from "../Previews";
import PageTabs from "../PageTabs";
export default function _Basic() {
{/* <Preview sourceKey="Template" content={<Template />} /> */}
return <PageTabs curPageURL="/basic"><Preview sourceKey="HelloWorld" content={<HelloWorld />} /></PageTabs>;
}

View File

@ -0,0 +1,22 @@
import React from 'react';
import Preview from '../Previews';
import Anchors from './Anchors';
import EdgeTolerance from './EdgeTolerance';
import FixedPoints from './FixedPoints';
import HelloPort from './HelloPort';
import Orthogonal from './Orthogonal';
import PortRefs from './PortRefs';
import PageTabs from "../PageTabs";
export default function _Connections() {
return (
<PageTabs curPageURL="/connections">
<Preview sourceKey="Anchors" content={<Anchors />} />
<Preview sourceKey="EdgeTolerance" content={<EdgeTolerance />} />
<Preview sourceKey="FixedPoints" content={<FixedPoints />} />
<Preview sourceKey="HelloPort" content={<HelloPort />} />
<Preview sourceKey="Orthogonal" content={<Orthogonal />} />
<Preview sourceKey="PortRefs" content={<PortRefs />} />
</PageTabs>
);
}

View File

@ -0,0 +1,16 @@
import React from 'react';
import Preview from '../Previews';
import Clipboard from './Clipboard';
import DragSource from './DragSource';
import Drop from './Drop';
import PageTabs from "../PageTabs";
export default function _DnDCopyPaste() {
return (
<PageTabs curPageURL="/dnd_copypaste">
<Preview sourceKey="Clipboard" content={<Clipboard />} />
<Preview sourceKey="DragSource" content={<DragSource />} />
<Preview sourceKey="Drop" content={<Drop />} />
</PageTabs>
);
}

View File

@ -0,0 +1,8 @@
import React from 'react';
import Preview from "../Previews";
import Editing from "./Editing";
import PageTabs from "../PageTabs";
export default function _Editing() {
return <PageTabs curPageURL="/editing"><Preview sourceKey="Editing" content={<Editing />} /></PageTabs>;
}

View File

@ -0,0 +1,16 @@
import React from 'react';
import Animation from './Animation';
import Preview from '../Previews';
import Morph from './Morph';
import Overlays from './Overlays';
import PageTabs from "../PageTabs";
export default function Effects() {
return (
<PageTabs curPageURL="/effects">
<Preview sourceKey="Animation" content={<Animation />} />
<Preview sourceKey="Morph" content={<Morph />} />
<Preview sourceKey="Overlays" content={<Overlays />} />
</PageTabs>
);
}

14
src/pages/events/index.js Normal file
View File

@ -0,0 +1,14 @@
import React from 'react';
import Boundary from './Boundary';
import Preview from '../Previews';
import Events from "./Events";
import PageTabs from "../PageTabs";
export default function _Events() {
return (
<PageTabs curPageURL="/events">
<Preview sourceKey="Boundary" content={<Boundary />} />
<Preview sourceKey="Events" content={<Events />} />
</PageTabs>
);
}

View File

@ -0,0 +1,24 @@
import React from 'react';
import ContextIcons from './ContextIcons';
import Preview from '../Previews';
import Control from './Control';
import FixedIcon from './FixedIcon';
import HoverIcons from './HoverIcons';
import Images from './Images';
import Indicators from './Indicators';
import Markers from './Markers';
import PageTabs from "../PageTabs";
export default function _Backgrounds() {
return (
<PageTabs curPageURL="/icons_images">
<Preview sourceKey="ContextIcons" content={<ContextIcons />} />
<Preview sourceKey="Control" content={<Control />} />
<Preview sourceKey="FixedIcon" content={<FixedIcon />} />
<Preview sourceKey="HoverIcons" content={<HoverIcons />} />
<Preview sourceKey="Images" content={<Images />} />
<Preview sourceKey="Indicators" content={<Indicators />} />
<Preview sourceKey="Markers" content={<Markers />} />
</PageTabs>
);
}

View File

@ -1,144 +1,9 @@
import Head from 'next/head';
import Link from 'next/link';
import styles from '../styles/Home.module.css';
import HelloWorld from './basic/HelloWorld';
import Anchors from './connections/Anchors';
import AutoLayout from './layout/AutoLayout';
import Animation from './effects/Animation';
import Boundary from './events/Boundary';
import Clipboard from './dnd_copypaste/Clipboard';
import DragSource from './dnd_copypaste/DragSource';
import Control from './icons_images/Control';
import ContextIcons from './icons_images/ContextIcons';
import Collapse from './layout/Collapse';
import Constituent from './layout/Constituent';
import DynamicLoading from './misc/DynamicLoading';
import Drop from './dnd_copypaste/Drop';
import DynamicStyle from './styles/DynamicStyle';
import DynamicToolbar from './toolbars/DynamicToolbar';
import EdgeTolerance from './connections/EdgeTolerance';
import Editing from './editing/Editing';
import Tree from './layout/Tree';
import Validation from './misc/Validation';
import SwimLanes from './layout/SwimLanes';
import Wrapping from './labels/Wrapping';
// import Windows from "./Windows";
import Visibility from './misc/Visibility';
import UserObject from './xml_json/UserObject';
import Toolbar from './toolbars/Toolbar';
import Thread from './misc/Thread';
// import Template from "./Template";
import Stylesheet from './styles/Stylesheet';
import Stencils from './shapes_stencils/Stencils';
import SecondLabel from './labels/SecondLabel';
import Shape from './shapes_stencils/Shape';
import Resources from './xml_json/Resources';
import RadialTreeLayout from './layout/RadialTreeLayout';
import PortRefs from './connections/PortRefs';
import Permissions from './misc/Permissions';
import Perimeter from './labels/Perimeter';
import PageBreaks from './printing/PageBreaks';
import Overlays from './effects/Overlays';
import Orthogonal from './connections/Orthogonal';
import OrgChart from './layout/OrgChart';
import OffPage from './zoom_offpage/OffPage';
import Morph from './effects/Morph';
import Monitor from './misc/Monitor';
import Merge from './misc/Merge';
import Markers from './icons_images/Markers';
import LOD from './zoom_offpage/LOD';
import Layers from './layout/Layers';
import Labels from './labels/Labels';
import LabelPosition from './labels/LabelPosition';
import JsonData from './xml_json/JsonData';
import Indicators from './icons_images/Indicators';
import Images from './icons_images/Images';
import HoverIcons from './icons_images/HoverIcons';
import HoverStyle from './styles/HoverStyle';
import HierarchicalLayout from './layout/HierarchicalLayout';
import HelloPort from './connections/HelloPort';
import Handles from './layout/Handles';
import Guides from './misc/Guides';
import Groups from './layout/Groups';
import Grid from './backgrounds/Grid';
import Folding from './layout/Folding';
import FixedPoints from './connections/FixedPoints';
import FixedIcon from './icons_images/FixedIcon';
import Preview from './Previews';
import PageTabs from "./PageTabs";
import Basic from "./basic";
export default function Home() {
return (
<div
style={{
width: '900px',
margin: '0 auto',
}}
>
<Preview sourceKey="HelloWorld" content={<HelloWorld />} />
<Preview sourceKey="Anchors" content={<Anchors />} />
<Preview sourceKey="AutoLayout" content={<AutoLayout />} />
<Preview sourceKey="Animation" content={<Animation />} />
<Preview sourceKey="Boundary" content={<Boundary />} />
<Preview sourceKey="Clipboard" content={<Clipboard />} />
<Preview sourceKey="ContextIcons" content={<ContextIcons />} />
<Preview sourceKey="Collapse" content={<Collapse />} />
<Preview sourceKey="Constituent" content={<Constituent />} />
<Preview sourceKey="ContextIcons" content={<ContextIcons />} />
<Preview sourceKey="Control" content={<Control />} />
<Preview sourceKey="DragSource" content={<DragSource />} />
<Preview sourceKey="Drop" content={<Drop />} />
{/* <Preview sourceKey="DynamicLoading" content={<DynamicLoading />} /> */}
<Preview sourceKey="DynamicStyle" content={<DynamicStyle />} />
<Preview sourceKey="DynamicToolbar" content={<DynamicToolbar />} />
<Preview sourceKey="EdgeTolerance" content={<EdgeTolerance />} />
<Preview sourceKey="Editing" content={<Editing />} />
<Preview sourceKey="FixedIcon" content={<FixedIcon />} />
<Preview sourceKey="FixedPoints" content={<FixedPoints />} />
<Preview sourceKey="Folding" content={<Folding />} />
<Preview sourceKey="Grid" content={<Grid />} />
<Preview sourceKey="Groups" content={<Groups />} />
<Preview sourceKey="Guides" content={<Guides />} />
<Preview sourceKey="Handles" content={<Handles />} />
<Preview sourceKey="HelloPort" content={<HelloPort />} />
{/* <Preview sourceKey="HierarchicalLayout" content={<HierarchicalLayout />} /> */}
<Preview sourceKey="HoverStyle" content={<HoverStyle />} />
<Preview sourceKey="HoverIcons" content={<HoverIcons />} />
<Preview sourceKey="Images" content={<Images />} />
<Preview sourceKey="Indicators" content={<Indicators />} />
<Preview sourceKey="JsonData" content={<JsonData />} />
<Preview sourceKey="LabelPosition" content={<LabelPosition />} />
<Preview sourceKey="Labels" content={<Labels />} />
<Preview sourceKey="Layers" content={<Layers />} />
<Preview sourceKey="LOD" content={<LOD />} />
<Preview sourceKey="Markers" content={<Markers />} />
<Preview sourceKey="Merge" content={<Merge />} />
<Preview sourceKey="Monitor" content={<Monitor />} />
<Preview sourceKey="Morph" content={<Morph />} />
<Preview sourceKey="OffPage" content={<OffPage />} />
<Preview sourceKey="OrgChart" content={<OrgChart />} />
<Preview sourceKey="Orthogonal" content={<Orthogonal />} />
<Preview sourceKey="Overlays" content={<Overlays />} />
{/* <Preview sourceKey="PageBreaks" content={<PageBreaks />} /> */}
<Preview sourceKey="Perimeter" content={<Perimeter />} />
<Preview sourceKey="Permissions" content={<Permissions />} />
<Preview sourceKey="PortRefs" content={<PortRefs />} />
<Preview sourceKey="RadialTreeLayout" content={<RadialTreeLayout />} />
<Preview sourceKey="Resources" content={<Resources />} />
<Preview sourceKey="SecondLabel" content={<SecondLabel />} />
<Preview sourceKey="Shape" content={<Shape />} />
{/* <Preview sourceKey="Stencils" content={<Stencils />} /> */}
<Preview sourceKey="Stylesheet" content={<Stylesheet />} />
<Preview sourceKey="SwimLanes" content={<SwimLanes />} />
{/* <Preview sourceKey="Template" content={<Template />} /> */}
<Preview sourceKey="Thread" content={<Thread />} />
<Preview sourceKey="Toolbar" content={<Toolbar />} />
<Preview sourceKey="Tree" content={<Tree />} />
<Preview sourceKey="UserObject" content={<UserObject />} />
<Preview sourceKey="Validation" content={<Validation />} />
<Preview sourceKey="Visibility" content={<Visibility />} />
{/* <Preview sourceKey="Windows" content={<Windows />} /> */}
<Preview sourceKey="Wrapping" content={<Wrapping />} />
</div>
);
return <Basic />;
}

20
src/pages/labels/index.js Normal file
View File

@ -0,0 +1,20 @@
import React from 'react';
import Preview from '../Previews';
import LabelPosition from './LabelPosition';
import Perimeter from './Perimeter';
import SecondLabel from './SecondLabel';
import Wrapping from './Wrapping';
import Labels from './Labels';
import PageTabs from "../PageTabs";
export default function _Labels() {
return (
<PageTabs curPageURL="/labels">
<Preview sourceKey="LabelPosition" content={<LabelPosition />} />
<Preview sourceKey="Labels" content={<Labels />} />
<Preview sourceKey="Perimeter" content={<Perimeter />} />
<Preview sourceKey="SecondLabel" content={<SecondLabel />} />
<Preview sourceKey="Wrapping" content={<Wrapping />} />
</PageTabs>
);
}

33
src/pages/layout/index.js Normal file
View File

@ -0,0 +1,33 @@
import React from 'react';
import Preview from '../Previews';
import AutoLayout from './AutoLayout';
import Collapse from './Collapse';
import Constituent from './Constituent';
import Folding from './Folding';
import Groups from './Groups';
import Handles from './Handles';
import Layers from './Layers';
import OrgChart from './OrgChart';
import RadialTreeLayout from './RadialTreeLayout';
import SwimLanes from './SwimLanes';
import Tree from './Tree';
import PageTabs from "../PageTabs";
export default function _Layout() {
return (
<PageTabs curPageURL="/layout">
<Preview sourceKey="AutoLayout" content={<AutoLayout />} />
<Preview sourceKey="Collapse" content={<Collapse />} />
<Preview sourceKey="Constituent" content={<Constituent />} />
<Preview sourceKey="Folding" content={<Folding />} />
<Preview sourceKey="Groups" content={<Groups />} />
<Preview sourceKey="Handles" content={<Handles />} />
{/* <Preview sourceKey="HierarchicalLayout" content={<HierarchicalLayout />} /> */}
<Preview sourceKey="Layers" content={<Layers />} />
<Preview sourceKey="OrgChart" content={<OrgChart />} />
<Preview sourceKey="RadialTreeLayout" content={<RadialTreeLayout />} />
<Preview sourceKey="SwimLanes" content={<SwimLanes />} />
<Preview sourceKey="Tree" content={<Tree />} />
</PageTabs>
);
}

25
src/pages/misc/index.js Normal file
View File

@ -0,0 +1,25 @@
import React from 'react';
import Preview from '../Previews';
import Guides from './Guides';
import Merge from './Merge';
import Monitor from './Monitor';
import Permissions from './Permissions';
import Thread from './Thread';
import Validation from './Validation';
import Visibility from './Visibility';
import PageTabs from "../PageTabs";
export default function _Misc() {
return (
<PageTabs curPageURL="/misc">
{/* <Preview sourceKey="DynamicLoading" content={<DynamicLoading />} /> */}
<Preview sourceKey="Guides" content={<Guides />} />
<Preview sourceKey="Merge" content={<Merge />} />
<Preview sourceKey="Monitor" content={<Monitor />} />
<Preview sourceKey="Permissions" content={<Permissions />} />
<Preview sourceKey="Thread" content={<Thread />} />
<Preview sourceKey="Validation" content={<Validation />} />
<Preview sourceKey="Visibility" content={<Visibility />} />
</PageTabs>
);
}

View File

@ -0,0 +1,8 @@
import React from 'react';
import PageTabs from "../PageTabs";
export default function _Printing() {
return (
<PageTabs curPageURL="/printing">{/* <Preview sourceKey="PageBreaks" content={<PageBreaks />} /> */}</PageTabs>
);
}

View File

@ -0,0 +1,14 @@
import React from 'react';
import Preview from '../Previews';
import Shape from './Shape';
import Stencils from "./Stencils";
import PageTabs from "../PageTabs";
export default function _ShapesStencils() {
return (
<PageTabs curPageURL="/shapes_stencils">
<Preview sourceKey="Shape" content={<Shape />} />
{/*<Preview sourceKey="Stencils" content={<Stencils />} />*/}
</PageTabs>
);
}

View File

@ -4,10 +4,10 @@
*/
import React from 'react';
import mxEvent from '../../mxgraph/util/mxEvent';
import mxGraph from '../../mxgraph/view/mxGraph';
import mxRubberband from '../../mxgraph/handler/mxRubberband';
import mxConstants from '../../mxgraph/util/mxConstants';
import mxUtils from "../../mxgraph/util/mxUtils";
class HoverStyle extends React.Component {
constructor(props) {

16
src/pages/styles/index.js Normal file
View File

@ -0,0 +1,16 @@
import React from 'react';
import Preview from '../Previews';
import DynamicStyle from './DynamicStyle';
import HoverStyle from './HoverStyle';
import Stylesheet from './Stylesheet';
import PageTabs from "../PageTabs";
export default function _Styles() {
return (
<PageTabs curPageURL="/styles">
<Preview sourceKey="DynamicStyle" content={<DynamicStyle />} />
<Preview sourceKey="HoverStyle" content={<HoverStyle />} />
<Preview sourceKey="Stylesheet" content={<Stylesheet />} />
</PageTabs>
);
}

View File

@ -0,0 +1,14 @@
import React from 'react';
import Preview from '../Previews';
import DynamicToolbar from './DynamicToolbar';
import Toolbar from './Toolbar';
import PageTabs from "../PageTabs";
export default function _Toolbars() {
return (
<PageTabs curPageURL="/toolbars">
<Preview sourceKey="DynamicToolbar" content={<DynamicToolbar />} />
<Preview sourceKey="Toolbar" content={<Toolbar />} />
</PageTabs>
);
}

View File

@ -0,0 +1,8 @@
import React from 'react';
import Windows from "./Windows";
import Preview from "../Previews";
import PageTabs from "../PageTabs";
export default function _Windows() {
return <PageTabs curPageURL="/windows"><Preview sourceKey="Windows" content={<Windows />} /></PageTabs>;
}

View File

@ -0,0 +1,16 @@
import React from 'react';
import Preview from '../Previews';
import JsonData from './JsonData';
import Resources from './Resources';
import UserObject from './UserObject';
import PageTabs from "../PageTabs";
export default function _XMLJSON() {
return (
<PageTabs curPageURL="/xml_json">
<Preview sourceKey="JsonData" content={<JsonData />} />
<Preview sourceKey="Resources" content={<Resources />} />
<Preview sourceKey="UserObject" content={<UserObject />} />
</PageTabs>
);
}

View File

@ -0,0 +1,14 @@
import React from 'react';
import Preview from '../Previews';
import LOD from './LOD';
import OffPage from './OffPage';
import PageTabs from "../PageTabs";
export default function _ZoomOffpage() {
return (
<PageTabs curPageURL="/zoom_offpage">
<Preview sourceKey="LOD" content={<LOD />} />
<Preview sourceKey="OffPage" content={<OffPage />} />
</PageTabs>
);
}