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