Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
modal: { size: 'lg' },
};
}
const GLOBAL_CONFIG_PROVIDES = [
// TIPS:@delon/abc 有大量的全局配置信息,例如设置所有 `st` 的页码默认为 `20` 行
{ provide: STConfig, useFactory: fnSTConfig },
{ provide: PageHeaderConfig, useFactory: fnPageHeaderConfig },
{ provide: DelonAuthConfig, useFactory: fnDelonAuthConfig },
{ provide: DelonACLConfig, useFactory: fnDelonACLConfig },
];
// #endregion
@NgModule({
imports: [AlainThemeModule.forRoot(), DelonACLModule.forRoot(), ...MOCK_MODULES],
})
export class DelonModule {
constructor(@Optional() @SkipSelf() parentModule: DelonModule) {
throwIfAlreadyLoaded(parentModule, 'DelonModule');
}
static forRoot(): ModuleWithProviders {
return {
ngModule: DelonModule,
providers: [...REUSETAB_PROVIDES, ...GLOBAL_CONFIG_PROVIDES],
};
}
}
modal: { size: 'lg' },
};
}
const GLOBAL_CONFIG_PROVIDES = [
// TIPS:@delon/abc 有大量的全局配置信息,例如设置所有 `st` 的页码默认为 `20` 行
{ provide: STConfig, useFactory: fnSTConfig },
{ provide: PageHeaderConfig, useFactory: fnPageHeaderConfig },
{ provide: DelonAuthConfig, useFactory: fnDelonAuthConfig },
{ provide: DelonACLConfig, useFactory: fnDelonACLConfig },
];
// #endregion
@NgModule({
imports: [AlainThemeModule.forRoot(), DelonACLModule.forRoot(), ...MOCK_MODULES],
})
export class DelonModule {
constructor(@Optional() @SkipSelf() parentModule: DelonModule) {
throwIfAlreadyLoaded(parentModule, 'DelonModule');
}
static forRoot(): ModuleWithProviders {
return {
ngModule: DelonModule,
providers: [...REUSETAB_PROVIDES, ...GLOBAL_CONFIG_PROVIDES],
};
}
}
return Object.assign(new STConfig(), {
ps: 3,
});
}
export function fnLodopConfig(): LodopConfig {
return Object.assign(new LodopConfig(), {
license: `A59B099A586B3851E0F0D7FDBF37B603`,
licenseA: `C94CEE276DB2187AE6B65D56B3FC2848`,
});
}
// #endregion
@NgModule({
imports: [AlainThemeModule.forRoot(), DelonFormModule.forRoot(), DelonACLModule.forRoot(), DelonMockModule.forRoot({ data: MOCKDATA })],
})
export class DelonModule {
constructor(
@Optional()
@SkipSelf()
parentModule: DelonModule,
) {
throwIfAlreadyLoaded(parentModule, 'DelonModule');
}
static forRoot(): ModuleWithProviders {
return {
ngModule: DelonModule,
providers: [...REUSETAB_PROVIDES, { provide: STConfig, useFactory: fnSTConfig }, { provide: LodopConfig, useFactory: fnLodopConfig }],
};
}
import { AdLodopConfig, DelonABCModule } from '@delon/abc';
export function adLodopConfig(): AdLodopConfig {
return Object.assign(new AdLodopConfig(), {
license: `A59B099A586B3851E0F0D7FDBF37B603`,
licenseA: `C94CEE276DB2187AE6B65D56B3FC2848`
});
}
// endregion
@NgModule({
imports: [
NgZorroAntdModule.forRoot(),
// theme
AlainThemeModule.forRoot(),
// abc
DelonABCModule.forRoot(),
// form
DelonFormModule.forRoot(),
DelonUtilModule.forRoot()
]
})
export class DelonModule {
constructor( @Optional() @SkipSelf() parentModule: DelonModule) {
throwIfAlreadyLoaded(parentModule, 'DelonModule');
}
static forRoot(): ModuleWithProviders {
return {
ngModule: DelonModule,
providers: [
function genModule(defaultCog?: DelonCacheConfig) {
const providers: any[] = [];
if (defaultCog) {
providers.push({ provide: DelonCacheConfig, useValue: defaultCog });
}
injector = TestBed.configureTestingModule({
imports: [HttpClientTestingModule, AlainThemeModule.forRoot(), DelonCacheModule],
providers,
});
srv = injector.get(CacheService);
}
export function builder(options?: { detectChanges?: boolean; template?: string; ingoreAntd?: boolean; imports?: any[] }) {
options = { detectChanges: true, ...options };
TestBed.configureTestingModule({
imports: [NoopAnimationsModule, AlainThemeModule.forRoot(), DelonFormModule.forRoot()].concat(options.imports || []),
declarations: [TestFormComponent],
});
if (options.template) {
TestBed.overrideTemplate(TestFormComponent, options.template);
}
fixture = TestBed.createComponent(TestFormComponent);
dl = fixture.debugElement;
context = fixture.componentInstance;
spyOn(context, 'formChange');
spyOn(context, 'formSubmit');
spyOn(context, 'formReset');
spyOn(context, 'formError');
if (options.detectChanges !== false) {
fixture.detectChanges();
}
const page = new SFPage(context.comp);
configureTestSuite(() => {
TestBed.configureTestingModule({
imports: [NoopAnimationsModule, AlainThemeModule.forRoot(), DelonFormModule.forRoot(), HttpClientTestingModule],
declarations: [TestFormComponent],
});
});
}
//启动服务工厂
export function startupServiceFactory( startupService: StartupService ) {
return () => startupService.load();
}
/**
* 应用根模块
*/
@NgModule( {
declarations: [AppComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
HttpClientModule,
AlainThemeModule.forRoot(),
FrameworkModule,
HomeModule,
AppRoutingModule
],
providers: [
StartupService,
{
provide: APP_INITIALIZER,
useFactory: startupServiceFactory,
deps: [StartupService],
multi: true,
},
{ provide: NZ_ICONS, useValue: icons },
{ provide: UploadService, useClass: TestUploadService }
],
bootstrap: [AppComponent],
export function fnSTConfig(): STConfig {
return {
...new STConfig(),
...({
modal: { size: 'lg' },
} as STConfig),
};
}
const GLOBAL_CONFIG_PROVIDES = [
{ provide: STConfig, useFactory: fnSTConfig },
{ provide: PageHeaderConfig, useFactory: fnPageHeaderConfig },
];
@NgModule({
imports: [AlainThemeModule.forRoot(), ...MOCK_MODULES],
})
export class DelonModule {
constructor(@Optional() @SkipSelf() parentModule: DelonModule) {
throwIfAlreadyLoaded(parentModule, 'DelonModule');
}
static forRoot(): ModuleWithProviders {
return {
ngModule: DelonModule,
providers: [...GLOBAL_CONFIG_PROVIDES],
};
}
}