@ts-core/angular 13.1.14 → 13.1.17

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, ViewContainerRef, Injectable, Directive, Input, Pipe, NgModule, InjectionToken, EventEmitter, Output, HostListener, Optional, Inject, RendererStyleFlags2, NgModuleFactory } from '@angular/core';
2
+ import { Component, ViewContainerRef, InjectionToken, Injectable, Directive, Input, Pipe, NgModule, PLATFORM_ID, Inject, EventEmitter, Output, HostListener, Optional, RendererStyleFlags2, NgModuleFactory } from '@angular/core';
3
3
  import { DestroyableContainer, PromiseHandler, ExtendedError, LoadableEvent, Destroyable, IDestroyable, DateUtil, ObservableData, ObjectUtil, ArrayUtil, RemoveFilterableCondition, GetFilterableCondition, Logger, LoggerLevel, DataSourceMapCollectionEvent, FilterableDataSourceMapCollection, PaginableDataSourceMapCollection, PaginableBookmarkDataSourceMapCollection, Loadable, LoadableStatus, TransportTimeoutError, TransportNoConnectionError, FilterableMapCollection, MapCollection, TransportEvent, TransportLocal } from '@ts-core/common';
4
4
  import * as _ from 'lodash';
5
5
  import * as i1$1 from '@ts-core/frontend';
@@ -10,7 +10,7 @@ import numeral from 'numeral';
10
10
  import * as i1 from '@angular/material/dialog';
11
11
  import { MatDialogConfig, MatDialogModule, MatDialog } from '@angular/material/dialog';
12
12
  import * as i4 from '@angular/common';
13
- import { CommonModule, DOCUMENT, DatePipe } from '@angular/common';
13
+ import { CommonModule, isPlatformServer, isPlatformBrowser, DOCUMENT, DatePipe } from '@angular/common';
14
14
  import * as i5 from '@angular/forms';
15
15
  import { FormsModule, Validators } from '@angular/forms';
16
16
  import * as Cookie from 'ngx-cookie';
@@ -141,6 +141,18 @@ class ViewUtil {
141
141
  }
142
142
  ViewUtil._renderer = value;
143
143
  }
144
+ static get document() {
145
+ if (_.isNil(ViewUtil._document)) {
146
+ throw new ExtendedError(`ViewUtil is not initialized: document in nil`);
147
+ }
148
+ return ViewUtil._document;
149
+ }
150
+ static set document(value) {
151
+ if (value === ViewUtil._document) {
152
+ return;
153
+ }
154
+ ViewUtil._document = value;
155
+ }
144
156
  // --------------------------------------------------------------------------
145
157
  //
146
158
  // Private Methods
