@nativescript-community/ui-material-bottomsheet 7.0.19 → 7.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"nativescript-community-ui-material-bottomsheet-angular.mjs","sources":["../../../../src/bottomsheet/angular/bottomsheet.service.ts","../../../../src/bottomsheet/angular/bottomsheet.module.ts"],"sourcesContent":["import { ComponentFactoryResolver, ComponentRef, Injectable, Injector, Type, ViewContainerRef } from '@angular/core';\nimport type { BottomSheetOptions as MaterialBottomSheetOptions } from '@nativescript-community/ui-material-bottomsheet';\nimport { AppHostView, DetachedLoader, once } from '@nativescript/angular';\nimport { LayoutBase, ProxyViewContainer, View } from '@nativescript/core';\nimport { Observable, Subject } from 'rxjs';\n\nexport type BaseShowBottomSheetOptions = Omit<MaterialBottomSheetOptions, 'closeCallback' | 'view'>;\n\nexport interface BottomSheetOptions extends BaseShowBottomSheetOptions {\n viewContainerRef?: ViewContainerRef;\n}\n\nexport class BottomSheetParams {\n public constructor(public readonly context: any, public readonly closeCallback: (...args) => void) {}\n}\n\ntype ViewWithDialogRoot = View & { _ngDialogRoot?: View };\n\ninterface SheetRef<TResult = unknown> {\n detachedLoader?: ComponentRef<DetachedLoader>;\n componentView?: View;\n result: Subject<TResult>;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class BottomSheetService {\n public show<TResult = any>(type: Type<any>, options: BottomSheetOptions): Observable<TResult> {\n return this.showWithCloseCallback(type, options).observable;\n }\n\n public showWithCloseCallback<TResult = any>(type: Type<any>, options: BottomSheetOptions): { observable: Observable<TResult>; closeCallback: () => void } {\n if (!options.viewContainerRef) {\n throw new Error('No viewContainerRef: Make sure you pass viewContainerRef in BottomSheetOptions.');\n }\n\n const sheetRef: SheetRef<TResult> = {\n result: new Subject()\n };\n\n const parentView = this.getParentView(options.viewContainerRef);\n const factoryResolver = this.getFactoryResolver(options.viewContainerRef);\n const bottomSheetParams = this.getBottomSheetParams(options.context, sheetRef);\n\n sheetRef.detachedLoader = this.createDetachedLoader(factoryResolver, bottomSheetParams, options.viewContainerRef);\n\n this.loadComponent(type, sheetRef).then((componentView) => {\n parentView.showBottomSheet({\n ...options,\n ...bottomSheetParams,\n view: componentView\n });\n });\n\n return {\n observable: sheetRef.result,\n closeCallback: bottomSheetParams.closeCallback\n };\n }\n\n private getParentView(viewContainerRef: ViewContainerRef): View {\n let parentView = viewContainerRef.element.nativeElement as View;\n\n if (parentView instanceof AppHostView && parentView.ngAppRoot) {\n parentView = parentView.ngAppRoot;\n }\n\n // _ngDialogRoot is the first child of the previously detached proxy.\n // It should have 'viewController' (iOS) or '_dialogFragment' (Android) available for\n // presenting future bottomSheets views.\n if ((parentView as ViewWithDialogRoot)._ngDialogRoot) {\n parentView = (parentView as ViewWithDialogRoot)._ngDialogRoot;\n }\n\n return parentView;\n }\n\n private getFactoryResolver(componentContainer: ViewContainerRef): ComponentFactoryResolver {\n // resolve from particular module (moduleRef)\n // or from same module as parentView (viewContainerRef)\n return componentContainer.injector.get(ComponentFactoryResolver);\n }\n\n private createChildInjector(bottomSheetParams: BottomSheetParams, containerRef: ViewContainerRef): Injector {\n return Injector.create({\n providers: [\n {\n provide: BottomSheetParams,\n useValue: bottomSheetParams\n }\n ],\n parent: containerRef.injector\n });\n }\n\n private getBottomSheetParams(context: any, sheetRef: SheetRef): BottomSheetParams {\n const closeCallback = once((args) => {\n const { result, componentView, detachedLoader } = sheetRef;\n\n result.next(args);\n result.complete();\n\n if (componentView) {\n componentView.closeBottomSheet();\n }\n\n if (detachedLoader) {\n detachedLoader.instance.detectChanges();\n detachedLoader.destroy();\n }\n });\n\n return new BottomSheetParams(context, closeCallback);\n }\n\n private createDetachedLoader(factoryResolver: ComponentFactoryResolver, bottomSheetParams: BottomSheetParams, viewContainerRef: ViewContainerRef): ComponentRef<DetachedLoader> {\n const detachedLoaderFactory = factoryResolver.resolveComponentFactory(DetachedLoader);\n const childInjector = this.createChildInjector(bottomSheetParams, viewContainerRef);\n\n return viewContainerRef.createComponent(detachedLoaderFactory, 0, childInjector);\n }\n\n private async loadComponent(type: Type<any>, sheetRef: SheetRef): Promise<View> {\n try {\n const componentRef = await sheetRef.detachedLoader.instance.loadComponent(type);\n const detachedProxy = componentRef.location.nativeElement as ProxyViewContainer;\n\n if (detachedProxy.getChildrenCount() > 1) {\n throw new Error('BottomSheet content has more than one root view.');\n }\n\n sheetRef.componentView = detachedProxy.getChildAt(0);\n\n if (sheetRef.componentView.parent instanceof LayoutBase) {\n (sheetRef.componentView.parent as ViewWithDialogRoot)._ngDialogRoot = sheetRef.componentView;\n sheetRef.componentView.parent.removeChild(sheetRef.componentView);\n }\n\n return sheetRef.componentView;\n } catch (err) {\n console.error(err);\n\n return null;\n }\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { BottomSheetService } from './bottomsheet.service';\nimport { install } from '@nativescript-community/ui-material-bottomsheet';\n\n@NgModule()\nexport class NativeScriptMaterialBottomSheetModule {\n // This flag help us to avoid problems when using the new development workflow\n private static initialized = false;\n\n static forRoot(): ModuleWithProviders<NativeScriptMaterialBottomSheetModule> {\n return {\n ngModule: NativeScriptMaterialBottomSheetModule,\n providers: [BottomSheetService],\n };\n }\n\n public constructor() {\n if (!NativeScriptMaterialBottomSheetModule.initialized) {\n install();\n NativeScriptMaterialBottomSheetModule.initialized = true;\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;MAYa,iBAAiB;IAC1B,YAAmC,OAAY,EAAkB,aAAgC;QAA9D,YAAO,GAAP,OAAO,CAAK;QAAkB,kBAAa,GAAb,aAAa,CAAmB;KAAI;CACxG;MAaY,kBAAkB;IACpB,IAAI,CAAgB,IAAe,EAAE,OAA2B;QACnE,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,UAAU,CAAC;KAC/D;IAEM,qBAAqB,CAAgB,IAAe,EAAE,OAA2B;QACpF,IAAI,CAAC,OAAO,C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et.service.ts","../../../../src/bottomsheet/angular/bottomsheet.module.ts"],"sourcesContent":["import { ComponentFactoryResolver, ComponentRef, Injectable, Injector, Type, ViewContainerRef } from '@angular/core';\nimport type { BottomSheetOptions as MaterialBottomSheetOptions } from '@nativescript-community/ui-material-bottomsheet';\nimport { AppHostView, DetachedLoader, once } from '@nativescript/angular';\nimport { LayoutBase, ProxyViewContainer, View } from '@nativescript/core';\nimport { Observable, Subject } from 'rxjs';\n\nexport type BaseShowBottomSheetOptions = Omit<MaterialBottomSheetOptions, 'closeCallback' | 'view'>;\n\nexport interface BottomSheetOptions extends BaseShowBottomSheetOptions {\n viewContainerRef?: ViewContainerRef;\n}\n\nexport class BottomSheetParams {\n public constructor(public readonly context: any, public readonly closeCallback: (...args) => void) {}\n}\n\ntype ViewWithDialogRoot = View & { _ngDialogRoot?: View };\n\ninterface SheetRef<TResult = unknown> {\n detachedLoader?: ComponentRef<DetachedLoader>;\n componentView?: View;\n result: Subject<TResult>;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class BottomSheetService {\n public show<TResult = any>(type: Type<any>, options: BottomSheetOptions): Observable<TResult> {\n return this.showWithCloseCallback(type, options).observable;\n }\n\n public showWithCloseCallback<TResult = any>(type: Type<any>, options: BottomSheetOptions): { observable: Observable<TResult>; closeCallback: () => void } {\n if (!options.viewContainerRef) {\n throw new Error('No viewContainerRef: Make sure you pass viewContainerRef in BottomSheetOptions.');\n }\n\n const sheetRef: SheetRef<TResult> = {\n result: new Subject()\n };\n\n const parentView = this.getParentView(options.viewContainerRef);\n const factoryResolver = this.getFactoryResolver(options.viewContainerRef);\n const bottomSheetParams = this.getBottomSheetParams(options.context, sheetRef);\n\n sheetRef.detachedLoader = this.createDetachedLoader(factoryResolver, bottomSheetParams, options.viewContainerRef);\n\n this.loadComponent(type, sheetRef).then((componentView) => {\n parentView.showBottomSheet({\n ...options,\n ...bottomSheetParams,\n view: componentView\n });\n });\n\n return {\n observable: sheetRef.result,\n closeCallback: bottomSheetParams.closeCallback\n };\n }\n\n private getParentView(viewContainerRef: ViewContainerRef): View {\n let parentView = viewContainerRef.element.nativeElement as View;\n\n if (parentView instanceof AppHostView && parentView.ngAppRoot) {\n parentView = parentView.ngAppRoot;\n }\n\n // _ngDialogRoot is the first child of the previously detached proxy.\n // It should have 'viewController' (iOS) or '_dialogFragment' (Android) available for\n // presenting future bottomSheets views.\n if ((parentView as ViewWithDialogRoot)._ngDialogRoot) {\n parentView = (parentView as ViewWithDialogRoot)._ngDialogRoot;\n }\n\n return parentView;\n }\n\n private getFactoryResolver(componentContainer: ViewContainerRef): ComponentFactoryResolver {\n // resolve from particular module (moduleRef)\n // or from same module as parentView (viewContainerRef)\n return componentContainer.injector.get(ComponentFactoryResolver);\n }\n\n private createChildInjector(bottomSheetParams: BottomSheetParams, containerRef: ViewContainerRef): Injector {\n return Injector.create({\n providers: [\n {\n provide: BottomSheetParams,\n useValue: bottomSheetParams\n }\n ],\n parent: containerRef.injector\n });\n }\n\n private getBottomSheetParams(context: any, sheetRef: SheetRef): BottomSheetParams {\n const closeCallback = once((args) => {\n const { result, componentView, detachedLoader } = sheetRef;\n\n result.next(args);\n result.complete();\n\n if (componentView) {\n componentView.closeBottomSheet();\n }\n\n if (detachedLoader) {\n detachedLoader.instance.detectChanges();\n detachedLoader.destroy();\n }\n });\n\n return new BottomSheetParams(context, closeCallback);\n }\n\n private createDetachedLoader(factoryResolver: ComponentFactoryResolver, bottomSheetParams: BottomSheetParams, viewContainerRef: ViewContainerRef): ComponentRef<DetachedLoader> {\n const detachedLoaderFactory = factoryResolver.resolveComponentFactory(DetachedLoader);\n const childInjector = this.createChildInjector(bottomSheetParams, viewContainerRef);\n\n return viewContainerRef.createComponent(detachedLoaderFactory, 0, childInjector);\n }\n\n private async loadComponent(type: Type<any>, sheetRef: SheetRef): Promise<View> {\n try {\n const componentRef = await sheetRef.detachedLoader.instance.loadComponent(type);\n const detachedProxy = componentRef.location.nativeElement as ProxyViewContainer;\n\n if (detachedProxy.getChildrenCount() > 1) {\n throw new Error('BottomSheet content has more than one root view.');\n }\n\n sheetRef.componentView = detachedProxy.getChildAt(0);\n\n if (sheetRef.componentView.parent instanceof LayoutBase) {\n (sheetRef.componentView.parent as ViewWithDialogRoot)._ngDialogRoot = sheetRef.componentView;\n sheetRef.componentView.parent.removeChild(sheetRef.componentView);\n }\n\n return sheetRef.componentView;\n } catch (err) {\n console.error(err);\n\n return null;\n }\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { BottomSheetService } from './bottomsheet.service';\nimport { install } from '@nativescript-community/ui-material-bottomsheet';\n\n@NgModule()\nexport class NativeScriptMaterialBottomSheetModule {\n // This flag help us to avoid problems when using the new development workflow\n private static initialized = false;\n\n static forRoot(): ModuleWithProviders<NativeScriptMaterialBottomSheetModule> {\n return {\n ngModule: NativeScriptMaterialBottomSheetModule,\n providers: [BottomSheetService],\n };\n }\n\n public constructor() {\n if (!NativeScriptMaterialBottomSheetModule.initialized) {\n install();\n NativeScriptMaterialBottomSheetModule.initialized = true;\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;MAYa,iBAAiB,CAAA;IAC1B,WAAmC,CAAA,OAAY,EAAkB,aAAgC,EAAA;AAA9D,QAAA,IAAO,CAAA,OAAA,GAAP,OAAO,CAAK;AAAkB,QAAA,IAAa,CAAA,aAAA,GAAb,aAAa,CAAmB;KAAI;AACxG,CAAA;MAaY,kBAAkB,CAAA;IACpB,IAAI,CAAgB,IAAe,EAAE,OAA2B,EAAA;QACnE,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,UAAU,CAAC;KAC/D;IAEM,qBAAqB,CAAgB,IAAe,EAAE,OAA2B,EAAA;AACpF,QAAA,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;AAC3B,YAAA,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;AACtG,SAAA;AAED,QAAA,MAAM,QAAQ,GAAsB;YAChC,MAAM,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Y,qCAAqC,CAAA;AAW9C,IAAA,WAAA,GAAA;AACI,QAAA,IAAI,CAAC,qCAAqC,CAAC,WAAW,EAAE;AACpD,YAAA,OAAO,EAAE,CAAC;AACV,YAAA,qCAAqC,CAAC,WAAW,GAAG,IAAI,CAAC;AAC5D,SAAA;KACJ;AAZD,IAAA,OAAO,OAAO,GAAA;QACV,OAAO;AACH,YAAA,QAAQ,EAAE,qCAAqC;YAC/C,SAAS,EAAE,CAAC,kBAAkB,CAAC;SAClC,CAAC;KACL;;AAPc,qCAAW,CAAA,WAAA,GAAG,KAAM,CAAA;0HAF1B,qCAAqC,GAAA,CAAA,EAAA,CAAA;yEAArC,qCAAqC,EAAA,CAAA,CAAA;;;4EAArC,qCAAqC,EAAA,CAAA;kBADjD,QAAQ;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"nativescript-community-ui-material-bottomsheet-angular.mjs","sources":["../../../../src/bottomsheet/angular/bottomsheet.service.ts","../../../../src/bottomsheet/angular/bottomsheet.module.ts"],"sourcesContent":["import { ComponentFactoryResolver, ComponentRef, Injectable, Injector, Type, ViewContainerRef } from '@angular/core';\nimport type { BottomSheetOptions as MaterialBottomSheetOptions } from '@nativescript-community/ui-material-bottomsheet';\nimport { AppHostView, DetachedLoader, once } from '@nativescript/angular';\nimport { LayoutBase, ProxyViewContainer, View } from '@nativescript/core';\nimport { Observable, Subject } from 'rxjs';\n\nexport type BaseShowBottomSheetOptions = Omit<MaterialBottomSheetOptions, 'closeCallback' | 'view'>;\n\nexport interface BottomSheetOptions extends BaseShowBottomSheetOptions {\n viewContainerRef?: ViewContainerRef;\n}\n\nexport class BottomSheetParams {\n public constructor(public readonly context: any, public readonly closeCallback: (...args) => void) {}\n}\n\ntype ViewWithDialogRoot = View & { _ngDialogRoot?: View };\n\ninterface SheetRef<TResult = unknown> {\n detachedLoader?: ComponentRef<DetachedLoader>;\n componentView?: View;\n result: Subject<TResult>;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class BottomSheetService {\n public show<TResult = any>(type: Type<any>, options: BottomSheetOptions): Observable<TResult> {\n return this.showWithCloseCallback(type, options).observable;\n }\n\n public showWithCloseCallback<TResult = any>(type: Type<any>, options: BottomSheetOptions): { observable: Observable<TResult>; closeCallback: () => void } {\n if (!options.viewContainerRef) {\n throw new Error('No viewContainerRef: Make sure you pass viewContainerRef in BottomSheetOptions.');\n }\n\n const sheetRef: SheetRef<TResult> = {\n result: new Subject()\n };\n\n const parentView = this.getParentView(options.viewContainerRef);\n const factoryResolver = this.getFactoryResolver(options.viewContainerRef);\n const bottomSheetParams = this.getBottomSheetParams(options.context, sheetRef);\n\n sheetRef.detachedLoader = this.createDetachedLoader(factoryResolver, bottomSheetParams, options.viewContainerRef);\n\n this.loadComponent(type, sheetRef).then((componentView) => {\n parentView.showBottomSheet({\n ...options,\n ...bottomSheetParams,\n view: componentView\n });\n });\n\n return {\n observable: sheetRef.result,\n closeCallback: bottomSheetParams.closeCallback\n };\n }\n\n private getParentView(viewContainerRef: ViewContainerRef): View {\n let parentView = viewContainerRef.element.nativeElement as View;\n\n if (parentView instanceof AppHostView && parentView.ngAppRoot) {\n parentView = parentView.ngAppRoot;\n }\n\n // _ngDialogRoot is the first child of the previously detached proxy.\n // It should have 'viewController' (iOS) or '_dialogFragment' (Android) available for\n // presenting future bottomSheets views.\n if ((parentView as ViewWithDialogRoot)._ngDialogRoot) {\n parentView = (parentView as ViewWithDialogRoot)._ngDialogRoot;\n }\n\n return parentView;\n }\n\n private getFactoryResolver(componentContainer: ViewContainerRef): ComponentFactoryResolver {\n // resolve from particular module (moduleRef)\n // or from same module as parentView (viewContainerRef)\n return componentContainer.injector.get(ComponentFactoryResolver);\n }\n\n private createChildInjector(bottomSheetParams: BottomSheetParams, containerRef: ViewContainerRef): Injector {\n return Injector.create({\n providers: [\n {\n provide: BottomSheetParams,\n useValue: bottomSheetParams\n }\n ],\n parent: containerRef.injector\n });\n }\n\n private getBottomSheetParams(context: any, sheetRef: SheetRef): BottomSheetParams {\n const closeCallback = once((args) => {\n const { result, componentView, detachedLoader } = sheetRef;\n\n result.next(args);\n result.complete();\n\n if (componentView) {\n componentView.closeBottomSheet();\n }\n\n if (detachedLoader) {\n detachedLoader.instance.detectChanges();\n detachedLoader.destroy();\n }\n });\n\n return new BottomSheetParams(context, closeCallback);\n }\n\n private createDetachedLoader(factoryResolver: ComponentFactoryResolver, bottomSheetParams: BottomSheetParams, viewContainerRef: ViewContainerRef): ComponentRef<DetachedLoader> {\n const detachedLoaderFactory = factoryResolver.resolveComponentFactory(DetachedLoader);\n const childInjector = this.createChildInjector(bottomSheetParams, viewContainerRef);\n\n return viewContainerRef.createComponent(detachedLoaderFactory, 0, childInjector);\n }\n\n private async loadComponent(type: Type<any>, sheetRef: SheetRef): Promise<View> {\n try {\n const componentRef = await sheetRef.detachedLoader.instance.loadComponent(type);\n const detachedProxy = componentRef.location.nativeElement as ProxyViewContainer;\n\n if (detachedProxy.getChildrenCount() > 1) {\n throw new Error('BottomSheet content has more than one root view.');\n }\n\n sheetRef.componentView = detachedProxy.getChildAt(0);\n\n if (sheetRef.componentView.parent instanceof LayoutBase) {\n (sheetRef.componentView.parent as ViewWithDialogRoot)._ngDialogRoot = sheetRef.componentView;\n sheetRef.componentView.parent.removeChild(sheetRef.componentView);\n }\n\n return sheetRef.componentView;\n } catch (err) {\n console.error(err);\n\n return null;\n }\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { BottomSheetService } from './bottomsheet.service';\nimport { install } from '@nativescript-community/ui-material-bottomsheet';\n\n@NgModule()\nexport class NativeScriptMaterialBottomSheetModule {\n // This flag help us to avoid problems when using the new development workflow\n private static initialized = false;\n\n static forRoot(): ModuleWithProviders<NativeScriptMaterialBottomSheetModule> {\n return {\n ngModule: NativeScriptMaterialBottomSheetModule,\n providers: [BottomSheetService],\n };\n }\n\n public constructor() {\n if (!NativeScriptMaterialBottomSheetModule.initialized) {\n install();\n NativeScriptMaterialBottomSheetModule.initialized = true;\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pD,OAAO,EAAE,CAAC;YACV,qCAAqC,CAAC,WAAW,GAAG,IAAI,CAAC;SAC5D;KACJ;IAZD,OAAO,OAAO;QACV,OAAO;YACH,QAAQ,EAAE,qCAAqC;YAC/C,SAAS,EAAE,CAAC,kBAAkB,CAAC;SAClC,CAAC;KACL;;AAPc,iDAAW,GAAG,KAAM,CAAA;0HAF1B,qCAAqC;yEAArC,qCAAqC;;uFAArC,qCAAqC;cADjD,QAAQ;;;;;"}
1
+ {"version":3,"file":"nativescript-community-ui-material-bottomsheet-angular.mjs","sources":["../../../../src/bottomsheet/angular/bottomsheet.service.ts","../../../../src/bottomsheet/angular/bottomsheet.module.ts"],"sourcesContent":["import { ComponentFactoryResolver, ComponentRef, Injectable, Injector, Type, ViewContainerRef } from '@angular/core';\nimport type { BottomSheetOptions as MaterialBottomSheetOptions } from '@nativescript-community/ui-material-bottomsheet';\nimport { AppHostView, DetachedLoader, once } from '@nativescript/angular';\nimport { LayoutBase, ProxyViewContainer, View } from '@nativescript/core';\nimport { Observable, Subject } from 'rxjs';\n\nexport type BaseShowBottomSheetOptions = Omit<MaterialBottomSheetOptions, 'closeCallback' | 'view'>;\n\nexport interface BottomSheetOptions extends BaseShowBottomSheetOptions {\n viewContainerRef?: ViewContainerRef;\n}\n\nexport class BottomSheetParams {\n public constructor(public readonly context: any, public readonly closeCallback: (...args) => void) {}\n}\n\ntype ViewWithDialogRoot = View & { _ngDialogRoot?: View };\n\ninterface SheetRef<TResult = unknown> {\n detachedLoader?: ComponentRef<DetachedLoader>;\n componentView?: View;\n result: Subject<TResult>;\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class BottomSheetService {\n public show<TResult = any>(type: Type<any>, options: BottomSheetOptions): Observable<TResult> {\n return this.showWithCloseCallback(type, options).observable;\n }\n\n public showWithCloseCallback<TResult = any>(type: Type<any>, options: BottomSheetOptions): { observable: Observable<TResult>; closeCallback: () => void } {\n if (!options.viewContainerRef) {\n throw new Error('No viewContainerRef: Make sure you pass viewContainerRef in BottomSheetOptions.');\n }\n\n const sheetRef: SheetRef<TResult> = {\n result: new Subject()\n };\n\n const parentView = this.getParentView(options.viewContainerRef);\n const factoryResolver = this.getFactoryResolver(options.viewContainerRef);\n const bottomSheetParams = this.getBottomSheetParams(options.context, sheetRef);\n\n sheetRef.detachedLoader = this.createDetachedLoader(factoryResolver, bottomSheetParams, options.viewContainerRef);\n\n this.loadComponent(type, sheetRef).then((componentView) => {\n parentView.showBottomSheet({\n ...options,\n ...bottomSheetParams,\n view: componentView\n });\n });\n\n return {\n observable: sheetRef.result,\n closeCallback: bottomSheetParams.closeCallback\n };\n }\n\n private getParentView(viewContainerRef: ViewContainerRef): View {\n let parentView = viewContainerRef.element.nativeElement as View;\n\n if (parentView instanceof AppHostView && parentView.ngAppRoot) {\n parentView = parentView.ngAppRoot;\n }\n\n // _ngDialogRoot is the first child of the previously detached proxy.\n // It should have 'viewController' (iOS) or '_dialogFragment' (Android) available for\n // presenting future bottomSheets views.\n if ((parentView as ViewWithDialogRoot)._ngDialogRoot) {\n parentView = (parentView as ViewWithDialogRoot)._ngDialogRoot;\n }\n\n return parentView;\n }\n\n private getFactoryResolver(componentContainer: ViewContainerRef): ComponentFactoryResolver {\n // resolve from particular module (moduleRef)\n // or from same module as parentView (viewContainerRef)\n return componentContainer.injector.get(ComponentFactoryResolver);\n }\n\n private createChildInjector(bottomSheetParams: BottomSheetParams, containerRef: ViewContainerRef): Injector {\n return Injector.create({\n providers: [\n {\n provide: BottomSheetParams,\n useValue: bottomSheetParams\n }\n ],\n parent: containerRef.injector\n });\n }\n\n private getBottomSheetParams(context: any, sheetRef: SheetRef): BottomSheetParams {\n const closeCallback = once((args) => {\n const { result, componentView, detachedLoader } = sheetRef;\n\n result.next(args);\n result.complete();\n\n if (componentView) {\n componentView.closeBottomSheet();\n }\n\n if (detachedLoader) {\n detachedLoader.instance.detectChanges();\n detachedLoader.destroy();\n }\n });\n\n return new BottomSheetParams(context, closeCallback);\n }\n\n private createDetachedLoader(factoryResolver: ComponentFactoryResolver, bottomSheetParams: BottomSheetParams, viewContainerRef: ViewContainerRef): ComponentRef<DetachedLoader> {\n const detachedLoaderFactory = factoryResolver.resolveComponentFactory(DetachedLoader);\n const childInjector = this.createChildInjector(bottomSheetParams, viewContainerRef);\n\n return viewContainerRef.createComponent(detachedLoaderFactory, 0, childInjector);\n }\n\n private async loadComponent(type: Type<any>, sheetRef: SheetRef): Promise<View> {\n try {\n const componentRef = await sheetRef.detachedLoader.instance.loadComponent(type);\n const detachedProxy = componentRef.location.nativeElement as ProxyViewContainer;\n\n if (detachedProxy.getChildrenCount() > 1) {\n throw new Error('BottomSheet content has more than one root view.');\n }\n\n sheetRef.componentView = detachedProxy.getChildAt(0);\n\n if (sheetRef.componentView.parent instanceof LayoutBase) {\n (sheetRef.componentView.parent as ViewWithDialogRoot)._ngDialogRoot = sheetRef.componentView;\n sheetRef.componentView.parent.removeChild(sheetRef.componentView);\n }\n\n return sheetRef.componentView;\n } catch (err) {\n console.error(err);\n\n return null;\n }\n }\n}\n","import { ModuleWithProviders, NgModule } from '@angular/core';\n\nimport { BottomSheetService } from './bottomsheet.service';\nimport { install } from '@nativescript-community/ui-material-bottomsheet';\n\n@NgModule()\nexport class NativeScriptMaterialBottomSheetModule {\n // This flag help us to avoid problems when using the new development workflow\n private static initialized = false;\n\n static forRoot(): ModuleWithProviders<NativeScriptMaterialBottomSheetModule> {\n return {\n ngModule: NativeScriptMaterialBottomSheetModule,\n providers: [BottomSheetService],\n };\n }\n\n public constructor() {\n if (!NativeScriptMaterialBottomSheetModule.initialized) {\n install();\n NativeScriptMaterialBottomSheetModule.initialized = true;\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;MAYa,iBAAiB,CAAA;IAC1B,WAAmC,CAAA,OAAY,EAAkB,aAAgC,EAAA;QAA9D,IAAO,CAAA,OAAA,GAAP,OAAO,CAAK;QAAkB,IAAa,CAAA,aAAA,GAAb,aAAa,CAAmB;KAAI;AACxG,CAAA;MAaY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ACJ;;oFAtHQ,kBAAkB,GAAA,CAAA,EAAA,CAAA;0DAAlB,kBAAkB,EAAA,OAAA,EAAlB,kBAAkB,CAAA,IAAA,EAAA,UAAA,EAFf,MAAM,EAAA,CAAA,CAAA;uFAET,kBAAkB,EAAA,CAAA;cAH9B,UAAU;AAAC,QAAA,IAAA,EAAA,CAAA;AACR,gBAAA,UAAU,EAAE,MAAM;AACrB,aAAA,CAAA;;;MCpBY,qCAAqC,CAAA;AAW9C,IAAA,WAAA,GAAA;AACI,QAAA,IAAI,CAAC,qCAAqC,CAAC,WAAW,EAAE;AACpD,YAAA,OAAO,EAAE,CAAC;AACV,YAAA,qCAAqC,CAAC,WAAW,GAAG,IAAI,CAAC;AAC5D,SAAA;KACJ;AAZD,IAAA,OAAO,OAAO,GAAA;QACV,OAAO;AACH,YAAA,QAAQ,EAAE,qCAAqC;YAC/C,SAAS,EAAE,CAAC,kBAAkB,CAAC;SAClC,CAAC;KACL;;AAPc,qCAAW,CAAA,WAAA,GAAG,KAAM,CAAA;0HAF1B,qCAAqC,GAAA,CAAA,EAAA,CAAA;yEAArC,qCAAqC,EAAA,CAAA,CAAA;;uFAArC,qCAAqC,EAAA,CAAA;cADjD,QAAQ;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-material-bottomsheet",
3
- "version": "7.0.19",
3
+ "version": "7.0.20",
4
4
  "description": "Material Design Bottom Sheets slide up from the bottom of the screen to reveal more content. Bottom sheets integrate with the app to display supporting content or present deep-linked content from other apps.",
5
5
  "main": "./bottomsheet",
6
6
  "sideEffects": false,
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "readmeFilename": "README.md",
48
48
  "dependencies": {
49
- "@nativescript-community/ui-material-core": "^7.0.19"
49
+ "@nativescript-community/ui-material-core": "^7.0.20"
50
50
  },
51
- "gitHead": "240457b7952c4f0258aabc46615de63d1473ead1"
51
+ "gitHead": "36bc72b66526e6408db9d8aa885836033fe61eb1"
52
52
  }
package/pnpm-lock.yaml DELETED
@@ -1,90 +0,0 @@
1
- dependencies:
2
- '@nativescript-community/ui-material-core': 5.2.3
3
- lockfileVersion: 5.2
4
- packages:
5
- /@nativescript-community/ui-material-core/5.2.3:
6
- dependencies:
7
- '@nativescript/hook': 2.0.0
8
- dev: false
9
- requiresBuild: true
10
- resolution:
11
- integrity: sha512-Wy/MFuYhhIV6ec4Nm+Yb5/rly7au2Fo1uU0bGCHiMTk/xPfhpTORTyX42El/5VaDluhqRIG1I75KshBUMhv36A==
12
- /@nativescript/hook/2.0.0:
13
- dependencies:
14
- glob: 7.1.6
15
- mkdirp: 1.0.4
16
- dev: false
17
- resolution:
18
- integrity: sha512-v3Hj3Zpd69sQJfFpDNXonV0EjO1a2OL4l48wlo1Ycsqk4r7RY822d/irFTjt0LllRG0OcdEGgfG6wKb0YgPyHw==
19
- /balanced-match/1.0.0:
20
- dev: false
21
- resolution:
22
- integrity: sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
23
- /brace-expansion/1.1.11:
24
- dependencies:
25
- balanced-match: 1.0.0
26
- concat-map: 0.0.1
27
- dev: false
28
- resolution:
29
- integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
30
- /concat-map/0.0.1:
31
- dev: false
32
- resolution:
33
- integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
34
- /fs.realpath/1.0.0:
35
- dev: false
36
- resolution:
37
- integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
38
- /glob/7.1.6:
39
- dependencies:
40
- fs.realpath: 1.0.0
41
- inflight: 1.0.6
42
- inherits: 2.0.4
43
- minimatch: 3.0.4
44
- once: 1.4.0
45
- path-is-absolute: 1.0.1
46
- dev: false
47
- resolution:
48
- integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
49
- /inflight/1.0.6:
50
- dependencies:
51
- once: 1.4.0
52
- wrappy: 1.0.2
53
- dev: false
54
- resolution:
55
- integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
56
- /inherits/2.0.4:
57
- dev: false
58
- resolution:
59
- integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
60
- /minimatch/3.0.4:
61
- dependencies:
62
- brace-expansion: 1.1.11
63
- dev: false
64
- resolution:
65
- integrity: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
66
- /mkdirp/1.0.4:
67
- dev: false
68
- engines:
69
- node: '>=10'
70
- hasBin: true
71
- resolution:
72
- integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
73
- /once/1.4.0:
74
- dependencies:
75
- wrappy: 1.0.2
76
- dev: false
77
- resolution:
78
- integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
79
- /path-is-absolute/1.0.1:
80
- dev: false
81
- engines:
82
- node: '>=0.10.0'
83
- resolution:
84
- integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
85
- /wrappy/1.0.2:
86
- dev: false
87
- resolution:
88
- integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
89
- specifiers:
90
- '@nativescript-community/ui-material-core': ^5.2.3