@shuyun-ep-team/datadsl-editor

数据流dsl编辑器 react版

Usage no npm install needed!

<script type="module">
  import shuyunEpTeamDatadslEditor from 'https://cdn.skypack.dev/@shuyun-ep-team/datadsl-editor';
</script>

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()