diff --git a/npm/ng-packs/packages/identity/src/lib/identity.module.ts b/npm/ng-packs/packages/identity/src/lib/identity.module.ts index 036c7e3607..e2b832350a 100644 --- a/npm/ng-packs/packages/identity/src/lib/identity.module.ts +++ b/npm/ng-packs/packages/identity/src/lib/identity.module.ts @@ -1,14 +1,24 @@ import { CoreModule, LazyModuleFactory } from '@abp/ng.core'; import { PermissionManagementModule } from '@abp/ng.permission-management'; import { ThemeSharedModule } from '@abp/ng.theme.shared'; +import { UiExtensionsModule } from '@abp/ng.theme.shared/extensions'; import { ModuleWithProviders, NgModule, NgModuleFactory } from '@angular/core'; import { NgbDropdownModule, NgbNavModule } from '@ng-bootstrap/ng-bootstrap'; import { NgxValidateCoreModule } from '@ngx-validate/core'; import { NgxsModule } from '@ngxs/store'; import { RolesComponent } from './components/roles/roles.component'; import { UsersComponent } from './components/users/users.component'; +import { IdentityExtensionsGuard } from './guards/extensions.guard'; import { IdentityRoutingModule } from './identity-routing.module'; +import { IdentityConfigOptions } from './models/config-options'; import { IdentityState } from './states/identity.state'; +import { + IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS, + IDENTITY_EDIT_FORM_PROP_CONTRIBUTORS, + IDENTITY_ENTITY_ACTION_CONTRIBUTORS, + IDENTITY_ENTITY_PROP_CONTRIBUTORS, + IDENTITY_TOOLBAR_ACTION_CONTRIBUTORS, +} from './tokens/extensions.token'; @NgModule({ declarations: [RolesComponent, UsersComponent], @@ -19,20 +29,43 @@ import { IdentityState } from './states/identity.state'; IdentityRoutingModule, NgbNavModule, ThemeSharedModule, + UiExtensionsModule, NgbDropdownModule, PermissionManagementModule, NgxValidateCoreModule, ], }) export class IdentityModule { - static forChild(): ModuleWithProviders { + static forChild(options: IdentityConfigOptions = {}): ModuleWithProviders { return { ngModule: IdentityModule, - providers: [], + providers: [ + { + provide: IDENTITY_ENTITY_ACTION_CONTRIBUTORS, + useValue: options.entityActionContributors, + }, + { + provide: IDENTITY_TOOLBAR_ACTION_CONTRIBUTORS, + useValue: options.toolbarActionContributors, + }, + { + provide: IDENTITY_ENTITY_PROP_CONTRIBUTORS, + useValue: options.entityPropContributors, + }, + { + provide: IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS, + useValue: options.createFormPropContributors, + }, + { + provide: IDENTITY_EDIT_FORM_PROP_CONTRIBUTORS, + useValue: options.editFormPropContributors, + }, + IdentityExtensionsGuard, + ], }; } - static forLazy(): NgModuleFactory { - return new LazyModuleFactory(IdentityModule.forChild()); + static forLazy(options: IdentityConfigOptions = {}): NgModuleFactory { + return new LazyModuleFactory(IdentityModule.forChild(options)); } }