@@ -148,7 +160,7 @@ class ViewUtil {
148
160
  // --------------------------------------------------------------------------
149
161
  static copyToClipboard() {
150
162
  try {
151
- document.execCommand('copy');
163
+ ViewUtil.document.execCommand('copy');
152
164
  }
153
165
  catch (error) { }
154
166
  }
@@ -157,9 +169,6 @@ class ViewUtil {
157
169
  // Common Properties
158
170
  //
159
171
  // --------------------------------------------------------------------------
160
- static initialize(renderer) {
161
- ViewUtil._renderer = renderer;
162
- }
163
172
  static parseElement(element) {
164
173
  if (element instanceof HTMLElement) {
165
174
  return element;
@@ -201,7 +210,7 @@ class ViewUtil {
201
210
  else {
202
211
  let selection = window.getSelection();
203
212
  selection.removeAllRanges();
204
- let range = document.createRange();
213
+ let range = ViewUtil.document.createRange();
205
214
  if (!_.isNil(container)) {
206
215
  range.selectNodeContents(container);
207
216
  }
@@ -263,10 +272,10 @@ class ViewUtil {
263
272
  //
264
273
  // --------------------------------------------------------------------------
265
274
  static getStageWidth() {
266
- return window.innerWidth || document.body.clientWidth;
275
+ return window.innerWidth || ViewUtil.document.body.clientWidth;
267
276
  }
268
277
  static getStageHeight() {
269
- return window.innerHeight || document.body.clientHeight;
278
+ return window.innerHeight || ViewUtil.document.body.clientHeight;
270
279
  }
271
280
  static getWidth(container) {
272
281
  container = ViewUtil.parseElement(container);
@@ -670,6 +679,8 @@ class ViewUtil {
670
679
  //
671
680
  // --------------------------------------------------------------------------
672
681
  ViewUtil._renderer = null;
682
+ ViewUtil._document = document;
683
+ const VIEW_UTIL = new InjectionToken('VIEW_UTIL');
673
684
 
674
685
  class ApplicationComponent extends ApplicationBaseComponent {
675
686
  // --------------------------------------------------------------------------
@@ -1760,32 +1771,30 @@ class CookieService extends Cookie.CookieService {
1760
1771
  // Constructor
1761
1772
  //
1762
1773
  // --------------------------------------------------------------------------
1763
- constructor(options, nativeWindow) {
1774
+ constructor(options, nativeWindow, platform) {
1764
1775
  super({ options });
1765
1776
  // this['cookieString'] = nativeWindow.document.cookie;
1777
+ let cookieString = '';
1766
1778
  Object.defineProperty(this, 'cookieString', {
1767
- get: () => nativeWindow.document.cookie,
1768
- set: (value) => (nativeWindow.document.cookie = value),
1769
- writable: true,
1779
+ get: () => {
1780
+ console.log('cookieGet', platform.isPlatformBrowser);
1781
+ return platform.isPlatformBrowser ? nativeWindow.document.cookie : cookieString;
1782
+ },
1783
+ set: (value) => {
1784
+ console.log('cookieSet', platform.isPlatformBrowser);
1785
+ if (platform.isPlatformBrowser) {
1786
+ nativeWindow.document.cookie = value;
1787
+ }
1788
+ else {
1789
+ cookieString = value;
1790
+ }
1791
+ },
1770
1792
  enumerable: true,
1771
1793
  configurable: true
1772
1794
  });
1773
1795
  }
1774
1796
  // --------------------------------------------------------------------------
1775
1797
  //
1776
- // Protected Methods
1777
- //
1778
- // --------------------------------------------------------------------------
1779
- /*
1780
- protected get cookieString(): string {
1781
- return document.cookie || '';
1782
- }
1783
- protected override set cookieString(value: string) {
1784
- document.cookie = value;
1785
- }
1786
- */
1787
- // --------------------------------------------------------------------------
1788
- //
1789
1798
  // Public Methods
1790
1799
  //
1791
1800
  // --------------------------------------------------------------------------
@@ -1819,6 +1828,39 @@ class CookieService extends Cookie.CookieService {
1819
1828
  }
1820
1829
  }
1821
1830
 
1831
+ class PlatformService extends DestroyableContainer {
1832
+ // --------------------------------------------------------------------------
1833
+ //
1834
+ // Constructor
1835
+ //
1836
+ // --------------------------------------------------------------------------
1837
+ constructor(platformId) {
1838
+ super();
1839
+ this._isPlatformServer = isPlatformServer(platformId);
1840
+ this._isPlatformBrowser = isPlatformBrowser(platformId);
1841
+ }
1842
+ // --------------------------------------------------------------------------
1843
+ //
1844
+ // Public Properties
1845
+ //
1846
+ // --------------------------------------------------------------------------
1847
+ get isPlatformServer() {
1848
+ return this._isPlatformServer;
1849
+ }
1850
+ get isPlatformBrowser() {
1851
+ return this._isPlatformBrowser;
1852
+ }
1853
+ }
1854
+ PlatformService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlatformService, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
1855
+ PlatformService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlatformService, providedIn: 'root' });
1856
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlatformService, decorators: [{
1857
+ type: Injectable,
1858
+ args: [{ providedIn: 'root' }]
1859
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1860
+ type: Inject,
1861
+ args: [PLATFORM_ID]
1862
+ }] }]; } });
1863
+
1822
1864
  class CookieModule {
1823
1865
  // --------------------------------------------------------------------------
1824
1866
  //
@@ -1835,7 +1877,7 @@ class CookieModule {
1835
1877
  },
1836
1878
  {
1837
1879
  provide: CookieService,
1838
- deps: [NativeWindowService, COOKIE_OPTIONS],
1880
+ deps: [NativeWindowService, PlatformService, COOKIE_OPTIONS],
1839
1881
  useFactory: cookieServiceFactory
1840
1882
  }
1841
1883
  ]
@@ -1848,7 +1890,7 @@ CookieModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
1848
1890
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CookieModule, decorators: [{
1849
1891
  type: NgModule
1850
1892
  }] });
1851
- function cookieServiceFactory(nativeWindow, options) {
1893
+ function cookieServiceFactory(nativeWindow, platform, options) {
1852
1894
  options = _.assign({
1853
1895
  path: '/',
1854
1896
  domain: null,
@@ -1856,7 +1898,7 @@ function cookieServiceFactory(nativeWindow, options) {
1856
1898
  secure: false,
1857
1899
  httpOnly: false
1858
1900
  }, options);
1859
- return new CookieService(options, nativeWindow);
1901
+ return new CookieService(options, nativeWindow, platform);
1860
1902
  }
1861
1903
  const COOKIE_OPTIONS = new InjectionToken(`COOKIE_OPTIONS`);
1862
1904
 
@@ -6847,12 +6889,12 @@ class ThemeModule {
6847
6889
  },
6848
6890
  {
6849
6891
  provide: ThemeService,
6850
- deps: [CookieService, THEME_OPTIONS],
6892
+ deps: [NativeWindowService, CookieService, THEME_OPTIONS],
6851
6893
  useFactory: themeServiceFactory
6852
6894
  },
6853
6895
  {
6854
6896
  provide: ThemeAssetService,
6855
- deps: [ThemeService],
6897
+ deps: [ThemeService, NativeWindowService],
6856
6898
  useFactory: themeAssetServiceFactory
6857
6899
  }
6858
6900
  ]
@@ -6870,11 +6912,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
6870
6912
  exports: declarations
6871
6913
  }]
6872
6914
  }] });
