UNPKG

worker-calendar

Version:

A customizable, responsive Angular calendar component for scheduling worker appointments or shifts

51 lines (44 loc) 1.71 kB
/** * Specific compatibility module for Angular 14.2.0 * Used to ensure the Worker Calendar library works with Argon Dashboard Angular */ // Check if we're using Angular 14.2.0 export function isAngular14_2(): boolean { try { // Try to access the Angular version from global scope const ngVersion = (window as any).ng?.version; return ngVersion?.full === '14.2.0' || ngVersion?.major === 14; } catch (e) { return false; } } // Specific fixes for integration with Argon Dashboard Angular 1.5.0 export function applyArgonDashboardFixes(): void { // If project uses ng-bootstrap 12.0.1, ensure compatibility if (!(window as any).ngBootstrap) { (window as any).ngBootstrap = { version: { full: '12.0.1' } }; } // If project uses Material 14.2.7, ensure compatibility if (!(window as any).__NG_MATERIAL_VERSION) { (window as any).__NG_MATERIAL_VERSION = { full: '14.2.7' }; } // Application patching const originalLog = console.log; console.log = function(...args: any[]) { // Filter out "Angular is running in development mode" log if (typeof args[0] === 'string' && args[0].includes('Angular is running in development mode')) { return; } originalLog.apply(console, args); }; } // Apply the specific compatibility fixes export function initAngular14Compatibility(): void { if (typeof window !== 'undefined') { // Register the compatibility fixes applyArgonDashboardFixes(); // Ensure Angular CDK dragging works (window as any).__NG_CDK_VERSION = { full: '14.2.0' }; console.log('[Worker Calendar] Angular 14.2.0 compatibility mode enabled'); } }