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

d-tree-form

v1.1.3

Published

[![Build Status](https://travis-ci.org/deepexi/d-tree-form.svg?branch=master)](https://travis-ci.com/deepexi/d-tree-form) [![NPM Download](https://badgen.net/npm/dm/d-tree-form)](https://www.npmjs.com/package/d-tree-form) [![NPM Version](https://badgen.ne

Downloads

36

Readme

d-tree-form

Build Status NPM Download NPM Version NPM License PRs Welcome Automated Release Notes by gren

short description + sample image(png/gif/mp4)

Table of Contents

Introduction

一个通过脚手架参数转化成树形动态表单的组件

⬆ Back to Top

Features

  1. 目前支持 input,textarea,select 三种表单项
  2. type=select 时支持多层子节点
  3. 目前仅支持 required 的校验规则

Data Structure

Demo

image.png

[
  {
    label: '作者',
    type: 'input',
    prop: 'author',
    value: '',
    tooltips: 'xxx',
    componentProps: {
      placeholder: '请输入内容',
    },
    rules: [{required: true, message: '这是必填'}],
  },
  {
    label: '路由',
    type: 'select',
    prop: 'router',
    value: '',
    options: [
      {
        label: 'mongo',
        value: 'mongo',
      },
      {
        label: 'mysql',
        value: 'mysql',
      },
      {
        label: 'none',
        value: 'none',
      },
    ],
  },

  {
    label: '配置中心',
    type: 'select',
    prop: 'configCenter',
    value: '',
    options: [
      {
        label: 'apollo',
        value: 'apollo',
      },
      {
        label: 'none',
        value: 'none',
      },
    ],
  },
  {
    label: 'APM',
    type: 'select',
    prop: 'apm',
    value: '',
    options: [
      {
        label: 'skywalking',
        value: 'skywalking',
        childNodes: [
          {
            label: 'skywalking Servers地址:',
            type: 'input',
            prop: 'skywalkingServers',
            value: '',
            labelWidth: '200px',
            rules: [
              {required: true, message: '请输入skywalking Servers地址'},
            ],
          },
          {
            label: 'skywalking Servers地址2:',
            type: 'input',
            prop: 'skywalkingServers2',
            value: '',
            labelWidth: '200px',
            rules: [
              {required: true, message: '请输入skywalking Servers地址'},
            ],
          },
        ]
      },
      {
        label: 'none',
        value: 'none',
      }
    ],
  },
],

form-item props

| 参数 | 类型 | 说明 | 必须 | 默认值 | 备注 | | -------------- | ------------------------------- | ---------------------------- | ---- | -------- | ------------------------------------------- | | label | String | 字段中文名 | 是 | - | - | | prop | String | 字段的 key,必须唯一 | 是 | - | - | | value | StringNumberBoolean | 字段的值 | 是 | 空字符串 | - | | type | String | 该表单项的类型 | 是 | | 仅支持inputselecttextarea | | labelWidth | String | 字段中文名的宽度 | 否 | | | | tooltips | String | 问号提示语 | 否 | | | | rules | Array | 校验规则,详看下面 | 否 | | | | options | Array | 下拉框选项,详看下面 | | | type="select"时必填 | | componentProps | Object | 传给表单的属性对象,详看下面 | 否 | | | | children | Array | 子节点 | | | 每一项和 formitem 属性一致 |

select options

| 参数 | 类型 | 说明 | 必须 | 默认值 | 备注 | | ---------- | ------------------------------- | ---------------------- | ---- | ------ | ------------------------------------------------------------------------------ | | label | String | 下拉选项的显示值 | 是 | - | - | | value | StringNumberBoolean | 下拉选项的用于提交的值 | 是 | | | | childNodes | Array | 该 option 子节点 | 否 | | 选中该 option 需要子节点时使用,数组的项为 form-item,不支持子节点下还有子节点 |

rules

支持 Element-ui Form 的校验规则,不支持函数校验参考:https://element.eleme.cn/#/zh-CN/component/form#biao-dan-yan-zheng基本用法:image.png常用字段

| 参数 | 类型 | 说明 | 必须 | 默认值 | 备注 | | -------- | ------- | ---------------- | ---- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | type | String | 校验的类型 | 否 | string | image.png | | required | Boolean | 是否必填 | 否 | false | true 是在表单项前面会有一个星 | | message | String | 校验不通过提示语 | 是 | - | | | pattern | String | 校验正则 | 否 | - | 正则校验使用字符串形式,因为 JSON 中不支持存储正则表达式类型 | | trigger | String | 验证触发方式 | 否 | change | blur 失去焦点时change 改变值时 | | min | Number | 最小长度 | 否 | | | | max | Number | 最大长度 | 否 | | | | len | Number | 最大长度 | 否 | | 如果 len 属性与最小和最大范围属性组合,则 len 优先。 | | ... | | | | | |

更多高级用法  https://github.com/yiminghe/async-validator

⬆ Back to Top

Links

⬆ Back to Top

Install

⬆ Back to Top

Contributing

For those who are interested in contributing to this project, such as:

  • report a bug
  • request new feature
  • fix a bug
  • implement a new feature

Please refer to our contributing guide.

⬆ Back to Top

Contributors

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

⬆ Back to Top

License

MIT

⬆ Back to Top