Browse Source

theme change command updated

pull/22934/head
erdemcaygor 1 year ago
parent
commit
e4fc51d02a
  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 { export function insertImports(projectName: string, selectedTheme: ThemeOptionsEnum): Rule {
return addRootImport(projectName, code => { 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``; if (!selected?.length) return code.code``;
const expressions: string[] = []; const expressions: string[] = [];
@ -338,7 +339,8 @@ export function insertImports(projectName: string, selectedTheme: ThemeOptionsEn
} }
export function insertProviders(projectName: string, selectedTheme: ThemeOptionsEnum): Rule { export function insertProviders(projectName: string, selectedTheme: ThemeOptionsEnum): Rule {
return addRootProvider(projectName, code => { 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``; if (!selected || selected.length === 0) return code.code``;
const providers = selected 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; importName: string;
provider?: string; provider?: string;
expression?: string; expression?: string;
doNotImport?: boolean;
}; };
export const styleMap = new Map<ThemeOptionsEnum, StyleDefinition[]>(); export const styleMap = new Map<ThemeOptionsEnum, StyleDefinition[]>();
@ -366,6 +367,12 @@ importMap.set(ThemeOptionsEnum.LeptonX, [
importName: 'SideMenuLayoutModule', importName: 'SideMenuLayoutModule',
expression: 'SideMenuLayoutModule.forRoot()', expression: 'SideMenuLayoutModule.forRoot()',
}, },
{
path: '@volosoft/abp.ng.theme.lepton-x/layouts',
importName: 'TopMenuLayoutModule',
expression: 'TopMenuLayoutModule.forRoot()',
doNotImport: true,
},
{ {
path: '@abp/ng.theme.shared', path: '@abp/ng.theme.shared',
importName: 'ThemeSharedModule', importName: 'ThemeSharedModule',

Loading…
Cancel
Save