/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/cdk/overlay/scroll/scroll-strategy-options.ts
47 строк
2 KB
Kristiyan Kostadinov
refactor(cdk/overlay): switch to service decorator
25 апр 2026, 23:10
25 апр 2026, 23:10
8f02929
Код
Авторство
О чём код?
/** * @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.dev/license */ import {Service, Injector, inject} from '@angular/core'; import {createBlockScrollStrategy} from './block-scroll-strategy'; import {CloseScrollStrategyConfig, createCloseScrollStrategy} from './close-scroll-strategy'; import {NoopScrollStrategy} from './noop-scroll-strategy'; import { createRepositionScrollStrategy, RepositionScrollStrategyConfig, } from './reposition-scroll-strategy'; /** * Options for how an overlay will handle scrolling. * * Users can provide a custom value for `ScrollStrategyOptions` to replace the default * behaviors. This class primarily acts as a factory for ScrollStrategy instances. */ @Service() export class ScrollStrategyOptions { private _injector = inject(Injector); /** Do nothing on scroll. */ noop = () => new NoopScrollStrategy(); /** * Close the overlay as soon as the user scrolls. * @param config Configuration to be used inside the scroll strategy. */ close = (config?: CloseScrollStrategyConfig) => createCloseScrollStrategy(this._injector, config); /** Block scrolling. */ block = () => createBlockScrollStrategy(this._injector); /** * Update the overlay's position on scroll. * @param config Configuration to be used inside the scroll strategy. * Allows debouncing the reposition calls. */ reposition = (config?: RepositionScrollStrategyConfig) => createRepositionScrollStrategy(this._injector, config); }