Skip to content

Commit

Permalink
fix: 修复Type类型定义错误
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertLin0923 committed Nov 20, 2023
1 parent 90850c6 commit b4808bb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/components/src/MangoProTable/demo/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const Demo: FC = () => {
title: '录入新订单',
content: '请填写订单信息',
onOk: async () => {
mangoProTableRef.current.refresh()
mangoProTableRef?.current?.refresh()
},
})
},
Expand Down Expand Up @@ -142,7 +142,7 @@ const Demo: FC = () => {
{
name: 'status',
label: '处理进度',
type: 'mango-form-radio',
type: 'radio',
initialValue: 1,
optionFilter: (data: any) => data?.statusMap,
immediate: true,
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/MangoProTable/renderTableColumns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const renderTableColumns = (
render,
valueType = 'text',
valueEnum = [],
...rest
}) => {
return {
key: dataIndex,
Expand All @@ -134,6 +135,7 @@ export const renderTableColumns = (
valueEnum,
queryFormOptionData,
),
...rest,
}
},
) ?? []),
Expand Down
18 changes: 10 additions & 8 deletions packages/components/src/MangoProTable/type.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import type { AlertProps, SelectProps } from 'antd'
import type { MessageInstance } from 'antd/es/message/interface'
import type { ModalStaticFunctions } from 'antd/es/modal/confirm'
import type { NotificationInstance } from 'antd/es/notification/interface'
import type { DatePickerProps, InputProps, FormItemProps } from 'antd'
import type { InputProps, FormItemProps } from 'antd'
import type { DatePickerProps, RangePickerProps } from 'antd/es/date-picker'
import type { ColumnType } from 'antd/es/table'
import type { Dayjs } from 'dayjs'

type InputFieldType = {
Expand Down Expand Up @@ -45,7 +47,7 @@ type DatePickerFieldType = {
label?: string
initialValue?: Dayjs[]
immediate?: boolean
extraRawFieldProps?: Omit<DatePickerProps, 'placeholder' | 'picker'>
extraRawFieldProps?: DatePickerProps
extraFormFieldProps?: Omit<
FormItemProps,
'name' | 'label' | 'placeholder' | 'initialValue'
Expand All @@ -55,11 +57,11 @@ type DatePickerFieldType = {
type DateRangePickerFieldType = {
name: string
type: 'date-range-picker'
picker: DatePickerProps['picker']
picker: RangePickerProps['picker']
label?: string
initialValue?: Dayjs[]
immediate?: boolean
extraRawFieldProps?: Omit<DatePickerProps, 'placeholder' | 'picker'>
extraRawFieldProps?: RangePickerProps
extraFormFieldProps?: Omit<
FormItemProps,
'name' | 'label' | 'placeholder' | 'initialValue'
Expand Down Expand Up @@ -119,25 +121,25 @@ export type ValueEnum =
[key: string]: any
}[]
| string
| ((searchOptionsData: any) => {
| ((queryFormOptionData: any) => {
label: string
value: string | number
color: string
[key: string]: any
}[])

export type ColumnsType = {
export type ColumnsType = ({
title: string
dataIndex: string
align?: string
width?: number | string
ellipsis?: boolean
copyable?: boolean
fixed?: boolean
fixed?: boolean | string
render?: (text: any, record: any, index: number) => ReactNode
valueType?: ValueType
valueEnum?: ValueEnum
}[]
} & ColumnType<Record<string, any>>)[]

export type ColumnActionsType = {
width?: string | number
Expand Down

0 comments on commit b4808bb

Please sign in to comment.