1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/app.module.ts

218 lines
8.9 KiB
TypeScript
Raw Normal View History

2019-01-18 07:26:20 +08:00
import {Injectable, LOCALE_ID, NgModule, TRANSLATIONS, TRANSLATIONS_FORMAT} from '@angular/core';
2018-03-31 03:30:30 +08:00
import {BrowserModule, HAMMER_GESTURE_CONFIG, HammerGestureConfig} from '@angular/platform-browser';
import {FormsModule} from '@angular/forms';
import {AppComponent} from './app.component';
import {appRoutes} from './app.routing';
import {UserService} from './model/network/user.service';
import {GalleryService} from './gallery/gallery.service';
import {NetworkService} from './model/network/network.service';
import {GalleryCacheService} from './gallery/cache.gallery.service';
import {FullScreenService} from './gallery/fullscreen.service';
import {AuthenticationService} from './model/network/authentication.service';
import {UserMangerSettingsComponent} from './settings/usermanager/usermanager.settings.component';
import {FrameComponent} from './frame/frame.component';
import {YagaModule} from '@yaga/leaflet-ng2';
import {GalleryLightboxMediaComponent} from './gallery/lightbox/media/media.lightbox.gallery.component';
2018-03-31 03:30:30 +08:00
import {GalleryPhotoLoadingComponent} from './gallery/grid/photo/loading/loading.photo.grid.gallery.component';
import {GalleryNavigatorComponent} from './gallery/navigator/navigator.gallery.component';
import {GallerySearchComponent} from './gallery/search/search.gallery.component';
import {GalleryLightboxComponent} from './gallery/lightbox/lightbox.gallery.component';
import {GalleryDirectoryComponent} from './gallery/directory/directory.gallery.component';
import {GalleryGridComponent} from './gallery/grid/grid.gallery.component';
import {GalleryPhotoComponent} from './gallery/grid/photo/photo.grid.gallery.component';
import {LoginComponent} from './login/login.component';
import {AdminComponent} from './admin/admin.component';
import {GalleryComponent} from './gallery/gallery.component';
import {StringifyRole} from './pipes/StringifyRolePipe';
import {GalleryMapComponent} from './gallery/map/map.gallery.component';
import {GalleryMapLightboxComponent} from './gallery/map/lightbox/lightbox.map.gallery.component';
2018-12-09 01:17:33 +08:00
import {ThumbnailManagerService} from './gallery/thumbnailManager.service';
2018-03-31 03:30:30 +08:00
import {OverlayService} from './gallery/overlay.service';
import {SlimLoadingBarModule} from 'ng2-slim-loading-bar';
import {GalleryShareComponent} from './gallery/share/share.gallery.component';
import {ShareLoginComponent} from './sharelogin/share-login.component';
import {ShareService} from './gallery/share.service';
import {ModalModule} from 'ngx-bootstrap/modal';
import {BsDatepickerModule} from 'ngx-bootstrap/datepicker';
2018-03-31 03:30:30 +08:00
import {DatabaseSettingsComponent} from './settings/database/database.settings.component';
2018-05-23 08:27:07 +08:00
import {ToastrModule} from 'ngx-toastr';
2018-03-31 03:30:30 +08:00
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {NotificationService} from './model/notification.service';
import {JwBootstrapSwitchNg2Module} from 'jw-bootstrap-switch-ng2';
2018-03-31 03:30:30 +08:00
import {ClipboardModule} from 'ngx-clipboard';
import {NavigationService} from './model/navigation.service';
import {InfoPanelLightboxComponent} from './gallery/lightbox/infopanel/info-panel.lightbox.gallery.component';
import {MapSettingsComponent} from './settings/map/map.settings.component';
import {TooltipModule} from 'ngx-bootstrap/tooltip';
import {BsDropdownModule} from 'ngx-bootstrap/dropdown';
2018-05-14 04:59:57 +08:00
import {CollapseModule} from 'ngx-bootstrap/collapse';
2019-01-18 07:26:20 +08:00
import {PopoverModule} from 'ngx-bootstrap/popover';
2018-03-31 03:30:30 +08:00
import {ThumbnailSettingsComponent} from './settings/thumbnail/thumbanil.settings.component';
import {SearchSettingsComponent} from './settings/search/search.settings.component';
import {SettingsService} from './settings/settings.service';
import {ShareSettingsComponent} from './settings/share/share.settings.component';
import {BasicSettingsComponent} from './settings/basic/basic.settings.component';
import {OtherSettingsComponent} from './settings/other/other.settings.component';
import {HttpClientModule} from '@angular/common/http';
2017-07-19 00:26:24 +08:00
import {DefaultUrlSerializer, UrlSerializer, UrlTree} from '@angular/router';
2018-03-31 03:30:30 +08:00
import {IndexingSettingsComponent} from './settings/indexing/indexing.settings.component';
import {LanguageComponent} from './language/language.component';
2019-01-08 17:52:39 +08:00
import {I18n} from '@ngx-translate/i18n-polyfill';
import {QueryService} from './model/query.service';
2018-05-29 02:03:12 +08:00
import {IconizeSortingMethod} from './pipes/IconizeSortingMethod';
import {StringifySortingMethod} from './pipes/StringifySortingMethod';
import {RandomQueryBuilderGalleryComponent} from './gallery/random-query-builder/random-query-builder.gallery.component';
import {RandomPhotoSettingsComponent} from './settings/random-photo/random-photo.settings.component';
2018-11-02 17:40:09 +08:00
import {FixOrientationPipe} from './gallery/FixOrientationPipe';
2018-11-19 03:26:29 +08:00
import {VideoSettingsComponent} from './settings/video/video.settings.component';
2018-11-23 02:12:10 +08:00
import {DurationPipe} from './pipes/DurationPipe';
2018-11-26 07:26:29 +08:00
import {MapService} from './gallery/map/map.service';
2018-12-02 06:53:35 +08:00
import {MetaFileSettingsComponent} from './settings/metafiles/metafile.settings.component';
2018-12-09 01:17:33 +08:00
import {ThumbnailLoaderService} from './gallery/thumbnailLoader.service';
2018-12-10 06:25:39 +08:00
import {FileSizePipe} from './pipes/FileSizePipe';
2019-01-18 07:26:20 +08:00
import {DuplicateService} from './duplicates/duplicates.service';
import {DuplicateComponent} from './duplicates/duplicates.component';
import {DuplicatesPhotoComponent} from './duplicates/photo/photo.duplicates.component';
2019-01-28 06:27:41 +08:00
import {SeededRandomService} from './model/seededRandom.service';
2019-02-15 07:25:55 +08:00
import {FacesComponent} from './faces/faces.component';
import {FacesService} from './faces/faces.service';
import {FaceComponent} from './faces/face/face.component';
import {VersionService} from './model/version.service';
2017-07-18 00:30:16 +08:00
2016-12-27 06:36:38 +08:00
2018-05-08 03:42:32 +08:00
@Injectable()
2017-07-18 00:30:16 +08:00
export class MyHammerConfig extends HammerGestureConfig {
2018-12-18 07:06:25 +08:00
events: string[] = ['pinch'];
overrides = {
pan: {threshold: 1},
swipe: {direction: 31}, // enable swipe up
pinch: {enable: true}
2018-03-31 03:30:30 +08:00
};
2017-07-18 00:30:16 +08:00
}
2018-12-09 01:17:33 +08:00
2018-12-18 07:06:25 +08:00
export class CustomUrlSerializer implements UrlSerializer {
2017-07-19 00:26:24 +08:00
private _defaultUrlSerializer: DefaultUrlSerializer = new DefaultUrlSerializer();
parse(url: string): UrlTree {
// Encode parentheses
url = url.replace(/\(/g, '%28').replace(/\)/g, '%29');
// Use the default serializer.
2018-03-31 03:30:30 +08:00
return this._defaultUrlSerializer.parse(url);
2017-07-19 00:26:24 +08:00
}
serialize(tree: UrlTree): string {
return this._defaultUrlSerializer.serialize(tree).replace(/%28/g, '(').replace(/%29/g, ')');
}
}
2018-05-14 04:59:57 +08:00
// use the require method provided by webpack
2018-11-29 06:49:33 +08:00
declare const require: (path: string) => string;
2018-03-30 08:30:23 +08:00
export function translationsFactory(locale: string) {
locale = locale || 'en'; // default to english if no locale
return require(`raw-loader!../translate/messages.${locale}.xlf`);
}
2016-12-27 06:36:38 +08:00
@NgModule({
imports: [
BrowserModule,
FormsModule,
2018-03-31 03:30:30 +08:00
HttpClientModule,
2017-07-08 18:43:42 +08:00
BrowserAnimationsModule,
appRoutes,
2017-07-09 18:03:17 +08:00
ClipboardModule,
JwBootstrapSwitchNg2Module,
2017-07-15 18:47:11 +08:00
TooltipModule.forRoot(),
2018-05-23 08:27:07 +08:00
ToastrModule.forRoot(),
2017-07-08 18:43:42 +08:00
ModalModule.forRoot(),
2018-05-14 04:59:57 +08:00
CollapseModule.forRoot(),
2019-01-18 07:26:20 +08:00
PopoverModule.forRoot(),
BsDropdownModule.forRoot(),
SlimLoadingBarModule.forRoot(),
BsDatepickerModule.forRoot(),
YagaModule
],
declarations: [AppComponent,
LoginComponent,
2017-07-04 01:17:49 +08:00
ShareLoginComponent,
GalleryComponent,
2019-02-15 07:25:55 +08:00
FacesComponent,
2018-03-31 03:30:30 +08:00
// misc
FrameComponent,
LanguageComponent,
2018-03-31 03:30:30 +08:00
// Gallery
GalleryLightboxMediaComponent,
GalleryPhotoLoadingComponent,
GalleryGridComponent,
GalleryDirectoryComponent,
GalleryLightboxComponent,
GalleryMapComponent,
GalleryMapLightboxComponent,
FrameComponent,
GallerySearchComponent,
2017-07-04 01:17:49 +08:00
GalleryShareComponent,
GalleryNavigatorComponent,
GalleryPhotoComponent,
2017-07-08 18:43:42 +08:00
AdminComponent,
InfoPanelLightboxComponent,
RandomQueryBuilderGalleryComponent,
2019-02-15 07:25:55 +08:00
// Face
FaceComponent,
2018-03-31 03:30:30 +08:00
// Settings
2017-07-08 18:43:42 +08:00
UserMangerSettingsComponent,
DatabaseSettingsComponent,
2017-07-14 05:39:09 +08:00
MapSettingsComponent,
2017-07-15 18:47:11 +08:00
ThumbnailSettingsComponent,
2018-11-19 03:26:29 +08:00
VideoSettingsComponent,
2018-12-02 06:53:35 +08:00
MetaFileSettingsComponent,
2017-07-15 20:27:12 +08:00
SearchSettingsComponent,
2017-07-15 21:29:04 +08:00
ShareSettingsComponent,
RandomPhotoSettingsComponent,
2017-07-15 22:09:48 +08:00
BasicSettingsComponent,
2017-07-15 22:31:43 +08:00
OtherSettingsComponent,
2017-07-26 03:09:37 +08:00
IndexingSettingsComponent,
2019-01-18 07:26:20 +08:00
DuplicateComponent,
DuplicatesPhotoComponent,
2018-05-29 02:03:12 +08:00
StringifyRole,
IconizeSortingMethod,
2018-11-02 17:40:09 +08:00
StringifySortingMethod,
2018-11-23 02:12:10 +08:00
FixOrientationPipe,
2018-12-10 06:25:39 +08:00
DurationPipe,
FileSizePipe
2018-11-02 17:40:09 +08:00
],
providers: [
2017-07-19 00:26:24 +08:00
{provide: UrlSerializer, useClass: CustomUrlSerializer},
2017-07-18 00:30:16 +08:00
{provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig},
NetworkService,
2017-07-04 01:17:49 +08:00
ShareService,
UserService,
GalleryCacheService,
GalleryService,
2018-11-26 07:26:29 +08:00
MapService,
AuthenticationService,
ThumbnailLoaderService,
ThumbnailManagerService,
2017-07-08 18:43:42 +08:00
NotificationService,
FullScreenService,
2017-07-09 18:03:17 +08:00
NavigationService,
2017-07-15 20:27:12 +08:00
SettingsService,
2019-01-28 06:27:41 +08:00
SeededRandomService,
2018-03-30 08:30:23 +08:00
OverlayService,
QueryService,
2019-01-18 07:26:20 +08:00
DuplicateService,
2019-02-15 07:25:55 +08:00
FacesService,
VersionService,
2018-03-30 08:30:23 +08:00
{
provide: TRANSLATIONS,
useFactory: translationsFactory,
deps: [LOCALE_ID]
},
2018-05-14 04:59:57 +08:00
{provide: TRANSLATIONS_FORMAT, useValue: 'xlf'},
2019-01-08 17:52:39 +08:00
I18n
2018-03-30 08:30:23 +08:00
],
bootstrap: [AppComponent]
2016-12-27 06:36:38 +08:00
})
export class AppModule {
}