import { LitElement } from 'lit'; import { PaginatedSearchOptions } from './mixins'; import { LisCancelPromiseController } from './controllers'; import { LinkoutFunction } from './lis-linkout-element'; /** * The data used to construct the search form in the * {@link LisGeneFunctionSearchElement | `LisGeneFunctionSearchElement`} template. */ export type GeneFunctionSearchFormData = { genuses: { genus: string; species: { species: string; }[]; }[]; }; /** * Optional parameters that may be given to a form data function. The * {@link !AbortSignal | `AbortSignal`} instance will emit if a new function is provided * before the current function completes. This signal should be used to cancel in-flight * requests if the external API supports it. */ export type GeneFunctionSearchFormDataOptions = { abortSignal?: AbortSignal; }; /** * The type signature of a function that may be used to load the data used to construct * the search form in the {@link LisGeneFunctionSearchElement | `LisGeneFunctionSearchElement`} * template. */ export type GeneFunctionFormDataFunction = (options: GeneFunctionSearchFormDataOptions) => Promise; /** * The data that will be passed to the search function by the * {@link LisGeneFunctionSearchElement | `LisGeneFunctionSearchElement`} class when a search * is performed. */ export type GeneFunctionSearchData = { page: number; genus: string; species: string; geneIdentifier: string; traits: string; pubId: string; author: string; }; /** * A publication associated with a gene function search result. */ export type GeneFunctionPublication = { citation: string; doi?: string; title?: string; }; /** * A string value in a search result that may optionally opt out of linkout rendering * or pass a separate identifier to the linkout function. * Plain strings are treated as linkable when the containing column is in * {@link LisGeneFunctionSearchElement.linkoutColumns | `linkoutColumns`}, and `value` * is used as both the displayed text and the linkout identifier. * Use the object form with `linkable: false` to render a value as plain text even * when its column is configured for linkouts. Use `identifier` to display `value` * but pass a different string to the linkout function (e.g. show a symbol but link * by canonical identifier). * * @example * ```js * // display the symbol, but use primaryIdentifier for the linkout; * // synonyms are shown as plain text * geneSymbols: [ * {value: symbol, identifier: primaryIdentifier}, * ...synonyms.map(s => ({value: s, linkable: false})), * ] * ``` */ export type LinkableString = string | { value: string; linkable: false; } | { value: string; identifier: string; }; /** * A single result of a gene function search performed by the * {@link LisGeneFunctionSearchElement | `LisGeneFunctionSearchElement`} class. */ export type GeneFunctionSearchResult = { geneSymbols: LinkableString[]; geneSymbolDescription: string; geneModelPubName: string; geneModelFullName: string; synopsis: string; traits: string[]; citations?: GeneFunctionPublication | GeneFunctionPublication[]; }; /** * Maps result attribute names to linkout type strings. When set alongside * {@link LisGeneFunctionSearchElement.linkoutFunction | `linkoutFunction`}, * cells for the specified columns will be rendered as links that open a * linkout modal. The type string is passed through to the linkout function * as `{type, variables: {identifier}}`. * * @example * ```js * searchElement.linkoutColumns = { * geneSymbols: 'symbol', * geneModelFullName: 'gene', * }; * ``` */ export type GeneFunctionLinkoutColumns = Record; /** * The signature of the function the * {@link LisGeneFunctionSearchElement | `LisGeneFunctionSearchElement`} class requires for * performing a gene function search. * * @param searchData An object containing a value of each field in the submitted form. * @param options Optional parameters that aren't required to perform a gene function search * but may be useful. * * @returns A {@link !Promise | `Promise`} that resolves to an * {@link !Array | `Array`} of {@link GeneFunctionSearchResult | `GeneFunctionSearchResult`} * objects. */ export type GeneFunctionSearchFunction = (searchData: GeneFunctionSearchData, options: PaginatedSearchOptions) => Promise>; declare const LisGeneFunctionSearchElement_base: import("./mixins").Constructor, any[]> & typeof LitElement; /** * @htmlElement `` * * A Web Component that provides a search form for searching gene functions and * displaying the results in a view table. Note that the component saves its state to the URL query * string parameters and a search will be automatically performed if the parameters are present when * the component is loaded. The component uses the * {@link mixins!LisPaginatedSearchMixin | `LisPaginatedSearchMixin`} mixin. See the mixin docs for * further details. * * @queryStringParameters * - **genus:** The selected genus in the search form. * - **species:** The selected species in the search form. * - **geneIdentifier:** The gene ID, symbol, or locus name provided in the search form. * - **traits:** The traits provided in the search form. * - **pubId:** The publication ID provided in the search form. Either a PubMed ID or a DOI. * - **author:** The author provided in the search form. * - **page:** What page of results is loaded. Starts at 1. * * @example * The {@link geneIdentifierExample | `geneIdentifierExample`}, {@link traitsExample | `traitsExample`}, * {@link publicationExample | `publicationExample`}, and {@link authorExample | `authorExample`} * properties can be used to set the example text for the Gene ID, Traits, Publication ID, and Author * input fields, respectively. For example: * ```html * * * * * * * * * ``` */ export declare class LisGeneFunctionSearchElement extends LisGeneFunctionSearchElement_base { /** @ignore */ static styles: import("lit").CSSResult; /** * The data used to construct the search form in the template. * * @attribute */ formData: GeneFunctionSearchFormData; /** * An optional property that can be used to load the form data via an external function. * If used, the `formData` attribute/property will be updated using the result. */ formDataFunction?: GeneFunctionFormDataFunction; /** * An optional property that limits searches to a specific genus. Setting the property to the * empty string "" will cause the genus form field to be set to the default "any" value. * * @attribute */ genus?: string; /** * An optional property that limits searches to a specific species. Setting the property to the * empty string "" will cause the species form field to be set to the default "any" value. Doesn't * work without the `genus` property. * * @attribute */ species?: string; /** * An optional property to set the example text for the Gene ID input field. * * @attribute */ geneIdentifierExample?: string; /** * An optional property to set the example text for the Traits input field. * * @attribute */ traitsExample?: string; /** * An optional property to set the example text for the Publication ID input field. * * @attribute */ publicationExample?: string; /** * An optional property to set the example text for the author input field. * * @attribute */ authorExample?: string; /** * An optional function for performing linkouts. When provided alongside * {@link linkoutColumns | `linkoutColumns`}, cells for the configured columns * will be rendered as links that open a linkout modal. */ linkoutFunction?: LinkoutFunction; /** * Maps result attribute names to linkout type strings passed to * {@link linkoutFunction | `linkoutFunction`}. Has no effect unless * `linkoutFunction` is also set. */ linkoutColumns: GeneFunctionLinkoutColumns; private selectedGenus; private selectedSpecies; protected formDataCancelPromiseController: LisCancelPromiseController; private _modalId; private _linkoutRef; private _formLoadingRef; constructor(); private _getDefaultGenus; private _getDefaultSpecies; connectedCallback(): void; disconnectedCallback(): void; updated(changedProperties: Map): void; private _getFormData; private _initializeSelections; private _selectGenus; private _renderGenusSelector; private _selectSpecies; private _renderSpeciesSelector; private _handleLinkoutClick; private _linkoutAnchor; private _transformResult; /** @ignore */ protected renderResults(): unknown; /** @ignore */ renderForm(): import("lit-html").TemplateResult<1>; } declare global { interface HTMLElementTagNameMap { 'lis-gene-function-search-element': LisGeneFunctionSearchElement; } } export {}; //# sourceMappingURL=lis-gene-function-search-element.d.ts.map