@ts-core/angular 13.0.18 → 13.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8132,16 +8132,17 @@ class LoginBaseService extends Loadable {
8132
8132
  await this.loginBySid();
8133
8133
  }
8134
8134
  }
8135
- tryLoginBySid() {
8135
+ loginBySidIfCan() {
8136
8136
  if (!this.isCanLoginWithSid()) {
8137
8137
  return false;
8138
8138
  }
8139
- if (!this.isLoggedIn && !this.isLoading) {
8140
- this.status = LoadableStatus.LOADING;
8141
- this.observer.next(new ObservableData(LoadableEvent.STARTED));
8142
- this.observer.next(new ObservableData(LoginBaseServiceEvent.LOGIN_STARTED));
8143
- this.loginBySid();
8139
+ if (this.isLoggedIn || this.isLoading) {
8140
+ return true;
8144
8141
  }
8142
+ this.status = LoadableStatus.LOADING;
8143
+ this.observer.next(new ObservableData(LoadableEvent.STARTED));
8144
+ this.observer.next(new ObservableData(LoginBaseServiceEvent.LOGIN_STARTED));
8145
+ this.loginBySid();
8145
8146
  return true;
8146
8147
  }
8147
8148
  async logout() {
@@ -8320,6 +8321,54 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImpor
8320
8321
  args: [LoginBaseService]
8321
8322
  }] }, { type: i1$9.Router }]; } });
8322
8323
 
