@firestitch/popover 12.0.0 → 12.0.1

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.
Files changed (33) hide show
  1. package/app/class/popover-ref.d.ts +34 -34
  2. package/app/components/popover/popover.component.d.ts +50 -50
  3. package/app/components/popover-wrapper/popover-wrapper.component.d.ts +39 -39
  4. package/app/enums/position.d.ts +6 -6
  5. package/app/fs-popover.module.d.ts +13 -13
  6. package/app/helpers/create-injector.d.ts +4 -4
  7. package/app/helpers/create-overlay-ref.d.ts +4 -4
  8. package/app/helpers/create-position-strategy.d.ts +4 -4
  9. package/app/helpers/create-template-portal.d.ts +4 -4
  10. package/app/helpers/point-in-rect.d.ts +1 -1
  11. package/app/interfaces/popover-config.interface.d.ts +16 -16
  12. package/app/services/popover.service.d.ts +20 -20
  13. package/bundles/firestitch-popover.umd.js +944 -944
  14. package/bundles/firestitch-popover.umd.js.map +1 -1
  15. package/esm2015/app/class/popover-ref.js +85 -85
  16. package/esm2015/app/components/popover/popover.component.js +190 -190
  17. package/esm2015/app/components/popover-wrapper/popover-wrapper.component.js +118 -118
  18. package/esm2015/app/enums/position.js +7 -7
  19. package/esm2015/app/fs-popover.module.js +43 -43
  20. package/esm2015/app/helpers/create-injector.js +8 -8
  21. package/esm2015/app/helpers/create-overlay-ref.js +11 -11
  22. package/esm2015/app/helpers/create-position-strategy.js +55 -55
  23. package/esm2015/app/helpers/create-template-portal.js +4 -4
  24. package/esm2015/app/helpers/point-in-rect.js +3 -3
  25. package/esm2015/app/interfaces/popover-config.interface.js +1 -1
  26. package/esm2015/app/services/popover.service.js +55 -55
  27. package/esm2015/firestitch-popover.js +4 -4
  28. package/esm2015/public_api.js +8 -7
  29. package/fesm2015/firestitch-popover.js +526 -526
  30. package/fesm2015/firestitch-popover.js.map +1 -1
  31. package/firestitch-popover.d.ts +5 -5
  32. package/package.json +1 -1
  33. package/public_api.d.ts +5 -4
@@ -14,556 +14,556 @@ import { guid } from '@firestitch/common';
14
14
  import * as i1 from '@angular/cdk/overlay';
15
15
  import { OverlayConfig } from '@angular/cdk/overlay';
16
16
 
