refactor: tree-select
parent
415c2888c4
commit
15ca5f0787
|
@ -22,32 +22,6 @@ interface TreeEventInfo {
|
|||
checked?: boolean;
|
||||
}
|
||||
|
||||
export interface OptionListProps<OptionsType extends object[]> {
|
||||
prefixCls: string;
|
||||
id: string;
|
||||
options: OptionsType;
|
||||
flattenOptions: FlattenDataNode[];
|
||||
height: number;
|
||||
itemHeight: number;
|
||||
virtual?: boolean;
|
||||
values: Set<RawValueType>;
|
||||
multiple: boolean;
|
||||
open: boolean;
|
||||
defaultActiveFirstOption?: boolean;
|
||||
notFoundContent?: any;
|
||||
menuItemSelectedIcon?: any;
|
||||
childrenAsData: boolean;
|
||||
searchValue: string;
|
||||
|
||||
onSelect: (value: RawValueType, option: { selected: boolean }) => void;
|
||||
onToggleOpen: (open?: boolean) => void;
|
||||
/** Tell Select that some value is now active to make accessibility work */
|
||||
onActiveValue: (value: RawValueType, index: number) => void;
|
||||
onScroll: UIEvent;
|
||||
|
||||
onMouseenter: () => void;
|
||||
}
|
||||
|
||||
type ReviseRefOptionListProps = Omit<RefOptionListProps, 'scrollTo'> & { scrollTo: ScrollTo };
|
||||
|
||||
export default defineComponent({
|
||||
|
|
|
@ -3,11 +3,11 @@ import type { DataNode } from '../tree';
|
|||
import PropTypes from '../_util/vue-types';
|
||||
import type { FlattenDataNode, RawValueType } from './interface';
|
||||
|
||||
export function optionListProps<OptionsType extends object[]>() {
|
||||
export function optionListProps<OptionsType>() {
|
||||
return {
|
||||
prefixCls: String,
|
||||
id: String,
|
||||
options: { type: Array as PropType<unknown> as PropType<OptionsType> },
|
||||
options: { type: Array as PropType<OptionsType[]> },
|
||||
flattenOptions: { type: Array as PropType<FlattenDataNode[]> },
|
||||
height: Number,
|
||||
itemHeight: Number,
|
||||
|
@ -33,9 +33,9 @@ export function optionListProps<OptionsType extends object[]>() {
|
|||
};
|
||||
}
|
||||
|
||||
class Helper<T extends object[]> {
|
||||
class Helper<T> {
|
||||
Return = optionListProps<T>();
|
||||
}
|
||||
type FuncReturnType<T extends object[]> = Helper<T>['Return'];
|
||||
type FuncReturnType<T> = Helper<T>['Return'];
|
||||
|
||||
export type OptionListProps = Partial<ExtractPropTypes<FuncReturnType<DataNode[]>>>;
|
||||
export type OptionListProps = Partial<ExtractPropTypes<FuncReturnType<DataNode>>>;
|
||||
|
|
Loading…
Reference in New Issue