chore(project): 添加项目配置文件和忽略规则
- 添加 Babel 配置文件支持 ES6+ 语法转换 - 添加 ESLint 忽略规则和配置文件 - 添加 Git 忽略规则文件 - 添加 Travis CI 配置文件 - 添加 1.4.2 版本变更日志文件 - 添加 Helm 图表辅助模板文件 - 添加 Helm 忽略规则文件
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
const global = {
|
||||
trackable: process.env.NODE_ENV === 'production',
|
||||
version: process.env.GG_EDITOR_VERSION,
|
||||
};
|
||||
|
||||
export default {
|
||||
get(key) {
|
||||
return global[key];
|
||||
},
|
||||
set(key, value) {
|
||||
global[key] = value;
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
export const FLOW_CONTAINER = 'J_FlowContainer';
|
||||
export const MIND_CONTAINER = 'J_MindContainer';
|
||||
export const KONI_CONTAINER = 'J_KoniContainer';
|
||||
export const TOOLBAR_CONTAINER = 'J_ToolbarContainer';
|
||||
export const MINIMAP_CONTAINER = 'J_MinimapContainer';
|
||||
export const CONTEXT_MENU_CONTAINER = 'J_ContextMenuContainer';
|
||||
|
||||
export const FLOW_CLASS_NAME = 'Flow';
|
||||
export const MIND_CLASS_NAME = 'Mind';
|
||||
export const KONI_CLASS_NAME = 'Koni';
|
||||
|
||||
export const EVENT_BEFORE_ADD_PAGE = 'beforeAddPage';
|
||||
export const EVENT_AFTER_ADD_PAGE = 'afterAddPage';
|
||||
|
||||
export const STATUS_CANVAS_SELECTED = 'canvas-selected';
|
||||
export const STATUS_NODE_SELECTED = 'node-selected';
|
||||
export const STATUS_EDGE_SELECTED = 'edge-selected';
|
||||
export const STATUS_GROUP_SELECTED = 'group-selected';
|
||||
export const STATUS_MULTI_SELECTED = 'multi-selected';
|
||||
|
||||
export const GRAPH_MOUSE_REACT_EVENTS = {
|
||||
click: 'Click',
|
||||
contextmenu: 'ContextMenu',
|
||||
dblclick: 'DoubleClick',
|
||||
drag: 'Drag',
|
||||
dragend: 'DragEnd',
|
||||
dragenter: 'DragEnter',
|
||||
dragleave: 'DragLeave',
|
||||
dragstart: 'DragStart',
|
||||
drop: 'Drop',
|
||||
mousedown: 'MouseDown',
|
||||
mouseenter: 'MouseEnter',
|
||||
mouseleave: 'MouseLeave',
|
||||
mousemove: 'MouseMove',
|
||||
mouseup: 'MouseUp',
|
||||
};
|
||||
|
||||
export const GRAPH_OTHER_REACT_EVENTS = {
|
||||
afterchange: 'onAfterChange',
|
||||
afterchangesize: 'onAfterChangeSize',
|
||||
afterviewportchange: 'onAfterViewportChange',
|
||||
beforechange: 'onBeforeChange',
|
||||
beforechangesize: 'onBeforeChangeSize',
|
||||
beforeviewportchange: 'onBeforeViewportChange',
|
||||
keydown: 'onKeyDown',
|
||||
keyup: 'onKeyUp',
|
||||
mousewheel: 'onMouseWheel',
|
||||
};
|
||||
|
||||
export const PAGE_REACT_EVENTS = {
|
||||
afteritemactived: 'onAfterItemActived',
|
||||
afteriteminactivated: 'onAfterItemInactivated',
|
||||
afteritemselected: 'onAfterItemSelected',
|
||||
afteritemunactived: 'onAfterItemInactivated',
|
||||
afteritemunselected: 'onAfterItemUnselected',
|
||||
beforeitemactived: 'onBeforeItemActived',
|
||||
beforeiteminactivated: 'onBeforeItemInactivated',
|
||||
beforeitemselected: 'onBeforeItemSelected',
|
||||
beforeitemunactived: 'onBeforeItemInactivated',
|
||||
beforeitemunselected: 'onBeforeItemUnselected',
|
||||
keyUpEditLabel: 'onKeyUpEditLabel',
|
||||
};
|
||||
|
||||
export const EDITOR_REACT_EVENTS = {
|
||||
aftercommandexecute: 'onAfterCommandExecute',
|
||||
beforecommandexecute: 'onBeforeCommandExecute',
|
||||
};
|
||||
|
||||
export const GRAPH_MOUSE_EVENTS = Object.keys(GRAPH_MOUSE_REACT_EVENTS);
|
||||
export const GRAPH_OTHER_EVENTS = Object.keys(GRAPH_OTHER_REACT_EVENTS);
|
||||
export const PAGE_EVENTS = Object.keys(PAGE_REACT_EVENTS);
|
||||
export const EDITOR_EVENTS = Object.keys(EDITOR_REACT_EVENTS);
|
||||
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
|
||||
export default React.createContext({});
|
||||
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import GGEditorContext from '@common/context/GGEditorContext';
|
||||
|
||||
export default function (WrappedComponent) {
|
||||
class InjectGGEditorContext extends React.Component {
|
||||
render() {
|
||||
const { forwardRef, ...rest } = this.props;
|
||||
|
||||
return (
|
||||
<GGEditorContext.Consumer>
|
||||
{context => <WrappedComponent ref={forwardRef} {...rest} {...context} />}
|
||||
</GGEditorContext.Consumer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return React.forwardRef((props, ref) => <InjectGGEditorContext {...props} forwardRef={ref} />);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import React from 'react';
|
||||
|
||||
export default React.createContext({});
|
||||
@@ -0,0 +1,21 @@
|
||||
class PropsAPI {
|
||||
editor = null;
|
||||
|
||||
constructor(editor) {
|
||||
this.editor = editor;
|
||||
|
||||
['executeCommand'].forEach((key) => {
|
||||
this[key] = (...params) => this.editor[key](...params);
|
||||
});
|
||||
|
||||
['read', 'save', 'add', 'find', 'update', 'remove', 'getSelected'].forEach((key) => {
|
||||
this[key] = (...params) => this.currentPage[key](...params);
|
||||
});
|
||||
}
|
||||
|
||||
get currentPage() {
|
||||
return this.editor.getCurrentPage();
|
||||
}
|
||||
}
|
||||
|
||||
export default PropsAPI;
|
||||
@@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import PropsAPIContext from '@common/context/PropsAPIContext';
|
||||
|
||||
export default function (WrappedComponent) {
|
||||
class InjectPropsAPI extends React.Component {
|
||||
render() {
|
||||
const { forwardRef, ...rest } = this.props;
|
||||
|
||||
return (
|
||||
<PropsAPIContext.Consumer>
|
||||
{propsAPI => <WrappedComponent ref={forwardRef} {...rest} propsAPI={propsAPI} />}
|
||||
</PropsAPIContext.Consumer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return React.forwardRef((props, ref) => <InjectPropsAPI {...props} forwardRef={ref} />);
|
||||
}
|
||||
Reference in New Issue
Block a user