17
- var Position;
18
- (function (Position) {
19
- Position["North"] = "north";
20
- Position["South"] = "south";
21
- Position["East"] = "east";
22
- Position["West"] = "west";
17
+ var Position;
18
+ (function (Position) {
19
+ Position["North"] = "north";
20
+ Position["South"] = "south";
21
+ Position["East"] = "east";
22
+ Position["West"] = "west";
23
23
  })(Position || (Position = {}));
24
24
 
25
- class FsPopoverRef {
26
- constructor(config = {}) {
27
- this._autoShow$ = new BehaviorSubject(true);
28
- this._autoClose$ = new BehaviorSubject(true);
29
- this._componentLoading$ = new BehaviorSubject(true);
30
- this._init(config);
31
- }
32
- get loadingDiameter() {
33
- return this._loadingDiameter;
34
- }
35
- get size() {
36
- return this._size;
37
- }
38
- get theme() {
39
- return this._theme;
40
- }
41
- get loading() {
42
- return this._loading;
43
- }
44
- get autoShow$() {
45
- return this._autoShow$.asObservable();
46
- }
47
- get autoShow() {
48
- return this._autoShow$.getValue();
49
- }
50
- set autoShow(value) {
51
- this._autoShow$.next(value);
52
- }
53
- get autoClose$() {
54
- return this._autoClose$.asObservable();
55
- }
56
- get autoClose() {
57
- return this._autoClose$.getValue();
58
- }
59
- set autoClose(value) {
60
- this._autoClose$.next(value);
61
- }
62
- get componentVisible$() {
63
- return combineLatest([
64
- this.autoShow$,
65
- this.componentLoading$,
66
- ]).pipe(map(([autoShow, componentLoading]) => {
67
- return autoShow || !componentLoading;
68
- }));
69
- }
70
- get componentLoading$() {
71
- return this._componentLoading$.asObservable();
72
- }
73
- get componentLoading() {
74
- return this._componentLoading$.getValue();
75
- }
76
- get wrapperClass() {
77
- return this._wrapperClass;
78
- }
79
- get maxWidth() {
80
- return this._maxWidth;
81
- }
82
- show() {
83
- setTimeout(() => {
84
- this._componentLoading$.next(false);
85
- setTimeout(() => {
86
- this.updatePosition();
87
- });
88
- });
89
- }
90
- close() {
91
- this.overlayRef.detach();
92
- this._componentLoading$.next(true);
93
- }
94
- updatePosition() {
95
- this.overlayRef.updatePosition();
96
- }
97
- _init(config) {
98
- this._wrapperClass = config.wrapperClass;
99
- this._maxWidth = config.maxWidth;
100
- this._loading = config.loading;
101
- this._loadingDiameter = config.loadingDiameter;
102
- this._size = config.size;
103
- this._theme = config.theme;
104
- this._autoShow$.next(config.autoShow);
105
- this._autoClose$.next(config.autoClose);
106
- }
25
+ class FsPopoverRef {
26
+ constructor(config = {}) {
27
+ this._autoShow$ = new BehaviorSubject(true);
28
+ this._autoClose$ = new BehaviorSubject(true);
29
+ this._componentLoading$ = new BehaviorSubject(true);
30
+ this._init(config);
31
+ }
32
+ get loadingDiameter() {
33
+ return this._loadingDiameter;
34
+ }
35
+ get size() {
36
+ return this._size;
37
+ }
38
+ get theme() {
39
+ return this._theme;
40
+ }
41
+ get loading() {
42
+ return this._loading;
43
+ }
44
+ get autoShow$() {
45
+ return this._autoShow$.asObservable();
46
+ }
47
+ get autoShow() {
48
+ return this._autoShow$.getValue();
49
+ }
50
+ set autoShow(value) {
51
+ this._autoShow$.next(value);
52
+ }
53
+ get autoClose$() {
54
+ return this._autoClose$.asObservable();
55
+ }
56
+ get autoClose() {
57
+ return this._autoClose$.getValue();
58
+ }
59
+ set autoClose(value) {
60
+ this._autoClose$.next(value);
61
+ }
62
+ get componentVisible$() {
63
+ return combineLatest([
64
+ this.autoShow$,
65
+ this.componentLoading$,
66
+ ]).pipe(map(([autoShow, componentLoading]) => {
67
+ return autoShow || !componentLoading;
68
+ }));
69
+ }
70
+ get componentLoading$() {
71
+ return this._componentLoading$.asObservable();
72
+ }
73
+ get componentLoading() {
74
+ return this._componentLoading$.getValue();
75
+ }
76
+ get wrapperClass() {
77
+ return this._wrapperClass;
78
+ }
79
+ get maxWidth() {
80
+ return this._maxWidth;
81
+ }
82
+ show() {
83
+ setTimeout(() => {
84
+ this._componentLoading$.next(false);
85
+ setTimeout(() => {
86
+ this.updatePosition();
87
+ });
88
+ });
89
+ }
90
+ close() {
91
+ this.overlayRef.detach();
92
+ this._componentLoading$.next(true);
93
+ }
94
+ updatePosition() {
95
+ this.overlayRef.updatePosition();
96
+ }
97
+ _init(config) {
98
+ this._wrapperClass = config.wrapperClass;
99
+ this._maxWidth = config.maxWidth;
100
+ this._loading = config.loading;
101
+ this._loadingDiameter = config.loadingDiameter;
102
+ this._size = config.size;
103
+ this._theme = config.theme;
104
+ this._autoShow$.next(config.autoShow);
105
+ this._autoClose$.next(config.autoClose);
106
+ }
107
107
  }
108
108
 
109
- class FsPopoverWrapperComponent extends BasePortalOutlet {
110
- constructor(popoverRef, _el, _zone) {
111
- super();
112
- this.popoverRef = popoverRef;
113
- this._el = _el;
114
- this._zone = _zone;
115
- this.hidden = false;
116
- this._updatePosition = new Subject();
117
- this._destroy$ = new Subject();
118
- this._updateClass();
119
- this.wrapperClass = this.popoverRef.wrapperClass;
120
- this.maxWidth = this.popoverRef.maxWidth;
121
- }
122
- set maxWidth(value) {
123
- this._el.nativeElement.style.maxWidth = value ? value + 'px' : void 0;
124
- }
125
- set wrapperClass(value) {
126
- this._wrapperClass = value;
127
- this._updateClass();
128
- }
129
- ngOnInit() {
130
- if (!this.popoverRef.autoShow && this.popoverRef.componentLoading) {
131
- this._watchMousePosition();
132
- }
133
- this._observeContentChanges();
134
- this._listenUpdatePositionRequests();
135
- }
136
- ngOnDestroy() {
137
- this._contentChangesObserver.disconnect();
138
- this._destroy$.next();
139
- this._destroy$.complete();
140
- }
141
- /**
142
- * Attach a TemplatePortal as content to this popover container.
143
- * @param portal Portal to be attached as the popover content.
144
- */
145
- attachTemplatePortal(portal) {
146
- if (this._portalOutlet.hasAttached()) {
147
- throw Error('Popover template already attached');
148
- }
149
- return this._portalOutlet.attachTemplatePortal(portal);
150
- }
151
- /**
152
- * Attach a ComponentPortal as content to this popover container.
153
- * @param portal Portal to be attached as the popover content.
154
- */
155
- attachComponentPortal(portal) {
156
- if (this._portalOutlet.hasAttached()) {
157
- throw Error('Popover component already attached');
158
- }
159
- return this._portalOutlet.attachComponentPortal(portal);
160
- }
161
- updatePosition() {
162
- this._updatePosition.next();
163
- }
164
- _watchMousePosition() {
165
- const componentVisibilityChange$ = this.popoverRef.componentVisible$
166
- .pipe(filter((value) => value === true));
167
- this._zone.runOutsideAngular(() => {
168
- fromEvent(document, 'mousemove')
169
- .pipe(takeUntil(componentVisibilityChange$), takeUntil(this._destroy$))
170
- .subscribe((e) => {
171
- this.spinner.nativeElement.style.left = e.x + 'px';
172
- this.spinner.nativeElement.style.top = (e.y + 20) + 'px';
173
- });
174
- });
175
- }
176
- _updateClass() {
177
- this.class = ['popover-wrapper', this._wrapperClass].filter(Boolean).join(' ');
178
- }
179
- _observeContentChanges() {
180
- const config = {
181
- childList: true,
182
- subtree: true
183
- };
184
- this._contentChangesObserver = new MutationObserver(() => {
185
- this.updatePosition();
186
- });
187
- this._contentChangesObserver.observe(this._el.nativeElement, config);
188
- }
189
- _listenUpdatePositionRequests() {
190
- this._updatePosition
191
- .pipe(debounceTime(50), takeUntil(this._destroy$))
192
- .subscribe(() => {
193
- this.popoverRef.updatePosition();
194
- });
195
- }
196
- }
197
- FsPopoverWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverWrapperComponent, deps: [{ token: FsPopoverRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
198
- FsPopoverWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsPopoverWrapperComponent, selector: "fs-popover-wrapper", host: { properties: { "class": "this.class" } }, viewQueries: [{ propertyName: "_portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }, { propertyName: "spinner", first: true, predicate: ["spinner"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"wrapper\" [ngClass]=\"{\n 'theme-dark' : popoverRef.theme === 'dark',\n 'size-tiny': popoverRef.size === 'tiny',\n 'size-small': popoverRef.size === 'small',\n 'hidden': !(popoverRef.componentVisible$ | async)\n }\">\n <div class=\"mat-elevation-z4 popover-content\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n\n <div class=\"fs-popover-arrow light\"></div>\n <div class=\"fs-popover-arrow dark\"></div>\n</div>\n\n<div class=\"loading-spinner\"\n #spinner\n *ngIf=\"popoverRef.loading && !(popoverRef.componentVisible$ | async)\"\n [style.marginLeft]=\"(popoverRef.loadingDiameter * -.25) +'px'\">\n <mat-spinner [diameter]=\"popoverRef.loadingDiameter\"></mat-spinner>\n</div>\n", styles: [".wrapper{padding:6px;animation:fadeIn ease .2s}.wrapper.hidden{display:none}.wrapper .popover-content{background:#fff;border-radius:4px;padding:8px;color:#1b1b1b;box-sizing:border-box;overflow:hidden}.wrapper.theme-dark .popover-content{background-color:#707070;color:#fff}.wrapper.size-small .popover-content{font-size:80%}.wrapper.size-tiny .popover-content{font-size:75%}.wrapper .fs-popover-arrow{width:0;height:0;font-size:0;line-height:0;position:absolute;z-index:200;z-index:1}.wrapper .fs-popover-arrow.dark{z-index:0}::ng-deep .fs-popover-top .fs-popover-arrow,::ng-deep .fs-popover-bottom .fs-popover-arrow{border-left:10px solid transparent;border-right:10px solid transparent}::ng-deep .fs-popover-left .fs-popover-arrow,::ng-deep .fs-popover-right .fs-popover-arrow{border-top:10px solid transparent;border-bottom:10px solid transparent}::ng-deep .fs-popover-top .fs-popover-arrow{bottom:-3px;left:calc(50% - 10px);border-top:10px solid #fff}::ng-deep .fs-popover-top .fs-popover-arrow.dark{border-top-color:#dfdfdf40;bottom:-4px}::ng-deep .fs-popover-bottom .fs-popover-arrow{top:-3px;left:calc(50% - 10px);border-bottom:10px solid #fff}::ng-deep .fs-popover-bottom .fs-popover-arrow.dark{border-bottom-color:#dfdfdf40;top:-4px}::ng-deep .fs-popover-left .fs-popover-arrow{left:-3px;top:calc(50% - 10px);border-right:10px solid #fff}::ng-deep .fs-popover-left .fs-popover-arrow.dark{border-right-color:#dfdfdf40;left:-4px}::ng-deep .fs-popover-right .fs-popover-arrow{right:-3px;top:calc(50% - 10px);border-left:10px solid #fff}::ng-deep .fs-popover-right .fs-popover-arrow.dark{border-left-color:#dfdfdf40;right:-4px}::ng-deep .fs-popover-bottom .wrapper.theme-dark .fs-popover-arrow{border-bottom-color:#707070}::ng-deep .fs-popover-left .wrapper.theme-dark .fs-popover-arrow{border-right-color:#707070}::ng-deep .fs-popover-right .wrapper.theme-dark .fs-popover-arrow{border-left-color:#707070}::ng-deep .fs-popover-top .wrapper.theme-dark .fs-popover-arrow{border-top-color:#707070}.loading-spinner{margin-top:10px}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}\n"], components: [{ type: i2.MatSpinner, selector: "mat-spinner", inputs: ["color"] }], directives: [{ type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
199
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverWrapperComponent, decorators: [{
200
- type: Component,
201
- args: [{
202
- selector: 'fs-popover-wrapper',
203
- templateUrl: 'popover-wrapper.component.html',
204
- styleUrls: ['popover-wrapper.component.scss'],
205
- changeDetection: ChangeDetectionStrategy.OnPush,
206
- }]
207
- }], ctorParameters: function () { return [{ type: FsPopoverRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { _portalOutlet: [{
208
- type: ViewChild,
209
- args: [CdkPortalOutlet, { static: true }]
210
- }], spinner: [{
211
- type: ViewChild,
212
- args: ['spinner']
213
- }], class: [{
214
- type: HostBinding,
215
- args: ['class']
109
+ class FsPopoverWrapperComponent extends BasePortalOutlet {
110
+ constructor(popoverRef, _el, _zone) {
111
+ super();
112
+ this.popoverRef = popoverRef;
113
+ this._el = _el;
114
+ this._zone = _zone;
115
+ this.hidden = false;
116
+ this._updatePosition = new Subject();
117
+ this._destroy$ = new Subject();
118
+ this._updateClass();
119
+ this.wrapperClass = this.popoverRef.wrapperClass;
120
+ this.maxWidth = this.popoverRef.maxWidth;
121
+ }
122
+ set maxWidth(value) {
123
+ this._el.nativeElement.style.maxWidth = value ? value + 'px' : void 0;
124
+ }
125
+ set wrapperClass(value) {
126
+ this._wrapperClass = value;
127
+ this._updateClass();
128
+ }
129
+ ngOnInit() {
130
+ if (!this.popoverRef.autoShow && this.popoverRef.componentLoading) {
131
+ this._watchMousePosition();
132
+ }
133
+ this._observeContentChanges();
134
+ this._listenUpdatePositionRequests();
135
+ }
136
+ ngOnDestroy() {
137
+ this._contentChangesObserver.disconnect();
138
+ this._destroy$.next();
139
+ this._destroy$.complete();
140
+ }
141
+ /**
142
+ * Attach a TemplatePortal as content to this popover container.
143
+ * @param portal Portal to be attached as the popover content.
144
+ */
145
+ attachTemplatePortal(portal) {
146
+ if (this._portalOutlet.hasAttached()) {
147
+ throw Error('Popover template already attached');
148
+ }
149
+ return this._portalOutlet.attachTemplatePortal(portal);
150
+ }
151
+ /**
152
+ * Attach a ComponentPortal as content to this popover container.
153
+ * @param portal Portal to be attached as the popover content.
154
+ */
155
+ attachComponentPortal(portal) {
156
+ if (this._portalOutlet.hasAttached()) {
157
+ throw Error('Popover component already attached');
158
+ }
159
+ return this._portalOutlet.attachComponentPortal(portal);
160
+ }
161
+ updatePosition() {
162
+ this._updatePosition.next();
163
+ }
164
+ _watchMousePosition() {
165
+ const componentVisibilityChange$ = this.popoverRef.componentVisible$
166
+ .pipe(filter((value) => value === true));
167
+ this._zone.runOutsideAngular(() => {
168
+ fromEvent(document, 'mousemove')
169
+ .pipe(takeUntil(componentVisibilityChange$), takeUntil(this._destroy$))
170
+ .subscribe((e) => {
171
+ this.spinner.nativeElement.style.left = e.x + 'px';
172
+ this.spinner.nativeElement.style.top = (e.y + 20) + 'px';
173
+ });
174
+ });
175
+ }
176
+ _updateClass() {
177
+ this.class = ['popover-wrapper', this._wrapperClass].filter(Boolean).join(' ');
178
+ }
179
+ _observeContentChanges() {
180
+ const config = {
181
+ childList: true,
182
+ subtree: true
183
+ };
184
+ this._contentChangesObserver = new MutationObserver(() => {
185
+ this.updatePosition();
186
+ });
187
+ this._contentChangesObserver.observe(this._el.nativeElement, config);
188
+ }
189
+ _listenUpdatePositionRequests() {
190
+ this._updatePosition
191
+ .pipe(debounceTime(50), takeUntil(this._destroy$))
192
+ .subscribe(() => {
193
+ this.popoverRef.updatePosition();
194
+ });
195
+ }
196
+ }
197
+ FsPopoverWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverWrapperComponent, deps: [{ token: FsPopoverRef }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
198
+ FsPopoverWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsPopoverWrapperComponent, selector: "fs-popover-wrapper", host: { properties: { "class": "this.class" } }, viewQueries: [{ propertyName: "_portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }, { propertyName: "spinner", first: true, predicate: ["spinner"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"wrapper\" [ngClass]=\"{\n 'theme-dark' : popoverRef.theme === 'dark',\n 'size-tiny': popoverRef.size === 'tiny',\n 'size-small': popoverRef.size === 'small',\n 'hidden': !(popoverRef.componentVisible$ | async)\n }\">\n <div class=\"mat-elevation-z4 popover-content\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n\n <div class=\"fs-popover-arrow light\"></div>\n <div class=\"fs-popover-arrow dark\"></div>\n</div>\n\n<div class=\"loading-spinner\"\n #spinner\n *ngIf=\"popoverRef.loading && !(popoverRef.componentVisible$ | async)\"\n [style.marginLeft]=\"(popoverRef.loadingDiameter * -.25) +'px'\">\n <mat-spinner [diameter]=\"popoverRef.loadingDiameter\"></mat-spinner>\n</div>\n", styles: [".wrapper{padding:6px;animation:fadeIn ease .2s}.wrapper.hidden{display:none}.wrapper .popover-content{background:#fff;border-radius:4px;padding:8px;color:#1b1b1b;box-sizing:border-box;overflow:hidden}.wrapper.theme-dark .popover-content{background-color:#707070;color:#fff}.wrapper.size-small .popover-content{font-size:80%}.wrapper.size-tiny .popover-content{font-size:75%}.wrapper .fs-popover-arrow{width:0;height:0;font-size:0;line-height:0;position:absolute;z-index:200;z-index:1}.wrapper .fs-popover-arrow.dark{z-index:0}::ng-deep .fs-popover-top .fs-popover-arrow,::ng-deep .fs-popover-bottom .fs-popover-arrow{border-left:10px solid transparent;border-right:10px solid transparent}::ng-deep .fs-popover-left .fs-popover-arrow,::ng-deep .fs-popover-right .fs-popover-arrow{border-top:10px solid transparent;border-bottom:10px solid transparent}::ng-deep .fs-popover-top .fs-popover-arrow{bottom:-3px;left:calc(50% - 10px);border-top:10px solid #fff}::ng-deep .fs-popover-top .fs-popover-arrow.dark{border-top-color:#dfdfdf40;bottom:-4px}::ng-deep .fs-popover-bottom .fs-popover-arrow{top:-3px;left:calc(50% - 10px);border-bottom:10px solid #fff}::ng-deep .fs-popover-bottom .fs-popover-arrow.dark{border-bottom-color:#dfdfdf40;top:-4px}::ng-deep .fs-popover-left .fs-popover-arrow{left:-3px;top:calc(50% - 10px);border-right:10px solid #fff}::ng-deep .fs-popover-left .fs-popover-arrow.dark{border-right-color:#dfdfdf40;left:-4px}::ng-deep .fs-popover-right .fs-popover-arrow{right:-3px;top:calc(50% - 10px);border-left:10px solid #fff}::ng-deep .fs-popover-right .fs-popover-arrow.dark{border-left-color:#dfdfdf40;right:-4px}::ng-deep .fs-popover-bottom .wrapper.theme-dark .fs-popover-arrow{border-bottom-color:#707070}::ng-deep .fs-popover-left .wrapper.theme-dark .fs-popover-arrow{border-right-color:#707070}::ng-deep .fs-popover-right .wrapper.theme-dark .fs-popover-arrow{border-left-color:#707070}::ng-deep .fs-popover-top .wrapper.theme-dark .fs-popover-arrow{border-top-color:#707070}.loading-spinner{margin-top:10px}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}\n"], components: [{ type: i2.MatSpinner, selector: "mat-spinner", inputs: ["color"] }], directives: [{ type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i3.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
199
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverWrapperComponent, decorators: [{
200
+ type: Component,
201
+ args: [{
202
+ selector: 'fs-popover-wrapper',
203
+ templateUrl: 'popover-wrapper.component.html',
204
+ styleUrls: ['popover-wrapper.component.scss'],
205
+ changeDetection: ChangeDetectionStrategy.OnPush,
206
+ }]
207
+ }], ctorParameters: function () { return [{ type: FsPopoverRef }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { _portalOutlet: [{
208
+ type: ViewChild,
209
+ args: [CdkPortalOutlet, { static: true }]
210
+ }], spinner: [{
211
+ type: ViewChild,
212
+ args: ['spinner']
213
+ }], class: [{
214
+ type: HostBinding,
215
+ args: ['class']
216
216
  }] } });
217
217
 
218
- function createPopupPositionStrategy(el, overlay, position) {
219
- let overlayX = 'center';
220
- let overlayY = 'center';
221
- let originX = 'center';
222
- let originY = 'center';
223
- let offsetX = 0;
224
- let offsetY = 0;
225
- let panelClass = [];
226
- switch (position) {
227
- case Position.North:
228
- originY = 'top';
229
- overlayY = 'bottom';
230
- panelClass = ['fs-popover-top'];
231
- offsetY = -8;
232
- break;
233
- case Position.South:
234
- originY = 'bottom';
235
- overlayY = 'top';
236
- panelClass = ['fs-popover-bottom'];
237
- offsetY = 8;
238
- break;
239
- case Position.East:
240
- overlayX = 'start';
241
- originX = 'end';
242
- panelClass = ['fs-popover-left'];
243
- offsetX = 8;
244
- break;
245
- case Position.West:
246
- overlayX = 'end';
247
- originX = 'start';
248
- panelClass = ['fs-popover-right'];
249
- offsetX = -8;
250
- break;
251
- }
252
- return createBasePopupPositionStrategy(el, overlay)
253
- .withPositions([
254
- {
255
- originX: originX,
256
- originY: originY,
257
- overlayX: overlayX,
258
- overlayY: overlayY,
259
- offsetX: offsetX,
260
- offsetY: offsetY,
261
- panelClass: panelClass,
262
- }
263
- ]);
264
- }
265
- function createBasePopupPositionStrategy(el, overlay) {
266
- return overlay.position()
267
- .flexibleConnectedTo(el)
268
- .withGrowAfterOpen(true)
269
- .withFlexibleDimensions(false)
270
- .withViewportMargin(4);
218
+ function createPopupPositionStrategy(el, overlay, position) {
219
+ let overlayX = 'center';
220
+ let overlayY = 'center';
221
+ let originX = 'center';
222
+ let originY = 'center';
223
+ let offsetX = 0;
224
+ let offsetY = 0;
225
+ let panelClass = [];
226
+ switch (position) {
227
+ case Position.North:
228
+ originY = 'top';
229
+ overlayY = 'bottom';
230
+ panelClass = ['fs-popover-top'];
231
+ offsetY = -8;
232
+ break;
233
+ case Position.South:
234
+ originY = 'bottom';
235
+ overlayY = 'top';
236
+ panelClass = ['fs-popover-bottom'];
237
+ offsetY = 8;
238
+ break;
239
+ case Position.East:
240
+ overlayX = 'start';
241
+ originX = 'end';
242
+ panelClass = ['fs-popover-left'];
243
+ offsetX = 8;
244
+ break;
245
+ case Position.West:
246
+ overlayX = 'end';
247
+ originX = 'start';
248
+ panelClass = ['fs-popover-right'];
249
+ offsetX = -8;
250
+ break;
251
+ }
252
+ return createBasePopupPositionStrategy(el, overlay)
253
+ .withPositions([
254
+ {
255
+ originX: originX,
256
+ originY: originY,
257
+ overlayX: overlayX,
258
+ overlayY: overlayY,
259
+ offsetX: offsetX,
260
+ offsetY: offsetY,
261
+ panelClass: panelClass,
262
+ }
263
+ ]);
264
+ }
265
+ function createBasePopupPositionStrategy(el, overlay) {
266
+ return overlay.position()
267
+ .flexibleConnectedTo(el)
268
+ .withGrowAfterOpen(true)
269
+ .withFlexibleDimensions(false)
270
+ .withViewportMargin(4);
271
271
  }
272
272
 
273
- function createOverlayRef(el, overlay, position) {
274
- const config = {
275
- positionStrategy: createPopupPositionStrategy(el, overlay, position),
276
- scrollStrategy: overlay.scrollStrategies.reposition(),
277
- hasBackdrop: false
278
- };
279
- const overlayConfig = new OverlayConfig(config);
280
- return overlay.create(overlayConfig);
273
+ function createOverlayRef(el, overlay, position) {
274
+ const config = {
275
+ positionStrategy: createPopupPositionStrategy(el, overlay, position),
276
+ scrollStrategy: overlay.scrollStrategies.reposition(),
277
+ hasBackdrop: false
278
+ };
279
+ const overlayConfig = new OverlayConfig(config);
280
+ return overlay.create(overlayConfig);
281
281
  }
282
282
 
283
- function createInjector(popoverRef, parentInjector) {
284
- const injectionTokens = new WeakMap([
285
- [FsPopoverRef, popoverRef],
286
- ]);
287
- return new PortalInjector(parentInjector, injectionTokens);
283
+ function createInjector(popoverRef, parentInjector) {
284
+ const injectionTokens = new WeakMap([
285
+ [FsPopoverRef, popoverRef],
286
+ ]);
287
+ return new PortalInjector(parentInjector, injectionTokens);
288
288
  }
289
289
 
290
- function createTempatePortal(template, popoverRef, data) {
291
- return new TemplatePortal(template, void 0, { data: data, popover: popoverRef });
290
+ function createTempatePortal(template, popoverRef, data) {
291
+ return new TemplatePortal(template, void 0, { data: data, popover: popoverRef });
292
292
  }
293
293
 
294
- class FsPopoverService {
295
- constructor(_injector, _overlay) {
296
- this._injector = _injector;
297
- this._overlay = _overlay;
298
- }
299
- get hasActivePopover() {
300
- return !!this._activeElement;
301
- }
302
- get activeElementGUID() {
303
- return this._activeElementGUID;
304
- }
305
- setActivePopoverGUID(value) {
306
- this._activeElementGUID = value;
307
- }
308
- openPopover(el, template, data, popoverRef, position) {
309
- if (this._activeElement) {
310
- this.close(this._activeElement.popoverRef);
311
- }
312
- const overlayRef = createOverlayRef(el, this._overlay, position);
313
- const containerRef = this._openPortalPreview(FsPopoverWrapperComponent, overlayRef, popoverRef);
314
- const templatePortal = createTempatePortal(template, popoverRef, data);
315
- containerRef.instance.attachTemplatePortal(templatePortal);
316
- popoverRef.overlayRef = overlayRef;
317
- this._activeElement = {
318
- overlayRef,
319
- popoverRef,
320
- };
321
- return containerRef.location.nativeElement;
322
- }
323
- close(popoverRef = null) {
324
- if (this._activeElement.popoverRef === popoverRef) {
325
- popoverRef.close();
326
- this._activeElement = void 0;
327
- this._activeElementGUID = void 0;
328
- }
329
- }
330
- _openPortalPreview(component, overlayRef, popoverRef) {
331
- const containerPortal = new ComponentPortal(component, void 0, createInjector(popoverRef, this._injector));
332
- return overlayRef.attach(containerPortal);
333
- }
334
- }
335
- FsPopoverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverService, deps: [{ token: i0.Injector }, { token: i1.Overlay }], target: i0.ɵɵFactoryTarget.Injectable });
336
- FsPopoverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverService });
337
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverService, decorators: [{
338
- type: Injectable
294
+ class FsPopoverService {
295
+ constructor(_injector, _overlay) {
296
+ this._injector = _injector;
297
+ this._overlay = _overlay;
298
+ }
299
+ get hasActivePopover() {
300
+ return !!this._activeElement;
301
+ }
302
+ get activeElementGUID() {
303
+ return this._activeElementGUID;
304
+ }
305
+ setActivePopoverGUID(value) {
306
+ this._activeElementGUID = value;
307
+ }
308
+ openPopover(el, template, data, popoverRef, position) {
309
+ if (this._activeElement) {
310
+ this.close(this._activeElement.popoverRef);
311
+ }
312
+ const overlayRef = createOverlayRef(el, this._overlay, position);
313
+ const containerRef = this._openPortalPreview(FsPopoverWrapperComponent, overlayRef, popoverRef);
314
+ const templatePortal = createTempatePortal(template, popoverRef, data);
315
+ containerRef.instance.attachTemplatePortal(templatePortal);
316
+ popoverRef.overlayRef = overlayRef;
317
+ this._activeElement = {
318
+ overlayRef,
319
+ popoverRef,
320
+ };
321
+ return containerRef.location.nativeElement;
322
+ }
323
+ close(popoverRef = null) {
324
+ if (this._activeElement.popoverRef === popoverRef) {
325
+ popoverRef.close();
326
+ this._activeElement = void 0;
327
+ this._activeElementGUID = void 0;
328
+ }
329
+ }
330
+ _openPortalPreview(component, overlayRef, popoverRef) {
331
+ const containerPortal = new ComponentPortal(component, void 0, createInjector(popoverRef, this._injector));
332
+ return overlayRef.attach(containerPortal);
333
+ }
334
+ }
335
+ FsPopoverService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverService, deps: [{ token: i0.Injector }, { token: i1.Overlay }], target: i0.ɵɵFactoryTarget.Injectable });
336
+ FsPopoverService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverService });
337
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverService, decorators: [{
338
+ type: Injectable
339
339
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.Overlay }]; } });
340
340
 
341
- function pointInRect(x1, y1, x2, y2, px, py) {
342
- return (px > x1 && px < x2) && (py > y1 && py < y2);
341
+ function pointInRect(x1, y1, x2, y2, px, py) {
342
+ return (px > x1 && px < x2) && (py > y1 && py < y2);
343
343
  }
344
344
 
345
- class FsPopoverComponent {
346
- constructor(_elRef, _popoverService, _ngZone, _router) {
347
- this._elRef = _elRef;
348
- this._popoverService = _popoverService;
349
- this._ngZone = _ngZone;
350
- this._router = _router;
351
- this._guid = guid('xxxxxxx');
352
- this.leaveDelay = 100;
353
- this.showDelay = 0;
354
- this.maxWidth = 250;
355
- this.autoShow = true;
356
- this.autoClose = true;
357
- this.loadingDiameter = 20;
358
- this.loading = true;
359
- this.indication = true;
360
- this.position = Position.South;
361
- this.theme = 'light';
362
- this.size = 'normal';
363
- this.trigger = 'mouseover';
364
- this._mouseEnter$ = fromEvent(this._elRef.nativeElement, 'mouseenter');
365
- this._mouseMove$ = fromEvent(document, 'mousemove', { passive: true });
366
- this._mouseLeave$ = fromEvent(this._elRef.nativeElement, 'mouseleave');
367
- this._popoverClosed$ = new Subject();
368
- this._destroy$ = new Subject();
369
- }
370
- get openTimer$() {
371
- return timer(this.showDelay);
372
- }
373
- get closeTimer$() {
374
- return timer(this.leaveDelay);
375
- }
376
- ngOnInit() {
377
- this._popoverRef = new FsPopoverRef({
378
- maxWidth: this.maxWidth,
379
- wrapperClass: this.wrapperClass,
380
- autoShow: this.autoShow,
381
- autoClose: this.autoClose,
382
- loadingDiameter: this.loadingDiameter,
383
- loading: this.loading,
384
- size: this.size,
385
- theme: this.theme,
386
- });
387
- this._ngZone.runOutsideAngular(() => {
388
- if (this.trigger === 'click') {
389
- this._listenMouseHostClick();
390
- }
391
- else {
392
- this._listenMouseHostEnter();
393
- }
394
- });
395
- this._listenRouteChange();
396
- }
397
- ngOnDestroy() {
398
- this._popoverClosed$.next();
399
- this._destroy$.next();
400
- }
401
- _closePopover() {
402
- this._popoverClosed$.next();
403
- this._ngZone.run(() => {
404
- this._wrapperElement = null;
405
- if (this._popoverService.hasActivePopover) {
406
- this._popoverService.close(this._popoverRef);
407
- }
408
- });
409
- }
410
- _listenRouteChange() {
411
- this._router.events
412
- .pipe(filter((event) => {
413
- return event instanceof NavigationEnd;
414
- }), pipe(takeUntil(this._destroy$
415
- .pipe(delay(200)))))
416
- .subscribe(() => {
417
- this._closePopover();
418
- });
419
- }
420
- _listenMouseHostClick() {
421
- fromEvent(this._elRef.nativeElement, 'click', { passive: true })
422
- .pipe(tap((e) => {
423
- e.stopPropagation();
424
- this._openPopover();
425
- }), switchMap(() => this._listenMouseHostLeave$()), switchMap(() => this.closeTimer$), takeUntil(this._destroy$))
426
- .subscribe(() => {
427
- this._closePopover();
428
- });
429
- }
430
- _listenMouseHostEnter() {
431
- const actualMouseState$ = merge(this._mouseLeave$.pipe(mapTo(true)), this._mouseEnter$.pipe(mapTo(false)))
432
- .pipe(startWith(false), distinctUntilChanged());
433
- this._mouseEnter$
434
- .pipe(filter(() => {
435
- return !this._wrapperElement;
436
- }), tap(() => {
437
- this._popoverService.setActivePopoverGUID(this._guid);
438
- }), switchMap(() => this.openTimer$),
439
- // we have to check that after all delays mouse still over an elemen
440
- withLatestFrom(actualMouseState$), filter(([_, mouseLeave]) => {
441
- return !mouseLeave;
442
- }), tap(() => this._openPopover()), switchMap(() => this._listenMouseHostLeave$()), switchMap(() => this.closeTimer$), tap(() => this._closePopover()), finalize(() => this._closePopover()), takeUntil(this._destroy$))
443
- .subscribe();
444
- }
445
- _openPopover() {
446
- if (this.trigger === 'mouseover' && this._popoverService.activeElementGUID !== this._guid) {
447
- return;
448
- }
449
- this._hostBounds = this._elRef.nativeElement.getBoundingClientRect();
450
- this._ngZone.run(() => {
451
- this._wrapperElement = this._popoverService.openPopover(this._elRef, this.template, this.data, this._popoverRef, this.position);
452
- });
453
- }
454
- _listenMouseHostLeave$() {
455
- const mouseMove$ = this._mouseMove$
456
- .pipe(debounceTime(50), filter(() => !!this._wrapperElement), filter((event) => {
457
- return this._popoverRef.autoClose && this._mouseLeftTheTargets(event);
458
- }));
459
- const mouseClick$ = fromEvent(this._elRef.nativeElement, 'click');
460
- return merge(mouseMove$, mouseClick$);
461
- //
462
- // return this._mouseLeave$
463
- // .pipe(
464
- // //
465
- // timeoutWith(200, mouseMove$),
466
- // );
467
- }
468
- // Check if mouse left target or popover rects
469
- _mouseLeftTheTargets(event) {
470
- const hostBounds = this._hostBounds;
471
- const popoverBounds = this._wrapperElement.getBoundingClientRect();
472
- const pointInHostRect = pointInRect(hostBounds.x, hostBounds.y, hostBounds.x + hostBounds.width, hostBounds.y + hostBounds.height, event.x, event.y);
473
- const pointInPopoverRect = pointInRect(popoverBounds.x, popoverBounds.y, popoverBounds.x + popoverBounds.width, popoverBounds.y + popoverBounds.height, event.x, event.y);
474
- return !pointInHostRect && !pointInPopoverRect;
475
- }
476
- }
477
- FsPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverComponent, deps: [{ token: i0.ElementRef }, { token: FsPopoverService }, { token: i0.NgZone }, { token: i2$1.Router, optional: true }], target: i0.ɵɵFactoryTarget.Component });
478
- FsPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsPopoverComponent, selector: "fs-popover", inputs: { template: "template", data: "data", leaveDelay: "leaveDelay", showDelay: "showDelay", maxWidth: "maxWidth", wrapperClass: "wrapperClass", autoShow: "autoShow", autoClose: "autoClose", loadingDiameter: "loadingDiameter", loading: "loading", indication: "indication", position: "position", theme: "theme", size: "size", trigger: "trigger" }, host: { properties: { "class.indication": "this.indication" } }, ngImport: i0, template: "<ng-content></ng-content>\n<!-- <div class=\"line-container\">\n <div class=\"line\"></div>\n</div> -->\n\n<div class=\"line\"></div>\n\n", styles: [":host{display:inline-flex;cursor:pointer;position:relative}::ng-deep fs-popover.indication .line{width:100%;bottom:0;border-bottom:1px dashed #ccc;position:absolute;opacity:.6}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
479
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverComponent, decorators: [{
480
- type: Component,
481
- args: [{
482
- selector: 'fs-popover',
483
- templateUrl: 'popover.component.html',
484
- styleUrls: ['popover.component.scss'],
485
- changeDetection: ChangeDetectionStrategy.OnPush
486
- }]
487
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FsPopoverService }, { type: i0.NgZone }, { type: i2$1.Router, decorators: [{
488
- type: Optional
489
- }] }]; }, propDecorators: { template: [{
490
- type: Input
491
- }], data: [{
492
- type: Input
493
- }], leaveDelay: [{
494
- type: Input
495
- }], showDelay: [{
496
- type: Input
497
- }], maxWidth: [{
498
- type: Input
499
- }], wrapperClass: [{
500
- type: Input
501
- }], autoShow: [{
502
- type: Input
503
- }], autoClose: [{
504
- type: Input
505
- }], loadingDiameter: [{
506
- type: Input
507
- }], loading: [{
508
- type: Input
509
- }], indication: [{
510
- type: Input
511
- }, {
512
- type: HostBinding,
513
- args: ['class.indication']
514
- }], position: [{
515
- type: Input
516
- }], theme: [{
517
- type: Input
518
- }], size: [{
519
- type: Input
520
- }], trigger: [{
521
- type: Input
345
+ class FsPopoverComponent {
346
+ constructor(_elRef, _popoverService, _ngZone, _router) {
347
+ this._elRef = _elRef;
348
+ this._popoverService = _popoverService;
349
+ this._ngZone = _ngZone;
350
+ this._router = _router;
351
+ this._guid = guid('xxxxxxx');
352
+ this.leaveDelay = 100;
353
+ this.showDelay = 0;
354
+ this.maxWidth = 250;
355
+ this.autoShow = true;
356
+ this.autoClose = true;
357
+ this.loadingDiameter = 20;
358
+ this.loading = true;
359
+ this.indication = true;
360
+ this.position = Position.South;
361
+ this.theme = 'light';
362
+ this.size = 'normal';
363
+ this.trigger = 'mouseover';
364
+ this._mouseEnter$ = fromEvent(this._elRef.nativeElement, 'mouseenter');
365
+ this._mouseMove$ = fromEvent(document, 'mousemove', { passive: true });
366
+ this._mouseLeave$ = fromEvent(this._elRef.nativeElement, 'mouseleave');
367
+ this._popoverClosed$ = new Subject();
368
+ this._destroy$ = new Subject();
369
+ }
370
+ get openTimer$() {
371
+ return timer(this.showDelay);
372
+ }
373
+ get closeTimer$() {
374
+ return timer(this.leaveDelay);
375
+ }
376
+ ngOnInit() {
377
+ this._popoverRef = new FsPopoverRef({
378
+ maxWidth: this.maxWidth,
379
+ wrapperClass: this.wrapperClass,
380
+ autoShow: this.autoShow,
381
+ autoClose: this.autoClose,
382
+ loadingDiameter: this.loadingDiameter,
383
+ loading: this.loading,
384
+ size: this.size,
385
+ theme: this.theme,
386
+ });
387
+ this._ngZone.runOutsideAngular(() => {
388
+ if (this.trigger === 'click') {
389
+ this._listenMouseHostClick();
390
+ }
391
+ else {
392
+ this._listenMouseHostEnter();
393
+ }
394
+ });
395
+ this._listenRouteChange();
396
+ }
397
+ ngOnDestroy() {
398
+ this._popoverClosed$.next();
399
+ this._destroy$.next();
400
+ }
401
+ _closePopover() {
402
+ this._popoverClosed$.next();
403
+ this._ngZone.run(() => {
404
+ this._wrapperElement = null;
405
+ if (this._popoverService.hasActivePopover) {
406
+ this._popoverService.close(this._popoverRef);
407
+ }
408
+ });
409
+ }
410
+ _listenRouteChange() {
411
+ this._router.events
412
+ .pipe(filter((event) => {
413
+ return event instanceof NavigationEnd;
414
+ }), pipe(takeUntil(this._destroy$
415
+ .pipe(delay(200)))))
416
+ .subscribe(() => {
417
+ this._closePopover();
418
+ });
419
+ }
420
+ _listenMouseHostClick() {
421
+ fromEvent(this._elRef.nativeElement, 'click', { passive: true })
422
+ .pipe(tap((e) => {
423
+ e.stopPropagation();
424
+ this._openPopover();
425
+ }), switchMap(() => this._listenMouseHostLeave$()), switchMap(() => this.closeTimer$), takeUntil(this._destroy$))
426
+ .subscribe(() => {
427
+ this._closePopover();
428
+ });
429
+ }
430
+ _listenMouseHostEnter() {
431
+ const actualMouseState$ = merge(this._mouseLeave$.pipe(mapTo(true)), this._mouseEnter$.pipe(mapTo(false)))
432
+ .pipe(startWith(false), distinctUntilChanged());
433
+ this._mouseEnter$
434
+ .pipe(filter(() => {
435
+ return !this._wrapperElement;
436
+ }), tap(() => {
437
+ this._popoverService.setActivePopoverGUID(this._guid);
438
+ }), switchMap(() => this.openTimer$),
439
+ // we have to check that after all delays mouse still over an elemen
440
+ withLatestFrom(actualMouseState$), filter(([_, mouseLeave]) => {
441
+ return !mouseLeave;
442
+ }), tap(() => this._openPopover()), switchMap(() => this._listenMouseHostLeave$()), switchMap(() => this.closeTimer$), tap(() => this._closePopover()), finalize(() => this._closePopover()), takeUntil(this._destroy$))
443
+ .subscribe();
444
+ }
445
+ _openPopover() {
446
+ if (this.trigger === 'mouseover' && this._popoverService.activeElementGUID !== this._guid) {
447
+ return;
448
+ }
449
+ this._hostBounds = this._elRef.nativeElement.getBoundingClientRect();
450
+ this._ngZone.run(() => {
451
+ this._wrapperElement = this._popoverService.openPopover(this._elRef, this.template, this.data, this._popoverRef, this.position);
452
+ });
453
+ }
454
+ _listenMouseHostLeave$() {
455
+ const mouseMove$ = this._mouseMove$
456
+ .pipe(debounceTime(50), filter(() => !!this._wrapperElement), filter((event) => {
457
+ return this._popoverRef.autoClose && this._mouseLeftTheTargets(event);
458
+ }));
459
+ const mouseClick$ = fromEvent(this._elRef.nativeElement, 'click');
460
+ return merge(mouseMove$, mouseClick$);
461
+ //
462
+ // return this._mouseLeave$
463
+ // .pipe(
464
+ // //
465
+ // timeoutWith(200, mouseMove$),
466
+ // );
467
+ }
468
+ // Check if mouse left target or popover rects
469
+ _mouseLeftTheTargets(event) {
470
+ const hostBounds = this._hostBounds;
471
+ const popoverBounds = this._wrapperElement.getBoundingClientRect();
472
+ const pointInHostRect = pointInRect(hostBounds.x, hostBounds.y, hostBounds.x + hostBounds.width, hostBounds.y + hostBounds.height, event.x, event.y);
473
+ const pointInPopoverRect = pointInRect(popoverBounds.x, popoverBounds.y, popoverBounds.x + popoverBounds.width, popoverBounds.y + popoverBounds.height, event.x, event.y);
474
+ return !pointInHostRect && !pointInPopoverRect;
475
+ }
476
+ }
477
+ FsPopoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverComponent, deps: [{ token: i0.ElementRef }, { token: FsPopoverService }, { token: i0.NgZone }, { token: i2$1.Router, optional: true }], target: i0.ɵɵFactoryTarget.Component });
478
+ FsPopoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsPopoverComponent, selector: "fs-popover", inputs: { template: "template", data: "data", leaveDelay: "leaveDelay", showDelay: "showDelay", maxWidth: "maxWidth", wrapperClass: "wrapperClass", autoShow: "autoShow", autoClose: "autoClose", loadingDiameter: "loadingDiameter", loading: "loading", indication: "indication", position: "position", theme: "theme", size: "size", trigger: "trigger" }, host: { properties: { "class.indication": "this.indication" } }, ngImport: i0, template: "<ng-content></ng-content>\n<!-- <div class=\"line-container\">\n <div class=\"line\"></div>\n</div> -->\n\n<div class=\"line\"></div>\n\n", styles: [":host{display:inline-flex;cursor:pointer;position:relative}::ng-deep fs-popover.indication .line{width:100%;bottom:0;border-bottom:1px dashed #ccc;position:absolute;opacity:.6}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
479
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverComponent, decorators: [{
480
+ type: Component,
481
+ args: [{
482
+ selector: 'fs-popover',
483
+ templateUrl: 'popover.component.html',
484
+ styleUrls: ['popover.component.scss'],
485
+ changeDetection: ChangeDetectionStrategy.OnPush
486
+ }]
487
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: FsPopoverService }, { type: i0.NgZone }, { type: i2$1.Router, decorators: [{
488
+ type: Optional
489
+ }] }]; }, propDecorators: { template: [{
490
+ type: Input
491
+ }], data: [{
492
+ type: Input
493
+ }], leaveDelay: [{
494
+ type: Input
495
+ }], showDelay: [{
496
+ type: Input
497
+ }], maxWidth: [{
498
+ type: Input
499
+ }], wrapperClass: [{
500
+ type: Input
501
+ }], autoShow: [{
502
+ type: Input
503
+ }], autoClose: [{
504
+ type: Input
505
+ }], loadingDiameter: [{
506
+ type: Input
507
+ }], loading: [{
508
+ type: Input
509
+ }], indication: [{
510
+ type: Input
511
+ }, {
512
+ type: HostBinding,
513
+ args: ['class.indication']
514
+ }], position: [{
515
+ type: Input
516
+ }], theme: [{
517
+ type: Input
518
+ }], size: [{
519
+ type: Input
520
+ }], trigger: [{
521
+ type: Input
522
522
  }] } });
523
523
 
524
- class FsPopoverModule {
525
- static forRoot() {
526
- return {
527
- ngModule: FsPopoverModule,
528
- providers: [FsPopoverService]
529
- };
530
- }
531
- }
532
- FsPopoverModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
533
- FsPopoverModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverModule, declarations: [FsPopoverComponent,
534
- FsPopoverWrapperComponent], imports: [CommonModule,
535
- PortalModule,
536
- MatProgressSpinnerModule], exports: [FsPopoverComponent] });
537
- FsPopoverModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverModule, imports: [[
538
- CommonModule,
539
- PortalModule,
540
- MatProgressSpinnerModule,
541
- ]] });
542
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverModule, decorators: [{
543
- type: NgModule,
544
- args: [{
545
- imports: [
546
- CommonModule,
547
- PortalModule,
548
- MatProgressSpinnerModule,
549
- ],
550
- declarations: [
551
- FsPopoverComponent,
552
- FsPopoverWrapperComponent,
553
- ],
554
- exports: [
555
- FsPopoverComponent,
556
- ],
557
- }]
524
+ class FsPopoverModule {
525
+ static forRoot() {
526
+ return {
527
+ ngModule: FsPopoverModule,
528
+ providers: [FsPopoverService]
529
+ };
530
+ }
531
+ }
532
+ FsPopoverModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
533
+ FsPopoverModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverModule, declarations: [FsPopoverComponent,
534
+ FsPopoverWrapperComponent], imports: [CommonModule,
535
+ PortalModule,
536
+ MatProgressSpinnerModule], exports: [FsPopoverComponent] });
537
+ FsPopoverModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverModule, imports: [[
538
+ CommonModule,
539
+ PortalModule,
540
+ MatProgressSpinnerModule,
541
+ ]] });
542
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsPopoverModule, decorators: [{
543
+ type: NgModule,
544
+ args: [{
545
+ imports: [
546
+ CommonModule,
547
+ PortalModule,
548
+ MatProgressSpinnerModule,
549
+ ],
550
+ declarations: [
551
+ FsPopoverComponent,
552
+ FsPopoverWrapperComponent,
553
+ ],
554
+ exports: [
555
+ FsPopoverComponent,
556
+ ],
557
+ }]
558
558
  }] });
559
559
 
560
- /*
561
- * Public API Surface of fs-menu
560
+ /*
561
+ * Public API Surface of fs-menu
562
562
  */
563
563
 
564
- /**
565
- * Generated bundle index. Do not edit.
564
+ /**
565
+ * Generated bundle index. Do not edit.
566
566
  */
567
567
 
568
- export { FsPopoverComponent, FsPopoverModule, FsPopoverRef };
568
+ export { FsPopoverComponent, FsPopoverModule, FsPopoverRef, Position };
569
569
  //# sourceMappingURL=firestitch-popover.js.map