license import { DOCUMENT } from '@angular/common' ; import { Inject , Injectable , Optional , NgZone } from '@angular/core' ; import { InteractivityChecker } from '../interactivity-checker/interactivity-checker' ; import { ConfigurableFocusTrap } from './configurable-focus-trap' ; import { ConfigurableFocusTrapConfig } from './configurable-focus-trap-config' ; import { FOCUS_TRAP_INERT_STRATEGY , FocusTrapInertStrategy } from './focus-trap-inert-strategy' ; import { EventListenerFocusTrapInertStrategy } from './event-listener-inert-strategy' ; import { FocusTrapManager } from './focus-trap-manager' ; /** Factory that allows easy instantiation of configurable focus traps. */ @ Injectable ( { providedIn : 'root' } ) export class ConfigurableFocusTrapFactory { private _document : Document ; private _inertStrategy : FocusTrapInertStrategy ; constructor ( private _checker , private _ngZone , private _focusTrapManager , @ Inject ( DOCUMENT ) _document , @ Optional ( ) @ Inject ( FOCUS_TRAP_INERT_STRATEGY ) _inertStrategy ? ) { this . _document = _document ; this . _inertStrategy = _inertStrategy || new EventListenerFocusTrapInertStrategy ( ) ; } param element param config returns create ( element , config ? ) ; deprecated breaking-change create ( element , deferCaptureElements ) ; create ( element , config = { defer : false } ) { let configObject ; if ( typeof config === 'boolean' ) { configObject = { defer : config } ; } else { configObject = config ; } return new ConfigurableFocusTrap ( element , this . _checker , this . _ngZone , this . _document , this . _focusTrapManager , this . _inertStrategy , configObject ) ; } }