6873
- function themeServiceFactory(cookie, options) {
6915
+ function themeServiceFactory(nativeWindow, cookie, options) {
6874
6916
  if (!_.isNil(options) && _.isNil(options.service)) {
6875
6917
  options.service = cookie;
6876
6918
  }
6877
- return new ThemeService(options);
6919
+ return new ThemeService(nativeWindow, options);
6878
6920
  }
6879
6921
  function themeAssetServiceFactory(theme) {
6880
6922
  return new ThemeAssetService(theme);
@@ -7103,7 +7145,9 @@ class VICommonModule {
7103
7145
  ngModule: VICommonModule,
7104
7146
  providers: [
7105
7147
  LoadingService,
7148
+ PlatformService,
7106
7149
  CanDeactivateGuard,
7150
+ { provide: VIEW_UTIL, useFactory: viewUtilFactory },
7107
7151
  { provide: VI_ANGULAR_OPTIONS, useValue: options || {} },
7108
7152
  { provide: Logger, deps: [VI_ANGULAR_OPTIONS], useFactory: loggerServiceFactory },
7109
7153
  { provide: NativeWindowService, deps: [DOCUMENT], useFactory: nativeWindowServiceFactory },
@@ -7178,6 +7222,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
7178
7222
  }] });
7179
7223
  class IVICommonOptions extends ICookieOptions {
7180
7224
  }
7225
+ function viewUtilFactory(nativeWindow, renderer) {
7226
+ ViewUtil.renderer = renderer;
7227
+ ViewUtil.document = nativeWindow.document;
7228
+ return ViewUtil;
7229
+ }
7181
7230
  function loggerServiceFactory(options) {
7182
7231
  return new DefaultLogger(!_.isNil(options.loggerLevel) ? options.loggerLevel : LoggerLevel.LOG);
7183
7232
  }
