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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hzab/schema-descriptions

v1.3.0

Published

通过 schema 生成的描述列表组件

Downloads

37

Readme

@hzab/schema-descriptions

通过 schema 生成的描述列表组件

组件

示例

import SchemaDes from "@hzab/schema-descriptions";

// testSchema 为 formily 生成的 schema json
<SchemaDes schema={testSchema} data={data} />;

API

InfoPanel Attributes

| 参数 | 类型 | 必填 | 默认值 | 说明 | | ---------- | ------- | ---- | ------ | ------------------------------------------------------------------------------------------- | | schema | Object | 是 | - | 数据信息的 schema | | data | Object | 是 | - | 展示的数据 | | bordered | Boolean | 否 | true | 控制是否显示边框 | | layout | string | 否 | | 布局:horizontal / vertical | | column | number | 否 | 2 | 一行的 DescriptionItems 数量,可以写成像素值或支持响应式的对象写法 { xs: 8, sm: 16, md: 24} | | desConf | Object | 否 | 2 | antd descriptions 的默认配置项 | | Slots | Object | 否 | - | 数据展示的插槽 | | LabelSlots | Object | 否 | - | label 的插槽 |

Slots

  • 使用插槽进行内容的自定义渲染
  • props:
    • value 处理过后的数据
    • dataVal data 中的实际数据
    • item 当前表单项配置数据
import SchemaDes from "@hzab/schema-descriptions";

// testSchema 中存在 name 为 userName 的字段
<SchemaDes
  schema={testSchema}
  data={data}
  Slots={{
    userName(props) {
      console.log("Slots props", props);
      return "Slots-" + props.value + props.dataVal;
    },
  }}
  LabelSlots={{
    userName(props) {
      console.log("Label props", props);
      return "Label-Slots-" + props.label;
    },
  }}
/>;

组件开发流程

  • 在 config/webpack.config.js 中按需修改 alias 配置的包名,便于本地调试
  • 在 src/typings.d.ts 中按需修改 declare module 配置的包名,解决 ts 报错问题
  • npm run dev

命令

  • 本地运行:npm run dev
  • 测试环境打包编译:npm run build-flow-dev
  • 生产环境打包编译:npm run build

发布

  • 命令:npm publish --access public

  • 发布目录:

    • lib

配置

配置文件

  • 本地配置文件:config/global-config/config.local.js
  • 测试环境配置文件:config/global-config/config.flowDev.js
  • 生产环境配置文件:config/global-config/config.production.js

webpack 配置文件

  • config/webpack.config.js