# @great-expectations/jsonforms-antd-renderers 中文文档

规范地址：https://npmcn.com/package/%40great-expectations/jsonforms-antd-renderers/

版本：2\.3\.5
npm 元数据更新时间：2026-04-17T18:58:06.136Z
中文译文更新时间：2026-11-16T23:48:50.065Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40great-expectations/jsonforms-antd-renderers
原文对照：https://npmcn.com/package/%40great-expectations/jsonforms-antd-renderers/?lang=original
项目主页：https://github.com/great-expectations/jsonforms-antd-renderers#readme
源码仓库：https://github.com/great-expectations/jsonforms-antd-renderers

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：414 kB，273 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：4 个
- peer 依赖：@ant-design/icons ^5\.3\.0，@jsonforms/core ^3\.3\.0，@jsonforms/react ^3\.3\.0，antd ^5\.14\.0，dayjs ^1，react ^17 \|\| ^18
- 首次发布：2024-03-11T16:29:03.302Z
- 最新版本发布：2026-04-17T18:58:05.820Z
- 近 30 天下载量：32506（2026-10-17 至 2026-11-15，npm 官方下载统计）
- 已发布版本数：65（近 12 个月 10 个）

## 中文简介

jsonforms 声明形式框架的蚂蚁设计渲染器集

## 安装

```sh
npm install @great-expectations/jsonforms-antd-renderers
```

也可以使用：`pnpm add @great-expectations/jsonforms-antd-renderers`、`yarn add @great-expectations/jsonforms-antd-renderers`、`bun add @great-expectations/jsonforms-antd-renderers`

## README

