Browse Source

Merge pull request #22934 from abpframework/fix/#19862

Angular - When top menu switches a project to lepton theme, an error is thrown
pull/22955/head
Gizem Mutu Kurt 9 months ago
committed by GitHub
parent
commit
307149d89b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      npm/ng-packs/packages/schematics/src/commands/change-theme/index.ts
  2. 7
      npm/ng-packs/packages/schematics/src/commands/change-theme/style-map.ts

6
npm/ng-packs/packages/schematics/src/commands/change-theme/index.ts

@ -320,7 +320,8 @@ export function removeProviderFromNgModuleMetadata(
export function insertImports(projectName: string, selectedTheme: ThemeOptionsEnum): Rule {
return addRootImport(projectName, code => {
const selected = importMap.get(selectedTheme);
const selectedThemeImports = importMap.get(selectedTheme);
const selected = selectedThemeImports?.filter(s => !s.doNotImport);
if (!selected?.length) return code.code``;
const expressions: string[] = [];
@ -338,7 +339,8 @@ export function insertImports(projectName: string, selectedTheme: ThemeOptionsEn
}
export function insertProviders(projectName: string, selectedTheme: ThemeOptionsEnum): Rule {
return addRootProvider(projectName, code => {
const selected = importMap.get(selectedTheme);
const selectedThemeImports = importMap.get(selectedTheme);
const selected = selectedThemeImports?.filter(s => !s.doNotImport);
if (!selected || selected.length === 0) return code.code``;
const providers = selected

7
npm/ng-packs/packages/schematics/src/commands/change-theme/style-map.ts

@ -13,6 +13,7 @@ export type ImportDefinition = {
importName: string;
provider?: string;
expression?: string;
doNotImport?: boolean;
};
export const styleMap = new Map<ThemeOptionsEnum, StyleDefinition[]>();
@ -366,6 +367,12 @@ importMap.set(ThemeOptionsEnum.LeptonX, [
importName: 'SideMenuLayoutModule',
expression: 'SideMenuLayoutModule.forRoot()',
},
{
path: '@volosoft/abp.ng.theme.lepton-x/layouts',
importName: 'TopMenuLayoutModule',
expression: 'TopMenuLayoutModule.forRoot()',
doNotImport: true,
},
{
path: '@abp/ng.theme.shared',
importName: 'ThemeSharedModule',

Loading…
Cancel
Save