thx-portal-rule
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-alpha.23 • Public • Published

THX Portal Rule

THX 可视化规则编辑器。

安装

yarn add thx-portal-rule

使用

import { mock } from 'mockjs'
import { RuleEditor, IRuleModel } from 'thx-portal-rule'

const MOCK_MODEL_LIST: IRuleModel[] = mock({
  'list|10': [{
    'id|1000-9999': 1,
    name: '模型@cword(5)',
    code: '@word(5)',
    'fields|10': [
      {
        'id|1000-9999': 1,
        name: '字段@cword(5)',
        code: '@word(5)'
      }
    ]
  }]
}).list

export default function App () {
  const [content, setContent] = useState(MOCK_CONTENT)
  return <>
    <RuleEditor models={MOCK_MODEL_LIST} content={content}
      onChange={(nextContent) => setContent(nextContent)}
    />
    <pre>{JSON.stringify(content, null, 2)}</pre>
  </>
}

示例

yarn run examples:start

Readme

Keywords

none

Package Sidebar

Install

npm i thx-portal-rule

Weekly Downloads

2

Version

0.0.1-alpha.23

License

MIT

Unpacked Size

1.18 MB

Total Files

76

Last publish

Collaborators

  • nuysoft