All Projects → zixiCat → form-bunch

zixiCat / form-bunch

Licence: MIT license
Form-bunch is a component like plugin that make it easier to write form, you could add the most of components what you want to form-bunch for build various form.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to form-bunch

Jafar
🌟!(Just another form application renderer)
Stars: ✭ 107 (+494.44%)
Mutual labels:  layout, form
react-input
A single component for building forms in React
Stars: ✭ 44 (+144.44%)
Mutual labels:  form
Signify
OpenBSD tool to signs and verify signatures on files. Portable version.
Stars: ✭ 122 (+577.78%)
Mutual labels:  verify
react-plough
A library to help tend your react form fields
Stars: ✭ 31 (+72.22%)
Mutual labels:  form
Paseto
PASETO (Platform-Agnostic SEcurity TOkens) for Node.js with no dependencies
Stars: ✭ 134 (+644.44%)
Mutual labels:  verify
pgpverify-maven-plugin
Verify Open PGP / GPG signatures plugin
Stars: ✭ 42 (+133.33%)
Mutual labels:  verify
Qa Checks V4
PowerShell scripts to ensure consistent and reliable build quality and configuration for your servers
Stars: ✭ 94 (+422.22%)
Mutual labels:  verify
verify-apple-id-token
Verify the Apple id token on the server side.
Stars: ✭ 49 (+172.22%)
Mutual labels:  verify
PandaDemo
Demo project for asynchronous render and Layout framework Panda
Stars: ✭ 15 (-16.67%)
Mutual labels:  layout
Vuejs Rails Starterkit
Vue.js + Rails Starting Kit GitHub Template to develop Hybrid Mobile Application: https://vuejs-rails-starterkit.herokuapp.com
Stars: ✭ 205 (+1038.89%)
Mutual labels:  verify
Android Play Safetynet
Samples for the Google SafetyNet Attestation API
Stars: ✭ 195 (+983.33%)
Mutual labels:  verify
Elm Verify Examples
Stars: ✭ 147 (+716.67%)
Mutual labels:  verify
elderform
💪🏽 Form creation made easy, backed by state machines
Stars: ✭ 30 (+66.67%)
Mutual labels:  form
Hibp
A composer package to verify if a password was previously used in a breach using Have I Been Pwned API.
Stars: ✭ 126 (+600%)
Mutual labels:  verify
antd-form-mate
📦 基于 ant design 的表单组件,配置化实现表单功能。
Stars: ✭ 14 (-22.22%)
Mutual labels:  form
Piracychecker
An Android library that prevents your app from being pirated / cracked using Google Play Licensing (LVL), APK signature protection and more. API 14+ required.
Stars: ✭ 1,359 (+7450%)
Mutual labels:  verify
Strsync
A CLI tool for localization resource management on Xcode. Built with Google Translator.
Stars: ✭ 157 (+772.22%)
Mutual labels:  verify
WP-Media-Uploader
Easily create a custom media upload button in WordPress admin dashboard that you can use in your plugin
Stars: ✭ 25 (+38.89%)
Mutual labels:  form
musicWebTemplate
Free website template built for musicians / artists to promote their music and connect to their audience.
Stars: ✭ 26 (+44.44%)
Mutual labels:  form
discord-group-spammer
You need to run all_together.py and follow the instructions on the readme below. This Tool allows you to use various discord exploits for educational use.
Stars: ✭ 45 (+150%)
Mutual labels:  verify

form-bunch

NPM Status

Form-bunch is a component like plugin that make it easier to write form.
You could add the most of components what you want to form-bunch for build various form.
You could also easily change the settings to get the verification or layout you want.
Hope you enjoy it, and if you like it, star it pllllllllllz. :)

Advantages:

  • Customizable. You can add whatever you want if it's possible, like components of Material-UI, Ant Design or customized components.
  • Small. it will give you performance and convenience for building form.
  • Easy. You can change the settings easily - see below

DEMO

Installation

  • YARN
yarn add form-bunch
  • NPM
npm install form-bunch

Usage

First of all, initialize form-bunch.
Assume that you would like to use components of antd, the components should match two rules:
1. it has two fields —— value, onChange
2. the param(e) of onChange(e) => void must be corresponding to value.
if one component has no value or onChange key, or it doesn't match form-bunch, you should replace them like following.

// index.tsx 
import { DatePicker, Input, Switch } from 'antd';

const extensions = {
  datePickDatePicker,
  input[
    Input,
    {
      // change the `e.target.value` to `value`
      // assume that original filed `onChange` is `onSelect`, 
      // then it should be `onChange: ['onSelect', 'e.target.value']`
      onChange['onChange', 'e.target.value'],
    },
  ],
  switch[
    Switch,
    {
      // change the field `checked` to `value`
      value'checked'
    }
  ]
};

export type TExtensions = typeof extensions;

const MyFormBunch = formBunchInit<TExtensions>(extensions);

export default MyFormBunch;

And then, set style after verification failed in form-bunch-error-box className, then import it.

/* index.css */
.form-bunch-error-box .ant-input {
    border: 1px solid red;
    box-shadow: none
}

.form-bunch-error-box .ant-input:hover {
    border: 1px solid red;
}

.form-bunch-error-box .ant-input:active {
    border: 1px solid red;
}
// index.tsx
import './index.css'

...

export default MyFormBunch;

Finally, config form-bunch, and there are many apis for usage.

<MyFormBunch
  ref={formBunchRef}
  value={value}
  items={[
    {
      key: 'a',
      type: 'input',
    },
    {
      labelCol: '80px',
      offset: '40px',
      key: 'b',
      defaultValue: 'test',
      type: 'input',
      verify: (value) => value.length > 5,
    },
  ]}
  onChange={(value) => {
    setValue(value);
  }}
/>

Click DEMO for more details about usage.

API

Form

Property Description Type Default
items config of each form item, see Items API for more details IFormItem -
onChange the callback function when form data changes (form: IFormValue, item: any, key: string) => void -
setting global setting of form, Priority: items > setting, see Setting API for more details IFormSetting -
value form data IFormValue -

Items

Property Description Type Default
className class of the formItem string -
col like flex-basic, the space that formItem takes up number | string '100%'
controlCol like flex-basic, the space that control of formItem takes up number | string '80%'
defaultValue default value, you can also change initial value of form API to set it any -
error the message after verification fails string -
key property of formItem string -
label label of formItem string -
labelAlign type of label alignment 'left' | 'right' | 'center' 'right'
labelCol like flex-basic, the space that label of formItem takes up number | string 20%
offset like margin-left, the space offset from the left number | string 0
render render type of formItem control,
require that only one is provided between property [type] and [render]
(value: any, setValue: (state: any) => void) => JSX.Element -
required set formItem value to be required boolean false
type render type of formItem control,
require that only one is provided between property [type] and [render]
string -
typeProps when use [type], then [typeProps] is its original props object -
verify function that to verify the formItem value, it supports regex.
when it return string, the string will replace corresponding error tip
RegExp | ((value?: any, form?: IFormValue) => boolean | string) -

Setting

Property Description Type Default
col like flex-basic, the space that formItem takes up number | string '100%
controlCol like flex-basic, the space that control of formItem takes up number | string '80%'
hasTips determine if there is space left for error tips boolean false
labelAlign type of label alignment "left" | "right" | "center" 'right'
labelCol like flex-basic, the space that label of formItem takes up number | string '20%'
offset like margin-left, the space offset from the left number | string 0

Ref

Property Description Type Default
validate validate all values of form and return result () => boolean -
reset reset all value of form and result of verify () => void -

Bug tracker

If you find a bug, please report it here on Github!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].