feat: add missing export types in documentation (#1066)

* feat: export UploadFile

* doc(upload): update CHANGELOG

* feat(dropdown): export `DropdownDivider` type

* feat(cascader): alias CascaderOption option

* feat(mention): export `MentionOption` type

* feat(transfer): export `TransferOption` type

* feat(pagination): add `PaginationInfo` type

* feat(data-table): add `CreateSummary` type

* fix: export missing `DropdownDivider`

* feat(dropdown): add `DropdownGroup` & `DropdownSubmenu` type

Co-authored-by: 07akioni <07akioni2@gmail.com>
This commit is contained in:
equt 2021-09-04 14:12:34 +08:00 committed by GitHub
parent b61363c882
commit 424f1cd1c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 64 additions and 5 deletions

View File

@ -23,6 +23,13 @@
- `n-dropdown` option add `props` prop, closes [#813](https://github.com/TuSimple/naive-ui/issues/813).
- `n-data-table` supports multi-selection by holding down `shift`, closes [#554](https://github.com/TuSimple/naive-ui/issues/554).
- `n-tree-select` add `check-strategy` prop, closes [#624](https://github.com/TuSimple/naive-ui/issues/624).
- `n-upload` export `UploadFile` type.
- `n-dropdown` export `DropdownDivider`, `DropdownSubmenu`, and `DropdownGroup` type.
- `n-cascader` export `CascaderOption` type.
- `n-mention` export `MentionOption` type.
- `n-transfer` export `TransferOption` type.
- `n-pagination` export `PaginationInfo` type.
- `n-data-table` export `CreateSummary` type.
- `n-code` add `inline` prop, closes [#834](https://github.com/TuSimple/naive-ui/issues/834)
### Fixes

View File

@ -23,6 +23,13 @@
- `n-dropdown` 选项新增 `props` 属性,关闭 [#813](https://github.com/TuSimple/naive-ui/issues/813)
- `n-data-table` 支持按住 `shift` 进行多选操作,关闭 [#554](https://github.com/TuSimple/naive-ui/issues/554)
- `n-tree-select` 增加 `check-strategy` 属性,关闭 [#624](https://github.com/TuSimple/naive-ui/issues/624)
- `n-upload` 增加 `UploadFile` 类型
- `n-dropdown` 导出 `DropdownDivider`, `DropdownSubmenu``DropdownGroup` 类型
- `n-cascader` 导出 `CascaderOption` 类型
- `n-mention` 导出 `MentionOption` 类型
- `n-transfer` 导出 `TransferOption` 类型
- `n-pagination` 导出 `PaginationInfo` 类型
- `n-data-table` 导出 `CreateSummary` 类型
- `n-code` 新增 `inline` 属性, 关闭 [#834](https://github.com/TuSimple/naive-ui/issues/834)
### Fixes

View File

@ -1,2 +1,3 @@
export { default as NCascader } from './src/Cascader'
export type { CascaderProps } from './src/Cascader'
export type { CascaderOption } from './src/interface'

View File

@ -9,6 +9,8 @@ export type Value = ValueAtom | ValueAtom[]
export type Key = ValueAtom
export type CascaderOption = BaseOption
export interface BaseOption {
label: string
value: ValueAtom
@ -99,6 +101,5 @@ export interface SelectMenuInstance {
enter: () => boolean
}
export const cascaderInjectionKey: InjectionKey<CascaderInjection> = Symbol(
'cascader'
)
export const cascaderInjectionKey: InjectionKey<CascaderInjection> =
Symbol('cascader')

View File

@ -1,3 +1,10 @@
import type {
CreateSummary as InternalCreateSummary,
RowData
} from './src/interface'
export type CreateSummary = InternalCreateSummary<RowData>
export { default as NDataTable } from './src/DataTable'
export type { DataTableProps } from './src/DataTable'
export type {
@ -12,5 +19,7 @@ export type {
CreateRowClassName as DataTableCreateRowClassName,
CreateRowKey as DataTableCreateRowKey,
CreateRowProps as DataTableCreateRowProps,
DataTableInst
DataTableInst,
SummaryRowData,
SummaryCell
} from './src/interface'

View File

@ -4,5 +4,8 @@ export type {
DropdownOption,
DropdownGroupOption,
DropdownIgnoredOption,
DropdownDivider,
DropdownSubmenu,
DropdownGroup,
DropdownDividerOption
} from './src/interface'

View File

@ -33,6 +33,25 @@ export interface DropdownDividerOption {
[key: string]: unknown
}
export type DropdownDivider = Pick<DropdownDividerOption, 'type' | 'key'>
export interface DropdownSubmenu {
type: 'submenu'
label: string
icon?: () => VNodeChild
key: Key
children: Array<DropdownOption | DropdownDivider | DropdownSubmenu>
disabled: boolean
}
export interface DropdownGroup {
type: 'group'
label: string
icon?: () => VNodeChild
key: Key
children: Array<DropdownOption | DropdownDivider | DropdownSubmenu>
}
export type TmNode = TreeNode<
DropdownOption,
DropdownGroupOption,

View File

@ -1,5 +1,7 @@
import type { DropdownMixedOption } from './interface'
export type { DropdownDivider } from './interface'
export function isSubmenuNode (rawNode: DropdownMixedOption): boolean {
return (
rawNode.type === 'submenu' ||

View File

@ -1,2 +1,3 @@
export { default as NMention } from './src/Mention'
export type { MentionProps } from './src/Mention'
export type { MentionOption } from './src/interface'

View File

@ -1,2 +1,3 @@
export { default as NPagination } from './src/Pagination'
export type { PaginationProps } from './src/Pagination'
export type { PaginationInfo } from './src/interface'

View File

@ -1,5 +1,7 @@
import { VNodeChild } from 'vue'
export type PaginationInfo = Parameters<RenderPrefix>[0]
export type RenderPrefix = (info: {
startIndex: number
endIndex: number

View File

@ -1,2 +1,3 @@
export { default as NTransfer } from './src/Transfer'
export type { TransferProps } from './src/Transfer'
export type { Option as TransferOption } from './src/interface'

View File

@ -2,4 +2,4 @@ export { default as NUpload } from './src/Upload'
export { default as NUploadDragger } from './src/UploadDragger'
export type { UploadProps } from './src/Upload'
export type { uploadDraggerKey } from './src/UploadDragger'
export type { UploadInst } from './src/interface'
export type { UploadInst, UploadFile } from './src/interface'

View File

@ -13,6 +13,11 @@ export interface FileInfo {
type?: string
}
export type UploadFile = Pick<
FileInfo,
'id' | 'name' | 'status' | 'percentage' | 'file'
>
export type FuncOrRecordOrUndef =
| Record<string, string>
| (({ file }: { file: FileInfo }) => Record<string, string>)