Commit 1f4480f1 authored by 陈帅's avatar 陈帅

use ts

parent 76fc1935
import React from 'react'; import React from 'react';
import { Command } from 'gg-editor'; import { Command } from 'gg-editor';
import upperFirst from 'lodash/upperFirst';
import IconFont from '../../common/IconFont'; import IconFont from '../../common/IconFont';
import styles from './index.less'; 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<MenuItemProps> = props => {
const { command, icon, text } = props; const { command, icon, text } = props;
return ( return (
......
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import { Card, Form, Input, Select } from 'antd'; import { Card, Form, Input, Select } from 'antd';
import { withPropsAPI } from 'gg-editor'; 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 { Item } = Form;
const { Option } = Select; const { Option } = Select;
...@@ -15,14 +19,19 @@ const inlineFormItemLayout = { ...@@ -15,14 +19,19 @@ const inlineFormItemLayout = {
}, },
}; };
class DetailForm extends React.Component { interface DetailFormProps extends FormComponentProps {
type: string;
propsAPI?: any;
}
class DetailForm extends React.Component<DetailFormProps> {
get item() { get item() {
const { propsAPI } = this.props; const { propsAPI } = this.props;
return propsAPI.getSelected()[0]; return propsAPI.getSelected()[0];
} }
handleSubmit = e => { handleSubmit = (e: React.FormEvent) => {
if (e && e.preventDefault) { if (e && e.preventDefault) {
e.preventDefault(); e.preventDefault();
} }
...@@ -126,4 +135,4 @@ class DetailForm extends React.Component { ...@@ -126,4 +135,4 @@ class DetailForm extends React.Component {
} }
} }
export default Form.create()(withPropsAPI(DetailForm)); export default Form.create<DetailFormProps>()(withPropsAPI(DetailForm as any));
import React from 'react'; import React from 'react';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
import { Command } from 'gg-editor'; import { Command } from 'gg-editor';
import upperFirst from 'lodash/upperFirst';
import IconFont from '../../common/IconFont'; import IconFont from '../../common/IconFont';
import styles from './index.less'; 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<ToolbarButtonProps> = props => {
const { command, icon, text } = props; const { command, icon, text } = props;
return ( return (
......
import React from 'react'; import React from 'react';
import { Command } from 'gg-editor'; import { Command } from 'gg-editor';
import upperFirst from 'lodash/upperFirst';
import IconFont from '../../common/IconFont'; import IconFont from '../../common/IconFont';
import styles from './index.less'; 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<MenuItemProps> = props => {
const { command, icon, text } = props; const { command, icon, text } = props;
return ( return (
......
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import { Card, Form, Input, Select } from 'antd'; import { Card, Form, Input, Select } from 'antd';
import { withPropsAPI } from 'gg-editor'; 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 { Item } = Form;
const { Option } = Select; const { Option } = Select;
...@@ -15,14 +19,19 @@ const inlineFormItemLayout = { ...@@ -15,14 +19,19 @@ const inlineFormItemLayout = {
}, },
}; };
class DetailForm extends React.Component { interface DetailFormProps extends FormComponentProps {
type: string;
propsAPI?: any;
}
class DetailForm extends React.Component<DetailFormProps> {
get item() { get item() {
const { propsAPI } = this.props; const { propsAPI } = this.props;
return propsAPI.getSelected()[0]; return propsAPI.getSelected()[0];
} }
handleSubmit = e => { handleSubmit = (e: React.FormEvent) => {
if (e && e.preventDefault) { if (e && e.preventDefault) {
e.preventDefault(); e.preventDefault();
} }
...@@ -126,4 +135,4 @@ class DetailForm extends React.Component { ...@@ -126,4 +135,4 @@ class DetailForm extends React.Component {
} }
} }
export default Form.create()(withPropsAPI(DetailForm)); export default Form.create<DetailFormProps>()(withPropsAPI(DetailForm as any));
import React from 'react'; import React from 'react';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
import { Command } from 'gg-editor'; import { Command } from 'gg-editor';
import upperFirst from 'lodash/upperFirst';
import IconFont from '../../common/IconFont'; import IconFont from '../../common/IconFont';
import styles from './index.less'; 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<ToolbarButtonProps> = props => {
const { command, icon, text } = props; const { command, icon, text } = props;
return ( return (
......
import React from 'react'; 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 { PageHeader, Tabs, Typography } from 'antd';
import styles from './index.less'; import styles from './index.less';
import { GridContent } from '@ant-design/pro-layout';
import { TabsProps } from 'antd/lib/tabs'; import { TabsProps } from 'antd/lib/tabs';
interface IPageHeaderTabConfig { interface IPageHeaderTabConfig {
tabList?: Array<{ tabList?: Array<{
......
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 <RegisterNode name="koni-custom-node" config={config} />;
}
}
export default KoniCustomNode;
...@@ -6,7 +6,6 @@ import { KoniContextMenu } from './components/EditorContextMenu'; ...@@ -6,7 +6,6 @@ import { KoniContextMenu } from './components/EditorContextMenu';
import { KoniToolbar } from './components/EditorToolbar'; import { KoniToolbar } from './components/EditorToolbar';
import { KoniItemPanel } from './components/EditorItemPanel'; import { KoniItemPanel } from './components/EditorItemPanel';
import { KoniDetailPanel } from './components/EditorDetailPanel'; import { KoniDetailPanel } from './components/EditorDetailPanel';
import KoniCustomNode from './components/shape/nodes/KoniCustomNode';
import styles from './index.less'; import styles from './index.less';
import PageHeaderWrapper from './components/PageHeaderWrapper'; import PageHeaderWrapper from './components/PageHeaderWrapper';
...@@ -36,7 +35,6 @@ export default () => { ...@@ -36,7 +35,6 @@ export default () => {
<EditorMinimap /> <EditorMinimap />
</Col> </Col>
</Row> </Row>
<KoniCustomNode />
<KoniContextMenu /> <KoniContextMenu />
</GGEditor> </GGEditor>
</PageHeaderWrapper> </PageHeaderWrapper>
......
import React from 'react'; import React from 'react';
import { Command } from 'gg-editor'; import { Command } from 'gg-editor';
import upperFirst from 'lodash/upperFirst';
import IconFont from '../../common/IconFont'; import IconFont from '../../common/IconFont';
import styles from './index.less'; 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<MenuItemProps> = props => {
const { command, icon, text } = props; const { command, icon, text } = props;
return ( return (
......
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import { Card, Form, Input, Select } from 'antd'; import { Card, Form, Input, Select } from 'antd';
import { withPropsAPI } from 'gg-editor'; 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 { Item } = Form;
const { Option } = Select; const { Option } = Select;
...@@ -15,14 +19,19 @@ const inlineFormItemLayout = { ...@@ -15,14 +19,19 @@ const inlineFormItemLayout = {
}, },
}; };
class DetailForm extends React.Component { interface DetailFormProps extends FormComponentProps {
type: string;
propsAPI?: any;
}
class DetailForm extends React.Component<DetailFormProps> {
get item() { get item() {
const { propsAPI } = this.props; const { propsAPI } = this.props;
return propsAPI.getSelected()[0]; return propsAPI.getSelected()[0];
} }
handleSubmit = e => { handleSubmit = (e: React.FormEvent) => {
if (e && e.preventDefault) { if (e && e.preventDefault) {
e.preventDefault(); e.preventDefault();
} }
...@@ -126,4 +135,4 @@ class DetailForm extends React.Component { ...@@ -126,4 +135,4 @@ class DetailForm extends React.Component {
} }
} }
export default Form.create()(withPropsAPI(DetailForm)); export default Form.create<DetailFormProps>()(withPropsAPI(DetailForm as any));
import React from 'react'; import React from 'react';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
import { Command } from 'gg-editor'; import { Command } from 'gg-editor';
import upperFirst from 'lodash/upperFirst';
import IconFont from '../../common/IconFont'; import IconFont from '../../common/IconFont';
import styles from './index.less'; 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<ToolbarButtonProps> = props => {
const { command, icon, text } = props; const { command, icon, text } = props;
return ( return (
......
import React from 'react'; 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 { PageHeader, Tabs, Typography } from 'antd';
import styles from './index.less'; import styles from './index.less';
import { GridContent } from '@ant-design/pro-layout';
import { TabsProps } from 'antd/lib/tabs'; import { TabsProps } from 'antd/lib/tabs';
interface IPageHeaderTabConfig { interface IPageHeaderTabConfig {
tabList?: Array<{ tabList?: Array<{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment