数据模型定义和表单引擎建立在 Formily 2.x 基础之上。

0. Schema

我们的 Schema 是在 Formily Schema 之上增加了一些语法糖,而 Formily Schema 又是扩展和简化 JSON Schema。我们在他的基础上简化和扩展了一些数据类型。

我们的 Schema 最终会转换为 Formily Schema

Formily Schema 示例:

{
  "type": "object",
  "properties": {
    "source": {
      "type": "string",
      "title": "Source",
      "x-component": "Input",
      "x-component-props": {
        "placeholder": "请输入"
      }
    },
    "target": {
      "type": "string",
      "title": "Target",
      "x-component": "Input",
      "x-component-props": {
        "placeholder": "请输入"
      },
      "x-reactions": [
        {
          "dependencies": ["source"],
          "when": "{{$deps[0] == '123'}}",
          "fulfill": {
            "state": {
              "visible": true
            }
          },
          "otherwise": {
            "state": {
              "visible": false
            }
          }
        }
      ]
    }
  }
}

1. 内置数据类型

1.1 核心类型