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

jsf.js

v0.0.15

Published

一个基于 jsonschema 生成form 表单的 react 组件

Downloads

19

Readme

JSF(json-schema-form)

一个基于 jsonschema 生成form 表单的 react 组件

背景

react-json-schema-form 交互太难用,不得不重新造一个。。。

目标

  1. 采用标准化交互,满足各类需求

    • 为了实现这个目的,我们对 object 类型统一为左右两栏布局;
    • 对 object Array 类型,采用了表格式布局,可以设置不常用编辑项或一些比较占用空间的编辑项通过弹层的方式打开编辑;
  2. 使用了 ajv 验证库

  3. 支持通过 js 表达式自定义部分交互(比如隐藏、禁用等)

  4. 支持自定义组件

Live PlayGround

快速开始

Install

npm i jsf.js

Usage

import JSONSchemaForm from 'jsf.js'
import 'jsf.js/dist/main.css'


const schema = {
  type: "object",
  required: ['name'],
  properties: {
    name: {
      title: '用户名',
      type: "string",
      description: "zzzzzz",
      pattern: "[0-9]+"
    },
  }
}

export default class App extends React.PureComponent {
  static propTypes = {
    curTab: Proptypes.string.isRequired,
    match: Proptypes.object,
  };
  state = {
    data: {}
  };

  onChange =(value)=>{
    this.setState({
      data: value
    })
  }

  render () {
    return (
      <JSONSchemaForm onChange={this.onChange} value={this.state.data} schema={schema} />
    );
  }
}

License

Apache 2