mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
- Update Nx from 21.3.2 to 21.5.2 - Update Angular packages from 20.1.x to 20.2.4 - Update NgRx from 20.0.0 to 20.0.1 - Update development dependencies (@swc/core, @types/node, etc.) - Resolve dependency conflicts with canvas and jsdom versions - Apply Nx migrations for tsConfig options and Angular CLI updates - Fix TypeScript error in customer-order-search.store.ts for tuple destructuring - Update package overrides for compatibility with updated dependencies All tests passing and build successful after migration.
Scroll Position Library
Overview
Provides utilities for storing, restoring, and observing scroll position across navigation or component view changes.
Features
- Store current scroll position in session storage.
- Restore saved scroll position with an optional delay.
- Observe when an element enters or leaves the viewport.
Usage
Storing Scroll Position
Call the function to save the current scroll position:
import { storeScrollPosition } from '@isa/utils/scroll-position';
storeScrollPosition();
Restoring Scroll Position
Inject the restore function and call it with an optional delay:
import { injectRestoreScrollPosition } from '@isa/utils/scroll-position';
const restorePosition = injectRestoreScrollPosition();
await restorePosition(200);
Automatic Restoration
Provide environment initializer in your app module to auto-save scroll positions:
import { provideScrollPositionRestoration } from '@isa/utils/scroll-position';
provideScrollPositionRestoration();
Marking a Route for Auto Restoration
To enable automatic scroll restoration on a specific route, add the “scrollPositionRestoration” property in its data:
{
path: 'example',
component: ExampleComponent,
data: {
scrollPositionRestoration: true
}
},
Detecting Element Visibility
Apply the directive to a component template to emit true or false when entering or exiting the viewport:
<div utilScrolledIntoViewport (utilScrolledIntoViewport)="onVisibilityChange($event)">...</div>