import { IRouteParameter, ValidParameterValue } from './IRouteParameter'; import { IViewParameterList } from './ViewParameterList'; import { Model } from '@singularsystems/neo-core'; export interface IViewParameter { /** * Gets or sets the current parameter value. */ value: ValidParameterValue; /** * Clears the value, replacing the url instead of adding to the history. * This prevents the back button returning the params to the current state. */ reset(): void; /** * Gets or sets the description which corresponds with the value. * Used by the breadcrumb. */ description: string; /** * Sets the description, and an optional list of prefixes. * @param description Description of the current value. * @param prefixes Function that returns prefixes for this breadcrumb item. The previous prefixes are passed into the function. */ setDescription(description: string, getPrefixes?: (currentPrefixes: IViewParameterPrefix[]) => IViewParameterPrefix[]): void; /** * Returns value as a nullable int. */ asNullableInt(): number | null; /** * Returns the value as a string. String will be empty if the underlying value is null. */ asString(): string; /** * Returns the value as a list of string. */ asStringList(): string[]; /** * Allows this view parameter to automatically update when the provided properties value changes. * This is one way, you will still need to set the property value in viewParamsUpdated() */ bindTo(property: Model.IPropertyInstance): void; /** * Allows this view parameter to automatically update when the value returned in the provided callback changes. */ bindTo(callback: () => ValidParameterValue): void; } export declare class ViewParameter implements IViewParameter { private parent; name: string; routeParameter: IRouteParameter; private hasPendingValue; private pendingValue; private _value; prefixes: IViewParameterPrefix[]; constructor(parent: IViewParameterList, name: string, routeParameter: IRouteParameter); bindTo(propertyOrCallback: Model.IPropertyInstance | (() => ValidParameterValue)): void; get value(): ValidParameterValue; set value(value: ValidParameterValue); reset(): void; _description: string; get description(): string; set description(value: string); setDescription(description: string, getPrefixes?: (currentPrefixes: IViewParameterPrefix[]) => IViewParameterPrefix[]): void; asNullableInt(): number | null; asString(): string; asStringList(): string[]; /** Updates the current value, and returns true if the value changed. */ update(value: string | null): boolean; } interface IViewParameterPrefix { /** Label to show on breadcrumb. */ label: string; /** Value to use in the breadcrumb link. Clicking on the link will set the view parameter to this value. */ value?: ValidParameterValue; /** Custom link to use in the breadcrumb. */ link?: string; /** Click event for the breadcrumb. */ onClick?: (e: React.MouseEvent) => void; } export {};