diff --git a/EditorFlow/src/common/IconFont/index.js b/EditorFlow/src/common/IconFont/index.ts similarity index 100% rename from EditorFlow/src/common/IconFont/index.js rename to EditorFlow/src/common/IconFont/index.ts diff --git a/EditorFlow/src/components/EditorContextMenu/FlowContextMenu.js b/EditorFlow/src/components/EditorContextMenu/FlowContextMenu.tsx similarity index 100% rename from EditorFlow/src/components/EditorContextMenu/FlowContextMenu.js rename to EditorFlow/src/components/EditorContextMenu/FlowContextMenu.tsx diff --git a/EditorFlow/src/components/EditorContextMenu/KoniContextMenu.js b/EditorFlow/src/components/EditorContextMenu/KoniContextMenu.tsx similarity index 100% rename from EditorFlow/src/components/EditorContextMenu/KoniContextMenu.js rename to EditorFlow/src/components/EditorContextMenu/KoniContextMenu.tsx diff --git a/EditorKoni/src/components/EditorContextMenu/MenuItem.js b/EditorFlow/src/components/EditorContextMenu/MenuItem.tsx similarity index 62% rename from EditorKoni/src/components/EditorContextMenu/MenuItem.js rename to EditorFlow/src/components/EditorContextMenu/MenuItem.tsx index 4cbde89e1a9a79f5ee0eb44ac5a443cd58feddb1..afbefe310398a6899ea05014a3dab9844d97882d 100644 --- a/EditorKoni/src/components/EditorContextMenu/MenuItem.js +++ b/EditorFlow/src/components/EditorContextMenu/MenuItem.tsx @@ -1,10 +1,18 @@ 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 upperFirst = (str: string) => { + return str.toLowerCase().replace(/( |^)[a-z]/g, (l: string) => l.toUpperCase()); +}; + +interface MenuItemProps { + command: string; + icon?: string; + text?: string; +} +const MenuItem: React.SFC = props => { const { command, icon, text } = props; return ( diff --git a/EditorFlow/src/components/EditorContextMenu/MindContextMenu.js b/EditorFlow/src/components/EditorContextMenu/MindContextMenu.tsx similarity index 100% rename from EditorFlow/src/components/EditorContextMenu/MindContextMenu.js rename to EditorFlow/src/components/EditorContextMenu/MindContextMenu.tsx diff --git a/EditorFlow/src/components/EditorContextMenu/index.js b/EditorFlow/src/components/EditorContextMenu/index.tsx similarity index 100% rename from EditorFlow/src/components/EditorContextMenu/index.js rename to EditorFlow/src/components/EditorContextMenu/index.tsx diff --git a/EditorFlow/src/components/EditorDetailPanel/DetailForm.js b/EditorFlow/src/components/EditorDetailPanel/DetailForm.tsx similarity index 86% rename from EditorFlow/src/components/EditorDetailPanel/DetailForm.js rename to EditorFlow/src/components/EditorDetailPanel/DetailForm.tsx index 3d68011530023482b45bf4afb29971b7c33a83d8..4d442af4fee75f9cb47894709f59e1be11fcefda 100644 --- a/EditorFlow/src/components/EditorDetailPanel/DetailForm.js +++ b/EditorFlow/src/components/EditorDetailPanel/DetailForm.tsx @@ -1,7 +1,11 @@ import React, { Fragment } from 'react'; import { Card, Form, Input, Select } from 'antd'; import { withPropsAPI } from 'gg-editor'; -import upperFirst from 'lodash/upperFirst'; +import { FormComponentProps } from 'antd/lib/form'; + +const upperFirst = (str: string) => { + return str.toLowerCase().replace(/( |^)[a-z]/g, (l: string) => l.toUpperCase()); +}; const { Item } = Form; const { Option } = Select; @@ -15,14 +19,19 @@ const inlineFormItemLayout = { }, }; -class DetailForm extends React.Component { +interface DetailFormProps extends FormComponentProps { + type: string; + propsAPI?: any; +} + +class DetailForm extends React.Component { get item() { const { propsAPI } = this.props; return propsAPI.getSelected()[0]; } - handleSubmit = e => { + handleSubmit = (e: React.FormEvent) => { if (e && e.preventDefault) { e.preventDefault(); } @@ -126,4 +135,4 @@ class DetailForm extends React.Component { } } -export default Form.create()(withPropsAPI(DetailForm)); +export default Form.create()(withPropsAPI(DetailForm as any)); diff --git a/EditorFlow/src/components/EditorDetailPanel/FlowDetailPanel.js b/EditorFlow/src/components/EditorDetailPanel/FlowDetailPanel.tsx similarity index 100% rename from EditorFlow/src/components/EditorDetailPanel/FlowDetailPanel.js rename to EditorFlow/src/components/EditorDetailPanel/FlowDetailPanel.tsx diff --git a/EditorFlow/src/components/EditorDetailPanel/KoniDetailPanel.js b/EditorFlow/src/components/EditorDetailPanel/KoniDetailPanel.tsx similarity index 100% rename from EditorFlow/src/components/EditorDetailPanel/KoniDetailPanel.js rename to EditorFlow/src/components/EditorDetailPanel/KoniDetailPanel.tsx diff --git a/EditorFlow/src/components/EditorDetailPanel/MindDetailPanel.js b/EditorFlow/src/components/EditorDetailPanel/MindDetailPanel.tsx similarity index 100% rename from EditorFlow/src/components/EditorDetailPanel/MindDetailPanel.js rename to EditorFlow/src/components/EditorDetailPanel/MindDetailPanel.tsx diff --git a/EditorFlow/src/components/EditorDetailPanel/index.js b/EditorFlow/src/components/EditorDetailPanel/index.tsx similarity index 100% rename from EditorFlow/src/components/EditorDetailPanel/index.js rename to EditorFlow/src/components/EditorDetailPanel/index.tsx diff --git a/EditorFlow/src/components/EditorItemPanel/FlowItemPanel.js b/EditorFlow/src/components/EditorItemPanel/FlowItemPanel.tsx similarity index 100% rename from EditorFlow/src/components/EditorItemPanel/FlowItemPanel.js rename to EditorFlow/src/components/EditorItemPanel/FlowItemPanel.tsx diff --git a/EditorFlow/src/components/EditorItemPanel/KoniItemPanel.js b/EditorFlow/src/components/EditorItemPanel/KoniItemPanel.tsx similarity index 100% rename from EditorFlow/src/components/EditorItemPanel/KoniItemPanel.js rename to EditorFlow/src/components/EditorItemPanel/KoniItemPanel.tsx diff --git a/EditorFlow/src/components/EditorItemPanel/index.js b/EditorFlow/src/components/EditorItemPanel/index.tsx similarity index 100% rename from EditorFlow/src/components/EditorItemPanel/index.js rename to EditorFlow/src/components/EditorItemPanel/index.tsx diff --git a/EditorFlow/src/components/EditorMinimap/index.js b/EditorFlow/src/components/EditorMinimap/index.tsx similarity index 100% rename from EditorFlow/src/components/EditorMinimap/index.js rename to EditorFlow/src/components/EditorMinimap/index.tsx diff --git a/EditorFlow/src/components/EditorToolbar/FlowToolbar.js b/EditorFlow/src/components/EditorToolbar/FlowToolbar.tsx similarity index 100% rename from EditorFlow/src/components/EditorToolbar/FlowToolbar.js rename to EditorFlow/src/components/EditorToolbar/FlowToolbar.tsx diff --git a/EditorFlow/src/components/EditorToolbar/KoniToolbar.js b/EditorFlow/src/components/EditorToolbar/KoniToolbar.tsx similarity index 100% rename from EditorFlow/src/components/EditorToolbar/KoniToolbar.js rename to EditorFlow/src/components/EditorToolbar/KoniToolbar.tsx diff --git a/EditorFlow/src/components/EditorToolbar/MindToolbar.js b/EditorFlow/src/components/EditorToolbar/MindToolbar.tsx similarity index 100% rename from EditorFlow/src/components/EditorToolbar/MindToolbar.js rename to EditorFlow/src/components/EditorToolbar/MindToolbar.tsx diff --git a/EditorMind/src/components/EditorToolbar/ToolbarButton.js b/EditorFlow/src/components/EditorToolbar/ToolbarButton.tsx similarity index 65% rename from EditorMind/src/components/EditorToolbar/ToolbarButton.js rename to EditorFlow/src/components/EditorToolbar/ToolbarButton.tsx index eb5b4ffa2f0fab721aeb8de278d243dca99d9f85..30958f0e4fba130dea4a28c7e3741f65dd162d23 100644 --- a/EditorMind/src/components/EditorToolbar/ToolbarButton.js +++ b/EditorFlow/src/components/EditorToolbar/ToolbarButton.tsx @@ -1,11 +1,19 @@ 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 upperFirst = (str: string) => { + return str.toLowerCase().replace(/( |^)[a-z]/g, (l: string) => l.toUpperCase()); +}; + +interface ToolbarButtonProps { + command: string; + icon?: string; + text?: string; +} +const ToolbarButton: React.SFC = props => { const { command, icon, text } = props; return ( diff --git a/EditorFlow/src/components/EditorToolbar/index.js b/EditorFlow/src/components/EditorToolbar/index.tsx similarity index 100% rename from EditorFlow/src/components/EditorToolbar/index.js rename to EditorFlow/src/components/EditorToolbar/index.tsx diff --git a/EditorKoni/src/common/IconFont/index.js b/EditorKoni/src/common/IconFont/index.ts similarity index 100% rename from EditorKoni/src/common/IconFont/index.js rename to EditorKoni/src/common/IconFont/index.ts diff --git a/EditorKoni/src/components/EditorContextMenu/FlowContextMenu.js b/EditorKoni/src/components/EditorContextMenu/FlowContextMenu.tsx similarity index 100% rename from EditorKoni/src/components/EditorContextMenu/FlowContextMenu.js rename to EditorKoni/src/components/EditorContextMenu/FlowContextMenu.tsx diff --git a/EditorKoni/src/components/EditorContextMenu/KoniContextMenu.js b/EditorKoni/src/components/EditorContextMenu/KoniContextMenu.tsx similarity index 100% rename from EditorKoni/src/components/EditorContextMenu/KoniContextMenu.js rename to EditorKoni/src/components/EditorContextMenu/KoniContextMenu.tsx diff --git a/EditorMind/src/components/EditorContextMenu/MenuItem.js b/EditorKoni/src/components/EditorContextMenu/MenuItem.tsx similarity index 62% rename from EditorMind/src/components/EditorContextMenu/MenuItem.js rename to EditorKoni/src/components/EditorContextMenu/MenuItem.tsx index 4cbde89e1a9a79f5ee0eb44ac5a443cd58feddb1..afbefe310398a6899ea05014a3dab9844d97882d 100644 --- a/EditorMind/src/components/EditorContextMenu/MenuItem.js +++ b/EditorKoni/src/components/EditorContextMenu/MenuItem.tsx @@ -1,10 +1,18 @@ 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 upperFirst = (str: string) => { + return str.toLowerCase().replace(/( |^)[a-z]/g, (l: string) => l.toUpperCase()); +}; + +interface MenuItemProps { + command: string; + icon?: string; + text?: string; +} +const MenuItem: React.SFC = props => { const { command, icon, text } = props; return ( diff --git a/EditorKoni/src/components/EditorContextMenu/MindContextMenu.js b/EditorKoni/src/components/EditorContextMenu/MindContextMenu.tsx similarity index 100% rename from EditorKoni/src/components/EditorContextMenu/MindContextMenu.js rename to EditorKoni/src/components/EditorContextMenu/MindContextMenu.tsx diff --git a/EditorKoni/src/components/EditorContextMenu/index.js b/EditorKoni/src/components/EditorContextMenu/index.tsx similarity index 100% rename from EditorKoni/src/components/EditorContextMenu/index.js rename to EditorKoni/src/components/EditorContextMenu/index.tsx diff --git a/EditorKoni/src/components/EditorDetailPanel/DetailForm.js b/EditorKoni/src/components/EditorDetailPanel/DetailForm.tsx similarity index 86% rename from EditorKoni/src/components/EditorDetailPanel/DetailForm.js rename to EditorKoni/src/components/EditorDetailPanel/DetailForm.tsx index 3d68011530023482b45bf4afb29971b7c33a83d8..4d442af4fee75f9cb47894709f59e1be11fcefda 100644 --- a/EditorKoni/src/components/EditorDetailPanel/DetailForm.js +++ b/EditorKoni/src/components/EditorDetailPanel/DetailForm.tsx @@ -1,7 +1,11 @@ import React, { Fragment } from 'react'; import { Card, Form, Input, Select } from 'antd'; import { withPropsAPI } from 'gg-editor'; -import upperFirst from 'lodash/upperFirst'; +import { FormComponentProps } from 'antd/lib/form'; + +const upperFirst = (str: string) => { + return str.toLowerCase().replace(/( |^)[a-z]/g, (l: string) => l.toUpperCase()); +}; const { Item } = Form; const { Option } = Select; @@ -15,14 +19,19 @@ const inlineFormItemLayout = { }, }; -class DetailForm extends React.Component { +interface DetailFormProps extends FormComponentProps { + type: string; + propsAPI?: any; +} + +class DetailForm extends React.Component { get item() { const { propsAPI } = this.props; return propsAPI.getSelected()[0]; } - handleSubmit = e => { + handleSubmit = (e: React.FormEvent) => { if (e && e.preventDefault) { e.preventDefault(); } @@ -126,4 +135,4 @@ class DetailForm extends React.Component { } } -export default Form.create()(withPropsAPI(DetailForm)); +export default Form.create()(withPropsAPI(DetailForm as any)); diff --git a/EditorKoni/src/components/EditorDetailPanel/FlowDetailPanel.js b/EditorKoni/src/components/EditorDetailPanel/FlowDetailPanel.tsx similarity index 100% rename from EditorKoni/src/components/EditorDetailPanel/FlowDetailPanel.js rename to EditorKoni/src/components/EditorDetailPanel/FlowDetailPanel.tsx diff --git a/EditorKoni/src/components/EditorDetailPanel/KoniDetailPanel.js b/EditorKoni/src/components/EditorDetailPanel/KoniDetailPanel.tsx similarity index 100% rename from EditorKoni/src/components/EditorDetailPanel/KoniDetailPanel.js rename to EditorKoni/src/components/EditorDetailPanel/KoniDetailPanel.tsx diff --git a/EditorKoni/src/components/EditorDetailPanel/MindDetailPanel.js b/EditorKoni/src/components/EditorDetailPanel/MindDetailPanel.tsx similarity index 100% rename from EditorKoni/src/components/EditorDetailPanel/MindDetailPanel.js rename to EditorKoni/src/components/EditorDetailPanel/MindDetailPanel.tsx diff --git a/EditorKoni/src/components/EditorDetailPanel/index.js b/EditorKoni/src/components/EditorDetailPanel/index.tsx similarity index 100% rename from EditorKoni/src/components/EditorDetailPanel/index.js rename to EditorKoni/src/components/EditorDetailPanel/index.tsx diff --git a/EditorKoni/src/components/EditorItemPanel/FlowItemPanel.js b/EditorKoni/src/components/EditorItemPanel/FlowItemPanel.tsx similarity index 100% rename from EditorKoni/src/components/EditorItemPanel/FlowItemPanel.js rename to EditorKoni/src/components/EditorItemPanel/FlowItemPanel.tsx diff --git a/EditorKoni/src/components/EditorItemPanel/KoniItemPanel.js b/EditorKoni/src/components/EditorItemPanel/KoniItemPanel.tsx similarity index 100% rename from EditorKoni/src/components/EditorItemPanel/KoniItemPanel.js rename to EditorKoni/src/components/EditorItemPanel/KoniItemPanel.tsx diff --git a/EditorKoni/src/components/EditorItemPanel/index.js b/EditorKoni/src/components/EditorItemPanel/index.tsx similarity index 100% rename from EditorKoni/src/components/EditorItemPanel/index.js rename to EditorKoni/src/components/EditorItemPanel/index.tsx diff --git a/EditorKoni/src/components/EditorMinimap/index.js b/EditorKoni/src/components/EditorMinimap/index.tsx similarity index 100% rename from EditorKoni/src/components/EditorMinimap/index.js rename to EditorKoni/src/components/EditorMinimap/index.tsx diff --git a/EditorKoni/src/components/EditorToolbar/FlowToolbar.js b/EditorKoni/src/components/EditorToolbar/FlowToolbar.tsx similarity index 100% rename from EditorKoni/src/components/EditorToolbar/FlowToolbar.js rename to EditorKoni/src/components/EditorToolbar/FlowToolbar.tsx diff --git a/EditorKoni/src/components/EditorToolbar/KoniToolbar.js b/EditorKoni/src/components/EditorToolbar/KoniToolbar.tsx similarity index 100% rename from EditorKoni/src/components/EditorToolbar/KoniToolbar.js rename to EditorKoni/src/components/EditorToolbar/KoniToolbar.tsx diff --git a/EditorKoni/src/components/EditorToolbar/MindToolbar.js b/EditorKoni/src/components/EditorToolbar/MindToolbar.tsx similarity index 100% rename from EditorKoni/src/components/EditorToolbar/MindToolbar.js rename to EditorKoni/src/components/EditorToolbar/MindToolbar.tsx diff --git a/EditorKoni/src/components/EditorToolbar/ToolbarButton.js b/EditorKoni/src/components/EditorToolbar/ToolbarButton.tsx similarity index 65% rename from EditorKoni/src/components/EditorToolbar/ToolbarButton.js rename to EditorKoni/src/components/EditorToolbar/ToolbarButton.tsx index eb5b4ffa2f0fab721aeb8de278d243dca99d9f85..30958f0e4fba130dea4a28c7e3741f65dd162d23 100644 --- a/EditorKoni/src/components/EditorToolbar/ToolbarButton.js +++ b/EditorKoni/src/components/EditorToolbar/ToolbarButton.tsx @@ -1,11 +1,19 @@ 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 upperFirst = (str: string) => { + return str.toLowerCase().replace(/( |^)[a-z]/g, (l: string) => l.toUpperCase()); +}; + +interface ToolbarButtonProps { + command: string; + icon?: string; + text?: string; +} +const ToolbarButton: React.SFC = props => { const { command, icon, text } = props; return ( diff --git a/EditorKoni/src/components/EditorToolbar/index.js b/EditorKoni/src/components/EditorToolbar/index.tsx similarity index 100% rename from EditorKoni/src/components/EditorToolbar/index.js rename to EditorKoni/src/components/EditorToolbar/index.tsx diff --git a/EditorKoni/src/components/PageHeaderWrapper/index.tsx b/EditorKoni/src/components/PageHeaderWrapper/index.tsx index bb565a04505fb3fb70482dfdf942d93025fc0cb8..18525c4b66ed20dfa89fd987ad943e18a710bcab 100644 --- a/EditorKoni/src/components/PageHeaderWrapper/index.tsx +++ b/EditorKoni/src/components/PageHeaderWrapper/index.tsx @@ -1,8 +1,7 @@ import React from 'react'; -import { RouteContext } from '@ant-design/pro-layout'; +import { RouteContext, GridContent } 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<{ diff --git a/EditorKoni/src/components/shape/nodes/KoniCustomNode.js b/EditorKoni/src/components/shape/nodes/KoniCustomNode.js deleted file mode 100644 index 4c13bb4f42cb3c20e55b26e63de9cdb5c9448e5d..0000000000000000000000000000000000000000 --- a/EditorKoni/src/components/shape/nodes/KoniCustomNode.js +++ /dev/null @@ -1,33 +0,0 @@ -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.tsx b/EditorKoni/src/index.tsx index f2ee717c3362fac87b06705c2324b8e86736d55f..e8e1f77dc2cfed0e76085bdad800774bef50858e 100644 --- a/EditorKoni/src/index.tsx +++ b/EditorKoni/src/index.tsx @@ -6,7 +6,6 @@ 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'; @@ -36,7 +35,6 @@ export default () => { - diff --git a/EditorMind/src/common/IconFont/index.js b/EditorMind/src/common/IconFont/index.ts similarity index 100% rename from EditorMind/src/common/IconFont/index.js rename to EditorMind/src/common/IconFont/index.ts diff --git a/EditorMind/src/components/EditorContextMenu/FlowContextMenu.js b/EditorMind/src/components/EditorContextMenu/FlowContextMenu.tsx similarity index 100% rename from EditorMind/src/components/EditorContextMenu/FlowContextMenu.js rename to EditorMind/src/components/EditorContextMenu/FlowContextMenu.tsx diff --git a/EditorMind/src/components/EditorContextMenu/KoniContextMenu.js b/EditorMind/src/components/EditorContextMenu/KoniContextMenu.tsx similarity index 100% rename from EditorMind/src/components/EditorContextMenu/KoniContextMenu.js rename to EditorMind/src/components/EditorContextMenu/KoniContextMenu.tsx diff --git a/EditorFlow/src/components/EditorContextMenu/MenuItem.js b/EditorMind/src/components/EditorContextMenu/MenuItem.tsx similarity index 62% rename from EditorFlow/src/components/EditorContextMenu/MenuItem.js rename to EditorMind/src/components/EditorContextMenu/MenuItem.tsx index 4cbde89e1a9a79f5ee0eb44ac5a443cd58feddb1..afbefe310398a6899ea05014a3dab9844d97882d 100644 --- a/EditorFlow/src/components/EditorContextMenu/MenuItem.js +++ b/EditorMind/src/components/EditorContextMenu/MenuItem.tsx @@ -1,10 +1,18 @@ 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 upperFirst = (str: string) => { + return str.toLowerCase().replace(/( |^)[a-z]/g, (l: string) => l.toUpperCase()); +}; + +interface MenuItemProps { + command: string; + icon?: string; + text?: string; +} +const MenuItem: React.SFC = props => { const { command, icon, text } = props; return ( diff --git a/EditorMind/src/components/EditorContextMenu/MindContextMenu.js b/EditorMind/src/components/EditorContextMenu/MindContextMenu.tsx similarity index 100% rename from EditorMind/src/components/EditorContextMenu/MindContextMenu.js rename to EditorMind/src/components/EditorContextMenu/MindContextMenu.tsx diff --git a/EditorMind/src/components/EditorContextMenu/index.js b/EditorMind/src/components/EditorContextMenu/index.tsx similarity index 100% rename from EditorMind/src/components/EditorContextMenu/index.js rename to EditorMind/src/components/EditorContextMenu/index.tsx diff --git a/EditorMind/src/components/EditorDetailPanel/DetailForm.js b/EditorMind/src/components/EditorDetailPanel/DetailForm.tsx similarity index 86% rename from EditorMind/src/components/EditorDetailPanel/DetailForm.js rename to EditorMind/src/components/EditorDetailPanel/DetailForm.tsx index 3d68011530023482b45bf4afb29971b7c33a83d8..4d442af4fee75f9cb47894709f59e1be11fcefda 100644 --- a/EditorMind/src/components/EditorDetailPanel/DetailForm.js +++ b/EditorMind/src/components/EditorDetailPanel/DetailForm.tsx @@ -1,7 +1,11 @@ import React, { Fragment } from 'react'; import { Card, Form, Input, Select } from 'antd'; import { withPropsAPI } from 'gg-editor'; -import upperFirst from 'lodash/upperFirst'; +import { FormComponentProps } from 'antd/lib/form'; + +const upperFirst = (str: string) => { + return str.toLowerCase().replace(/( |^)[a-z]/g, (l: string) => l.toUpperCase()); +}; const { Item } = Form; const { Option } = Select; @@ -15,14 +19,19 @@ const inlineFormItemLayout = { }, }; -class DetailForm extends React.Component { +interface DetailFormProps extends FormComponentProps { + type: string; + propsAPI?: any; +} + +class DetailForm extends React.Component { get item() { const { propsAPI } = this.props; return propsAPI.getSelected()[0]; } - handleSubmit = e => { + handleSubmit = (e: React.FormEvent) => { if (e && e.preventDefault) { e.preventDefault(); } @@ -126,4 +135,4 @@ class DetailForm extends React.Component { } } -export default Form.create()(withPropsAPI(DetailForm)); +export default Form.create()(withPropsAPI(DetailForm as any)); diff --git a/EditorMind/src/components/EditorDetailPanel/FlowDetailPanel.js b/EditorMind/src/components/EditorDetailPanel/FlowDetailPanel.tsx similarity index 100% rename from EditorMind/src/components/EditorDetailPanel/FlowDetailPanel.js rename to EditorMind/src/components/EditorDetailPanel/FlowDetailPanel.tsx diff --git a/EditorMind/src/components/EditorDetailPanel/KoniDetailPanel.js b/EditorMind/src/components/EditorDetailPanel/KoniDetailPanel.tsx similarity index 100% rename from EditorMind/src/components/EditorDetailPanel/KoniDetailPanel.js rename to EditorMind/src/components/EditorDetailPanel/KoniDetailPanel.tsx diff --git a/EditorMind/src/components/EditorDetailPanel/MindDetailPanel.js b/EditorMind/src/components/EditorDetailPanel/MindDetailPanel.tsx similarity index 100% rename from EditorMind/src/components/EditorDetailPanel/MindDetailPanel.js rename to EditorMind/src/components/EditorDetailPanel/MindDetailPanel.tsx diff --git a/EditorMind/src/components/EditorDetailPanel/index.js b/EditorMind/src/components/EditorDetailPanel/index.tsx similarity index 100% rename from EditorMind/src/components/EditorDetailPanel/index.js rename to EditorMind/src/components/EditorDetailPanel/index.tsx diff --git a/EditorMind/src/components/EditorItemPanel/FlowItemPanel.js b/EditorMind/src/components/EditorItemPanel/FlowItemPanel.tsx similarity index 100% rename from EditorMind/src/components/EditorItemPanel/FlowItemPanel.js rename to EditorMind/src/components/EditorItemPanel/FlowItemPanel.tsx diff --git a/EditorMind/src/components/EditorItemPanel/KoniItemPanel.js b/EditorMind/src/components/EditorItemPanel/KoniItemPanel.tsx similarity index 100% rename from EditorMind/src/components/EditorItemPanel/KoniItemPanel.js rename to EditorMind/src/components/EditorItemPanel/KoniItemPanel.tsx diff --git a/EditorMind/src/components/EditorItemPanel/index.js b/EditorMind/src/components/EditorItemPanel/index.tsx similarity index 100% rename from EditorMind/src/components/EditorItemPanel/index.js rename to EditorMind/src/components/EditorItemPanel/index.tsx diff --git a/EditorMind/src/components/EditorMinimap/index.js b/EditorMind/src/components/EditorMinimap/index.tsx similarity index 100% rename from EditorMind/src/components/EditorMinimap/index.js rename to EditorMind/src/components/EditorMinimap/index.tsx diff --git a/EditorMind/src/components/EditorToolbar/FlowToolbar.js b/EditorMind/src/components/EditorToolbar/FlowToolbar.tsx similarity index 100% rename from EditorMind/src/components/EditorToolbar/FlowToolbar.js rename to EditorMind/src/components/EditorToolbar/FlowToolbar.tsx diff --git a/EditorMind/src/components/EditorToolbar/KoniToolbar.js b/EditorMind/src/components/EditorToolbar/KoniToolbar.tsx similarity index 100% rename from EditorMind/src/components/EditorToolbar/KoniToolbar.js rename to EditorMind/src/components/EditorToolbar/KoniToolbar.tsx diff --git a/EditorMind/src/components/EditorToolbar/MindToolbar.js b/EditorMind/src/components/EditorToolbar/MindToolbar.tsx similarity index 100% rename from EditorMind/src/components/EditorToolbar/MindToolbar.js rename to EditorMind/src/components/EditorToolbar/MindToolbar.tsx diff --git a/EditorFlow/src/components/EditorToolbar/ToolbarButton.js b/EditorMind/src/components/EditorToolbar/ToolbarButton.tsx similarity index 65% rename from EditorFlow/src/components/EditorToolbar/ToolbarButton.js rename to EditorMind/src/components/EditorToolbar/ToolbarButton.tsx index eb5b4ffa2f0fab721aeb8de278d243dca99d9f85..30958f0e4fba130dea4a28c7e3741f65dd162d23 100644 --- a/EditorFlow/src/components/EditorToolbar/ToolbarButton.js +++ b/EditorMind/src/components/EditorToolbar/ToolbarButton.tsx @@ -1,11 +1,19 @@ 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 upperFirst = (str: string) => { + return str.toLowerCase().replace(/( |^)[a-z]/g, (l: string) => l.toUpperCase()); +}; + +interface ToolbarButtonProps { + command: string; + icon?: string; + text?: string; +} +const ToolbarButton: React.SFC = props => { const { command, icon, text } = props; return ( diff --git a/EditorMind/src/components/EditorToolbar/index.js b/EditorMind/src/components/EditorToolbar/index.tsx similarity index 100% rename from EditorMind/src/components/EditorToolbar/index.js rename to EditorMind/src/components/EditorToolbar/index.tsx diff --git a/EditorMind/src/components/PageHeaderWrapper/index.tsx b/EditorMind/src/components/PageHeaderWrapper/index.tsx index bb565a04505fb3fb70482dfdf942d93025fc0cb8..18525c4b66ed20dfa89fd987ad943e18a710bcab 100644 --- a/EditorMind/src/components/PageHeaderWrapper/index.tsx +++ b/EditorMind/src/components/PageHeaderWrapper/index.tsx @@ -1,8 +1,7 @@ import React from 'react'; -import { RouteContext } from '@ant-design/pro-layout'; +import { RouteContext, GridContent } 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<{