@egjs/ngx-conveyer
Version:
Angular Conveyer adds Drag gestures to your Native Scroll.
1 lines • 6.94 kB
Source Map (JSON)
{"version":3,"file":"egjs-ngx-conveyer.mjs","sources":["../../../projects/ngx-conveyer/src/lib/consts.ts","../../../projects/ngx-conveyer/src/lib/ngx-conveyer.interface.ts","../../../projects/ngx-conveyer/src/lib/ngx-conveyer.directive.ts","../../../projects/ngx-conveyer/src/lib/ngx-conveyer.module.ts","../../../projects/ngx-conveyer/src/public-api.ts","../../../projects/ngx-conveyer/src/egjs-ngx-conveyer.ts"],"sourcesContent":["import { CONVEYER_EVENTS } from '@egjs/conveyer';\nimport { AngularEventsOutputs } from '@cfcs/angular';\n\n// auto\n// eslint-disable-next-line max-len\nexport const ANGULAR_CONVEYER_EVENTS = [\"ngxReachStart: reachStart\", \"ngxReachEnd: reachEnd\", \"ngxLeaveStart: leaveStart\", \"ngxLeaveEnd: leaveEnd\", \"ngxBeginScroll: beginScroll\", \"ngxFinishScroll: finishScroll\"] as AngularEventsOutputs<typeof CONVEYER_EVENTS, 'ngx', ''>;\n","import { Directive } from '@angular/core';\nimport { REACTIVE_CONVEYER } from '@egjs/conveyer';\nimport { ReactiveAdapterResult } from '@cfcs/angular';\n\n@Directive()\nexport class NgxConveyerInterface {}\n\n// automatic reactive state, methods types\nexport interface NgxConveyerInterface\n extends ReactiveAdapterResult<typeof REACTIVE_CONVEYER, 'ngx'> {}\n","import {\n Directive,\n ElementRef,\n EventEmitter,\n Input,\n NgZone,\n} from '@angular/core';\nimport { ConveyerOptions, REACTIVE_CONVEYER } from '@egjs/conveyer';\nimport { useReactive } from '@cfcs/angular';\n\nimport { ANGULAR_CONVEYER_EVENTS } from './consts';\nimport { NgxConveyerInterface } from './ngx-conveyer.interface';\n\n@Directive({\n selector: '[ngxConveyer]',\n exportAs: 'ngxConveyer',\n outputs: ANGULAR_CONVEYER_EVENTS,\n})\nexport class NgxConveyerDirective extends NgxConveyerInterface {\n @Input() ngxConveyer!: ConveyerOptions | '';\n\n /** Event emitters below will be created by `@cfcs/angular`. */\n\n // automatic methods, reactive state\n private _reactiveConveyer = useReactive(this, {\n data: () => {\n return {\n container: { current: this._host.nativeElement! },\n props: this.ngxConveyer || {},\n };\n },\n ...REACTIVE_CONVEYER,\n });\n\n constructor(private _host: ElementRef<HTMLElement>, private _ngZone: NgZone) {\n super();\n }\n\n ngAfterViewInit() {\n this._patchEventEmitters();\n this._ngZone.runOutsideAngular(() => this._reactiveConveyer.mounted());\n }\n\n ngOnDestroy() {\n this._reactiveConveyer.destroy();\n }\n\n private _patchEventEmitters(): void {\n // Pick `ngxReachStart`, ngxReachEnd` and other event emitters.\n // They will be created by `@cfcs/angular`.\n const eventEmitters: EventEmitter<unknown>[] = Object.values(this).filter(\n (value) => value instanceof EventEmitter\n );\n\n for (const eventEmitter of eventEmitters) {\n const emit = eventEmitter.emit;\n\n // We must patch event generators because we're not responsible for\n // calling `emit` since this is done by `@cfcs/angular`. The `conveyer`\n // is created outside of the Angular zone to reduce the number of change\n // detections since it setups mouse listeners (as `mousemove`).\n eventEmitter.emit = (value) => {\n // `observed` is available only in newer RxJS version (7.2+).\n if (eventEmitter.observed || eventEmitter.observers.length > 0) {\n // Given event emitter is `ngxBeginScroll`; this will re-enter the Angular\n // zone if there're any listeners added in template, for instance:\n // `<div ngxConveyer (beginScroll)=\"onBeginScroll()\"></div>`.ngxConveyer\n return this._ngZone.run(() => emit.call(eventEmitter, value));\n } else {\n return emit.call(eventEmitter, value);\n }\n };\n }\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport { NgxConveyerDirective } from './ngx-conveyer.directive';\n\n@NgModule({\n declarations: [NgxConveyerDirective],\n exports: [NgxConveyerDirective],\n})\nexport class NgxConveyerModule {}\n","/*\n * Public API Surface of ngx-conveyer\n */\n\nexport * from './lib/ngx-conveyer.directive';\nexport * from './lib/ngx-conveyer.interface';\nexport * from './lib/ngx-conveyer.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"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