| (function (global, factory) { |
| typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/cdk/portal'), require('@angular/material/core'), require('@angular/material/dialog'), require('@angular/cdk/overlay'), require('@angular/cdk/a11y'), require('@angular/common'), require('@angular/animations'), require('rxjs'), require('rxjs/operators'), require('@angular/cdk/bidi')) : |
| typeof define === 'function' && define.amd ? define('@covalent/core/side-sheet', ['exports', '@angular/core', '@angular/cdk/portal', '@angular/material/core', '@angular/material/dialog', '@angular/cdk/overlay', '@angular/cdk/a11y', '@angular/common', '@angular/animations', 'rxjs', 'rxjs/operators', '@angular/cdk/bidi'], factory) : |
| (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.covalent = global.covalent || {}, global.covalent.core = global.covalent.core || {}, global.covalent.core['side-sheet'] = {}), global.ng.core, global.ng.cdk.portal, global.ng.material.core, global.ng.material.dialog, global.ng.cdk.overlay, global.ng.cdk.a11y, global.ng.common, global.ng.animations, global.rxjs, global.rxjs.operators, global.ng.cdk.bidi)); |
| }(this, (function (exports, core$1, portal, core, dialog, overlay, a11y, common, animations, rxjs, operators, bidi) { 'use strict'; |
| |
| /*! ***************************************************************************** |
| Copyright (c) Microsoft Corporation. |
| |
| Permission to use, copy, modify, and/or distribute this software for any |
| purpose with or without fee is hereby granted. |
| |
| THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
| REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
| AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
| INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
| LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
| OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| PERFORMANCE OF THIS SOFTWARE. |
| ***************************************************************************** */ |
| /* global Reflect, Promise */ |
| var extendStatics = function (d, b) { |
| extendStatics = Object.setPrototypeOf || |
| ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || |
| function (d, b) { for (var p in b) |
| if (Object.prototype.hasOwnProperty.call(b, p)) |
| d[p] = b[p]; }; |
| return extendStatics(d, b); |
| }; |
| function __extends(d, b) { |
| extendStatics(d, b); |
| function __() { this.constructor = d; } |
| d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
| } |
| var __assign = function () { |
| __assign = Object.assign || function __assign(t) { |
| for (var s, i = 1, n = arguments.length; i < n; i++) { |
| s = arguments[i]; |
| for (var p in s) |
| if (Object.prototype.hasOwnProperty.call(s, p)) |
| t[p] = s[p]; |
| } |
| return t; |
| }; |
| return __assign.apply(this, arguments); |
| }; |
| function __rest(s, e) { |
| var t = {}; |
| for (var p in s) |
| if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) |
| t[p] = s[p]; |
| if (s != null && typeof Object.getOwnPropertySymbols === "function") |
| for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { |
| if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) |
| t[p[i]] = s[p[i]]; |
| } |
| return t; |
| } |
| function __decorate(decorators, target, key, desc) { |
| var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; |
| if (typeof Reflect === "object" && typeof Reflect.decorate === "function") |
| r = Reflect.decorate(decorators, target, key, desc); |
| else |
| for (var i = decorators.length - 1; i >= 0; i--) |
| if (d = decorators[i]) |
| r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; |
| return c > 3 && r && Object.defineProperty(target, key, r), r; |
| } |
| function __param(paramIndex, decorator) { |
| return function (target, key) { decorator(target, key, paramIndex); }; |
| } |
| function __metadata(metadataKey, metadataValue) { |
| if (typeof Reflect === "object" && typeof Reflect.metadata === "function") |
| return Reflect.metadata(metadataKey, metadataValue); |
| } |
| function __awaiter(thisArg, _arguments, P, generator) { |
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } |
| return new (P || (P = Promise))(function (resolve, reject) { |
| function fulfilled(value) { try { |
| step(generator.next(value)); |
| } |
| catch (e) { |
| reject(e); |
| } } |
| function rejected(value) { try { |
| step(generator["throw"](value)); |
| } |
| catch (e) { |
| reject(e); |
| } } |
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } |
| step((generator = generator.apply(thisArg, _arguments || [])).next()); |
| }); |
| } |
| function __generator(thisArg, body) { |
| var _ = { label: 0, sent: function () { if (t[0] & 1) |
| throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; |
| return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g; |
| function verb(n) { return function (v) { return step([n, v]); }; } |
| function step(op) { |
| if (f) |
| throw new TypeError("Generator is already executing."); |
| while (_) |
| try { |
| if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) |
| return t; |
| if (y = 0, t) |
| op = [op[0] & 2, t.value]; |
| switch (op[0]) { |
| case 0: |
| case 1: |
| t = op; |
| break; |
| case 4: |
| _.label++; |
| return { value: op[1], done: false }; |
| case 5: |
| _.label++; |
| y = op[1]; |
| op = [0]; |
| continue; |
| case 7: |
| op = _.ops.pop(); |
| _.trys.pop(); |
| continue; |
| default: |
| if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { |
| _ = 0; |
| continue; |
| } |
| if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { |
| _.label = op[1]; |
| break; |
| } |
| if (op[0] === 6 && _.label < t[1]) { |
| _.label = t[1]; |
| t = op; |
| break; |
| } |
| if (t && _.label < t[2]) { |
| _.label = t[2]; |
| _.ops.push(op); |
| break; |
| } |
| if (t[2]) |
| _.ops.pop(); |
| _.trys.pop(); |
| continue; |
| } |
| op = body.call(thisArg, _); |
| } |
| catch (e) { |
| op = [6, e]; |
| y = 0; |
| } |
| finally { |
| f = t = 0; |
| } |
| if (op[0] & 5) |
| throw op[1]; |
| return { value: op[0] ? op[1] : void 0, done: true }; |
| } |
| } |
| var __createBinding = Object.create ? (function (o, m, k, k2) { |
| if (k2 === undefined) |
| k2 = k; |
| Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } }); |
| }) : (function (o, m, k, k2) { |
| if (k2 === undefined) |
| k2 = k; |
| o[k2] = m[k]; |
| }); |
| function __exportStar(m, o) { |
| for (var p in m) |
| if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) |
| __createBinding(o, m, p); |
| } |
| function __values(o) { |
| var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; |
| if (m) |
| return m.call(o); |
| if (o && typeof o.length === "number") |
| return { |
| next: function () { |
| if (o && i >= o.length) |
| o = void 0; |
| return { value: o && o[i++], done: !o }; |
| } |
| }; |
| throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); |
| } |
| function __read(o, n) { |
| var m = typeof Symbol === "function" && o[Symbol.iterator]; |
| if (!m) |
| return o; |
| var i = m.call(o), r, ar = [], e; |
| try { |
| while ((n === void 0 || n-- > 0) && !(r = i.next()).done) |
| ar.push(r.value); |
| } |
| catch (error) { |
| e = { error: error }; |
| } |
| finally { |
| try { |
| if (r && !r.done && (m = i["return"])) |
| m.call(i); |
| } |
| finally { |
| if (e) |
| throw e.error; |
| } |
| } |
| return ar; |
| } |
| function __spread() { |
| for (var ar = [], i = 0; i < arguments.length; i++) |
| ar = ar.concat(__read(arguments[i])); |
| return ar; |
| } |
| function __spreadArrays() { |
| for (var s = 0, i = 0, il = arguments.length; i < il; i++) |
| s += arguments[i].length; |
| for (var r = Array(s), k = 0, i = 0; i < il; i++) |
| for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) |
| r[k] = a[j]; |
| return r; |
| } |
| ; |
| function __await(v) { |
| return this instanceof __await ? (this.v = v, this) : new __await(v); |
| } |
| function __asyncGenerator(thisArg, _arguments, generator) { |
| if (!Symbol.asyncIterator) |
| throw new TypeError("Symbol.asyncIterator is not defined."); |
| var g = generator.apply(thisArg, _arguments || []), i, q = []; |
| return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; |
| function verb(n) { if (g[n]) |
| i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } |
| function resume(n, v) { try { |
| step(g[n](v)); |
| } |
| catch (e) { |
| settle(q[0][3], e); |
| } } |
| function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } |
| function fulfill(value) { resume("next", value); } |
| function reject(value) { resume("throw", value); } |
| function settle(f, v) { if (f(v), q.shift(), q.length) |
| resume(q[0][0], q[0][1]); } |
| } |
| function __asyncDelegator(o) { |
| var i, p; |
| return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; |
| function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } |
| } |
| function __asyncValues(o) { |
| if (!Symbol.asyncIterator) |
| throw new TypeError("Symbol.asyncIterator is not defined."); |
| var m = o[Symbol.asyncIterator], i; |
| return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); |
| function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } |
| function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); } |
| } |
| function __makeTemplateObject(cooked, raw) { |
| if (Object.defineProperty) { |
| Object.defineProperty(cooked, "raw", { value: raw }); |
| } |
| else { |
| cooked.raw = raw; |
| } |
| return cooked; |
| } |
| ; |
| var __setModuleDefault = Object.create ? (function (o, v) { |
| Object.defineProperty(o, "default", { enumerable: true, value: v }); |
| }) : function (o, v) { |
| o["default"] = v; |
| }; |
| function __importStar(mod) { |
| if (mod && mod.__esModule) |
| return mod; |
| var result = {}; |
| if (mod != null) |
| for (var k in mod) |
| if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) |
| __createBinding(result, mod, k); |
| __setModuleDefault(result, mod); |
| return result; |
| } |
| function __importDefault(mod) { |
| return (mod && mod.__esModule) ? mod : { default: mod }; |
| } |
| function __classPrivateFieldGet(receiver, privateMap) { |
| if (!privateMap.has(receiver)) { |
| throw new TypeError("attempted to get private field on non-instance"); |
| } |
| return privateMap.get(receiver); |
| } |
| function __classPrivateFieldSet(receiver, privateMap, value) { |
| if (!privateMap.has(receiver)) { |
| throw new TypeError("attempted to set private field on non-instance"); |
| } |
| privateMap.set(receiver, value); |
| return value; |
| } |
| |
| /** |
| * @fileoverview added by tsickle |
| * Generated from: side-sheet.animation.ts |
| * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc |
| */ |
| /** @type {?} */ |
| var tdSideSheetAnimations = { |
| /** |
| * Animation that is applied on the side-sheet container by default. |
| */ |
| sideSheetContainer: animations.trigger('sideSheetContainer', [ |
| animations.state('void, exit', animations.style({ transform: 'translateX(100%)' })), |
| animations.state('enter', animations.style({ transform: 'translateX(0%)', opacity: 1 })), |
| animations.transition('* => enter', animations.animate(core.AnimationDurations.ENTERING + " " + core.AnimationCurves.ACCELERATION_CURVE, animations.style({ transform: 'translateX(0)', opacity: 1 }))), |
| animations.transition('* => void, * => exit', animations.animate(core.AnimationDurations.EXITING + " " + core.AnimationCurves.ACCELERATION_CURVE, animations.style({ transform: 'translateX(100%)' }))), |
| ]), |
| }; |
| |
| /** |
| * @template D |
| */ |
| var CovalentSideSheetConfig = /** @class */ (function (_super) { |
| __extends(CovalentSideSheetConfig, _super); |
| function CovalentSideSheetConfig() { |
| return _super !== null && _super.apply(this, arguments) || this; |
| } |
| return CovalentSideSheetConfig; |
| }(dialog.MatDialogConfig)); |
| |
| /** |
| * @return {?} |
| */ |
| function _getFocusedElementPierceShadowDom() { |
| /** @type {?} */ |
| var activeElement = typeof document !== 'undefined' && document ? (( /** @type {?} */(document.activeElement))) : null; |
| while (activeElement && activeElement.shadowRoot) { |
| /** @type {?} */ |
| var newActiveElement = ( /** @type {?} */(activeElement.shadowRoot.activeElement)); |
| if (newActiveElement === activeElement) { |
| break; |
| } |
| else { |
| activeElement = newActiveElement; |
| } |
| } |
| return activeElement; |
| } |
| /** |
| * Base class for the `CovalentSideSheetContainer`. The base class does not implement |
| * animations as these are left to implementers of the side-sheet container. |
| * @abstract |
| */ |
| var _CovalentSideSheetContainerBase = /** @class */ (function (_super) { |
| __extends(_CovalentSideSheetContainerBase, _super); |
| /** |
| * @param {?} _elementRef |
| * @param {?} _focusTrapFactory |
| * @param {?} _changeDetectorRef |
| * @param {?} _document |
| * @param {?} _config |
| * @param {?=} _focusMonitor |
| */ |
| function _CovalentSideSheetContainerBase(_elementRef, _focusTrapFactory, _changeDetectorRef, _document, _config, _focusMonitor) { |
| var _this = _super.call(this) || this; |
| _this._elementRef = _elementRef; |
| _this._focusTrapFactory = _focusTrapFactory; |
| _this._changeDetectorRef = _changeDetectorRef; |
| _this._config = _config; |
| _this._focusMonitor = _focusMonitor; |
| /** |
| * Emits when an animation state changes. |
| */ |
| _this._animationStateChanged = new core$1.EventEmitter(); |
| /** |
| * Element that was focused before the side-sheet was opened. Save this to restore upon close. |
| */ |
| _this._elementFocusedBeforeSideSheetWasOpened = null; |
| /** |
| * Type of interaction that led to the side-sheet being closed. This is used to determine |
| * whether the focus style will be applied when returning focus to its original location |
| * after the side-sheet is closed. |
| */ |
| _this._closeInteractionType = null; |
| /** |
| * Attaches a DOM portal to the side-sheet container. |
| * @param portal Portal to be attached. |
| * @deprecated To be turned into a method. |
| */ |
| _this.attachDomPortal = ( /** |
| * @param {?} portal |
| * @return {?} |
| */function (portal) { |
| return _this._portalOutlet.attachDomPortal(portal); |
| }); |
| _this._ariaLabelledBy = _config.ariaLabelledBy || null; |
| _this._document = _document; |
| return _this; |
| } |
| /** |
| * Initializes the side-sheet container with the attached content. |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._initializeWithAttachedContent = function () { |
| this._setupFocusTrap(); |
| // Save the previously focused element. This element will be re-focused |
| // when the side-sheet closes. |
| this._capturePreviouslyFocusedElement(); |
| }; |
| /** |
| * Attach a ComponentPortal as content to this side-sheet container. |
| * @template T |
| * @param {?} portal Portal to be attached as the side-sheet content. |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype.attachComponentPortal = function (portal) { |
| return this._portalOutlet.attachComponentPortal(portal); |
| }; |
| /** |
| * Attach a TemplatePortal as content to this side-sheet container. |
| * @template C |
| * @param {?} portal Portal to be attached as the side-sheet content. |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype.attachTemplatePortal = function (portal) { |
| return this._portalOutlet.attachTemplatePortal(portal); |
| }; |
| /** |
| * Moves focus back into the side-sheet if it was moved out. |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._recaptureFocus = function () { |
| if (!this._containsFocus()) { |
| this._trapFocus(); |
| } |
| }; |
| /** |
| * Moves the focus inside the focus trap. When autoFocus is not set to 'side-sheet', if focus |
| * cannot be moved then focus will go to the side-sheet container. |
| * @protected |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._trapFocus = function () { |
| var _this = this; |
| /** @type {?} */ |
| var element = this._elementRef.nativeElement; |
| if (!this._config.autoFocus) { |
| if (!this._containsFocus()) { |
| element.focus(); |
| } |
| } |
| else { |
| this._focusTrap.focusInitialElementWhenReady().then(( /** |
| * @param {?} focusedSuccessfully |
| * @return {?} |
| */function (focusedSuccessfully) { |
| // If we weren't able to find a focusable element in the side-sheet, then focus the side-sheet |
| // container instead. |
| if (!focusedSuccessfully) { |
| _this._focusSideSheetContainer(); |
| } |
| })); |
| } |
| }; |
| /** |
| * Restores focus to the element that was focused before the side-sheet opened. |
| * @protected |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._restoreFocus = function () { |
| /** @type {?} */ |
| var previousElement = this._elementFocusedBeforeSideSheetWasOpened; |
| // We need the extra check, because IE can set the `activeElement` to null in some cases. |
| if (this._config.restoreFocus && previousElement && typeof previousElement.focus === 'function') { |
| /** @type {?} */ |
| var activeElement = _getFocusedElementPierceShadowDom(); |
| /** @type {?} */ |
| var element = this._elementRef.nativeElement; |
| // Make sure that focus is still inside the side-sheet or is on the body (usually because a |
| // non-focusable element like the backdrop was clicked) before moving it. It's possible that |
| // the consumer moved it themselves before the animation was done, in which case we shouldn't |
| // do anything. |
| if (!activeElement || |
| activeElement === this._document.body || |
| activeElement === element || |
| element.contains(activeElement)) { |
| if (this._focusMonitor) { |
| this._focusMonitor.focusVia(previousElement, this._closeInteractionType); |
| this._closeInteractionType = null; |
| } |
| else { |
| previousElement.focus(); |
| } |
| } |
| } |
| if (this._focusTrap) { |
| this._focusTrap.destroy(); |
| } |
| }; |
| /** |
| * Sets up the focus trap. |
| * @private |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._setupFocusTrap = function () { |
| this._focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement); |
| }; |
| /** |
| * Captures the element that was focused before the side-sheet was opened. |
| * @private |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._capturePreviouslyFocusedElement = function () { |
| if (this._document) { |
| this._elementFocusedBeforeSideSheetWasOpened = _getFocusedElementPierceShadowDom(); |
| } |
| }; |
| /** |
| * Focuses the side-sheet container. |
| * @private |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._focusSideSheetContainer = function () { |
| // Note that there is no focus method when rendering on the server. |
| if (this._elementRef.nativeElement.focus) { |
| this._elementRef.nativeElement.focus(); |
| } |
| }; |
| /** |
| * Returns whether focus is inside the side-sheet. |
| * @private |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._containsFocus = function () { |
| /** @type {?} */ |
| var element = this._elementRef.nativeElement; |
| /** @type {?} */ |
| var activeElement = _getFocusedElementPierceShadowDom(); |
| return element === activeElement || element.contains(activeElement); |
| }; |
| return _CovalentSideSheetContainerBase; |
| }(portal.BasePortalOutlet)); |
| _CovalentSideSheetContainerBase.decorators = [ |
| { type: core$1.Directive } |
| ]; |
| /** @nocollapse */ |
| _CovalentSideSheetContainerBase.ctorParameters = function () { return [ |
| { type: core$1.ElementRef }, |
| { type: a11y.FocusTrapFactory }, |
| { type: core$1.ChangeDetectorRef }, |
| { type: undefined, decorators: [{ type: core$1.Optional }, { type: core$1.Inject, args: [common.DOCUMENT,] }] }, |
| { type: CovalentSideSheetConfig }, |
| { type: a11y.FocusMonitor } |
| ]; }; |
| _CovalentSideSheetContainerBase.propDecorators = { |
| _portalOutlet: [{ type: core$1.ViewChild, args: [portal.CdkPortalOutlet, { static: true },] }] |
| }; |
| if (false) { |
| /** |
| * @type {?} |
| * @protected |
| */ |
| _CovalentSideSheetContainerBase.prototype._document; |
| /** |
| * The portal outlet inside of this container into which the side-sheet content will be loaded. |
| * @type {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._portalOutlet; |
| /** |
| * The class that traps and manages focus within the side-sheet. |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetContainerBase.prototype._focusTrap; |
| /** |
| * Emits when an animation state changes. |
| * @type {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._animationStateChanged; |
| /** |
| * Element that was focused before the side-sheet was opened. Save this to restore upon close. |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetContainerBase.prototype._elementFocusedBeforeSideSheetWasOpened; |
| /** |
| * Type of interaction that led to the side-sheet being closed. This is used to determine |
| * whether the focus style will be applied when returning focus to its original location |
| * after the side-sheet is closed. |
| * @type {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._closeInteractionType; |
| /** |
| * ID of the element that should be considered as the side-sheet's label. |
| * @type {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._ariaLabelledBy; |
| /** |
| * ID for the container DOM element. |
| * @type {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._id; |
| /** |
| * Attaches a DOM portal to the side-sheet container. |
| * \@param portal Portal to be attached. |
| * @deprecated To be turned into a method. |
| * @type {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype.attachDomPortal; |
| /** |
| * @type {?} |
| * @protected |
| */ |
| _CovalentSideSheetContainerBase.prototype._elementRef; |
| /** |
| * @type {?} |
| * @protected |
| */ |
| _CovalentSideSheetContainerBase.prototype._focusTrapFactory; |
| /** |
| * @type {?} |
| * @protected |
| */ |
| _CovalentSideSheetContainerBase.prototype._changeDetectorRef; |
| /** |
| * The side-sheet configuration. |
| * @type {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._config; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetContainerBase.prototype._focusMonitor; |
| /** |
| * Starts the side-sheet exit animation. |
| * @abstract |
| * @return {?} |
| */ |
| _CovalentSideSheetContainerBase.prototype._startExitAnimation = function () { }; |
| } |
| /** |
| * Internal component that wraps the generated side-sheet content. |
| * This animation below is the only reason for duplicating most of the Material dialog code |
| */ |
| var CovalentSideSheetContainer = /** @class */ (function (_super) { |
| __extends(CovalentSideSheetContainer, _super); |
| function CovalentSideSheetContainer() { |
| var _this = _super.apply(this, __spread(arguments)) || this; |
| /** |
| * State of the side-sheet animation. |
| */ |
| _this._state = 'enter'; |
| return _this; |
| } |
| /** |
| * Callback, invoked whenever an animation on the host completes. |
| * @param {?} __0 |
| * @return {?} |
| */ |
| CovalentSideSheetContainer.prototype._onAnimationDone = function (_a) { |
| var toState = _a.toState, totalTime = _a.totalTime; |
| if (toState === 'enter') { |
| this._trapFocus(); |
| this._animationStateChanged.next({ state: 'opened', totalTime: totalTime }); |
| } |
| else if (toState === 'exit') { |
| this._restoreFocus(); |
| this._animationStateChanged.next({ state: 'closed', totalTime: totalTime }); |
| } |
| }; |
| /** |
| * Callback, invoked when an animation on the host starts. |
| * @param {?} __0 |
| * @return {?} |
| */ |
| CovalentSideSheetContainer.prototype._onAnimationStart = function (_a) { |
| var toState = _a.toState, totalTime = _a.totalTime; |
| if (toState === 'enter') { |
| this._animationStateChanged.next({ state: 'opening', totalTime: totalTime }); |
| } |
| else if (toState === 'exit' || toState === 'void') { |
| this._animationStateChanged.next({ state: 'closing', totalTime: totalTime }); |
| } |
| }; |
| /** |
| * Starts the side-sheet exit animation. |
| * @return {?} |
| */ |
| CovalentSideSheetContainer.prototype._startExitAnimation = function () { |
| this._state = 'exit'; |
| this._changeDetectorRef.markForCheck(); |
| }; |
| return CovalentSideSheetContainer; |
| }(_CovalentSideSheetContainerBase)); |
| CovalentSideSheetContainer.decorators = [ |
| { type: core$1.Component, args: [{ |
| selector: 'td-side-sheet-container', |
| template: "\n <ng-template cdkPortalOutlet></ng-template>\n ", |
| encapsulation: core$1.ViewEncapsulation.None, |
| changeDetection: core$1.ChangeDetectionStrategy.Default, |
| animations: [tdSideSheetAnimations.sideSheetContainer], |
| host: { |
| 'class': 'td-side-sheet-container', |
| 'tabindex': '-1', |
| 'aria-modal': 'true', |
| '[id]': '_id', |
| '[attr.role]': '_config.role', |
| '[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledBy', |
| '[attr.aria-label]': '_config.ariaLabel', |
| '[attr.aria-describedby]': '_config.ariaDescribedBy || null', |
| '[@sideSheetContainer]': '_state', |
| '(@sideSheetContainer.start)': '_onAnimationStart($event)', |
| '(@sideSheetContainer.done)': '_onAnimationDone($event)', |
| }, |
| styles: [".td-side-sheet-container{background-color:#fff;box-shadow:0 8px 10px -5px rgba(0,0,0,.2),0 16px 24px 2px rgba(0,0,0,.14),0 6px 30px 5px rgba(0,0,0,.12);box-sizing:border-box;display:block;height:100%;max-height:inherit;min-height:inherit;outline:0;overflow:auto;padding:24px;width:100%}.td-side-sheet-wrapper{-ms-flex-direction:column;display:-ms-flexbox;display:flex;flex-direction:column;height:100%}.td-side-sheet-content{-ms-flex:1;-webkit-overflow-scrolling:touch;flex:1;margin:0 -24px;overflow:auto;padding:0 24px}.td-side-sheet-title{margin:-16px 0 20px}.td-side-sheet-actions,.td-side-sheet-title{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex}.td-side-sheet-actions{-ms-flex-pack:justify;-ms-flex-wrap:wrap;box-sizing:content-box;flex-wrap:wrap;justify-content:space-between;margin:0 -16px -24px;padding:8px 0}.td-side-sheet-actions[align=end]{-ms-flex-pack:end;justify-content:flex-end}.td-side-sheet-actions[align=center]{-ms-flex-pack:center;justify-content:center}.td-side-sheet-actions .mat-button-base+.mat-button-base,.td-side-sheet-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .td-side-sheet-actions .mat-button-base+.mat-button-base,[dir=rtl] .td-side-sheet-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}"] |
| }] } |
| ]; |
| if (false) { |
| /** |
| * State of the side-sheet animation. |
| * @type {?} |
| */ |
| CovalentSideSheetContainer.prototype._state; |
| } |
| |
| // Counter for unique dialog ids. |
| /** @type {?} */ |
| var uniqueId = 0; |
| // Create a new side sheet ref to change the id of the ref |
| /** |
| * @template T, R |
| */ |
| var CovalentSideSheetRef = /** @class */ (function (_super) { |
| __extends(CovalentSideSheetRef, _super); |
| /** |
| * @param {?} overlayRef |
| * @param {?} _containerInstance |
| * @param {?=} id |
| */ |
| function CovalentSideSheetRef(overlayRef, _containerInstance, id) { |
| if (id === void 0) { id = "td-side-sheet-" + uniqueId++; } |
| var _this = _super.call(this, overlayRef, _containerInstance, id) || this; |
| _this.overlayRef = overlayRef; |
| _this._containerInstance = _containerInstance; |
| _this.id = id; |
| return _this; |
| } |
| return CovalentSideSheetRef; |
| }(dialog.MatDialogRef)); |
| if (false) { |
| /** @type {?} */ |
| CovalentSideSheetRef.prototype.overlayRef; |
| /** @type {?} */ |
| CovalentSideSheetRef.prototype._containerInstance; |
| /** @type {?} */ |
| CovalentSideSheetRef.prototype.id; |
| } |
| /** |
| * @template R |
| * @param {?} ref |
| * @param {?} interactionType |
| * @param {?=} result |
| * @return {?} |
| */ |
| function _closeSideSheetVia(ref, interactionType, result) { |
| // Some mock dialog ref instances in tests do not have the `_containerInstance` property. |
| // For those, we keep the behavior as is and do not deal with the interaction type. |
| if (ref._containerInstance !== undefined) { |
| ref._containerInstance._closeInteractionType = interactionType; |
| } |
| return ref.close(result); |
| } |
| |
| /** |
| * @template C |
| */ |
| var _CovalentSideSheetBase = /** @class */ (function () { |
| /** |
| * @param {?} _overlay |
| * @param {?} _injector |
| * @param {?} _defaultOptions |
| * @param {?} _parentSideSheet |
| * @param {?} _sideSheetRefConstructor |
| * @param {?} _sideSheetContainerType |
| * @param {?} _sideSheetDataToken |
| */ |
| function _CovalentSideSheetBase(_overlay, _injector, _defaultOptions, _parentSideSheet, _sideSheetRefConstructor, _sideSheetContainerType, _sideSheetDataToken) { |
| this._overlay = _overlay; |
| this._injector = _injector; |
| this._defaultOptions = _defaultOptions; |
| this._parentSideSheet = _parentSideSheet; |
| this._sideSheetRefConstructor = _sideSheetRefConstructor; |
| this._sideSheetContainerType = _sideSheetContainerType; |
| this._sideSheetDataToken = _sideSheetDataToken; |
| this._openSideSheetsAtThisLevel = []; |
| this._afterAllClosedAtThisLevel = new rxjs.Subject(); |
| this._afterOpenedAtThisLevel = new rxjs.Subject(); |
| this.defaultSidebarConfig = { |
| minWidth: '400px', |
| maxWidth: '100vw', |
| }; |
| } |
| Object.defineProperty(_CovalentSideSheetBase.prototype, "openSideSheets", { |
| /** |
| * Keeps track of the currently-open side-sheets. |
| * @return {?} |
| */ |
| get: function () { |
| return this._parentSideSheet ? this._parentSideSheet.openSideSheets : this._openSideSheetsAtThisLevel; |
| }, |
| enumerable: false, |
| configurable: true |
| }); |
| /** |
| * @template T, D, R |
| * @param {?} componentOrTemplateRef |
| * @param {?=} config |
| * @return {?} |
| */ |
| _CovalentSideSheetBase.prototype.open = function (componentOrTemplateRef, config) { |
| var _this = this; |
| config = Object.assign(Object.assign(Object.assign({}, (this._defaultOptions || new CovalentSideSheetConfig())), this.defaultSidebarConfig), config); |
| /** @type {?} */ |
| var overlayRef = this._createOverlay(config); |
| /** @type {?} */ |
| var sideSheetContainer = this._attachSideSheetContainer(overlayRef, config); |
| /** @type {?} */ |
| var sideSheetRef = this._attachSideSheetContent(componentOrTemplateRef, sideSheetContainer, overlayRef, config); |
| /** @type {?} */ |
| var prevSideSheetRef = this.openSideSheets.slice(-1)[0]; |
| /** @type {?} */ |
| var prevOverlayRef = prevSideSheetRef === null || prevSideSheetRef === void 0 ? void 0 : prevSideSheetRef.overlayRef; |
| // Animate previous side sheet to full width |
| if (prevOverlayRef === null || prevOverlayRef === void 0 ? void 0 : prevOverlayRef.overlayElement) { |
| prevOverlayRef.overlayElement.style.transition = core.AnimationDurations.COMPLEX + " " + core.AnimationCurves.DECELERATION_CURVE; |
| prevOverlayRef.overlayElement.style.minWidth = (( /** @type {?} */(window))).innerWidth + "px"; |
| } |
| // Revert the previous side sheet config & size |
| sideSheetRef._containerInstance._animationStateChanged |
| .pipe(operators.filter(( /** |
| * @param {?} event |
| * @return {?} |
| */function (event) { return event.state === 'closing' && !!(prevSideSheetRef && prevOverlayRef); })), operators.take(1)) |
| .subscribe(( /** |
| * @return {?} |
| */function () { |
| prevOverlayRef.overlayElement.style.transition = core.AnimationDurations.EXITING + " " + core.AnimationCurves.DECELERATION_CURVE; |
| prevSideSheetRef.updateSize(); |
| })); |
| // Add new side sheet to open list |
| this.openSideSheets.push(sideSheetRef); |
| // Remove side sheet ref after closed |
| sideSheetRef |
| .afterClosed() |
| .pipe(operators.take(1)) |
| .subscribe(( /** |
| * @return {?} |
| */function () { return _this._removeOpenSideSheet(sideSheetRef); })); |
| // Notify the side-sheet container that the content has been attached. |
| sideSheetContainer._initializeWithAttachedContent(); |
| return sideSheetRef; |
| }; |
| /** |
| * @return {?} |
| */ |
| _CovalentSideSheetBase.prototype.ngOnDestroy = function () { |
| // Only close the side-sheets at this level on destroy |
| // since the parent service may still be active. |
| this._closeSideSheets(this._openSideSheetsAtThisLevel); |
| this._afterAllClosedAtThisLevel.complete(); |
| this._afterOpenedAtThisLevel.complete(); |
| // Clean up any subscriptions to side-sheet that never finished opening. |
| if (this._animationStateSubscriptions) { |
| this._animationStateSubscriptions.unsubscribe(); |
| } |
| }; |
| /** |
| * Closes all of the currently-open side-sheets. |
| * @return {?} |
| */ |
| _CovalentSideSheetBase.prototype.closeAll = function () { |
| this._closeSideSheets(this.openSideSheets); |
| }; |
| /** |
| * @private |
| * @template T |
| * @param {?} config |
| * @return {?} |
| */ |
| _CovalentSideSheetBase.prototype._createOverlay = function (config) { |
| /** @type {?} */ |
| var overlayConfig = new overlay.OverlayConfig({ |
| positionStrategy: this._overlay.position().global(), |
| scrollStrategy: this._overlay.scrollStrategies.block(), |
| panelClass: config.panelClass, |
| hasBackdrop: config.hasBackdrop, |
| direction: config.direction, |
| minWidth: config.minWidth, |
| minHeight: config.minHeight, |
| maxWidth: config.maxWidth, |
| }); |
| /** @type {?} */ |
| var overlayRef = this._overlay.create(overlayConfig); |
| /** @type {?} */ |
| var positionStrategy = ( /** @type {?} */(overlayRef.getConfig().positionStrategy)); |
| positionStrategy.right('0px'); |
| return overlayRef; |
| }; |
| /** |
| * Attaches a container to a side-sheets's already-created overlay. |
| * @private |
| * @param {?} overlay Reference to the side-sheet's underlying overlay. |
| * @param {?} config The side-sheet configuration. |
| * @return {?} A promise resolving to a ComponentRef for the attached container. |
| */ |
| _CovalentSideSheetBase.prototype._attachSideSheetContainer = function (overlay, config) { |
| /** @type {?} */ |
| var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; |
| /** @type {?} */ |
| var injector = core$1.Injector.create({ |
| parent: userInjector || this._injector, |
| providers: [{ provide: CovalentSideSheetConfig, useValue: config }], |
| }); |
| /** @type {?} */ |
| var containerPortal = new portal.ComponentPortal(this._sideSheetContainerType, config.viewContainerRef, injector, config.componentFactoryResolver); |
| /** @type {?} */ |
| var containerRef = overlay.attach(containerPortal); |
| return containerRef.instance; |
| }; |
| /** |
| * Attaches the user-provided component to the already-created side sheet container. |
| * @private |
| * @template T, R |
| * @param {?} componentOrTemplateRef The type of component being loaded into the side-sheet, |
| * or a TemplateRef to instantiate as the content. |
| * @param {?} sideSheetContainer |
| * @param {?} overlayRef Reference to the overlay in which the side-sheet resides. |
| * @param {?} config The side-sheet configuration. |
| * @return {?} A promise resolving to the CovalentSideSheetRef that should be returned to the user. |
| */ |
| _CovalentSideSheetBase.prototype._attachSideSheetContent = function (componentOrTemplateRef, sideSheetContainer, overlayRef, config) { |
| // Create a reference to the side-sheet we're creating in order to give the user a handle |
| // to modify and close it. |
| /** @type {?} */ |
| var sideSheetRef = new this._sideSheetRefConstructor(overlayRef, sideSheetContainer, config.id); |
| if (componentOrTemplateRef instanceof core$1.TemplateRef) { |
| sideSheetContainer.attachTemplatePortal(new portal.TemplatePortal(componentOrTemplateRef, ( /** @type {?} */(null)), ( /** @type {?} */({ |
| $implicit: config.data, |
| sideSheetRef: sideSheetRef, |
| })))); |
| } |
| else { |
| /** @type {?} */ |
| var injector = this._createInjector(config, sideSheetRef, sideSheetContainer); |
| /** @type {?} */ |
| var contentRef = sideSheetContainer.attach(new portal.ComponentPortal(componentOrTemplateRef, config.viewContainerRef, injector)); |
| sideSheetRef.componentInstance = contentRef.instance; |
| } |
| sideSheetRef.updateSize(config.width, config.height); |
| return sideSheetRef; |
| }; |
| /** |
| * @private |
| * @template T |
| * @param {?} config |
| * @param {?} sideSheetRef |
| * @param {?} sideSheetContainer |
| * @return {?} |
| */ |
| _CovalentSideSheetBase.prototype._createInjector = function (config, sideSheetRef, sideSheetContainer) { |
| /** @type {?} */ |
| var userInjector = config && config.viewContainerRef && config.viewContainerRef.injector; |
| // The side-sheet container should be provided as the side-sheet container and the side-sheet's |
| // content are created out of the same `ViewContainerRef` and as such, are siblings |
| // for injector purposes. To allow the hierarchy that is expected, the side-sheet |
| // container is explicitly provided in the injector. |
| /** @type {?} */ |
| var providers = [ |
| { provide: this._sideSheetContainerType, useValue: sideSheetContainer }, |
| { provide: this._sideSheetDataToken, useValue: config.data }, |
| { provide: this._sideSheetRefConstructor, useValue: sideSheetRef }, |
| ]; |
| if (config.direction && |
| (!userInjector || !userInjector.get(bidi.Directionality, null, core$1.InjectFlags.Optional))) { |
| providers.push({ |
| provide: bidi.Directionality, |
| useValue: { value: config.direction, change: rxjs.of() }, |
| }); |
| } |
| return core$1.Injector.create({ parent: userInjector || this._injector, providers: providers }); |
| }; |
| /** |
| * Removes a side sheet from the array of open side sheets. |
| * @private |
| * @param {?} sideSheetRef Side Sheet to be removed. |
| * @return {?} |
| */ |
| _CovalentSideSheetBase.prototype._removeOpenSideSheet = function (sideSheetRef) { |
| /** @type {?} */ |
| var index = this.openSideSheets.indexOf(sideSheetRef); |
| if (index > -1) { |
| this.openSideSheets.splice(index, 1); |
| } |
| }; |
| /** |
| * Closes all of the side-sheet in an array. |
| * @private |
| * @param {?} sideSheets |
| * @return {?} |
| */ |
| _CovalentSideSheetBase.prototype._closeSideSheets = function (sideSheets) { |
| /** @type {?} */ |
| var i = sideSheets.length; |
| while (i--) { |
| sideSheets[i].close(); |
| } |
| }; |
| return _CovalentSideSheetBase; |
| }()); |
| _CovalentSideSheetBase.decorators = [ |
| { type: core$1.Directive } |
| ]; |
| /** @nocollapse */ |
| _CovalentSideSheetBase.ctorParameters = function () { return [ |
| { type: overlay.Overlay }, |
| { type: core$1.Injector }, |
| { type: undefined }, |
| { type: undefined }, |
| { type: core$1.Type }, |
| { type: core$1.Type }, |
| { type: core$1.InjectionToken } |
| ]; }; |
| if (false) { |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._openSideSheetsAtThisLevel; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._afterAllClosedAtThisLevel; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._afterOpenedAtThisLevel; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._animationStateSubscriptions; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype.defaultSidebarConfig; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._overlay; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._injector; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._defaultOptions; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._parentSideSheet; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._sideSheetRefConstructor; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._sideSheetContainerType; |
| /** |
| * @type {?} |
| * @private |
| */ |
| _CovalentSideSheetBase.prototype._sideSheetDataToken; |
| } |
| /** |
| * Service to open Covalent Design side-sheet. |
| */ |
| var CovalentSideSheet = /** @class */ (function (_super) { |
| __extends(CovalentSideSheet, _super); |
| /** |
| * @param {?} overlay |
| * @param {?} injector |
| * @param {?} defaultOptions |
| * @param {?} parentSideSheet |
| */ |
| function CovalentSideSheet(overlay, injector, defaultOptions, parentSideSheet) { |
| return _super.call(this, overlay, injector, defaultOptions, parentSideSheet, CovalentSideSheetRef, CovalentSideSheetContainer, dialog.MAT_DIALOG_DATA) || this; |
| } |
| return CovalentSideSheet; |
| }(_CovalentSideSheetBase)); |
| CovalentSideSheet.decorators = [ |
| { type: core$1.Injectable } |
| ]; |
| /** @nocollapse */ |
| CovalentSideSheet.ctorParameters = function () { return [ |
| { type: overlay.Overlay }, |
| { type: core$1.Injector }, |
| { type: CovalentSideSheetConfig, decorators: [{ type: core$1.Optional }, { type: core$1.Inject, args: [dialog.MAT_DIALOG_DEFAULT_OPTIONS,] }] }, |
| { type: CovalentSideSheet, decorators: [{ type: core$1.Optional }, { type: core$1.SkipSelf }] } |
| ]; }; |
| |
| /** |
| * @fileoverview added by tsickle |
| * Generated from: side-sheet.content-directives.ts |
| * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc |
| */ |
| /** |
| * Counter used to generate unique IDs for dialog elements. |
| * @type {?} |
| */ |
| var dialogElementUid = 0; |
| /** |
| * Button that will close the current dialog. |
| */ |
| var CovalentSideSheetClose = /** @class */ (function () { |
| /** |
| * @param {?} dialogRef |
| * @param {?} _elementRef |
| * @param {?} _dialog |
| */ |
| function CovalentSideSheetClose(dialogRef, _elementRef, _dialog) { |
| this.dialogRef = dialogRef; |
| this._elementRef = _elementRef; |
| this._dialog = _dialog; |
| /** |
| * Default to "button" to prevents accidental form submits. |
| */ |
| this.type = 'button'; |
| } |
| /** |
| * @return {?} |
| */ |
| CovalentSideSheetClose.prototype.ngOnInit = function () { |
| if (!this.dialogRef) { |
| // When this directive is included in a dialog via TemplateRef (rather than being |
| // in a Component), the DialogRef isn't available via injection because embedded |
| // views cannot be given a custom injector. Instead, we look up the DialogRef by |
| // ID. This must occur in `onInit`, as the ID binding for the dialog container won't |
| // be resolved at constructor time. |
| this.dialogRef = ( /** @type {?} */(getClosestDialog(this._elementRef, this._dialog.openSideSheets))); |
| } |
| }; |
| /** |
| * @param {?} changes |
| * @return {?} |
| */ |
| CovalentSideSheetClose.prototype.ngOnChanges = function (changes) { |
| /** @type {?} */ |
| var proxiedChange = changes['_CovalentSideSheetClose'] || changes['_CovalentSideSheetCloseResult']; |
| if (proxiedChange) { |
| this.dialogResult = proxiedChange.currentValue; |
| } |
| }; |
| /** |
| * @param {?} event |
| * @return {?} |
| */ |
| CovalentSideSheetClose.prototype._onButtonClick = function (event) { |
| // Determinate the focus origin using the click event, because using the FocusMonitor will |
| // result in incorrect origins. Most of the time, close buttons will be auto focused in the |
| // dialog, and therefore clicking the button won't result in a focus change. This means that |
| // the FocusMonitor won't detect any origin change, and will always output `program`. |
| _closeSideSheetVia(this.dialogRef, event.screenX === 0 && event.screenY === 0 ? 'keyboard' : 'mouse', this.dialogResult); |
| }; |
| return CovalentSideSheetClose; |
| }()); |
| CovalentSideSheetClose.decorators = [ |
| { type: core$1.Directive, args: [{ |
| selector: '[td-side-sheet-close], [CovalentSideSheetClose]', |
| exportAs: 'CovalentSideSheetClose', |
| host: { |
| '(click)': '_onButtonClick($event)', |
| '[attr.aria-label]': 'ariaLabel || null', |
| '[attr.type]': 'type', |
| }, |
| },] } |
| ]; |
| /** @nocollapse */ |
| CovalentSideSheetClose.ctorParameters = function () { return [ |
| { type: CovalentSideSheetRef, decorators: [{ type: core$1.Optional }] }, |
| { type: core$1.ElementRef }, |
| { type: CovalentSideSheet } |
| ]; }; |
| CovalentSideSheetClose.propDecorators = { |
| ariaLabel: [{ type: core$1.Input, args: ['aria-label',] }], |
| type: [{ type: core$1.Input }], |
| dialogResult: [{ type: core$1.Input, args: ['td-side-sheet-close',] }], |
| _CovalentSideSheetClose: [{ type: core$1.Input, args: ['CovalentSideSheetClose',] }] |
| }; |
| if (false) { |
| /** |
| * Screenreader label for the button. |
| * @type {?} |
| */ |
| CovalentSideSheetClose.prototype.ariaLabel; |
| /** |
| * Default to "button" to prevents accidental form submits. |
| * @type {?} |
| */ |
| CovalentSideSheetClose.prototype.type; |
| /** |
| * Dialog close input. |
| * @type {?} |
| */ |
| CovalentSideSheetClose.prototype.dialogResult; |
| /** @type {?} */ |
| CovalentSideSheetClose.prototype._CovalentSideSheetClose; |
| /** @type {?} */ |
| CovalentSideSheetClose.prototype.dialogRef; |
| /** |
| * @type {?} |
| * @private |
| */ |
| CovalentSideSheetClose.prototype._elementRef; |
| /** |
| * @type {?} |
| * @private |
| */ |
| CovalentSideSheetClose.prototype._dialog; |
| } |
| /** |
| * Title of a side sheet element. Stays fixed to the top of the side sheet when scrolling. |
| */ |
| var CovalentSideSheetTitle = /** @class */ (function () { |
| /** |
| * @param {?} _dialogRef |
| * @param {?} _elementRef |
| * @param {?} _dialog |
| */ |
| function CovalentSideSheetTitle(_dialogRef, _elementRef, _dialog) { |
| this._dialogRef = _dialogRef; |
| this._elementRef = _elementRef; |
| this._dialog = _dialog; |
| /** |
| * Unique id for the dialog title. If none is supplied, it will be auto-generated. |
| */ |
| this.id = "td-side-sheet-title-" + dialogElementUid++; |
| } |
| /** |
| * @return {?} |
| */ |
| CovalentSideSheetTitle.prototype.ngOnInit = function () { |
| var _this = this; |
| if (this._dialogRef) { |
| Promise.resolve().then(( /** |
| * @return {?} |
| */function () { |
| /** @type {?} */ |
| var container = _this._dialogRef._containerInstance; |
| if (container && !container._ariaLabelledBy) { |
| container._ariaLabelledBy = _this.id; |
| } |
| })); |
| } |
| else { |
| this._dialogRef = ( /** @type {?} */(getClosestDialog(this._elementRef, this._dialog.openSideSheets))); |
| } |
| }; |
| return CovalentSideSheetTitle; |
| }()); |
| CovalentSideSheetTitle.decorators = [ |
| { type: core$1.Directive, args: [{ |
| selector: '[td-side-sheet-title], [CovalentSideSheetTitle]', |
| exportAs: 'CovalentSideSheetTitle', |
| host: { |
| 'class': 'td-side-sheet-title', |
| '[id]': 'id', |
| }, |
| },] } |
| ]; |
| /** @nocollapse */ |
| CovalentSideSheetTitle.ctorParameters = function () { return [ |
| { type: CovalentSideSheetRef, decorators: [{ type: core$1.Optional }] }, |
| { type: core$1.ElementRef }, |
| { type: CovalentSideSheet } |
| ]; }; |
| CovalentSideSheetTitle.propDecorators = { |
| id: [{ type: core$1.Input }] |
| }; |
| if (false) { |
| /** |
| * Unique id for the dialog title. If none is supplied, it will be auto-generated. |
| * @type {?} |
| */ |
| CovalentSideSheetTitle.prototype.id; |
| /** |
| * @type {?} |
| * @private |
| */ |
| CovalentSideSheetTitle.prototype._dialogRef; |
| /** |
| * @type {?} |
| * @private |
| */ |
| CovalentSideSheetTitle.prototype._elementRef; |
| /** |
| * @type {?} |
| * @private |
| */ |
| CovalentSideSheetTitle.prototype._dialog; |
| } |
| /** |
| * Scrollable content container of a dialog. |
| */ |
| var CovalentSideSheetContent = /** @class */ (function () { |
| function CovalentSideSheetContent() { |
| } |
| return CovalentSideSheetContent; |
| }()); |
| CovalentSideSheetContent.decorators = [ |
| { type: core$1.Directive, args: [{ |
| selector: "[td-side-sheet-content], td-side-sheet-content, [CovalentSideSheetContent]", |
| host: { class: 'td-side-sheet-content' }, |
| },] } |
| ]; |
| /** |
| * Container for the bottom action buttons in a dialog. |
| * Stays fixed to the bottom when scrolling. |
| */ |
| var CovalentSideSheetActions = /** @class */ (function () { |
| function CovalentSideSheetActions() { |
| } |
| return CovalentSideSheetActions; |
| }()); |
| CovalentSideSheetActions.decorators = [ |
| { type: core$1.Directive, args: [{ |
| selector: "[td-side-sheet-actions], td-side-sheet-actions, [CovalentSideSheetActions]", |
| host: { class: 'td-side-sheet-actions' }, |
| },] } |
| ]; |
| /** |
| * Container for the wrapper part of the dialog |
| */ |
| var CovalentSideSheetWrapper = /** @class */ (function () { |
| function CovalentSideSheetWrapper() { |
| } |
| return CovalentSideSheetWrapper; |
| }()); |
| CovalentSideSheetWrapper.decorators = [ |
| { type: core$1.Directive, args: [{ |
| selector: "[td-side-sheet-wrapper], td-side-sheet-wrapper, [CovalentSideSheetWrapper]", |
| host: { class: 'td-side-sheet-wrapper' }, |
| },] } |
| ]; |
| /** |
| * Finds the closest CovalentSideSheetRef to an element by looking at the DOM. |
| * @param {?} element Element relative to which to look for a dialog. |
| * @param {?} openDialogs References to the currently-open dialogs. |
| * @return {?} |
| */ |
| function getClosestDialog(element, openDialogs) { |
| /** @type {?} */ |
| var parent = element.nativeElement.parentElement; |
| while (parent && !parent.classList.contains('td-side-sheet-container')) { |
| parent = parent.parentElement; |
| } |
| return parent ? openDialogs.find(( /** |
| * @param {?} dialog |
| * @return {?} |
| */function (dialog) { return dialog.id === ( /** @type {?} */(parent)).id; })) : null; |
| } |
| |
| /** |
| * @fileoverview added by tsickle |
| * Generated from: side-sheet.module.ts |
| * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc |
| */ |
| var CovalentSideSheetModule = /** @class */ (function () { |
| function CovalentSideSheetModule() { |
| } |
| return CovalentSideSheetModule; |
| }()); |
| CovalentSideSheetModule.decorators = [ |
| { type: core$1.NgModule, args: [{ |
| declarations: [ |
| CovalentSideSheetContainer, |
| CovalentSideSheetActions, |
| CovalentSideSheetClose, |
| CovalentSideSheetContent, |
| CovalentSideSheetTitle, |
| CovalentSideSheetWrapper, |
| ], |
| exports: [ |
| CovalentSideSheetActions, |
| CovalentSideSheetClose, |
| CovalentSideSheetContent, |
| CovalentSideSheetTitle, |
| CovalentSideSheetWrapper, |
| ], |
| imports: [portal.PortalModule, dialog.MatDialogModule, core.MatCommonModule], |
| providers: [CovalentSideSheet], |
| },] } |
| ]; |
| |
| /** |
| * @fileoverview added by tsickle |
| * Generated from: public-api.ts |
| * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc |
| */ |
| |
| /** |
| * @fileoverview added by tsickle |
| * Generated from: index.ts |
| * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc |
| */ |
| |
| /** |
| * @fileoverview added by tsickle |
| * Generated from: covalent-core-side-sheet.ts |
| * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc |
| */ |
| |
| exports.CovalentSideSheet = CovalentSideSheet; |
| exports.CovalentSideSheetActions = CovalentSideSheetActions; |
| exports.CovalentSideSheetClose = CovalentSideSheetClose; |
| exports.CovalentSideSheetConfig = CovalentSideSheetConfig; |
| exports.CovalentSideSheetContent = CovalentSideSheetContent; |
| exports.CovalentSideSheetModule = CovalentSideSheetModule; |
| exports.CovalentSideSheetRef = CovalentSideSheetRef; |
| exports.CovalentSideSheetTitle = CovalentSideSheetTitle; |
| exports.CovalentSideSheetWrapper = CovalentSideSheetWrapper; |
| exports._CovalentSideSheetBase = _CovalentSideSheetBase; |
| exports._closeSideSheetVia = _closeSideSheetVia; |
| exports.ɵa = _CovalentSideSheetContainerBase; |
| exports.ɵb = CovalentSideSheetContainer; |
| exports.ɵc = tdSideSheetAnimations; |
| |
| Object.defineProperty(exports, '__esModule', { value: true }); |
| |
| }))); |
| //# sourceMappingURL=covalent-core-side-sheet.umd.js.map |