-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Angular): add standalone components to the
@beeq/angular
outpu…
…t target (#870) We have added more flexibility over the `dist-custom-elements` target, allowing using it on each framework-specific configuration target. The Angular output target has been improved, the value accessors are now part of the BEEQ Angular module, and no need to import them on the Angular project side. Instead of this: ```ts import { BeeQModule, BooleanValueAccessor, TextValueAccessor, } from '@beeq/angular'; /** 💡 More Value Accessors will be exported later and should be included as well */ const VALUE_ACCESSORS = [BooleanValueAccessor, TextValueAccessor]; @NgModule({ declarations: [AppComponent, ...VALUE_ACCESSORS], imports: [BeeQModule.forRoot(), BrowserModule, FormsModule, ReactiveFormsModule], .... }) ``` we will have only to do this: ```ts @NgModule({ declarations: [AppComponent], imports: [BeeQModule.forRoot(), BrowserModule, FormsModule, ReactiveFormsModule], .... }) ``` Also, we added new value accessors: number, radio, and select, for components like `bq-input[type="number"]`, `bq-radio-group`, and `bq-select`.
- Loading branch information
1 parent
5a297a9
commit 055209f
Showing
19 changed files
with
166 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,41 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { ModuleWithProviders, NgModule } from '@angular/core'; | ||
import { CommonModule, DOCUMENT } from '@angular/common'; | ||
import { APP_INITIALIZER, ModuleWithProviders, NgModule, NgZone } from '@angular/core'; | ||
import { defineCustomElements } from '@beeq/core/dist/loader'; | ||
|
||
import { DIRECTIVES } from './directives'; | ||
import { BooleanValueAccessor } from './directives/boolean-value-accessor'; | ||
import { NumericValueAccessor } from './directives/number-value-accessor'; | ||
import { RadioValueAccessor } from './directives/radio-value-accessor'; | ||
import { SelectValueAccessor } from './directives/select-value-accessor'; | ||
import { TextValueAccessor } from './directives/text-value-accessor'; | ||
|
||
const DECLARATIONS = [ | ||
...DIRECTIVES, | ||
// ngModel Accessors | ||
BooleanValueAccessor, | ||
NumericValueAccessor, | ||
RadioValueAccessor, | ||
SelectValueAccessor, | ||
TextValueAccessor, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [CommonModule], | ||
declarations: [...DIRECTIVES], | ||
exports: [...DIRECTIVES], | ||
declarations: DECLARATIONS, | ||
exports: DECLARATIONS, | ||
}) | ||
export class BeeQModule { | ||
static forRoot(): ModuleWithProviders<BeeQModule> { | ||
defineCustomElements(); | ||
return { | ||
ngModule: BeeQModule, | ||
providers: [ | ||
{ | ||
provide: APP_INITIALIZER, | ||
useFactory: () => defineCustomElements, | ||
multi: true, | ||
deps: [DOCUMENT, NgZone], | ||
}, | ||
], | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"lib": { | ||
"entryFile": "src/index.ts" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/* -------------------------------------------------------------------------- */ | ||
/* DIRECTIVES */ | ||
/* -------------------------------------------------------------------------- */ | ||
// @ts-ignore | ||
export * from './directives/components'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.