@shuyun-ep-team/datadsl-editor
v0.1.30
Published
数据流dsl编辑器
Downloads
24
Keywords
Readme
datadsl-editor
数据流dsl编辑器 react版
准备
安装包与依赖
npm install --save @shuyun-ep-team/datadsl-editor react react-dom antd
webpack配置
{
module: ...,
plugins: ...,
// 使用antlr4需配置
node: { module: "empty", net: "empty", fs: "empty" }
}
使用
import DslEditor from '@shuyun-ep-team/datadsl-editor';
const edit: any;
// 用户可选的所有数据对象字段路径
const dataFieldPaths = {
pathRoot: '$',
paths: [
{"path": "main.test", "parents": ["main"], "type": "string"},
{"path": "main", "parents": [], "type": "object"}
]
}
// 函数提示数据
const functionData = {
date: [
{
functionExpress: "date.is_after(value: date):boolean",
description: "判断date对象日期是否在参数之后",
returnType: "boolean",
args: [
{
name: "arg0",
description: "",
argumentType: "date"
},
{
name: "value",
description: "用于比较的参数",
argumentType: "date"
}
]
}
]
}
<DslEditor ref={node => edit = node} defaultValue="123" dataFieldPaths={dataFieldPaths} functionData={functionData} />
API
getValue()
//获取内容
edit.getValue()