db-ui / elements

Web Components, based on DB UI Core.
https://db-ui.github.io/elements/
Apache License 2.0
40 stars 9 forks source link

feat: provide individual components for angular as `standalone` components #605

Open d-koppenhagen opened 1 year ago

d-koppenhagen commented 1 year ago

With the introduction of Standalone Components with Angular 14, components can be imported and tree-shaked individually without the need of a wrapping module such as DBUIElementsModule.

It would be great if all components can be marked as standalone and imported individually.

mfranzke commented 11 months ago

This is probably implemented by StencilJS with standalone components, compare to https://github.com/ionic-team/stencil-ds-output-targets/releases/tag/%40stencil%2Fangular-output-target%400.8.0

mfranzke commented 5 months ago

Another team has reported us lately, that they're using Unit-Tests for their standalone Components, and for the ones in which they're importing DBUIElementsModule, exactly this modules doesn't get found by Jest when these tests are run (Cannot find module '@db-ui/ngx-elements/dist/lib' from ComponentXYZ).

Their setup is as described within https://db-ui.github.io/elements/?path=/story/00-intro-frameworks-angular--page, except the import of DBUIElementsModule within the non-existing app.modules.ts, as they're using standalone Components.

The application itself runs fine with DB UI Elements components, but the Unit-tests fail because of the problems described above.

d-koppenhagen commented 5 months ago

In theory, it should work without a module when adding the import of DBUIElementsModule to the imports section of a component instead:

@Component({
  imports: [DBUIElementsModule]
})
tlt26 commented 5 months ago

In theory, it should work without a module when adding the import of DBUIElementsModule to the imports section of a component instead:

@Component({
  imports: [DBUIElementsModule]
})

After setting up Jest as it is supposed to be like the RI Angular, this works also in practice! Thanks again!