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

use ts

parent 76fc1935
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<MenuItemProps> = props => {
const { command, icon, text } = props;
return (
......
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<DetailFormProps> {
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<DetailFormProps>()(withPropsAPI(DetailForm as any));
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<ToolbarButtonProps> = props => {
const { command, icon, text } = props;
return (
......
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<MenuItemProps> = props => {
const { command, icon, text } = props;
return (
......
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<DetailFormProps> {
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<DetailFormProps>()(withPropsAPI(DetailForm as any));
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<ToolbarButtonProps> = props => {
const { command, icon, text } = props;
return (
......
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<{
......
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';
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 () => {
<EditorMinimap />
</Col>
</Row>
<KoniCustomNode />
<KoniContextMenu />
</GGEditor>
</PageHeaderWrapper>
......
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<MenuItemProps> = props => {
const { command, icon, text } = props;
return (
......
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<DetailFormProps> {
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<DetailFormProps>()(withPropsAPI(DetailForm as any));
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<ToolbarButtonProps> = props => {
const { command, icon, text } = props;
return (
......
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<{
......
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