npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hzab/schema-descriptions-mobile

v1.1.7

Published

移动端详情组件

Readme

@hzab/schema-descriptions-mobile

移动端详情(只读展示)渲染器:用 Formily schema 描述字段,按 descriptions 场景渲染为详情视图。

  • Node.js ≥ 24

安装

pnpm add @hzab/schema-descriptions-mobile

本包同时发布到公共 npmregistry.npmjs.org,public access)与企业私有源(ld / old)。默认源可直接安装, 无需额外配置;若团队要求走内网源,见消费方接入指南 §2

消费方需自备 peerDependencies:@formily/antd-mobile@formily/core@formily/json-schema@formily/react@formily/reactive@formily/shared@hzab/formily-result-utilsantd-mobileantd-mobile-iconsreactreact-dom(本包不会随包安装)。

发布形态:本包在本仓以源码直出方式发布——main 指向 src,由消费方打包器编译 TypeScript 与 .less 样式;@hzab/schema-descriptions-mobile/src/* 深路径同样可直接引用。随包发布的 dist/ 仅用于 类型解析(typesdist/index.d.ts),不是运行时入口。消费方需要承担的编译责任见 消费方接入指南 §4

快速开始

默认导出即组件(内部为 forwardRefref.current.formRender 可取到 Formily Form 实例):

import SchemaDescriptions from "@hzab/schema-descriptions-mobile";

const schema = {
  form: { layout: "horizontal" },
  schema: {
    type: "object",
    properties: {
      name: { type: "string", title: "姓名", "x-component": "Text" },
      status: { type: "string", title: "状态", "x-component": "Select" },
    },
  },
};

<SchemaDescriptions schema={schema} data={{ name: "张三", status: "active" }} />;

API

Props

| 属性 | 类型 | 必须 | 默认值 | 说明 | | -------------- | ----------------- | ---- | -------------- | ------------------------------------------------------------------------ | | schema | Object | 是 | - | Formily schema。既可传 { form, schema } 结构,也可直接传 schema 本体 | | data | Object | 否 | - | 详情数据;同时作为 initialValues,且每次变化都会 setValues | | layout | string | 否 | "horizontal" | 布局,覆盖 schema.form.layout | | components | Object | 否 | - | 追加/覆盖 SchemaField 的组件注册表(合并顺序见下) | | schemaScope | Object | 否 | - | 追加给 schema 表达式的作用域变量 | | formOptions | Object | 否 | - | 透传给 createForm 的选项(在 initialValues 之后展开,可覆盖它) | | init | (form) => void | 否 | - | 组件挂载后回调一次,入参为 Formily Form 实例 | | footerRender | () => ReactNode | 否 | - | 渲染在详情内容下方的自定义节点 | | className | string | 否 | - | 追加到外层 div.schema-descriptions 的 className |

ref

| 字段 | 说明 | | ------------ | ---------------------------------------- | | formRender | Formily Form 实例(createForm 的产物) |

schema 结构

{
  form: { layout: "horizontal" },   // 可选:FormLayout 配置
  schema: { type: "object", properties: { /* 字段 */ } },
}

layout 的处理:以 props.layout 优先,其次 schema.form.layout,都没有时回落 "horizontal"

内置组件注册表

SchemaField 默认注册:

  • SliderCardFormGridSpace(来自 antd-mobile / @formily/antd-mobile);
  • 本包自定义组件:ArrayCardsArrayTableFormCollapseFormItem
  • @hzab/formily-result-utils 的全部导出CascaderCheckboxDatePickerRadioSelectSwitchTimePickerTreeSelectResultShow,以及别名 InputTextPasswordNumberPicker
  • 最后合并 props.components同名覆盖内置项)。

因此 schema 里 "x-component": "Text" / "Select" / "DatePicker" 等直接可用,无需自行注册。

内置作用域

scope 默认含 scenario: "schema-descriptions-mobile",可用于 x-reactions 表达式区分场景; props.schemaScope 的键会合并进该作用域。

提示:本组件面向只读展示,内部通过 GlobalPropsContext 传出 _scenario_: "descriptions"; 需要可编辑表单请用 @hzab/form-render-mobile

相关文档