Skip to content

Conversation

@thakkarkeyur
Copy link

Summary

Adds Angular 20 compatibility to dockview-angular while maintaining backward compatibility with Angular 14+.

Problem

Angular 20 introduced stricter validation for standalone components. The current implementation causes compilation errors:

  • NG6008: Component is standalone and cannot be declared in an NgModule
  • NG6004: Can't be exported from NgModule without being imported first

Solution

Implements a hybrid standalone pattern:

  • Added standalone: true to all four components (DockviewAngular, GridviewAngular, PaneviewAngular, SplitviewAngular)
  • Updated DockviewAngularModule to import components instead of declaring them
  • This pattern works with both NgModule and standalone component usage

Changes

  • dockview-angular.component.ts - Added standalone: true
  • gridview-angular.component.ts - Added standalone: true
  • paneview-angular.component.ts - Added standalone: true
  • splitview-angular.component.ts - Added standalone: true
  • dockview-angular.module.ts - Changed from declarations to imports

Testing

  • Verified compilation with Angular 20.3.12 and TypeScript 5.8
  • Tested with minimal Angular 20 application
  • Confirmed backward compatibility maintained (Angular 14-19)
  • Zero breaking changes for existing users

Breaking Changes

None - fully backward compatible.

Updates dockview-angular components to support Angular 20 while maintaining
backward compatibility with Angular 14+.

Changes:
- Added standalone: true to all four components (DockviewAngular, GridviewAngular,
  PaneviewAngular, SplitviewAngular)
- Updated DockviewAngularModule to import components instead of declaring them
- This implements a hybrid standalone pattern that works with both NgModule
  and standalone component usage

Fixes:
- NG6008: Component is standalone and cannot be declared in an NgModule
- NG6004: Can't be exported from NgModule without being imported first

Testing:
- Verified compilation with Angular 20.3.12 and TypeScript 5.8
- Tested with minimal Angular 20 application
- Confirmed backward compatibility maintained
- Zero breaking changes for existing users

This change allows developers to use dockview-angular in Angular 20 projects
while keeping full compatibility with earlier Angular versions (14-19).
@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 19, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 842ca16:

Sandbox Source
dockview-app Configuration
editor-gridview Configuration
externaldnd-dockview Configuration
fullwidthtab-dockview Configuration
iframe-dockview Configuration
keyboard-dockview Configuration
nativeapp-dockview Configuration
rendering-dockview Configuration

…ation

The AngularRenderer was using hasOwnProperty() to check if properties exist
before setting them. This doesn't work with TypeScript getter/setter properties
because they're defined on the prototype chain, not as own properties.

This bug prevented header action components (and any components using
getters/setters) from receiving their props from dockview-core.

Changes:
- Changed from hasOwnProperty() to 'in' operator in angular-renderer.ts
  to check the entire prototype chain
- Made init() idempotent to handle multiple initialization calls
- Added clarifying comment in component-factory.ts

Testing:
- Verified header action components now receive props correctly with Angular 20
- Confirmed backward compatibility with regular properties
- Tested with getter/setter properties for reactive behavior

Fixes components that use property getters/setters, particularly
header action components that need reactive state tracking.
@thakkarkeyur
Copy link
Author

Critical Bug Fix Added

Adds an important bug fix to this PR that addresses a fundamental issue with the AngularRenderer.

Problem

The AngularRenderer was using hasOwnProperty() to check if properties exist before setting them. This doesn't work with TypeScript getter/setter properties because they're defined on the prototype chain, not as own properties.

This bug prevented header action components (and any components using getters/setters) from receiving their props from dockview-core.

Solution

Commit: 842ca16

  • Changed property detection: Replaced hasOwnProperty() with the in operator to check the entire prototype chain
  • Made init() idempotent: Updated init method to handle multiple initialization calls
  • Added documentation: Clarified the initialization pattern in component-factory.ts

Files Changed

  • packages/dockview-angular/src/lib/utils/angular-renderer.ts
  • packages/dockview-angular/src/lib/utils/component-factory.ts

Impact

This enables reactive patterns with property setters:

export class HeaderActionsComponent {
    private _api: any;
    
    get api() { return this._api; }
    set api(value: any) {
        this._api = value;
        this.setupListeners();  // Now this works!
    }
}

Testing

  • Verified with Angular 20.3.12
  • Confirmed header action components receive props correctly
  • Tested getter/setter properties work as expected
  • Backward compatible with regular properties

This is a general bug fix that benefits all Angular versions, not just Angular 20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant