mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-30 12:52:43 +08:00
doc: refine type annotations
This commit is contained in:
parent
30820db527
commit
7b14362207
@ -42,7 +42,7 @@ after-select
|
||||
## Slots
|
||||
|Name|Parameters|Description|
|
||||
|-|-|-|
|
||||
|default|`({ handleInput: (value: string) => any, handleFocus: function, handleBlur: function, value: string, theme: string \| null })`||
|
||||
|default|`(options: { handleInput: (value: string) => any, handleFocus: function, handleBlur: function, value: string, theme: string \| null })`||
|
||||
|
||||
## Events
|
||||
|Name|Parameters|Description|
|
||||
|
@ -43,7 +43,7 @@ after-select
|
||||
## Slots
|
||||
|名称|参数|说明|
|
||||
|-|-|-|
|
||||
|default|`({ handleInput: (value: string) => any, handleFocus: function, handleBlur: function, value: string, theme: string \| null })`||
|
||||
|default|`(options: { handleInput: (value: string) => any, handleFocus: function, handleBlur: function, value: string, theme: string \| null })`||
|
||||
|
||||
## Events
|
||||
|名称|参数|说明|
|
||||
|
@ -43,11 +43,11 @@ item-header-click
|
||||
|-|-|-|
|
||||
|default|`()`||
|
||||
|header|`()`||
|
||||
|arrow|`({ collapsed: boolean })`||
|
||||
|arrow|`(options: { collapsed: boolean })`||
|
||||
|
||||
## Event
|
||||
### Collapse Event
|
||||
|Name|Parameters|Description|
|
||||
|-|-|-|
|
||||
|expanded-names-change|`(expandedNames: Array<string>)`||
|
||||
|item-header-click|`({ name: string, expanded: boolean, event: MouseEvent })`||
|
||||
|item-header-click|`(data: { name: string, expanded: boolean, event: MouseEvent })`||
|
@ -43,11 +43,11 @@ item-header-click
|
||||
|-|-|-|
|
||||
|default|`()`||
|
||||
|header|`()`||
|
||||
|arrow|`({ collapsed: boolean })`||
|
||||
|arrow|`(options: { collapsed: boolean })`||
|
||||
|
||||
## Event
|
||||
### Collapse Event
|
||||
|名称|参数|说明|
|
||||
|-|-|-|
|
||||
|expanded-names-change|`(expandedNames: Array<string>)`||
|
||||
|item-header-click|`({ name: string, expanded: boolean, event: MouseEvent })`||
|
||||
|item-header-click|`(data: { name: string, expanded: boolean, event: MouseEvent })`||
|
||||
|
@ -16,4 +16,4 @@ color
|
||||
## Slots
|
||||
|Name|Parameters|Description|
|
||||
|-|-|-|
|
||||
|default|`({ theme: string, namespace: string, language: string, themeEnvironment: any, styleScheme: object })`||
|
||||
|default|`(options: { theme: string, namespace: string, language: string, themeEnvironment: any, styleScheme: Object })`||
|
@ -16,4 +16,4 @@ color
|
||||
## Slots
|
||||
|名称|参数|说明|
|
||||
|-|-|-|
|
||||
|default|`({ theme: string, namespace: string, language: string, themeEnvironment: any, styleScheme: object })`||
|
||||
|default|`(options: { theme: string, namespace: string, language: string, themeEnvironment: any, styleScheme: object })`||
|
@ -66,7 +66,7 @@ These methods can help you control table in an uncontrolled manner. However, it'
|
||||
|Name|Parameters|Description|
|
||||
|-|-|-|
|
||||
|filters-change|`(filters: { [string \| number]: Array<string \| number> }, initiatorColumn: Column)`||
|
||||
|sorter-change|`({ columnKey: string \| number, sorter: 'default' \| function \| boolean, order: 'ascend' \| 'descend' \| false } \| null)`|If there won't be a active sorter after change, sorter-change will emit `null`|
|
||||
|sorter-change|`(data: { columnKey: string \| number, sorter: 'default' \| function \| boolean, order: 'ascend' \| 'descend' \| false } \| null)`|If there won't be a active sorter after change, sorter-change will emit `null`|
|
||||
|page-change|`(page: number)`||
|
||||
|page-size-change|`(pageSize: number)`||
|
||||
|checked-row-keys-change|`(keys: Array<string \| number>)`||
|
||||
|
@ -66,7 +66,7 @@ ajaxUsage
|
||||
|名称|参数|说明|
|
||||
|-|-|-|
|
||||
|filters-change|`(filters: { [string \| number]: Array<string \| number> \| string \| number }, initiatorColumn: Column)`||
|
||||
|sorter-change|`({ columnKey: string \| number, sorter: 'default' \| function \| boolean, order: 'ascend' \| 'descend' \| false } \| null)`|如果在变动后没有激活的排序,那么 sorter-change 将发出 `null`|
|
||||
|sorter-change|`(options: { columnKey: string \| number, sorter: 'default' \| function \| boolean, order: 'ascend' \| 'descend' \| false } \| null)`|如果在变动后没有激活的排序,那么 sorter-change 将发出 `null`|
|
||||
|page-change|`(page: number)`||
|
||||
|page-size-change|`(pageSize: number)`||
|
||||
|checked-row-keys-change|`(keys: Array<string \| number>)`||
|
||||
|
@ -43,7 +43,7 @@ form
|
||||
## Slots
|
||||
|Name|Parameters|Description|
|
||||
|-|-|-|
|
||||
|default|`({ value: any, index: number })`|The content of each item, `value` is the value of current item, `index` is the index of the current item.|
|
||||
|default|`(options: { value: any, index: number })`|The content of each item, `value` is the value of current item, `index` is the index of the current item.|
|
||||
|
||||
## Events
|
||||
|Name|Parameters|Description|
|
||||
|
@ -44,7 +44,7 @@ form
|
||||
## Slots
|
||||
|名称|参数|说明|
|
||||
|-|-|-|
|
||||
|default|`({ value: any, index: number })`|每一项的渲染方式,其中 `value` 为该项对应的数组值,`index` 为该项对应的数组索引|
|
||||
|default|`(options: { value: any, index: number })`|每一项的渲染方式,其中 `value` 为该项对应的数组值,`index` 为该项对应的数组索引|
|
||||
|
||||
## Events
|
||||
|名称|参数|说明|
|
||||
|
@ -75,7 +75,7 @@ Accept all props from form-item & [Col](n-row#Col-Props)
|
||||
### Form Item, Form Item Row, Form Item Col Methods
|
||||
|Name|Type|Description|
|
||||
|-|-|-|
|
||||
|validate|`({ trigger?: string, callback?: (errors?: Array<ValidationError>) => any, shouldRuleBeApplied?: FormItemRule => boolean, options?: AsyncValidatorOptions }) => Promise<void>`|Validate the form item. The rejection value type of returned promise is `Array<ValidationError>`. If trigger is not set, all rules of the item will be applied. `shouldRuleBeApplied` can filter rules after they are filtered by the trigger.|
|
||||
|validate|`(options: { trigger?: string, callback?: (errors?: Array<ValidationError>) => any, shouldRuleBeApplied?: FormItemRule => boolean, options?: AsyncValidatorOptions }) => Promise<void>`|Validate the form item. The rejection value type of returned promise is `Array<ValidationError>`. If trigger is not set, all rules of the item will be applied. `shouldRuleBeApplied` can filter rules after they are filtered by the trigger.|
|
||||
|clearValidationEffect|`() => void`||
|
||||
|
||||
About AsyncValidatorOptions, see <n-a href="https://github.com/yiminghe/async-validator">async-validator</n-a>.
|
||||
|
@ -75,7 +75,7 @@ validator-debug
|
||||
### Form Item, Form Item Row, Form Item Col Methods
|
||||
|名称|类型|说明|
|
||||
|-|-|-|
|
||||
|validate|`({ trigger?: string, callback?: (errors?: Array<ValidationError>) => any, shouldRuleBeApplied?: FormItemRule => boolean, options?: AsyncValidatorOptions }) => Promise<void>`|验证表项,Promise rejection 的返回值类型是 `Array<ValidationError>`。如果设定 `trigger`,这一个表项全部的规则都会被使用。`shouldRuleBeApplied` 可以用来进一步过滤已经经过 `trigger` 筛选的规则|
|
||||
|validate|`(options: { trigger?: string, callback?: (errors?: Array<ValidationError>) => any, shouldRuleBeApplied?: FormItemRule => boolean, options?: AsyncValidatorOptions }) => Promise<void>`|验证表项,Promise rejection 的返回值类型是 `Array<ValidationError>`。如果设定 `trigger`,这一个表项全部的规则都会被使用。`shouldRuleBeApplied` 可以用来进一步过滤已经经过 `trigger` 筛选的规则|
|
||||
|clearValidationEffect|`() => void`||
|
||||
|
||||
关于 AsyncValidatorOptions,参考 <n-a href="https://github.com/yiminghe/async-validator">async-validator</n-a>。
|
||||
|
@ -44,11 +44,11 @@ filter
|
||||
## Events
|
||||
|Name|Parameters|Description|
|
||||
|-|-|-|
|
||||
|selected-keys-change|`(Array<string \| number>)`||
|
||||
|expanded-keys-change|`(Array<string \| number>)`||
|
||||
|checked-keys-change|`(Array<string \| number>)`||
|
||||
|dragstart|`({ node: TreeNode, event: DragEvent })`||
|
||||
|dragend|`({ node: TreeNode, event: DragEvent })`||
|
||||
|dragenter|`({ node: TreeNode, event: DragEvent })`||
|
||||
|dragleave|`({ node: TreeNode, event: DragEvent })`||
|
||||
|drop|`({ node: TreeNode, dragNode: TreeNode, dropPosition: 'top' \| 'center' \| 'bottom', event: DragEvent })`||
|
||||
|selected-keys-change|`(keys: Array<string \| number>)`||
|
||||
|expanded-keys-change|`(keys: Array<string \| number>)`||
|
||||
|checked-keys-change|`(keys: Array<string \| number>)`||
|
||||
|dragstart|`(data: { node: TreeNode, event: DragEvent })`||
|
||||
|dragend|`(data: { node: TreeNode, event: DragEvent })`||
|
||||
|dragenter|`(data: { node: TreeNode, event: DragEvent })`||
|
||||
|dragleave|`(data: { node: TreeNode, event: DragEvent })`||
|
||||
|drop|`(data: { node: TreeNode, dragNode: TreeNode, dropPosition: 'top' \| 'center' \| 'bottom', event: DragEvent })`||
|
@ -43,11 +43,11 @@ filter
|
||||
## Events
|
||||
|名称|参数|说明|
|
||||
|-|-|-|
|
||||
|selected-keys-change|`(Array<string \| number>)`||
|
||||
|expanded-keys-change|`(Array<string \| number>)`||
|
||||
|checked-keys-change|`(Array<string \| number>)`||
|
||||
|dragstart|`({ node: TreeNode, event: DragEvent })`||
|
||||
|dragend|`({ node: TreeNode, event: DragEvent })`||
|
||||
|dragenter|`({ node: TreeNode, event: DragEvent })`||
|
||||
|dragleave|`({ node: TreeNode, event: DragEvent })`||
|
||||
|drop|`({ node: TreeNode, dragNode: TreeNode, dropPosition: 'top' \| 'center' \| 'bottom', event: DragEvent })`||
|
||||
|selected-keys-change|`(keys: Array<string \| number>)`||
|
||||
|expanded-keys-change|`(keys: Array<string \| number>)`||
|
||||
|checked-keys-change|`(keys: Array<string \| number>)`||
|
||||
|dragstart|`(data: { node: TreeNode, event: DragEvent })`||
|
||||
|dragend|`(data: { node: TreeNode, event: DragEvent })`||
|
||||
|dragenter|`(data: { node: TreeNode, event: DragEvent })`||
|
||||
|dragleave|`(data: { node: TreeNode, event: DragEvent })`||
|
||||
|drop|`(data: { node: TreeNode, dragNode: TreeNode, dropPosition: 'top' \| 'center' \| 'bottom', event: DragEvent })`||
|
@ -24,9 +24,9 @@ default-files
|
||||
|headers|`object \| ({ file: UploadFile }) => object`|`null`|The additional HTTP Headers of request.|
|
||||
|data|`object \| ({ file: UploadFile }) => object`|`null`|The additional fileds data of HTTP request's form data.|
|
||||
|with-credentials|`boolean`|`false`|If cookie attached.|
|
||||
|on-change|`({ file: UploadFile, fileList: Array<UploadFile>, event?: Event }) => any`|`() => {}`|The callback of status change of the component. Any file status change would fire the callback.|
|
||||
|on-remove|`({ file: UploadFile, fileList: Array<UploadFile> }) => boolean \| Promise<boolean> \| any`|`() => true`|The callback of file removal. Return false, promise resolve false or promise reject will cancel this removal.|
|
||||
|on-finish|`({ file: UploadFile }) => UploadFile \| void`|`file => file`|The callback of file upload finish. You can modify the UploadFile or retun a new UploadFile.|
|
||||
|on-change|`(options: { file: UploadFile, fileList: Array<UploadFile>, event?: Event }) => any`|`() => {}`|The callback of status change of the component. Any file status change would fire the callback.|
|
||||
|on-remove|`(options: { file: UploadFile, fileList: Array<UploadFile> }) => boolean \| Promise<boolean> \| any`|`() => true`|The callback of file removal. Return false, promise resolve false or promise reject will cancel this removal.|
|
||||
|on-finish|`(options: { file: UploadFile }) => UploadFile \| void`|`file => file`|The callback of file upload finish. You can modify the UploadFile or retun a new UploadFile.|
|
||||
|default-upload|`boolean`|`false`|If file uploaded immediatelly after file is selected.|
|
||||
|file-list|`Array<UploadFile>`|`undefined`|The file list of component. If set, the component will work in controlled manner.|
|
||||
|file-list-style|`Object`|`null`|The style of file list area|
|
||||
|
@ -23,9 +23,9 @@ default-files
|
||||
|headers|`object \| ({ file: UploadFile }) => object`|`null`|HTTP 请求需要附加的 Headers|
|
||||
|data|`object \| ({ file: UploadFile }) => object`|`null`|提交表单需要附加的数据|
|
||||
|with-credentials|`boolean`|`false`|是否携带 Cookie|
|
||||
|on-change|`({ file: UploadFile, fileList: Array<UploadFile>, event?: Event }) => any`|`() => {}`|组件状态变化的回调,组件的任何文件状态变化都会触发回调|
|
||||
|on-remove|`({ file: UploadFile, fileList: Array<UploadFile> }) => boolean \| Promise<boolean> \| any`|`() => true`|文件移除的回调,返回 false 或者 promise resolve false 或者 promise reject 会不执行这次删除|
|
||||
|on-finish|`({ file: UploadFile }) => UploadFile \| void`|`file => file`|文件上传结束的回调,可以修改传入的 UploadFile 或者返回一个新的 UploadFile|
|
||||
|on-change|`(options: { file: UploadFile, fileList: Array<UploadFile>, event?: Event }) => any`|`() => {}`|组件状态变化的回调,组件的任何文件状态变化都会触发回调|
|
||||
|on-remove|`(options: { file: UploadFile, fileList: Array<UploadFile> }) => boolean \| Promise<boolean> \| any`|`() => true`|文件移除的回调,返回 false 或者 promise resolve false 或者 promise reject 会不执行这次删除|
|
||||
|on-finish|`(options: { file: UploadFile }) => UploadFile \| void`|`file => file`|文件上传结束的回调,可以修改传入的 UploadFile 或者返回一个新的 UploadFile|
|
||||
|default-upload|`boolean`|`false`|选择文件时候是否默认上传|
|
||||
|file-list|`Array<UploadFile>`|`undefined`|文件列表,如果传入组件会处于受控状态|
|
||||
|file-list-style|`Object`|`null`|文件列表区域的样式|
|
||||
|
Loading…
Reference in New Issue
Block a user