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

regular-form

v0.1.2

Published

RegularJs(regular) Form Validate.

Downloads

9

Readme

RegularForm简介

npm install regular-form

Demo & API:戳这里

使用要点
  • 依赖regularjs
  • name 和 r-model是每个需要验证表单元素必须配置的
  • 如果表单内嵌组件需要验证,内嵌的组件也需要继承regular-form

API

Directive

| 指令 | 指令值 | 描述 | | ------------- | ----------- | ------------- | | r-model | | r-model和name是每个表单元素需要必需要设置的 | | r-required | true false {variable} | 表单元素是否必需 | | r-type | url number email week month time date | 表单元素支持验证的类型 | | r-min | Number {variable} | 表单元素的最小值 | | r-max | Number {variable} | 表单元素的最大值 | | r-step | Number {variable} | 表单元素的间隔 | | r-pattern | RegExp {variable} |表单元素验证的正则规则(直接填写正则字符串如/^1[3|4|5|6|7|8|9]\d{9}$/,regular在parse时{9}会被处理,建议使用{variable}的方式) | | r-extend | Function {variable} | 表单元素的自定义验证 |

Component Status

| 属性 | 类型 | 描述 | | ------------- | ----------- | ------------- | | $dirty | Boolean | 表单是否有改动的,内容改动之后就会置为true即使改回原来的值 | | $invalid | Boolean | 表单是否验证通过 | | $submitted | Boolean | 表单提交状态,点击提交就会置为true,用于提交时显示错误| | form.$$name.$dirty | Boolean | 具体一个表单元素是否有过交互,内容改动之后就会置为true即使改回原来的值 | | form.$$name.$dirty2 | Boolean | $dirty || $touched || $submitted,实时显示错误需要依赖的标记 | | form.$$name.$touched | Boolean | 具体一个表单元素触发过blur事件 | | form.$$name.$error.required | Boolean | 具体一个表单元素的验证非法类型,true - 验证通过 false - 验证失败, name置表单元素的name属性 | form.$$name.$error.type | Boolean | | form.$$name.$error.min | Boolean | | form.$$name.$error.max | Boolean | | form.$$name.$error.step | Boolean | | form.$$name.$error.pattern | Boolean | | form.$$name.$error.required | Boolean | | form.$$name.$error.extend | Boolean |