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

next-formx

v0.1.9

Published

> 根据配置数据生成Form

Downloads

4

Readme

next-formx

根据配置数据生成Form

API

Form

| 参数 | 说明 | 类型 | 默认值 | | :-----| :---- | :---- | :---- | | groupNumber | 每行分组数量 | number | 1 | formItems | formItem配置 | FormItem[] |

FormItem

更多参数配置,参考antd formItem配置

| 参数 | 说明 | 类型 | 默认值 | | :-----| :---- | :---- | :---- | | type | 类型 | FormItemTypes | input | ghost | 是否隐藏 | string boolean | | required | 是否必填 | string boolean | | options | 组件配置项,具体字段参考对应组件的配置 | object

FormItemTypes

| 属性 | 值 | 说明 | 配置项 | | :-----| :---- | :---- | :---- | | INPUT | input | 输入框 | 查看 | SWITCH | switch | 切换 | 查看 | SELECT | select | 下拉框 | 参考Select api | NUMBER | number | 数字输入框 | 参考Number api | DATE_PICKER | datePicker | 日期选择 | 查看 | RANGE_PICKER | rangePicker | 日期范围选择 | 查看 | CHECKBOX_GROUP | checkboxGroup | 多选 | 查看

Number

基于antd input-number封装,支持金额格式化、整数限制。更多API 请参考antd InputNumber

| 参数 | 说明 | 类型 | 默认值 | | :-----| :---- | :---- | :---- | | isAmount | 金额format | boolean | | isInteger | 整数限制,为true时只允许输入整数 | boolean |

Select

基于antd select封装,支持传入url获取数据。更多API 请参考antd Select

| 参数 | 说明 | 类型 | 默认值 | | :-----| :---- | :---- | :---- | | url | 获取数据url | string | | cacheKey | 缓存key,需全局唯一,只获取一次数据 | boolean | false | query | 查询参数 | object | extra | 客户扩展数据,被form嵌套下参数才生效 | string[] | fieldNames | label value显示的字段 | { label: string; value: string } | { label: 'label', value: 'value' }

示例

formItems配置项示例

import { FormItemTypes } from 'next-formx';

const formItems = [
  {
    name: 'uNm'
  },
  {
    name: 'age',
    type: FormItemTypes.NUMBER,
    required: '!!${uNm}', // 根据uNm 控制是否必填
    options: { // options 组件配置项
      isInteger: true
    }
  },
  {
    name: 'child',
    type: FormItemTypes.SELECT,
    options: {
      url: '/api/getUsers',
      query: '{"where":{"partner":${uNm}}}', // 基于其他字段动态生成query
      extra: ['sex','cunm=childName'] // 扩展出sex,childName并重命为cunm
    }
  }
]