@ts-core/angular 15.0.27 → 15.0.29

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.
@@ -519,7 +519,7 @@ class ViewUtil {
519
519
  //
520
520
  // --------------------------------------------------------------------------
521
521
  static addClass(container, name) {
522
- if (_.isNil(name)) {
522
+ if (_.isEmpty(name)) {
523
523
  return;
524
524
  }
525
525
  container = ViewUtil.parseElement(container);
@@ -534,7 +534,7 @@ class ViewUtil {
534
534
  names.split(' ').forEach(name => ViewUtil.addClass(container, name));
535
535
  }
536
536
  static removeClass(container, name) {
537
- if (_.isNil(name)) {
537
+ if (_.isEmpty(name)) {
538
538
  return;
539
539
  }
540
540
  container = ViewUtil.parseElement(container);
@@ -3290,6 +3290,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
3290
3290
  args: [LoginBaseService]
3291
3291
  }] }]; } });
3292
3292
 
3293
+ class LoginTokenStorage extends DestroyableContainer {
3294
+ //--------------------------------------------------------------------------
3295
+ //
3296
+ // Constructor
3297
+ //
3298
+ //--------------------------------------------------------------------------
3299
+ constructor(storage, cookies) {
3300
+ super();
3301
+ this.storage = storage;
3302
+ this.cookies = cookies;
3303
+ console.log(storage.get);
3304
+ }
3305
+ //--------------------------------------------------------------------------
3306
+ //
3307
+ // Public Methods
3308
+ //
3309
+ //--------------------------------------------------------------------------
3310
+ get() {
3311
+ let value = null;
3312
+ try {
3313
+ value = this.storage.get(LoginTokenStorage.TOKEN_KEY);
3314
+ }
3315
+ catch (error) { }
3316
+ return !_.isNil(value) ? value : this.cookies.get(LoginTokenStorage.TOKEN_KEY);
3317
+ }
3318
+ save(value) {
3319
+ try {
3320
+ this.storage.set(LoginTokenStorage.TOKEN_KEY, value);
3321
+ }
3322
+ finally {
3323
+ this.cookies.put(LoginTokenStorage.TOKEN_KEY, value);
3324
+ }
3325
+ }
3326
+ remove() {
3327
+ try {
3328
+ this.storage.remove(LoginTokenStorage.TOKEN_KEY);
3329
+ }
3330
+ finally {
3331
+ this.cookies.remove(LoginTokenStorage.TOKEN_KEY);
3332
+ }
3333
+ }
3334
+ }
3335
+ //--------------------------------------------------------------------------
3336
+ //
3337
+ // Properties
3338
+ //
3339
+ //--------------------------------------------------------------------------
3340
+ LoginTokenStorage.TOKEN_KEY = 'sid';
3341
+
3293
3342
  class MenuItemBase {
3294
3343
  // --------------------------------------------------------------------------
3295
3344
  //
@@ -6265,6 +6314,61 @@ var NotificationServiceEvent;
6265
6314
  class BottomSheetService extends Destroyable {
6266
6315
  }
6267
6316
 
6317
+ class StorageService extends DestroyableContainer {
6318
+ //--------------------------------------------------------------------------
6319
+ //
6320
+ // Constructor
6321
+ //
6322
+ //--------------------------------------------------------------------------
6323
+ constructor(nativeWindow) {
6324
+ super();
6325
+ this.nativeWindow = nativeWindow;
6326
+ }
6327
+ //--------------------------------------------------------------------------
6328
+ //
6329
+ // Public Methods
6330
+ //
6331
+ //--------------------------------------------------------------------------
6332
+ get(key, defaultValue) {
6333
+ return this.has(key) ? this.storage.getItem(key) : defaultValue;
6334
+ }
6335
+ has(key) {
6336
+ return !_.isNil(this.storage.getItem(key));
6337
+ }
6338
+ set(key, value) {
6339
+ if (!_.isNil(value)) {
6340
+ this.storage.setItem(key, value);
6341
+ }
6342
+ else {
6343
+ this.remove(key);
6344
+ }
6345
+ }
6346
+ remove(key) {
6347
+ this.storage.removeItem(key);
6348
+ }
6349
+ clear() {
6350
+ this.storage.clear();
6351
+ }
6352
+ destroy() {
6353
+ if (this.isDestroyed) {
6354
+ return;
6355
+ }
6356
+ super.destroy();
6357
+ this.nativeWindow = null;
6358
+ }
6359
+ //--------------------------------------------------------------------------
6360
+ //
6361
+ // Protected Properties
6362
+ //
6363
+ //--------------------------------------------------------------------------
6364
+ get length() {
6365
+ return this.storage.length;
6366
+ }
6367
+ get storage() {
6368
+ return this.nativeWindow.window.localStorage;
6369
+ }
6370
+ }
6371
+
6268
6372
  class LazyModuleLoader extends Loadable {
6269
6373
  //--------------------------------------------------------------------------
6270
6374
  //
@@ -6531,6 +6635,8 @@ class VIModule {
6531
6635
  { provide: VI_ANGULAR_OPTIONS, useValue: options || {} },
6532
6636
  { provide: Logger, deps: [VI_ANGULAR_OPTIONS], useFactory: loggerServiceFactory },
6533
6637
  { provide: NativeWindowService, deps: [DOCUMENT], useFactory: nativeWindowServiceFactory },
6638
+ { provide: StorageService, deps: [NativeWindowService], useFactory: storageServiceFactory },
6639
+ { provide: LoginTokenStorage, deps: [StorageService, CookieService], useFactory: loginTokenStorageServiceFactory },
6534
6640
  ...CookieModule.forRoot(options).providers,
6535
6641
  ...ThemeModule.forRoot(options ? options.themeOptions : null).providers,
6536
6642
  ...LanguageModule.forRoot(options ? options.languageOptions : null).providers
@@ -6612,6 +6718,12 @@ function loggerServiceFactory(options) {
6612
6718
  function nativeWindowServiceFactory(document) {
6613
6719
  return new NativeWindowService(document);
6614
6720
  }
6721
+ function storageServiceFactory(nativeWindow) {
6722
+ return new StorageService(nativeWindow);
6723
+ }
6724
+ function loginTokenStorageServiceFactory(storage, cookies) {
6725
+ return new LoginTokenStorage(storage, cookies);
6726
+ }
6615
6727
  const VI_ANGULAR_OPTIONS = new InjectionToken(`VI_ANGULAR_OPTIONS`);
6616
6728
 
6617
6729
  //
@@ -6620,5 +6732,5 @@ const VI_ANGULAR_OPTIONS = new InjectionToken(`VI_ANGULAR_OPTIONS`);
6620
6732
  * Generated bundle index. Do not edit.
6621
6733
  */
6622
6734
 
6623
- export { APPLICATION_INJECTOR, ApplicationBaseComponent, ApplicationComponent, AspectRatioResizeDirective, AssetBackgroundDirective, AssetBackgroundPipe, AssetFilePipe, AssetIconPipe, AssetImagePipe, AssetModule, AssetSoundPipe, AssetVideoPipe, AutoScrollBottomDirective, BottomSheetService, COOKIE_OPTIONS, CamelCasePipe, CanDeactivateGuard, ClickToCopyDirective, ClickToSelectDirective, CookieModule, CookieOptions, CookieService, Direction, FinancePipe, FocusDirective, FocusManager, FormElementAsync, FormElementSync, HTMLContentTitleDirective, HTMLTitleDirective, INotification, INotificationContent, IUser, IVIOptions, IWindow, IWindowContent, InfiniteScrollDirective, IsBrowserDirective, IsServerDirective, LANGUAGE_OPTIONS, LanguageDirective, LanguageHasDirective, LanguageModule, LanguagePipe, LanguagePipeHas, LanguagePipeHasPure, LanguagePipePure, LanguageRequireResolver, LanguageResolver, LazyModuleLoader, ListItem, ListItems, LoginBaseService, LoginBaseServiceEvent, LoginGuard, LoginIfCanGuard, LoginNotGuard, LoginRequireResolver, LoginResolver, MenuItem, MenuItemBase, MenuItems, MessageBaseComponent, MomentDateAdaptivePipe, MomentDateFromNowPipe, MomentDatePipe, MomentTimePipe, NavigationMenuItem, NgModelErrorPipe, NotificationConfig, NotificationEvent, NotificationService, NotificationServiceEvent, PipeBaseService, PlatformService, PrettifyPipe, QuestionEvent, QuestionManager, QuestionMode, ResizeDirective, ResizeManager, RouterBaseService, SanitizePipe, ScrollCheckDirective, ScrollDirective, SelectListItem, SelectListItems, SelectOnFocusDirective, StartCasePipe, THEME_OPTIONS, ThemeAssetBackgroundDirective, ThemeAssetDirective, ThemeAssetIconDirective, ThemeAssetImageDirective, ThemeModule, ThemeStyleDirective, ThemeStyleHoverDirective, ThemeToggleDirective, TimePipe, TransportLazy, TransportLazyModule, TransportLazyModuleLoadedEvent, TruncatePipe, UserBaseService, UserBaseServiceEvent, VIModule, VI_ANGULAR_OPTIONS, ViewUtil, WINDOW_CONTENT_CONTAINER, WindowAlign, WindowBase, WindowClosedError, WindowConfig, WindowEvent, WindowService, WindowServiceEvent, cookieServiceFactory, initializerFactory, languageServiceFactory, loggerServiceFactory, nativeWindowServiceFactory, themeAssetServiceFactory, themeServiceFactory };
6735
+ export { APPLICATION_INJECTOR, ApplicationBaseComponent, ApplicationComponent, AspectRatioResizeDirective, AssetBackgroundDirective, AssetBackgroundPipe, AssetFilePipe, AssetIconPipe, AssetImagePipe, AssetModule, AssetSoundPipe, AssetVideoPipe, AutoScrollBottomDirective, BottomSheetService, COOKIE_OPTIONS, CamelCasePipe, CanDeactivateGuard, ClickToCopyDirective, ClickToSelectDirective, CookieModule, CookieOptions, CookieService, Direction, FinancePipe, FocusDirective, FocusManager, FormElementAsync, FormElementSync, HTMLContentTitleDirective, HTMLTitleDirective, INotification, INotificationContent, IUser, IVIOptions, IWindow, IWindowContent, InfiniteScrollDirective, IsBrowserDirective, IsServerDirective, LANGUAGE_OPTIONS, LanguageDirective, LanguageHasDirective, LanguageModule, LanguagePipe, LanguagePipeHas, LanguagePipeHasPure, LanguagePipePure, LanguageRequireResolver, LanguageResolver, LazyModuleLoader, ListItem, ListItems, LoginBaseService, LoginBaseServiceEvent, LoginGuard, LoginIfCanGuard, LoginNotGuard, LoginRequireResolver, LoginResolver, LoginTokenStorage, MenuItem, MenuItemBase, MenuItems, MessageBaseComponent, MomentDateAdaptivePipe, MomentDateFromNowPipe, MomentDatePipe, MomentTimePipe, NavigationMenuItem, NgModelErrorPipe, NotificationConfig, NotificationEvent, NotificationService, NotificationServiceEvent, PipeBaseService, PlatformService, PrettifyPipe, QuestionEvent, QuestionManager, QuestionMode, ResizeDirective, ResizeManager, RouterBaseService, SanitizePipe, ScrollCheckDirective, ScrollDirective, SelectListItem, SelectListItems, SelectOnFocusDirective, StartCasePipe, StorageService, THEME_OPTIONS, ThemeAssetBackgroundDirective, ThemeAssetDirective, ThemeAssetIconDirective, ThemeAssetImageDirective, ThemeModule, ThemeStyleDirective, ThemeStyleHoverDirective, ThemeToggleDirective, TimePipe, TransportLazy, TransportLazyModule, TransportLazyModuleLoadedEvent, TruncatePipe, UserBaseService, UserBaseServiceEvent, VIModule, VI_ANGULAR_OPTIONS, ViewUtil, WINDOW_CONTENT_CONTAINER, WindowAlign, WindowBase, WindowClosedError, WindowConfig, WindowEvent, WindowService, WindowServiceEvent, cookieServiceFactory, initializerFactory, languageServiceFactory, loggerServiceFactory, loginTokenStorageServiceFactory, nativeWindowServiceFactory, storageServiceFactory, themeAssetServiceFactory, themeServiceFactory };
6624
6736
  //# sourceMappingURL=ts-core-angular.mjs.map