@nativescript-community/ui-persistent-bottomsheet
Version:
NativeScript plugin that allows you to easily add a persistent bottomsheet to your projects.
165 lines (161 loc) • 6.46 kB
JavaScript
import * as i0 from '@angular/core';
import { ElementRef, ViewContainerRef, Component, Inject, Input, Directive, NgModule } from '@angular/core';
import { registerElement } from '@nativescript/angular';
import { PersistentBottomSheet } from '@nativescript-community/ui-persistent-bottomsheet';
const _c0 = ["*"];
const BOTTOMSHEET = 'bottomSheet';
/**
* This is the SideDrawer component. It separates your mobile app's screen
* into a main part and a menu part whereby the menu part is shown upon a swipe
* gesture using a transition effect.
*/
class BottomSheetComponent {
elementRef;
viewContainer;
pbs;
bottomSheetTemplate;
_gestureEnabled;
_stepIndex;
constructor(elementRef, viewContainer) {
this.elementRef = elementRef;
this.viewContainer = viewContainer;
this.pbs = this.elementRef.nativeElement;
}
get nativeElement() {
return this.pbs;
}
get gestureEnabled() {
return this._gestureEnabled;
}
set gestureEnabled(value) {
this._gestureEnabled = value;
this.pbs.gestureEnabled = this._gestureEnabled;
}
get stepIndex() {
return this._stepIndex;
}
set stepIndex(value) {
if (!isNaN(value)) {
this._stepIndex = value;
this.pbs.stepIndex = this._stepIndex;
}
}
get backdropColor() {
return this.pbs.backdropColor;
}
set backdropColor(value) {
this.pbs.backdropColor = value;
}
get scrollViewId() {
return this.pbs.scrollViewId;
}
set scrollViewId(value) {
this.pbs.scrollViewId = value;
}
get panGestureOptions() {
return this.pbs.panGestureOptions;
}
set panGestureOptions(value) {
this.pbs.panGestureOptions = value;
}
static ɵfac = function BottomSheetComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BottomSheetComponent)(i0.ɵɵdirectiveInject(ElementRef), i0.ɵɵdirectiveInject(ViewContainerRef)); };
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: BottomSheetComponent, selectors: [["BottomSheet"]], inputs: { gestureEnabled: "gestureEnabled", stepIndex: "stepIndex", backdropColor: "backdropColor", scrollViewId: "scrollViewId", panGestureOptions: "panGestureOptions" }, standalone: false, ngContentSelectors: _c0, decls: 1, vars: 0, template: function BottomSheetComponent_Template(rf, ctx) { if (rf & 1) {
i0.ɵɵprojectionDef();
i0.ɵɵprojection(0);
} }, encapsulation: 2 });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BottomSheetComponent, [{
type: Component,
args: [{
selector: 'BottomSheet',
template: '<ng-content></ng-content>',
standalone: false
}]
}], () => [{ type: i0.ElementRef, decorators: [{
type: Inject,
args: [ElementRef]
}] }, { type: i0.ViewContainerRef, decorators: [{
type: Inject,
args: [ViewContainerRef]
}] }], { gestureEnabled: [{
type: Input
}], stepIndex: [{
type: Input
}], backdropColor: [{
type: Input
}], scrollViewId: [{
type: Input
}], panGestureOptions: [{
type: Input
}] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(BottomSheetComponent, { className: "BottomSheetComponent", filePath: "module.ts", lineNumber: 23 }); })();
/**
* Directive identifying the left drawer
*/
class BottomSheetDirective {
_elementRef;
constructor(_elementRef) {
this._elementRef = _elementRef;
this._elementRef.nativeElement.id = BOTTOMSHEET;
}
static ɵfac = function BottomSheetDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BottomSheetDirective)(i0.ɵɵdirectiveInject(ElementRef)); };
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: BottomSheetDirective, selectors: [["", "bottomSheet", ""]], standalone: false });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BottomSheetDirective, [{
type: Directive,
args: [{
selector: '[bottomSheet]',
standalone: false
}]
}], () => [{ type: i0.ElementRef, decorators: [{
type: Inject,
args: [ElementRef]
}] }], null); })();
const sbsMeta = {
insertChild: (parent, child) => {
const pbs = parent;
const childView = child;
if (childView.id === BOTTOMSHEET) {
pbs.bottomSheet = childView;
}
else {
pbs.addChild(childView);
}
},
removeChild: (parent, child) => {
const pbs = parent;
const childView = child;
if (childView.id === BOTTOMSHEET) {
pbs.bottomSheet = null;
}
else {
pbs.removeChild(childView);
}
}
};
/**
* Directives identifying the Drawer.
*/
const PERSISTENTBOTTOMSHEET_DIRECTIVES = [BottomSheetDirective];
registerElement('BottomSheet', () => PersistentBottomSheet, sbsMeta);
/**
* NgModule containing all of the RadSideDrawer directives.
*/
class BottomSheetModule {
static ɵfac = function BottomSheetModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || BottomSheetModule)(); };
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: BottomSheetModule });
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BottomSheetModule, [{
type: NgModule,
args: [{
declarations: [BottomSheetComponent, PERSISTENTBOTTOMSHEET_DIRECTIVES],
exports: [BottomSheetComponent, PERSISTENTBOTTOMSHEET_DIRECTIVES]
}]
}], null, null); })();
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(BottomSheetModule, { declarations: [BottomSheetComponent, BottomSheetDirective], exports: [BottomSheetComponent, BottomSheetDirective] }); })();
/**
* Generated bundle index. Do not edit.
*/
export { BottomSheetComponent, BottomSheetDirective, BottomSheetModule, PERSISTENTBOTTOMSHEET_DIRECTIVES };
//# sourceMappingURL=nativescript-community-ui-persistent-bottomsheet-angular.mjs.map