yangpei
4 years ago
77 changed files with 777 additions and 809 deletions
@ -1,32 +1,32 @@ |
|||
import React from 'react'; |
|||
|
|||
import {Graph} from '@antv/x6'; |
|||
import {safeGet} from '../../../utils'; |
|||
import {BoldOutlined} from '@ant-design/icons'; |
|||
import { Graph } from '@antv/x6'; |
|||
import { safeGet } from '../../../utils'; |
|||
import { BoldOutlined } from '@ant-design/icons'; |
|||
import shortcuts from '../../../common/shortcuts'; |
|||
import makeBtnWidget from './common/makeBtnWidget'; |
|||
|
|||
interface IProps { |
|||
flowChart: Graph |
|||
flowChart: Graph; |
|||
} |
|||
|
|||
const Bold: React.FC<IProps> = makeBtnWidget({ |
|||
tooltip: '加粗', |
|||
handler: shortcuts['bold'].handler, |
|||
handler: shortcuts.bold.handler, |
|||
getIcon() { |
|||
return <BoldOutlined/>; |
|||
return <BoldOutlined />; |
|||
}, |
|||
disabled(flowChart: Graph) { |
|||
return flowChart.getSelectedCellCount() === 0; |
|||
}, |
|||
selected(flowChart: Graph) { |
|||
const cells = flowChart.getSelectedCells(); |
|||
if(cells.length > 0) { |
|||
if (cells.length > 0) { |
|||
return safeGet(cells, '0.attrs.label.fontWeight', 'normal') === 'bold'; |
|||
} else { |
|||
return false; |
|||
} |
|||
} |
|||
}, |
|||
}); |
|||
|
|||
export default Bold; |
|||
|
@ -1,25 +1,25 @@ |
|||
import React from 'react'; |
|||
|
|||
import {Graph} from '@antv/x6'; |
|||
import { Graph } from '@antv/x6'; |
|||
import XIcon from '../../../components/xIcon'; |
|||
import makeBtnWidget from './common/makeBtnWidget'; |
|||
import {getSelectedNodes, hasNodeSelected} from '../../../utils/flowChartUtils'; |
|||
import { getSelectedNodes, hasNodeSelected } from '../../../utils/flowChartUtils'; |
|||
|
|||
interface IProps { |
|||
flowChart: Graph |
|||
flowChart: Graph; |
|||
} |
|||
|
|||
const BringToBack: React.FC<IProps> = makeBtnWidget({ |
|||
tooltip: '置于底层', |
|||
getIcon() { |
|||
return <XIcon type={'icon-bringtobottom'}/>; |
|||
return <XIcon type={'icon-bringtobottom'} />; |
|||
}, |
|||
handler(flowChart: Graph) { |
|||
getSelectedNodes(flowChart).forEach(node => node.toBack()); |
|||
getSelectedNodes(flowChart).forEach((node) => node.toBack()); |
|||
}, |
|||
disabled(flowChart: Graph) { |
|||
return !hasNodeSelected(flowChart); |
|||
} |
|||
}, |
|||
}); |
|||
|
|||
export default BringToBack; |
@ -1,26 +1,26 @@ |
|||
//at.alicdn.com/t/font_2024452_s39le1337k9.js
|
|||
// at.alicdn.com/t/font_2024452_s39le1337k9.js
|
|||
import React from 'react'; |
|||
|
|||
import {Graph} from '@antv/x6'; |
|||
import { Graph } from '@antv/x6'; |
|||
import XIcon from '../../../components/xIcon'; |
|||
import makeBtnWidget from './common/makeBtnWidget'; |
|||
import {getSelectedNodes, hasNodeSelected} from '../../../utils/flowChartUtils'; |
|||
import { getSelectedNodes, hasNodeSelected } from '../../../utils/flowChartUtils'; |
|||
|
|||
interface IProps { |
|||
flowChart: Graph |
|||
flowChart: Graph; |
|||
} |
|||
|
|||
const BringToTop: React.FC<IProps> = makeBtnWidget({ |
|||
tooltip: '置于顶层', |
|||
getIcon() { |
|||
return <XIcon type={'icon-bringtotop'}/>; |
|||
return <XIcon type={'icon-bringtotop'} />; |
|||
}, |
|||
handler(flowChart: Graph) { |
|||
getSelectedNodes(flowChart).forEach(node => node.toFront()); |
|||
getSelectedNodes(flowChart).forEach((node) => node.toFront()); |
|||
}, |
|||
disabled(flowChart: Graph) { |
|||
return !hasNodeSelected(flowChart); |
|||
} |
|||
}, |
|||
}); |
|||
|
|||
export default BringToTop; |
@ -1,21 +1,21 @@ |
|||
import React from 'react'; |
|||
|
|||
import {Graph} from '@antv/x6'; |
|||
import { Graph } from '@antv/x6'; |
|||
import makeBtnWidget from './common/makeBtnWidget'; |
|||
import {FullscreenExitOutlined} from '@ant-design/icons'; |
|||
import { FullscreenExitOutlined } from '@ant-design/icons'; |
|||
|
|||
interface IProps { |
|||
flowChart: Graph |
|||
flowChart: Graph; |
|||
} |
|||
|
|||
const FitWindow: React.FC<IProps> = makeBtnWidget({ |
|||
tooltip: '适配窗口', |
|||
getIcon() { |
|||
return <FullscreenExitOutlined/>; |
|||
return <FullscreenExitOutlined />; |
|||
}, |
|||
handler(flowChart: Graph) { |
|||
flowChart.zoomToFit({minScale: 0.5, maxScale: 1}); |
|||
} |
|||
flowChart.zoomToFit({ minScale: 0.5, maxScale: 1 }); |
|||
}, |
|||
}); |
|||
|
|||
export default FitWindow; |
|||
|
@ -1,32 +1,32 @@ |
|||
import React from 'react'; |
|||
|
|||
import {Graph} from '@antv/x6'; |
|||
import {safeGet} from '../../../utils'; |
|||
import { Graph } from '@antv/x6'; |
|||
import { safeGet } from '../../../utils'; |
|||
import makeBtnWidget from './common/makeBtnWidget'; |
|||
import {ItalicOutlined} from '@ant-design/icons'; |
|||
import { ItalicOutlined } from '@ant-design/icons'; |
|||
import shortcuts from '../../../common/shortcuts'; |
|||
|
|||
interface IProps { |
|||
flowChart: Graph |
|||
flowChart: Graph; |
|||
} |
|||
|
|||
const Italic: React.FC<IProps> = makeBtnWidget({ |
|||
tooltip: '斜体', |
|||
handler: shortcuts['italic'].handler, |
|||
handler: shortcuts.italic.handler, |
|||
getIcon() { |
|||
return <ItalicOutlined/>; |
|||
return <ItalicOutlined />; |
|||
}, |
|||
disabled(flowChart: Graph) { |
|||
return flowChart.getSelectedCellCount() === 0; |
|||
}, |
|||
selected(flowChart: Graph) { |
|||
const cells = flowChart.getSelectedCells(); |
|||
if(cells.length > 0) { |
|||
if (cells.length > 0) { |
|||
return safeGet(cells, '0.attrs.label.fontStyle', 'normal') === 'italic'; |
|||
} else { |
|||
return false; |
|||
} |
|||
} |
|||
}, |
|||
}); |
|||
|
|||
export default Italic; |
|||
|
@ -1,23 +1,23 @@ |
|||
import React from 'react'; |
|||
|
|||
import {Graph} from '@antv/x6'; |
|||
import {RedoOutlined} from '@ant-design/icons'; |
|||
import { Graph } from '@antv/x6'; |
|||
import { RedoOutlined } from '@ant-design/icons'; |
|||
import shortcuts from '../../../common/shortcuts'; |
|||
import makeBtnWidget from './common/makeBtnWidget'; |
|||
|
|||
interface IProps { |
|||
flowChart: Graph |
|||
flowChart: Graph; |
|||
} |
|||
|
|||
const Save: React.FC<IProps> = makeBtnWidget({ |
|||
tooltip: '重做', |
|||
handler: shortcuts['redo'].handler, |
|||
handler: shortcuts.redo.handler, |
|||
getIcon() { |
|||
return <RedoOutlined/>; |
|||
return <RedoOutlined />; |
|||
}, |
|||
disabled(flowChart: Graph) { |
|||
return !flowChart.canRedo(); |
|||
} |
|||
}, |
|||
}); |
|||
|
|||
export default Save; |
|||
|
@ -1,20 +1,20 @@ |
|||
import React from 'react'; |
|||
|
|||
import {Graph} from '@antv/x6'; |
|||
import {SaveOutlined} from '@ant-design/icons'; |
|||
import { Graph } from '@antv/x6'; |
|||
import { SaveOutlined } from '@ant-design/icons'; |
|||
import shortcuts from '../../../common/shortcuts'; |
|||
import makeBtnWidget from './common/makeBtnWidget'; |
|||
|
|||
interface IProps { |
|||
flowChart: Graph |
|||
flowChart: Graph; |
|||
} |
|||
|
|||
const Save: React.FC<IProps> = makeBtnWidget({ |
|||
tooltip: '保存', |
|||
handler: shortcuts['save'].handler, |
|||
handler: shortcuts.save.handler, |
|||
getIcon() { |
|||
return <SaveOutlined/>; |
|||
} |
|||
return <SaveOutlined />; |
|||
}, |
|||
}); |
|||
|
|||
export default Save; |
|||
|
@ -1,32 +1,32 @@ |
|||
import React from 'react'; |
|||
|
|||
import {Graph} from '@antv/x6'; |
|||
import {safeGet} from '../../../utils'; |
|||
import { Graph } from '@antv/x6'; |
|||
import { safeGet } from '../../../utils'; |
|||
import shortcuts from '../../../common/shortcuts'; |
|||
import makeBtnWidget from './common/makeBtnWidget'; |
|||
import {UnderlineOutlined} from '@ant-design/icons'; |
|||
import { UnderlineOutlined } from '@ant-design/icons'; |
|||
|
|||
interface IProps { |
|||
flowChart: Graph |
|||
flowChart: Graph; |
|||
} |
|||
|
|||
const Underline: React.FC<IProps> = makeBtnWidget({ |
|||
tooltip: '下划线', |
|||
handler: shortcuts['underline'].handler, |
|||
handler: shortcuts.underline.handler, |
|||
getIcon() { |
|||
return <UnderlineOutlined/>; |
|||
return <UnderlineOutlined />; |
|||
}, |
|||
disabled(flowChart: Graph) { |
|||
return flowChart.getSelectedCellCount() === 0; |
|||
}, |
|||
selected(flowChart: Graph) { |
|||
const cells = flowChart.getSelectedCells(); |
|||
if(cells.length > 0) { |
|||
if (cells.length > 0) { |
|||
return safeGet(cells, '0.attrs.label.textDecoration', 'none') === 'underline'; |
|||
} else { |
|||
return false; |
|||
} |
|||
} |
|||
}, |
|||
}); |
|||
|
|||
export default Underline; |
|||
|
@ -1,23 +1,23 @@ |
|||
import React from 'react'; |
|||
|
|||
import {Graph} from '@antv/x6'; |
|||
import {UndoOutlined} from '@ant-design/icons'; |
|||
import { Graph } from '@antv/x6'; |
|||
import { UndoOutlined } from '@ant-design/icons'; |
|||
import shortcuts from '../../../common/shortcuts'; |
|||
import makeBtnWidget from './common/makeBtnWidget'; |
|||
|
|||
interface IProps { |
|||
flowChart: Graph |
|||
flowChart: Graph; |
|||
} |
|||
|
|||
const Save: React.FC<IProps> = makeBtnWidget({ |
|||
tooltip: '撤销', |
|||
handler: shortcuts['undo'].handler, |
|||
handler: shortcuts.undo.handler, |
|||
getIcon() { |
|||
return <UndoOutlined/>; |
|||
return <UndoOutlined />; |
|||
}, |
|||
disabled(flowChart: Graph) { |
|||
return !flowChart.canUndo(); |
|||
} |
|||
}, |
|||
}); |
|||
|
|||
export default Save; |
|||
|
@ -1,9 +1,9 @@ |
|||
declare module '*.module.css' { |
|||
const classes: {[key: string]: string}; |
|||
const classes: { [key: string]: string }; |
|||
export default classes; |
|||
} |
|||
|
|||
declare module '*.less' { |
|||
const classes: {[key: string]: string}; |
|||
const classes: { [key: string]: string }; |
|||
export default classes; |
|||
} |
|||
|
Loading…
Reference in new issue