8324
+ class LoginIfCanGuard extends LoginGuard {
8325
+ // --------------------------------------------------------------------------
8326
+ //
8327
+ // Constructor
8328
+ //
8329
+ // --------------------------------------------------------------------------
8330
+ constructor(login, router) {
8331
+ super(login, router);
8332
+ this.router = router;
8333
+ }
8334
+ // --------------------------------------------------------------------------
8335
+ //
8336
+ // Private Methods
8337
+ //
8338
+ // --------------------------------------------------------------------------
8339
+ async loginIfCan() {
8340
+ if (this.login.loginBySidIfCan()) {
8341
+ try {
8342
+ await this.resolve();
8343
+ }
8344
+ catch (error) { }
8345
+ }
8346
+ }
8347
+ // --------------------------------------------------------------------------
8348
+ //
8349
+ // Public Methods
8350
+ //
8351
+ // --------------------------------------------------------------------------
8352
+ async canActivate(route, state) {
8353
+ if (state.url !== LoginGuard.redirectUrl) {
8354
+ LoginNotGuard.redirectUrl = state.url;
8355
+ }
8356
+ if (!this.isLoggedIn()) {
8357
+ await this.loginIfCan();
8358
+ }
8359
+ return super.canActivate(route, state);
8360
+ }
8361
+ }
8362
+ LoginIfCanGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: LoginIfCanGuard, deps: [{ token: LoginBaseService }, { token: i1$9.Router }], target: i0.ɵɵFactoryTarget.Injectable });
8363
+ LoginIfCanGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: LoginIfCanGuard, providedIn: 'root' });
8364
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: LoginIfCanGuard, decorators: [{
8365
+ type: Injectable,
8366
+ args: [{ providedIn: 'root' }]
8367
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
8368
+ type: Inject,
8369
+ args: [LoginBaseService]
8370
+ }] }, { type: i1$9.Router }]; } });
8371
+
8323
8372
  class LoginResolver extends LoginRequireResolver {
8324
8373
  // --------------------------------------------------------------------------
8325
8374
  //
@@ -9679,5 +9728,5 @@ class TransportLazyModule {
9679
9728
  * Generated bundle index. Do not edit.
9680
9729
  */
9681
9730
 
9682
- export { APPLICATION_INJECTOR, ApplicationBaseComponent, ApplicationComponent, AspectRatioResizeDirective, AssetBackgroundDirective, AssetBackgroundPipe, AssetFilePipe, AssetIconPipe, AssetImagePipe, AssetModule, AssetSoundPipe, AssetVideoPipe, AutoScrollBottomDirective, BootstrapBreakpoint, BootstrapBreakpointService, BootstrapBreakpointServiceEvent, BottomSheetService, COOKIE_OPTIONS, CamelCasePipe, CanDeactivateGuard, CdkTableBaseComponent, CdkTableCellClassNamePipe, CdkTableColumnClassNamePipe, CdkTableColumnStyleNamePipe, CdkTableColumnValuePipe, CdkTableDataSource, CdkTableFilterableComponent, CdkTableFilterableMapCollection, CdkTablePaginableBookmarkComponent, CdkTablePaginableBookmarkMapCollection, CdkTablePaginableComponent, CdkTablePaginableMapCollection, CdkTableRowClassNamePipe, CdkTableRowStyleNamePipe, ClickToCopyDirective, ClickToSelectDirective, CookieModule, CookieOptions, CookieService, Direction, FinancePipe, FocusDirective, FocusManager, FormElementAsync, FormElementSync, HTMLContentTitleDirective, INotification, INotificationContent, IUser, IVICommonOptions, IWindow, IWindowContent, InfiniteScrollDirective, LANGUAGE_OPTIONS, LanguageDirective, LanguageHasDirective, LanguageMatPaginatorIntl, LanguageModule, LanguageMomentDateAdapter, LanguagePipe, LanguagePipeHas, LanguagePipeHasPure, LanguagePipePure, LanguageRequireResolver, LanguageResolver, LanguageSelectorComponent, LazyModuleLoader, ListItem, ListItems, LoginBaseService, LoginBaseServiceEvent, LoginGuard, LoginNotGuard, LoginRequireResolver, LoginResolver, MenuItem, MenuItemBase, MenuItems, MenuListComponent, MenuTriggerForDirective, MessageBaseComponent, MomentDateAdaptivePipe, MomentDateFromNowPipe, MomentDatePipe, MomentTimePipe, NavigationMenuItem, NgModelErrorPipe, NotificationBaseComponent, NotificationComponent, NotificationConfig, NotificationEvent, NotificationFactory, NotificationModule, NotificationService, NotificationServiceEvent, PipeBaseService, PrettifyPipe, PropertiesManager, QuestionEvent, QuestionManager, QuestionMode, ResizeDirective, ResizeManager, RouterBaseService, SanitizePipe, ScrollCheckDirective, ScrollDirective, SelectListComponent, SelectListItem, SelectListItems, SelectOnFocusDirective, ShellBaseComponent, StartCasePipe, THEME_OPTIONS, TabGroupComponent, ThemeAssetBackgroundDirective, ThemeAssetDirective, ThemeAssetImageDirective, ThemeModule, ThemeStyleDirective, ThemeStyleHoverDirective, ThemeToggleDirective, TimePipe, TransportLazy, TransportLazyModule, TransportLazyModuleLoadedEvent, TruncatePipe, UserBaseService, UserBaseServiceEvent, VICommonModule, VIComponentModule, VI_ANGULAR_OPTIONS, ViewUtil, WINDOW_CONTENT_CONTAINER, WindowAlign, WindowBase, WindowBaseComponent, WindowCloseElementComponent, WindowConfig, WindowDragAreaDirective, WindowEvent, WindowFactory, WindowImpl, WindowMinimizeElementComponent, WindowModule, WindowQuestionBaseComponent, WindowQuestionComponent, WindowResizeElementComponent, WindowService, WindowServiceEvent, cookieServiceFactory, languageServiceFactory, loggerServiceFactory, notificationServiceFactory, themeAssetServiceFactory, themeServiceFactory, windowServiceFactory };
9731
+ export { APPLICATION_INJECTOR, ApplicationBaseComponent, ApplicationComponent, AspectRatioResizeDirective, AssetBackgroundDirective, AssetBackgroundPipe, AssetFilePipe, AssetIconPipe, AssetImagePipe, AssetModule, AssetSoundPipe, AssetVideoPipe, AutoScrollBottomDirective, BootstrapBreakpoint, BootstrapBreakpointService, BootstrapBreakpointServiceEvent, BottomSheetService, COOKIE_OPTIONS, CamelCasePipe, CanDeactivateGuard, CdkTableBaseComponent, CdkTableCellClassNamePipe, CdkTableColumnClassNamePipe, CdkTableColumnStyleNamePipe, CdkTableColumnValuePipe, CdkTableDataSource, CdkTableFilterableComponent, CdkTableFilterableMapCollection, CdkTablePaginableBookmarkComponent, CdkTablePaginableBookmarkMapCollection, CdkTablePaginableComponent, CdkTablePaginableMapCollection, CdkTableRowClassNamePipe, CdkTableRowStyleNamePipe, ClickToCopyDirective, ClickToSelectDirective, CookieModule, CookieOptions, CookieService, Direction, FinancePipe, FocusDirective, FocusManager, FormElementAsync, FormElementSync, HTMLContentTitleDirective, INotification, INotificationContent, IUser, IVICommonOptions, IWindow, IWindowContent, InfiniteScrollDirective, LANGUAGE_OPTIONS, LanguageDirective, LanguageHasDirective, LanguageMatPaginatorIntl, LanguageModule, LanguageMomentDateAdapter, LanguagePipe, LanguagePipeHas, LanguagePipeHasPure, LanguagePipePure, LanguageRequireResolver, LanguageResolver, LanguageSelectorComponent, LazyModuleLoader, ListItem, ListItems, LoginBaseService, LoginBaseServiceEvent, LoginGuard, LoginIfCanGuard, LoginNotGuard, LoginRequireResolver, LoginResolver, MenuItem, MenuItemBase, MenuItems, MenuListComponent, MenuTriggerForDirective, MessageBaseComponent, MomentDateAdaptivePipe, MomentDateFromNowPipe, MomentDatePipe, MomentTimePipe, NavigationMenuItem, NgModelErrorPipe, NotificationBaseComponent, NotificationComponent, NotificationConfig, NotificationEvent, NotificationFactory, NotificationModule, NotificationService, NotificationServiceEvent, PipeBaseService, PrettifyPipe, PropertiesManager, QuestionEvent, QuestionManager, QuestionMode, ResizeDirective, ResizeManager, RouterBaseService, SanitizePipe, ScrollCheckDirective, ScrollDirective, SelectListComponent, SelectListItem, SelectListItems, SelectOnFocusDirective, ShellBaseComponent, StartCasePipe, THEME_OPTIONS, TabGroupComponent, ThemeAssetBackgroundDirective, ThemeAssetDirective, ThemeAssetImageDirective, ThemeModule, ThemeStyleDirective, ThemeStyleHoverDirective, ThemeToggleDirective, TimePipe, TransportLazy, TransportLazyModule, TransportLazyModuleLoadedEvent, TruncatePipe, UserBaseService, UserBaseServiceEvent, VICommonModule, VIComponentModule, VI_ANGULAR_OPTIONS, ViewUtil, WINDOW_CONTENT_CONTAINER, WindowAlign, WindowBase, WindowBaseComponent, WindowCloseElementComponent, WindowConfig, WindowDragAreaDirective, WindowEvent, WindowFactory, WindowImpl, WindowMinimizeElementComponent, WindowModule, WindowQuestionBaseComponent, WindowQuestionComponent, WindowResizeElementComponent, WindowService, WindowServiceEvent, cookieServiceFactory, languageServiceFactory, loggerServiceFactory, notificationServiceFactory, themeAssetServiceFactory, themeServiceFactory, windowServiceFactory };
9683
9732
  //# sourceMappingURL=ts-core-angular.mjs.map