@eric-emg/symphiq-components 1.2.18 → 1.2.21

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 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,88 @@ 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
- container = document.getElementById(this.scrollContainerId());
21368
- if (!container) {
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:', container);
21373
- console.log('[Scroll Debug] Container dimensions:', {
21374
- clientHeight: container.clientHeight,
21375
- scrollHeight: container.scrollHeight,
21376
- scrollTop: container.scrollTop,
21377
- hasOverflow: container.scrollHeight > container.clientHeight
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
+ const dimensions = {
21386
+ clientHeight: scrollElement.clientHeight,
21387
+ scrollHeight: scrollElement.scrollHeight,
21388
+ scrollTop: scrollElement.scrollTop,
21389
+ hasOverflow: scrollElement.scrollHeight > scrollElement.clientHeight
21390
+ };
21391
+ console.log('[Scroll Debug] Ionic scroll element dimensions:', dimensions);
21392
+ if (!dimensions.hasOverflow) {
21393
+ console.warn('[Scroll Debug] ⚠️ WARNING: Scroll element has no overflow! Content may still be loading.');
21394
+ console.warn('[Scroll Debug] The dashboard content needs to be taller than', dimensions.clientHeight, 'px to enable scrolling');
21395
+ // Set up a MutationObserver to detect when content becomes scrollable
21396
+ const observer = new MutationObserver(() => {
21397
+ const newScrollHeight = scrollElement.scrollHeight;
21398
+ const newClientHeight = scrollElement.clientHeight;
21399
+ if (newScrollHeight > newClientHeight) {
21400
+ console.log('[Scroll Debug] ✓ Content is now scrollable!', {
21401
+ clientHeight: newClientHeight,
21402
+ scrollHeight: newScrollHeight,
21403
+ hasOverflow: true
21404
+ });
21405
+ observer.disconnect();
21406
+ }
21407
+ });
21408
+ observer.observe(scrollElement, {
21409
+ childList: true,
21410
+ subtree: true,
21411
+ attributes: true
21412
+ });
21413
+ console.log('[Scroll Debug] Monitoring for content changes...');
21414
+ }
21415
+ scrollElement.addEventListener('scroll', () => this.onContainerScroll(scrollElement), { passive: true });
21416
+ console.log('[Scroll Debug] Attached scroll listener to Ionic scroll element');
21417
+ // Test if scroll event fires by manually triggering a test
21418
+ console.log('[Scroll Debug] Testing scroll event by programmatically scrolling to 1px...');
21419
+ scrollElement.scrollTop = 1;
21420
+ setTimeout(() => {
21421
+ if (scrollElement.scrollTop === 1) {
21422
+ console.log('[Scroll Debug] ✓ Scroll position changed successfully');
21423
+ scrollElement.scrollTop = 0; // Reset
21424
+ }
21425
+ else {
21426
+ console.warn('[Scroll Debug] ⚠️ Could not change scroll position - element may not be scrollable');
21427
+ }
21428
+ }, 50);
21429
+ }).catch((error) => {
21430
+ console.error('[Scroll Debug] Error getting Ionic scroll element:', error);
21431
+ });
21432
+ }
21433
+ else {
21434
+ console.warn('[Scroll Debug] ion-content does not have getScrollElement() method');
21435
+ // Fallback: attach to ion-content itself (may not work)
21436
+ container = element;
21437
+ }
21438
+ }
21439
+ else {
21440
+ // Regular HTML element
21441
+ container = element;
21442
+ console.log('[Scroll Debug] Container dimensions:', {
21443
+ clientHeight: container.clientHeight,
21444
+ scrollHeight: container.scrollHeight,
21445
+ scrollTop: container.scrollTop,
21446
+ hasOverflow: container.scrollHeight > container.clientHeight
21447
+ });
21448
+ }
21379
21449
  }
21380
21450
  }
21381
21451
  else if (this.dashboardContainer) {
@@ -21383,11 +21453,12 @@ class SymphiqFunnelAnalysisDashboardComponent {
21383
21453
  container = this.dashboardContainer.nativeElement;
21384
21454
  console.log('[Scroll Debug] Using internal dashboard container:', container);
21385
21455
  }
21456
+ // Only attach listener for non-Ionic elements (Ionic handled above)
21386
21457
  if (container) {
21387
21458
  console.log('[Scroll Debug] Attaching scroll listener to container');
21388
21459
  container.addEventListener('scroll', () => this.onContainerScroll(container), { passive: true });
21389
21460
  }
21390
- else {
21461
+ else if (!this.scrollContainerId() || document.getElementById(this.scrollContainerId())?.tagName.toLowerCase() !== 'ion-content') {
21391
21462
  console.warn('[Scroll Debug] No scroll container found!');
21392
21463
  }
21393
21464
  }