source: trip-planner-front/node_modules/@angular/cdk/esm2015/bidi/dir.js@ bdd6491

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

initial commit

  • Property mode set to 100644
File size: 6.4 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 { Directive, Output, Input, EventEmitter, } from '@angular/core';
9import { Directionality } from './directionality';
10/**
11 * Directive to listen for changes of direction of part of the DOM.
12 *
13 * Provides itself as Directionality such that descendant directives only need to ever inject
14 * Directionality to get the closest direction.
15 */
16export class Dir {
17 constructor() {
18 /** Normalized direction that accounts for invalid/unsupported values. */
19 this._dir = 'ltr';
20 /** Whether the `value` has been set to its initial value. */
21 this._isInitialized = false;
22 /** Event emitted when the direction changes. */
23 this.change = new EventEmitter();
24 }
25 /** @docs-private */
26 get dir() { return this._dir; }
27 set dir(value) {
28 const old = this._dir;
29 const normalizedValue = value ? value.toLowerCase() : value;
30 this._rawDir = value;
31 this._dir = (normalizedValue === 'ltr' || normalizedValue === 'rtl') ? normalizedValue : 'ltr';
32 if (old !== this._dir && this._isInitialized) {
33 this.change.emit(this._dir);
34 }
35 }
36 /** Current layout direction of the element. */
37 get value() { return this.dir; }
38 /** Initialize once default value has been set. */
39 ngAfterContentInit() {
40 this._isInitialized = true;
41 }
42 ngOnDestroy() {
43 this.change.complete();
44 }
45}
46Dir.decorators = [
47 { type: Directive, args: [{
48 selector: '[dir]',
49 providers: [{ provide: Directionality, useExisting: Dir }],
50 host: { '[attr.dir]': '_rawDir' },
51 exportAs: 'dir',
52 },] }
53];
54Dir.propDecorators = {
55 change: [{ type: Output, args: ['dirChange',] }],
56 dir: [{ type: Input }]
57};
58//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi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