ohayolibs
Version:
Ohayo is a set of essential modules for ohayojp.
61 lines (48 loc) • 1.93 kB
text/typescript
import { OverlayModule } from '@angular/cdk/overlay';
import { CommonModule } from '@angular/common';
import { ModuleWithProviders, NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { OhayoLocaleModule } from './locale/locale.module';
// #region import
import { DrawerHelper } from './services/drawer/drawer.helper';
import { ModalHelper } from './services/modal/modal.helper';
const HELPERS = [ModalHelper, DrawerHelper];
// pipes
import { CNCurrencyPipe } from './pipes/currency/cn-currency.pipe';
import { DatePipe } from './pipes/date/date.pipe';
import { KeysPipe } from './pipes/keys/keys.pipe';
import { HTMLPipe } from './pipes/safe/html.pipe';
import { URLPipe } from './pipes/safe/url.pipe';
import { YNPipe } from './pipes/yn/yn.pipe';
import { I18nPipe } from './services/i18n/i18n.pipe';
const PIPES = [DatePipe, CNCurrencyPipe, KeysPipe, YNPipe, I18nPipe, HTMLPipe, URLPipe];
// #endregion
// #region all ohayo used icons
// - zorro: https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/components/icon/icons.ts
import { BellOutline, DeleteOutline, InboxOutline, PlusOutline } from '@ant-design/icons-angular/icons';
import { NzI18nModule } from 'ng-zorro-antd/i18n';
import { NzIconService } from 'ng-zorro-antd/icon';
const ICONS = [BellOutline, DeleteOutline, PlusOutline, InboxOutline];
// #endregion
({
imports: [CommonModule, RouterModule, OverlayModule, NzI18nModule],
declarations: [...PIPES],
exports: [...PIPES, OhayoLocaleModule],
})
export class OhayoThemeModule {
constructor(iconSrv: NzIconService) {
iconSrv.addIcon(...ICONS);
}
static forRoot(): ModuleWithProviders<OhayoThemeModule> {
return {
ngModule: OhayoThemeModule,
providers: [...HELPERS],
};
}
static forChild(): ModuleWithProviders<OhayoThemeModule> {
return {
ngModule: OhayoThemeModule,
providers: [...HELPERS],
};
}
}