@acorex/cdk 21.0.2-next.4 → 21.0.2-next.41
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/fesm2022/acorex-cdk-accordion.mjs +35 -35
- package/fesm2022/acorex-cdk-accordion.mjs.map +1 -1
- package/fesm2022/acorex-cdk-carousel.mjs +4 -4
- package/fesm2022/acorex-cdk-carousel.mjs.map +1 -1
- package/fesm2022/acorex-cdk-clipboard.mjs +7 -7
- package/fesm2022/acorex-cdk-clipboard.mjs.map +1 -1
- package/fesm2022/acorex-cdk-common.mjs +102 -103
- package/fesm2022/acorex-cdk-common.mjs.map +1 -1
- package/fesm2022/acorex-cdk-dom.mjs +3 -3
- package/fesm2022/acorex-cdk-double-click.mjs +5 -5
- package/fesm2022/acorex-cdk-double-click.mjs.map +1 -1
- package/fesm2022/acorex-cdk-drag-drop.mjs +68 -68
- package/fesm2022/acorex-cdk-drag-drop.mjs.map +1 -1
- package/fesm2022/acorex-cdk-drawer.mjs +35 -35
- package/fesm2022/acorex-cdk-drawer.mjs.map +1 -1
- package/fesm2022/acorex-cdk-focus-trap.mjs +19 -19
- package/fesm2022/acorex-cdk-focus-trap.mjs.map +1 -1
- package/fesm2022/acorex-cdk-full-screen.mjs +4 -4
- package/fesm2022/acorex-cdk-full-screen.mjs.map +1 -1
- package/fesm2022/acorex-cdk-input-mask.mjs +19 -13
- package/fesm2022/acorex-cdk-input-mask.mjs.map +1 -1
- package/fesm2022/acorex-cdk-list-navigation.mjs +17 -17
- package/fesm2022/acorex-cdk-list-navigation.mjs.map +1 -1
- package/fesm2022/acorex-cdk-outline.mjs +77 -66
- package/fesm2022/acorex-cdk-outline.mjs.map +1 -1
- package/fesm2022/acorex-cdk-overlay.mjs +16 -3
- package/fesm2022/acorex-cdk-overlay.mjs.map +1 -1
- package/fesm2022/acorex-cdk-pan-view.mjs +67 -49
- package/fesm2022/acorex-cdk-pan-view.mjs.map +1 -1
- package/fesm2022/acorex-cdk-resizable.mjs +46 -22
- package/fesm2022/acorex-cdk-resizable.mjs.map +1 -1
- package/fesm2022/acorex-cdk-selection.mjs +21 -21
- package/fesm2022/acorex-cdk-selection.mjs.map +1 -1
- package/fesm2022/acorex-cdk-sliding-item.mjs +11 -11
- package/fesm2022/acorex-cdk-sliding-item.mjs.map +1 -1
- package/fesm2022/acorex-cdk-sticky.mjs +3 -3
- package/fesm2022/acorex-cdk-uploader.mjs +298 -188
- package/fesm2022/acorex-cdk-uploader.mjs.map +1 -1
- package/fesm2022/acorex-cdk-virtual-scroll.mjs +17 -17
- package/fesm2022/acorex-cdk-virtual-scroll.mjs.map +1 -1
- package/fesm2022/acorex-cdk-wysiwyg.mjs +1 -1
- package/fesm2022/acorex-cdk-wysiwyg.mjs.map +1 -1
- package/fesm2022/acorex-cdk-z-index.mjs +4 -4
- package/fesm2022/acorex-cdk-z-index.mjs.map +1 -1
- package/package.json +3 -2
- package/types/acorex-cdk-common.d.ts +1 -1
- package/types/acorex-cdk-drawer.d.ts +2 -0
- package/types/acorex-cdk-focus-trap.d.ts +2 -3
- package/types/acorex-cdk-input-mask.d.ts +1 -0
- package/types/acorex-cdk-outline.d.ts +1 -0
- package/types/acorex-cdk-overlay.d.ts +1 -0
- package/types/acorex-cdk-pan-view.d.ts +4 -0
- package/types/acorex-cdk-resizable.d.ts +2 -0
- package/types/acorex-cdk-uploader.d.ts +120 -110
|
@@ -195,6 +195,7 @@ class AXOverlayService {
|
|
|
195
195
|
dispose();
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
+
this.addHostClass(options?.anchorOptions?.anchor, overlayContainer);
|
|
198
199
|
return {
|
|
199
200
|
instance,
|
|
200
201
|
updatePosition,
|
|
@@ -381,10 +382,22 @@ class AXOverlayService {
|
|
|
381
382
|
container.style.top = `${coords.top}px`;
|
|
382
383
|
container.style.left = `${coords.left}px`;
|
|
383
384
|
}
|
|
384
|
-
|
|
385
|
-
|
|
385
|
+
addHostClass(refElement, targetElement) {
|
|
386
|
+
if (!refElement || !targetElement)
|
|
387
|
+
return;
|
|
388
|
+
const el = refElement instanceof ElementRef ? refElement.nativeElement : refElement;
|
|
389
|
+
const computedStyle = getComputedStyle(el);
|
|
390
|
+
const classSize = computedStyle.getPropertyValue('--ax-sys-size');
|
|
391
|
+
const themeColor = +computedStyle.getPropertyValue('--ax-sys-theme-isDark');
|
|
392
|
+
if (themeColor === 1)
|
|
393
|
+
targetElement.classList.add('ax-dark');
|
|
394
|
+
if (classSize)
|
|
395
|
+
targetElement.classList.add(classSize);
|
|
396
|
+
}
|
|
397
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXOverlayService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
398
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXOverlayService, providedIn: 'root' }); }
|
|
386
399
|
}
|
|
387
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
400
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXOverlayService, decorators: [{
|
|
388
401
|
type: Injectable,
|
|
389
402
|
args: [{
|
|
390
403
|
providedIn: 'root',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-cdk-overlay.mjs","sources":["../../../../packages/cdk/overlay/src/lib/overlay.types.ts","../../../../packages/cdk/overlay/src/lib/overlay.service.ts","../../../../packages/cdk/overlay/src/acorex-cdk-overlay.ts"],"sourcesContent":["import { AXConnectedPosition, AXPlacement, AXPlacementType } from '@acorex/cdk/common';\nimport { AXComponentOptions } from '@acorex/core/components';\nimport { AXZToken } from '@acorex/core/z-index';\nimport { ComponentRef, ElementRef, EmbeddedViewRef } from '@angular/core';\n\nexport interface AXOverlayRef<T> {\n instance: EmbeddedViewRef<T> | ComponentRef<T>;\n /** Updates the overlay position relative to the anchor */\n updatePosition: () => void;\n /** Destroys the overlay and removes it from the DOM */\n dispose: () => void;\n /** The overlay container element */\n overlayElement: HTMLElement | null;\n /** The z-index token for this overlay */\n zToken: AXZToken | null;\n /** Brings this overlay to the front of all other overlays */\n bringToFront: () => void;\n}\n\nexport interface AXOverlayAnchorOptions {\n /** The anchor element to position relative to */\n anchor: HTMLElement | ElementRef<HTMLElement>;\n /** Placement of the overlay relative to the anchor */\n placement?: AXPlacementType;\n /** Horizontal offset in pixels */\n offsetX?: number;\n /** Vertical offset in pixels */\n offsetY?: number;\n /** Whether to flip the overlay when it overflows the viewport */\n autoFlip?: boolean;\n}\n\nexport interface AXOverlayOptions extends AXComponentOptions {\n backdrop?: {\n enabled?: boolean;\n background?: boolean;\n backdropClass?: string;\n closeOnClick?: boolean;\n };\n position?: AXPlacement;\n /** Anchor-based positioning options for tooltips, popovers, etc. */\n anchorOptions?: AXOverlayAnchorOptions;\n /** Custom CSS class for the overlay panel */\n panelClass?: string | string[];\n /** Whether to close when clicking outside */\n closeOnOutsideClick?: boolean;\n /** Whether to close when pressing Escape */\n closeOnEscape?: boolean;\n /** Width of the overlay container (e.g., 'auto', '200px', '100%') */\n width?: string;\n /** Callback when the overlay is disposed (e.g., due to scroll) */\n onDispose?: () => void;\n /** Whether to use centered container (default: true). Set to false for positioned overlays like toasts */\n centered?: boolean;\n actionSheetStyle?: boolean;\n}\n\n/**\n * Calculates the position of an overlay element relative to an anchor element.\n */\nexport function calculateAnchorPosition(\n anchorRect: DOMRect,\n overlayRect: DOMRect,\n position: AXConnectedPosition,\n): { top: number; left: number } {\n let left = 0;\n let top = 0;\n\n // Calculate origin point on anchor\n switch (position.originX) {\n case 'start':\n left = anchorRect.left;\n break;\n case 'center':\n left = anchorRect.left + anchorRect.width / 2;\n break;\n case 'end':\n left = anchorRect.right;\n break;\n }\n\n switch (position.originY) {\n case 'top':\n top = anchorRect.top;\n break;\n case 'center':\n top = anchorRect.top + anchorRect.height / 2;\n break;\n case 'bottom':\n top = anchorRect.bottom;\n break;\n }\n\n // Adjust for overlay alignment\n switch (position.overlayX) {\n case 'start':\n // left stays the same\n break;\n case 'center':\n left -= overlayRect.width / 2;\n break;\n case 'end':\n left -= overlayRect.width;\n break;\n }\n\n switch (position.overlayY) {\n case 'top':\n // top stays the same\n break;\n case 'center':\n top -= overlayRect.height / 2;\n break;\n case 'bottom':\n top -= overlayRect.height;\n break;\n }\n\n // Apply offsets\n if (position.offsetX) {\n left += position.offsetX;\n }\n if (position.offsetY) {\n top += position.offsetY;\n }\n\n return { top, left };\n}\n\n/**\n * Checks if the overlay position fits within the viewport.\n */\nexport function fitsInViewport(\n position: { top: number; left: number },\n overlayRect: DOMRect,\n viewportWidth: number,\n viewportHeight: number,\n): boolean {\n return (\n position.left >= 0 &&\n position.top >= 0 &&\n position.left + overlayRect.width <= viewportWidth &&\n position.top + overlayRect.height <= viewportHeight\n );\n}\n\n/**\n * Clamps a position to ensure the overlay stays within viewport bounds.\n */\nexport function clampToViewport(\n coords: { top: number; left: number },\n overlayRect: DOMRect,\n viewportWidth: number,\n viewportHeight: number,\n margin = 4,\n): { top: number; left: number } {\n const clampedLeft = Math.max(margin, Math.min(coords.left, viewportWidth - overlayRect.width - margin));\n const clampedTop = Math.max(margin, Math.min(coords.top, viewportHeight - overlayRect.height - margin));\n\n return { top: clampedTop, left: clampedLeft };\n}\n\n/**\n * Finds the best position for an overlay that fits in the viewport.\n */\nexport function findBestPosition(\n anchorRect: DOMRect,\n overlayRect: DOMRect,\n positions: AXConnectedPosition[],\n viewportWidth: number,\n viewportHeight: number,\n): { position: AXConnectedPosition; coords: { top: number; left: number } } {\n for (const position of positions) {\n const coords = calculateAnchorPosition(anchorRect, overlayRect, position);\n\n if (fitsInViewport(coords, overlayRect, viewportWidth, viewportHeight)) {\n return { position, coords };\n }\n }\n\n // Fallback to first position if none fit, but clamp to viewport bounds\n const fallbackCoords = calculateAnchorPosition(anchorRect, overlayRect, positions[0]);\n const clampedCoords = clampToViewport(fallbackCoords, overlayRect, viewportWidth, viewportHeight);\n return { position: positions[0], coords: clampedCoords };\n}\n","import { convertToPlacement } from '@acorex/cdk/common';\nimport { AXComponentContent, AXComponentService } from '@acorex/core/components';\nimport { AXPlatform } from '@acorex/core/platform';\nimport { AXZIndexService, AXZToken } from '@acorex/core/z-index';\nimport { DOCUMENT } from '@angular/common';\nimport { ComponentRef, ElementRef, EmbeddedViewRef, inject, Injectable, TemplateRef } from '@angular/core';\nimport { AXOverlayOptions, AXOverlayRef, findBestPosition } from './overlay.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXOverlayService {\n private componentService = inject(AXComponentService);\n private document = inject(DOCUMENT);\n private zIndexService = inject(AXZIndexService);\n private _platform: AXPlatform = inject(AXPlatform);\n\n /**\n * Creates an overlay with optional anchor-based positioning.\n * @param content - Component or template to display\n * @param options - Configuration options for the overlay\n * @returns Promise<AXOverlayRef> - Reference to the created overlay\n */\n async create<T = unknown>(content: AXComponentContent<T>, options?: AXOverlayOptions): Promise<AXOverlayRef<T>> {\n let instance: EmbeddedViewRef<T> | ComponentRef<T>;\n let overlayContainer: HTMLElement | null = null;\n let backdropElement: HTMLElement | null = null;\n let isDisposed = false;\n\n // Acquire a z-index token for this overlay\n let zToken: AXZToken | null = this.zIndexService.acquire();\n\n if (content instanceof TemplateRef) {\n instance = this.componentService.createFromTemplate<T>(content);\n } else {\n instance = this.componentService.createFromComponent<T>(content);\n if (options?.inputs) {\n Object.entries(options.inputs).forEach((c) => {\n (instance as ComponentRef<T>).setInput(c[0], c[1]);\n });\n }\n }\n\n // Get the host element\n const hostElement = this.getHostElement(instance);\n\n // Create backdrop if enabled\n if (options?.backdrop?.enabled) {\n backdropElement = this.createBackdrop(options, zToken.zIndex);\n }\n\n // If anchor options are provided, set up positioned overlay (for tooltips, popovers)\n if (options?.anchorOptions?.anchor) {\n overlayContainer = this.createOverlayContainer(hostElement, options, zToken.zIndex);\n this.positionOverlay(overlayContainer, options);\n } else if (options?.centered === false) {\n // Non-centered positioned overlay (for toasts, notifications)\n overlayContainer = this.createOverlayContainer(hostElement, options, zToken.zIndex);\n } else {\n // No anchor - create centered overlay (for modals, popups)\n overlayContainer = this.createCenteredOverlayContainer(hostElement, options, zToken.zIndex);\n }\n\n const updatePosition = () => {\n if (overlayContainer && options?.anchorOptions?.anchor) {\n this.positionOverlay(overlayContainer, options);\n }\n };\n\n const dispose = () => {\n if (isDisposed) return;\n isDisposed = true;\n\n // Remove backdrop\n if (backdropElement) {\n backdropElement.remove();\n }\n\n if (overlayContainer) {\n overlayContainer.remove();\n }\n if (instance instanceof ComponentRef) {\n instance.destroy();\n } else {\n instance.destroy();\n }\n\n // Release the z-index token\n this.zIndexService.release(zToken);\n zToken = null;\n\n // Notify callback\n options?.onDispose?.();\n };\n\n const bringToFront = () => {\n if (!zToken || isDisposed) return;\n zToken = this.zIndexService.bringToFront(zToken);\n if (backdropElement) {\n backdropElement.style.zIndex = String(zToken.zIndex);\n }\n if (overlayContainer) {\n overlayContainer.style.zIndex = String(zToken.zIndex);\n }\n };\n\n // Set up backdrop click handler\n if (backdropElement && options?.backdrop?.closeOnClick) {\n backdropElement.addEventListener('click', () => {\n dispose();\n });\n }\n\n return {\n instance,\n updatePosition,\n dispose,\n overlayElement: overlayContainer,\n zToken,\n bringToFront,\n };\n }\n\n /**\n * Creates a backdrop element.\n */\n private createBackdrop(options: AXOverlayOptions | undefined, zIndex: number): HTMLElement {\n const backdrop = this.document.createElement('div');\n backdrop.classList.add('ax-overlay-backdrop');\n\n if (options?.backdrop?.backdropClass) {\n backdrop.classList.add(options.backdrop.backdropClass);\n }\n\n // Style the backdrop\n backdrop.style.position = 'fixed';\n backdrop.style.top = '0';\n backdrop.style.left = '0';\n backdrop.style.width = '100%';\n backdrop.style.height = '100%';\n backdrop.style.zIndex = String(zIndex);\n\n if (options?.backdrop?.background) {\n backdrop.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';\n }\n\n this.document.body.appendChild(backdrop);\n return backdrop;\n }\n\n /**\n * Creates a centered overlay container (for modals/popups).\n */\n private createCenteredOverlayContainer(\n content: HTMLElement,\n options: AXOverlayOptions | undefined,\n zIndex: number,\n ): HTMLElement {\n const container = this.document.createElement('div');\n container.classList.add('ax-overlay-container', 'ax-overlay-centered');\n\n // Add custom panel classes\n if (options?.panelClass) {\n const classes = Array.isArray(options.panelClass) ? options.panelClass : [options.panelClass];\n classes.forEach((cls) => {\n if (cls) {\n container.classList.add(cls);\n }\n });\n }\n\n // Set styles for centered positioning\n container.style.position = 'fixed';\n container.style.top = '0';\n container.style.left = '0';\n container.style.width = '100%';\n container.style.height = '100%';\n container.style.display = 'flex';\n container.style.alignItems = 'center';\n container.style.justifyContent = 'center';\n container.style.zIndex = String(zIndex);\n\n // Create inner wrapper for the content\n const contentWrapper = this.document.createElement('div');\n contentWrapper.classList.add('ax-overlay-content');\n\n // Apply width if provided\n if (options?.width) {\n contentWrapper.style.width = options.width;\n }\n\n // Move content into wrapper\n contentWrapper.appendChild(content);\n container.appendChild(contentWrapper);\n\n // Append to body\n this.document.body.appendChild(container);\n\n return container;\n }\n\n /**\n * Gets the host element from a ComponentRef or EmbeddedViewRef.\n */\n private getHostElement<T>(instance: EmbeddedViewRef<T> | ComponentRef<T>): HTMLElement {\n if (instance instanceof ComponentRef) {\n return instance.location.nativeElement;\n } else {\n // EmbeddedViewRef - get the first root node\n return instance.rootNodes[0] as HTMLElement;\n }\n }\n\n /**\n * Creates an overlay container element and appends the content to it.\n */\n private createOverlayContainer(\n content: HTMLElement,\n options: AXOverlayOptions | undefined,\n zIndex: number,\n ): HTMLElement {\n const container = this.document.createElement('div');\n const pane = this.document.createElement('div');\n container.classList.add('ax-overlay-container');\n\n if (Array.isArray(options.panelClass)) {\n const check = options.panelClass.some((element) => {\n return element === 'ax-action-sheet-panel';\n });\n if (!check) pane.classList.add('ax-overlay-pane');\n }\n\n if (options.actionSheetStyle && this._platform.is('SM')) pane.classList.add('ax-overlay-actionsheet');\n\n // Add custom panel classes\n if (options?.panelClass) {\n const classes = Array.isArray(options.panelClass) ? options.panelClass : [options.panelClass];\n classes.forEach((cls) => {\n if (cls) {\n container.classList.add(cls);\n }\n });\n }\n\n // Set initial styles for positioning\n container.style.position = 'fixed';\n container.style.zIndex = String(zIndex);\n container.style.maxWidth = '100vw';\n container.style.maxHeight = '100vh';\n\n if (options?.actionSheetStyle) {\n container.style.width = this._platform.is('SM') ? '100%' : 'fit-content';\n } else {\n container.style.width = options?.width || 'fit-content';\n }\n\n // Move content into container\n pane.appendChild(content);\n container.appendChild(pane);\n\n // Append to body\n this.document.body.appendChild(container);\n\n return container;\n }\n\n /**\n * Positions the overlay container relative to the anchor element.\n */\n private positionOverlay(container: HTMLElement, options: AXOverlayOptions): void {\n if (options.actionSheetStyle && this._platform.is('SM')) {\n container.style.bottom = `0px`;\n container.style.left = `0px`;\n return;\n }\n\n const anchorOptions = options.anchorOptions;\n if (!anchorOptions?.anchor) return;\n\n const anchorElement =\n anchorOptions.anchor instanceof ElementRef ? anchorOptions.anchor.nativeElement : anchorOptions.anchor;\n\n const anchorRect = anchorElement.getBoundingClientRect();\n const containerRect = container.getBoundingClientRect();\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n // Get positions from placement\n let positions = convertToPlacement(anchorOptions.placement ?? 'bottom');\n if (positions.length === 0) {\n positions = convertToPlacement('bottom');\n }\n\n // Apply custom offsets to positions with direction-aware inversion\n // When position flips, the offset should also be inverted to maintain the intended gap\n if (anchorOptions.offsetX || anchorOptions.offsetY) {\n const primaryPosition = positions[0];\n positions = positions.map((p) => {\n let adjustedOffsetX = anchorOptions.offsetX ?? 0;\n let adjustedOffsetY = anchorOptions.offsetY ?? 0;\n\n // Invert offsetY when vertical direction flips\n // (from bottom to top or vice versa)\n if (primaryPosition.originY !== p.originY) {\n adjustedOffsetY = -adjustedOffsetY;\n }\n\n // Invert offsetX when horizontal direction flips\n // (from end to start or vice versa)\n if (primaryPosition.originX !== p.originX) {\n adjustedOffsetX = -adjustedOffsetX;\n }\n\n return {\n ...p,\n offsetX: (p.offsetX ?? 0) + adjustedOffsetX,\n offsetY: (p.offsetY ?? 0) + adjustedOffsetY,\n };\n });\n }\n\n // Find the best position that fits in viewport\n const { coords } = anchorOptions.autoFlip\n ? findBestPosition(anchorRect, containerRect, positions, viewportWidth, viewportHeight)\n : {\n coords: {\n top:\n positions[0].originY === 'bottom'\n ? anchorRect.bottom + (positions[0].offsetY ?? 0)\n : anchorRect.top - containerRect.height + (positions[0].offsetY ?? 0),\n left: anchorRect.left + (positions[0].offsetX ?? 0),\n },\n };\n\n // Apply position\n container.style.top = `${coords.top}px`;\n container.style.left = `${coords.left}px`;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAyDA;;AAEG;SACa,uBAAuB,CACrC,UAAmB,EACnB,WAAoB,EACpB,QAA6B,EAAA;IAE7B,IAAI,IAAI,GAAG,CAAC;IACZ,IAAI,GAAG,GAAG,CAAC;;AAGX,IAAA,QAAQ,QAAQ,CAAC,OAAO;AACtB,QAAA,KAAK,OAAO;AACV,YAAA,IAAI,GAAG,UAAU,CAAC,IAAI;YACtB;AACF,QAAA,KAAK,QAAQ;YACX,IAAI,GAAG,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,KAAK,GAAG,CAAC;YAC7C;AACF,QAAA,KAAK,KAAK;AACR,YAAA,IAAI,GAAG,UAAU,CAAC,KAAK;YACvB;;AAGJ,IAAA,QAAQ,QAAQ,CAAC,OAAO;AACtB,QAAA,KAAK,KAAK;AACR,YAAA,GAAG,GAAG,UAAU,CAAC,GAAG;YACpB;AACF,QAAA,KAAK,QAAQ;YACX,GAAG,GAAG,UAAU,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC;YAC5C;AACF,QAAA,KAAK,QAAQ;AACX,YAAA,GAAG,GAAG,UAAU,CAAC,MAAM;YACvB;;;AAIJ,IAAA,QAAQ,QA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AAA,CAAA;;2FAEP,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAH5B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACVD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-cdk-overlay.mjs","sources":["../../../../packages/cdk/overlay/src/lib/overlay.types.ts","../../../../packages/cdk/overlay/src/lib/overlay.service.ts","../../../../packages/cdk/overlay/src/acorex-cdk-overlay.ts"],"sourcesContent":["import { AXConnectedPosition, AXPlacement, AXPlacementType } from '@acorex/cdk/common';\nimport { AXComponentOptions } from '@acorex/core/components';\nimport { AXZToken } from '@acorex/core/z-index';\nimport { ComponentRef, ElementRef, EmbeddedViewRef } from '@angular/core';\n\nexport interface AXOverlayRef<T> {\n instance: EmbeddedViewRef<T> | ComponentRef<T>;\n /** Updates the overlay position relative to the anchor */\n updatePosition: () => void;\n /** Destroys the overlay and removes it from the DOM */\n dispose: () => void;\n /** The overlay container element */\n overlayElement: HTMLElement | null;\n /** The z-index token for this overlay */\n zToken: AXZToken | null;\n /** Brings this overlay to the front of all other overlays */\n bringToFront: () => void;\n}\n\nexport interface AXOverlayAnchorOptions {\n /** The anchor element to position relative to */\n anchor: HTMLElement | ElementRef<HTMLElement>;\n /** Placement of the overlay relative to the anchor */\n placement?: AXPlacementType;\n /** Horizontal offset in pixels */\n offsetX?: number;\n /** Vertical offset in pixels */\n offsetY?: number;\n /** Whether to flip the overlay when it overflows the viewport */\n autoFlip?: boolean;\n}\n\nexport interface AXOverlayOptions extends AXComponentOptions {\n backdrop?: {\n enabled?: boolean;\n background?: boolean;\n backdropClass?: string;\n closeOnClick?: boolean;\n };\n position?: AXPlacement;\n /** Anchor-based positioning options for tooltips, popovers, etc. */\n anchorOptions?: AXOverlayAnchorOptions;\n /** Custom CSS class for the overlay panel */\n panelClass?: string | string[];\n /** Whether to close when clicking outside */\n closeOnOutsideClick?: boolean;\n /** Whether to close when pressing Escape */\n closeOnEscape?: boolean;\n /** Width of the overlay container (e.g., 'auto', '200px', '100%') */\n width?: string;\n /** Callback when the overlay is disposed (e.g., due to scroll) */\n onDispose?: () => void;\n /** Whether to use centered container (default: true). Set to false for positioned overlays like toasts */\n centered?: boolean;\n actionSheetStyle?: boolean;\n}\n\n/**\n * Calculates the position of an overlay element relative to an anchor element.\n */\nexport function calculateAnchorPosition(\n anchorRect: DOMRect,\n overlayRect: DOMRect,\n position: AXConnectedPosition,\n): { top: number; left: number } {\n let left = 0;\n let top = 0;\n\n // Calculate origin point on anchor\n switch (position.originX) {\n case 'start':\n left = anchorRect.left;\n break;\n case 'center':\n left = anchorRect.left + anchorRect.width / 2;\n break;\n case 'end':\n left = anchorRect.right;\n break;\n }\n\n switch (position.originY) {\n case 'top':\n top = anchorRect.top;\n break;\n case 'center':\n top = anchorRect.top + anchorRect.height / 2;\n break;\n case 'bottom':\n top = anchorRect.bottom;\n break;\n }\n\n // Adjust for overlay alignment\n switch (position.overlayX) {\n case 'start':\n // left stays the same\n break;\n case 'center':\n left -= overlayRect.width / 2;\n break;\n case 'end':\n left -= overlayRect.width;\n break;\n }\n\n switch (position.overlayY) {\n case 'top':\n // top stays the same\n break;\n case 'center':\n top -= overlayRect.height / 2;\n break;\n case 'bottom':\n top -= overlayRect.height;\n break;\n }\n\n // Apply offsets\n if (position.offsetX) {\n left += position.offsetX;\n }\n if (position.offsetY) {\n top += position.offsetY;\n }\n\n return { top, left };\n}\n\n/**\n * Checks if the overlay position fits within the viewport.\n */\nexport function fitsInViewport(\n position: { top: number; left: number },\n overlayRect: DOMRect,\n viewportWidth: number,\n viewportHeight: number,\n): boolean {\n return (\n position.left >= 0 &&\n position.top >= 0 &&\n position.left + overlayRect.width <= viewportWidth &&\n position.top + overlayRect.height <= viewportHeight\n );\n}\n\n/**\n * Clamps a position to ensure the overlay stays within viewport bounds.\n */\nexport function clampToViewport(\n coords: { top: number; left: number },\n overlayRect: DOMRect,\n viewportWidth: number,\n viewportHeight: number,\n margin = 4,\n): { top: number; left: number } {\n const clampedLeft = Math.max(margin, Math.min(coords.left, viewportWidth - overlayRect.width - margin));\n const clampedTop = Math.max(margin, Math.min(coords.top, viewportHeight - overlayRect.height - margin));\n\n return { top: clampedTop, left: clampedLeft };\n}\n\n/**\n * Finds the best position for an overlay that fits in the viewport.\n */\nexport function findBestPosition(\n anchorRect: DOMRect,\n overlayRect: DOMRect,\n positions: AXConnectedPosition[],\n viewportWidth: number,\n viewportHeight: number,\n): { position: AXConnectedPosition; coords: { top: number; left: number } } {\n for (const position of positions) {\n const coords = calculateAnchorPosition(anchorRect, overlayRect, position);\n\n if (fitsInViewport(coords, overlayRect, viewportWidth, viewportHeight)) {\n return { position, coords };\n }\n }\n\n // Fallback to first position if none fit, but clamp to viewport bounds\n const fallbackCoords = calculateAnchorPosition(anchorRect, overlayRect, positions[0]);\n const clampedCoords = clampToViewport(fallbackCoords, overlayRect, viewportWidth, viewportHeight);\n return { position: positions[0], coords: clampedCoords };\n}\n","import { convertToPlacement } from '@acorex/cdk/common';\nimport { AXComponentContent, AXComponentService } from '@acorex/core/components';\nimport { AXPlatform } from '@acorex/core/platform';\nimport { AXZIndexService, AXZToken } from '@acorex/core/z-index';\nimport { DOCUMENT } from '@angular/common';\nimport { ComponentRef, ElementRef, EmbeddedViewRef, inject, Injectable, TemplateRef } from '@angular/core';\nimport { AXOverlayOptions, AXOverlayRef, findBestPosition } from './overlay.types';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AXOverlayService {\n private componentService = inject(AXComponentService);\n private document = inject(DOCUMENT);\n private zIndexService = inject(AXZIndexService);\n private _platform: AXPlatform = inject(AXPlatform);\n\n /**\n * Creates an overlay with optional anchor-based positioning.\n * @param content - Component or template to display\n * @param options - Configuration options for the overlay\n * @returns Promise<AXOverlayRef> - Reference to the created overlay\n */\n async create<T = unknown>(content: AXComponentContent<T>, options?: AXOverlayOptions): Promise<AXOverlayRef<T>> {\n let instance: EmbeddedViewRef<T> | ComponentRef<T>;\n let overlayContainer: HTMLElement | null = null;\n let backdropElement: HTMLElement | null = null;\n let isDisposed = false;\n\n // Acquire a z-index token for this overlay\n let zToken: AXZToken | null = this.zIndexService.acquire();\n\n if (content instanceof TemplateRef) {\n instance = this.componentService.createFromTemplate<T>(content);\n } else {\n instance = this.componentService.createFromComponent<T>(content);\n if (options?.inputs) {\n Object.entries(options.inputs).forEach((c) => {\n (instance as ComponentRef<T>).setInput(c[0], c[1]);\n });\n }\n }\n\n // Get the host element\n const hostElement = this.getHostElement(instance);\n\n // Create backdrop if enabled\n if (options?.backdrop?.enabled) {\n backdropElement = this.createBackdrop(options, zToken.zIndex);\n }\n\n // If anchor options are provided, set up positioned overlay (for tooltips, popovers)\n if (options?.anchorOptions?.anchor) {\n overlayContainer = this.createOverlayContainer(hostElement, options, zToken.zIndex);\n this.positionOverlay(overlayContainer, options);\n } else if (options?.centered === false) {\n // Non-centered positioned overlay (for toasts, notifications)\n overlayContainer = this.createOverlayContainer(hostElement, options, zToken.zIndex);\n } else {\n // No anchor - create centered overlay (for modals, popups)\n overlayContainer = this.createCenteredOverlayContainer(hostElement, options, zToken.zIndex);\n }\n\n const updatePosition = () => {\n if (overlayContainer && options?.anchorOptions?.anchor) {\n this.positionOverlay(overlayContainer, options);\n }\n };\n\n const dispose = () => {\n if (isDisposed) return;\n isDisposed = true;\n\n // Remove backdrop\n if (backdropElement) {\n backdropElement.remove();\n }\n\n if (overlayContainer) {\n overlayContainer.remove();\n }\n if (instance instanceof ComponentRef) {\n instance.destroy();\n } else {\n instance.destroy();\n }\n\n // Release the z-index token\n this.zIndexService.release(zToken);\n zToken = null;\n\n // Notify callback\n options?.onDispose?.();\n };\n\n const bringToFront = () => {\n if (!zToken || isDisposed) return;\n zToken = this.zIndexService.bringToFront(zToken);\n if (backdropElement) {\n backdropElement.style.zIndex = String(zToken.zIndex);\n }\n if (overlayContainer) {\n overlayContainer.style.zIndex = String(zToken.zIndex);\n }\n };\n\n // Set up backdrop click handler\n if (backdropElement && options?.backdrop?.closeOnClick) {\n backdropElement.addEventListener('click', () => {\n dispose();\n });\n }\n\n this.addHostClass(options?.anchorOptions?.anchor, overlayContainer);\n\n return {\n instance,\n updatePosition,\n dispose,\n overlayElement: overlayContainer,\n zToken,\n bringToFront,\n };\n }\n\n /**\n * Creates a backdrop element.\n */\n private createBackdrop(options: AXOverlayOptions | undefined, zIndex: number): HTMLElement {\n const backdrop = this.document.createElement('div');\n backdrop.classList.add('ax-overlay-backdrop');\n\n if (options?.backdrop?.backdropClass) {\n backdrop.classList.add(options.backdrop.backdropClass);\n }\n\n // Style the backdrop\n backdrop.style.position = 'fixed';\n backdrop.style.top = '0';\n backdrop.style.left = '0';\n backdrop.style.width = '100%';\n backdrop.style.height = '100%';\n backdrop.style.zIndex = String(zIndex);\n\n if (options?.backdrop?.background) {\n backdrop.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';\n }\n\n this.document.body.appendChild(backdrop);\n return backdrop;\n }\n\n /**\n * Creates a centered overlay container (for modals/popups).\n */\n private createCenteredOverlayContainer(\n content: HTMLElement,\n options: AXOverlayOptions | undefined,\n zIndex: number,\n ): HTMLElement {\n const container = this.document.createElement('div');\n container.classList.add('ax-overlay-container', 'ax-overlay-centered');\n\n // Add custom panel classes\n if (options?.panelClass) {\n const classes = Array.isArray(options.panelClass) ? options.panelClass : [options.panelClass];\n classes.forEach((cls) => {\n if (cls) {\n container.classList.add(cls);\n }\n });\n }\n\n // Set styles for centered positioning\n container.style.position = 'fixed';\n container.style.top = '0';\n container.style.left = '0';\n container.style.width = '100%';\n container.style.height = '100%';\n container.style.display = 'flex';\n container.style.alignItems = 'center';\n container.style.justifyContent = 'center';\n container.style.zIndex = String(zIndex);\n\n // Create inner wrapper for the content\n const contentWrapper = this.document.createElement('div');\n contentWrapper.classList.add('ax-overlay-content');\n\n // Apply width if provided\n if (options?.width) {\n contentWrapper.style.width = options.width;\n }\n\n // Move content into wrapper\n contentWrapper.appendChild(content);\n container.appendChild(contentWrapper);\n\n // Append to body\n this.document.body.appendChild(container);\n\n return container;\n }\n\n /**\n * Gets the host element from a ComponentRef or EmbeddedViewRef.\n */\n private getHostElement<T>(instance: EmbeddedViewRef<T> | ComponentRef<T>): HTMLElement {\n if (instance instanceof ComponentRef) {\n return instance.location.nativeElement;\n } else {\n // EmbeddedViewRef - get the first root node\n return instance.rootNodes[0] as HTMLElement;\n }\n }\n\n /**\n * Creates an overlay container element and appends the content to it.\n */\n private createOverlayContainer(\n content: HTMLElement,\n options: AXOverlayOptions | undefined,\n zIndex: number,\n ): HTMLElement {\n const container = this.document.createElement('div');\n const pane = this.document.createElement('div');\n container.classList.add('ax-overlay-container');\n\n if (Array.isArray(options.panelClass)) {\n const check = options.panelClass.some((element) => {\n return element === 'ax-action-sheet-panel';\n });\n if (!check) pane.classList.add('ax-overlay-pane');\n }\n\n if (options.actionSheetStyle && this._platform.is('SM')) pane.classList.add('ax-overlay-actionsheet');\n\n // Add custom panel classes\n if (options?.panelClass) {\n const classes = Array.isArray(options.panelClass) ? options.panelClass : [options.panelClass];\n classes.forEach((cls) => {\n if (cls) {\n container.classList.add(cls);\n }\n });\n }\n\n // Set initial styles for positioning\n container.style.position = 'fixed';\n container.style.zIndex = String(zIndex);\n container.style.maxWidth = '100vw';\n container.style.maxHeight = '100vh';\n\n if (options?.actionSheetStyle) {\n container.style.width = this._platform.is('SM') ? '100%' : 'fit-content';\n } else {\n container.style.width = options?.width || 'fit-content';\n }\n\n // Move content into container\n pane.appendChild(content);\n container.appendChild(pane);\n\n // Append to body\n this.document.body.appendChild(container);\n\n return container;\n }\n\n /**\n * Positions the overlay container relative to the anchor element.\n */\n private positionOverlay(container: HTMLElement, options: AXOverlayOptions): void {\n if (options.actionSheetStyle && this._platform.is('SM')) {\n container.style.bottom = `0px`;\n container.style.left = `0px`;\n return;\n }\n\n const anchorOptions = options.anchorOptions;\n if (!anchorOptions?.anchor) return;\n\n const anchorElement =\n anchorOptions.anchor instanceof ElementRef ? anchorOptions.anchor.nativeElement : anchorOptions.anchor;\n\n const anchorRect = anchorElement.getBoundingClientRect();\n const containerRect = container.getBoundingClientRect();\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n // Get positions from placement\n let positions = convertToPlacement(anchorOptions.placement ?? 'bottom');\n if (positions.length === 0) {\n positions = convertToPlacement('bottom');\n }\n\n // Apply custom offsets to positions with direction-aware inversion\n // When position flips, the offset should also be inverted to maintain the intended gap\n if (anchorOptions.offsetX || anchorOptions.offsetY) {\n const primaryPosition = positions[0];\n positions = positions.map((p) => {\n let adjustedOffsetX = anchorOptions.offsetX ?? 0;\n let adjustedOffsetY = anchorOptions.offsetY ?? 0;\n\n // Invert offsetY when vertical direction flips\n // (from bottom to top or vice versa)\n if (primaryPosition.originY !== p.originY) {\n adjustedOffsetY = -adjustedOffsetY;\n }\n\n // Invert offsetX when horizontal direction flips\n // (from end to start or vice versa)\n if (primaryPosition.originX !== p.originX) {\n adjustedOffsetX = -adjustedOffsetX;\n }\n\n return {\n ...p,\n offsetX: (p.offsetX ?? 0) + adjustedOffsetX,\n offsetY: (p.offsetY ?? 0) + adjustedOffsetY,\n };\n });\n }\n\n // Find the best position that fits in viewport\n const { coords } = anchorOptions.autoFlip\n ? findBestPosition(anchorRect, containerRect, positions, viewportWidth, viewportHeight)\n : {\n coords: {\n top:\n positions[0].originY === 'bottom'\n ? anchorRect.bottom + (positions[0].offsetY ?? 0)\n : anchorRect.top - containerRect.height + (positions[0].offsetY ?? 0),\n left: anchorRect.left + (positions[0].offsetX ?? 0),\n },\n };\n\n // Apply position\n container.style.top = `${coords.top}px`;\n container.style.left = `${coords.left}px`;\n }\n\n private addHostClass(refElement: HTMLElement | ElementRef, targetElement: HTMLElement) {\n if (!refElement || !targetElement) return;\n const el = refElement instanceof ElementRef ? refElement.nativeElement : refElement;\n const computedStyle = getComputedStyle(el);\n const classSize = computedStyle.getPropertyValue('--ax-sys-size');\n const themeColor = +computedStyle.getPropertyValue('--ax-sys-theme-isDark');\n if (themeColor === 1) targetElement.classList.add('ax-dark');\n if (classSize) targetElement.classList.add(classSize);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAyDA;;AAEG;SACa,uBAAuB,CACrC,UAAmB,EACnB,WAAoB,EACpB,QAA6B,EAAA;IAE7B,IAAI,IAAI,GAAG,CAAC;IACZ,IAAI,GAAG,GAAG,CAAC;;AAGX,IAAA,QAAQ,QAAQ,CAAC,OAAO;AACtB,QAAA,KAAK,OAAO;AACV,YAAA,IAAI,GAAG,UAAU,CAAC,IAAI;YACtB;AACF,QAAA,KAAK,QAAQ;YACX,IAAI,GAAG,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,KAAK,GAAG,CAAC;YAC7C;AACF,QAAA,KAAK,KAAK;AACR,YAAA,IAAI,GAAG,UAAU,CAAC,KAAK;YACvB;;AAGJ,IAAA,QAAQ,QAAQ,CAAC,OAAO;AACtB,QAAA,KAAK,KAAK;AACR,YAAA,GAAG,GAAG,UAAU,CAAC,GAAG;YACpB;AACF,QAAA,KAAK,QAAQ;YACX,GAAG,GAAG,UAAU,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC;YAC5C;AACF,QAAA,KAAK,QAAQ;AACX,YAAA,GAAG,GAAG,UAAU,CAAC,MAAM;YACvB;;;AAIJ,IAAA,QAAQ,QAAQ,CAAC,QAAQ;AACvB,QAAA,KAAK,OAAO;;YAEV;AACF,QAAA,KAAK,QAAQ;AACX,YAAA,IAAI,IAAI,WAAW,CAAC,KAAK,GAAG,CAAC;YAC7B;AACF,QAAA,KAAK,KAAK;AACR,YAAA,IAAI,IAAI,WAAW,CAAC,KAAK;YACzB;;AAGJ,IAAA,QAAQ,QAAQ,CAAC,QAAQ;AACvB,QAAA,KAAK,KAAK;;YAER;AACF,QAAA,KAAK,QAAQ;AACX,YAAA,GAAG,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC;YAC7B;AAC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,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAhB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cAFf,MAAM,EAAA,CAAA,CAAA;;2FAEP,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAH5B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACVD;;AAEG;;;;"}
|
|
@@ -9,50 +9,35 @@ class AXPanViewDirective {
|
|
|
9
9
|
this.render = inject(Renderer2);
|
|
10
10
|
this.document = inject(DOCUMENT);
|
|
11
11
|
this.el = inject((ElementRef));
|
|
12
|
-
this.startX = signal(0, ...(ngDevMode ? [{ debugName: "startX" }] : []));
|
|
13
|
-
this.startY = signal(0, ...(ngDevMode ? [{ debugName: "startY" }] : []));
|
|
14
|
-
this.pointerDown = signal(false, ...(ngDevMode ? [{ debugName: "pointerDown" }] : []));
|
|
15
|
-
this.wrapper = signal(null, ...(ngDevMode ? [{ debugName: "wrapper" }] : []));
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
12
|
+
this.startX = signal(0, ...(ngDevMode ? [{ debugName: "startX" }] : /* istanbul ignore next */ []));
|
|
13
|
+
this.startY = signal(0, ...(ngDevMode ? [{ debugName: "startY" }] : /* istanbul ignore next */ []));
|
|
14
|
+
this.pointerDown = signal(false, ...(ngDevMode ? [{ debugName: "pointerDown" }] : /* istanbul ignore next */ []));
|
|
15
|
+
this.wrapper = signal(null, ...(ngDevMode ? [{ debugName: "wrapper" }] : /* istanbul ignore next */ []));
|
|
16
|
+
this.wheelListener = (e) => this.handleWheel(e);
|
|
17
|
+
this.zoomStep = input(7, ...(ngDevMode ? [{ debugName: "zoomStep" }] : /* istanbul ignore next */ []));
|
|
18
|
+
this.minZoom = input(25, ...(ngDevMode ? [{ debugName: "minZoom" }] : /* istanbul ignore next */ []));
|
|
19
|
+
this.maxZoom = input(400, ...(ngDevMode ? [{ debugName: "maxZoom" }] : /* istanbul ignore next */ []));
|
|
20
|
+
this.freeMode = input(false, ...(ngDevMode ? [{ debugName: "freeMode" }] : /* istanbul ignore next */ []));
|
|
21
|
+
this.fitContent = input(true, ...(ngDevMode ? [{ debugName: "fitContent" }] : /* istanbul ignore next */ []));
|
|
22
|
+
this.disablePan = input(false, ...(ngDevMode ? [{ debugName: "disablePan" }] : /* istanbul ignore next */ []));
|
|
23
|
+
this.disableZoom = input(false, ...(ngDevMode ? [{ debugName: "disableZoom" }] : /* istanbul ignore next */ []));
|
|
24
|
+
this.wrapperClasses = input('', ...(ngDevMode ? [{ debugName: "wrapperClasses" }] : /* istanbul ignore next */ []));
|
|
25
|
+
this.panX = model(0, ...(ngDevMode ? [{ debugName: "panX" }] : /* istanbul ignore next */ []));
|
|
26
|
+
this.panY = model(0, ...(ngDevMode ? [{ debugName: "panY" }] : /* istanbul ignore next */ []));
|
|
27
|
+
this.zoom = model(100, ...(ngDevMode ? [{ debugName: "zoom" }] : /* istanbul ignore next */ []));
|
|
27
28
|
this.zoomChange = output();
|
|
28
29
|
this.positionChange = output();
|
|
29
|
-
this.nativeEl = computed(() => this.el.nativeElement, ...(ngDevMode ? [{ debugName: "nativeEl" }] : []));
|
|
30
|
-
this.initialWidth = linkedSignal(() => this.nativeEl().getBoundingClientRect().width, ...(ngDevMode ? [{ debugName: "initialWidth" }] : []));
|
|
31
|
-
this.initialHeight = linkedSignal(() => this.nativeEl().getBoundingClientRect().height, ...(ngDevMode ? [{ debugName: "initialHeight" }] : []));
|
|
30
|
+
this.nativeEl = computed(() => this.el.nativeElement, ...(ngDevMode ? [{ debugName: "nativeEl" }] : /* istanbul ignore next */ []));
|
|
31
|
+
this.initialWidth = linkedSignal(() => this.nativeEl().getBoundingClientRect().width, ...(ngDevMode ? [{ debugName: "initialWidth" }] : /* istanbul ignore next */ []));
|
|
32
|
+
this.initialHeight = linkedSignal(() => this.nativeEl().getBoundingClientRect().height, ...(ngDevMode ? [{ debugName: "initialHeight" }] : /* istanbul ignore next */ []));
|
|
32
33
|
this.#anr = afterNextRender(() => {
|
|
33
34
|
// Create Wrapper
|
|
34
35
|
this.createWrapper();
|
|
35
36
|
this.zone.runOutsideAngular(() => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.handleZoomChange(e);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
else if (e.shiftKey) {
|
|
44
|
-
if (this.disablePan())
|
|
45
|
-
return;
|
|
46
|
-
this.panX.update((prev) => prev - e.deltaY / 3);
|
|
47
|
-
this.setElementPosition();
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
if (this.disablePan())
|
|
51
|
-
return;
|
|
52
|
-
this.panY.update((prev) => prev - e.deltaY / 3);
|
|
53
|
-
this.setElementPosition();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
37
|
+
const wrapper = this.wrapper();
|
|
38
|
+
if (!wrapper)
|
|
39
|
+
return;
|
|
40
|
+
wrapper.addEventListener('wheel', this.wheelListener, { passive: false });
|
|
56
41
|
// Pointer Down Event
|
|
57
42
|
this.wrapper().onpointerdown = (e) => this.handlePointerDown(e);
|
|
58
43
|
// Pointer Move Event
|
|
@@ -70,10 +55,13 @@ class AXPanViewDirective {
|
|
|
70
55
|
});
|
|
71
56
|
});
|
|
72
57
|
}
|
|
58
|
+
static { this.WHEEL_PAN_FACTOR = 1 / 3; }
|
|
73
59
|
#anr;
|
|
74
60
|
ngOnDestroy() {
|
|
75
|
-
if (isPlatformBrowser(this.platformId))
|
|
76
|
-
|
|
61
|
+
if (!isPlatformBrowser(this.platformId))
|
|
62
|
+
return;
|
|
63
|
+
this.wrapper()?.removeEventListener('wheel', this.wheelListener);
|
|
64
|
+
this.resizeObserver?.disconnect();
|
|
77
65
|
}
|
|
78
66
|
createWrapper() {
|
|
79
67
|
this.wrapper.set(this.render.createElement('div'));
|
|
@@ -120,10 +108,38 @@ class AXPanViewDirective {
|
|
|
120
108
|
this.pointerDown.set(false);
|
|
121
109
|
this.wrapper().style.cursor = 'auto';
|
|
122
110
|
}
|
|
111
|
+
handleWheel(e) {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
if (this.freeMode()) {
|
|
114
|
+
this.handleZoomChange(e);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (e.ctrlKey) {
|
|
118
|
+
this.handleZoomChange(e);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
if (this.disablePan())
|
|
122
|
+
return;
|
|
123
|
+
const delta = this.getWheelDelta(e, e.shiftKey);
|
|
124
|
+
this.zone.run(() => {
|
|
125
|
+
if (e.shiftKey) {
|
|
126
|
+
this.panX.update((prev) => prev - delta * AXPanViewDirective.WHEEL_PAN_FACTOR);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.panY.update((prev) => prev - delta * AXPanViewDirective.WHEEL_PAN_FACTOR);
|
|
130
|
+
}
|
|
131
|
+
this.setElementPosition();
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
getWheelDelta(e, horizontal) {
|
|
135
|
+
if (horizontal) {
|
|
136
|
+
return e.deltaX !== 0 ? e.deltaX : e.deltaY;
|
|
137
|
+
}
|
|
138
|
+
return e.deltaY !== 0 ? e.deltaY : e.deltaX;
|
|
139
|
+
}
|
|
123
140
|
handleZoomChange(e) {
|
|
124
141
|
if (this.disableZoom())
|
|
125
142
|
return;
|
|
126
|
-
e.preventDefault();
|
|
127
143
|
const rect = this.nativeEl().getBoundingClientRect();
|
|
128
144
|
const mouseX = e.clientX - rect.left;
|
|
129
145
|
const mouseY = e.clientY - rect.top;
|
|
@@ -131,11 +147,13 @@ class AXPanViewDirective {
|
|
|
131
147
|
const zoomDirection = e.deltaY > 0 ? -1 : 1; // Scroll up -> zoom in, scroll down -> zoom out
|
|
132
148
|
const newZoom = Math.round(Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom() + zoomDirection * this.zoomStep())));
|
|
133
149
|
const scaleChange = newZoom / this.zoom();
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
150
|
+
this.zone.run(() => {
|
|
151
|
+
// Adjust pan to keep zoom centered at the mouse position
|
|
152
|
+
this.panX.update((prev) => prev - (mouseX - rect.width / 2) * (scaleChange - 1));
|
|
153
|
+
this.panY.update((prev) => prev - (mouseY - rect.height / 2) * (scaleChange - 1));
|
|
154
|
+
this.zoom.set(newZoom);
|
|
155
|
+
this.setElementPosition();
|
|
156
|
+
});
|
|
139
157
|
}
|
|
140
158
|
sizeChanged() {
|
|
141
159
|
const prevWidth = this.initialWidth();
|
|
@@ -182,10 +200,10 @@ class AXPanViewDirective {
|
|
|
182
200
|
this.zoom.set(Math.round(Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom() - this.zoomStep()))));
|
|
183
201
|
this.setElementPosition();
|
|
184
202
|
}
|
|
185
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
186
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.
|
|
203
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPanViewDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
204
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: AXPanViewDirective, isStandalone: true, selector: "[axPanView]", inputs: { zoomStep: { classPropertyName: "zoomStep", publicName: "zoomStep", isSignal: true, isRequired: false, transformFunction: null }, minZoom: { classPropertyName: "minZoom", publicName: "minZoom", isSignal: true, isRequired: false, transformFunction: null }, maxZoom: { classPropertyName: "maxZoom", publicName: "maxZoom", isSignal: true, isRequired: false, transformFunction: null }, freeMode: { classPropertyName: "freeMode", publicName: "freeMode", isSignal: true, isRequired: false, transformFunction: null }, fitContent: { classPropertyName: "fitContent", publicName: "fitContent", isSignal: true, isRequired: false, transformFunction: null }, disablePan: { classPropertyName: "disablePan", publicName: "disablePan", isSignal: true, isRequired: false, transformFunction: null }, disableZoom: { classPropertyName: "disableZoom", publicName: "disableZoom", isSignal: true, isRequired: false, transformFunction: null }, wrapperClasses: { classPropertyName: "wrapperClasses", publicName: "wrapperClasses", isSignal: true, isRequired: false, transformFunction: null }, panX: { classPropertyName: "panX", publicName: "panX", isSignal: true, isRequired: false, transformFunction: null }, panY: { classPropertyName: "panY", publicName: "panY", isSignal: true, isRequired: false, transformFunction: null }, zoom: { classPropertyName: "zoom", publicName: "zoom", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { panX: "panXChange", panY: "panYChange", zoom: "zoomChange", zoomChange: "zoomChange", positionChange: "positionChange" }, exportAs: ["axPanView"], ngImport: i0 }); }
|
|
187
205
|
}
|
|
188
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
206
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPanViewDirective, decorators: [{
|
|
189
207
|
type: Directive,
|
|
190
208
|
args: [{
|
|
191
209
|
selector: '[axPanView]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-cdk-pan-view.mjs","sources":["../../../../packages/cdk/pan-view/src/lib/pan-view.directive.ts","../../../../packages/cdk/pan-view/src/acorex-cdk-pan-view.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n computed,\n Directive,\n DOCUMENT,\n ElementRef,\n inject,\n input,\n linkedSignal,\n model,\n NgZone,\n OnDestroy,\n output,\n PLATFORM_ID,\n Renderer2,\n signal,\n} from '@angular/core';\n\n@Directive({\n selector: '[axPanView]',\n exportAs: 'axPanView',\n})\nexport class AXPanViewDirective implements OnDestroy {\n private resizeObserver: ResizeObserver;\n\n private platformId = inject(PLATFORM_ID);\n private zone = inject(NgZone);\n private render = inject(Renderer2);\n private document = inject(DOCUMENT);\n private el = inject(ElementRef<HTMLElement>);\n\n private startX = signal(0);\n private startY = signal(0);\n private pointerDown = signal(false);\n private wrapper = signal<HTMLDivElement | null>(null);\n\n zoomStep = input(7);\n minZoom = input(25);\n maxZoom = input(400);\n freeMode = input(false);\n fitContent = input(true);\n disablePan = input(false);\n disableZoom = input(false);\n wrapperClasses = input('');\n\n panX = model(0);\n panY = model(0);\n zoom = model(100);\n\n zoomChange = output<number>();\n positionChange = output<{ x: number; y: number }>();\n\n private nativeEl = computed(() => this.el.nativeElement as HTMLElement);\n\n private initialWidth = linkedSignal(() => this.nativeEl().getBoundingClientRect().width);\n private initialHeight = linkedSignal(() => this.nativeEl().getBoundingClientRect().height);\n\n #anr = afterNextRender(() => {\n // Create Wrapper\n this.createWrapper();\n this.zone.runOutsideAngular(() => {\n // Wheel Event\n this.wrapper().onwheel = (e) => {\n e.preventDefault();\n if (e.ctrlKey || this.freeMode()) {\n this.handleZoomChange(e);\n return;\n } else if (e.shiftKey) {\n if (this.disablePan()) return;\n this.panX.update((prev) => prev - e.deltaY / 3);\n this.setElementPosition();\n } else {\n if (this.disablePan()) return;\n this.panY.update((prev) => prev - e.deltaY / 3);\n this.setElementPosition();\n }\n };\n // Pointer Down Event\n this.wrapper().onpointerdown = (e) => this.handlePointerDown(e);\n // Pointer Move Event\n this.document.onpointermove = (e) => this.handlePointerMove(e);\n // Pointer Up/Leave Event\n this.document.onpointerup = (e) => this.handlePointerUp(e);\n\n if (isPlatformBrowser(this.platformId)) {\n this.resizeObserver = new ResizeObserver(() => this.sizeChanged());\n this.resizeObserver.observe(this.wrapper());\n this.resizeObserver.observe(this.nativeEl());\n }\n });\n setTimeout(() => {\n this.resetPosition();\n });\n });\n\n ngOnDestroy(): void {\n if (isPlatformBrowser(this.platformId)) this.resizeObserver.disconnect();\n }\n\n private createWrapper() {\n this.wrapper.set(this.render.createElement('div'));\n this.render.addClass(this.wrapper(), 'ax-pan-view-wrapper');\n if (this.wrapperClasses()) this.render.addClass(this.wrapper(), this.wrapperClasses());\n\n const parent = this.nativeEl().parentNode;\n this.render.appendChild(this.wrapper(), this.nativeEl());\n this.render.insertBefore(parent, this.wrapper(), this.nativeEl().nextSibling);\n\n this.render.setStyle(this.wrapper(), 'width', '100%');\n this.render.setStyle(this.wrapper(), 'height', '100%');\n this.render.setStyle(this.wrapper(), 'overflow', 'hidden');\n this.render.setStyle(this.wrapper(), 'position', 'relative');\n\n this.render.setStyle(this.nativeEl(), 'top', '0');\n this.render.setStyle(this.nativeEl(), 'left', '0');\n this.render.setStyle(this.nativeEl(), 'position', 'absolute');\n }\n\n private handlePointerDown(e: PointerEvent) {\n if (this.disablePan()) return;\n if (!this.freeMode() && e.pointerType === 'mouse' && e.buttons !== 4) return;\n if (this.freeMode() && e.pointerType === 'mouse' && e.buttons !== 1) return;\n e.preventDefault();\n this.pointerDown.set(true);\n this.wrapper().style.cursor = 'grabbing';\n\n // Update previous position for next move\n this.startX.set(e.clientX - this.panX());\n this.startY.set(e.clientY - this.panY());\n }\n\n private handlePointerMove(e: PointerEvent) {\n if (!this.pointerDown() || this.disablePan()) return;\n e.preventDefault();\n this.panX.set(e.clientX - this.startX());\n this.panY.set(e.clientY - this.startY());\n\n this.setElementPosition();\n }\n\n private handlePointerUp(e: PointerEvent) {\n if (!this.pointerDown() || this.disablePan()) return;\n e.preventDefault();\n this.pointerDown.set(false);\n this.wrapper().style.cursor = 'auto';\n }\n\n private handleZoomChange(e: WheelEvent) {\n if (this.disableZoom()) return;\n\n e.preventDefault();\n\n const rect = this.nativeEl().getBoundingClientRect();\n const mouseX = e.clientX - rect.left;\n const mouseY = e.clientY - rect.top;\n\n // Calculate the new zoom based on step\n const zoomDirection = e.deltaY > 0 ? -1 : 1; // Scroll up -> zoom in, scroll down -> zoom out\n const newZoom = Math.round(\n Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom() + zoomDirection * this.zoomStep())),\n );\n\n const scaleChange = newZoom / this.zoom();\n\n // Adjust pan to keep zoom centered at the mouse position\n this.panX.update((prev) => prev - (mouseX - rect.width / 2) * (scaleChange - 1));\n this.panY.update((prev) => prev - (mouseY - rect.height / 2) * (scaleChange - 1));\n this.zoom.set(newZoom);\n\n this.setElementPosition();\n }\n\n private sizeChanged() {\n const prevWidth = this.initialWidth();\n const prevHeight = this.initialHeight();\n\n this.initialWidth.set((this.nativeEl().getBoundingClientRect().width * 100) / this.zoom());\n this.initialHeight.set((this.nativeEl().getBoundingClientRect().height * 100) / this.zoom());\n\n const newWidth = this.initialWidth();\n const newHeight = this.initialHeight();\n\n // Maintain the same relative position\n this.panX.update((prev) => prev - (newWidth - prevWidth) / 2);\n this.panY.update((prev) => prev - (newHeight - prevHeight) / 2);\n\n this.setElementPosition();\n }\n\n private setFitContentScale() {\n if (!this.fitContent()) return;\n const height = this.wrapper().clientHeight / this.nativeEl().clientHeight;\n const width = this.wrapper().clientWidth / this.nativeEl().clientWidth;\n this.zoom.set(Math.round(Math.min(height, width) * 100));\n }\n\n setElementPosition() {\n this.nativeEl().style.transform = `translate(${this.panX()}px, ${this.panY()}px) scale(${this.zoom() / 100})`;\n\n this.positionChange.emit({ x: this.panX(), y: this.panY() });\n this.zoomChange.emit(this.zoom());\n }\n\n resetPosition() {\n const containerWidth = this.wrapper().offsetWidth;\n const containerHeight = this.wrapper().offsetHeight;\n\n const boxLeft = (containerWidth - this.initialWidth()) / 2;\n const boxTop = (containerHeight - this.initialHeight()) / 2;\n\n this.panX.set(boxLeft);\n this.panY.set(boxTop);\n\n if (this.fitContent()) this.setFitContentScale();\n else this.zoom.set(100);\n\n this.setElementPosition();\n }\n\n zoomIn() {\n this.zoom.set(Math.round(Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom() + this.zoomStep()))));\n this.setElementPosition();\n }\n\n zoomOut() {\n this.zoom.set(Math.round(Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom() - this.zoomStep()))));\n this.setElementPosition();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAuBa,kBAAkB,CAAA;AAJ/B,IAAA,WAAA,GAAA;AAOU,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAChC,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;AACrB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;AAC1B,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,EAAC,UAAuB,EAAC;AAEpC,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,CAAC,kDAAC;AAClB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,CAAC,kDAAC;AAClB,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,KAAK,uDAAC;AAC3B,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAwB,IAAI,mDAAC;AAErD,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,CAAC,oDAAC;AACnB,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC,EAAE,mDAAC;AACnB,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC,GAAG,mDAAC;AACpB,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,oDAAC;AACvB,QAAA,IAAA,CAAA,UAAU,GAAG,KAAK,CAAC,I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A,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,IAAA,EAAA,YAAA,EAAA,IAAA,EAAA,YAAA,EAAA,IAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACtB,iBAAA;;;ACtBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"acorex-cdk-pan-view.mjs","sources":["../../../../packages/cdk/pan-view/src/lib/pan-view.directive.ts","../../../../packages/cdk/pan-view/src/acorex-cdk-pan-view.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n computed,\n Directive,\n DOCUMENT,\n ElementRef,\n inject,\n input,\n linkedSignal,\n model,\n NgZone,\n OnDestroy,\n output,\n PLATFORM_ID,\n Renderer2,\n signal,\n} from '@angular/core';\n\n@Directive({\n selector: '[axPanView]',\n exportAs: 'axPanView',\n})\nexport class AXPanViewDirective implements OnDestroy {\n private resizeObserver: ResizeObserver;\n\n private platformId = inject(PLATFORM_ID);\n private zone = inject(NgZone);\n private render = inject(Renderer2);\n private document = inject(DOCUMENT);\n private el = inject(ElementRef<HTMLElement>);\n\n private startX = signal(0);\n private startY = signal(0);\n private pointerDown = signal(false);\n private wrapper = signal<HTMLDivElement | null>(null);\n private readonly wheelListener = (e: WheelEvent) => this.handleWheel(e);\n\n private static readonly WHEEL_PAN_FACTOR = 1 / 3;\n\n zoomStep = input(7);\n minZoom = input(25);\n maxZoom = input(400);\n freeMode = input(false);\n fitContent = input(true);\n disablePan = input(false);\n disableZoom = input(false);\n wrapperClasses = input('');\n\n panX = model(0);\n panY = model(0);\n zoom = model(100);\n\n zoomChange = output<number>();\n positionChange = output<{ x: number; y: number }>();\n\n private nativeEl = computed(() => this.el.nativeElement as HTMLElement);\n\n private initialWidth = linkedSignal(() => this.nativeEl().getBoundingClientRect().width);\n private initialHeight = linkedSignal(() => this.nativeEl().getBoundingClientRect().height);\n\n #anr = afterNextRender(() => {\n // Create Wrapper\n this.createWrapper();\n this.zone.runOutsideAngular(() => {\n const wrapper = this.wrapper();\n if (!wrapper) return;\n wrapper.addEventListener('wheel', this.wheelListener, { passive: false });\n // Pointer Down Event\n this.wrapper().onpointerdown = (e) => this.handlePointerDown(e);\n // Pointer Move Event\n this.document.onpointermove = (e) => this.handlePointerMove(e);\n // Pointer Up/Leave Event\n this.document.onpointerup = (e) => this.handlePointerUp(e);\n\n if (isPlatformBrowser(this.platformId)) {\n this.resizeObserver = new ResizeObserver(() => this.sizeChanged());\n this.resizeObserver.observe(this.wrapper());\n this.resizeObserver.observe(this.nativeEl());\n }\n });\n setTimeout(() => {\n this.resetPosition();\n });\n });\n\n ngOnDestroy(): void {\n if (!isPlatformBrowser(this.platformId)) return;\n this.wrapper()?.removeEventListener('wheel', this.wheelListener);\n this.resizeObserver?.disconnect();\n }\n\n private createWrapper() {\n this.wrapper.set(this.render.createElement('div'));\n this.render.addClass(this.wrapper(), 'ax-pan-view-wrapper');\n if (this.wrapperClasses()) this.render.addClass(this.wrapper(), this.wrapperClasses());\n\n const parent = this.nativeEl().parentNode;\n this.render.appendChild(this.wrapper(), this.nativeEl());\n this.render.insertBefore(parent, this.wrapper(), this.nativeEl().nextSibling);\n\n this.render.setStyle(this.wrapper(), 'width', '100%');\n this.render.setStyle(this.wrapper(), 'height', '100%');\n this.render.setStyle(this.wrapper(), 'overflow', 'hidden');\n this.render.setStyle(this.wrapper(), 'position', 'relative');\n\n this.render.setStyle(this.nativeEl(), 'top', '0');\n this.render.setStyle(this.nativeEl(), 'left', '0');\n this.render.setStyle(this.nativeEl(), 'position', 'absolute');\n }\n\n private handlePointerDown(e: PointerEvent) {\n if (this.disablePan()) return;\n if (!this.freeMode() && e.pointerType === 'mouse' && e.buttons !== 4) return;\n if (this.freeMode() && e.pointerType === 'mouse' && e.buttons !== 1) return;\n e.preventDefault();\n this.pointerDown.set(true);\n this.wrapper().style.cursor = 'grabbing';\n\n // Update previous position for next move\n this.startX.set(e.clientX - this.panX());\n this.startY.set(e.clientY - this.panY());\n }\n\n private handlePointerMove(e: PointerEvent) {\n if (!this.pointerDown() || this.disablePan()) return;\n e.preventDefault();\n this.panX.set(e.clientX - this.startX());\n this.panY.set(e.clientY - this.startY());\n\n this.setElementPosition();\n }\n\n private handlePointerUp(e: PointerEvent) {\n if (!this.pointerDown() || this.disablePan()) return;\n e.preventDefault();\n this.pointerDown.set(false);\n this.wrapper().style.cursor = 'auto';\n }\n\n private handleWheel(e: WheelEvent) {\n e.preventDefault();\n\n if (this.freeMode()) {\n this.handleZoomChange(e);\n return;\n }\n\n if (e.ctrlKey) {\n this.handleZoomChange(e);\n return;\n }\n\n if (this.disablePan()) return;\n\n const delta = this.getWheelDelta(e, e.shiftKey);\n this.zone.run(() => {\n if (e.shiftKey) {\n this.panX.update((prev) => prev - delta * AXPanViewDirective.WHEEL_PAN_FACTOR);\n } else {\n this.panY.update((prev) => prev - delta * AXPanViewDirective.WHEEL_PAN_FACTOR);\n }\n this.setElementPosition();\n });\n }\n\n private getWheelDelta(e: WheelEvent, horizontal: boolean): number {\n if (horizontal) {\n return e.deltaX !== 0 ? e.deltaX : e.deltaY;\n }\n return e.deltaY !== 0 ? e.deltaY : e.deltaX;\n }\n\n private handleZoomChange(e: WheelEvent) {\n if (this.disableZoom()) return;\n\n const rect = this.nativeEl().getBoundingClientRect();\n const mouseX = e.clientX - rect.left;\n const mouseY = e.clientY - rect.top;\n\n // Calculate the new zoom based on step\n const zoomDirection = e.deltaY > 0 ? -1 : 1; // Scroll up -> zoom in, scroll down -> zoom out\n const newZoom = Math.round(\n Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom() + zoomDirection * this.zoomStep())),\n );\n\n const scaleChange = newZoom / this.zoom();\n\n this.zone.run(() => {\n // Adjust pan to keep zoom centered at the mouse position\n this.panX.update((prev) => prev - (mouseX - rect.width / 2) * (scaleChange - 1));\n this.panY.update((prev) => prev - (mouseY - rect.height / 2) * (scaleChange - 1));\n this.zoom.set(newZoom);\n this.setElementPosition();\n });\n }\n\n private sizeChanged() {\n const prevWidth = this.initialWidth();\n const prevHeight = this.initialHeight();\n\n this.initialWidth.set((this.nativeEl().getBoundingClientRect().width * 100) / this.zoom());\n this.initialHeight.set((this.nativeEl().getBoundingClientRect().height * 100) / this.zoom());\n\n const newWidth = this.initialWidth();\n const newHeight = this.initialHeight();\n\n // Maintain the same relative position\n this.panX.update((prev) => prev - (newWidth - prevWidth) / 2);\n this.panY.update((prev) => prev - (newHeight - prevHeight) / 2);\n\n this.setElementPosition();\n }\n\n private setFitContentScale() {\n if (!this.fitContent()) return;\n const height = this.wrapper().clientHeight / this.nativeEl().clientHeight;\n const width = this.wrapper().clientWidth / this.nativeEl().clientWidth;\n this.zoom.set(Math.round(Math.min(height, width) * 100));\n }\n\n setElementPosition() {\n this.nativeEl().style.transform = `translate(${this.panX()}px, ${this.panY()}px) scale(${this.zoom() / 100})`;\n\n this.positionChange.emit({ x: this.panX(), y: this.panY() });\n this.zoomChange.emit(this.zoom());\n }\n\n resetPosition() {\n const containerWidth = this.wrapper().offsetWidth;\n const containerHeight = this.wrapper().offsetHeight;\n\n const boxLeft = (containerWidth - this.initialWidth()) / 2;\n const boxTop = (containerHeight - this.initialHeight()) / 2;\n\n this.panX.set(boxLeft);\n this.panY.set(boxTop);\n\n if (this.fitContent()) this.setFitContentScale();\n else this.zoom.set(100);\n\n this.setElementPosition();\n }\n\n zoomIn() {\n this.zoom.set(Math.round(Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom() + this.zoomStep()))));\n this.setElementPosition();\n }\n\n zoomOut() {\n this.zoom.set(Math.round(Math.max(this.minZoom(), Math.min(this.maxZoom(), this.zoom() - this.zoomStep()))));\n this.setElementPosition();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAuBa,kBAAkB,CAAA;AAJ/B,IAAA,WAAA,GAAA;AAOU,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC;AAChC,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;AACrB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC;AAC1B,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,EAAC,UAAuB,EAAC;AAEpC,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,CAAC,6EAAC;AAClB,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,CAAC,6EAAC;AAClB,QAAA,IAAA,CAAA,WAAW,GAAG,MAAM,CAAC,KAAK,kFAAC;AAC3B,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAwB,IAAI,8EAAC;AACpC,QAAA,IAAA,CAAA,aAAa,GAAG,CAAC,CAAa,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;AAIvE,QAAA,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAC,CAAC,+EAAC;AACnB,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAC,EAAE,8EAAC;AACnB,QAAA,IAAA,CAAA,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,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,IAAA,EAAA,YAAA,EAAA,IAAA,EAAA,YAAA,EAAA,IAAA,EAAA,YAAA,EAAA,UAAA,EAAA,YAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,EAAA,QAAA,EAAA,CAAA,WAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,WAAW;AACtB,iBAAA;;;ACtBD;;AAEG;;;;"}
|
|
@@ -2,7 +2,7 @@ import { AXPlatform } from '@acorex/core/platform';
|
|
|
2
2
|
import { AXHtmlUtil } from '@acorex/core/utils';
|
|
3
3
|
import { isPlatformBrowser } from '@angular/common';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { inject, ElementRef, NgZone, DOCUMENT, PLATFORM_ID, signal, model, output, Directive } from '@angular/core';
|
|
5
|
+
import { inject, ElementRef, NgZone, DOCUMENT, PLATFORM_ID, signal, model, output, effect, Directive } from '@angular/core';
|
|
6
6
|
import { Subscription } from 'rxjs';
|
|
7
7
|
|
|
8
8
|
class AXResizableDirective {
|
|
@@ -12,7 +12,7 @@ class AXResizableDirective {
|
|
|
12
12
|
this.zone = inject(NgZone);
|
|
13
13
|
this.document = inject(DOCUMENT);
|
|
14
14
|
this.platformID = inject(PLATFORM_ID);
|
|
15
|
-
this.isResizing = signal(false, ...(ngDevMode ? [{ debugName: "isResizing" }] : []));
|
|
15
|
+
this.isResizing = signal(false, ...(ngDevMode ? [{ debugName: "isResizing" }] : /* istanbul ignore next */ []));
|
|
16
16
|
this.initialElementWidth = 0;
|
|
17
17
|
this.startMoveWidth = 0;
|
|
18
18
|
this.subscriptions = new Subscription();
|
|
@@ -35,24 +35,24 @@ class AXResizableDirective {
|
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
/** Define if directive is active or not */
|
|
38
|
-
this.axResizable = model(true, ...(ngDevMode ? [{ debugName: "axResizable" }] : []));
|
|
38
|
+
this.axResizable = model(true, ...(ngDevMode ? [{ debugName: "axResizable" }] : /* istanbul ignore next */ []));
|
|
39
39
|
/** Minimum width for the resizable element. */
|
|
40
|
-
this.minWidth = model(100, ...(ngDevMode ? [{ debugName: "minWidth" }] : []));
|
|
40
|
+
this.minWidth = model(100, ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
|
|
41
41
|
/** Maximum width for the resizable element. Defaults to parent width if not provided. */
|
|
42
|
-
this.maxWidth = model(Infinity, ...(ngDevMode ? [{ debugName: "maxWidth" }] : []));
|
|
42
|
+
this.maxWidth = model(Infinity, ...(ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []));
|
|
43
43
|
/** Behavior on double-click: 'reset' or 'maximize'. */
|
|
44
|
-
this.dblClickAction = model('reset', ...(ngDevMode ? [{ debugName: "dblClickAction" }] : []));
|
|
44
|
+
this.dblClickAction = model('reset', ...(ngDevMode ? [{ debugName: "dblClickAction" }] : /* istanbul ignore next */ []));
|
|
45
45
|
/** Define initial width for the element. */
|
|
46
|
-
this.width = model(null, ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
46
|
+
this.width = model(null, ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
47
47
|
/** Define reset width for the element. */
|
|
48
|
-
this.defaultWidth = model(null, ...(ngDevMode ? [{ debugName: "defaultWidth" }] : []));
|
|
48
|
+
this.defaultWidth = model(null, ...(ngDevMode ? [{ debugName: "defaultWidth" }] : /* istanbul ignore next */ []));
|
|
49
49
|
/** Event emitted when resizing starts. */
|
|
50
50
|
this.onResizingStarted = output();
|
|
51
51
|
/** Event emitted when resizing ends. */
|
|
52
52
|
this.onResizingEnded = output();
|
|
53
53
|
/** Event emitted on double-click. */
|
|
54
54
|
this.onResizingDblClick = output();
|
|
55
|
-
this.isRTL = signal(AXHtmlUtil.isRtl(this.document.documentElement), ...(ngDevMode ? [{ debugName: "isRTL" }] : []));
|
|
55
|
+
this.isRTL = signal(AXHtmlUtil.isRtl(this.document.documentElement), ...(ngDevMode ? [{ debugName: "isRTL" }] : /* istanbul ignore next */ []));
|
|
56
56
|
this.isBrowser = isPlatformBrowser(this.platformID);
|
|
57
57
|
this.hostElement = this.el.nativeElement;
|
|
58
58
|
this.subscriptions.add(this.platformService.directionChange.subscribe((i) => {
|
|
@@ -61,15 +61,23 @@ class AXResizableDirective {
|
|
|
61
61
|
this.updateHandlePosition();
|
|
62
62
|
}
|
|
63
63
|
}));
|
|
64
|
+
if (this.isBrowser) {
|
|
65
|
+
effect(() => {
|
|
66
|
+
if (this.isResizing()) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const resolvedWidth = this.width() ?? this.defaultWidth();
|
|
70
|
+
if (resolvedWidth !== null) {
|
|
71
|
+
this.applyElementWidth(resolvedWidth);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
64
75
|
}
|
|
65
76
|
ngAfterViewInit() {
|
|
66
77
|
if (!this.isBrowser)
|
|
67
78
|
return;
|
|
68
79
|
this.initialElementWidth = this.hostElement.offsetWidth;
|
|
69
|
-
|
|
70
|
-
if (initialWidth !== null) {
|
|
71
|
-
this.hostElement.style.width = `${initialWidth}px`;
|
|
72
|
-
}
|
|
80
|
+
this.applyWidthFromModel();
|
|
73
81
|
if (this.maxWidth() === Infinity) {
|
|
74
82
|
const parentWidth = this.hostElement.parentElement?.offsetWidth;
|
|
75
83
|
if (parentWidth) {
|
|
@@ -91,14 +99,29 @@ class AXResizableDirective {
|
|
|
91
99
|
setupResizableState() {
|
|
92
100
|
this.subscriptions.add(this.axResizable.subscribe((isActive) => {
|
|
93
101
|
if (!isActive) {
|
|
94
|
-
this.
|
|
102
|
+
this.applyWidthFromModel();
|
|
95
103
|
this.cleanupEventListeners();
|
|
96
104
|
}
|
|
97
105
|
else {
|
|
106
|
+
this.applyWidthFromModel();
|
|
98
107
|
this.createResizeHandle();
|
|
99
108
|
}
|
|
100
109
|
}));
|
|
101
110
|
}
|
|
111
|
+
applyWidthFromModel() {
|
|
112
|
+
const width = this.width();
|
|
113
|
+
if (width !== null) {
|
|
114
|
+
this.applyElementWidth(width);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const defaultWidth = this.defaultWidth();
|
|
118
|
+
if (defaultWidth !== null) {
|
|
119
|
+
this.applyElementWidth(defaultWidth);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
applyElementWidth(width) {
|
|
123
|
+
this.hostElement.style.width = `${width}px`;
|
|
124
|
+
}
|
|
102
125
|
createResizeHandle() {
|
|
103
126
|
if (!this.axResizable() || this.resizeHandle)
|
|
104
127
|
return;
|
|
@@ -201,11 +224,11 @@ class AXResizableDirective {
|
|
|
201
224
|
onMouseUp() {
|
|
202
225
|
if (!this.isResizing() || !this.resizeHandle)
|
|
203
226
|
return;
|
|
204
|
-
this.isResizing.set(false);
|
|
205
227
|
this.document.body.style.cursor = '';
|
|
206
228
|
this.resizeHandle.style.backgroundColor = STYLES.backgroundColor;
|
|
207
229
|
const currentWidth = this.hostElement.offsetWidth;
|
|
208
230
|
this.zone.run(() => {
|
|
231
|
+
this.width.set(currentWidth);
|
|
209
232
|
this.onResizingEnded.emit({
|
|
210
233
|
component: this,
|
|
211
234
|
htmlElement: this.hostElement,
|
|
@@ -215,6 +238,7 @@ class AXResizableDirective {
|
|
|
215
238
|
oldValue: this.startMoveWidth,
|
|
216
239
|
});
|
|
217
240
|
});
|
|
241
|
+
this.isResizing.set(false);
|
|
218
242
|
}
|
|
219
243
|
onMouseEnter() {
|
|
220
244
|
if (!this.isResizing() && this.resizeHandle) {
|
|
@@ -257,21 +281,21 @@ class AXResizableDirective {
|
|
|
257
281
|
resetToInitialWidth() {
|
|
258
282
|
const defaultWidth = this.defaultWidth();
|
|
259
283
|
if (defaultWidth !== null) {
|
|
260
|
-
this.
|
|
284
|
+
this.applyElementWidth(defaultWidth);
|
|
261
285
|
return defaultWidth;
|
|
262
286
|
}
|
|
263
287
|
const initialWidth = this.width();
|
|
264
288
|
if (initialWidth !== null) {
|
|
265
|
-
this.
|
|
289
|
+
this.applyElementWidth(initialWidth);
|
|
266
290
|
return initialWidth;
|
|
267
291
|
}
|
|
268
|
-
this.
|
|
292
|
+
this.applyElementWidth(this.initialElementWidth);
|
|
269
293
|
return this.initialElementWidth;
|
|
270
294
|
}
|
|
271
295
|
maximizeToMaxWidth() {
|
|
272
296
|
const maxWidth = this.maxWidth();
|
|
273
297
|
if (maxWidth !== Infinity) {
|
|
274
|
-
this.
|
|
298
|
+
this.applyElementWidth(maxWidth);
|
|
275
299
|
}
|
|
276
300
|
return maxWidth;
|
|
277
301
|
}
|
|
@@ -279,10 +303,10 @@ class AXResizableDirective {
|
|
|
279
303
|
this.hostElement.style.width = 'fit-content';
|
|
280
304
|
return this.hostElement.clientWidth;
|
|
281
305
|
}
|
|
282
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
283
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.
|
|
306
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXResizableDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
307
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: AXResizableDirective, isStandalone: true, selector: "[axResizable]", inputs: { axResizable: { classPropertyName: "axResizable", publicName: "axResizable", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, dblClickAction: { classPropertyName: "dblClickAction", publicName: "dblClickAction", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, defaultWidth: { classPropertyName: "defaultWidth", publicName: "defaultWidth", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { axResizable: "axResizableChange", minWidth: "minWidthChange", maxWidth: "maxWidthChange", dblClickAction: "dblClickActionChange", width: "widthChange", defaultWidth: "defaultWidthChange", onResizingStarted: "onResizingStarted", onResizingEnded: "onResizingEnded", onResizingDblClick: "onResizingDblClick" }, ngImport: i0 }); }
|
|
284
308
|
}
|
|
285
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
309
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXResizableDirective, decorators: [{
|
|
286
310
|
type: Directive,
|
|
287
311
|
args: [{
|
|
288
312
|
selector: '[axResizable]',
|