@@ -10059,5 +10108,5 @@ class TransportLazyModule {
10059
10108
  * Generated bundle index. Do not edit.
10060
10109
  */
10061
10110
 
10062
- export { APPLICATION_INJECTOR, ApplicationBaseComponent, ApplicationComponent, AspectRatioResizeDirective, AssetBackgroundDirective, AssetBackgroundPipe, AssetFilePipe, AssetIconPipe, AssetImagePipe, AssetModule, AssetSoundPipe, AssetVideoPipe, AutoScrollBottomDirective, BootstrapBreakpoint, BootstrapBreakpointService, BootstrapBreakpointServiceEvent, BottomSheetBaseComponent, BottomSheetService, COOKIE_OPTIONS, CamelCasePipe, CanDeactivateGuard, CdkTableBaseComponent, CdkTableCellClassNamePipe, CdkTableCellStyleNamePipe, CdkTableCellValuePipe, CdkTableCellValuePipePure, CdkTableColumnClassNamePipe, CdkTableColumnStyleNamePipe, CdkTableDataSource, CdkTableFilterableComponent, CdkTableFilterableMapCollection, CdkTablePaginableBookmarkComponent, CdkTablePaginableBookmarkMapCollection, CdkTablePaginableComponent, CdkTablePaginableMapCollection, CdkTableRowClassNamePipe, CdkTableRowStyleNamePipe, ClickToCopyDirective, ClickToSelectDirective, CookieModule, CookieOptions, CookieService, Direction, FinancePipe, FocusDirective, FocusManager, FormElementAsync, FormElementSync, HTMLContentTitleDirective, HTMLTitleDirective, 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, WindowClosedError, WindowConfig, WindowDragAreaDirective, WindowElement, WindowEvent, WindowExpandElementComponent, WindowFactory, WindowImpl, WindowMinimizeElementComponent, WindowModule, WindowQuestionBaseComponent, WindowQuestionComponent, WindowResizeElementComponent, WindowService, WindowServiceEvent, cookieServiceFactory, languageServiceFactory, loggerServiceFactory, nativeWindowServiceFactory, notificationServiceFactory, themeAssetServiceFactory, themeServiceFactory };
10111
+ export { APPLICATION_INJECTOR, ApplicationBaseComponent, ApplicationComponent, AspectRatioResizeDirective, AssetBackgroundDirective, AssetBackgroundPipe, AssetFilePipe, AssetIconPipe, AssetImagePipe, AssetModule, AssetSoundPipe, AssetVideoPipe, AutoScrollBottomDirective, BootstrapBreakpoint, BootstrapBreakpointService, BootstrapBreakpointServiceEvent, BottomSheetBaseComponent, BottomSheetService, COOKIE_OPTIONS, CamelCasePipe, CanDeactivateGuard, CdkTableBaseComponent, CdkTableCellClassNamePipe, CdkTableCellStyleNamePipe, CdkTableCellValuePipe, CdkTableCellValuePipePure, CdkTableColumnClassNamePipe, CdkTableColumnStyleNamePipe, CdkTableDataSource, CdkTableFilterableComponent, CdkTableFilterableMapCollection, CdkTablePaginableBookmarkComponent, CdkTablePaginableBookmarkMapCollection, CdkTablePaginableComponent, CdkTablePaginableMapCollection, CdkTableRowClassNamePipe, CdkTableRowStyleNamePipe, ClickToCopyDirective, ClickToSelectDirective, CookieModule, CookieOptions, CookieService, Direction, FinancePipe, FocusDirective, FocusManager, FormElementAsync, FormElementSync, HTMLContentTitleDirective, HTMLTitleDirective, 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, PlatformService, 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, VIEW_UTIL, VI_ANGULAR_OPTIONS, ViewUtil, WINDOW_CONTENT_CONTAINER, WindowAlign, WindowBase, WindowBaseComponent, WindowCloseElementComponent, WindowClosedError, WindowConfig, WindowDragAreaDirective, WindowElement, WindowEvent, WindowExpandElementComponent, WindowFactory, WindowImpl, WindowMinimizeElementComponent, WindowModule, WindowQuestionBaseComponent, WindowQuestionComponent, WindowResizeElementComponent, WindowService, WindowServiceEvent, cookieServiceFactory, languageServiceFactory, loggerServiceFactory, nativeWindowServiceFactory, notificationServiceFactory, themeAssetServiceFactory, themeServiceFactory, viewUtilFactory };
10063
10112
  //# sourceMappingURL=ts-core-angular.mjs.map