[![codecov](https://codecov.io/gh/great-expectations/jsonforms-antd-renderers/graph/badge.svg?token=aDz1isILuA)](https://codecov.io/gh/great-expectations/jsonforms-antd-renderers) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/great-expectations/jsonforms-antd-renderers/main.svg)](https://results.pre-commit.ci/latest/github/great-expectations/jsonforms-antd-renderers/main)

# 蚂蚁设计渲染器 `jsonforms`

[json形式](https://jsonforms.io/docs/) 是“高效构建基于形式网络用户界面的申报框架” `jsonforms` 拥有多个用于不同框架和组件库的渲染软件包,这是其中的一个软件包. 您可以通过故事本预览渲染器 [这里](https://great-expectations.github.io/jsonforms-antd-renderers/)。 。 。 .

## 开始

```bash
npm install @great-expectations/jsonforms-antd-renderers
```

### 使用 AntD 渲染器

为了使用此软件包, 您需要从此软件包中导入渲染器注册项并提供给 `@jsonforms/react` `JsonForms` 组件 :

```tsx
import { JsonForms } from "@jsonforms/react"
import {
  rendererRegistryEntries,
  cellRegistryEntries,
} from "@great-expectations/jsonforms-antd-renderers"

function MyForm({ data }: { data: Record<string, unknown> }) {
  return (
    <JsonForms
      data={data}
      schema={schema}
      renderers={rendererRegistryEntries}
      cells={cellRegistryEntries}
    />
  )
}
```

### 写入 UISchemas

此软件包扩展了类型和配置 [jsonforms UISchemas 化学式](https://jsonforms.io/docs/uischema)写UISchema的时候,你会想 提供你的Jsonschema的类型给我们 `UISchema` 类型,以利用高级类型检查 & UI 配置。 参见我们的故事书(运行故事书的指示) `Contributing`),用于更多实例.

```tsx
import { useState } from "react"
import { Form, Button } from "antd"
import { JsonForms } from "@jsonforms/react"
import {
  rendererRegistryEntries,
  UISchema,
} from "@great-expectations/jsonforms-antd-renderers"

const schema = {
  type: "object",
  properties: { password: { type: "string" } },
} as const
// Be sure to use an `as const` assertion so that UISchema
// can see the specific types of `type` fields within a schema.
// i.e. without `as const`, the value "object" is interpreted
// as a string type, and not the string literal type "object"

const uischema: UISchema<typeof schema> = {
  type: "VerticalLayout",
  elements: [
    {
      type: "Control",
      scope: "#/properties/password",
      // Properties like type: "password" here are unique to this renderer package.
      // This allows you more declarative control over how your forms render.
      // In this case, the password field will be rendered with AntD's password input component.
      options: { type: "password" },
    },
  ],
}

function MyForm() {
  const [data, setData] = useState<Record<string, unknown>>({})

  return (
    <Form onFinish={() => myApiCall(data)}>
      <JsonForms
        data={data}
        onChange={(result) => setData(result.data as Record<string, unknown>)}
        schema={schema}
        uischema={uischema}
        renderers={rendererRegistryEntries}
      />
      <Form.Item>
        <Button htmlType="submit">Submit</Button>
      </Form.Item>
    </Form>
  )
}
```

## 捐款

### 第一次设置

-   安装节点.js( 目前只支持节点 v20)
-   安装版本 [小时](https://pnpm.io/installation) 定义 `packageManager` 输入 `package.json`
-   克隆此寄存器
-   安装依赖性 : `pnpm i --frozen-lockfile`
-   运行测试 : `pnpm test`
-   运行测试和视图覆盖 :
    -   `pnpm test:cov`
    -   `npx vite preview --outDir html`
    -   在终端,类型 `o` + 键 `enter` 在浏览器中打开结果
-   运行故事本 : `pnpm storybook`

### 作出改变

-   更改代码
-   运行测试 : `pnpm test`
-   运行故事本 : `pnpm storybook`
-   运行格式 : `pnpm format:write`
-   运行林特 : `pnpm lint`
-   提交更改

### 常规承诺

-   我们用 [语义释放](https://github.com/semantic-release/semantic-release) 来发布我们的软件包,所以确保您的承诺遵守 [常规承诺格式](https://semantic-release.gitbook.io/semantic-release#commit-message-format)
-   特别是承诺信息的形式 `fix(<scope>): <short summary>`, (中文(简体) ), `feat(<scope>): <short summary>`,或 `BREAKING CHANGE: <short summary>` 将引发释放. `short summary` 需要时间. `scope` 是可选的.

### 本地测试软件包

-   从此目录创建可安装的 tarball 文件 : `pnpm pack`
-   如果您先前安装了软件包, 您可能需要先删除: `npm uninstall @great-expectations/jsonforms-antd-renderers` 并可能清除您的软件包管理器缓存
-   在您的工程中安装软件包 : `npm install /path/to/jsonforms-antd-renderers-0.0.0-semantic-release.tgz`

## 常见问题

### @great-expectations/jsonforms-antd-renderers 是什么？

jsonforms 声明形式框架的蚂蚁设计渲染器集

### 如何安装 @great-expectations/jsonforms-antd-renderers？

在项目目录运行 npm install @great-expectations/jsonforms-antd-renderers，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：@ant-design/icons（^5\.3\.0）、@jsonforms/core（^3\.3\.0）、@jsonforms/react（^3\.3\.0）、antd（^5\.14\.0）、dayjs（^1）、react（^17 \|\| ^18）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @great-expectations/jsonforms-antd-renderers 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @great-expectations/jsonforms-antd-renderers 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @great-expectations/jsonforms-antd-renderers 可以商用吗？

@great-expectations/jsonforms-antd-renderers 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @great-expectations/jsonforms-antd-renderers 的下载量有多少？

根据 npm 官方下载统计，@great-expectations/jsonforms-antd-renderers 在 2026/10/17 – 2026/11/15 这 30 天内被下载 32,506 次，日均约 1,084 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @great-expectations/jsonforms-antd-renderers 还在维护吗？

最新版本 2\.3\.5 发布于 2026/04/18（6 个月前）；至今共发布 65 个版本，其中过去 12 个月发布了 10 个；首次发布于 2024/03/12。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

