mirror of https://github.com/abpframework/abp.git
12 changed files with 163 additions and 135 deletions
@ -0,0 +1,31 @@ |
|||
import { ConfigStateService } from "@abp/ng.core"; |
|||
import { ExtensionsService, getObjectExtensionEntitiesFromStore, mapEntitiesToContributors, mergeWithDefaultProps } from "@abp/ng.theme.shared/extensions"; |
|||
import { inject } from "@angular/core"; |
|||
import { map, tap } from "rxjs"; |
|||
import { eAccountComponents } from "../enums"; |
|||
import { ACCOUNT_EDIT_FORM_PROP_CONTRIBUTORS, DEFAULT_ACCOUNT_FORM_PROPS } from "../tokens"; |
|||
|
|||
export const AccountExtensionsResolver = () => { |
|||
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, |
|||
); |
|||
}), |
|||
map(() => true), |
|||
); |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
export * from './extensions.resolver' |
|||
@ -0,0 +1,58 @@ |
|||
import { ConfigStateService } from "@abp/ng.core"; |
|||
import { ExtensionsService, getObjectExtensionEntitiesFromStore, mapEntitiesToContributors, mergeWithDefaultActions, mergeWithDefaultProps } from "@abp/ng.theme.shared/extensions"; |
|||
import { inject } from "@angular/core"; |
|||
import { map, tap } from "rxjs"; |
|||
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"; |
|||
|
|||
export const IdentityExtensionsResolver = () => { |
|||
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, |
|||
); |
|||
}), |
|||
map(() => true), |
|||
); |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
export * from './extensions.resolver' |
|||
@ -0,0 +1,59 @@ |
|||
import { ConfigStateService } from "@abp/ng.core"; |
|||
import { ExtensionsService, getObjectExtensionEntitiesFromStore, mapEntitiesToContributors, mergeWithDefaultActions, mergeWithDefaultProps } from "@abp/ng.theme.shared/extensions"; |
|||
import { inject } from "@angular/core"; |
|||
import { CanActivateFn } from "@angular/router"; |
|||
import { map, tap } from "rxjs"; |
|||
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"; |
|||
|
|||
export const TenantManagementExtensionsResolver: CanActivateFn = () => { |
|||
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, |
|||
); |
|||
}), |
|||
map(() => true), |
|||
); |
|||
}; |
|||
@ -0,0 +1 @@ |
|||
export * from './extensions.resolver' |
|||
Loading…
Reference in new issue