1 | /**
|
2 | * @license
|
3 | * Copyright 2016 Google Inc.
|
4 | *
|
5 | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 | * of this software and associated documentation files (the "Software"), to deal
|
7 | * in the Software without restriction, including without limitation the rights
|
8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 | * copies of the Software, and to permit persons to whom the Software is
|
10 | * furnished to do so, subject to the following conditions:
|
11 | *
|
12 | * The above copyright notice and this permission notice shall be included in
|
13 | * all copies or substantial portions of the Software.
|
14 | *
|
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21 | * THE SOFTWARE.
|
22 | */
|
23 | import { MDCComponent } from '@material/base/component';
|
24 | import { MDCFloatingLabelFactory } from '@material/floating-label/component';
|
25 | import { MDCLineRippleFactory } from '@material/line-ripple/component';
|
26 | import { MDCMenuFactory } from '@material/menu/component';
|
27 | import { MDCNotchedOutlineFactory } from '@material/notched-outline/component';
|
28 | import { MDCSelectFoundation } from './foundation';
|
29 | import { MDCSelectHelperTextFactory } from './helper-text/component';
|
30 | import { MDCSelectIconFactory } from './icon/component';
|
31 | export declare class MDCSelect extends MDCComponent<MDCSelectFoundation> {
|
32 | static attachTo(root: Element): MDCSelect;
|
33 | private ripple;
|
34 | private menu;
|
35 | private selectAnchor;
|
36 | private selectedText;
|
37 | private hiddenInput;
|
38 | private menuElement;
|
39 | private menuItemValues;
|
40 | private leadingIcon?;
|
41 | private helperText;
|
42 | private lineRipple;
|
43 | private label;
|
44 | private outline;
|
45 | private handleFocus;
|
46 | private handleBlur;
|
47 | private handleClick;
|
48 | private handleKeydown;
|
49 | private handleMenuOpened;
|
50 | private handleMenuClosed;
|
51 | private handleMenuClosing;
|
52 | private handleMenuItemAction;
|
53 | initialize(labelFactory?: MDCFloatingLabelFactory, lineRippleFactory?: MDCLineRippleFactory, outlineFactory?: MDCNotchedOutlineFactory, menuFactory?: MDCMenuFactory, iconFactory?: MDCSelectIconFactory, helperTextFactory?: MDCSelectHelperTextFactory): void;
|
54 | /**
|
55 | * Initializes the select's event listeners and internal state based
|
56 | * on the environment's state.
|
57 | */
|
58 | initialSyncWithDOM(): void;
|
59 | destroy(): void;
|
60 | get value(): string;
|
61 | set value(value: string);
|
62 | setValue(value: string, skipNotify?: boolean): void;
|
63 | get selectedIndex(): number;
|
64 | set selectedIndex(selectedIndex: number);
|
65 | setSelectedIndex(selectedIndex: number, skipNotify?: boolean): void;
|
66 | get disabled(): boolean;
|
67 | set disabled(disabled: boolean);
|
68 | set leadingIconAriaLabel(label: string);
|
69 | /**
|
70 | * Sets the text content of the leading icon.
|
71 | */
|
72 | set leadingIconContent(content: string);
|
73 | /**
|
74 | * Sets the text content of the helper text.
|
75 | */
|
76 | set helperTextContent(content: string);
|
77 | /**
|
78 | * Enables or disables the default validation scheme where a required select
|
79 | * must be non-empty. Set to false for custom validation.
|
80 | * @param useDefaultValidation Set this to false to ignore default
|
81 | * validation scheme.
|
82 | */
|
83 | set useDefaultValidation(useDefaultValidation: boolean);
|
84 | /**
|
85 | * Sets the current invalid state of the select.
|
86 | */
|
87 | set valid(isValid: boolean);
|
88 | /**
|
89 | * Checks if the select is in a valid state.
|
90 | */
|
91 | get valid(): boolean;
|
92 | /**
|
93 | * Sets the control to the required state.
|
94 | */
|
95 | set required(isRequired: boolean);
|
96 | /**
|
97 | * Returns whether the select is required.
|
98 | */
|
99 | get required(): boolean;
|
100 | /**
|
101 | * Re-calculates if the notched outline should be notched and if the label
|
102 | * should float.
|
103 | */
|
104 | layout(): void;
|
105 | /**
|
106 | * Synchronizes the list of options with the state of the foundation. Call
|
107 | * this whenever menu options are dynamically updated.
|
108 | */
|
109 | layoutOptions(): void;
|
110 | getDefaultFoundation(): MDCSelectFoundation;
|
111 | /**
|
112 | * Handles setup for the menu.
|
113 | */
|
114 | private menuSetup;
|
115 | private createRipple;
|
116 | private getSelectAdapterMethods;
|
117 | private getCommonAdapterMethods;
|
118 | private getOutlineAdapterMethods;
|
119 | private getLabelAdapterMethods;
|
120 | /**
|
121 | * Calculates where the line ripple should start based on the x coordinate within the component.
|
122 | */
|
123 | private getNormalizedXCoordinate;
|
124 | private isTouchEvent;
|
125 | /**
|
126 | * Returns a map of all subcomponents to subfoundations.
|
127 | */
|
128 | private getFoundationMap;
|
129 | }
|