@wfrog/vc
Version:
vue3 组件库 vc
79 lines (78 loc) • 2.67 kB
TypeScript
import { CascaderOption, CascaderProps } from 'element-plus';
import { ComputedRef, Ref } from 'vue';
export interface IPCAPickerProps {
source: 'p' | 'p-py' | 'p-py-fn' | 'pc' | 'pc-py' | 'pc-py-fn' | 'pca' | 'pca-py' | 'pca-py-fn';
type: 'P' | 'C' | 'PC' | 'PCA';
hotIds?: number[];
hotText?: string;
history?: boolean;
historyText?: string;
historyMax?: number;
historyStorageKey?: string;
excludeIds?: number[];
nameKey?: string;
modelValue: number | number[] | undefined;
disabled?: boolean;
multiple?: boolean;
placeholder?: string;
loadingText?: string;
loadFailedText?: string;
activeMark?: boolean;
syncActive?: boolean;
limit?: number;
props?: CascaderProps;
}
export interface ICommmonStateType {
props: Required<IPCAPickerProps>;
availableData: ComputedRef<IPCAData[]>;
flatData: ComputedRef<IPCAData[]>;
filterData: ComputedRef<IPCAData[]>;
historyData: ComputedRef<IPCAData[]>;
fpyGroupData: ComputedRef<{
label: string;
childs: IPCAData[];
}[]>;
optionData: ComputedRef<CascaderOption[]>;
itemClass: (item: IPCAData, isHistoryOrHot?: boolean) => Record<string, boolean>;
hasHot: ComputedRef<boolean>;
hotData: ComputedRef<IPCAData[]>;
clickItem: (item: IPCAData) => void;
clickItems: (items: IPCAData[]) => void;
keyword: Ref<string>;
lastKeyword: Ref<string>;
popoverVisible: Ref<boolean>;
togglePopoverVisible: (visible?: boolean) => boolean;
updatePopper: () => Promise<void>;
}
export interface IPCAData {
id: number;
n: string;
fpy: string;
fn?: string;
py?: string;
childs?: IPCAData[];
[key: string]: any;
}
export declare function usePCAData(params: IPCAPickerProps): {
fetchData: (pcaBaseUrl: string, crosProxy?: string) => Promise<IPCAData[]>;
loading: Ref<boolean, boolean>;
loadFailed: Ref<boolean, boolean>;
filterData: ComputedRef<IPCAData[]>;
flatData: ComputedRef<IPCAData[]>;
keyword: Ref<string, string>;
lastKeyword: Ref<string, string>;
availableData: ComputedRef<IPCAData[]>;
optionData: ComputedRef<CascaderOption[]>;
setProps: (data: IPCAPickerProps) => void;
hasHot: ComputedRef<boolean>;
hotData: ComputedRef<IPCAData[]>;
historyData: ComputedRef<IPCAData[]>;
appendToHistory: (id: number) => void;
getValueData: (values: number | number[] | undefined) => IPCAData[];
fpyGroupData: ComputedRef<{
label: string;
childs: IPCAData[];
}[]>;
};
export declare const KEY_NAME: unique symbol;
export declare const injectCommonState: () => ICommmonStateType;