@anglr/select 12.0.0-beta.20230109084937 → 12.0.0-beta.20230109090910
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/es2015/src/plugins/positioner/default/defaultPositioner.component.js +7 -29
- package/es2015/src/plugins/positioner/default/defaultPositioner.component.js.map +1 -1
- package/es2020/src/plugins/positioner/default/defaultPositioner.component.js +4 -26
- package/es2020/src/plugins/positioner/default/defaultPositioner.component.js.map +1 -1
- package/package.json +1 -1
- package/src/plugins/positioner/default/defaultPositioner.component.d.ts +3 -8
- package/src/plugins/positioner/default/defaultPositioner.component.d.ts.map +1 -1
- package/version.bak +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy, Inject, Optional, ElementRef, PLATFORM_ID,
|
|
1
|
+
import { Component, ChangeDetectionStrategy, Inject, Optional, ElementRef, PLATFORM_ID, EventEmitter } from '@angular/core';
|
|
2
2
|
import { isPlatformBrowser } from '@angular/common';
|
|
3
3
|
import { applyPositionResult, POSITION, PositionOffset, PositionPlacement } from '@anglr/common';
|
|
4
4
|
import { extend } from '@jscrpt/common';
|
|
@@ -22,12 +22,11 @@ const defaultOptions = {
|
|
|
22
22
|
*/
|
|
23
23
|
export class DefaultPositionerComponent {
|
|
24
24
|
//######################### constructor #########################
|
|
25
|
-
constructor(ngSelectPlugins, pluginBus, pluginElement, position,
|
|
25
|
+
constructor(ngSelectPlugins, pluginBus, pluginElement, position, options, platformId) {
|
|
26
26
|
this.ngSelectPlugins = ngSelectPlugins;
|
|
27
27
|
this.pluginBus = pluginBus;
|
|
28
28
|
this.pluginElement = pluginElement;
|
|
29
29
|
this.position = position;
|
|
30
|
-
this.changeDetector = changeDetector;
|
|
31
30
|
this.platformId = platformId;
|
|
32
31
|
/**
|
|
33
32
|
* Occurs when flip occured during positining of popup
|
|
@@ -60,13 +59,11 @@ export class DefaultPositionerComponent {
|
|
|
60
59
|
* Called when component is destroyed
|
|
61
60
|
*/
|
|
62
61
|
ngOnDestroy() {
|
|
63
|
-
var _a, _b, _c
|
|
62
|
+
var _a, _b, _c;
|
|
64
63
|
(_a = this.visibilitySubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
65
64
|
this.visibilitySubscription = null;
|
|
66
|
-
(_b = this.
|
|
67
|
-
this.
|
|
68
|
-
(_c = this.positioningDispose) === null || _c === void 0 ? void 0 : _c.call(this);
|
|
69
|
-
(_d = this.positioningSubscription) === null || _d === void 0 ? void 0 : _d.unsubscribe();
|
|
65
|
+
(_b = this.positioningDispose) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
66
|
+
(_c = this.positioningSubscription) === null || _c === void 0 ? void 0 : _c.unsubscribe();
|
|
70
67
|
this.positioningSubscription = null;
|
|
71
68
|
}
|
|
72
69
|
//######################### public methods - implementation of DefaultPositioner #########################
|
|
@@ -74,24 +71,7 @@ export class DefaultPositionerComponent {
|
|
|
74
71
|
* Initialize plugin, to be ready to use, initialize communication with other plugins
|
|
75
72
|
*/
|
|
76
73
|
initialize() {
|
|
77
|
-
// if(this.optionsGatherer && this.optionsGatherer != this.pluginBus?.selectOptions.optionsGatherer)
|
|
78
|
-
// {
|
|
79
|
-
// this.optionsChangeSubscription.unsubscribe();
|
|
80
|
-
// this.optionsChangeSubscription = null;
|
|
81
74
|
var _a;
|
|
82
|
-
// this.optionsGatherer = null;
|
|
83
|
-
// }
|
|
84
|
-
// if(!this.optionsGatherer)
|
|
85
|
-
// {
|
|
86
|
-
// this.optionsGatherer = this.pluginBus?.selectOptions.optionsGatherer;
|
|
87
|
-
// this.optionsChangeSubscription = this.optionsGatherer.availableOptionsChange.subscribe(() =>
|
|
88
|
-
// {
|
|
89
|
-
// if(this.popup.popupElement && this.optionsGatherer.availableOptions)
|
|
90
|
-
// {
|
|
91
|
-
// this._handlePosition();
|
|
92
|
-
// }
|
|
93
|
-
// });
|
|
94
|
-
// }
|
|
95
75
|
const popup = this.ngSelectPlugins[POPUP];
|
|
96
76
|
if (this.popup && this.popup != popup) {
|
|
97
77
|
(_a = this.visibilitySubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
@@ -121,8 +101,6 @@ export class DefaultPositionerComponent {
|
|
|
121
101
|
initPosition() {
|
|
122
102
|
var _a, _b, _c, _d;
|
|
123
103
|
this.popupElement = this.popup.popupElement;
|
|
124
|
-
// //this has meaning only when popup is outside of ng-element
|
|
125
|
-
// this.changeDetector.markForCheck();
|
|
126
104
|
if (this.isBrowser) {
|
|
127
105
|
//register events and handle position of opened popup
|
|
128
106
|
if (this.popupElement) {
|
|
@@ -149,7 +127,7 @@ export class DefaultPositionerComponent {
|
|
|
149
127
|
}
|
|
150
128
|
}
|
|
151
129
|
}
|
|
152
|
-
DefaultPositionerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DefaultPositionerComponent, deps: [{ token: NG_SELECT_PLUGIN_INSTANCES, optional: true }, { token: i1.PluginBus, optional: true }, { token: i0.ElementRef }, { token: POSITION }, { token:
|
|
130
|
+
DefaultPositionerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DefaultPositionerComponent, deps: [{ token: NG_SELECT_PLUGIN_INSTANCES, optional: true }, { token: i1.PluginBus, optional: true }, { token: i0.ElementRef }, { token: POSITION }, { token: POSITIONER_OPTIONS, optional: true }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
|
|
153
131
|
DefaultPositionerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: DefaultPositionerComponent, selector: "ng-default-positioner", ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
154
132
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DefaultPositionerComponent, decorators: [{
|
|
155
133
|
type: Component,
|
|
@@ -168,7 +146,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
168
146
|
}] }, { type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
169
147
|
type: Inject,
|
|
170
148
|
args: [POSITION]
|
|
171
|
-
}] }, { type:
|
|
149
|
+
}] }, { type: undefined, decorators: [{
|
|
172
150
|
type: Inject,
|
|
173
151
|
args: [POSITIONER_OPTIONS]
|
|
174
152
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultPositioner.component.js","sourceRoot":"","sources":["../../../../../src/plugins/positioner/default/defaultPositioner.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAa,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACxJ,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,mBAAmB,EAAY,QAAQ,EAAE,cAAc,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACzG,OAAO,EAAC,MAAM,EAAa,MAAM,gBAAgB,CAAC;AAMlD,OAAO,EAAC,0BAA0B,EAAC,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;;;AAE5D;;GAEG;AACH,MAAM,cAAc,GACpB;IACI,eAAe,EACf;QACI,MAAM,EAAE,cAAc,CAAC,IAAI;QAC3B,SAAS,EAAE,iBAAiB,CAAC,WAAW;KAC3C;CACJ,CAAC;AAEF;;GAEG;AAOH,MAAM,OAAO,0BAA0B;IA4EnC,iEAAiE;IACjE,YAAmE,eAAwC,EAC5E,SAAoB,EAChC,aAAyB,EACJ,QAAkB,EACpC,c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etectionStrategy, Inject, Optional, ElementRef, OnDestroy, PLATFORM_ID, ChangeDetectorRef, EventEmitter} from '@angular/core';\nimport {isPlatformBrowser} from '@angular/common';\nimport {applyPositionResult, Position, POSITION, PositionOffset, PositionPlacement} from '@anglr/common';\nimport {extend, NoopAction} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DefaultPositionerOptions, DefaultPositioner} from './defaultPositioner.interface';\nimport {NgSelectPlugin, OptionsGatherer} from '../../../misc';\nimport {NgSelectPluginInstances} from '../../../components/select';\nimport {NG_SELECT_PLUGIN_INSTANCES} from '../../../components/select/types';\nimport {POSITIONER_OPTIONS} from '../types';\nimport {Popup} from '../../popup';\nimport {POPUP} from '../../popup/types';\nimport {PluginBus} from '../../../misc/pluginBus/pluginBus';\n\n/**\n * Default options for positioner\n */\nconst defaultOptions: DefaultPositionerOptions =\n{\n positionOptions:\n {\n offset: PositionOffset.None,\n placement: PositionPlacement.BottomStart,\n }\n};\n\n/**\n * Component used for positioning popup element, handles resize, scroll and collision using `Position`\n */\n@Component(\n{\n selector: 'ng-default-positioner',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DefaultPositionerComponent implements DefaultPositioner, NgSelectPlugin<DefaultPositionerOptions>, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Instance of previous options gatherer, that is used for obtaining available options\n */\n protected optionsGatherer: OptionsGatherer;\n\n /**\n * Occurs when flip occured during positining of popup\n */\n protected ɵflip: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * Options for NgSelect plugin\n */\n protected ɵoptions: DefaultPositionerOptions;\n\n /**\n * Subscription for visibility change of popup\n */\n protected visibilitySubscription: Subscription|undefined|null;\n\n /**\n * Subscription for changes of options in options gatherer\n */\n protected optionsChangeSubscription: Subscription|undefined|null;\n\n /**\n * Subscription for positioning event that occured\n */\n protected positioningSubscription: Subscription|undefined|null;\n\n /**\n * Function used for disposing of positining watch\n */\n protected positioningDispose: NoopAction;\n\n /**\n * Popup that is displayed\n */\n protected popup: Popup;\n\n /**\n * Html element of popup plugin\n */\n protected popupElement: HTMLElement;\n\n /**\n * Indication whether is code running in browser\n */\n protected isBrowser: boolean = isPlatformBrowser(this.platformId);\n\n //######################### public properties - implementation of DefaultPositioner #########################\n\n /**\n * Options for NgSelect plugin\n */\n public get options(): DefaultPositionerOptions\n {\n return this.ɵoptions;\n }\n public set options(options: DefaultPositionerOptions)\n {\n this.ɵoptions = extend(true, this.ɵoptions, options);\n }\n\n /**\n * @inheritdoc\n */\n public get flip(): EventEmitter<void>\n {\n return this.ɵflip;\n }\n\n //######################### constructor #########################\n constructor(@Inject(NG_SELECT_PLUGIN_INSTANCES) @Optional() public ngSelectPlugins: NgSelectPluginInstances,\n @Optional() public pluginBus: PluginBus,\n public pluginElement: ElementRef,\n @Inject(POSITION) protected position: Position,\n protected changeDetector: ChangeDetectorRef,\n @Inject(POSITIONER_OPTIONS) @Optional() options?: DefaultPositionerOptions,\n @Inject(PLATFORM_ID) protected platformId?: Object,)\n {\n this.ɵoptions = extend(true, {}, defaultOptions, options);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy()\n {\n this.visibilitySubscription?.unsubscribe();\n this.visibilitySubscription = null;\n\n this.optionsChangeSubscription?.unsubscribe();\n this.optionsChangeSubscription = null;\n\n this.positioningDispose?.();\n\n this.positioningSubscription?.unsubscribe();\n this.positioningSubscription = null;\n }\n\n //######################### public methods - implementation of DefaultPositioner #########################\n\n /**\n * Initialize plugin, to be ready to use, initialize communication with other plugins\n */\n public initialize()\n {\n // if(this.optionsGatherer && this.optionsGatherer != this.pluginBus?.selectOptions.optionsGatherer)\n // {\n // this.optionsChangeSubscription.unsubscribe();\n // this.optionsChangeSubscription = null;\n\n // this.optionsGatherer = null;\n // }\n\n // if(!this.optionsGatherer)\n // {\n // this.optionsGatherer = this.pluginBus?.selectOptions.optionsGatherer;\n\n // this.optionsChangeSubscription = this.optionsGatherer.availableOptionsChange.subscribe(() =>\n // {\n // if(this.popup.popupElement && this.optionsGatherer.availableOptions)\n // {\n // this._handlePosition();\n // }\n // });\n // }\n\n const popup: Popup = this.ngSelectPlugins[POPUP] as Popup;\n\n if(this.popup && this.popup != popup)\n {\n this.visibilitySubscription?.unsubscribe();\n this.visibilitySubscription = null;\n\n this.popup = null;\n }\n\n if(!this.popup)\n {\n this.popup = popup;\n\n this.visibilitySubscription = this.popup.visibilityChange.subscribe(() => this.initPosition());\n }\n\n this.initPosition();\n }\n\n /**\n * @inheritdoc\n */\n public initOptions()\n {\n }\n\n /**\n * @inheritdoc\n */\n public invalidateVisuals(): void\n {\n }\n\n //######################### protected methods #########################\n\n /**\n * Initialize positioning of popup\n */\n protected initPosition()\n {\n this.popupElement = this.popup.popupElement;\n\n // //this has meaning only when popup is outside of ng-element\n // this.changeDetector.markForCheck();\n\n if(this.isBrowser)\n {\n //register events and handle position of opened popup\n if(this.popupElement)\n {\n this.positioningSubscription?.unsubscribe();\n this.positioningDispose?.();\n \n this.positioningSubscription = null;\n this.positioningDispose = null;\n\n this.positioningSubscription = this.position.placeElement(this.popupElement,\n this.pluginBus.selectElement.nativeElement,\n {\n autoUpdate: true,\n flip: true,\n ...this.options.positionOptions\n },)\n .subscribe(result =>\n {\n applyPositionResult(result);\n this.positioningDispose = result.dispose;\n\n if(result.flip)\n {\n this.flip.emit();\n }\n });\n }\n //unregister events\n else\n {\n this.positioningSubscription?.unsubscribe();\n this.positioningDispose?.();\n\n this.positioningSubscription = null;\n this.positioningDispose = null;\n }\n }\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"defaultPositioner.component.js","sourceRoot":"","sources":["../../../../../src/plugins/positioner/default/defaultPositioner.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAa,WAAW,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACrI,OAAO,EAAC,iBAAiB,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Z,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAClD;;0BAyEgB,MAAM;2BAAC,0BAA0B;;0BAAG,QAAQ;;0BAC5C,QAAQ;;0BAER,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,kBAAkB;;0BAAG,QAAQ;;0BACpC,MAAM;2BAAC,WAAW","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, Optional, ElementRef, OnDestroy, PLATFORM_ID, EventEmitter} from '@angular/core';\nimport {isPlatformBrowser} from '@angular/common';\nimport {applyPositionResult, Position, POSITION, PositionOffset, PositionPlacement} from '@anglr/common';\nimport {extend, NoopAction} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DefaultPositionerOptions, DefaultPositioner} from './defaultPositioner.interface';\nimport {NgSelectPlugin, OptionsGatherer} from '../../../misc';\nimport {NgSelectPluginInstances} from '../../../components/select';\nimport {NG_SELECT_PLUGIN_INSTANCES} from '../../../components/select/types';\nimport {POSITIONER_OPTIONS} from '../types';\nimport {Popup} from '../../popup';\nimport {POPUP} from '../../popup/types';\nimport {PluginBus} from '../../../misc/pluginBus/pluginBus';\n\n/**\n * Default options for positioner\n */\nconst defaultOptions: DefaultPositionerOptions =\n{\n positionOptions:\n {\n offset: PositionOffset.None,\n placement: PositionPlacement.BottomStart,\n }\n};\n\n/**\n * Component used for positioning popup element, handles resize, scroll and collision using `Position`\n */\n@Component(\n{\n selector: 'ng-default-positioner',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DefaultPositionerComponent implements DefaultPositioner, NgSelectPlugin<DefaultPositionerOptions>, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Instance of previous options gatherer, that is used for obtaining available options\n */\n protected optionsGatherer: OptionsGatherer;\n\n /**\n * Occurs when flip occured during positining of popup\n */\n protected ɵflip: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * Options for NgSelect plugin\n */\n protected ɵoptions: DefaultPositionerOptions;\n\n /**\n * Subscription for visibility change of popup\n */\n protected visibilitySubscription: Subscription|undefined|null;\n\n /**\n * Subscription for positioning event that occured\n */\n protected positioningSubscription: Subscription|undefined|null;\n\n /**\n * Function used for disposing of positining watch\n */\n protected positioningDispose: NoopAction;\n\n /**\n * Popup that is displayed\n */\n protected popup: Popup;\n\n /**\n * Html element of popup plugin\n */\n protected popupElement: HTMLElement;\n\n /**\n * Indication whether is code running in browser\n */\n protected isBrowser: boolean = isPlatformBrowser(this.platformId);\n\n //######################### public properties - implementation of DefaultPositioner #########################\n\n /**\n * Options for NgSelect plugin\n */\n public get options(): DefaultPositionerOptions\n {\n return this.ɵoptions;\n }\n public set options(options: DefaultPositionerOptions)\n {\n this.ɵoptions = extend(true, this.ɵoptions, options);\n }\n\n /**\n * @inheritdoc\n */\n public get flip(): EventEmitter<void>\n {\n return this.ɵflip;\n }\n\n //######################### constructor #########################\n constructor(@Inject(NG_SELECT_PLUGIN_INSTANCES) @Optional() public ngSelectPlugins: NgSelectPluginInstances,\n @Optional() public pluginBus: PluginBus,\n public pluginElement: ElementRef,\n @Inject(POSITION) protected position: Position,\n @Inject(POSITIONER_OPTIONS) @Optional() options?: DefaultPositionerOptions,\n @Inject(PLATFORM_ID) protected platformId?: Object,)\n {\n this.ɵoptions = extend(true, {}, defaultOptions, options);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy()\n {\n this.visibilitySubscription?.unsubscribe();\n this.visibilitySubscription = null;\n\n this.positioningDispose?.();\n\n this.positioningSubscription?.unsubscribe();\n this.positioningSubscription = null;\n }\n\n //######################### public methods - implementation of DefaultPositioner #########################\n\n /**\n * Initialize plugin, to be ready to use, initialize communication with other plugins\n */\n public initialize()\n {\n const popup: Popup = this.ngSelectPlugins[POPUP] as Popup;\n\n if(this.popup && this.popup != popup)\n {\n this.visibilitySubscription?.unsubscribe();\n this.visibilitySubscription = null;\n\n this.popup = null;\n }\n\n if(!this.popup)\n {\n this.popup = popup;\n\n this.visibilitySubscription = this.popup.visibilityChange.subscribe(() => this.initPosition());\n }\n\n this.initPosition();\n }\n\n /**\n * @inheritdoc\n */\n public initOptions()\n {\n }\n\n /**\n * @inheritdoc\n */\n public invalidateVisuals(): void\n {\n }\n\n //######################### protected methods #########################\n\n /**\n * Initialize positioning of popup\n */\n protected initPosition()\n {\n this.popupElement = this.popup.popupElement;\n\n if(this.isBrowser)\n {\n //register events and handle position of opened popup\n if(this.popupElement)\n {\n this.positioningSubscription?.unsubscribe();\n this.positioningDispose?.();\n \n this.positioningSubscription = null;\n this.positioningDispose = null;\n\n this.positioningSubscription = this.position.placeElement(this.popupElement,\n this.pluginBus.selectElement.nativeElement,\n {\n autoUpdate: true,\n flip: true,\n ...this.options.positionOptions\n },)\n .subscribe(result =>\n {\n applyPositionResult(result);\n this.positioningDispose = result.dispose;\n\n if(result.flip)\n {\n this.flip.emit();\n }\n });\n }\n //unregister events\n else\n {\n this.positioningSubscription?.unsubscribe();\n this.positioningDispose?.();\n\n this.positioningSubscription = null;\n this.positioningDispose = null;\n }\n }\n }\n}"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy, Inject, Optional, ElementRef, PLATFORM_ID,
|
|
1
|
+
import { Component, ChangeDetectionStrategy, Inject, Optional, ElementRef, PLATFORM_ID, EventEmitter } from '@angular/core';
|
|
2
2
|
import { isPlatformBrowser } from '@angular/common';
|
|
3
3
|
import { applyPositionResult, POSITION, PositionOffset, PositionPlacement } from '@anglr/common';
|
|
4
4
|
import { extend } from '@jscrpt/common';
|
|
@@ -22,12 +22,11 @@ const defaultOptions = {
|
|
|
22
22
|
*/
|
|
23
23
|
export class DefaultPositionerComponent {
|
|
24
24
|
//######################### constructor #########################
|
|
25
|
-
constructor(ngSelectPlugins, pluginBus, pluginElement, position,
|
|
25
|
+
constructor(ngSelectPlugins, pluginBus, pluginElement, position, options, platformId) {
|
|
26
26
|
this.ngSelectPlugins = ngSelectPlugins;
|
|
27
27
|
this.pluginBus = pluginBus;
|
|
28
28
|
this.pluginElement = pluginElement;
|
|
29
29
|
this.position = position;
|
|
30
|
-
this.changeDetector = changeDetector;
|
|
31
30
|
this.platformId = platformId;
|
|
32
31
|
/**
|
|
33
32
|
* Occurs when flip occured during positining of popup
|
|
@@ -62,8 +61,6 @@ export class DefaultPositionerComponent {
|
|
|
62
61
|
ngOnDestroy() {
|
|
63
62
|
this.visibilitySubscription?.unsubscribe();
|
|
64
63
|
this.visibilitySubscription = null;
|
|
65
|
-
this.optionsChangeSubscription?.unsubscribe();
|
|
66
|
-
this.optionsChangeSubscription = null;
|
|
67
64
|
this.positioningDispose?.();
|
|
68
65
|
this.positioningSubscription?.unsubscribe();
|
|
69
66
|
this.positioningSubscription = null;
|
|
@@ -73,23 +70,6 @@ export class DefaultPositionerComponent {
|
|
|
73
70
|
* Initialize plugin, to be ready to use, initialize communication with other plugins
|
|
74
71
|
*/
|
|
75
72
|
initialize() {
|
|
76
|
-
// if(this.optionsGatherer && this.optionsGatherer != this.pluginBus?.selectOptions.optionsGatherer)
|
|
77
|
-
// {
|
|
78
|
-
// this.optionsChangeSubscription.unsubscribe();
|
|
79
|
-
// this.optionsChangeSubscription = null;
|
|
80
|
-
// this.optionsGatherer = null;
|
|
81
|
-
// }
|
|
82
|
-
// if(!this.optionsGatherer)
|
|
83
|
-
// {
|
|
84
|
-
// this.optionsGatherer = this.pluginBus?.selectOptions.optionsGatherer;
|
|
85
|
-
// this.optionsChangeSubscription = this.optionsGatherer.availableOptionsChange.subscribe(() =>
|
|
86
|
-
// {
|
|
87
|
-
// if(this.popup.popupElement && this.optionsGatherer.availableOptions)
|
|
88
|
-
// {
|
|
89
|
-
// this._handlePosition();
|
|
90
|
-
// }
|
|
91
|
-
// });
|
|
92
|
-
// }
|
|
93
73
|
const popup = this.ngSelectPlugins[POPUP];
|
|
94
74
|
if (this.popup && this.popup != popup) {
|
|
95
75
|
this.visibilitySubscription?.unsubscribe();
|
|
@@ -118,8 +98,6 @@ export class DefaultPositionerComponent {
|
|
|
118
98
|
*/
|
|
119
99
|
initPosition() {
|
|
120
100
|
this.popupElement = this.popup.popupElement;
|
|
121
|
-
// //this has meaning only when popup is outside of ng-element
|
|
122
|
-
// this.changeDetector.markForCheck();
|
|
123
101
|
if (this.isBrowser) {
|
|
124
102
|
//register events and handle position of opened popup
|
|
125
103
|
if (this.popupElement) {
|
|
@@ -150,7 +128,7 @@ export class DefaultPositionerComponent {
|
|
|
150
128
|
}
|
|
151
129
|
}
|
|
152
130
|
}
|
|
153
|
-
DefaultPositionerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DefaultPositionerComponent, deps: [{ token: NG_SELECT_PLUGIN_INSTANCES, optional: true }, { token: i1.PluginBus, optional: true }, { token: i0.ElementRef }, { token: POSITION }, { token:
|
|
131
|
+
DefaultPositionerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DefaultPositionerComponent, deps: [{ token: NG_SELECT_PLUGIN_INSTANCES, optional: true }, { token: i1.PluginBus, optional: true }, { token: i0.ElementRef }, { token: POSITION }, { token: POSITIONER_OPTIONS, optional: true }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
|
|
154
132
|
DefaultPositionerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: DefaultPositionerComponent, selector: "ng-default-positioner", ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
155
133
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DefaultPositionerComponent, decorators: [{
|
|
156
134
|
type: Component,
|
|
@@ -169,7 +147,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
169
147
|
}] }, { type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
170
148
|
type: Inject,
|
|
171
149
|
args: [POSITION]
|
|
172
|
-
}] }, { type:
|
|
150
|
+
}] }, { type: undefined, decorators: [{
|
|
173
151
|
type: Inject,
|
|
174
152
|
args: [POSITIONER_OPTIONS]
|
|
175
153
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultPositioner.component.js","sourceRoot":"","sources":["../../../../../src/plugins/positioner/default/defaultPositioner.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAa,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACxJ,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,mBAAmB,EAAY,QAAQ,EAAE,cAAc,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACzG,OAAO,EAAC,MAAM,EAAa,MAAM,gBAAgB,CAAC;AAMlD,OAAO,EAAC,0BAA0B,EAAC,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAC,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;;;AAE5D;;GAEG;AACH,MAAM,cAAc,GACpB;IACI,eAAe,EACf;QACI,MAAM,EAAE,cAAc,CAAC,IAAI;QAC3B,SAAS,EAAE,iBAAiB,CAAC,WAAW;KAC3C;CACJ,CAAC;AAEF;;GAEG;AAOH,MAAM,OAAO,0BAA0B;IA4EnC,iEAAiE;IACjE,YAAmE,eAAwC,EAC5E,SAAoB,EAChC,aAAyB,EACJ,QAAkB,EACpC,cAAiC,EACH,OAAkC,EAC3C,UAAmB;QANK,oBAAe,GAAf,eAAe,CAAyB;QAC5E,cAAS,GAAT,SAAS,CAAW;QAChC,kBAAa,GAAb,aAAa,CAAY;QACJ,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AS,CAAC,aAAa,CAAC,aAAa,EAC1C;oBACI,UAAU,EAAE,IAAI;oBAChB,IAAI,EAAE,IAAI;oBACV,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe;iBAClC,CAAE;qBACxD,SAAS,CAAC,MAAM,CAAC,EAAE;oBAEhB,mBAAmB,CAAC,MAAM,CAAC,CAAC;oBAC5B,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC;oBAEzC,IAAG,MAAM,CAAC,IAAI,EACd;wBACI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;qBACpB;gBACL,CAAC,CAAC,CAAC;aACV;YACD,mBAAmB;iBAEnB;gBACI,IAAI,CAAC,uBAAuB,EAAE,WAAW,EAAE,CAAC;gBAC5C,IAAI,CAAC,kBAAkB,EAAE,EAAE,CAAC;gBAE5B,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC;gBACpC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;aAClC;SACJ;IACL,CAAC;;uHA5NQ,0BAA0B,kBA6Ef,0BAA0B,gGAG1B,QAAQ,8CAER,kBAAkB,6BAClB,WAAW;2GAnFtB,0BAA0B,6DAHzB,EAAE;2FAGH,0BAA0B;kBANtC,SAAS;mBACV;oBACI,QAAQ,EAAE,uBAAuB;oBACjC,QAAQ,EAAE,EAAE;oBACZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAClD;;0BA8EgB,MAAM;2BAAC,0BAA0B;;0BAAG,QAAQ;;0BAC5C,QAAQ;;0BAER,MAAM;2BAAC,QAAQ;;0BAEf,MAAM;2BAAC,kBAAkB;;0BAAG,QAAQ;;0BACpC,MAAM;2BAAC,WAAW","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, Optional, ElementRef, OnDestroy, PLATFORM_ID, ChangeDetectorRef, EventEmitter} from '@angular/core';\nimport {isPlatformBrowser} from '@angular/common';\nimport {applyPositionResult, Position, POSITION, PositionOffset, PositionPlacement} from '@anglr/common';\nimport {extend, NoopAction} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DefaultPositionerOptions, DefaultPositioner} from './defaultPositioner.interface';\nimport {NgSelectPlugin, OptionsGatherer} from '../../../misc';\nimport {NgSelectPluginInstances} from '../../../components/select';\nimport {NG_SELECT_PLUGIN_INSTANCES} from '../../../components/select/types';\nimport {POSITIONER_OPTIONS} from '../types';\nimport {Popup} from '../../popup';\nimport {POPUP} from '../../popup/types';\nimport {PluginBus} from '../../../misc/pluginBus/pluginBus';\n\n/**\n * Default options for positioner\n */\nconst defaultOptions: DefaultPositionerOptions =\n{\n positionOptions:\n {\n offset: PositionOffset.None,\n placement: PositionPlacement.BottomStart,\n }\n};\n\n/**\n * Component used for positioning popup element, handles resize, scroll and collision using `Position`\n */\n@Component(\n{\n selector: 'ng-default-positioner',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DefaultPositionerComponent implements DefaultPositioner, NgSelectPlugin<DefaultPositionerOptions>, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Instance of previous options gatherer, that is used for obtaining available options\n */\n protected optionsGatherer: OptionsGatherer;\n\n /**\n * Occurs when flip occured during positining of popup\n */\n protected ɵflip: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * Options for NgSelect plugin\n */\n protected ɵoptions: DefaultPositionerOptions;\n\n /**\n * Subscription for visibility change of popup\n */\n protected visibilitySubscription: Subscription|undefined|null;\n\n /**\n * Subscription for changes of options in options gatherer\n */\n protected optionsChangeSubscription: Subscription|undefined|null;\n\n /**\n * Subscription for positioning event that occured\n */\n protected positioningSubscription: Subscription|undefined|null;\n\n /**\n * Function used for disposing of positining watch\n */\n protected positioningDispose: NoopAction;\n\n /**\n * Popup that is displayed\n */\n protected popup: Popup;\n\n /**\n * Html element of popup plugin\n */\n protected popupElement: HTMLElement;\n\n /**\n * Indication whether is code running in browser\n */\n protected isBrowser: boolean = isPlatformBrowser(this.platformId);\n\n //######################### public properties - implementation of DefaultPositioner #########################\n\n /**\n * Options for NgSelect plugin\n */\n public get options(): DefaultPositionerOptions\n {\n return this.ɵoptions;\n }\n public set options(options: DefaultPositionerOptions)\n {\n this.ɵoptions = extend(true, this.ɵoptions, options);\n }\n\n /**\n * @inheritdoc\n */\n public get flip(): EventEmitter<void>\n {\n return this.ɵflip;\n }\n\n //######################### constructor #########################\n constructor(@Inject(NG_SELECT_PLUGIN_INSTANCES) @Optional() public ngSelectPlugins: NgSelectPluginInstances,\n @Optional() public pluginBus: PluginBus,\n public pluginElement: ElementRef,\n @Inject(POSITION) protected position: Position,\n protected changeDetector: ChangeDetectorRef,\n @Inject(POSITIONER_OPTIONS) @Optional() options?: DefaultPositionerOptions,\n @Inject(PLATFORM_ID) protected platformId?: Object,)\n {\n this.ɵoptions = extend(true, {}, defaultOptions, options);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy()\n {\n this.visibilitySubscription?.unsubscribe();\n this.visibilitySubscription = null;\n\n this.optionsChangeSubscription?.unsubscribe();\n this.optionsChangeSubscription = null;\n\n this.positioningDispose?.();\n\n this.positioningSubscription?.unsubscribe();\n this.positioningSubscription = null;\n }\n\n //######################### public methods - implementation of DefaultPositioner #########################\n\n /**\n * Initialize plugin, to be ready to use, initialize communication with other plugins\n */\n public initialize()\n {\n // if(this.optionsGatherer && this.optionsGatherer != this.pluginBus?.selectOptions.optionsGatherer)\n // {\n // this.optionsChangeSubscription.unsubscribe();\n // this.optionsChangeSubscription = null;\n\n // this.optionsGatherer = null;\n // }\n\n // if(!this.optionsGatherer)\n // {\n // this.optionsGatherer = this.pluginBus?.selectOptions.optionsGatherer;\n\n // this.optionsChangeSubscription = this.optionsGatherer.availableOptionsChange.subscribe(() =>\n // {\n // if(this.popup.popupElement && this.optionsGatherer.availableOptions)\n // {\n // this._handlePosition();\n // }\n // });\n // }\n\n const popup: Popup = this.ngSelectPlugins[POPUP] as Popup;\n\n if(this.popup && this.popup != popup)\n {\n this.visibilitySubscription?.unsubscribe();\n this.visibilitySubscription = null;\n\n this.popup = null;\n }\n\n if(!this.popup)\n {\n this.popup = popup;\n\n this.visibilitySubscription = this.popup.visibilityChange.subscribe(() => this.initPosition());\n }\n\n this.initPosition();\n }\n\n /**\n * @inheritdoc\n */\n public initOptions()\n {\n }\n\n /**\n * @inheritdoc\n */\n public invalidateVisuals(): void\n {\n }\n\n //######################### protected methods #########################\n\n /**\n * Initialize positioning of popup\n */\n protected initPosition()\n {\n this.popupElement = this.popup.popupElement;\n\n // //this has meaning only when popup is outside of ng-element\n // this.changeDetector.markForCheck();\n\n if(this.isBrowser)\n {\n //register events and handle position of opened popup\n if(this.popupElement)\n {\n this.positioningSubscription?.unsubscribe();\n this.positioningDispose?.();\n \n this.positioningSubscription = null;\n this.positioningDispose = null;\n\n this.positioningSubscription = this.position.placeElement(this.popupElement,\n this.pluginBus.selectElement.nativeElement,\n {\n autoUpdate: true,\n flip: true,\n ...this.options.positionOptions\n },)\n .subscribe(result =>\n {\n applyPositionResult(result);\n this.positioningDispose = result.dispose;\n\n if(result.flip)\n {\n this.flip.emit();\n }\n });\n }\n //unregister events\n else\n {\n this.positioningSubscription?.unsubscribe();\n this.positioningDispose?.();\n\n this.positioningSubscription = null;\n this.positioningDispose = null;\n }\n }\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"defaultPositioner.component.js","sourceRoot":"","sources":["../../../../../src/plugins/positioner/default/defaultPositioner.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAa,WAAW,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACrI,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,mBAAmB,EAAY,QAAQ,EAAE,cAAc,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACzG,OAAO,EAAC,MAAM,EAAa,MAAM,gBAAgB,C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pC,MAAM;2BAAC,WAAW","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, Optional, ElementRef, OnDestroy, PLATFORM_ID, EventEmitter} from '@angular/core';\nimport {isPlatformBrowser} from '@angular/common';\nimport {applyPositionResult, Position, POSITION, PositionOffset, PositionPlacement} from '@anglr/common';\nimport {extend, NoopAction} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DefaultPositionerOptions, DefaultPositioner} from './defaultPositioner.interface';\nimport {NgSelectPlugin, OptionsGatherer} from '../../../misc';\nimport {NgSelectPluginInstances} from '../../../components/select';\nimport {NG_SELECT_PLUGIN_INSTANCES} from '../../../components/select/types';\nimport {POSITIONER_OPTIONS} from '../types';\nimport {Popup} from '../../popup';\nimport {POPUP} from '../../popup/types';\nimport {PluginBus} from '../../../misc/pluginBus/pluginBus';\n\n/**\n * Default options for positioner\n */\nconst defaultOptions: DefaultPositionerOptions =\n{\n positionOptions:\n {\n offset: PositionOffset.None,\n placement: PositionPlacement.BottomStart,\n }\n};\n\n/**\n * Component used for positioning popup element, handles resize, scroll and collision using `Position`\n */\n@Component(\n{\n selector: 'ng-default-positioner',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DefaultPositionerComponent implements DefaultPositioner, NgSelectPlugin<DefaultPositionerOptions>, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Instance of previous options gatherer, that is used for obtaining available options\n */\n protected optionsGatherer: OptionsGatherer;\n\n /**\n * Occurs when flip occured during positining of popup\n */\n protected ɵflip: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * Options for NgSelect plugin\n */\n protected ɵoptions: DefaultPositionerOptions;\n\n /**\n * Subscription for visibility change of popup\n */\n protected visibilitySubscription: Subscription|undefined|null;\n\n /**\n * Subscription for positioning event that occured\n */\n protected positioningSubscription: Subscription|undefined|null;\n\n /**\n * Function used for disposing of positining watch\n */\n protected positioningDispose: NoopAction;\n\n /**\n * Popup that is displayed\n */\n protected popup: Popup;\n\n /**\n * Html element of popup plugin\n */\n protected popupElement: HTMLElement;\n\n /**\n * Indication whether is code running in browser\n */\n protected isBrowser: boolean = isPlatformBrowser(this.platformId);\n\n //######################### public properties - implementation of DefaultPositioner #########################\n\n /**\n * Options for NgSelect plugin\n */\n public get options(): DefaultPositionerOptions\n {\n return this.ɵoptions;\n }\n public set options(options: DefaultPositionerOptions)\n {\n this.ɵoptions = extend(true, this.ɵoptions, options);\n }\n\n /**\n * @inheritdoc\n */\n public get flip(): EventEmitter<void>\n {\n return this.ɵflip;\n }\n\n //######################### constructor #########################\n constructor(@Inject(NG_SELECT_PLUGIN_INSTANCES) @Optional() public ngSelectPlugins: NgSelectPluginInstances,\n @Optional() public pluginBus: PluginBus,\n public pluginElement: ElementRef,\n @Inject(POSITION) protected position: Position,\n @Inject(POSITIONER_OPTIONS) @Optional() options?: DefaultPositionerOptions,\n @Inject(PLATFORM_ID) protected platformId?: Object,)\n {\n this.ɵoptions = extend(true, {}, defaultOptions, options);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy()\n {\n this.visibilitySubscription?.unsubscribe();\n this.visibilitySubscription = null;\n\n this.positioningDispose?.();\n\n this.positioningSubscription?.unsubscribe();\n this.positioningSubscription = null;\n }\n\n //######################### public methods - implementation of DefaultPositioner #########################\n\n /**\n * Initialize plugin, to be ready to use, initialize communication with other plugins\n */\n public initialize()\n {\n const popup: Popup = this.ngSelectPlugins[POPUP] as Popup;\n\n if(this.popup && this.popup != popup)\n {\n this.visibilitySubscription?.unsubscribe();\n this.visibilitySubscription = null;\n\n this.popup = null;\n }\n\n if(!this.popup)\n {\n this.popup = popup;\n\n this.visibilitySubscription = this.popup.visibilityChange.subscribe(() => this.initPosition());\n }\n\n this.initPosition();\n }\n\n /**\n * @inheritdoc\n */\n public initOptions()\n {\n }\n\n /**\n * @inheritdoc\n */\n public invalidateVisuals(): void\n {\n }\n\n //######################### protected methods #########################\n\n /**\n * Initialize positioning of popup\n */\n protected initPosition()\n {\n this.popupElement = this.popup.popupElement;\n\n if(this.isBrowser)\n {\n //register events and handle position of opened popup\n if(this.popupElement)\n {\n this.positioningSubscription?.unsubscribe();\n this.positioningDispose?.();\n \n this.positioningSubscription = null;\n this.positioningDispose = null;\n\n this.positioningSubscription = this.position.placeElement(this.popupElement,\n this.pluginBus.selectElement.nativeElement,\n {\n autoUpdate: true,\n flip: true,\n ...this.options.positionOptions\n },)\n .subscribe(result =>\n {\n applyPositionResult(result);\n this.positioningDispose = result.dispose;\n\n if(result.flip)\n {\n this.flip.emit();\n }\n });\n }\n //unregister events\n else\n {\n this.positioningSubscription?.unsubscribe();\n this.positioningDispose?.();\n\n this.positioningSubscription = null;\n this.positioningDispose = null;\n }\n }\n }\n}"]}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementRef, OnDestroy,
|
|
1
|
+
import { ElementRef, OnDestroy, EventEmitter } from '@angular/core';
|
|
2
2
|
import { Position } from '@anglr/common';
|
|
3
3
|
import { NoopAction } from '@jscrpt/common';
|
|
4
4
|
import { Subscription } from 'rxjs';
|
|
@@ -16,7 +16,6 @@ export declare class DefaultPositionerComponent implements DefaultPositioner, Ng
|
|
|
16
16
|
pluginBus: PluginBus;
|
|
17
17
|
pluginElement: ElementRef;
|
|
18
18
|
protected position: Position;
|
|
19
|
-
protected changeDetector: ChangeDetectorRef;
|
|
20
19
|
protected platformId?: Object;
|
|
21
20
|
/**
|
|
22
21
|
* Instance of previous options gatherer, that is used for obtaining available options
|
|
@@ -34,10 +33,6 @@ export declare class DefaultPositionerComponent implements DefaultPositioner, Ng
|
|
|
34
33
|
* Subscription for visibility change of popup
|
|
35
34
|
*/
|
|
36
35
|
protected visibilitySubscription: Subscription | undefined | null;
|
|
37
|
-
/**
|
|
38
|
-
* Subscription for changes of options in options gatherer
|
|
39
|
-
*/
|
|
40
|
-
protected optionsChangeSubscription: Subscription | undefined | null;
|
|
41
36
|
/**
|
|
42
37
|
* Subscription for positioning event that occured
|
|
43
38
|
*/
|
|
@@ -67,7 +62,7 @@ export declare class DefaultPositionerComponent implements DefaultPositioner, Ng
|
|
|
67
62
|
* @inheritdoc
|
|
68
63
|
*/
|
|
69
64
|
get flip(): EventEmitter<void>;
|
|
70
|
-
constructor(ngSelectPlugins: NgSelectPluginInstances, pluginBus: PluginBus, pluginElement: ElementRef, position: Position,
|
|
65
|
+
constructor(ngSelectPlugins: NgSelectPluginInstances, pluginBus: PluginBus, pluginElement: ElementRef, position: Position, options?: DefaultPositionerOptions, platformId?: Object);
|
|
71
66
|
/**
|
|
72
67
|
* Called when component is destroyed
|
|
73
68
|
*/
|
|
@@ -88,7 +83,7 @@ export declare class DefaultPositionerComponent implements DefaultPositioner, Ng
|
|
|
88
83
|
* Initialize positioning of popup
|
|
89
84
|
*/
|
|
90
85
|
protected initPosition(): void;
|
|
91
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultPositionerComponent, [{ optional: true; }, { optional: true; }, null, null,
|
|
86
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DefaultPositionerComponent, [{ optional: true; }, { optional: true; }, null, null, { optional: true; }, null]>;
|
|
92
87
|
static ɵcmp: i0.ɵɵComponentDeclaration<DefaultPositionerComponent, "ng-default-positioner", never, {}, {}, never, never, false, never>;
|
|
93
88
|
}
|
|
94
89
|
//# sourceMappingURL=defaultPositioner.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultPositioner.component.d.ts","sourceRoot":"","sources":["defaultPositioner.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuD,UAAU,EAAE,SAAS,EAAe,
|
|
1
|
+
{"version":3,"file":"defaultPositioner.component.d.ts","sourceRoot":"","sources":["defaultPositioner.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuD,UAAU,EAAE,SAAS,EAAe,YAAY,EAAC,MAAM,eAAe,CAAC;AAErI,OAAO,EAAsB,QAAQ,EAA8C,MAAM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