UNPKG

@metabohub/forum-library

Version:

<!-- Put your badges here: --> [![pipeline status](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/badges/dev/pipeline.svg)](https://forge.inrae.fr/metabohub/forvm/mth-forvm-lib/-/commits/dev) [![coverage report](https://forge.inrae.fr/metabohub/forv

172 lines (171 loc) 9.13 kB
import { Ref } from "vue"; import { SearchEntityType, SelectorType } from '../../core/forum-core/endpoint-search-query'; import { ChebiApi, ChemontApi, PubchemApi, MeshApi } from '../../core/openapi-ts'; import { AxiosRequestConfig } from "axios"; declare enum searchLabelTargetText { CPD_TO_MESH = "MeSH biomedicals concepts", MESH_TO_PUBCHEM_CID = "PubChem CIDs", MESH_TO_CHEBI_ID = "ChEBI IDs", MESH_TO_CHEMONT_ID = "ChemOnt CIDs" } declare enum searchLabelSourceText { PUBCHEM_CID_TO_MESH = "PubChem CID", CHEBI_ID_TO_MESH = "ChEBI ID", CHEMONT_ID_TO_MESH = "ChemOnt ID", MESH_TO_CPD = "MeSH biomedical concept" } declare enum searchQueryNoDataText { DEFAULT = "enter at least 5 letters...", LOADING = "loading...", NO_RESULTS = "sorry, no matched results." } declare class FuzzyItem { private _id; private _name; private _score; id: string; name: string; score: number; constructor(// _id: string, // _name: string, // _score: number); } interface FuzzyItemRaw { item: any; refIndex: number; score: number; } export { FuzzyItem, type FuzzyItemRaw, searchLabelTargetText, searchLabelSourceText, searchQueryNoDataText }; declare const _sfc_main: import("vue").DefineComponent<{}, { queryType: Ref<SearchEntityType, SearchEntityType>; switchShowAdvancedSetting: Ref<boolean, boolean>; searchType: Ref<SelectorType, SelectorType>; searchQueryItem: Ref<FuzzyItem | null, FuzzyItem | null>; labelTarget: Ref<searchLabelTargetText, searchLabelTargetText>; labelSource: Ref<searchLabelSourceText, searchLabelSourceText>; searchQueryItems: Ref<{ id: string; name: string; score: number; }[], FuzzyItem[] | { id: string; name: string; score: number; }[]>; searchQueryLoading: Ref<boolean, boolean>; searchQueryNoData: Ref<searchQueryNoDataText, searchQueryNoDataText>; fuzzyMatchingKeywordMinLength: Ref<number, number>; searchQueryItemText: Ref<string, string>; searchQueryItemTextCache: Ref<string, string>; searchQueryItemsVisible: Ref<boolean, boolean>; pubchemAPI: Ref<{ meshPubchemIdMeshGet: (idMesh: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; pubchemFuzzyQueryGet: (query: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; pubchemMeshIdPubchemGet: (idPubchem: number, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; }, PubchemApi | { meshPubchemIdMeshGet: (idMesh: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; pubchemFuzzyQueryGet: (query: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; pubchemMeshIdPubchemGet: (idPubchem: number, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; }>; chebiApi: Ref<{ chebiFuzzyQueryGet: (query: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; chebiMeshIdChebiGet: (idChebi: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; meshChebiIdMeshGet: (idMesh: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; }, ChebiApi | { chebiFuzzyQueryGet: (query: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; chebiMeshIdChebiGet: (idChebi: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; meshChebiIdMeshGet: (idMesh: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; }>; chemontApi: Ref<{ chemontFuzzyQueryGet: (query: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; chemontMeshIdChemontGet: (idChemont: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; meshChemontIdMeshGet: (idMesh: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; }, ChemontApi | { chemontFuzzyQueryGet: (query: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; chemontMeshIdChemontGet: (idChemont: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; meshChemontIdMeshGet: (idMesh: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; }>; meshApi: Ref<{ meshFuzzyQueryGet: (query: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; }, MeshApi | { meshFuzzyQueryGet: (query: string, options?: AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any, {}>>; }>; abortController: Ref<{ readonly signal: { readonly aborted: boolean; onabort: ((this: AbortSignal, ev: Event) => any) | null; readonly reason: any; throwIfAborted: { (): void; (): void; }; addEventListener: { <K extends "abort">(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void; }; removeEventListener: { <K_1 extends "abort">(type: K_1, listener: (this: AbortSignal, ev: AbortSignalEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void; }; dispatchEvent: (event: Event) => boolean; }; abort: { (reason?: any): void; (reason?: any): void; }; }, AbortController | { readonly signal: { readonly aborted: boolean; onabort: ((this: AbortSignal, ev: Event) => any) | null; readonly reason: any; throwIfAborted: { (): void; (): void; }; addEventListener: { <K extends "abort">(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void; }; removeEventListener: { <K_1 extends "abort">(type: K_1, listener: (this: AbortSignal, ev: AbortSignalEventMap[K_1]) => any, options?: boolean | EventListenerOptions | undefined): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions | undefined): void; }; dispatchEvent: (event: Event) => boolean; }; abort: { (reason?: any): void; (reason?: any): void; }; }>; }, {}, {}, { /** * Method use to reload parameters from the URL hash * (allow users to share results using a copy/pasted URL) */ loadParamFromHash(): void; /** * Launch a query (submit button) * - save the query in URL (as hash parameters) * - build the EndpointSearchQuery object * - emit this object to the parent component */ launchQuery(): void; /** * Launch an example with pres-defined parameters * @param queryType the query type (cpd to mesh / mesh to cpd) * @param searchType the search type (pubchem cid / chebi id / ...) * @param searchQueryName the queried item NAME * @param searchQueryId the queried item Identifier */ launchExample(queryType: string, searchType: string, searchQueryName: string, searchQueryId: string): void; /** * Method called if a change occured in the form */ triggerFormChange(): void; triggerSearchQueryUpdate(newSearchQueryValue: string): void; triggerSearchMenu(isShow: boolean): void; }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "search-query"[], "search-query", import("vue").PublicProps, Readonly<{}> & Readonly<{ "onSearch-query"?: ((...args: any[]) => any) | undefined; }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>; export default _sfc_main;