{"meta":"<h2 id=\"Development Guide\">Development Guide <a class=\"header-anchor scroll-count-item\" href=\"#Development Guide\" data-scroll-id=\"Development Guide\">#</a></h2>\n<h3 id=\"When To Use\">When to use <a class=\"header-anchor scroll-count-item\" href=\"#When To Use\" data-scroll-id=\"When To Use\">#</a></h3>\n<p>Fields can be used to manage data when it comes to form data manipulation and validation. After being associated with a component, the form data can be automatically written back, read, and verified.</p>\n<h3 id=\"Use Caution\">Use caution <a class=\"header-anchor scroll-count-item\" href=\"#Use Caution\" data-scroll-id=\"Use Caution\">#</a></h3>\n<ul>\n<li>With Field <code>init</code> components, <code>value</code> <code>onChange</code> must be placed in init&apos;s third argument, otherwise it may be overridden by init.</li>\n<li><code>Form</code> has been deeply optimized with <code>Field</code> for <code>data acquisition</code> and <code>automatic verification prompt</code>. It is recommended to use <code>Field</code> in <code>Form</code>. Please check Form demo.</li>\n<li>initValue The defaultValue of a similar component, which only takes effect when the component first renders (the ajax asynchronous invocation setting initValue may have missed the first render)</li>\n<li>with <code>parseName=true</code> you could use <code>getValues</code> to get a struct value, but not work in <code>getValue</code> you still need pass complete key</li>\n</ul>\n<h3 id=\"Basic Use\">basic use <a class=\"header-anchor scroll-count-item\" href=\"#Basic Use\" data-scroll-id=\"Basic Use\">#</a></h3>\n<pre><code>Class Demo extends React.Component {\n&#xA0;&#xA0;&#xA0;&#xA0;Field = new Field(this); // instance creation\n\n&#xA0;&#xA0;&#xA0;&#xA0;onClick = ()=&gt;{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Console.log(this.field.getValue(&apos;name&apos;));\n&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;Render() {\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Const init = this.field.init;\n\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;// Note: initValue will only be assigned when the component is first initialized. If you are using an asynchronous assignment, use setValue\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Return &lt;div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;Input {...init(&apos;name&apos;,{initValue:&apos;first value&apos;})} /&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;button onClick={this.onClick&gt;Get Data&lt;/button&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;/div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;}\n}\n</code></pre>\n<h3 id=\"Update Data\">update data <a class=\"header-anchor scroll-count-item\" href=\"#Update Data\" data-scroll-id=\"Update Data\">#</a></h3>\n<h4>Event Updates</h4>\n<pre><code>Class Demo extends React.Component {\n&#xA0;&#xA0;&#xA0;&#xA0;Field = new Field(this);\n\n&#xA0;&#xA0;&#xA0;&#xA0;onClick = ()=&gt;{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;this.field.setValue(&apos;name&apos;, &apos;newvalue&apos;); // Assignment will automatically trigger render\n&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;Render() {\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Const init = this.field.init;\n\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Return &lt;div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;Input {...init(&apos;name&apos;)} /&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;button onClick={this.onClick}&gt;Settings&lt;/button&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;/div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;}\n}\n</code></pre>\n<h4>props update</h4>\n<pre><code>Class Demo extends React.Component {\n&#xA0;&#xA0;&#xA0;&#xA0;Field = new Field(this);\n\n&#xA0;&#xA0;&#xA0;&#xA0;// Set the data before the component is mounted (this can be replaced with initValue)\n&#xA0;&#xA0;&#xA0;&#xA0;componentWillMount() {\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;this.field.setValue(&apos;name&apos;, &apos;init Name&apos;)\n&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;// Receive data from props\n&#xA0;&#xA0;&#xA0;&#xA0;componentWillReceiveProps(nextProps) {\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;this.field.setValue(&apos;name&apos;, nextProps.name)\n&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;Render() {\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Const init = this.field.init;\n\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Return &lt;div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;Input {...init(&apos;name&apos;)} /&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;/div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;}\n}\n</code></pre>\n<h4>ajax update</h4>\n<pre><code>Class Demo extends React.Component {\n&#xA0;&#xA0;&#xA0;&#xA0;Field = new Field(this);\n\n&#xA0;&#xA0;&#xA0;&#xA0;onClick = ()=&gt;{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Ajax({\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Url:&apos;/demo.json&apos;,\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Success:(json)=&gt;{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;// Update of assignment in callback event\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;this.field.setValue(&apos;name&apos;,json.name);\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;});\n&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;Render() {\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Const init = this.field.init;\n\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Return &lt;div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;Input {...init(&apos;name&apos;)} /&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;button onClick={this.onClick}&gt;Settings&lt;/button&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;/div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;}\n}\n</code></pre>\n<h4>onChange update monitoring</h4>\n<p>Two usages:</p>\n<ol>\n<li>Unified management</li>\n</ol>\n<pre><code>Class Demo extends React.Component {\n&#xA0;&#xA0;&#xA0;&#xA0;Field = new Field(this,{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;onChange:(name, value) =&gt; {\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Switch(name) {\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Case &apos;name1&apos;:\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;this.field.setValue(&apos;name2&apos;,&apos;value set by name1&apos;);\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Break;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Case &apos;name2&apos;:\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;this.field.setValue(&apos;name1&apos;,&apos;value set by name2&apos;);\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Break;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;});\n&#xA0;&#xA0;&#xA0;&#xA0;Render() {\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Const init = this.field.init;\n\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Return &lt;div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;Input {...init(&apos;name1&apos;)} /&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;Input {...init(&apos;name2&apos;)} /&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;/div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;}\n}\n</code></pre>\n<ol start=\"2\">\n<li>Individual management</li>\n</ol>\n<pre><code>Class Demo extends React.Component {\n&#xA0;&#xA0;&#xA0;&#xA0;Render() {\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Const init = this.field.init;\n\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Return &lt;div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;Input {...init(&apos;name1&apos;,{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Props:{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;onChange:(v)=&gt;{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;this.field.setValue(&apos;name2&apos;,&apos;value set by name1&apos;);\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;})} /&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;Input {...init(&apos;name2&apos;,{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;Props:{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;onChange:(v)=&gt;{\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;this.field.setValue(&apos;name1&apos;,&apos;value set by name2&apos;);\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;}\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;})} /&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&lt;/div&gt;\n&#xA0;&#xA0;&#xA0;&#xA0;}\n}\n</code></pre>\n<p>For details, please check Demo Demo <code>Associate Control</code></p>\n","api":"<h2 id=\"API\">API <a class=\"header-anchor scroll-count-item\" href=\"#API\" data-scroll-id=\"API\">#</a></h2>\n<!-- api-extra-start -->\n<h3 id=\"Initialization\">initialization <a class=\"header-anchor scroll-count-item\" href=\"#Initialization\" data-scroll-id=\"Initialization\">#</a></h3>\n<pre><code>Let myfield = new Field(this [,options]);\n\nor with hooks\n\nlet myfield = Field.useField([options]); // react version must &gt; 16.8\n</code></pre>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n<th>Type</th>\n<th>Optional</th>\n<th>Default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>this</td>\n<td>The incoming call to this class</td>\n<td>React.Component</td>\n<td>must be set</td>\n<td></td>\n</tr>\n<tr>\n<td>options</td>\n<td>Some event configuration, detailed parameters are as follows</td>\n<td>Object</td>\n<td>Not required</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p><code>options</code> configuration item</p>\n<table>\n<thead>\n<tr>\n<th>Parameters</th>\n<th>Description</th>\n<th>Type</th>\n<th>Default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>onChange</td>\n<td>all component changes will arrive here [setValue won&apos;t trigger the function]</td>\n<td>Function(name,value)</td>\n<td></td>\n</tr>\n<tr>\n<td>parseName</td>\n<td>Whether to translate <code>name</code> in <code>init(name)</code> (getValues &#x200B;&#x200B;will convert a string with <code>.</code> to an object)</td>\n<td>Boolean</td>\n<td>false</td>\n</tr>\n<tr>\n<td>forceUpdate</td>\n<td>Only the components of PureComponent are recommended to open this forced refresh function, which will cause performance problems (500 components as an example: the render will cost 700ms when it is turned on, and 400ms if it is turned off)</td>\n<td>Boolean</td>\n<td>false</td>\n</tr>\n<tr>\n<td>scrollToFirstError</td>\n<td>scrolling field.validate scrolls to the first errored component, offsets if it is an integer</td>\n<td>Boolean/Number</td>\n<td>true</td>\n</tr>\n<tr>\n<td>autoUnmount</td>\n<td>Automatically delete the Unmout element, if you want to keep the data can be set to false</td>\n<td>Boolean</td>\n<td>true</td>\n</tr>\n<tr>\n<td>autoValidate</td>\n<td>Automatically validate while value changed</td>\n<td>Boolean</td>\n<td>true</td>\n</tr>\n<tr>\n<td>values</td>\n<td>initial value</td>\n<td>Object</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4>API Interface</h4>\n<p>The api interface provided by the object after <code>new</code> (eg <code>myfield.getValues()</code>) (The api function starting with <code>set</code> should not be manipulated in render, which may trigger an infinite loop)</p>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n<th>Type</th>\n<th>Optional</th>\n<th>Default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>init</td>\n<td>Initialize each component, [Detailed Parameters below] (#init))</td>\n<td>Function(name:String, option:Object)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>getValues &#x200B;&#x200B;</td>\n<td>Get the value of a group of input controls. If no parameters are passed, get the values &#x200B;&#x200B;of all components</td>\n<td>Function([names: String[]])</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>getValue</td>\n<td>get the value of a single input control</td>\n<td>Function(name: String)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>setValues &#x200B;&#x200B;</td>\n<td>Sets the value of a set of input controls (triggers render, follow the use of react time)</td>\n<td>Function(obj: Object)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>setValue</td>\n<td>Sets the value of a single input control (triggers render, follow the use of react time)</td>\n<td>Function(name: String, value)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>Validate</td>\n<td>Validate and retrieve the values &#x200B;&#x200B;of a set of input fields and Error</td>\n<td>Function([names: String[]], callback: Function(errors, values))</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>getError</td>\n<td>Get Error of a Single Input Control</td>\n<td>Function(name: String)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>getErrors</td>\n<td>Get Errors of a Group of Input Controls</td>\n<td>Function([name: String])</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>setError</td>\n<td>Set Error for a Single Input Control</td>\n<td>Function(name: String, errors:String/Array[String])</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>setErrors</td>\n<td>Set Errors of a Group of Input Controls</td>\n<td>Function(obj: Object)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>reset</td>\n<td>reset the value of a group of input controls, clear the checksum</td>\n<td>Function([names: String[]])</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>resetToDefault</td>\n<td>Resets the value of a group of input controls to the default</td>\n<td>Function([names: String[]])</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>getState</td>\n<td>Judge check status</td>\n<td>Function(name: String)</td>\n<td>&apos;error&apos; &apos;success&apos; &apos;loading&apos; &apos;&apos;</td>\n<td>&apos;&apos;</td>\n</tr>\n<tr>\n<td>getNames</td>\n<td>Get the key of all components</td>\n<td>Function()</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>remove</td>\n<td>Delete the data of a certain control or a group of controls. After deletion, the validate/value associated with it will be cleared.</td>\n<td>Function(name: String/String[])</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>addArrayValue</td>\n<td>add data of name like name.{index}</td>\n<td>Function(key: String, index: Number, value1, value2, ...)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>deleteArrayValue</td>\n<td>delete data of name like name.{index}</td>\n<td>Function(key: String, index: Number, howmany)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>watch</td>\n<td>watch field value changes</td>\n<td>Function(names: String[], callback: Function(name: String, value: any, oldValue: any, triggerType: &apos;init&apos; | &apos;change&apos; | &apos;setValue&apos; | &apos;unmount&apos; | &apos;reset&apos;))</td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4>init</h4>\n<pre><code>init(name, options, props)\n</code></pre>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n<th>Type</th>\n<th>Optional</th>\n<th>Default</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>name</td>\n<td>Required unique input control symbol</td>\n<td>String</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>options.valueName</td>\n<td>attribute name of the component value, such as Checkbox is <code>checked</code>, Input is <code>value</code></td>\n<td>String</td>\n<td></td>\n<td>&apos;value&apos;</td>\n</tr>\n<tr>\n<td>options.initValue</td>\n<td>The initial value of the component (the component will be read only when rendering for the first time, and later modifying this value is invalid), similar to defaultValue</td>\n<td>any</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>options.trigger</td>\n<td>Name of the event that triggered the data change</td>\n<td>String</td>\n<td></td>\n<td>&apos;onChange&apos;</td>\n</tr>\n<tr>\n<td>options.rules</td>\n<td>Checksum Rules</td>\n<td>Array/Object</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>options.getValueFormatter</td>\n<td>custom way to get value from <code>onChange</code> event, Detailed usage see demo <code>custom data get</code></td>\n<td>Function(value, ...args) parameter order and components are exactly the same The</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>options.getValueFormatter</td>\n<td>custom way to set value. Detailed usage see demo <code>custom data get</code></td>\n<td>Function(values)</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>props</td>\n<td>Component-defined events can be written here</td>\n<td>Object</td>\n<td></td>\n<td></td>\n</tr>\n<tr>\n<td>autoValidate</td>\n<td>Automatically validate while value changed</td>\n<td>Boolean</td>\n<td>true</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>return</p>\n<pre><code>{id,value,onChange}\n</code></pre>\n<h4>rules</h4>\n<pre><code>{\n    rules:[{ required: true }]\n}\n</code></pre>\n<p>multiple rule</p>\n<pre><code>{\n    rules:[{required:true,trigger:&apos;onBlur&apos;},{pattern:/abcd/,message:&apos;match abcd&apos;},{validator:(rule, value, callback)=&gt;{callback(&apos;got error&apos;)}}]\n}\n</code></pre>\n<table>\n<thead>\n<tr>\n<th>Parameter</th>\n<th>Description</th>\n<th>Type</th>\n<th>Optional</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>required</td>\n<td>cannot be empty</td>\n<td>Boolean</td>\n<td>true</td>\n</tr>\n<tr>\n<td>pattern</td>\n<td>check regular expression</td>\n<td>regular</td>\n<td></td>\n</tr>\n<tr>\n<td>minLength</td>\n<td>Minimum string length / Minimum number of arrays</td>\n<td>Number</td>\n<td></td>\n</tr>\n<tr>\n<td>maxLength</td>\n<td>Maximum length of string / Maximum number of arrays</td>\n<td>Number</td>\n<td></td>\n</tr>\n<tr>\n<td>length</td>\n<td>string exact length / exact number of arrays</td>\n<td></td>\n<td>number</td>\n</tr>\n<tr>\n<td>min</td>\n<td>Min</td>\n<td>Number</td>\n<td></td>\n</tr>\n<tr>\n<td>max</td>\n<td>maximum</td>\n<td>Number</td>\n<td></td>\n</tr>\n<tr>\n<td>format</td>\n<td>sum of common patterns</td>\n<td>String</td>\n<td>url, email, tel, number</td>\n</tr>\n<tr>\n<td>validator</td>\n<td>Custom validation, (don&apos;t forget to execute <code>callback()</code> when validation is successful, otherwise validation will not return)</td>\n<td>Function(rule,value,callback)</td>\n<td></td>\n</tr>\n<tr>\n<td>trigger</td>\n<td>Name of the event that triggered the check</td>\n<td>String/Array</td>\n<td>onChange/onBlur/...</td>\n</tr>\n<tr>\n<td>message</td>\n<td>error message</td>\n<td>String</td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<h4>Field.useWatch</h4>\n<p>react hook for <code>field.watch</code></p>\n<pre class=\"language-typescript\"><code class=\"language-typescript\"><span class=\"token keyword\">type</span> <span class=\"token class-name\">WatchTriggerType</span> <span class=\"token operator\">=</span> <span class=\"token string\">&apos;init&apos;</span> <span class=\"token operator\">|</span> <span class=\"token string\">&apos;change&apos;</span> <span class=\"token operator\">|</span> <span class=\"token string\">&apos;setValue&apos;</span> <span class=\"token operator\">|</span> <span class=\"token string\">&apos;unmount&apos;</span> <span class=\"token operator\">|</span> <span class=\"token string\">&apos;reset&apos;</span><span class=\"token punctuation\">;</span>\n<span class=\"token keyword\">interface</span> <span class=\"token class-name\">WatchCallback</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token punctuation\">(</span>name<span class=\"token operator\">:</span> <span class=\"token builtin\">string</span><span class=\"token punctuation\">,</span> value<span class=\"token operator\">:</span> <span class=\"token builtin\">unknown</span><span class=\"token punctuation\">,</span> oldValue<span class=\"token operator\">:</span> <span class=\"token builtin\">unknown</span><span class=\"token punctuation\">,</span> triggerType<span class=\"token operator\">:</span> WatchTriggerType<span class=\"token punctuation\">)</span><span class=\"token operator\">:</span> <span class=\"token keyword\">void</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n<span class=\"token keyword\">class</span> <span class=\"token class-name\">Field</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">static</span> <span class=\"token function-variable function\">useWatch</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">(</span>field<span class=\"token operator\">:</span> Field<span class=\"token punctuation\">,</span> names<span class=\"token operator\">:</span> <span class=\"token builtin\">string</span><span class=\"token punctuation\">[</span><span class=\"token punctuation\">]</span><span class=\"token punctuation\">,</span> callback<span class=\"token operator\">:</span> WatchCallback<span class=\"token punctuation\">)</span> <span class=\"token operator\">=&gt;</span> <span class=\"token keyword\">void</span><span class=\"token punctuation\">;</span>\n<span class=\"token punctuation\">}</span>\n</code></pre>\n<!-- api-extra-end -->\n<h2 id=\"Custom Component Access To Field Standards\">Custom Component Access to Field Standards <a class=\"header-anchor scroll-count-item\" href=\"#Custom Component Access To Field Standards\" data-scroll-id=\"Custom Component Access To Field Standards\">#</a></h2>\n<ul>\n<li>\n<p>Supports controlled mode (value+onChange) <code>Must</code>\n&#xA0;&#xA0;&#xA0;&#xA0; - value control component data display\n&#xA0;&#xA0;&#xA0;&#xA0; - onChange callback function when the component changes (the first parameter can be given to value)</p>\n</li>\n<li>\n<p>One complete operation throws an onChange event\n&#xA0;&#xA0;&#xA0;&#xA0; For example, there is a process that indicates the status of the progress, it is recommended to increase the API <code>onProcess</code>; if there is a Start indicates the startup state, it is recommended to increase the API <code>onStart</code></p>\n</li>\n<li>\n<p>Clear data when <code>value={undefined}</code>, field&apos;s reset function will send undefined data to all components</p>\n</li>\n</ul>\n<pre><code>componentWillReceiveProps(nextProps) {\n    if (&apos;value&apos; in nextProps ) {\n        this.setState({\n           value: nextProps.value === undefined? []: nextProps.value   //  set value after clear\n        })\n    }\n}\n</code></pre>\n<h2 id=\"Known Issues\">Known Issues <a class=\"header-anchor scroll-count-item\" href=\"#Known Issues\" data-scroll-id=\"Known Issues\">#</a></h2>\n<ul>\n<li>Why doesn&apos;t the callback function enter the <code>this.field.validate</code> manually? A: Is it safe to define the validator method to ensure that the <code>callback</code> can be executed on any branch?</li>\n</ul>\n"}