feat: update collapse type
parent
2f51f2d3af
commit
321989b9c2
|
@ -74,6 +74,6 @@ export function stringType<T extends string = string>(defaultVal?: T) {
|
|||
return { type: String as unknown as PropType<T>, default: defaultVal as T };
|
||||
}
|
||||
|
||||
export function someType<T>(types: any[], defaultVal?: T) {
|
||||
return { type: types as PropType<T>, default: defaultVal as T };
|
||||
export function someType<T>(types?: any[], defaultVal?: T) {
|
||||
return types ? { type: types as PropType<T>, default: defaultVal as T } : anyType<T>(defaultVal);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { Key } from '../_util/type';
|
||||
import { tuple, booleanType, someType, stringType, functionType } from '../_util/type';
|
||||
import { booleanType, someType, stringType, functionType } from '../_util/type';
|
||||
import PropTypes from '../_util/vue-types';
|
||||
|
||||
export type CollapsibleType = 'header' | 'icon' | 'disabled';
|
||||
|
@ -26,7 +26,7 @@ const collapseProps = () => ({
|
|||
bordered: booleanType(),
|
||||
expandIcon: functionType<(panelProps: PanelProps) => any>(),
|
||||
openAnimation: PropTypes.object,
|
||||
expandIconPosition: PropTypes.oneOf(tuple('start', 'end')),
|
||||
expandIconPosition: stringType<'start' | 'end'>(),
|
||||
collapsible: stringType<CollapsibleType>(),
|
||||
ghost: booleanType(),
|
||||
onChange: functionType<(key: Key | Key[]) => void>(),
|
||||
|
@ -47,7 +47,7 @@ const collapsePanelProps = () => ({
|
|||
forceRender: booleanType(),
|
||||
expandIcon: functionType<(panelProps: PanelProps) => any>(),
|
||||
extra: PropTypes.any,
|
||||
panelKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
panelKey: someType<number | string>(),
|
||||
collapsible: stringType<CollapsibleType>(),
|
||||
role: String,
|
||||
onItemClick: functionType<(panelKey: Key) => void>(),
|
||||
|
|
Loading…
Reference in New Issue