@eric-emg/symphiq-components 1.2.18 → 1.2.20
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/README.md +20 -0
- package/fesm2022/symphiq-components.mjs +45 -10
- package/fesm2022/symphiq-components.mjs.map +1 -1
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/styles.css +4 -0
package/README.md
CHANGED
|
@@ -82,6 +82,26 @@ Embedded mode:
|
|
|
82
82
|
|
|
83
83
|
**Note:** When `embedded` is `true` and you have a custom scrolling container outside the dashboard component, you should provide the `scrollContainerId` input with the ID of that container element. If `scrollContainerId` is not provided, the component will fall back to using its internal container for scroll tracking.
|
|
84
84
|
|
|
85
|
+
#### Ionic Framework Support
|
|
86
|
+
|
|
87
|
+
The component automatically detects and supports **Ionic `<ion-content>` elements**:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
@Component({
|
|
91
|
+
template: `
|
|
92
|
+
<ion-content id="mainContent">
|
|
93
|
+
<symphiq-funnel-analysis-dashboard
|
|
94
|
+
[funnelAnalysis]="data"
|
|
95
|
+
[embedded]="true"
|
|
96
|
+
[scrollContainerId]="'mainContent'">
|
|
97
|
+
</symphiq-funnel-analysis-dashboard>
|
|
98
|
+
</ion-content>
|
|
99
|
+
`
|
|
100
|
+
})
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
When an `ion-content` element is detected, the component will automatically call `getScrollElement()` to attach the scroll listener to the correct internal scrollable element within the shadow DOM.
|
|
104
|
+
|
|
85
105
|
### Preview Component
|
|
86
106
|
|
|
87
107
|
The library includes a compact preview component for displaying funnel analysis summaries:
|
|
@@ -21364,18 +21364,52 @@ class SymphiqFunnelAnalysisDashboardComponent {
|
|
|
21364
21364
|
console.log('[Scroll Debug] scrollContainerId:', this.scrollContainerId());
|
|
21365
21365
|
// If a scroll container ID is provided, use that element
|
|
21366
21366
|
if (this.scrollContainerId()) {
|
|
21367
|
-
|
|
21368
|
-
if (!
|
|
21367
|
+
const element = document.getElementById(this.scrollContainerId());
|
|
21368
|
+
if (!element) {
|
|
21369
21369
|
console.warn(`[Scroll Debug] Scroll container with id "${this.scrollContainerId()}" not found. Scroll tracking will not work.`);
|
|
21370
21370
|
}
|
|
21371
21371
|
else {
|
|
21372
|
-
console.log('[Scroll Debug] Found external scroll container:',
|
|
21373
|
-
console.log('[Scroll Debug] Container
|
|
21374
|
-
|
|
21375
|
-
|
|
21376
|
-
|
|
21377
|
-
|
|
21378
|
-
|
|
21372
|
+
console.log('[Scroll Debug] Found external scroll container:', element);
|
|
21373
|
+
console.log('[Scroll Debug] Container tag name:', element.tagName);
|
|
21374
|
+
// Check if this is an Ionic ion-content element
|
|
21375
|
+
if (element.tagName.toLowerCase() === 'ion-content') {
|
|
21376
|
+
console.log('[Scroll Debug] Detected Ionic ion-content, attempting to get scrollable element');
|
|
21377
|
+
// Try to get the scroll element from Ionic's ion-content
|
|
21378
|
+
// Ionic stores the scrollable element in the component itself
|
|
21379
|
+
const ionContent = element;
|
|
21380
|
+
// Method 1: Try getScrollElement() method (Ionic 4+)
|
|
21381
|
+
if (typeof ionContent.getScrollElement === 'function') {
|
|
21382
|
+
console.log('[Scroll Debug] Using getScrollElement() method');
|
|
21383
|
+
ionContent.getScrollElement().then((scrollElement) => {
|
|
21384
|
+
console.log('[Scroll Debug] Got Ionic scroll element:', scrollElement);
|
|
21385
|
+
console.log('[Scroll Debug] Ionic scroll element dimensions:', {
|
|
21386
|
+
clientHeight: scrollElement.clientHeight,
|
|
21387
|
+
scrollHeight: scrollElement.scrollHeight,
|
|
21388
|
+
scrollTop: scrollElement.scrollTop,
|
|
21389
|
+
hasOverflow: scrollElement.scrollHeight > scrollElement.clientHeight
|
|
21390
|
+
});
|
|
21391
|
+
scrollElement.addEventListener('scroll', () => this.onContainerScroll(scrollElement), { passive: true });
|
|
21392
|
+
console.log('[Scroll Debug] Attached scroll listener to Ionic scroll element');
|
|
21393
|
+
}).catch((error) => {
|
|
21394
|
+
console.error('[Scroll Debug] Error getting Ionic scroll element:', error);
|
|
21395
|
+
});
|
|
21396
|
+
}
|
|
21397
|
+
else {
|
|
21398
|
+
console.warn('[Scroll Debug] ion-content does not have getScrollElement() method');
|
|
21399
|
+
// Fallback: attach to ion-content itself (may not work)
|
|
21400
|
+
container = element;
|
|
21401
|
+
}
|
|
21402
|
+
}
|
|
21403
|
+
else {
|
|
21404
|
+
// Regular HTML element
|
|
21405
|
+
container = element;
|
|
21406
|
+
console.log('[Scroll Debug] Container dimensions:', {
|
|
21407
|
+
clientHeight: container.clientHeight,
|
|
21408
|
+
scrollHeight: container.scrollHeight,
|
|
21409
|
+
scrollTop: container.scrollTop,
|
|
21410
|
+
hasOverflow: container.scrollHeight > container.clientHeight
|
|
21411
|
+
});
|
|
21412
|
+
}
|
|
21379
21413
|
}
|
|
21380
21414
|
}
|
|
21381
21415
|
else if (this.dashboardContainer) {
|
|
@@ -21383,11 +21417,12 @@ class SymphiqFunnelAnalysisDashboardComponent {
|
|
|
21383
21417
|
container = this.dashboardContainer.nativeElement;
|
|
21384
21418
|
console.log('[Scroll Debug] Using internal dashboard container:', container);
|
|
21385
21419
|
}
|
|
21420
|
+
// Only attach listener for non-Ionic elements (Ionic handled above)
|
|
21386
21421
|
if (container) {
|
|
21387
21422
|
console.log('[Scroll Debug] Attaching scroll listener to container');
|
|
21388
21423
|
container.addEventListener('scroll', () => this.onContainerScroll(container), { passive: true });
|
|
21389
21424
|
}
|
|
21390
|
-
else {
|
|
21425
|
+
else if (!this.scrollContainerId() || document.getElementById(this.scrollContainerId())?.tagName.toLowerCase() !== 'ion-content') {
|
|
21391
21426
|
console.warn('[Scroll Debug] No scroll container found!');
|
|
21392
21427
|
}
|
|
21393
21428
|
}
|