/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { NoopScrollStrategy } from './scroll/index'; /** Initial configuration used when creating an overlay. */ export class OverlayConfig { constructor(config) { /** Strategy to be used when handling scroll events while the overlay is open. */ this.scrollStrategy = new NoopScrollStrategy(); /** Custom class to add to the overlay pane. */ this.panelClass = ''; /** Whether the overlay has a backdrop. */ this.hasBackdrop = false; /** Custom class to add to the backdrop */ this.backdropClass = 'cdk-overlay-dark-backdrop'; /** * Whether the overlay should be disposed of when the user goes backwards/forwards in history. * Note that this usually doesn't include clicking on links (unless the user is using * the `HashLocationStrategy`). */ this.disposeOnNavigation = false; if (config) { // Use `Iterable` instead of `Array` because TypeScript, as of 3.6.3, // loses the array generic type in the `for of`. But we *also* have to use `Array` because // typescript won't iterate over an `Iterable` unless you compile with `--downlevelIteration` const configKeys = Object.keys(config); for (const key of configKeys) { if (config[key] !== undefined) { // TypeScript, as of version 3.5, sees the left-hand-side of this expression // as "I don't know *which* key this is, so the only valid value is the intersection // of all the posible values." In this case, that happens to be `undefined`. TypeScript // is not smart enough to see that the right-hand-side is actually an access of the same // exact type with the same exact key, meaning that the value type must be identical. // So we use `any` to work around this. this[key] = config[key]; } } } } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3ZlcmxheS1jb25maWcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL292ZXJsYXkvb3ZlcmxheS1jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBSUgsT0FBTyxFQUFpQixrQkFBa0IsRUFBQyxNQUFNLGdCQUFnQixDQUFDO0FBR2xFLDJEQUEyRDtBQUMzRCxNQUFNLE9BQU8sYUFBYTtJQStDeEIsWUFBWSxNQUFzQjtRQTNDbEMsaUZBQWlGO1FBQ2pG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