gs-notebook
v1.1.6
Published
```bash npm install gs-notebook --save ```
Downloads
4
Readme
install
npm install gs-notebook --save
Usage
import React from 'react';
import GsNotebook from 'gs-notebook';
export default () => {
const onCreateGraph = (params) => {
console.log('params', params);
};
const onCreateGraph = (params) => {
console.log('graph params', params);
};
const onCreateVertex = (params) => {
console.log('vertex obj', params);
return true;
};
const onEditVertex = (params) => {
console.log('vertex obj', params);
return false;
};
const onCreateEdge = (params) => {
console.log('edge obj', params);
return true;
};
const onEditEdge = (params) => {
console.log('edge obj', params);
return true;
};
const onDeleteVertex = (parmas) => {
console.log('vertex obj', params);
return false;
};
const onDeleteEdge = (params) => {
console.log('edge obj', params);
return true;
};
return (
<GsNotebook
onCreateGraph={onCreateGraph}
onCreateVertex={onCreateVertex}
onCreateEdge={onCreateEdge}
onEditVertex={onEditVertex}
onEditEdge={onEditEdge}
/>
);
};
API
{
/** 创建图的回调,返回boolean或不返回,true为创建成功,false为创建失败 */
onCreateGraph?: (
params: GraphBasicInfoObj & { edgeList: EdgesObj[] } & { vertexList: VerticesObj[] }
) => boolean | void;
/** 创建节点的回调,返回true或者不返回为创建成功,保存入图里面,返回false创建失败,不跳转会graph页面 */
onCreateVertex?: (params: VerticesObj) => boolean | void;
/** 创建边的回调,返回true或者不返回为创建成功,保存入图里面,返回false创建失败,不跳转会graph页面 */
onCreateEdge?: (params: EdgesObj) => boolean | void;
/** 编辑节点的回调,返回true或者不返回为编辑成功,保存入图里面,返回false编辑失败,不跳转会graph页面 */
onEditVertex?: (params: VerticesObj) => boolean | void;
/** 编辑边的回调,返回true或者不返回为编辑成功,保存入图里面,返回false编辑失败,不跳转会graph页面 */
onEditEdge?: (params: EdgesObj) => boolean | void;
/** 删除节点的回调,返回true或者不返回为删除成功,返回false删除失败,数据不做删除 */
onDeleteVertex?: (params: VerticesObj) => boolean | void;
/** 删除边的回调,返回true或者不返回为删除成功,返回false删除失败,数据不做删除 */
onDeleteEdge?: (params: VerticesObj) => boolean | void;
}