source: trip-planner-front/node_modules/@angular/material/esm2015/datepicker/datepicker-actions.js@ 571e0df

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

initial commit

  • Property mode set to 100644
File size: 8.8 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 { ChangeDetectionStrategy, Component, Directive, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation } from '@angular/core';
9import { TemplatePortal } from '@angular/cdk/portal';
10import { MatDatepickerBase } from './datepicker-base';
11/** Button that will close the datepicker and assign the current selection to the data model. */
12export class MatDatepickerApply {
13 constructor(_datepicker) {
14 this._datepicker = _datepicker;
15 }
16 _applySelection() {
17 this._datepicker._applyPendingSelection();
18 this._datepicker.close();
19 }
20}
21MatDatepickerApply.decorators = [
22 { type: Directive, args: [{
23 selector: '[matDatepickerApply], [matDateRangePickerApply]',
24 host: { '(click)': '_applySelection()' }
25 },] }
26];
27MatDatepickerApply.ctorParameters = () => [
28 { type: MatDatepickerBase }
29];
30/** Button that will close the datepicker and discard the current selection. */
31export class MatDatepickerCancel {
32 constructor(_datepicker) {
33 this._datepicker = _datepicker;
34 }
35}
36MatDatepickerCancel.decorators = [
37 { type: Directive, args: [{
38 selector: '[matDatepickerCancel], [matDateRangePickerCancel]',
39 host: { '(click)': '_datepicker.close()' }
40 },] }
41];
42MatDatepickerCancel.ctorParameters = () => [
43 { type: MatDatepickerBase }
44];
45/**
46 * Container that can be used to project a row of action buttons
47 * to the bottom of a datepicker or date range picker.
48 */
49export class MatDatepickerActions {
50 constructor(_datepicker, _viewContainerRef) {
51 this._datepicker = _datepicker;
52 this._viewContainerRef = _viewContainerRef;
53 }
54 ngAfterViewInit() {
55 this._portal = new TemplatePortal(this._template, this._viewContainerRef);
56 this._datepicker.registerActions(this._portal);
57 }
58 ngOnDestroy() {
59 var _a;
60 this._datepicker.removeActions(this._portal);
61 // Needs to be null checked since we initialize it in `ngAfterViewInit`.
62 if (this._portal && this._portal.isAttached) {
63 (_a = this._portal) === null || _a === void 0 ? void 0 : _a.detach();
64 }
65 }
66}
67MatDatepickerActions.decorators = [
68 { type: Component, args: [{
69 selector: 'mat-datepicker-actions, mat-date-range-picker-actions',
70 template: `
71 <ng-template>
72 <div class="mat-datepicker-actions">
73 <ng-content></ng-content>
74 </div>
75 </ng-template>
76 `,
77 changeDetection: ChangeDetectionStrategy.OnPush,
78 encapsulation: ViewEncapsulation.None,
79 styles: [".mat-datepicker-actions{display:flex;justify-content:flex-end;align-items:center;padding:0 8px 8px 8px}.mat-datepicker-actions .mat-button-base+.mat-button-base{margin-left:8px}[dir=rtl] .mat-datepicker-actions .mat-button-base+.mat-button-base{margin-left:0;margin-right:8px}\n"]
80 },] }
81];
82MatDatepickerActions.ctorParameters = () => [
83 { type: MatDatepickerBase },
84 { type: ViewContainerRef }
85];
86MatDatepickerActions.propDecorators = {
87 _template: [{ type: ViewChild, args: [TemplateRef,] }]
88};
89//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZXBpY2tlci1hY3Rpb25zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2RhdGVwaWNrZXIvZGF0ZXBpY2tlci1hY3Rpb25zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFFTCx1QkFBdUIsRUFDdkIsU0FBUyxFQUNULFNBQVMsRUFFVCxXQUFXLEVBQ1gsU0FBUyxFQUNULGdCQUFnQixFQUNoQixpQkFBaUIsRUFDbEIsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFDLGNBQWMsRUFBQyxNQUFNLHFCQUFxQixDQUFDO0FBQ25ELE9BQU8sRUFBQyxpQkFBaUIsRUFBdUIsTU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