shineout
Version:
Shein 前端组件库
48 lines (47 loc) • 2.11 kB
TypeScript
import { ChangeType } from './types';
import { ObjectType } from '../@types/common';
import { ListDatumOptions } from './Props';
export default class<Item, Value> {
distinct: ListDatumOptions<Item, Value>['distinct'];
prediction: ListDatumOptions<Item, Value>['prediction'];
onChange: ListDatumOptions<Item, Value>['onChange'];
limit: ListDatumOptions<Item, Value>['limit'];
separator?: ListDatumOptions<Item, Value>['separator'];
$events: ObjectType<Function[]>;
$cachedDisabled: ListDatumOptions<Item, Value>['disabled'] | {};
$cachedFlatten: Map<any, any>;
valueMap: Map<any, boolean>;
disabled: (...args: any) => boolean;
format: (...args: any) => unknown;
$values: any[];
$cachedValue: Value;
updateLock: boolean;
constructor(args?: ListDatumOptions<Item, Value>);
get length(): number;
cleanDataCache(): void;
get values(): any[];
set values(values: any[]);
resetValueMap(): void;
setDisabled(disabled: ListDatumOptions<Item, Value>['disabled']): void;
handleChange(values: any[], ...args: any): void;
flattenTreeData(data: Item[], childrenKey: keyof Item): any;
setLock(lock: boolean): void;
add(data: Item | Item[], _?: any, childrenKey?: keyof Item, unshift?: boolean): void;
set(value: Item): void;
check(raw: Item): boolean;
getDataByValue(data: Item[], value: Value extends (infer U)[] ? U : Value): Item | null | undefined;
clear(): void;
dispatch(name: string, ...args: any): void;
initFormat(f: ListDatumOptions<Item, Value>['format']): void;
defaultPrediction(value: unknown, data: Item): boolean;
remove(value: Item | Item[] | {
IS_NOT_MATCHED_VALUE: boolean;
value: any;
}, _?: unknown, childrenKey?: string): void;
subscribe(name: string, fn: Function): void;
unsubscribe(name: string, fn: Function): void;
getValue(): any;
resetValue(values: any[], cached: boolean): void;
formatValue(values: Value | undefined): string[] | (Value | undefined)[] | (Value & any[]);
setValue(values?: Value, type?: ChangeType): void;
}