mirror of https://github.com/abpframework/abp.git
committed by
GitHub
21 changed files with 315 additions and 24 deletions
@ -0,0 +1,36 @@ |
|||||
|
import { inject } from '@angular/core'; |
||||
|
import { ConfigStateService } from '@abp/ng.core'; |
||||
|
import { map, tap } from 'rxjs'; |
||||
|
import { |
||||
|
ExtensionsService, |
||||
|
getObjectExtensionEntitiesFromStore, |
||||
|
mapEntitiesToContributors, |
||||
|
mergeWithDefaultProps, |
||||
|
} from '@abp/ng.theme.shared/extensions'; |
||||
|
import { eAccountComponents } from '../enums'; |
||||
|
import { ACCOUNT_EDIT_FORM_PROP_CONTRIBUTORS, DEFAULT_ACCOUNT_FORM_PROPS } from '../tokens'; |
||||
|
import { ResolveFn } from '@angular/router'; |
||||
|
|
||||
|
export const accountExtensionsResolver: ResolveFn<any> = () => { |
||||
|
const configState = inject(ConfigStateService); |
||||
|
const extensions = inject(ExtensionsService); |
||||
|
|
||||
|
const config = { optional: true }; |
||||
|
|
||||
|
const editFormContributors = inject(ACCOUNT_EDIT_FORM_PROP_CONTRIBUTORS, config) || {}; |
||||
|
|
||||
|
return getObjectExtensionEntitiesFromStore(configState, 'Identity').pipe( |
||||
|
map(entities => ({ |
||||
|
[eAccountComponents.PersonalSettings]: entities.User, |
||||
|
})), |
||||
|
mapEntitiesToContributors(configState, 'AbpIdentity'), |
||||
|
tap(objectExtensionContributors => { |
||||
|
mergeWithDefaultProps( |
||||
|
extensions.editFormProps, |
||||
|
DEFAULT_ACCOUNT_FORM_PROPS, |
||||
|
objectExtensionContributors.editForm, |
||||
|
editFormContributors, |
||||
|
); |
||||
|
}), |
||||
|
); |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
export * from './extensions.resolver' |
||||
@ -0,0 +1,75 @@ |
|||||
|
import { inject } from '@angular/core'; |
||||
|
import { map, tap } from 'rxjs'; |
||||
|
import { ConfigStateService } from '@abp/ng.core'; |
||||
|
import { |
||||
|
ExtensionsService, |
||||
|
getObjectExtensionEntitiesFromStore, |
||||
|
mapEntitiesToContributors, |
||||
|
mergeWithDefaultActions, |
||||
|
mergeWithDefaultProps, |
||||
|
} from '@abp/ng.theme.shared/extensions'; |
||||
|
import { eIdentityComponents } from '../enums'; |
||||
|
import { |
||||
|
IDENTITY_ENTITY_ACTION_CONTRIBUTORS, |
||||
|
IDENTITY_TOOLBAR_ACTION_CONTRIBUTORS, |
||||
|
IDENTITY_ENTITY_PROP_CONTRIBUTORS, |
||||
|
IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS, |
||||
|
IDENTITY_EDIT_FORM_PROP_CONTRIBUTORS, |
||||
|
DEFAULT_IDENTITY_ENTITY_ACTIONS, |
||||
|
DEFAULT_IDENTITY_TOOLBAR_ACTIONS, |
||||
|
DEFAULT_IDENTITY_ENTITY_PROPS, |
||||
|
DEFAULT_IDENTITY_CREATE_FORM_PROPS, |
||||
|
DEFAULT_IDENTITY_EDIT_FORM_PROPS, |
||||
|
} from '../tokens'; |
||||
|
import { ResolveFn } from '@angular/router'; |
||||
|
|
||||
|
export const identityExtensionsResolver: ResolveFn<any> = () => { |
||||
|
const configState = inject(ConfigStateService); |
||||
|
const extensions = inject(ExtensionsService); |
||||
|
|
||||
|
const config = { optional: true }; |
||||
|
|
||||
|
const actionContributors = inject(IDENTITY_ENTITY_ACTION_CONTRIBUTORS, config) || {}; |
||||
|
const toolbarContributors = inject(IDENTITY_TOOLBAR_ACTION_CONTRIBUTORS, config) || {}; |
||||
|
const propContributors = inject(IDENTITY_ENTITY_PROP_CONTRIBUTORS, config) || {}; |
||||
|
const createFormContributors = inject(IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS, config) || {}; |
||||
|
const editFormContributors = inject(IDENTITY_EDIT_FORM_PROP_CONTRIBUTORS, config) || {}; |
||||
|
|
||||
|
return getObjectExtensionEntitiesFromStore(configState, 'Identity').pipe( |
||||
|
map(entities => ({ |
||||
|
[eIdentityComponents.Roles]: entities.Role, |
||||
|
[eIdentityComponents.Users]: entities.User, |
||||
|
})), |
||||
|
mapEntitiesToContributors(configState, 'AbpIdentity'), |
||||
|
tap(objectExtensionContributors => { |
||||
|
mergeWithDefaultActions( |
||||
|
extensions.entityActions, |
||||
|
DEFAULT_IDENTITY_ENTITY_ACTIONS, |
||||
|
actionContributors, |
||||
|
); |
||||
|
mergeWithDefaultActions( |
||||
|
extensions.toolbarActions, |
||||
|
DEFAULT_IDENTITY_TOOLBAR_ACTIONS, |
||||
|
toolbarContributors, |
||||
|
); |
||||
|
mergeWithDefaultProps( |
||||
|
extensions.entityProps, |
||||
|
DEFAULT_IDENTITY_ENTITY_PROPS, |
||||
|
objectExtensionContributors.prop, |
||||
|
propContributors, |
||||
|
); |
||||
|
mergeWithDefaultProps( |
||||
|
extensions.createFormProps, |
||||
|
DEFAULT_IDENTITY_CREATE_FORM_PROPS, |
||||
|
objectExtensionContributors.createForm, |
||||
|
createFormContributors, |
||||
|
); |
||||
|
mergeWithDefaultProps( |
||||
|
extensions.editFormProps, |
||||
|
DEFAULT_IDENTITY_EDIT_FORM_PROPS, |
||||
|
objectExtensionContributors.editForm, |
||||
|
editFormContributors, |
||||
|
); |
||||
|
}), |
||||
|
); |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
export * from './extensions.resolver' |
||||
@ -0,0 +1,75 @@ |
|||||
|
import { inject } from '@angular/core'; |
||||
|
import { map, tap } from 'rxjs'; |
||||
|
import { ConfigStateService } from '@abp/ng.core'; |
||||
|
import { |
||||
|
ExtensionsService, |
||||
|
getObjectExtensionEntitiesFromStore, |
||||
|
mapEntitiesToContributors, |
||||
|
mergeWithDefaultActions, |
||||
|
mergeWithDefaultProps, |
||||
|
} from '@abp/ng.theme.shared/extensions'; |
||||
|
import { eTenantManagementComponents } from '../enums'; |
||||
|
import { |
||||
|
TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS, |
||||
|
TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS, |
||||
|
TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS, |
||||
|
TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS, |
||||
|
TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS, |
||||
|
DEFAULT_TENANT_MANAGEMENT_ENTITY_ACTIONS, |
||||
|
DEFAULT_TENANT_MANAGEMENT_TOOLBAR_ACTIONS, |
||||
|
DEFAULT_TENANT_MANAGEMENT_ENTITY_PROPS, |
||||
|
DEFAULT_TENANT_MANAGEMENT_CREATE_FORM_PROPS, |
||||
|
DEFAULT_TENANT_MANAGEMENT_EDIT_FORM_PROPS, |
||||
|
} from '../tokens'; |
||||
|
import { ResolveFn } from '@angular/router'; |
||||
|
|
||||
|
export const tenantManagementExtensionsResolver: ResolveFn<any> = () => { |
||||
|
const configState = inject(ConfigStateService); |
||||
|
const extensions = inject(ExtensionsService); |
||||
|
|
||||
|
const config = { optional: true }; |
||||
|
|
||||
|
const actionContributors = inject(TENANT_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS, config) || {}; |
||||
|
const toolbarContributors = inject(TENANT_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS, config) || {}; |
||||
|
const propContributors = inject(TENANT_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS, config) || {}; |
||||
|
const createFormContributors = |
||||
|
inject(TENANT_MANAGEMENT_CREATE_FORM_PROP_CONTRIBUTORS, config) || {}; |
||||
|
const editFormContributors = inject(TENANT_MANAGEMENT_EDIT_FORM_PROP_CONTRIBUTORS, config) || {}; |
||||
|
|
||||
|
return getObjectExtensionEntitiesFromStore(configState, 'TenantManagement').pipe( |
||||
|
map(entities => ({ |
||||
|
[eTenantManagementComponents.Tenants]: entities.Tenant, |
||||
|
})), |
||||
|
mapEntitiesToContributors(configState, 'TenantManagement'), |
||||
|
tap(objectExtensionContributors => { |
||||
|
mergeWithDefaultActions( |
||||
|
extensions.entityActions, |
||||
|
DEFAULT_TENANT_MANAGEMENT_ENTITY_ACTIONS, |
||||
|
actionContributors, |
||||
|
); |
||||
|
mergeWithDefaultActions( |
||||
|
extensions.toolbarActions, |
||||
|
DEFAULT_TENANT_MANAGEMENT_TOOLBAR_ACTIONS, |
||||
|
toolbarContributors, |
||||
|
); |
||||
|
mergeWithDefaultProps( |
||||
|
extensions.entityProps, |
||||
|
DEFAULT_TENANT_MANAGEMENT_ENTITY_PROPS, |
||||
|
objectExtensionContributors.prop, |
||||
|
propContributors, |
||||
|
); |
||||
|
mergeWithDefaultProps( |
||||
|
extensions.createFormProps, |
||||
|
DEFAULT_TENANT_MANAGEMENT_CREATE_FORM_PROPS, |
||||
|
objectExtensionContributors.createForm, |
||||
|
createFormContributors, |
||||
|
); |
||||
|
mergeWithDefaultProps( |
||||
|
extensions.editFormProps, |
||||
|
DEFAULT_TENANT_MANAGEMENT_EDIT_FORM_PROPS, |
||||
|
objectExtensionContributors.editForm, |
||||
|
editFormContributors, |
||||
|
); |
||||
|
}), |
||||
|
); |
||||
|
}; |
||||
@ -0,0 +1 @@ |
|||||
|
export * from './extensions.resolver' |
||||
Loading…
Reference in new issue