@sebgroup/green-angular 1.0.0-beta.1 → 1.0.0-beta.2
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.
- package/esm2020/index.mjs +10 -0
- package/esm2020/lib/dropdown/dropdown.component.mjs +111 -0
- package/esm2020/lib/dropdown/dropdown.module.mjs +42 -0
- package/esm2020/lib/dropdown/popover-element.directive.mjs +218 -0
- package/esm2020/lib/dropdown/popover-option.directive.mjs +58 -0
- package/esm2020/lib/dropdown/popover-trigger.directive.mjs +80 -0
- package/esm2020/lib/dropdown/popover.directive.mjs +46 -0
- package/esm2020/lib/green-angular.module.mjs +19 -0
- package/esm2020/lib/segmented-control/segmented-control.component.mjs +40 -0
- package/esm2020/lib/segmented-control/segmented-control.module.mjs +19 -0
- package/esm2020/sebgroup-green-angular.mjs +5 -0
- package/fesm2015/{sebgroup-green-angular.js → sebgroup-green-angular.mjs} +54 -45
- package/fesm2015/sebgroup-green-angular.mjs.map +1 -0
- package/fesm2020/sebgroup-green-angular.mjs +599 -0
- package/fesm2020/sebgroup-green-angular.mjs.map +1 -0
- package/package.json +26 -13
- package/bundles/sebgroup-green-angular.umd.js +0 -610
- package/bundles/sebgroup-green-angular.umd.js.map +0 -1
- package/esm2015/index.js +0 -10
- package/esm2015/index.js.map +0 -1
- package/esm2015/lib/dropdown/dropdown.component.js +0 -111
- package/esm2015/lib/dropdown/dropdown.component.js.map +0 -1
- package/esm2015/lib/dropdown/dropdown.module.js +0 -42
- package/esm2015/lib/dropdown/dropdown.module.js.map +0 -1
- package/esm2015/lib/dropdown/popover-element.directive.js +0 -220
- package/esm2015/lib/dropdown/popover-element.directive.js.map +0 -1
- package/esm2015/lib/dropdown/popover-option.directive.js +0 -59
- package/esm2015/lib/dropdown/popover-option.directive.js.map +0 -1
- package/esm2015/lib/dropdown/popover-trigger.directive.js +0 -80
- package/esm2015/lib/dropdown/popover-trigger.directive.js.map +0 -1
- package/esm2015/lib/dropdown/popover.directive.js +0 -46
- package/esm2015/lib/dropdown/popover.directive.js.map +0 -1
- package/esm2015/lib/green-angular.module.js +0 -19
- package/esm2015/lib/green-angular.module.js.map +0 -1
- package/esm2015/lib/segmented-control/segmented-control.component.js +0 -40
- package/esm2015/lib/segmented-control/segmented-control.component.js.map +0 -1
- package/esm2015/lib/segmented-control/segmented-control.module.js +0 -19
- package/esm2015/lib/segmented-control/segmented-control.module.js.map +0 -1
- package/esm2015/sebgroup-green-angular.js +0 -5
- package/esm2015/sebgroup-green-angular.js.map +0 -1
- package/fesm2015/sebgroup-green-angular.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sebgroup-green-angular.umd.js","sources":["../../../../libs/angular/src/lib/segmented-control/segmented-control.component.ts","../../../../libs/angular/src/lib/segmented-control/segmented-control.module.ts","../../../../libs/angular/src/lib/dropdown/popover.directive.ts","../../../../libs/angular/src/lib/dropdown/popover-trigger.directive.ts","../../../../libs/angular/src/lib/dropdown/popover-option.directive.ts","../../../../libs/angular/src/lib/dropdown/popover-element.directive.ts","../../../../libs/angular/src/lib/dropdown/dropdown.component.ts","../../../../libs/angular/src/lib/dropdown/dropdown.module.ts","../../../../libs/angular/src/lib/green-angular.module.ts","../../../../libs/angular/src/sebgroup-green-angular.ts"],"sourcesContent":["import { Component, ChangeDetectionStrategy, Input } from '@angular/core'\nimport { Observable } from 'rxjs'\nexport interface SegmentedControl {\n url: string\n text: Observable<string> | string\n}\n@Component({\n selector: 'ngg-segmented-control',\n template: `\n <div class=\"group\">\n <a\n *ngFor=\"let control of $controls | async\"\n [routerLink]=\"control.url\"\n routerLinkActive=\"active\"\n class=\"button\"\n >{{ control.text }}</a\n >\n </div>\n `,\n styles: [],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NggSegmentedControlComponent {\n @Input() $controls: Observable<Array<SegmentedControl>> | undefined\n}\n","import { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { NggSegmentedControlComponent } from './segmented-control.component'\nimport { RouterModule } from '@angular/router'\n\n@NgModule({\n declarations: [NggSegmentedControlComponent],\n imports: [RouterModule, CommonModule],\n exports: [NggSegmentedControlComponent],\n})\nexport class NggSegmentedControlModule {}\n","import { Directive, ElementRef, Input } from '@angular/core'\nimport { BehaviorSubject } from 'rxjs'\ninterface PopoverConfig {\n usePopper?: boolean\n container?: '' | 'body'\n useBodyScrollLock?: boolean\n}\n\ninterface PopoverState {\n $isOpen: BehaviorSubject<boolean>\n}\n\n@Directive({\n selector: '[nggPopover]',\n})\nexport class NggPopoverDirective {\n get config(): PopoverConfig {\n return this._config\n }\n\n @Input() set config(config: PopoverConfig) {\n this._config = { ...this.config, ...config }\n }\n triggerElement?: ElementRef\n private _config: PopoverConfig = {\n usePopper: true,\n container: '',\n useBodyScrollLock: true,\n }\n state: PopoverState = {\n $isOpen: new BehaviorSubject<boolean>(false),\n }\n\n close() {\n this.state.$isOpen.next(false)\n }\n open() {\n this.state.$isOpen.next(true)\n }\n toggle() {\n if (this.state.$isOpen.value) {\n this.close()\n } else {\n this.open()\n }\n }\n}\n","import {\n Directive,\n ElementRef,\n forwardRef,\n HostBinding,\n HostListener,\n Inject,\n OnDestroy,\n OnInit,\n} from '@angular/core'\nimport { Subject } from 'rxjs'\nimport { takeUntil, tap } from 'rxjs/operators'\nimport { NggPopoverDirective } from './popover.directive'\n\n@Directive({\n selector: '[nggPopoverTrigger]',\n})\nexport class NggPopoverTriggerDirective implements OnInit, OnDestroy {\n $unsubscribe = new Subject()\n\n @HostBinding('class') class = 'dropdown-toggle'\n @HostBinding('attr.aria-haspopup') haspopup = 'listbox'\n @HostBinding('attr.aria-owns') owns: string | null = null\n @HostBinding('attr.aria-expanded') expanded = this.popover.state.$isOpen.value\n\n @HostListener('keydown.arrowdown', ['$event'])\n @HostListener('click', ['$event'])\n toggle = (event: Event | KeyboardEvent) => {\n if ('key' in event && event.key === 'ArrowDown') {\n // open popover on arrow down by not stopping event propagation\n if (this.popover.state.$isOpen.value) {\n return\n } else {\n // prevent container from scrolling\n event.preventDefault()\n }\n }\n event.stopPropagation()\n this.popover.toggle()\n }\n constructor(\n @Inject(forwardRef(() => NggPopoverDirective))\n public popover: NggPopoverDirective,\n private _elRef: ElementRef\n ) {}\n\n ngOnInit() {\n // if trigger element does not have an id...\n if (!this._elRef.nativeElement.id) {\n // ...add a unique id\n this._elRef.nativeElement.id = `ngg_dropdownTrigger_${new Date().getTime()}`\n this.owns = this._elRef.nativeElement.id.replace(\n /dropdownTrigger/,\n 'popover'\n )\n } else {\n this.owns = this._elRef.nativeElement.id + '_popover'\n }\n\n this.popover.triggerElement = this._elRef\n\n this.popover.state.$isOpen\n .pipe(\n tap((isOpen) => (this.expanded = isOpen)),\n takeUntil(this.$unsubscribe)\n )\n .subscribe()\n }\n\n ngOnDestroy() {\n this.$unsubscribe.next()\n this.$unsubscribe.complete()\n }\n}\n","import {\n Directive,\n ElementRef,\n EventEmitter,\n forwardRef,\n HostBinding,\n HostListener,\n Inject,\n Input,\n OnInit,\n Output,\n} from '@angular/core'\nimport { NggPopoverDirective } from './popover.directive'\n\n@Directive({\n selector: '[nggPopoverOption]',\n})\nexport class NggPopoverOptionDirective implements OnInit {\n @Input() nggPopoverOption: any\n @Input() index: number | undefined\n @Input() selected = false\n @Output() selectedChanged = new EventEmitter()\n @HostBinding('attr.role') role = 'option'\n @HostBinding('attr.aria-selected')\n public get ariaSelected(): null | boolean {\n return this.selected || null\n }\n @HostBinding('attr.id') id = ''\n @HostListener('click') clickHandler = (event: Event) => {\n this.select(event)\n }\n\n constructor(\n @Inject(forwardRef(() => NggPopoverDirective))\n public popover: NggPopoverDirective,\n public elRef: ElementRef\n ) {}\n\n ngOnInit() {\n this.id = `${this.popover.triggerElement?.nativeElement.id}_dropdownOption_${this.index}`\n }\n\n select = (event: Event) => {\n this.selectedChanged.emit(this.nggPopoverOption)\n }\n}\n","import {\n ChangeDetectorRef,\n ContentChildren,\n Directive,\n ElementRef,\n forwardRef,\n HostBinding,\n HostListener,\n Inject,\n OnDestroy,\n OnInit,\n QueryList,\n Renderer2,\n} from '@angular/core'\nimport { filter, skip, switchMap, takeUntil, tap } from 'rxjs/operators'\nimport { Instance } from '@popperjs/core/lib/types'\nimport { EMPTY, fromEvent, merge, Subject } from 'rxjs'\nimport { NggPopoverOptionDirective } from './popover-option.directive'\nimport { NggPopoverDirective } from './popover.directive'\nimport { createPopper } from '@popperjs/core'\nimport { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock'\n\n@Directive({\n selector: '[nggPopoverElement]',\n})\nexport class NggPopoverElementDirective implements OnInit, OnDestroy {\n _popper?: Instance | null\n _container?: ElementRef | null\n $unsubscribe = new Subject()\n sm = window.innerWidth <= 576\n @ContentChildren(NggPopoverOptionDirective, { descendants: true }) options:\n | QueryList<NggPopoverOptionDirective>\n | undefined\n\n @HostBinding('class.popover') class = true\n @HostBinding('attr.role') role = 'listbox'\n @HostBinding('attr.id') id = null\n @HostBinding('class.active') show = this.popover.state.$isOpen.value\n @HostBinding('attr.aria-activedescendant') activeDescendant: string | null =\n null\n // TODO: refactor and move to general size/device service\n @HostListener('window:resize', ['$event']) onResize(event: UIEvent) {\n // determine if small screen size i.e less than or equal to 576 pixels which is the breakpoint for small screens\n this.sm = (event.target as Window).innerWidth <= 576\n if (this.sm) {\n // remove popper\n this.removePopper()\n } else if (!this._popper) {\n // add popper\n this.addPopper()\n }\n }\n\n handleClickEvent(event: Event) {\n // if click inside popover element...\n if (this._elRef.nativeElement.contains(event.target)) {\n this.popover.close()\n } else if (this.popover.state.$isOpen.value) {\n // else if click outside popover element...\n this.popover.close()\n }\n }\n handleKeydownEvent(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n this.popover.close()\n return\n }\n let next = 0 // Used for home key\n const currentSelection =\n this.options?.find((option) => !!option.selected)?.index || 0\n if (event.key === 'End') {\n // set next to last option\n next = (this.options?.length || 1) - 1\n } else if (event.key === 'ArrowUp') {\n // next can't be less than zero\n next = Math.max(0, currentSelection - 1)\n\n // prevent container from scrolling\n event.preventDefault()\n } else if (event.key === 'ArrowDown') {\n // next can't be greater than number of options\n next = Math.min((this.options?.length || 1) - 1, currentSelection + 1)\n\n // prevent container from scrolling\n event.preventDefault()\n }\n // select next option\n this.options?.get(next)?.select(event)\n }\n\n constructor(\n @Inject(forwardRef(() => NggPopoverDirective))\n public popover: NggPopoverDirective,\n private _elRef: ElementRef,\n private _renderer: Renderer2,\n private _cdr: ChangeDetectorRef\n ) {}\n ngOnInit() {\n this.id = /^ngg_dropdownTrigger/.test(\n this.popover.triggerElement?.nativeElement.id\n )\n ? this.popover.triggerElement?.nativeElement.id.replace(\n /dropdownTrigger/,\n 'popover'\n )\n : this.popover.triggerElement?.nativeElement.id + '_popover'\n this.popover.state.$isOpen\n .pipe(\n skip(1), // skip initial value\n tap((isOpen) => {\n this.show = isOpen // toggle visibility\n\n if (isOpen) {\n this.activeDescendant =\n this.options?.find((option) => !!option.selected)?.id || null\n\n // if use body scroll lock\n if (this.popover.config.useBodyScrollLock) {\n this.disableBodyScrollLock()\n }\n // if popover is configured to use a container...\n if (this.popover.config.container !== '') {\n // ...add container\n this.addContainer()\n }\n // if popover is configured to use popper.js...\n if (this.popover.config.usePopper) {\n this.addPopper()\n }\n } else {\n this.activeDescendant = null\n if (this.popover.config.useBodyScrollLock) {\n this.enableBodyScrollLock()\n }\n this.removeContainer()\n this.removePopper()\n }\n }),\n switchMap((isOpen) =>\n isOpen\n ? merge(\n // listen to click events\n fromEvent(document, 'click').pipe(\n tap((event) => this.handleClickEvent(event))\n ),\n // listen to keydown events\n fromEvent(document, 'keydown').pipe(\n // filter keys\n filter(\n (event) =>\n ['ArrowDown', 'ArrowUp', 'Escape', 'Home', 'End'].indexOf(\n (event as KeyboardEvent).key\n ) !== -1\n ),\n tap((event) =>\n this.handleKeydownEvent(event as KeyboardEvent)\n )\n )\n )\n : EMPTY\n ),\n takeUntil(this.$unsubscribe)\n )\n .subscribe()\n }\n\n ngOnDestroy() {\n this.removePopper()\n this.disableBodyScrollLock()\n\n // remove container if declared\n if (this._container) {\n this.removeContainer()\n }\n this.$unsubscribe.next()\n this.$unsubscribe.complete()\n }\n\n enableBodyScrollLock() {\n enableBodyScroll(this._elRef.nativeElement)\n }\n\n disableBodyScrollLock() {\n disableBodyScroll(this._elRef.nativeElement)\n }\n\n addPopper() {\n if (this.sm) {\n return\n }\n if (!this._popper) {\n // ...create popper instance for anchoring popover with trigger element\n this._popper = createPopper(\n this.popover.triggerElement?.nativeElement,\n this._elRef.nativeElement,\n {\n placement: 'bottom-start',\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 4],\n },\n },\n ],\n }\n )\n // detect changes once element and popper is initiated to update initial position\n this._cdr.detectChanges()\n } else {\n this._popper.state.elements.reference =\n this.popover.triggerElement?.nativeElement\n this._popper.update().then((_) => this._cdr.detectChanges())\n }\n }\n removePopper() {\n // destroy popper if declared\n if (this._popper) {\n this._popper?.destroy()\n this._popper = null\n }\n }\n addContainer() {\n // create global container for popover if not already present\n if (!this._container) {\n this._container = this._renderer.createElement('div')\n }\n this._renderer.appendChild(this._container, this._elRef.nativeElement)\n this._renderer.appendChild(document.body, this._container)\n }\n\n removeContainer() {\n if (this._container) {\n // remove container from DOM tree\n this._renderer.removeChild(document.body, this._container)\n\n // clear container\n this._container = null\n }\n }\n}\n","import { Component, Input } from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\n@Component({\n selector: 'ngg-dropdown',\n template: `\n <div nggPopover [config]=\"config\">\n <button type=\"button\" nggPopoverTrigger>\n {{ value }}\n </button>\n <div nggPopoverElement tabindex=\"-1\" autofocus>\n <button class=\"close m-4 m-sm-2 d-block d-sm-none \">\n <span class=\"sr-only\">Close</span>\n </button>\n <ul role=\"listbox\">\n <li\n *ngFor=\"let option of options; let i = index\"\n [nggPopoverOption]=\"option.value\"\n [index]=\"i\"\n [selected]=\"value === option.value\"\n (selectedChanged)=\"select($event)\"\n >\n {{ option.key }}\n </li>\n </ul>\n </div>\n </div>\n `,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: NggDropdownComponent,\n multi: true,\n },\n ],\n //changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NggDropdownComponent implements ControlValueAccessor {\n get options(): Array<any> {\n return this._options\n }\n\n @Input() set options(value: Array<any>) {\n this._options = value\n }\n get config(): any {\n return this._config\n }\n @Input() set config(value: any) {\n this._config = value\n }\n\n value: any\n onChangeFn: any\n onTouchedFn: any\n\n private _options: Array<any> = []\n\n private _config?: any = {}\n\n writeValue(obj: any): void {\n this.value = obj\n }\n\n registerOnChange(fn: any): void {\n this.onChangeFn = fn\n }\n\n registerOnTouched(fn: any): void {\n this.onTouchedFn = fn\n }\n\n select(value: any) {\n this.onChangeFn(value)\n this.value = value\n }\n}\n","import { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { NggDropdownComponent } from './dropdown.component'\nimport { NggPopoverElementDirective } from './popover-element.directive'\nimport { NggPopoverOptionDirective } from './popover-option.directive'\nimport { NggPopoverTriggerDirective } from './popover-trigger.directive'\nimport { NggPopoverDirective } from './popover.directive'\n\n@NgModule({\n declarations: [\n NggPopoverDirective,\n NggPopoverOptionDirective,\n NggPopoverElementDirective,\n NggPopoverTriggerDirective,\n NggDropdownComponent,\n ],\n imports: [CommonModule],\n exports: [\n NggPopoverDirective,\n NggPopoverOptionDirective,\n NggPopoverElementDirective,\n NggPopoverTriggerDirective,\n NggDropdownComponent,\n ],\n})\nexport class NggDropdownModule {}\n","import { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { NggSegmentedControlModule } from './segmented-control/segmented-control.module'\nimport { NggDropdownModule } from './dropdown/dropdown.module'\n\n@NgModule({\n declarations: [],\n imports: [CommonModule],\n exports: [NggSegmentedControlModule, NggDropdownModule],\n})\nexport class NggModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["Component","ChangeDetectionStrategy","Input","RouterModule","CommonModule","NgModule","BehaviorSubject","Directive","Subject","tap","takeUntil","forwardRef","Inject","HostBinding","HostListener","EventEmitter","Output","skip","switchMap","merge","fromEvent","filter","EMPTY","enableBodyScroll","disableBodyScroll","createPopper","ContentChildren","NG_VALUE_ACCESSOR"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAsBA;;;;kJAAa,4BAA4B;2HAA5B,4BAA4B,4GAd7B,0PAUT;oHAIU,4BAA4B;oBAhBxCA,YAAS;qBAAC;sBACT,QAAQ,EAAE,uBAAuB;sBACjC,QAAQ,EAAE,0PAUT;sBACD,MAAM,EAAE,EAAE;sBACV,eAAe,EAAEC,0BAAuB,CAAC,MAAM;mBAChD;gCAEU,SAAS;wBAAjBC,QAAK;;;;MCbR;;;;+IAAa,yBAAyB;gJAAzB,yBAAyB,iBAJrB,4BAA4B,aACjCC,eAAY,EAAEC,eAAY,aAC1B,4BAA4B;gJAE3B,yBAAyB,YAH3B,CAACD,eAAY,EAAEC,eAAY,CAAC;oHAG1B,yBAAyB;oBALrCC,WAAQ;qBAAC;sBACR,YAAY,EAAE,CAAC,4BAA4B,CAAC;sBAC5C,OAAO,EAAE,CAACF,eAAY,EAAEC,eAAY,CAAC;sBACrC,OAAO,EAAE,CAAC,4BAA4B,CAAC;mBACxC;;;;MCGD;UAYU,YAAO,GAAkB;cAC/B,SAAS,EAAE,IAAI;cACf,SAAS,EAAE,EAAE;cACb,iBAAiB,EAAE,IAAI;WACxB,CAAA;UACD,UAAK,GAAiB;cACpB,OAAO,EAAE,IAAIE,oBAAe,CAAU,KAAK,CAAC;WAC7C,CAAA;OAeF;MA9BC,sBAAI,uCAAM;eAAV;cACE,OAAO,IAAI,CAAC,OAAO,CAAA;WACpB;eAED,UAAoB,MAAqB;cACvC,IAAI,CAAC,OAAO,mCAAQ,IAAI,CAAC,MAAM,GAAK,MAAM,CAAE,CAAA;WAC7C;;;SAJA;MAeD,mCAAK,GAAL;UACE,IAAI,CAAC,KAAK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,YAHVA,eAAY,aACZ,yBAAyB,EAAE,iBAAiB;gIAE3C,SAAS,YAHX,CAACA,eAAY,CAAC,EACb,yBAAyB,EAAE,iBAAiB;oHAE3C,SAAS;oBALrBC,WAAQ;qBAAC;sBACR,YAAY,EAAE,EAAE;sBAChB,OAAO,EAAE,CAACD,eAAY,CAAC;sBACvB,OAAO,EAAE,CAAC,yBAAyB,EAAE,iBAAiB,CAAC;mBACxD;;;ECTD;;;;;;;;;;;;;;;;;;;;"}
|
package/esm2015/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './lib/green-angular.module';
|
|
2
|
-
export * from './lib/dropdown/dropdown.module';
|
|
3
|
-
export * from './lib/dropdown/dropdown.component';
|
|
4
|
-
export * from './lib/dropdown/popover.directive';
|
|
5
|
-
export * from './lib/dropdown/popover-element.directive';
|
|
6
|
-
export * from './lib/dropdown/popover-option.directive';
|
|
7
|
-
export * from './lib/dropdown/popover-trigger.directive';
|
|
8
|
-
export * from './lib/segmented-control/segmented-control.module';
|
|
9
|
-
export * from './lib/segmented-control/segmented-control.component';
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/esm2015/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/angular/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mCAAmC,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAChD,cAAc,0CAA0C,CAAA;AACxD,cAAc,yCAAyC,CAAA;AACvD,cAAc,0CAA0C,CAAA;AACxD,cAAc,kDAAkD,CAAA;AAChE,cAAc,qDAAqD,CAAA","sourcesContent":["export * from './lib/green-angular.module'\nexport * from './lib/dropdown/dropdown.module'\nexport * from './lib/dropdown/dropdown.component'\nexport * from './lib/dropdown/popover.directive'\nexport * from './lib/dropdown/popover-element.directive'\nexport * from './lib/dropdown/popover-option.directive'\nexport * from './lib/dropdown/popover-trigger.directive'\nexport * from './lib/segmented-control/segmented-control.module'\nexport * from './lib/segmented-control/segmented-control.component'\n"]}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "./popover.directive";
|
|
5
|
-
import * as i2 from "./popover-trigger.directive";
|
|
6
|
-
import * as i3 from "./popover-element.directive";
|
|
7
|
-
import * as i4 from "@angular/common";
|
|
8
|
-
import * as i5 from "./popover-option.directive";
|
|
9
|
-
export class NggDropdownComponent {
|
|
10
|
-
constructor() {
|
|
11
|
-
this._options = [];
|
|
12
|
-
this._config = {};
|
|
13
|
-
}
|
|
14
|
-
get options() {
|
|
15
|
-
return this._options;
|
|
16
|
-
}
|
|
17
|
-
set options(value) {
|
|
18
|
-
this._options = value;
|
|
19
|
-
}
|
|
20
|
-
get config() {
|
|
21
|
-
return this._config;
|
|
22
|
-
}
|
|
23
|
-
set config(value) {
|
|
24
|
-
this._config = value;
|
|
25
|
-
}
|
|
26
|
-
writeValue(obj) {
|
|
27
|
-
this.value = obj;
|
|
28
|
-
}
|
|
29
|
-
registerOnChange(fn) {
|
|
30
|
-
this.onChangeFn = fn;
|
|
31
|
-
}
|
|
32
|
-
registerOnTouched(fn) {
|
|
33
|
-
this.onTouchedFn = fn;
|
|
34
|
-
}
|
|
35
|
-
select(value) {
|
|
36
|
-
this.onChangeFn(value);
|
|
37
|
-
this.value = value;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
NggDropdownComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: NggDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
41
|
-
NggDropdownComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", type: NggDropdownComponent, selector: "ngg-dropdown", inputs: { options: "options", config: "config" }, providers: [
|
|
42
|
-
{
|
|
43
|
-
provide: NG_VALUE_ACCESSOR,
|
|
44
|
-
useExisting: NggDropdownComponent,
|
|
45
|
-
multi: true,
|
|
46
|
-
},
|
|
47
|
-
], ngImport: i0, template: `
|
|
48
|
-
<div nggPopover [config]="config">
|
|
49
|
-
<button type="button" nggPopoverTrigger>
|
|
50
|
-
{{ value }}
|
|
51
|
-
</button>
|
|
52
|
-
<div nggPopoverElement tabindex="-1" autofocus>
|
|
53
|
-
<button class="close m-4 m-sm-2 d-block d-sm-none ">
|
|
54
|
-
<span class="sr-only">Close</span>
|
|
55
|
-
</button>
|
|
56
|
-
<ul role="listbox">
|
|
57
|
-
<li
|
|
58
|
-
*ngFor="let option of options; let i = index"
|
|
59
|
-
[nggPopoverOption]="option.value"
|
|
60
|
-
[index]="i"
|
|
61
|
-
[selected]="value === option.value"
|
|
62
|
-
(selectedChanged)="select($event)"
|
|
63
|
-
>
|
|
64
|
-
{{ option.key }}
|
|
65
|
-
</li>
|
|
66
|
-
</ul>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
`, isInline: true, directives: [{ type: i1.NggPopoverDirective, selector: "[nggPopover]", inputs: ["config"] }, { type: i2.NggPopoverTriggerDirective, selector: "[nggPopoverTrigger]" }, { type: i3.NggPopoverElementDirective, selector: "[nggPopoverElement]" }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NggPopoverOptionDirective, selector: "[nggPopoverOption]", inputs: ["nggPopoverOption", "index", "selected"], outputs: ["selectedChanged"] }] });
|
|
70
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: NggDropdownComponent, decorators: [{
|
|
71
|
-
type: Component,
|
|
72
|
-
args: [{
|
|
73
|
-
selector: 'ngg-dropdown',
|
|
74
|
-
template: `
|
|
75
|
-
<div nggPopover [config]="config">
|
|
76
|
-
<button type="button" nggPopoverTrigger>
|
|
77
|
-
{{ value }}
|
|
78
|
-
</button>
|
|
79
|
-
<div nggPopoverElement tabindex="-1" autofocus>
|
|
80
|
-
<button class="close m-4 m-sm-2 d-block d-sm-none ">
|
|
81
|
-
<span class="sr-only">Close</span>
|
|
82
|
-
</button>
|
|
83
|
-
<ul role="listbox">
|
|
84
|
-
<li
|
|
85
|
-
*ngFor="let option of options; let i = index"
|
|
86
|
-
[nggPopoverOption]="option.value"
|
|
87
|
-
[index]="i"
|
|
88
|
-
[selected]="value === option.value"
|
|
89
|
-
(selectedChanged)="select($event)"
|
|
90
|
-
>
|
|
91
|
-
{{ option.key }}
|
|
92
|
-
</li>
|
|
93
|
-
</ul>
|
|
94
|
-
</div>
|
|
95
|
-
</div>
|
|
96
|
-
`,
|
|
97
|
-
providers: [
|
|
98
|
-
{
|
|
99
|
-
provide: NG_VALUE_ACCESSOR,
|
|
100
|
-
useExisting: NggDropdownComponent,
|
|
101
|
-
multi: true,
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
//changeDetection: ChangeDetectionStrategy.OnPush
|
|
105
|
-
}]
|
|
106
|
-
}], propDecorators: { options: [{
|
|
107
|
-
type: Input
|
|
108
|
-
}], config: [{
|
|
109
|
-
type: Input
|
|
110
|
-
}] } });
|
|
111
|
-
//# sourceMappingURL=dropdown.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.component.js","sourceRoot":"","sources":["../../../../../../libs/angular/src/lib/dropdown/dropdown.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAwB,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;;;;;;;AAoCxE,MAAM,OAAO,oBAAoB;IAlCjC;QAqDU,aAAQ,GAAe,EAAE,CAAA;QAEzB,YAAO,GAAS,EAAE,CAAA;KAkB3B;IAtCC,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED,IAAa,OAAO,CAAC,KAAiB;QACpC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAA;IACvB,CAAC;IACD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IACD,IAAa,MAAM,CAAC,KAAU;QAC5B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACtB,CAAC;IAUD,UAAU,CAAC,GAAQ;QACjB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAA;IAClB,CAAC;IAED,gBAAgB,CAAC,EAAO;QACtB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;IACtB,CAAC;IAED,iBAAiB,CAAC,EAAO;QACvB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAA;IACvB,CAAC;IAED,MAAM,CAAC,KAAU;QACf,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;;kHAtCU,oBAAoB;sGAApB,oBAAoB,yFATpB;QACT;YACE,OAAO,EAAE,iBAAiB;YAC1B,WAAW,EAAE,oBAAoB;YACjC,KAAK,EAAE,IAAI;SACZ;KACF,0BA7BS;;;;;;;;;;;;;;;;;;;;;;GAsBT;4FAUU,oBAAoB;kBAlChC,SAAS;mBAAC;oBACT,QAAQ,EAAE,cAAc;oBACxB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;GAsBT;oBACD,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,iBAAiB;4BAC1B,WAAW,sBAAsB;4BACjC,KAAK,EAAE,IAAI;yBACZ;qBACF;oBACD,iDAAiD;iBAClD;8BAMc,OAAO;sBAAnB,KAAK;gBAMO,MAAM;sBAAlB,KAAK","sourcesContent":["import { Component, Input } from '@angular/core'\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\n\n@Component({\n selector: 'ngg-dropdown',\n template: `\n <div nggPopover [config]=\"config\">\n <button type=\"button\" nggPopoverTrigger>\n {{ value }}\n </button>\n <div nggPopoverElement tabindex=\"-1\" autofocus>\n <button class=\"close m-4 m-sm-2 d-block d-sm-none \">\n <span class=\"sr-only\">Close</span>\n </button>\n <ul role=\"listbox\">\n <li\n *ngFor=\"let option of options; let i = index\"\n [nggPopoverOption]=\"option.value\"\n [index]=\"i\"\n [selected]=\"value === option.value\"\n (selectedChanged)=\"select($event)\"\n >\n {{ option.key }}\n </li>\n </ul>\n </div>\n </div>\n `,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: NggDropdownComponent,\n multi: true,\n },\n ],\n //changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NggDropdownComponent implements ControlValueAccessor {\n get options(): Array<any> {\n return this._options\n }\n\n @Input() set options(value: Array<any>) {\n this._options = value\n }\n get config(): any {\n return this._config\n }\n @Input() set config(value: any) {\n this._config = value\n }\n\n value: any\n onChangeFn: any\n onTouchedFn: any\n\n private _options: Array<any> = []\n\n private _config?: any = {}\n\n writeValue(obj: any): void {\n this.value = obj\n }\n\n registerOnChange(fn: any): void {\n this.onChangeFn = fn\n }\n\n registerOnTouched(fn: any): void {\n this.onTouchedFn = fn\n }\n\n select(value: any) {\n this.onChangeFn(value)\n this.value = value\n }\n}\n"]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { NggDropdownComponent } from './dropdown.component';
|
|
4
|
-
import { NggPopoverElementDirective } from './popover-element.directive';
|
|
5
|
-
import { NggPopoverOptionDirective } from './popover-option.directive';
|
|
6
|
-
import { NggPopoverTriggerDirective } from './popover-trigger.directive';
|
|
7
|
-
import { NggPopoverDirective } from './popover.directive';
|
|
8
|
-
import * as i0 from "@angular/core";
|
|
9
|
-
export class NggDropdownModule {
|
|
10
|
-
}
|
|
11
|
-
NggDropdownModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: NggDropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
12
|
-
NggDropdownModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: NggDropdownModule, declarations: [NggPopoverDirective,
|
|
13
|
-
NggPopoverOptionDirective,
|
|
14
|
-
NggPopoverElementDirective,
|
|
15
|
-
NggPopoverTriggerDirective,
|
|
16
|
-
NggDropdownComponent], imports: [CommonModule], exports: [NggPopoverDirective,
|
|
17
|
-
NggPopoverOptionDirective,
|
|
18
|
-
NggPopoverElementDirective,
|
|
19
|
-
NggPopoverTriggerDirective,
|
|
20
|
-
NggDropdownComponent] });
|
|
21
|
-
NggDropdownModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: NggDropdownModule, imports: [[CommonModule]] });
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: NggDropdownModule, decorators: [{
|
|
23
|
-
type: NgModule,
|
|
24
|
-
args: [{
|
|
25
|
-
declarations: [
|
|
26
|
-
NggPopoverDirective,
|
|
27
|
-
NggPopoverOptionDirective,
|
|
28
|
-
NggPopoverElementDirective,
|
|
29
|
-
NggPopoverTriggerDirective,
|
|
30
|
-
NggDropdownComponent,
|
|
31
|
-
],
|
|
32
|
-
imports: [CommonModule],
|
|
33
|
-
exports: [
|
|
34
|
-
NggPopoverDirective,
|
|
35
|
-
NggPopoverOptionDirective,
|
|
36
|
-
NggPopoverElementDirective,
|
|
37
|
-
NggPopoverTriggerDirective,
|
|
38
|
-
NggDropdownComponent,
|
|
39
|
-
],
|
|
40
|
-
}]
|
|
41
|
-
}] });
|
|
42
|
-
//# sourceMappingURL=dropdown.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.module.js","sourceRoot":"","sources":["../../../../../../libs/angular/src/lib/dropdown/dropdown.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;;AAmBzD,MAAM,OAAO,iBAAiB;;+GAAjB,iBAAiB;gHAAjB,iBAAiB,iBAf1B,mBAAmB;QACnB,yBAAyB;QACzB,0BAA0B;QAC1B,0BAA0B;QAC1B,oBAAoB,aAEZ,YAAY,aAEpB,mBAAmB;QACnB,yBAAyB;QACzB,0BAA0B;QAC1B,0BAA0B;QAC1B,oBAAoB;gHAGX,iBAAiB,YATnB,CAAC,YAAY,CAAC;4FASZ,iBAAiB;kBAjB7B,QAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,mBAAmB;wBACnB,yBAAyB;wBACzB,0BAA0B;wBAC1B,0BAA0B;wBAC1B,oBAAoB;qBACrB;oBACD,OAAO,EAAE,CAAC,YAAY,CAAC;oBACvB,OAAO,EAAE;wBACP,mBAAmB;wBACnB,yBAAyB;wBACzB,0BAA0B;wBAC1B,0BAA0B;wBAC1B,oBAAoB;qBACrB;iBACF","sourcesContent":["import { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { NggDropdownComponent } from './dropdown.component'\nimport { NggPopoverElementDirective } from './popover-element.directive'\nimport { NggPopoverOptionDirective } from './popover-option.directive'\nimport { NggPopoverTriggerDirective } from './popover-trigger.directive'\nimport { NggPopoverDirective } from './popover.directive'\n\n@NgModule({\n declarations: [\n NggPopoverDirective,\n NggPopoverOptionDirective,\n NggPopoverElementDirective,\n NggPopoverTriggerDirective,\n NggDropdownComponent,\n ],\n imports: [CommonModule],\n exports: [\n NggPopoverDirective,\n NggPopoverOptionDirective,\n NggPopoverElementDirective,\n NggPopoverTriggerDirective,\n NggDropdownComponent,\n ],\n})\nexport class NggDropdownModule {}\n"]}
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { ChangeDetectorRef, ContentChildren, Directive, ElementRef, forwardRef, HostBinding, HostListener, Inject, Renderer2, } from '@angular/core';
|
|
2
|
-
import { filter, skip, switchMap, takeUntil, tap } from 'rxjs/operators';
|
|
3
|
-
import { EMPTY, fromEvent, merge, Subject } from 'rxjs';
|
|
4
|
-
import { NggPopoverOptionDirective } from './popover-option.directive';
|
|
5
|
-
import { NggPopoverDirective } from './popover.directive';
|
|
6
|
-
import { createPopper } from '@popperjs/core';
|
|
7
|
-
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
|
|
8
|
-
import * as i0 from "@angular/core";
|
|
9
|
-
import * as i1 from "./popover.directive";
|
|
10
|
-
export class NggPopoverElementDirective {
|
|
11
|
-
constructor(popover, _elRef, _renderer, _cdr) {
|
|
12
|
-
this.popover = popover;
|
|
13
|
-
this._elRef = _elRef;
|
|
14
|
-
this._renderer = _renderer;
|
|
15
|
-
this._cdr = _cdr;
|
|
16
|
-
this.$unsubscribe = new Subject();
|
|
17
|
-
this.sm = window.innerWidth <= 576;
|
|
18
|
-
this.class = true;
|
|
19
|
-
this.role = 'listbox';
|
|
20
|
-
this.id = null;
|
|
21
|
-
this.show = this.popover.state.$isOpen.value;
|
|
22
|
-
this.activeDescendant = null;
|
|
23
|
-
}
|
|
24
|
-
// TODO: refactor and move to general size/device service
|
|
25
|
-
onResize(event) {
|
|
26
|
-
// determine if small screen size i.e less than or equal to 576 pixels which is the breakpoint for small screens
|
|
27
|
-
this.sm = event.target.innerWidth <= 576;
|
|
28
|
-
if (this.sm) {
|
|
29
|
-
// remove popper
|
|
30
|
-
this.removePopper();
|
|
31
|
-
}
|
|
32
|
-
else if (!this._popper) {
|
|
33
|
-
// add popper
|
|
34
|
-
this.addPopper();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
handleClickEvent(event) {
|
|
38
|
-
// if click inside popover element...
|
|
39
|
-
if (this._elRef.nativeElement.contains(event.target)) {
|
|
40
|
-
this.popover.close();
|
|
41
|
-
}
|
|
42
|
-
else if (this.popover.state.$isOpen.value) {
|
|
43
|
-
// else if click outside popover element...
|
|
44
|
-
this.popover.close();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
handleKeydownEvent(event) {
|
|
48
|
-
var _a, _b, _c, _d, _e, _f;
|
|
49
|
-
if (event.key === 'Escape') {
|
|
50
|
-
this.popover.close();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
let next = 0; // Used for home key
|
|
54
|
-
const currentSelection = ((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.find((option) => !!option.selected)) === null || _b === void 0 ? void 0 : _b.index) || 0;
|
|
55
|
-
if (event.key === 'End') {
|
|
56
|
-
// set next to last option
|
|
57
|
-
next = (((_c = this.options) === null || _c === void 0 ? void 0 : _c.length) || 1) - 1;
|
|
58
|
-
}
|
|
59
|
-
else if (event.key === 'ArrowUp') {
|
|
60
|
-
// next can't be less than zero
|
|
61
|
-
next = Math.max(0, currentSelection - 1);
|
|
62
|
-
// prevent container from scrolling
|
|
63
|
-
event.preventDefault();
|
|
64
|
-
}
|
|
65
|
-
else if (event.key === 'ArrowDown') {
|
|
66
|
-
// next can't be greater than number of options
|
|
67
|
-
next = Math.min((((_d = this.options) === null || _d === void 0 ? void 0 : _d.length) || 1) - 1, currentSelection + 1);
|
|
68
|
-
// prevent container from scrolling
|
|
69
|
-
event.preventDefault();
|
|
70
|
-
}
|
|
71
|
-
// select next option
|
|
72
|
-
(_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.get(next)) === null || _f === void 0 ? void 0 : _f.select(event);
|
|
73
|
-
}
|
|
74
|
-
ngOnInit() {
|
|
75
|
-
var _a, _b, _c;
|
|
76
|
-
this.id = /^ngg_dropdownTrigger/.test((_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.nativeElement.id)
|
|
77
|
-
? (_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.nativeElement.id.replace(/dropdownTrigger/, 'popover')
|
|
78
|
-
: ((_c = this.popover.triggerElement) === null || _c === void 0 ? void 0 : _c.nativeElement.id) + '_popover';
|
|
79
|
-
this.popover.state.$isOpen
|
|
80
|
-
.pipe(skip(1), // skip initial value
|
|
81
|
-
tap((isOpen) => {
|
|
82
|
-
var _a, _b;
|
|
83
|
-
this.show = isOpen; // toggle visibility
|
|
84
|
-
if (isOpen) {
|
|
85
|
-
this.activeDescendant =
|
|
86
|
-
((_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.find((option) => !!option.selected)) === null || _b === void 0 ? void 0 : _b.id) || null;
|
|
87
|
-
// if use body scroll lock
|
|
88
|
-
if (this.popover.config.useBodyScrollLock) {
|
|
89
|
-
this.disableBodyScrollLock();
|
|
90
|
-
}
|
|
91
|
-
// if popover is configured to use a container...
|
|
92
|
-
if (this.popover.config.container !== '') {
|
|
93
|
-
// ...add container
|
|
94
|
-
this.addContainer();
|
|
95
|
-
}
|
|
96
|
-
// if popover is configured to use popper.js...
|
|
97
|
-
if (this.popover.config.usePopper) {
|
|
98
|
-
this.addPopper();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
this.activeDescendant = null;
|
|
103
|
-
if (this.popover.config.useBodyScrollLock) {
|
|
104
|
-
this.enableBodyScrollLock();
|
|
105
|
-
}
|
|
106
|
-
this.removeContainer();
|
|
107
|
-
this.removePopper();
|
|
108
|
-
}
|
|
109
|
-
}), switchMap((isOpen) => isOpen
|
|
110
|
-
? merge(
|
|
111
|
-
// listen to click events
|
|
112
|
-
fromEvent(document, 'click').pipe(tap((event) => this.handleClickEvent(event))),
|
|
113
|
-
// listen to keydown events
|
|
114
|
-
fromEvent(document, 'keydown').pipe(
|
|
115
|
-
// filter keys
|
|
116
|
-
filter((event) => ['ArrowDown', 'ArrowUp', 'Escape', 'Home', 'End'].indexOf(event.key) !== -1), tap((event) => this.handleKeydownEvent(event))))
|
|
117
|
-
: EMPTY), takeUntil(this.$unsubscribe))
|
|
118
|
-
.subscribe();
|
|
119
|
-
}
|
|
120
|
-
ngOnDestroy() {
|
|
121
|
-
this.removePopper();
|
|
122
|
-
this.disableBodyScrollLock();
|
|
123
|
-
// remove container if declared
|
|
124
|
-
if (this._container) {
|
|
125
|
-
this.removeContainer();
|
|
126
|
-
}
|
|
127
|
-
this.$unsubscribe.next();
|
|
128
|
-
this.$unsubscribe.complete();
|
|
129
|
-
}
|
|
130
|
-
enableBodyScrollLock() {
|
|
131
|
-
enableBodyScroll(this._elRef.nativeElement);
|
|
132
|
-
}
|
|
133
|
-
disableBodyScrollLock() {
|
|
134
|
-
disableBodyScroll(this._elRef.nativeElement);
|
|
135
|
-
}
|
|
136
|
-
addPopper() {
|
|
137
|
-
var _a, _b;
|
|
138
|
-
if (this.sm) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (!this._popper) {
|
|
142
|
-
// ...create popper instance for anchoring popover with trigger element
|
|
143
|
-
this._popper = createPopper((_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.nativeElement, this._elRef.nativeElement, {
|
|
144
|
-
placement: 'bottom-start',
|
|
145
|
-
modifiers: [
|
|
146
|
-
{
|
|
147
|
-
name: 'offset',
|
|
148
|
-
options: {
|
|
149
|
-
offset: [0, 4],
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
});
|
|
154
|
-
// detect changes once element and popper is initiated to update initial position
|
|
155
|
-
this._cdr.detectChanges();
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
this._popper.state.elements.reference =
|
|
159
|
-
(_b = this.popover.triggerElement) === null || _b === void 0 ? void 0 : _b.nativeElement;
|
|
160
|
-
this._popper.update().then((_) => this._cdr.detectChanges());
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
removePopper() {
|
|
164
|
-
var _a;
|
|
165
|
-
// destroy popper if declared
|
|
166
|
-
if (this._popper) {
|
|
167
|
-
(_a = this._popper) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
168
|
-
this._popper = null;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
addContainer() {
|
|
172
|
-
// create global container for popover if not already present
|
|
173
|
-
if (!this._container) {
|
|
174
|
-
this._container = this._renderer.createElement('div');
|
|
175
|
-
}
|
|
176
|
-
this._renderer.appendChild(this._container, this._elRef.nativeElement);
|
|
177
|
-
this._renderer.appendChild(document.body, this._container);
|
|
178
|
-
}
|
|
179
|
-
removeContainer() {
|
|
180
|
-
if (this._container) {
|
|
181
|
-
// remove container from DOM tree
|
|
182
|
-
this._renderer.removeChild(document.body, this._container);
|
|
183
|
-
// clear container
|
|
184
|
-
this._container = null;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
NggPopoverElementDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: NggPopoverElementDirective, deps: [{ token: forwardRef(() => NggPopoverDirective) }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
189
|
-
NggPopoverElementDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: NggPopoverElementDirective, selector: "[nggPopoverElement]", host: { listeners: { "window:resize": "onResize($event)" }, properties: { "class.popover": "this.class", "attr.role": "this.role", "attr.id": "this.id", "class.active": "this.show", "attr.aria-activedescendant": "this.activeDescendant" } }, queries: [{ propertyName: "options", predicate: NggPopoverOptionDirective, descendants: true }], ngImport: i0 });
|
|
190
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: NggPopoverElementDirective, decorators: [{
|
|
191
|
-
type: Directive,
|
|
192
|
-
args: [{
|
|
193
|
-
selector: '[nggPopoverElement]',
|
|
194
|
-
}]
|
|
195
|
-
}], ctorParameters: function () { return [{ type: i1.NggPopoverDirective, decorators: [{
|
|
196
|
-
type: Inject,
|
|
197
|
-
args: [forwardRef(() => NggPopoverDirective)]
|
|
198
|
-
}] }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { options: [{
|
|
199
|
-
type: ContentChildren,
|
|
200
|
-
args: [NggPopoverOptionDirective, { descendants: true }]
|
|
201
|
-
}], class: [{
|
|
202
|
-
type: HostBinding,
|
|
203
|
-
args: ['class.popover']
|
|
204
|
-
}], role: [{
|
|
205
|
-
type: HostBinding,
|
|
206
|
-
args: ['attr.role']
|
|
207
|
-
}], id: [{
|
|
208
|
-
type: HostBinding,
|
|
209
|
-
args: ['attr.id']
|
|
210
|
-
}], show: [{
|
|
211
|
-
type: HostBinding,
|
|
212
|
-
args: ['class.active']
|
|
213
|
-
}], activeDescendant: [{
|
|
214
|
-
type: HostBinding,
|
|
215
|
-
args: ['attr.aria-activedescendant']
|
|
216
|
-
}], onResize: [{
|
|
217
|
-
type: HostListener,
|
|
218
|
-
args: ['window:resize', ['$event']]
|
|
219
|
-
}] } });
|
|
220
|
-
//# sourceMappingURL=popover-element.directive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popover-element.directive.js","sourceRoot":"","sources":["../../../../../../libs/angular/src/lib/dropdown/popover-element.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,MAAM,EAIN,SAAS,GACV,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,MAAM,EAAE,IAAI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gBACO,IAAI;sBAAhC,WAAW;uBAAC,cAAc;gBACgB,gBAAgB;sBAA1D,WAAW;uBAAC,4BAA4B;gBAGE,QAAQ;sBAAlD,YAAY;uBAAC,eAAe,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import {\n ChangeDetectorRef,\n ContentChildren,\n Directive,\n ElementRef,\n forwardRef,\n HostBinding,\n HostListener,\n Inject,\n OnDestroy,\n OnInit,\n QueryList,\n Renderer2,\n} from '@angular/core'\nimport { filter, skip, switchMap, takeUntil, tap } from 'rxjs/operators'\nimport { Instance } from '@popperjs/core/lib/types'\nimport { EMPTY, fromEvent, merge, Subject } from 'rxjs'\nimport { NggPopoverOptionDirective } from './popover-option.directive'\nimport { NggPopoverDirective } from './popover.directive'\nimport { createPopper } from '@popperjs/core'\nimport { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock'\n\n@Directive({\n selector: '[nggPopoverElement]',\n})\nexport class NggPopoverElementDirective implements OnInit, OnDestroy {\n _popper?: Instance | null\n _container?: ElementRef | null\n $unsubscribe = new Subject()\n sm = window.innerWidth <= 576\n @ContentChildren(NggPopoverOptionDirective, { descendants: true }) options:\n | QueryList<NggPopoverOptionDirective>\n | undefined\n\n @HostBinding('class.popover') class = true\n @HostBinding('attr.role') role = 'listbox'\n @HostBinding('attr.id') id = null\n @HostBinding('class.active') show = this.popover.state.$isOpen.value\n @HostBinding('attr.aria-activedescendant') activeDescendant: string | null =\n null\n // TODO: refactor and move to general size/device service\n @HostListener('window:resize', ['$event']) onResize(event: UIEvent) {\n // determine if small screen size i.e less than or equal to 576 pixels which is the breakpoint for small screens\n this.sm = (event.target as Window).innerWidth <= 576\n if (this.sm) {\n // remove popper\n this.removePopper()\n } else if (!this._popper) {\n // add popper\n this.addPopper()\n }\n }\n\n handleClickEvent(event: Event) {\n // if click inside popover element...\n if (this._elRef.nativeElement.contains(event.target)) {\n this.popover.close()\n } else if (this.popover.state.$isOpen.value) {\n // else if click outside popover element...\n this.popover.close()\n }\n }\n handleKeydownEvent(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n this.popover.close()\n return\n }\n let next = 0 // Used for home key\n const currentSelection =\n this.options?.find((option) => !!option.selected)?.index || 0\n if (event.key === 'End') {\n // set next to last option\n next = (this.options?.length || 1) - 1\n } else if (event.key === 'ArrowUp') {\n // next can't be less than zero\n next = Math.max(0, currentSelection - 1)\n\n // prevent container from scrolling\n event.preventDefault()\n } else if (event.key === 'ArrowDown') {\n // next can't be greater than number of options\n next = Math.min((this.options?.length || 1) - 1, currentSelection + 1)\n\n // prevent container from scrolling\n event.preventDefault()\n }\n // select next option\n this.options?.get(next)?.select(event)\n }\n\n constructor(\n @Inject(forwardRef(() => NggPopoverDirective))\n public popover: NggPopoverDirective,\n private _elRef: ElementRef,\n private _renderer: Renderer2,\n private _cdr: ChangeDetectorRef\n ) {}\n ngOnInit() {\n this.id = /^ngg_dropdownTrigger/.test(\n this.popover.triggerElement?.nativeElement.id\n )\n ? this.popover.triggerElement?.nativeElement.id.replace(\n /dropdownTrigger/,\n 'popover'\n )\n : this.popover.triggerElement?.nativeElement.id + '_popover'\n this.popover.state.$isOpen\n .pipe(\n skip(1), // skip initial value\n tap((isOpen) => {\n this.show = isOpen // toggle visibility\n\n if (isOpen) {\n this.activeDescendant =\n this.options?.find((option) => !!option.selected)?.id || null\n\n // if use body scroll lock\n if (this.popover.config.useBodyScrollLock) {\n this.disableBodyScrollLock()\n }\n // if popover is configured to use a container...\n if (this.popover.config.container !== '') {\n // ...add container\n this.addContainer()\n }\n // if popover is configured to use popper.js...\n if (this.popover.config.usePopper) {\n this.addPopper()\n }\n } else {\n this.activeDescendant = null\n if (this.popover.config.useBodyScrollLock) {\n this.enableBodyScrollLock()\n }\n this.removeContainer()\n this.removePopper()\n }\n }),\n switchMap((isOpen) =>\n isOpen\n ? merge(\n // listen to click events\n fromEvent(document, 'click').pipe(\n tap((event) => this.handleClickEvent(event))\n ),\n // listen to keydown events\n fromEvent(document, 'keydown').pipe(\n // filter keys\n filter(\n (event) =>\n ['ArrowDown', 'ArrowUp', 'Escape', 'Home', 'End'].indexOf(\n (event as KeyboardEvent).key\n ) !== -1\n ),\n tap((event) =>\n this.handleKeydownEvent(event as KeyboardEvent)\n )\n )\n )\n : EMPTY\n ),\n takeUntil(this.$unsubscribe)\n )\n .subscribe()\n }\n\n ngOnDestroy() {\n this.removePopper()\n this.disableBodyScrollLock()\n\n // remove container if declared\n if (this._container) {\n this.removeContainer()\n }\n this.$unsubscribe.next()\n this.$unsubscribe.complete()\n }\n\n enableBodyScrollLock() {\n enableBodyScroll(this._elRef.nativeElement)\n }\n\n disableBodyScrollLock() {\n disableBodyScroll(this._elRef.nativeElement)\n }\n\n addPopper() {\n if (this.sm) {\n return\n }\n if (!this._popper) {\n // ...create popper instance for anchoring popover with trigger element\n this._popper = createPopper(\n this.popover.triggerElement?.nativeElement,\n this._elRef.nativeElement,\n {\n placement: 'bottom-start',\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 4],\n },\n },\n ],\n }\n )\n // detect changes once element and popper is initiated to update initial position\n this._cdr.detectChanges()\n } else {\n this._popper.state.elements.reference =\n this.popover.triggerElement?.nativeElement\n this._popper.update().then((_) => this._cdr.detectChanges())\n }\n }\n removePopper() {\n // destroy popper if declared\n if (this._popper) {\n this._popper?.destroy()\n this._popper = null\n }\n }\n addContainer() {\n // create global container for popover if not already present\n if (!this._container) {\n this._container = this._renderer.createElement('div')\n }\n this._renderer.appendChild(this._container, this._elRef.nativeElement)\n this._renderer.appendChild(document.body, this._container)\n }\n\n removeContainer() {\n if (this._container) {\n // remove container from DOM tree\n this._renderer.removeChild(document.body, this._container)\n\n // clear container\n this._container = null\n }\n }\n}\n"]}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Directive, ElementRef, EventEmitter, forwardRef, HostBinding, HostListener, Inject, Input, Output, } from '@angular/core';
|
|
2
|
-
import { NggPopoverDirective } from './popover.directive';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "./popover.directive";
|
|
5
|
-
export class NggPopoverOptionDirective {
|
|
6
|
-
constructor(popover, elRef) {
|
|
7
|
-
this.popover = popover;
|
|
8
|
-
this.elRef = elRef;
|
|
9
|
-
this.selected = false;
|
|
10
|
-
this.selectedChanged = new EventEmitter();
|
|
11
|
-
this.role = 'option';
|
|
12
|
-
this.id = '';
|
|
13
|
-
this.clickHandler = (event) => {
|
|
14
|
-
this.select(event);
|
|
15
|
-
};
|
|
16
|
-
this.select = (event) => {
|
|
17
|
-
this.selectedChanged.emit(this.nggPopoverOption);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
get ariaSelected() {
|
|
21
|
-
return this.selected || null;
|
|
22
|
-
}
|
|
23
|
-
ngOnInit() {
|
|
24
|
-
var _a;
|
|
25
|
-
this.id = `${(_a = this.popover.triggerElement) === null || _a === void 0 ? void 0 : _a.nativeElement.id}_dropdownOption_${this.index}`;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
NggPopoverOptionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: NggPopoverOptionDirective, deps: [{ token: forwardRef(() => NggPopoverDirective) }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
29
|
-
NggPopoverOptionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.10", type: NggPopoverOptionDirective, selector: "[nggPopoverOption]", inputs: { nggPopoverOption: "nggPopoverOption", index: "index", selected: "selected" }, outputs: { selectedChanged: "selectedChanged" }, host: { listeners: { "click": "clickHandler()" }, properties: { "attr.role": "this.role", "attr.aria-selected": "this.ariaSelected", "attr.id": "this.id" } }, ngImport: i0 });
|
|
30
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0, type: NggPopoverOptionDirective, decorators: [{
|
|
31
|
-
type: Directive,
|
|
32
|
-
args: [{
|
|
33
|
-
selector: '[nggPopoverOption]',
|
|
34
|
-
}]
|
|
35
|
-
}], ctorParameters: function () { return [{ type: i1.NggPopoverDirective, decorators: [{
|
|
36
|
-
type: Inject,
|
|
37
|
-
args: [forwardRef(() => NggPopoverDirective)]
|
|
38
|
-
}] }, { type: i0.ElementRef }]; }, propDecorators: { nggPopoverOption: [{
|
|
39
|
-
type: Input
|
|
40
|
-
}], index: [{
|
|
41
|
-
type: Input
|
|
42
|
-
}], selected: [{
|
|
43
|
-
type: Input
|
|
44
|
-
}], selectedChanged: [{
|
|
45
|
-
type: Output
|
|
46
|
-
}], role: [{
|
|
47
|
-
type: HostBinding,
|
|
48
|
-
args: ['attr.role']
|
|
49
|
-
}], ariaSelected: [{
|
|
50
|
-
type: HostBinding,
|
|
51
|
-
args: ['attr.aria-selected']
|
|
52
|
-
}], id: [{
|
|
53
|
-
type: HostBinding,
|
|
54
|
-
args: ['attr.id']
|
|
55
|
-
}], clickHandler: [{
|
|
56
|
-
type: HostListener,
|
|
57
|
-
args: ['click']
|
|
58
|
-
}] } });
|
|
59
|
-
//# sourceMappingURL=popover-option.directive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"popover-option.directive.js","sourceRoot":"","sources":["../../../../../../libs/angular/src/lib/dropdown/popover-option.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,UAAU,EACV,WAAW,EACX,YAAY,EACZ,MAAM,EACN,KAAK,EAEL,MAAM,GACP,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;;;AAKzD,MAAM,OAAO,yBAAyB;IAepC,YAES,OAA4B,EAC5B,KAAiB;QADjB,YAAO,GAAP,OAAO,CAAqB;QAC5B,UAAK,GAAL,KAAK,CAAY;QAfjB,aAAQ,GAAG,KAAK,CAAA;QACf,oBAAe,GAAG,IAAI,YAAY,EAAE,CAAA;QACpB,SAAI,GAAG,QAAQ,CAAA;QAKjB,OAAE,GAAG,EAAE,CAAA;QACR,iBAAY,GAAG,CAAC,KAAY,EAAE,EAAE;YACrD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACpB,CAAC,CAAA;QAYD,WAAM,GAAG,CAAC,KAAY,EAAE,EAAE;YACxB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAClD,CAAC,CAAA;IARE,CAAC;IAbJ,IACW,YAAY;QACrB,OAAO,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAA;IAC9B,CAAC;IAYD,QAAQ;;QACN,IAAI,CAAC,EAAE,GAAG,GAAG,MAAA,IAAI,CAAC,OAAO,CAAC,cAAc,0CAAE,aAAa,CAAC,EAAE,mBAAmB,IAAI,CAAC,KAAK,EAAE,CAAA;IAC3F,CAAC;;uHAvBU,yBAAyB,kBAgB1B,UAAU,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC;2GAhBpC,yBAAyB;4FAAzB,yBAAyB;kBAHrC,SAAS;mBAAC;oBACT,QAAQ,EAAE,oBAAoB;iBAC/B;;0BAiBI,MAAM;2BAAC,UAAU,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC;qEAftC,gBAAgB;sBAAxB,KAAK;gBACG,KAAK;sBAAb,KAAK;gBACG,QAAQ;sBAAhB,KAAK;gBACI,eAAe;sBAAxB,MAAM;gBACmB,IAAI;sBAA7B,WAAW;uBAAC,WAAW;gBAEb,YAAY;sBADtB,WAAW;uBAAC,oBAAoB;gBAIT,EAAE;sBAAzB,WAAW;uBAAC,SAAS;gBACC,YAAY;sBAAlC,YAAY;uBAAC,OAAO","sourcesContent":["import {\n Directive,\n ElementRef,\n EventEmitter,\n forwardRef,\n HostBinding,\n HostListener,\n Inject,\n Input,\n OnInit,\n Output,\n} from '@angular/core'\nimport { NggPopoverDirective } from './popover.directive'\n\n@Directive({\n selector: '[nggPopoverOption]',\n})\nexport class NggPopoverOptionDirective implements OnInit {\n @Input() nggPopoverOption: any\n @Input() index: number | undefined\n @Input() selected = false\n @Output() selectedChanged = new EventEmitter()\n @HostBinding('attr.role') role = 'option'\n @HostBinding('attr.aria-selected')\n public get ariaSelected(): null | boolean {\n return this.selected || null\n }\n @HostBinding('attr.id') id = ''\n @HostListener('click') clickHandler = (event: Event) => {\n this.select(event)\n }\n\n constructor(\n @Inject(forwardRef(() => NggPopoverDirective))\n public popover: NggPopoverDirective,\n public elRef: ElementRef\n ) {}\n\n ngOnInit() {\n this.id = `${this.popover.triggerElement?.nativeElement.id}_dropdownOption_${this.index}`\n }\n\n select = (event: Event) => {\n this.selectedChanged.emit(this.nggPopoverOption)\n }\n}\n"]}
|