New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@alifd/field

Package Overview
Dependencies
Maintainers
13
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alifd/field - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

5

demo/normalize.md

@@ -6,5 +6,6 @@ ---

通过 `getValueFormatter` 自定义从组件获取 `value`
通过 `setValueFormatter` 自定义转换 `value` 到组件
当组件返回的数据和最终期望提交的格式不一致的时候,可以使用 `getValueFormatter` 和 `setValueFormatter` 两个函数做转换。
比如 switch 组件期望上报 0/1, date-picker 组件期望上报 YYYY-MM-DD 这种字符串格式
---

@@ -11,0 +12,0 @@

4

package.json
{
"name": "@alifd/field",
"version": "1.4.1",
"version": "1.4.2",
"description": "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.",

@@ -88,3 +88,3 @@ "files": [

},
"homepage": "https://unpkg.com/@alifd/field@1.4.1/build/index.html",
"homepage": "https://unpkg.com/@alifd/field@1.4.2/build/index.html",
"bugs": "https://github.com/alibaba-fusion/field/issues",

@@ -91,0 +91,0 @@ "publishConfig": {

@@ -243,4 +243,4 @@ # Field

| options.rules | 校验规则 | Array/Object | | | |
| options.getValueFormatter | 自定义从组件获取 `value` ,详细用法查看demo `自定义数据获取` | Function(value,...args) 参数顺序和组件是完全一致的 | | | |
| options.setValueFormatter | 自定义转换 `value` 到组件 ,详细用法查看demo `自定义数据获取` | Function(value) | | | |
| options.getValueFormatter | 自定义从组件获取 `value` 的方式,详细用法查看demo `自定义数据获取` | Function(value,...args) 参数顺序和组件的 onChange 完全一致 | | | |
| options.setValueFormatter | 自定义转换 `value` 为组件需要的数据 ,详细用法查看demo `自定义数据获取` | Function(value) | | | |
| props | 组件自定义的事件可以写在这里 | Object | | | |

@@ -247,0 +247,0 @@ | autoValidate | 是否修改数据的时候自动触发校验单个组件的校验, 设为 false 后只能通过 validate() 来触发校验 | Boolean |true|

@@ -142,5 +142,9 @@ export type FieldOption = {

/**
* 自定义从onChange事件中获取value的方式,一般不需要设置. 详细用法查看demo 自定义数据获取 参数顺序和组件是完全一致的
* 自定义从组件获取 `value` 的方式,参数顺序和组件的 onChange 完全一致的
*/
getValueFromEvent?: (eventArgs: object) => T;
getValueFormatter?: (eventArgs: object) => T;
/**
* 自定义转换 `value` 为组件需要的数据
*/
setValueFormatter?: (value: T) => T;
};

@@ -147,0 +151,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc