diff --git a/DashboardWorkplace/src/components/PageHeaderWrapper/index.tsx b/DashboardWorkplace/src/components/PageHeaderWrapper/index.tsx index dc5ee01b0ba79c76285fd071671dc08db7222f3f..f8f545507ae22d66c5b9f886e4d97a988fb8dc9e 100644 --- a/DashboardWorkplace/src/components/PageHeaderWrapper/index.tsx +++ b/DashboardWorkplace/src/components/PageHeaderWrapper/index.tsx @@ -20,7 +20,7 @@ const PageHeaderWrapper: React.SFC = ({ {value => (
- +
diff --git a/EditorFlow/.gitignore b/EditorFlow/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..8ce76bc425533aa85835a516e25a0d7218a6e15b --- /dev/null +++ b/EditorFlow/.gitignore @@ -0,0 +1,7 @@ +/yarn.lock +/package-lock.json +/dist +/node_modules + +.umi +.umi-production diff --git a/EditorFlow/README.md b/EditorFlow/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bfcf96e84194ede04440463bb8ed73e95a458232 --- /dev/null +++ b/EditorFlow/README.md @@ -0,0 +1,13 @@ +# @umi-blocks/ant-design-pro/flow + +flow + +## Usage + +```sh +umi block add ant-design-pro/flow +``` + +## LICENSE + +MIT diff --git a/EditorFlow/package.json b/EditorFlow/package.json new file mode 100644 index 0000000000000000000000000000000000000000..045a5998526df782f760c36f665dc8a07d56857c --- /dev/null +++ b/EditorFlow/package.json @@ -0,0 +1,36 @@ +{ + "name": "@umi-block/flow", + "version": "0.0.1", + "description": "flow", + "repository": { + "type": "git", + "url": "https://github.com/umijs/umi-blocks/ant-design-pro/flow" + }, + "license": "ISC", + "main": "src/index.js", + "scripts": { + "dev": "umi dev" + }, + "dependencies": { + "@antv/data-set": "^0.10.2", + "antd": "^3.16.3", + "bizcharts": "^3.5.2", + "bizcharts-plugin-slider": "^2.1.1-beta.1", + "dva": "^2.4.0", + "gg-editor": "^2.0.2", + "moment": "^2.22.2", + "numeral": "^2.0.6", + "react": "^16.6.3", + "react-fittext": "^1.0.0", + "umi-request": "^1.0.0" + }, + "devDependencies": { + "umi": "^2.6.9", + "umi-plugin-block-dev": "^1.1.0", + "umi-plugin-react": "^1.7.2", + "@types/numeral": "^0.0.25" + }, + "blockConfig": { + "specVersion": "0.1" + } +} diff --git a/EditorFlow/src/common/IconFont/index.js b/EditorFlow/src/common/IconFont/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3bba8d2ed7043dd0b4f542ad5ef64bd2e9939f66 --- /dev/null +++ b/EditorFlow/src/common/IconFont/index.js @@ -0,0 +1,7 @@ +import { Icon } from 'antd'; + +const IconFont = Icon.createFromIconfontCN({ + scriptUrl: 'https://at.alicdn.com/t/font_1101588_01zniftxm9yp.js', +}); + +export default IconFont; diff --git a/EditorFlow/src/components/EditorContextMenu/FlowContextMenu.js b/EditorFlow/src/components/EditorContextMenu/FlowContextMenu.js new file mode 100644 index 0000000000000000000000000000000000000000..cbb7041f2003d17f4ef53d7ea8925ff8df2bf537 --- /dev/null +++ b/EditorFlow/src/components/EditorContextMenu/FlowContextMenu.js @@ -0,0 +1,36 @@ +import React from 'react'; +import { NodeMenu, EdgeMenu, GroupMenu, MultiMenu, CanvasMenu, ContextMenu } from 'gg-editor'; +import MenuItem from './MenuItem'; +import styles from './index.less'; + +const FlowContextMenu = () => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowContextMenu; diff --git a/EditorFlow/src/components/EditorContextMenu/KoniContextMenu.js b/EditorFlow/src/components/EditorContextMenu/KoniContextMenu.js new file mode 100644 index 0000000000000000000000000000000000000000..8b049a5ee7d0d0dae9216d6f01f1f5e40b4a9904 --- /dev/null +++ b/EditorFlow/src/components/EditorContextMenu/KoniContextMenu.js @@ -0,0 +1,3 @@ +import FlowContextMenu from './FlowContextMenu'; + +export default FlowContextMenu; diff --git a/EditorFlow/src/components/EditorContextMenu/MenuItem.js b/EditorFlow/src/components/EditorContextMenu/MenuItem.js new file mode 100644 index 0000000000000000000000000000000000000000..4cbde89e1a9a79f5ee0eb44ac5a443cd58feddb1 --- /dev/null +++ b/EditorFlow/src/components/EditorContextMenu/MenuItem.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { Command } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; +import IconFont from '../../common/IconFont'; +import styles from './index.less'; + +const MenuItem = props => { + const { command, icon, text } = props; + + return ( + +
+ + {text || upperFirst(command)} +
+
+ ); +}; + +export default MenuItem; diff --git a/EditorFlow/src/components/EditorContextMenu/MindContextMenu.js b/EditorFlow/src/components/EditorContextMenu/MindContextMenu.js new file mode 100644 index 0000000000000000000000000000000000000000..2a9d43cd28672b2c0afa4d9370f40f3366e00718 --- /dev/null +++ b/EditorFlow/src/components/EditorContextMenu/MindContextMenu.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { NodeMenu, CanvasMenu, ContextMenu } from 'gg-editor'; +import MenuItem from './MenuItem'; +import styles from './index.less'; + +const MindContextMenu = () => { + return ( + + + + + + + + + + + + + + ); +}; + +export default MindContextMenu; diff --git a/EditorFlow/src/components/EditorContextMenu/index.js b/EditorFlow/src/components/EditorContextMenu/index.js new file mode 100644 index 0000000000000000000000000000000000000000..16fcde018fc9e647daea97683cf46a5a9d264cfe --- /dev/null +++ b/EditorFlow/src/components/EditorContextMenu/index.js @@ -0,0 +1,5 @@ +import FlowContextMenu from './FlowContextMenu'; +import MindContextMenu from './MindContextMenu'; +import KoniContextMenu from './KoniContextMenu'; + +export { FlowContextMenu, MindContextMenu, KoniContextMenu }; diff --git a/EditorFlow/src/components/EditorContextMenu/index.less b/EditorFlow/src/components/EditorContextMenu/index.less new file mode 100644 index 0000000000000000000000000000000000000000..8a2cdae3bfbe5ffaaef812f8ab22677f5340dc91 --- /dev/null +++ b/EditorFlow/src/components/EditorContextMenu/index.less @@ -0,0 +1,39 @@ +.contextMenu { + display: none; + overflow: hidden; + background: #fff; + border-radius: 4px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); + + .item { + display: flex; + align-items: center; + padding: 5px 12px; + cursor: pointer; + transition: all 0.3s; + user-select: none; + + &:hover { + background: #e6f7ff; + } + + i { + margin-right: 8px; + } + } + + :global { + .disable { + :local { + .item { + color: rgba(0, 0, 0, 0.25); + cursor: auto; + + &:hover { + background: #fff; + } + } + } + } + } +} diff --git a/EditorFlow/src/components/EditorDetailPanel/DetailForm.js b/EditorFlow/src/components/EditorDetailPanel/DetailForm.js new file mode 100644 index 0000000000000000000000000000000000000000..3d68011530023482b45bf4afb29971b7c33a83d8 --- /dev/null +++ b/EditorFlow/src/components/EditorDetailPanel/DetailForm.js @@ -0,0 +1,129 @@ +import React, { Fragment } from 'react'; +import { Card, Form, Input, Select } from 'antd'; +import { withPropsAPI } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; + +const { Item } = Form; +const { Option } = Select; + +const inlineFormItemLayout = { + labelCol: { + sm: { span: 8 }, + }, + wrapperCol: { + sm: { span: 16 }, + }, +}; + +class DetailForm extends React.Component { + get item() { + const { propsAPI } = this.props; + + return propsAPI.getSelected()[0]; + } + + handleSubmit = e => { + if (e && e.preventDefault) { + e.preventDefault(); + } + + const { form, propsAPI } = this.props; + const { getSelected, executeCommand, update } = propsAPI; + + setTimeout(() => { + form.validateFieldsAndScroll((err, values) => { + if (err) { + return; + } + + const item = getSelected()[0]; + + if (!item) { + return; + } + + executeCommand(() => { + update(item, { + ...values, + }); + }); + }); + }, 0); + }; + + renderEdgeShapeSelect = () => { + return ( + + ); + }; + + renderNodeDetail = () => { + const { form } = this.props; + const { label } = this.item.getModel(); + + return ( + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + ); + }; + + renderEdgeDetail = () => { + const { form } = this.props; + const { label = '', shape = 'flow-smooth' } = this.item.getModel(); + + return ( + + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + + {form.getFieldDecorator('shape', { + initialValue: shape, + })(this.renderEdgeShapeSelect())} + + + ); + }; + + renderGroupDetail = () => { + const { form } = this.props; + const { label = '新建分组' } = this.item.getModel(); + + return ( + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + ); + }; + + render() { + const { type } = this.props; + + if (!this.item) { + return null; + } + + return ( + +
+ {type === 'node' && this.renderNodeDetail()} + {type === 'edge' && this.renderEdgeDetail()} + {type === 'group' && this.renderGroupDetail()} +
+
+ ); + } +} + +export default Form.create()(withPropsAPI(DetailForm)); diff --git a/EditorFlow/src/components/EditorDetailPanel/FlowDetailPanel.js b/EditorFlow/src/components/EditorDetailPanel/FlowDetailPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..8d6816186b96e555406d5c5534903e3dc3d98b6b --- /dev/null +++ b/EditorFlow/src/components/EditorDetailPanel/FlowDetailPanel.js @@ -0,0 +1,29 @@ +import React from 'react'; +import { Card } from 'antd'; +import { NodePanel, EdgePanel, GroupPanel, MultiPanel, CanvasPanel, DetailPanel } from 'gg-editor'; +import DetailForm from './DetailForm'; +import styles from './index.less'; + +const FlowDetailPanel = () => { + return ( + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowDetailPanel; diff --git a/EditorFlow/src/components/EditorDetailPanel/KoniDetailPanel.js b/EditorFlow/src/components/EditorDetailPanel/KoniDetailPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..18aea9a44f5d96009d696e6bf145b3715c0d824c --- /dev/null +++ b/EditorFlow/src/components/EditorDetailPanel/KoniDetailPanel.js @@ -0,0 +1,3 @@ +import FlowDetailPanel from './FlowDetailPanel'; + +export default FlowDetailPanel; diff --git a/EditorFlow/src/components/EditorDetailPanel/MindDetailPanel.js b/EditorFlow/src/components/EditorDetailPanel/MindDetailPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..6b4d5c9eadd0a6f5d656d3c2f772dde7af45f85d --- /dev/null +++ b/EditorFlow/src/components/EditorDetailPanel/MindDetailPanel.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { Card } from 'antd'; +import { NodePanel, CanvasPanel, DetailPanel } from 'gg-editor'; +import DetailForm from './DetailForm'; +import styles from './index.less'; + +const MindDetailPanel = () => { + return ( + + + + + + + + + ); +}; + +export default MindDetailPanel; diff --git a/EditorFlow/src/components/EditorDetailPanel/index.js b/EditorFlow/src/components/EditorDetailPanel/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8df063eff1c22b6ce5a3ecffbd004b7de681b73b --- /dev/null +++ b/EditorFlow/src/components/EditorDetailPanel/index.js @@ -0,0 +1,5 @@ +import FlowDetailPanel from './FlowDetailPanel'; +import MindDetailPanel from './MindDetailPanel'; +import KoniDetailPanel from './KoniDetailPanel'; + +export { FlowDetailPanel, MindDetailPanel, KoniDetailPanel }; diff --git a/EditorFlow/src/components/EditorDetailPanel/index.less b/EditorFlow/src/components/EditorDetailPanel/index.less new file mode 100644 index 0000000000000000000000000000000000000000..081945be43c093076bab1744984f5377a34f0fe2 --- /dev/null +++ b/EditorFlow/src/components/EditorDetailPanel/index.less @@ -0,0 +1,10 @@ +.detailPanel { + flex: 1; + background: #fafafa; + + :global { + .ant-card { + background: #fafafa; + } + } +} diff --git a/EditorFlow/src/components/EditorItemPanel/FlowItemPanel.js b/EditorFlow/src/components/EditorItemPanel/FlowItemPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..e6912793d9dca32face694ad91687ab8accce0e9 --- /dev/null +++ b/EditorFlow/src/components/EditorItemPanel/FlowItemPanel.js @@ -0,0 +1,55 @@ +import React from 'react'; +import { Card } from 'antd'; +import { ItemPanel, Item } from 'gg-editor'; +import styles from './index.less'; + +const FlowItemPanel = () => { + return ( + + + + + + + + + ); +}; + +export default FlowItemPanel; diff --git a/EditorFlow/src/components/EditorItemPanel/KoniItemPanel.js b/EditorFlow/src/components/EditorItemPanel/KoniItemPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..9df51f98ee1b0e5a7361df103ca760e77a4c86b4 --- /dev/null +++ b/EditorFlow/src/components/EditorItemPanel/KoniItemPanel.js @@ -0,0 +1,54 @@ +import React from 'react'; +import { Card } from 'antd'; +import { ItemPanel, Item } from 'gg-editor'; +import styles from './index.less'; + +const KoniItemPanel = () => { + return ( + + + + + + + + ); +}; + +export default KoniItemPanel; diff --git a/EditorFlow/src/components/EditorItemPanel/index.js b/EditorFlow/src/components/EditorItemPanel/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2ba03fbb700d78600d6ea668a57ffaad4e0586a6 --- /dev/null +++ b/EditorFlow/src/components/EditorItemPanel/index.js @@ -0,0 +1,4 @@ +import FlowItemPanel from './FlowItemPanel'; +import KoniItemPanel from './KoniItemPanel'; + +export { FlowItemPanel, KoniItemPanel }; diff --git a/EditorFlow/src/components/EditorItemPanel/index.less b/EditorFlow/src/components/EditorItemPanel/index.less new file mode 100644 index 0000000000000000000000000000000000000000..a7acc366d1715dc50003f7e7c1335e2844112a41 --- /dev/null +++ b/EditorFlow/src/components/EditorItemPanel/index.less @@ -0,0 +1,20 @@ +.itemPanel { + flex: 1; + background: #fafafa; + + :global { + .ant-card { + background: #fafafa; + } + + .ant-card-body { + display: flex; + flex-direction: column; + align-items: center; + + > div { + margin-bottom: 16px; + } + } + } +} diff --git a/EditorFlow/src/components/EditorMinimap/index.js b/EditorFlow/src/components/EditorMinimap/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8c86b242845629d533e8d55ce436c0cd63ae59d5 --- /dev/null +++ b/EditorFlow/src/components/EditorMinimap/index.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { Card } from 'antd'; +import { Minimap } from 'gg-editor'; + +const EditorMinimap = () => { + return ( + + + + ); +}; + +export default EditorMinimap; diff --git a/EditorFlow/src/components/EditorToolbar/FlowToolbar.js b/EditorFlow/src/components/EditorToolbar/FlowToolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..374c1858bcd07f1a68368fd437ac11e0c7eb5113 --- /dev/null +++ b/EditorFlow/src/components/EditorToolbar/FlowToolbar.js @@ -0,0 +1,32 @@ +import React from 'react'; +import { Divider } from 'antd'; +import { Toolbar } from 'gg-editor'; +import ToolbarButton from './ToolbarButton'; +import styles from './index.less'; + +const FlowToolbar = () => { + return ( + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowToolbar; diff --git a/EditorFlow/src/components/EditorToolbar/KoniToolbar.js b/EditorFlow/src/components/EditorToolbar/KoniToolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..f222007aff66a7d41abfd1f6bd459d7d7138c116 --- /dev/null +++ b/EditorFlow/src/components/EditorToolbar/KoniToolbar.js @@ -0,0 +1,3 @@ +import FlowToolbar from './FlowToolbar'; + +export default FlowToolbar; diff --git a/EditorFlow/src/components/EditorToolbar/MindToolbar.js b/EditorFlow/src/components/EditorToolbar/MindToolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..1c83286ac0b06abfe634b141bb7bf4beee266cba --- /dev/null +++ b/EditorFlow/src/components/EditorToolbar/MindToolbar.js @@ -0,0 +1,27 @@ +import React from 'react'; +import { Divider } from 'antd'; +import { Toolbar } from 'gg-editor'; +import ToolbarButton from './ToolbarButton'; +import styles from './index.less'; + +const FlowToolbar = () => { + return ( + + + + + + + + + + + + + + + + ); +}; + +export default FlowToolbar; diff --git a/EditorFlow/src/components/EditorToolbar/ToolbarButton.js b/EditorFlow/src/components/EditorToolbar/ToolbarButton.js new file mode 100644 index 0000000000000000000000000000000000000000..eb5b4ffa2f0fab721aeb8de278d243dca99d9f85 --- /dev/null +++ b/EditorFlow/src/components/EditorToolbar/ToolbarButton.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { Tooltip } from 'antd'; +import { Command } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; +import IconFont from '../../common/IconFont'; +import styles from './index.less'; + +const ToolbarButton = props => { + const { command, icon, text } = props; + + return ( + + + + + + ); +}; + +export default ToolbarButton; diff --git a/EditorFlow/src/components/EditorToolbar/index.js b/EditorFlow/src/components/EditorToolbar/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ac08e3dc54a84c9d2f292878f706d34c01091474 --- /dev/null +++ b/EditorFlow/src/components/EditorToolbar/index.js @@ -0,0 +1,5 @@ +import FlowToolbar from './FlowToolbar'; +import MindToolbar from './MindToolbar'; +import KoniToolbar from './KoniToolbar'; + +export { FlowToolbar, MindToolbar, KoniToolbar }; diff --git a/EditorFlow/src/components/EditorToolbar/index.less b/EditorFlow/src/components/EditorToolbar/index.less new file mode 100644 index 0000000000000000000000000000000000000000..a5cca37c2931b149d39c94410e0d105922173e29 --- /dev/null +++ b/EditorFlow/src/components/EditorToolbar/index.less @@ -0,0 +1,39 @@ +.toolbar { + display: flex; + align-items: center; + + :global { + .command i { + display: inline-block; + width: 27px; + height: 27px; + margin: 0 6px; + padding-top: 6px; + text-align: center; + border: 1px solid #fff; + cursor: pointer; + + &:hover { + border: 1px solid #e6e9ed; + } + } + + .disable i { + color: rgba(0, 0, 0, 0.25); + cursor: auto; + + &:hover { + border: 1px solid #fff; + } + } + } +} + +.tooltip { + :global { + .ant-tooltip-inner { + font-size: 12px; + border-radius: 0; + } + } +} diff --git a/EditorFlow/src/components/PageHeaderWrapper/index.less b/EditorFlow/src/components/PageHeaderWrapper/index.less new file mode 100644 index 0000000000000000000000000000000000000000..908db575ae9f0a0cd75d04952ba4f37b3002da42 --- /dev/null +++ b/EditorFlow/src/components/PageHeaderWrapper/index.less @@ -0,0 +1,86 @@ +@import '~antd/lib/style/themes/default.less'; + +.children-content { + margin: 24px 24px 0; +} + +.main { + .detail { + display: flex; + } + + .row { + display: flex; + width: 100%; + } + + .title-content { + margin-bottom: 16px; + } + + @media screen and (max-width: @screen-sm) { + .content { + margin: 24px 0 0; + } + } + + .title, + .content { + flex: auto; + } + + .extraContent, + .main { + flex: 0 1 auto; + } + + .main { + width: 100%; + } + + .title { + margin-bottom: 16px; + } + + .logo, + .content, + .extraContent { + margin-bottom: 16px; + } + + .extraContent { + min-width: 242px; + margin-left: 88px; + text-align: right; + } +} + +@media screen and (max-width: @screen-xl) { + .extraContent { + margin-left: 44px; + } +} + +@media screen and (max-width: @screen-lg) { + .extraContent { + margin-left: 20px; + } +} + +@media screen and (max-width: @screen-md) { + .row { + display: block; + } + + .action, + .extraContent { + margin-left: 0; + text-align: left; + } +} + +@media screen and (max-width: @screen-sm) { + .detail { + display: block; + } +} diff --git a/EditorFlow/src/components/PageHeaderWrapper/index.tsx b/EditorFlow/src/components/PageHeaderWrapper/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..bb565a04505fb3fb70482dfdf942d93025fc0cb8 --- /dev/null +++ b/EditorFlow/src/components/PageHeaderWrapper/index.tsx @@ -0,0 +1,96 @@ +import React from 'react'; +import { RouteContext } from '@ant-design/pro-layout'; +import { PageHeader, Tabs, Typography } from 'antd'; +import styles from './index.less'; +import { GridContent } from '@ant-design/pro-layout'; +import { TabsProps } from 'antd/lib/tabs'; +interface IPageHeaderTabConfig { + tabList?: Array<{ + key: string; + tab: string; + }>; + tabActiveKey?: TabsProps['activeKey']; + onTabChange?: TabsProps['onChange']; + tabBarExtraContent?: TabsProps['tabBarExtraContent']; +} + +interface IPageHeaderWrapperProps extends IPageHeaderTabConfig { + content?: React.ReactNode; + title: React.ReactNode; + extraContent?: React.ReactNode; +} + +/** + * render Footer tabList + * In order to be compatible with the old version of the PageHeader + * basically all the functions are implemented. + */ +const renderFooter = ({ + tabList, + tabActiveKey, + onTabChange, + tabBarExtraContent, +}: IPageHeaderTabConfig) => { + return tabList && tabList.length ? ( + { + if (onTabChange) { + onTabChange(key); + } + }} + tabBarExtraContent={tabBarExtraContent} + > + {tabList.map(item => ( + + ))} + + ) : null; +}; + +const PageHeaderWrapper: React.SFC = ({ + children, + title, + content, + extraContent, + ...restProps +}) => ( + + {value => ( +
+ + {title || value.title} + + } + footer={renderFooter(restProps)} + > +
+
+
+ {content &&
{content}
} + {extraContent &&
{extraContent}
} +
+
+
+
+ {children ? ( + +
{children}
+
+ ) : null} +
+ )} +
+); + +export default PageHeaderWrapper; diff --git a/EditorFlow/src/index.less b/EditorFlow/src/index.less new file mode 100644 index 0000000000000000000000000000000000000000..aeffa8293bba01745b47148456f4df752bddbdf0 --- /dev/null +++ b/EditorFlow/src/index.less @@ -0,0 +1,41 @@ +.editor { + display: flex; + flex: 1; + flex-direction: column; + width: 100%; + height: calc(100vh - 250px); + background: #fff; +} + +.editorHd { + padding: 8px; + border: 1px solid #e6e9ed; +} + +.editorBd { + flex: 1; +} + +.editorSidebar, +.editorContent { + display: flex; + flex-direction: column; +} + +.editorSidebar { + background: #fafafa; + + &:first-child { + border-right: 1px solid #e6e9ed; + } + + &:last-child { + border-left: 1px solid #e6e9ed; + } +} + +.flow, +.mind, +.koni { + flex: 1; +} diff --git a/EditorFlow/src/index.tsx b/EditorFlow/src/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..d8dec88ad9a027ba8d5c96a941fc423c53bc67c6 --- /dev/null +++ b/EditorFlow/src/index.tsx @@ -0,0 +1,42 @@ +import React from 'react'; +import { Row, Col } from 'antd'; +import GGEditor, { Flow } from 'gg-editor'; +import EditorMinimap from './components/EditorMinimap'; +import { FlowContextMenu } from './components/EditorContextMenu'; +import { FlowToolbar } from './components/EditorToolbar'; +import { FlowItemPanel } from './components/EditorItemPanel'; +import { FlowDetailPanel } from './components/EditorDetailPanel'; +import styles from './index.less'; +import PageHeaderWrapper from './components/PageHeaderWrapper'; + +GGEditor.setTrackable(false); + +export default () => { + return ( + + + + + + + + + + + + + + + + + + + + + + + ); +}; diff --git a/EditorKoni/.gitignore b/EditorKoni/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..8ce76bc425533aa85835a516e25a0d7218a6e15b --- /dev/null +++ b/EditorKoni/.gitignore @@ -0,0 +1,7 @@ +/yarn.lock +/package-lock.json +/dist +/node_modules + +.umi +.umi-production diff --git a/EditorKoni/README.md b/EditorKoni/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bfcf96e84194ede04440463bb8ed73e95a458232 --- /dev/null +++ b/EditorKoni/README.md @@ -0,0 +1,13 @@ +# @umi-blocks/ant-design-pro/flow + +flow + +## Usage + +```sh +umi block add ant-design-pro/flow +``` + +## LICENSE + +MIT diff --git a/EditorKoni/package.json b/EditorKoni/package.json new file mode 100644 index 0000000000000000000000000000000000000000..045a5998526df782f760c36f665dc8a07d56857c --- /dev/null +++ b/EditorKoni/package.json @@ -0,0 +1,36 @@ +{ + "name": "@umi-block/flow", + "version": "0.0.1", + "description": "flow", + "repository": { + "type": "git", + "url": "https://github.com/umijs/umi-blocks/ant-design-pro/flow" + }, + "license": "ISC", + "main": "src/index.js", + "scripts": { + "dev": "umi dev" + }, + "dependencies": { + "@antv/data-set": "^0.10.2", + "antd": "^3.16.3", + "bizcharts": "^3.5.2", + "bizcharts-plugin-slider": "^2.1.1-beta.1", + "dva": "^2.4.0", + "gg-editor": "^2.0.2", + "moment": "^2.22.2", + "numeral": "^2.0.6", + "react": "^16.6.3", + "react-fittext": "^1.0.0", + "umi-request": "^1.0.0" + }, + "devDependencies": { + "umi": "^2.6.9", + "umi-plugin-block-dev": "^1.1.0", + "umi-plugin-react": "^1.7.2", + "@types/numeral": "^0.0.25" + }, + "blockConfig": { + "specVersion": "0.1" + } +} diff --git a/EditorKoni/src/common/IconFont/index.js b/EditorKoni/src/common/IconFont/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3bba8d2ed7043dd0b4f542ad5ef64bd2e9939f66 --- /dev/null +++ b/EditorKoni/src/common/IconFont/index.js @@ -0,0 +1,7 @@ +import { Icon } from 'antd'; + +const IconFont = Icon.createFromIconfontCN({ + scriptUrl: 'https://at.alicdn.com/t/font_1101588_01zniftxm9yp.js', +}); + +export default IconFont; diff --git a/EditorKoni/src/components/EditorContextMenu/FlowContextMenu.js b/EditorKoni/src/components/EditorContextMenu/FlowContextMenu.js new file mode 100644 index 0000000000000000000000000000000000000000..cbb7041f2003d17f4ef53d7ea8925ff8df2bf537 --- /dev/null +++ b/EditorKoni/src/components/EditorContextMenu/FlowContextMenu.js @@ -0,0 +1,36 @@ +import React from 'react'; +import { NodeMenu, EdgeMenu, GroupMenu, MultiMenu, CanvasMenu, ContextMenu } from 'gg-editor'; +import MenuItem from './MenuItem'; +import styles from './index.less'; + +const FlowContextMenu = () => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowContextMenu; diff --git a/EditorKoni/src/components/EditorContextMenu/KoniContextMenu.js b/EditorKoni/src/components/EditorContextMenu/KoniContextMenu.js new file mode 100644 index 0000000000000000000000000000000000000000..8b049a5ee7d0d0dae9216d6f01f1f5e40b4a9904 --- /dev/null +++ b/EditorKoni/src/components/EditorContextMenu/KoniContextMenu.js @@ -0,0 +1,3 @@ +import FlowContextMenu from './FlowContextMenu'; + +export default FlowContextMenu; diff --git a/EditorKoni/src/components/EditorContextMenu/MenuItem.js b/EditorKoni/src/components/EditorContextMenu/MenuItem.js new file mode 100644 index 0000000000000000000000000000000000000000..4cbde89e1a9a79f5ee0eb44ac5a443cd58feddb1 --- /dev/null +++ b/EditorKoni/src/components/EditorContextMenu/MenuItem.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { Command } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; +import IconFont from '../../common/IconFont'; +import styles from './index.less'; + +const MenuItem = props => { + const { command, icon, text } = props; + + return ( + +
+ + {text || upperFirst(command)} +
+
+ ); +}; + +export default MenuItem; diff --git a/EditorKoni/src/components/EditorContextMenu/MindContextMenu.js b/EditorKoni/src/components/EditorContextMenu/MindContextMenu.js new file mode 100644 index 0000000000000000000000000000000000000000..2a9d43cd28672b2c0afa4d9370f40f3366e00718 --- /dev/null +++ b/EditorKoni/src/components/EditorContextMenu/MindContextMenu.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { NodeMenu, CanvasMenu, ContextMenu } from 'gg-editor'; +import MenuItem from './MenuItem'; +import styles from './index.less'; + +const MindContextMenu = () => { + return ( + + + + + + + + + + + + + + ); +}; + +export default MindContextMenu; diff --git a/EditorKoni/src/components/EditorContextMenu/index.js b/EditorKoni/src/components/EditorContextMenu/index.js new file mode 100644 index 0000000000000000000000000000000000000000..16fcde018fc9e647daea97683cf46a5a9d264cfe --- /dev/null +++ b/EditorKoni/src/components/EditorContextMenu/index.js @@ -0,0 +1,5 @@ +import FlowContextMenu from './FlowContextMenu'; +import MindContextMenu from './MindContextMenu'; +import KoniContextMenu from './KoniContextMenu'; + +export { FlowContextMenu, MindContextMenu, KoniContextMenu }; diff --git a/EditorKoni/src/components/EditorContextMenu/index.less b/EditorKoni/src/components/EditorContextMenu/index.less new file mode 100644 index 0000000000000000000000000000000000000000..8a2cdae3bfbe5ffaaef812f8ab22677f5340dc91 --- /dev/null +++ b/EditorKoni/src/components/EditorContextMenu/index.less @@ -0,0 +1,39 @@ +.contextMenu { + display: none; + overflow: hidden; + background: #fff; + border-radius: 4px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); + + .item { + display: flex; + align-items: center; + padding: 5px 12px; + cursor: pointer; + transition: all 0.3s; + user-select: none; + + &:hover { + background: #e6f7ff; + } + + i { + margin-right: 8px; + } + } + + :global { + .disable { + :local { + .item { + color: rgba(0, 0, 0, 0.25); + cursor: auto; + + &:hover { + background: #fff; + } + } + } + } + } +} diff --git a/EditorKoni/src/components/EditorDetailPanel/DetailForm.js b/EditorKoni/src/components/EditorDetailPanel/DetailForm.js new file mode 100644 index 0000000000000000000000000000000000000000..3d68011530023482b45bf4afb29971b7c33a83d8 --- /dev/null +++ b/EditorKoni/src/components/EditorDetailPanel/DetailForm.js @@ -0,0 +1,129 @@ +import React, { Fragment } from 'react'; +import { Card, Form, Input, Select } from 'antd'; +import { withPropsAPI } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; + +const { Item } = Form; +const { Option } = Select; + +const inlineFormItemLayout = { + labelCol: { + sm: { span: 8 }, + }, + wrapperCol: { + sm: { span: 16 }, + }, +}; + +class DetailForm extends React.Component { + get item() { + const { propsAPI } = this.props; + + return propsAPI.getSelected()[0]; + } + + handleSubmit = e => { + if (e && e.preventDefault) { + e.preventDefault(); + } + + const { form, propsAPI } = this.props; + const { getSelected, executeCommand, update } = propsAPI; + + setTimeout(() => { + form.validateFieldsAndScroll((err, values) => { + if (err) { + return; + } + + const item = getSelected()[0]; + + if (!item) { + return; + } + + executeCommand(() => { + update(item, { + ...values, + }); + }); + }); + }, 0); + }; + + renderEdgeShapeSelect = () => { + return ( + + ); + }; + + renderNodeDetail = () => { + const { form } = this.props; + const { label } = this.item.getModel(); + + return ( + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + ); + }; + + renderEdgeDetail = () => { + const { form } = this.props; + const { label = '', shape = 'flow-smooth' } = this.item.getModel(); + + return ( + + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + + {form.getFieldDecorator('shape', { + initialValue: shape, + })(this.renderEdgeShapeSelect())} + + + ); + }; + + renderGroupDetail = () => { + const { form } = this.props; + const { label = '新建分组' } = this.item.getModel(); + + return ( + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + ); + }; + + render() { + const { type } = this.props; + + if (!this.item) { + return null; + } + + return ( + +
+ {type === 'node' && this.renderNodeDetail()} + {type === 'edge' && this.renderEdgeDetail()} + {type === 'group' && this.renderGroupDetail()} +
+
+ ); + } +} + +export default Form.create()(withPropsAPI(DetailForm)); diff --git a/EditorKoni/src/components/EditorDetailPanel/FlowDetailPanel.js b/EditorKoni/src/components/EditorDetailPanel/FlowDetailPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..8d6816186b96e555406d5c5534903e3dc3d98b6b --- /dev/null +++ b/EditorKoni/src/components/EditorDetailPanel/FlowDetailPanel.js @@ -0,0 +1,29 @@ +import React from 'react'; +import { Card } from 'antd'; +import { NodePanel, EdgePanel, GroupPanel, MultiPanel, CanvasPanel, DetailPanel } from 'gg-editor'; +import DetailForm from './DetailForm'; +import styles from './index.less'; + +const FlowDetailPanel = () => { + return ( + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowDetailPanel; diff --git a/EditorKoni/src/components/EditorDetailPanel/KoniDetailPanel.js b/EditorKoni/src/components/EditorDetailPanel/KoniDetailPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..18aea9a44f5d96009d696e6bf145b3715c0d824c --- /dev/null +++ b/EditorKoni/src/components/EditorDetailPanel/KoniDetailPanel.js @@ -0,0 +1,3 @@ +import FlowDetailPanel from './FlowDetailPanel'; + +export default FlowDetailPanel; diff --git a/EditorKoni/src/components/EditorDetailPanel/MindDetailPanel.js b/EditorKoni/src/components/EditorDetailPanel/MindDetailPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..6b4d5c9eadd0a6f5d656d3c2f772dde7af45f85d --- /dev/null +++ b/EditorKoni/src/components/EditorDetailPanel/MindDetailPanel.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { Card } from 'antd'; +import { NodePanel, CanvasPanel, DetailPanel } from 'gg-editor'; +import DetailForm from './DetailForm'; +import styles from './index.less'; + +const MindDetailPanel = () => { + return ( + + + + + + + + + ); +}; + +export default MindDetailPanel; diff --git a/EditorKoni/src/components/EditorDetailPanel/index.js b/EditorKoni/src/components/EditorDetailPanel/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8df063eff1c22b6ce5a3ecffbd004b7de681b73b --- /dev/null +++ b/EditorKoni/src/components/EditorDetailPanel/index.js @@ -0,0 +1,5 @@ +import FlowDetailPanel from './FlowDetailPanel'; +import MindDetailPanel from './MindDetailPanel'; +import KoniDetailPanel from './KoniDetailPanel'; + +export { FlowDetailPanel, MindDetailPanel, KoniDetailPanel }; diff --git a/EditorKoni/src/components/EditorDetailPanel/index.less b/EditorKoni/src/components/EditorDetailPanel/index.less new file mode 100644 index 0000000000000000000000000000000000000000..081945be43c093076bab1744984f5377a34f0fe2 --- /dev/null +++ b/EditorKoni/src/components/EditorDetailPanel/index.less @@ -0,0 +1,10 @@ +.detailPanel { + flex: 1; + background: #fafafa; + + :global { + .ant-card { + background: #fafafa; + } + } +} diff --git a/EditorKoni/src/components/EditorItemPanel/FlowItemPanel.js b/EditorKoni/src/components/EditorItemPanel/FlowItemPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..e6912793d9dca32face694ad91687ab8accce0e9 --- /dev/null +++ b/EditorKoni/src/components/EditorItemPanel/FlowItemPanel.js @@ -0,0 +1,55 @@ +import React from 'react'; +import { Card } from 'antd'; +import { ItemPanel, Item } from 'gg-editor'; +import styles from './index.less'; + +const FlowItemPanel = () => { + return ( + + + + + + + + + ); +}; + +export default FlowItemPanel; diff --git a/EditorKoni/src/components/EditorItemPanel/KoniItemPanel.js b/EditorKoni/src/components/EditorItemPanel/KoniItemPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..9df51f98ee1b0e5a7361df103ca760e77a4c86b4 --- /dev/null +++ b/EditorKoni/src/components/EditorItemPanel/KoniItemPanel.js @@ -0,0 +1,54 @@ +import React from 'react'; +import { Card } from 'antd'; +import { ItemPanel, Item } from 'gg-editor'; +import styles from './index.less'; + +const KoniItemPanel = () => { + return ( + + + + + + + + ); +}; + +export default KoniItemPanel; diff --git a/EditorKoni/src/components/EditorItemPanel/index.js b/EditorKoni/src/components/EditorItemPanel/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2ba03fbb700d78600d6ea668a57ffaad4e0586a6 --- /dev/null +++ b/EditorKoni/src/components/EditorItemPanel/index.js @@ -0,0 +1,4 @@ +import FlowItemPanel from './FlowItemPanel'; +import KoniItemPanel from './KoniItemPanel'; + +export { FlowItemPanel, KoniItemPanel }; diff --git a/EditorKoni/src/components/EditorItemPanel/index.less b/EditorKoni/src/components/EditorItemPanel/index.less new file mode 100644 index 0000000000000000000000000000000000000000..a7acc366d1715dc50003f7e7c1335e2844112a41 --- /dev/null +++ b/EditorKoni/src/components/EditorItemPanel/index.less @@ -0,0 +1,20 @@ +.itemPanel { + flex: 1; + background: #fafafa; + + :global { + .ant-card { + background: #fafafa; + } + + .ant-card-body { + display: flex; + flex-direction: column; + align-items: center; + + > div { + margin-bottom: 16px; + } + } + } +} diff --git a/EditorKoni/src/components/EditorMinimap/index.js b/EditorKoni/src/components/EditorMinimap/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8c86b242845629d533e8d55ce436c0cd63ae59d5 --- /dev/null +++ b/EditorKoni/src/components/EditorMinimap/index.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { Card } from 'antd'; +import { Minimap } from 'gg-editor'; + +const EditorMinimap = () => { + return ( + + + + ); +}; + +export default EditorMinimap; diff --git a/EditorKoni/src/components/EditorToolbar/FlowToolbar.js b/EditorKoni/src/components/EditorToolbar/FlowToolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..374c1858bcd07f1a68368fd437ac11e0c7eb5113 --- /dev/null +++ b/EditorKoni/src/components/EditorToolbar/FlowToolbar.js @@ -0,0 +1,32 @@ +import React from 'react'; +import { Divider } from 'antd'; +import { Toolbar } from 'gg-editor'; +import ToolbarButton from './ToolbarButton'; +import styles from './index.less'; + +const FlowToolbar = () => { + return ( + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowToolbar; diff --git a/EditorKoni/src/components/EditorToolbar/KoniToolbar.js b/EditorKoni/src/components/EditorToolbar/KoniToolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..f222007aff66a7d41abfd1f6bd459d7d7138c116 --- /dev/null +++ b/EditorKoni/src/components/EditorToolbar/KoniToolbar.js @@ -0,0 +1,3 @@ +import FlowToolbar from './FlowToolbar'; + +export default FlowToolbar; diff --git a/EditorKoni/src/components/EditorToolbar/MindToolbar.js b/EditorKoni/src/components/EditorToolbar/MindToolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..1c83286ac0b06abfe634b141bb7bf4beee266cba --- /dev/null +++ b/EditorKoni/src/components/EditorToolbar/MindToolbar.js @@ -0,0 +1,27 @@ +import React from 'react'; +import { Divider } from 'antd'; +import { Toolbar } from 'gg-editor'; +import ToolbarButton from './ToolbarButton'; +import styles from './index.less'; + +const FlowToolbar = () => { + return ( + + + + + + + + + + + + + + + + ); +}; + +export default FlowToolbar; diff --git a/EditorKoni/src/components/EditorToolbar/ToolbarButton.js b/EditorKoni/src/components/EditorToolbar/ToolbarButton.js new file mode 100644 index 0000000000000000000000000000000000000000..eb5b4ffa2f0fab721aeb8de278d243dca99d9f85 --- /dev/null +++ b/EditorKoni/src/components/EditorToolbar/ToolbarButton.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { Tooltip } from 'antd'; +import { Command } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; +import IconFont from '../../common/IconFont'; +import styles from './index.less'; + +const ToolbarButton = props => { + const { command, icon, text } = props; + + return ( + + + + + + ); +}; + +export default ToolbarButton; diff --git a/EditorKoni/src/components/EditorToolbar/index.js b/EditorKoni/src/components/EditorToolbar/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ac08e3dc54a84c9d2f292878f706d34c01091474 --- /dev/null +++ b/EditorKoni/src/components/EditorToolbar/index.js @@ -0,0 +1,5 @@ +import FlowToolbar from './FlowToolbar'; +import MindToolbar from './MindToolbar'; +import KoniToolbar from './KoniToolbar'; + +export { FlowToolbar, MindToolbar, KoniToolbar }; diff --git a/EditorKoni/src/components/EditorToolbar/index.less b/EditorKoni/src/components/EditorToolbar/index.less new file mode 100644 index 0000000000000000000000000000000000000000..a5cca37c2931b149d39c94410e0d105922173e29 --- /dev/null +++ b/EditorKoni/src/components/EditorToolbar/index.less @@ -0,0 +1,39 @@ +.toolbar { + display: flex; + align-items: center; + + :global { + .command i { + display: inline-block; + width: 27px; + height: 27px; + margin: 0 6px; + padding-top: 6px; + text-align: center; + border: 1px solid #fff; + cursor: pointer; + + &:hover { + border: 1px solid #e6e9ed; + } + } + + .disable i { + color: rgba(0, 0, 0, 0.25); + cursor: auto; + + &:hover { + border: 1px solid #fff; + } + } + } +} + +.tooltip { + :global { + .ant-tooltip-inner { + font-size: 12px; + border-radius: 0; + } + } +} diff --git a/EditorKoni/src/components/PageHeaderWrapper/index.less b/EditorKoni/src/components/PageHeaderWrapper/index.less new file mode 100644 index 0000000000000000000000000000000000000000..908db575ae9f0a0cd75d04952ba4f37b3002da42 --- /dev/null +++ b/EditorKoni/src/components/PageHeaderWrapper/index.less @@ -0,0 +1,86 @@ +@import '~antd/lib/style/themes/default.less'; + +.children-content { + margin: 24px 24px 0; +} + +.main { + .detail { + display: flex; + } + + .row { + display: flex; + width: 100%; + } + + .title-content { + margin-bottom: 16px; + } + + @media screen and (max-width: @screen-sm) { + .content { + margin: 24px 0 0; + } + } + + .title, + .content { + flex: auto; + } + + .extraContent, + .main { + flex: 0 1 auto; + } + + .main { + width: 100%; + } + + .title { + margin-bottom: 16px; + } + + .logo, + .content, + .extraContent { + margin-bottom: 16px; + } + + .extraContent { + min-width: 242px; + margin-left: 88px; + text-align: right; + } +} + +@media screen and (max-width: @screen-xl) { + .extraContent { + margin-left: 44px; + } +} + +@media screen and (max-width: @screen-lg) { + .extraContent { + margin-left: 20px; + } +} + +@media screen and (max-width: @screen-md) { + .row { + display: block; + } + + .action, + .extraContent { + margin-left: 0; + text-align: left; + } +} + +@media screen and (max-width: @screen-sm) { + .detail { + display: block; + } +} diff --git a/EditorKoni/src/components/PageHeaderWrapper/index.tsx b/EditorKoni/src/components/PageHeaderWrapper/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..bb565a04505fb3fb70482dfdf942d93025fc0cb8 --- /dev/null +++ b/EditorKoni/src/components/PageHeaderWrapper/index.tsx @@ -0,0 +1,96 @@ +import React from 'react'; +import { RouteContext } from '@ant-design/pro-layout'; +import { PageHeader, Tabs, Typography } from 'antd'; +import styles from './index.less'; +import { GridContent } from '@ant-design/pro-layout'; +import { TabsProps } from 'antd/lib/tabs'; +interface IPageHeaderTabConfig { + tabList?: Array<{ + key: string; + tab: string; + }>; + tabActiveKey?: TabsProps['activeKey']; + onTabChange?: TabsProps['onChange']; + tabBarExtraContent?: TabsProps['tabBarExtraContent']; +} + +interface IPageHeaderWrapperProps extends IPageHeaderTabConfig { + content?: React.ReactNode; + title: React.ReactNode; + extraContent?: React.ReactNode; +} + +/** + * render Footer tabList + * In order to be compatible with the old version of the PageHeader + * basically all the functions are implemented. + */ +const renderFooter = ({ + tabList, + tabActiveKey, + onTabChange, + tabBarExtraContent, +}: IPageHeaderTabConfig) => { + return tabList && tabList.length ? ( + { + if (onTabChange) { + onTabChange(key); + } + }} + tabBarExtraContent={tabBarExtraContent} + > + {tabList.map(item => ( + + ))} + + ) : null; +}; + +const PageHeaderWrapper: React.SFC = ({ + children, + title, + content, + extraContent, + ...restProps +}) => ( + + {value => ( +
+ + {title || value.title} + + } + footer={renderFooter(restProps)} + > +
+
+
+ {content &&
{content}
} + {extraContent &&
{extraContent}
} +
+
+
+
+ {children ? ( + +
{children}
+
+ ) : null} +
+ )} +
+); + +export default PageHeaderWrapper; diff --git a/EditorKoni/src/components/shape/nodes/KoniCustomNode.js b/EditorKoni/src/components/shape/nodes/KoniCustomNode.js new file mode 100644 index 0000000000000000000000000000000000000000..4c13bb4f42cb3c20e55b26e63de9cdb5c9448e5d --- /dev/null +++ b/EditorKoni/src/components/shape/nodes/KoniCustomNode.js @@ -0,0 +1,33 @@ +import React from 'react'; +import { RegisterNode } from 'gg-editor'; + +class KoniCustomNode extends React.Component { + render() { + const config = { + draw(item) { + const keyShape = this.drawKeyShape(item); + + // draw label + this.drawLabel(item); + + // draw image + const group = item.getGraphicGroup(); + const model = item.getModel(); + + group.addShape('image', { + attrs: { + x: -7, + y: -7, + img: model.icon, + }, + }); + + return keyShape; + }, + }; + + return ; + } +} + +export default KoniCustomNode; diff --git a/EditorKoni/src/index.less b/EditorKoni/src/index.less new file mode 100644 index 0000000000000000000000000000000000000000..aeffa8293bba01745b47148456f4df752bddbdf0 --- /dev/null +++ b/EditorKoni/src/index.less @@ -0,0 +1,41 @@ +.editor { + display: flex; + flex: 1; + flex-direction: column; + width: 100%; + height: calc(100vh - 250px); + background: #fff; +} + +.editorHd { + padding: 8px; + border: 1px solid #e6e9ed; +} + +.editorBd { + flex: 1; +} + +.editorSidebar, +.editorContent { + display: flex; + flex-direction: column; +} + +.editorSidebar { + background: #fafafa; + + &:first-child { + border-right: 1px solid #e6e9ed; + } + + &:last-child { + border-left: 1px solid #e6e9ed; + } +} + +.flow, +.mind, +.koni { + flex: 1; +} diff --git a/EditorKoni/src/index.tsx b/EditorKoni/src/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..f2ee717c3362fac87b06705c2324b8e86736d55f --- /dev/null +++ b/EditorKoni/src/index.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import { Row, Col } from 'antd'; +import GGEditor, { Koni } from 'gg-editor'; +import EditorMinimap from './components/EditorMinimap'; +import { KoniContextMenu } from './components/EditorContextMenu'; +import { KoniToolbar } from './components/EditorToolbar'; +import { KoniItemPanel } from './components/EditorItemPanel'; +import { KoniDetailPanel } from './components/EditorDetailPanel'; +import KoniCustomNode from './components/shape/nodes/KoniCustomNode'; +import styles from './index.less'; +import PageHeaderWrapper from './components/PageHeaderWrapper'; + +GGEditor.setTrackable(false); + +export default () => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + ); +}; diff --git a/EditorMind/.gitignore b/EditorMind/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..8ce76bc425533aa85835a516e25a0d7218a6e15b --- /dev/null +++ b/EditorMind/.gitignore @@ -0,0 +1,7 @@ +/yarn.lock +/package-lock.json +/dist +/node_modules + +.umi +.umi-production diff --git a/EditorMind/README.md b/EditorMind/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bfcf96e84194ede04440463bb8ed73e95a458232 --- /dev/null +++ b/EditorMind/README.md @@ -0,0 +1,13 @@ +# @umi-blocks/ant-design-pro/flow + +flow + +## Usage + +```sh +umi block add ant-design-pro/flow +``` + +## LICENSE + +MIT diff --git a/EditorMind/package.json b/EditorMind/package.json new file mode 100644 index 0000000000000000000000000000000000000000..045a5998526df782f760c36f665dc8a07d56857c --- /dev/null +++ b/EditorMind/package.json @@ -0,0 +1,36 @@ +{ + "name": "@umi-block/flow", + "version": "0.0.1", + "description": "flow", + "repository": { + "type": "git", + "url": "https://github.com/umijs/umi-blocks/ant-design-pro/flow" + }, + "license": "ISC", + "main": "src/index.js", + "scripts": { + "dev": "umi dev" + }, + "dependencies": { + "@antv/data-set": "^0.10.2", + "antd": "^3.16.3", + "bizcharts": "^3.5.2", + "bizcharts-plugin-slider": "^2.1.1-beta.1", + "dva": "^2.4.0", + "gg-editor": "^2.0.2", + "moment": "^2.22.2", + "numeral": "^2.0.6", + "react": "^16.6.3", + "react-fittext": "^1.0.0", + "umi-request": "^1.0.0" + }, + "devDependencies": { + "umi": "^2.6.9", + "umi-plugin-block-dev": "^1.1.0", + "umi-plugin-react": "^1.7.2", + "@types/numeral": "^0.0.25" + }, + "blockConfig": { + "specVersion": "0.1" + } +} diff --git a/EditorMind/src/common/IconFont/index.js b/EditorMind/src/common/IconFont/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3bba8d2ed7043dd0b4f542ad5ef64bd2e9939f66 --- /dev/null +++ b/EditorMind/src/common/IconFont/index.js @@ -0,0 +1,7 @@ +import { Icon } from 'antd'; + +const IconFont = Icon.createFromIconfontCN({ + scriptUrl: 'https://at.alicdn.com/t/font_1101588_01zniftxm9yp.js', +}); + +export default IconFont; diff --git a/EditorMind/src/components/EditorContextMenu/FlowContextMenu.js b/EditorMind/src/components/EditorContextMenu/FlowContextMenu.js new file mode 100644 index 0000000000000000000000000000000000000000..cbb7041f2003d17f4ef53d7ea8925ff8df2bf537 --- /dev/null +++ b/EditorMind/src/components/EditorContextMenu/FlowContextMenu.js @@ -0,0 +1,36 @@ +import React from 'react'; +import { NodeMenu, EdgeMenu, GroupMenu, MultiMenu, CanvasMenu, ContextMenu } from 'gg-editor'; +import MenuItem from './MenuItem'; +import styles from './index.less'; + +const FlowContextMenu = () => { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowContextMenu; diff --git a/EditorMind/src/components/EditorContextMenu/KoniContextMenu.js b/EditorMind/src/components/EditorContextMenu/KoniContextMenu.js new file mode 100644 index 0000000000000000000000000000000000000000..8b049a5ee7d0d0dae9216d6f01f1f5e40b4a9904 --- /dev/null +++ b/EditorMind/src/components/EditorContextMenu/KoniContextMenu.js @@ -0,0 +1,3 @@ +import FlowContextMenu from './FlowContextMenu'; + +export default FlowContextMenu; diff --git a/EditorMind/src/components/EditorContextMenu/MenuItem.js b/EditorMind/src/components/EditorContextMenu/MenuItem.js new file mode 100644 index 0000000000000000000000000000000000000000..4cbde89e1a9a79f5ee0eb44ac5a443cd58feddb1 --- /dev/null +++ b/EditorMind/src/components/EditorContextMenu/MenuItem.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { Command } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; +import IconFont from '../../common/IconFont'; +import styles from './index.less'; + +const MenuItem = props => { + const { command, icon, text } = props; + + return ( + +
+ + {text || upperFirst(command)} +
+
+ ); +}; + +export default MenuItem; diff --git a/EditorMind/src/components/EditorContextMenu/MindContextMenu.js b/EditorMind/src/components/EditorContextMenu/MindContextMenu.js new file mode 100644 index 0000000000000000000000000000000000000000..2a9d43cd28672b2c0afa4d9370f40f3366e00718 --- /dev/null +++ b/EditorMind/src/components/EditorContextMenu/MindContextMenu.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { NodeMenu, CanvasMenu, ContextMenu } from 'gg-editor'; +import MenuItem from './MenuItem'; +import styles from './index.less'; + +const MindContextMenu = () => { + return ( + + + + + + + + + + + + + + ); +}; + +export default MindContextMenu; diff --git a/EditorMind/src/components/EditorContextMenu/index.js b/EditorMind/src/components/EditorContextMenu/index.js new file mode 100644 index 0000000000000000000000000000000000000000..16fcde018fc9e647daea97683cf46a5a9d264cfe --- /dev/null +++ b/EditorMind/src/components/EditorContextMenu/index.js @@ -0,0 +1,5 @@ +import FlowContextMenu from './FlowContextMenu'; +import MindContextMenu from './MindContextMenu'; +import KoniContextMenu from './KoniContextMenu'; + +export { FlowContextMenu, MindContextMenu, KoniContextMenu }; diff --git a/EditorMind/src/components/EditorContextMenu/index.less b/EditorMind/src/components/EditorContextMenu/index.less new file mode 100644 index 0000000000000000000000000000000000000000..8a2cdae3bfbe5ffaaef812f8ab22677f5340dc91 --- /dev/null +++ b/EditorMind/src/components/EditorContextMenu/index.less @@ -0,0 +1,39 @@ +.contextMenu { + display: none; + overflow: hidden; + background: #fff; + border-radius: 4px; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); + + .item { + display: flex; + align-items: center; + padding: 5px 12px; + cursor: pointer; + transition: all 0.3s; + user-select: none; + + &:hover { + background: #e6f7ff; + } + + i { + margin-right: 8px; + } + } + + :global { + .disable { + :local { + .item { + color: rgba(0, 0, 0, 0.25); + cursor: auto; + + &:hover { + background: #fff; + } + } + } + } + } +} diff --git a/EditorMind/src/components/EditorDetailPanel/DetailForm.js b/EditorMind/src/components/EditorDetailPanel/DetailForm.js new file mode 100644 index 0000000000000000000000000000000000000000..3d68011530023482b45bf4afb29971b7c33a83d8 --- /dev/null +++ b/EditorMind/src/components/EditorDetailPanel/DetailForm.js @@ -0,0 +1,129 @@ +import React, { Fragment } from 'react'; +import { Card, Form, Input, Select } from 'antd'; +import { withPropsAPI } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; + +const { Item } = Form; +const { Option } = Select; + +const inlineFormItemLayout = { + labelCol: { + sm: { span: 8 }, + }, + wrapperCol: { + sm: { span: 16 }, + }, +}; + +class DetailForm extends React.Component { + get item() { + const { propsAPI } = this.props; + + return propsAPI.getSelected()[0]; + } + + handleSubmit = e => { + if (e && e.preventDefault) { + e.preventDefault(); + } + + const { form, propsAPI } = this.props; + const { getSelected, executeCommand, update } = propsAPI; + + setTimeout(() => { + form.validateFieldsAndScroll((err, values) => { + if (err) { + return; + } + + const item = getSelected()[0]; + + if (!item) { + return; + } + + executeCommand(() => { + update(item, { + ...values, + }); + }); + }); + }, 0); + }; + + renderEdgeShapeSelect = () => { + return ( + + ); + }; + + renderNodeDetail = () => { + const { form } = this.props; + const { label } = this.item.getModel(); + + return ( + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + ); + }; + + renderEdgeDetail = () => { + const { form } = this.props; + const { label = '', shape = 'flow-smooth' } = this.item.getModel(); + + return ( + + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + + {form.getFieldDecorator('shape', { + initialValue: shape, + })(this.renderEdgeShapeSelect())} + + + ); + }; + + renderGroupDetail = () => { + const { form } = this.props; + const { label = '新建分组' } = this.item.getModel(); + + return ( + + {form.getFieldDecorator('label', { + initialValue: label, + })()} + + ); + }; + + render() { + const { type } = this.props; + + if (!this.item) { + return null; + } + + return ( + +
+ {type === 'node' && this.renderNodeDetail()} + {type === 'edge' && this.renderEdgeDetail()} + {type === 'group' && this.renderGroupDetail()} +
+
+ ); + } +} + +export default Form.create()(withPropsAPI(DetailForm)); diff --git a/EditorMind/src/components/EditorDetailPanel/FlowDetailPanel.js b/EditorMind/src/components/EditorDetailPanel/FlowDetailPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..8d6816186b96e555406d5c5534903e3dc3d98b6b --- /dev/null +++ b/EditorMind/src/components/EditorDetailPanel/FlowDetailPanel.js @@ -0,0 +1,29 @@ +import React from 'react'; +import { Card } from 'antd'; +import { NodePanel, EdgePanel, GroupPanel, MultiPanel, CanvasPanel, DetailPanel } from 'gg-editor'; +import DetailForm from './DetailForm'; +import styles from './index.less'; + +const FlowDetailPanel = () => { + return ( + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowDetailPanel; diff --git a/EditorMind/src/components/EditorDetailPanel/KoniDetailPanel.js b/EditorMind/src/components/EditorDetailPanel/KoniDetailPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..18aea9a44f5d96009d696e6bf145b3715c0d824c --- /dev/null +++ b/EditorMind/src/components/EditorDetailPanel/KoniDetailPanel.js @@ -0,0 +1,3 @@ +import FlowDetailPanel from './FlowDetailPanel'; + +export default FlowDetailPanel; diff --git a/EditorMind/src/components/EditorDetailPanel/MindDetailPanel.js b/EditorMind/src/components/EditorDetailPanel/MindDetailPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..6b4d5c9eadd0a6f5d656d3c2f772dde7af45f85d --- /dev/null +++ b/EditorMind/src/components/EditorDetailPanel/MindDetailPanel.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { Card } from 'antd'; +import { NodePanel, CanvasPanel, DetailPanel } from 'gg-editor'; +import DetailForm from './DetailForm'; +import styles from './index.less'; + +const MindDetailPanel = () => { + return ( + + + + + + + + + ); +}; + +export default MindDetailPanel; diff --git a/EditorMind/src/components/EditorDetailPanel/index.js b/EditorMind/src/components/EditorDetailPanel/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8df063eff1c22b6ce5a3ecffbd004b7de681b73b --- /dev/null +++ b/EditorMind/src/components/EditorDetailPanel/index.js @@ -0,0 +1,5 @@ +import FlowDetailPanel from './FlowDetailPanel'; +import MindDetailPanel from './MindDetailPanel'; +import KoniDetailPanel from './KoniDetailPanel'; + +export { FlowDetailPanel, MindDetailPanel, KoniDetailPanel }; diff --git a/EditorMind/src/components/EditorDetailPanel/index.less b/EditorMind/src/components/EditorDetailPanel/index.less new file mode 100644 index 0000000000000000000000000000000000000000..081945be43c093076bab1744984f5377a34f0fe2 --- /dev/null +++ b/EditorMind/src/components/EditorDetailPanel/index.less @@ -0,0 +1,10 @@ +.detailPanel { + flex: 1; + background: #fafafa; + + :global { + .ant-card { + background: #fafafa; + } + } +} diff --git a/EditorMind/src/components/EditorItemPanel/FlowItemPanel.js b/EditorMind/src/components/EditorItemPanel/FlowItemPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..e6912793d9dca32face694ad91687ab8accce0e9 --- /dev/null +++ b/EditorMind/src/components/EditorItemPanel/FlowItemPanel.js @@ -0,0 +1,55 @@ +import React from 'react'; +import { Card } from 'antd'; +import { ItemPanel, Item } from 'gg-editor'; +import styles from './index.less'; + +const FlowItemPanel = () => { + return ( + + + + + + + + + ); +}; + +export default FlowItemPanel; diff --git a/EditorMind/src/components/EditorItemPanel/KoniItemPanel.js b/EditorMind/src/components/EditorItemPanel/KoniItemPanel.js new file mode 100644 index 0000000000000000000000000000000000000000..9df51f98ee1b0e5a7361df103ca760e77a4c86b4 --- /dev/null +++ b/EditorMind/src/components/EditorItemPanel/KoniItemPanel.js @@ -0,0 +1,54 @@ +import React from 'react'; +import { Card } from 'antd'; +import { ItemPanel, Item } from 'gg-editor'; +import styles from './index.less'; + +const KoniItemPanel = () => { + return ( + + + + + + + + ); +}; + +export default KoniItemPanel; diff --git a/EditorMind/src/components/EditorItemPanel/index.js b/EditorMind/src/components/EditorItemPanel/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2ba03fbb700d78600d6ea668a57ffaad4e0586a6 --- /dev/null +++ b/EditorMind/src/components/EditorItemPanel/index.js @@ -0,0 +1,4 @@ +import FlowItemPanel from './FlowItemPanel'; +import KoniItemPanel from './KoniItemPanel'; + +export { FlowItemPanel, KoniItemPanel }; diff --git a/EditorMind/src/components/EditorItemPanel/index.less b/EditorMind/src/components/EditorItemPanel/index.less new file mode 100644 index 0000000000000000000000000000000000000000..a7acc366d1715dc50003f7e7c1335e2844112a41 --- /dev/null +++ b/EditorMind/src/components/EditorItemPanel/index.less @@ -0,0 +1,20 @@ +.itemPanel { + flex: 1; + background: #fafafa; + + :global { + .ant-card { + background: #fafafa; + } + + .ant-card-body { + display: flex; + flex-direction: column; + align-items: center; + + > div { + margin-bottom: 16px; + } + } + } +} diff --git a/EditorMind/src/components/EditorMinimap/index.js b/EditorMind/src/components/EditorMinimap/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8c86b242845629d533e8d55ce436c0cd63ae59d5 --- /dev/null +++ b/EditorMind/src/components/EditorMinimap/index.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { Card } from 'antd'; +import { Minimap } from 'gg-editor'; + +const EditorMinimap = () => { + return ( + + + + ); +}; + +export default EditorMinimap; diff --git a/EditorMind/src/components/EditorToolbar/FlowToolbar.js b/EditorMind/src/components/EditorToolbar/FlowToolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..374c1858bcd07f1a68368fd437ac11e0c7eb5113 --- /dev/null +++ b/EditorMind/src/components/EditorToolbar/FlowToolbar.js @@ -0,0 +1,32 @@ +import React from 'react'; +import { Divider } from 'antd'; +import { Toolbar } from 'gg-editor'; +import ToolbarButton from './ToolbarButton'; +import styles from './index.less'; + +const FlowToolbar = () => { + return ( + + + + + + + + + + + + + + + + + + + + + ); +}; + +export default FlowToolbar; diff --git a/EditorMind/src/components/EditorToolbar/KoniToolbar.js b/EditorMind/src/components/EditorToolbar/KoniToolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..f222007aff66a7d41abfd1f6bd459d7d7138c116 --- /dev/null +++ b/EditorMind/src/components/EditorToolbar/KoniToolbar.js @@ -0,0 +1,3 @@ +import FlowToolbar from './FlowToolbar'; + +export default FlowToolbar; diff --git a/EditorMind/src/components/EditorToolbar/MindToolbar.js b/EditorMind/src/components/EditorToolbar/MindToolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..1c83286ac0b06abfe634b141bb7bf4beee266cba --- /dev/null +++ b/EditorMind/src/components/EditorToolbar/MindToolbar.js @@ -0,0 +1,27 @@ +import React from 'react'; +import { Divider } from 'antd'; +import { Toolbar } from 'gg-editor'; +import ToolbarButton from './ToolbarButton'; +import styles from './index.less'; + +const FlowToolbar = () => { + return ( + + + + + + + + + + + + + + + + ); +}; + +export default FlowToolbar; diff --git a/EditorMind/src/components/EditorToolbar/ToolbarButton.js b/EditorMind/src/components/EditorToolbar/ToolbarButton.js new file mode 100644 index 0000000000000000000000000000000000000000..eb5b4ffa2f0fab721aeb8de278d243dca99d9f85 --- /dev/null +++ b/EditorMind/src/components/EditorToolbar/ToolbarButton.js @@ -0,0 +1,24 @@ +import React from 'react'; +import { Tooltip } from 'antd'; +import { Command } from 'gg-editor'; +import upperFirst from 'lodash/upperFirst'; +import IconFont from '../../common/IconFont'; +import styles from './index.less'; + +const ToolbarButton = props => { + const { command, icon, text } = props; + + return ( + + + + + + ); +}; + +export default ToolbarButton; diff --git a/EditorMind/src/components/EditorToolbar/index.js b/EditorMind/src/components/EditorToolbar/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ac08e3dc54a84c9d2f292878f706d34c01091474 --- /dev/null +++ b/EditorMind/src/components/EditorToolbar/index.js @@ -0,0 +1,5 @@ +import FlowToolbar from './FlowToolbar'; +import MindToolbar from './MindToolbar'; +import KoniToolbar from './KoniToolbar'; + +export { FlowToolbar, MindToolbar, KoniToolbar }; diff --git a/EditorMind/src/components/EditorToolbar/index.less b/EditorMind/src/components/EditorToolbar/index.less new file mode 100644 index 0000000000000000000000000000000000000000..a5cca37c2931b149d39c94410e0d105922173e29 --- /dev/null +++ b/EditorMind/src/components/EditorToolbar/index.less @@ -0,0 +1,39 @@ +.toolbar { + display: flex; + align-items: center; + + :global { + .command i { + display: inline-block; + width: 27px; + height: 27px; + margin: 0 6px; + padding-top: 6px; + text-align: center; + border: 1px solid #fff; + cursor: pointer; + + &:hover { + border: 1px solid #e6e9ed; + } + } + + .disable i { + color: rgba(0, 0, 0, 0.25); + cursor: auto; + + &:hover { + border: 1px solid #fff; + } + } + } +} + +.tooltip { + :global { + .ant-tooltip-inner { + font-size: 12px; + border-radius: 0; + } + } +} diff --git a/EditorMind/src/components/PageHeaderWrapper/index.less b/EditorMind/src/components/PageHeaderWrapper/index.less new file mode 100644 index 0000000000000000000000000000000000000000..908db575ae9f0a0cd75d04952ba4f37b3002da42 --- /dev/null +++ b/EditorMind/src/components/PageHeaderWrapper/index.less @@ -0,0 +1,86 @@ +@import '~antd/lib/style/themes/default.less'; + +.children-content { + margin: 24px 24px 0; +} + +.main { + .detail { + display: flex; + } + + .row { + display: flex; + width: 100%; + } + + .title-content { + margin-bottom: 16px; + } + + @media screen and (max-width: @screen-sm) { + .content { + margin: 24px 0 0; + } + } + + .title, + .content { + flex: auto; + } + + .extraContent, + .main { + flex: 0 1 auto; + } + + .main { + width: 100%; + } + + .title { + margin-bottom: 16px; + } + + .logo, + .content, + .extraContent { + margin-bottom: 16px; + } + + .extraContent { + min-width: 242px; + margin-left: 88px; + text-align: right; + } +} + +@media screen and (max-width: @screen-xl) { + .extraContent { + margin-left: 44px; + } +} + +@media screen and (max-width: @screen-lg) { + .extraContent { + margin-left: 20px; + } +} + +@media screen and (max-width: @screen-md) { + .row { + display: block; + } + + .action, + .extraContent { + margin-left: 0; + text-align: left; + } +} + +@media screen and (max-width: @screen-sm) { + .detail { + display: block; + } +} diff --git a/EditorMind/src/components/PageHeaderWrapper/index.tsx b/EditorMind/src/components/PageHeaderWrapper/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..bb565a04505fb3fb70482dfdf942d93025fc0cb8 --- /dev/null +++ b/EditorMind/src/components/PageHeaderWrapper/index.tsx @@ -0,0 +1,96 @@ +import React from 'react'; +import { RouteContext } from '@ant-design/pro-layout'; +import { PageHeader, Tabs, Typography } from 'antd'; +import styles from './index.less'; +import { GridContent } from '@ant-design/pro-layout'; +import { TabsProps } from 'antd/lib/tabs'; +interface IPageHeaderTabConfig { + tabList?: Array<{ + key: string; + tab: string; + }>; + tabActiveKey?: TabsProps['activeKey']; + onTabChange?: TabsProps['onChange']; + tabBarExtraContent?: TabsProps['tabBarExtraContent']; +} + +interface IPageHeaderWrapperProps extends IPageHeaderTabConfig { + content?: React.ReactNode; + title: React.ReactNode; + extraContent?: React.ReactNode; +} + +/** + * render Footer tabList + * In order to be compatible with the old version of the PageHeader + * basically all the functions are implemented. + */ +const renderFooter = ({ + tabList, + tabActiveKey, + onTabChange, + tabBarExtraContent, +}: IPageHeaderTabConfig) => { + return tabList && tabList.length ? ( + { + if (onTabChange) { + onTabChange(key); + } + }} + tabBarExtraContent={tabBarExtraContent} + > + {tabList.map(item => ( + + ))} + + ) : null; +}; + +const PageHeaderWrapper: React.SFC = ({ + children, + title, + content, + extraContent, + ...restProps +}) => ( + + {value => ( +
+ + {title || value.title} + + } + footer={renderFooter(restProps)} + > +
+
+
+ {content &&
{content}
} + {extraContent &&
{extraContent}
} +
+
+
+
+ {children ? ( + +
{children}
+
+ ) : null} +
+ )} +
+); + +export default PageHeaderWrapper; diff --git a/EditorMind/src/index.less b/EditorMind/src/index.less new file mode 100644 index 0000000000000000000000000000000000000000..aeffa8293bba01745b47148456f4df752bddbdf0 --- /dev/null +++ b/EditorMind/src/index.less @@ -0,0 +1,41 @@ +.editor { + display: flex; + flex: 1; + flex-direction: column; + width: 100%; + height: calc(100vh - 250px); + background: #fff; +} + +.editorHd { + padding: 8px; + border: 1px solid #e6e9ed; +} + +.editorBd { + flex: 1; +} + +.editorSidebar, +.editorContent { + display: flex; + flex-direction: column; +} + +.editorSidebar { + background: #fafafa; + + &:first-child { + border-right: 1px solid #e6e9ed; + } + + &:last-child { + border-left: 1px solid #e6e9ed; + } +} + +.flow, +.mind, +.koni { + flex: 1; +} diff --git a/EditorMind/src/index.tsx b/EditorMind/src/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..62c954da606089f2c2c86502fdaae892784eeeef --- /dev/null +++ b/EditorMind/src/index.tsx @@ -0,0 +1,39 @@ +import React from 'react'; +import { Row, Col } from 'antd'; +import GGEditor, { Mind } from 'gg-editor'; +import EditorMinimap from './components/EditorMinimap'; +import { MindContextMenu } from './components/EditorContextMenu'; +import { MindToolbar } from './components/EditorToolbar'; +import { MindDetailPanel } from './components/EditorDetailPanel'; +import data from './worldCup2018.json'; +import styles from './index.less'; +import PageHeaderWrapper from './components/PageHeaderWrapper'; + +GGEditor.setTrackable(false); + +export default () => { + return ( + + + + + + + + + + + + + + + + + + + + ); +}; diff --git a/EditorMind/src/worldCup2018.json b/EditorMind/src/worldCup2018.json new file mode 100644 index 0000000000000000000000000000000000000000..44f3e63f56ae005d569335026a79f8f0012d4611 --- /dev/null +++ b/EditorMind/src/worldCup2018.json @@ -0,0 +1,129 @@ +{ + "roots": [ + { + "label": "法国", + "children": [ + { + "label": "克罗地亚", + "side": "left", + "children": [ + { + "label": "克罗地亚", + "children": [ + { + "label": "克罗地亚", + "children": [ + { + "label": "克罗地亚" + }, + { + "label": "丹麦" + } + ] + }, + { + "label": "俄罗斯", + "children": [ + { + "label": "俄罗斯" + }, + { + "label": "西班牙" + } + ] + } + ] + }, + { + "label": "英格兰", + "children": [ + { + "label": "英格兰", + "children": [ + { + "label": "英格兰" + }, + { + "label": "哥伦比亚" + } + ] + }, + { + "label": "瑞典", + "children": [ + { + "label": "瑞士" + }, + { + "label": "瑞典" + } + ] + } + ] + } + ] + }, + { + "label": "法国", + "side": "right", + "children": [ + { + "label": "法国", + "children": [ + { + "label": "法国", + "children": [ + { + "label": "法国" + }, + { + "label": "阿根廷" + } + ] + }, + { + "label": "乌拉圭", + "children": [ + { + "label": "乌拉圭" + }, + { + "label": "葡萄牙" + } + ] + } + ] + }, + { + "label": "比利时", + "children": [ + { + "label": "比利时", + "children": [ + { + "label": "比利时" + }, + { + "label": "日本" + } + ] + }, + { + "label": "巴西", + "children": [ + { + "label": "巴西" + }, + { + "label": "墨西哥" + } + ] + } + ] + } + ] + } + ] + } + ] +} diff --git a/FormBasicForm/src/components/PageHeaderWrapper/index.tsx b/FormBasicForm/src/components/PageHeaderWrapper/index.tsx index 2776ca838b259906934ba71362bd10cd329555dc..93a13146d9ca267a040c3cc66fcc50c1723f6326 100644 --- a/FormBasicForm/src/components/PageHeaderWrapper/index.tsx +++ b/FormBasicForm/src/components/PageHeaderWrapper/index.tsx @@ -18,6 +18,7 @@ const PageHeaderWrapper: React.SFC = ({ {value => (
= ({ margin: 0, }} > - {title} + {title || value.title} } {...restProps} - {...value} > {content} diff --git a/FormStepForm/src/components/PageHeaderWrapper/index.tsx b/FormStepForm/src/components/PageHeaderWrapper/index.tsx index fe1a33b8a4fa0759d759c01304484d9eee5e7986..7186520a77222ae3661708e1d6db1e520cfb7e80 100644 --- a/FormStepForm/src/components/PageHeaderWrapper/index.tsx +++ b/FormStepForm/src/components/PageHeaderWrapper/index.tsx @@ -21,6 +21,7 @@ const PageHeaderWrapper: React.SFC = ({ {value => (
= ({ margin: 0, }} > - {title} + {title || value.title} } {...restProps} - {...value} >
diff --git a/ListCardList/src/components/PageHeaderWrapper/index.tsx b/ListCardList/src/components/PageHeaderWrapper/index.tsx index fe1a33b8a4fa0759d759c01304484d9eee5e7986..7186520a77222ae3661708e1d6db1e520cfb7e80 100644 --- a/ListCardList/src/components/PageHeaderWrapper/index.tsx +++ b/ListCardList/src/components/PageHeaderWrapper/index.tsx @@ -21,6 +21,7 @@ const PageHeaderWrapper: React.SFC = ({ {value => (
= ({ margin: 0, }} > - {title} + {title || value.title} } {...restProps} - {...value} >
diff --git a/ListSearch/src/components/PageHeaderWrapper/index.tsx b/ListSearch/src/components/PageHeaderWrapper/index.tsx index 6ed06a5550cf1e7065ceaaa5af019583b02e0ec0..622a42b33bc63e7fb9c17fd47530ff75de99b81d 100644 --- a/ListSearch/src/components/PageHeaderWrapper/index.tsx +++ b/ListSearch/src/components/PageHeaderWrapper/index.tsx @@ -60,6 +60,7 @@ const PageHeaderWrapper: React.SFC = ({ {value => (
= ({ margin: 0, }} > - {title} + {title || value.title} } {...restProps} - {...value} footer={renderFooter(restProps)} >
diff --git a/ListSearchApplications/src/components/PageHeaderWrapper/index.tsx b/ListSearchApplications/src/components/PageHeaderWrapper/index.tsx index fe1a33b8a4fa0759d759c01304484d9eee5e7986..7186520a77222ae3661708e1d6db1e520cfb7e80 100644 --- a/ListSearchApplications/src/components/PageHeaderWrapper/index.tsx +++ b/ListSearchApplications/src/components/PageHeaderWrapper/index.tsx @@ -21,6 +21,7 @@ const PageHeaderWrapper: React.SFC = ({ {value => (
= ({ margin: 0, }} > - {title} + {title || value.title} } {...restProps} - {...value} >
diff --git a/ProfileBasic/src/components/PageHeaderWrapper/index.tsx b/ProfileBasic/src/components/PageHeaderWrapper/index.tsx index d92c875ea6568cfe3db7ea3da8debeaaaf788c67..0f20f43acf05352831c1462385e7e7f9d84c0810 100644 --- a/ProfileBasic/src/components/PageHeaderWrapper/index.tsx +++ b/ProfileBasic/src/components/PageHeaderWrapper/index.tsx @@ -13,6 +13,7 @@ const PageHeaderWrapper: React.SFC = ({ children, conte {value => (
= ({ children, conte margin: 0, }} > - {title} + {title || value.title} } - {...value} > {content} diff --git a/package.json b/package.json index 146328a8cf4f7181a60aa642d83cc543f601205a..c5904c3d2ebfe4accd1041002d2eea7f93be7b71 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "scripts": { - "dev": "cross-env PAGES_PATH='SearchList/src' umi dev", + "dev": "cross-env PAGES_PATH='EditorKoni/src' umi dev", "lint": "npm run lint:ts && npm run lint:style && npm run lint:prettier", "lint-staged": "lint-staged", "lint-staged:ts": "tslint",