Skip to content

feat: (Angular) template ref support#1157

Merged
mathuo merged 9 commits intomathuo:masterfrom
puschie286:angular-template-ref-support
Apr 11, 2026
Merged

feat: (Angular) template ref support#1157
mathuo merged 9 commits intomathuo:masterfrom
puschie286:angular-template-ref-support

Conversation

@puschie286
Copy link
Copy Markdown
Contributor

@puschie286 puschie286 commented Apr 7, 2026

Support angular templates for components.

Required to support property binding

(re-implement of #1101 without dependencies and reduced changes)

+ add template ref as type for components
+ track view ref for template based components
+ create view setup method (from template)
+ add test for template based component
~ check for html element when detecting if already renderer (init)
~ move component setup to own method
~ determine creation based of component type
~ clean up view based component
- remove not required null suppression in test
- remove not required null suppression
~ use never instead of any for undefined cast
- remove not used imports
+ add template ref as type in views, components and types
~ allow templates for all elements (components, tab, watermark, header)
~ apply formatting
@codesandbox-ci
Copy link
Copy Markdown

codesandbox-ci bot commented Apr 7, 2026

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 1774e05:

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

@puschie286
Copy link
Copy Markdown
Contributor Author

puschie286 commented Apr 7, 2026

@mathuo for the 'onlyWhenVisible' renderer to behave correctly, the angular renderer need callbacks on visibility change to correctly attach/detach the component. I need to do more test on how angular behave in all those cases but its best to have a separate PR for this.

@mathuo
Copy link
Copy Markdown
Owner

mathuo commented Apr 7, 2026

@mathuo for the 'onlyWhenVisible' renderer to behave correctly, the angular renderer need callbacks on visibility change to correctly attach/detach the component. I need to do more test on how angular behave in all those cases but its best to have a separate PR for this.

Nice! That last part may require exposing an event for the render mode as I don't believe one is currently exposed, for example this PR.

Happy to merge this though - got quite a few changes sitting in the queue for the next major release but will make sure this is included.

@puschie286
Copy link
Copy Markdown
Contributor Author

Glad to hear that. Your PR is exactly what i need to complete the implementation and fix a few unexpected behaviors.

@mathuo
Copy link
Copy Markdown
Owner

mathuo commented Apr 8, 2026

Glad to hear that. Your PR is exactly what i need to complete the implementation and fix a few unexpected behaviors.

That PR is merged into master

# Conflicts:
#	packages/dockview-angular/src/lib/dockview/dockview-angular.component.ts
~ create template based view in non-container related way
~ use unknown instead of any
~ track component host view in viewRef
~ trigger change detection on viewref
~ always attach views on creation
@puschie286
Copy link
Copy Markdown
Contributor Author

Fixed the 'onlyWhenVisible' problem and updated for changes on master.
@mathuo should be ready for merge

I think its best to have the onShow/onHide improvements in a separate PR (which require some core adjustments).

@mathuo
Copy link
Copy Markdown
Owner

mathuo commented Apr 10, 2026

Fixed the 'onlyWhenVisible' problem and updated for changes on master. @mathuo should be ready for merge

I think its best to have the onShow/onHide improvements in a separate PR (which require some core adjustments).

Do we need any subsequent changes to this PR that's merge?

@puschie286
Copy link
Copy Markdown
Contributor Author

The initial onShow call for the ‘always’ renderer is missing but there is the onDidVisibilityChange event that might be better suited (but require some restructuring of the angular components factory).
This approach would give more option for further optimizations - but i need to evaluate this first.

The onShow/onHide might end up to be very similar to the onDidVisibilityChange event - so i’m not sure if it is the right approach to extend, sorry for the additional work you had with this.

I’m out for 2 weeks, so my evaluation have to wait for this time

@mathuo mathuo merged commit f7e577b into mathuo:master Apr 11, 2026
8 checks passed
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.

2 participants