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