@aurelia-mdc-web/select
Version:
Wrapper for Material Components Web Select
99 lines (98 loc) • 3.44 kB
TypeScript
import { MdcComponent, IValidatedElement, IError } from '@aurelia-mdc-web/base';
import { ViewCompiler, ViewResources, TaskQueue } from 'aurelia-framework';
import { MDCMenuItemEvent } from '@material/menu';
import { MdcListItem } from '@aurelia-mdc-web/list';
import { MDCSelectFoundationAurelia } from './mdc-select-foundation-aurelia';
import { MDCMenuDistance } from '@material/menu-surface';
import { MdcDefaultSelectConfiguration } from './mdc-default-select-configuration';
/**
* @selector mdc-select
* @emits mdcselect:change | Emitted if user changed the value
*/
export declare class MdcSelect extends MdcComponent<MDCSelectFoundationAurelia> {
private taskQueue;
private defaultConfiguration;
static processContent(_viewCompiler: ViewCompiler, _resources: ViewResources, element: Element): boolean;
constructor(root: HTMLElement, taskQueue: TaskQueue, defaultConfiguration: MdcDefaultSelectConfiguration);
id: string;
private menu;
private selectAnchor;
private selectedText;
private menuElement?;
items: MdcListItem[];
private leadingIcon?;
private helperText?;
private lineRipple?;
private mdcLabel;
private outline?;
errors: Map<IError, boolean>;
/** Sets the select label */
label: string;
labelChanged(): void;
/** Styles the select as an outlined select */
outlined?: boolean;
outlinedChanged(): void;
/** Makes the value required */
required: boolean;
requiredChanged(): Promise<void>;
/** Enables/disables the select */
disabled: boolean;
disabledChanged(): Promise<void>;
/** Hoists the select DOM to document.body */
hoistToBody: boolean;
/** Sets the select DOM position to fixed */
fixed: boolean;
/** Sets the margin between the select input and the dropdown */
anchorMargin: Partial<MDCMenuDistance>;
/** Sets the select dropdown width to match content */
naturalWidth: boolean;
private _value;
get value(): unknown;
set value(value: unknown);
setValue(value: unknown, skipNotify?: boolean): void;
get valid(): boolean;
set valid(value: boolean);
get selectedIndex(): number;
set selectedIndex(selectedIndex: number);
addError(error: IError): void;
removeError(error: IError): void;
renderErrors(): void;
initialise(): Promise<void>;
initialSyncWithDOM(): void;
getDefaultFoundation(): MDCSelectFoundationAurelia;
private getSelectAdapterMethods;
private getCommonAdapterMethods;
private getOutlineAdapterMethods;
private getLabelAdapterMethods;
handleChange(): void;
handleFocus(): void;
handleBlur(): void;
handleClick(evt: MouseEvent): void;
handleKeydown(evt: KeyboardEvent): boolean;
handleMenuItemAction(evt: MDCMenuItemEvent): void;
handleMenuOpened(): void;
handleMenuClosed(): void;
handleItemsChanged(): void;
focus(): void;
blur(): void;
/**
* @hidden
* Calculates where the line ripple should start based on the x coordinate within the component.
*/
private getNormalizedXCoordinate;
private isTouchEvent;
/**
* @hidden
* Returns a map of all subcomponents to subfoundations.
*/
private getFoundationMap;
}
/** @hidden */
export interface IMdcSelectElement extends IValidatedElement {
au: {
controller: {
viewModel: MdcSelect;
};
};
value: unknown;
}