source: trip-planner-front/node_modules/@angular/material/esm2015/core/option/option.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 34.2 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { coerceBooleanProperty } from '@angular/cdk/coercion';
9import { ENTER, SPACE, hasModifierKey } from '@angular/cdk/keycodes';
10import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, Inject, Input, Optional, Output, ViewEncapsulation, Directive, } from '@angular/core';
11import { Subject } from 'rxjs';
12import { MatOptgroup, _MatOptgroupBase, MAT_OPTGROUP } from './optgroup';
13import { MAT_OPTION_PARENT_COMPONENT } from './option-parent';
14/**
15 * Option IDs need to be unique across components, so this counter exists outside of
16 * the component definition.
17 */
18let _uniqueIdCounter = 0;
19/** Event object emitted by MatOption when selected or deselected. */
20export class MatOptionSelectionChange {
21 constructor(
22 /** Reference to the option that emitted the event. */
23 source,
24 /** Whether the change in the option's value was a result of a user action. */
25 isUserInput = false) {
26 this.source = source;
27 this.isUserInput = isUserInput;
28 }
29}
30export class _MatOptionBase {
31 constructor(_element, _changeDetectorRef, _parent, group) {
32 this._element = _element;
33 this._changeDetectorRef = _changeDetectorRef;
34 this._parent = _parent;
35 this.group = group;
36 this._selected = false;
37 this._active = false;
38 this._disabled = false;
39 this._mostRecentViewValue = '';
40 /** The unique ID of the option. */
41 this.id = `mat-option-${_uniqueIdCounter++}`;
42 /** Event emitted when the option is selected or deselected. */
43 // tslint:disable-next-line:no-output-on-prefix
44 this.onSelectionChange = new EventEmitter();
45 /** Emits when the state of the option changes and any parents have to be notified. */
46 this._stateChanges = new Subject();
47 }
48 /** Whether the wrapping component is in multiple selection mode. */
49 get multiple() { return this._parent && this._parent.multiple; }
50 /** Whether or not the option is currently selected. */
51 get selected() { return this._selected; }
52 /** Whether the option is disabled. */
53 get disabled() { return (this.group && this.group.disabled) || this._disabled; }
54 set disabled(value) { this._disabled = coerceBooleanProperty(value); }
55 /** Whether ripples for the option are disabled. */
56 get disableRipple() { return this._parent && this._parent.disableRipple; }
57 /**
58 * Whether or not the option is currently active and ready to be selected.
59 * An active option displays styles as if it is focused, but the
60 * focus is actually retained somewhere else. This comes in handy
61 * for components like autocomplete where focus must remain on the input.
62 */
63 get active() {
64 return this._active;
65 }
66 /**
67 * The displayed value of the option. It is necessary to show the selected option in the
68 * select's trigger.
69 */
70 get viewValue() {
71 // TODO(kara): Add input property alternative for node envs.
72 return (this._getHostElement().textContent || '').trim();
73 }
74 /** Selects the option. */
75 select() {
76 if (!this._selected) {
77 this._selected = true;
78 this._changeDetectorRef.markForCheck();
79 this._emitSelectionChangeEvent();
80 }
81 }
82 /** Deselects the option. */
83 deselect() {
84 if (this._selected) {
85 this._selected = false;
86 this._changeDetectorRef.markForCheck();
87 this._emitSelectionChangeEvent();
88 }
89 }
90 /** Sets focus onto this option. */
91 focus(_origin, options) {
92 // Note that we aren't using `_origin`, but we need to keep it because some internal consumers
93 // use `MatOption` in a `FocusKeyManager` and we need it to match `FocusableOption`.
94 const element = this._getHostElement();
95 if (typeof element.focus === 'function') {
96 element.focus(options);
97 }
98 }
99 /**
100 * This method sets display styles on the option to make it appear
101 * active. This is used by the ActiveDescendantKeyManager so key
102 * events will display the proper options as active on arrow key events.
103 */
104 setActiveStyles() {
105 if (!this._active) {
106 this._active = true;
107 this._changeDetectorRef.markForCheck();
108 }
109 }
110 /**
111 * This method removes display styles on the option that made it appear
112 * active. This is used by the ActiveDescendantKeyManager so key
113 * events will display the proper options as active on arrow key events.
114 */
115 setInactiveStyles() {
116 if (this._active) {
117 this._active = false;
118 this._changeDetectorRef.markForCheck();
119 }
120 }
121 /** Gets the label to be used when determining whether the option should be focused. */
122 getLabel() {
123 return this.viewValue;
124 }
125 /** Ensures the option is selected when activated from the keyboard. */
126 _handleKeydown(event) {
127 if ((event.keyCode === ENTER || event.keyCode === SPACE) && !hasModifierKey(event)) {
128 this._selectViaInteraction();
129 // Prevent the page from scrolling down and form submits.
130 event.preventDefault();
131 }
132 }
133 /**
134 * `Selects the option while indicating the selection came from the user. Used to
135 * determine if the select's view -> model callback should be invoked.`
136 */
137 _selectViaInteraction() {
138 if (!this.disabled) {
139 this._selected = this.multiple ? !this._selected : true;
140 this._changeDetectorRef.markForCheck();
141 this._emitSelectionChangeEvent(true);
142 }
143 }
144 /**
145 * Gets the `aria-selected` value for the option. We explicitly omit the `aria-selected`
146 * attribute from single-selection, unselected options. Including the `aria-selected="false"`
147 * attributes adds a significant amount of noise to screen-reader users without providing useful
148 * information.
149 */
150 _getAriaSelected() {
151 return this.selected || (this.multiple ? false : null);
152 }
153 /** Returns the correct tabindex for the option depending on disabled state. */
154 _getTabIndex() {
155 return this.disabled ? '-1' : '0';
156 }
157 /** Gets the host DOM element. */
158 _getHostElement() {
159 return this._element.nativeElement;
160 }
161 ngAfterViewChecked() {
162 // Since parent components could be using the option's label to display the selected values
163 // (e.g. `mat-select`) and they don't have a way of knowing if the option's label has changed
164 // we have to check for changes in the DOM ourselves and dispatch an event. These checks are
165 // relatively cheap, however we still limit them only to selected options in order to avoid
166 // hitting the DOM too often.
167 if (this._selected) {
168 const viewValue = this.viewValue;
169 if (viewValue !== this._mostRecentViewValue) {
170 this._mostRecentViewValue = viewValue;
171 this._stateChanges.next();
172 }
173 }
174 }
175 ngOnDestroy() {
176 this._stateChanges.complete();
177 }
178 /** Emits the selection change event. */
179 _emitSelectionChangeEvent(isUserInput = false) {
180 this.onSelectionChange.emit(new MatOptionSelectionChange(this, isUserInput));
181 }
182}
183_MatOptionBase.decorators = [
184 { type: Directive }
185];
186_MatOptionBase.ctorParameters = () => [
187 { type: ElementRef },
188 { type: ChangeDetectorRef },
189 { type: undefined },
190 { type: _MatOptgroupBase }
191];
192_MatOptionBase.propDecorators = {
193 value: [{ type: Input }],
194 id: [{ type: Input }],
195 disabled: [{ type: Input }],
196 onSelectionChange: [{ type: Output }]
197};
198/**
199 * Single option inside of a `<mat-select>` element.
200 */
201export class MatOption extends _MatOptionBase {
202 constructor(element, changeDetectorRef, parent, group) {
203 super(element, changeDetectorRef, parent, group);
204 }
205}
206MatOption.decorators = [
207 { type: Component, args: [{
208 selector: 'mat-option',
209 exportAs: 'matOption',
210 host: {
211 'role': 'option',
212 '[attr.tabindex]': '_getTabIndex()',
213 '[class.mat-selected]': 'selected',
214 '[class.mat-option-multiple]': 'multiple',
215 '[class.mat-active]': 'active',
216 '[id]': 'id',
217 '[attr.aria-selected]': '_getAriaSelected()',
218 '[attr.aria-disabled]': 'disabled.toString()',
219 '[class.mat-option-disabled]': 'disabled',
220 '(click)': '_selectViaInteraction()',
221 '(keydown)': '_handleKeydown($event)',
222 'class': 'mat-option mat-focus-indicator',
223 },
224 template: "<mat-pseudo-checkbox *ngIf=\"multiple\" class=\"mat-option-pseudo-checkbox\"\n [state]=\"selected ? 'checked' : 'unchecked'\" [disabled]=\"disabled\"></mat-pseudo-checkbox>\n\n<span class=\"mat-option-text\"><ng-content></ng-content></span>\n\n<!-- See a11y notes inside optgroup.ts for context behind this element. -->\n<span class=\"cdk-visually-hidden\" *ngIf=\"group && group._inert\">({{ group.label }})</span>\n\n<div class=\"mat-option-ripple\" mat-ripple\n [matRippleTrigger]=\"_getHostElement()\"\n [matRippleDisabled]=\"disabled || disableRipple\">\n</div>\n",
225 encapsulation: ViewEncapsulation.None,
226 changeDetection: ChangeDetectionStrategy.OnPush,
227 styles: [".mat-option{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;line-height:48px;height:48px;padding:0 16px;text-align:left;text-decoration:none;max-width:100%;position:relative;cursor:pointer;outline:none;display:flex;flex-direction:row;max-width:100%;box-sizing:border-box;align-items:center;-webkit-tap-highlight-color:transparent}.mat-option[disabled]{cursor:default}[dir=rtl] .mat-option{text-align:right}.mat-option .mat-icon{margin-right:16px;vertical-align:middle}.mat-option .mat-icon svg{vertical-align:top}[dir=rtl] .mat-option .mat-icon{margin-left:16px;margin-right:0}.mat-option[aria-disabled=true]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.mat-optgroup .mat-option:not(.mat-option-multiple){padding-left:32px}[dir=rtl] .mat-optgroup .mat-option:not(.mat-option-multiple){padding-left:16px;padding-right:32px}.cdk-high-contrast-active .mat-option{margin:0 1px}.cdk-high-contrast-active .mat-option.mat-active{border:solid 1px currentColor;margin:0}.cdk-high-contrast-active .mat-option[aria-disabled=true]{opacity:.5}.mat-option-text{display:inline-block;flex-grow:1;overflow:hidden;text-overflow:ellipsis}.mat-option .mat-option-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-option-pseudo-checkbox{margin-right:8px}[dir=rtl] .mat-option-pseudo-checkbox{margin-left:8px;margin-right:0}\n"]
228 },] }
229];
230MatOption.ctorParameters = () => [
231 { type: ElementRef },
232 { type: ChangeDetectorRef },
233 { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_OPTION_PARENT_COMPONENT,] }] },
234 { type: MatOptgroup, decorators: [{ type: Optional }, { type: Inject, args: [MAT_OPTGROUP,] }] }
235];
236/**
237 * Counts the amount of option group labels that precede the specified option.
238 * @param optionIndex Index of the option at which to start counting.
239 * @param options Flat list of all of the options.
240 * @param optionGroups Flat list of all of the option groups.
241 * @docs-private
242 */
243export function _countGroupLabelsBeforeOption(optionIndex, options, optionGroups) {
244 if (optionGroups.length) {
245 let optionsArray = options.toArray();
246 let groups = optionGroups.toArray();
247 let groupCounter = 0;
248 for (let i = 0; i < optionIndex + 1; i++) {
249 if (optionsArray[i].group && optionsArray[i].group === groups[groupCounter]) {
250 groupCounter++;
251 }
252 }
253 return groupCounter;
254 }
255 return 0;
256}
257/**
258 * Determines the position to which to scroll a panel in order for an option to be into view.
259 * @param optionOffset Offset of the option from the top of the panel.
260 * @param optionHeight Height of the options.
261 * @param currentScrollPosition Current scroll position of the panel.
262 * @param panelHeight Height of the panel.
263 * @docs-private
264 */
265export function _getOptionScrollPosition(optionOffset, optionHeight, currentScrollPosition, panelHeight) {
266 if (optionOffset < currentScrollPosition) {
267 return optionOffset;
268 }
269 if (optionOffset + optionHeight > currentScrollPosition + panelHeight) {
270 return Math.max(0, optionOffset - panelHeight + optionHeight);
271 }
272 return currentScrollPosition;
273}
274//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3B0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2NvcmUvb3B0aW9uL29wdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQWUscUJBQXFCLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQztBQUMxRSxPQUFPLEVBQUMsS0FBSyxFQUFFLEtBQUssRUFBRSxjQUFjLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQztBQUNuRSxPQUFPLEVBRUwsdUJBQXVCLEVBQ3ZCLGlCQUFpQixFQUNqQixTQUFTLEVBQ1QsVUFBVSxFQUNWLFlBQVksRUFDWixNQUFNLEVBQ04sS0FBSyxFQUVMLFFBQVEsRUFDUixNQUFNLEVBRU4saUJBQWlCLEVBQ2pCLFNBQVMsR0FDVixNQUFNLGVBQWUsQ0FBQztBQUV2QixPQUFPLEVBQUMsT0FBTyxFQUFDLE1BQU0sTUFBTSxDQUFDO0FBQzdCLE9BQU8sRUFBQyxXQUFXLEVBQUUsZ0JBQWdCLEVBQUUsWUFBWSxFQUFDLE1BQU0sWUFBWSxDQUFDO0FBQ3ZFLE9BQU8sRUFBMkIsMkJBQTJCLEVBQUMsTUFBTSxpQkFBaUIsQ0FBQztBQUV0Rjs7O0dBR0c7QUFDSCxJQUFJLGdCQUFnQixHQUFHLENBQUMsQ0FBQztBQUV6QixxRUFBcUU7QUFDckUsT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