@ts-core/angular 13.1.15 → 13.1.18

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,31 +1771,28 @@ class CookieService extends Cookie.CookieService {
1760
1771
  // Constructor
1761
1772
  //
1762
1773
  // --------------------------------------------------------------------------
1763
- constructor(options, nativeWindow) {
1774
+ constructor(options, platform, item) {
1764
1775
  super({ options });
1765
- // this['cookieString'] = nativeWindow.document.cookie;
1776
+ this._document = !_.isNil(item) ? item : document;
1777
+ let cookieString = '';
1766
1778
  Object.defineProperty(this, 'cookieString', {
1767
- get: () => nativeWindow.document.cookie,
1768
- set: (value) => (nativeWindow.document.cookie = value),
1779
+ get: () => {
1780
+ return platform.isPlatformBrowser ? this.document.cookie : cookieString;
1781
+ },
1782
+ set: (value) => {
1783
+ if (platform.isPlatformBrowser) {
1784
+ this.document.cookie = value;
1785
+ }
1786
+ else {
1787
+ cookieString = value;
1788
+ }
1789
+ },
1769
1790
  enumerable: true,
1770
1791
  configurable: true
1771
1792
  });
1772
1793
  }
1773
1794
  // --------------------------------------------------------------------------
1774
1795
  //
1775
- // Protected Methods
1776
- //
1777
- // --------------------------------------------------------------------------
1778
- /*
1779
- protected get cookieString(): string {
1780
- return document.cookie || '';
1781
- }
1782
- protected override set cookieString(value: string) {
1783
- document.cookie = value;
1784
- }
1785
- */
1786
- // --------------------------------------------------------------------------
1787
- //
1788
1796
  // Public Methods
1789
1797
  //
1790
1798
  // --------------------------------------------------------------------------
@@ -1816,7 +1824,48 @@ class CookieService extends Cookie.CookieService {
1816
1824
  this.remove(key);
1817
1825
  }
1818
1826
  }
1827
+ // --------------------------------------------------------------------------
1828
+ //
1829
+ // Private Properties
1830
+ //
1831
+ // --------------------------------------------------------------------------
1832
+ get document() {
1833
+ return this._document;
1834
+ }
1835
+ }
1836
+
1837
+ class PlatformService extends DestroyableContainer {
1838
+ // --------------------------------------------------------------------------
1839
+ //
1840
+ // Constructor
1841
+ //
1842
+ // --------------------------------------------------------------------------
1843
+ constructor(platformId) {
1844
+ super();
1845
+ this._isPlatformServer = isPlatformServer(platformId);
1846
+ this._isPlatformBrowser = isPlatformBrowser(platformId);
1847
+ }
1848
+ // --------------------------------------------------------------------------
1849
+ //
1850
+ // Public Properties
1851
+ //
1852
+ // --------------------------------------------------------------------------
1853
+ get isPlatformServer() {
1854
+ return this._isPlatformServer;
1855
+ }
1856
+ get isPlatformBrowser() {
1857
+ return this._isPlatformBrowser;
1858
+ }
1819
1859
  }
1860
+ PlatformService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlatformService, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
1861
+ PlatformService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlatformService, providedIn: 'root' });
1862
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: PlatformService, decorators: [{
1863
+ type: Injectable,
1864
+ args: [{ providedIn: 'root' }]
1865
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1866
+ type: Inject,
1867
+ args: [PLATFORM_ID]
1868
+ }] }]; } });
1820
1869
 
1821
1870
  class CookieModule {
1822
1871
  // --------------------------------------------------------------------------
@@ -1834,7 +1883,7 @@ class CookieModule {
1834
1883
  },
1835
1884
  {
1836
1885
  provide: CookieService,
1837
- deps: [NativeWindowService, COOKIE_OPTIONS],
1886
+ deps: [NativeWindowService, PlatformService, COOKIE_OPTIONS],
1838
1887
  useFactory: cookieServiceFactory
1839
1888
  }
1840
1889
  ]
@@ -1847,7 +1896,7 @@ CookieModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
1847
1896
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: CookieModule, decorators: [{
1848
1897
  type: NgModule
1849
1898
  }] });
1850
- function cookieServiceFactory(nativeWindow, options) {
1899
+ function cookieServiceFactory(nativeWindow, platform, options) {
1851
1900
  options = _.assign({
1852
1901
  path: '/',
1853
1902
  domain: null,
@@ -1855,7 +1904,7 @@ function cookieServiceFactory(nativeWindow, options) {
1855
1904
  secure: false,
1856
1905
  httpOnly: false
1857
1906
  }, options);
1858
- return new CookieService(options, nativeWindow);
1907
+ return new CookieService(options, platform, nativeWindow.document);
1859
1908
  }
1860
1909
  const COOKIE_OPTIONS = new InjectionToken(`COOKIE_OPTIONS`);
1861
1910
 
@@ -6846,12 +6895,12 @@ class ThemeModule {
6846
6895
  },
6847
6896
  {
6848
6897
  provide: ThemeService,
6849
- deps: [CookieService, THEME_OPTIONS],
6898
+ deps: [NativeWindowService, CookieService, THEME_OPTIONS],
6850
6899
  useFactory: themeServiceFactory
6851
6900
  },
6852
6901
  {
6853
6902
  provide: ThemeAssetService,
6854
- deps: [ThemeService],
6903
+ deps: [ThemeService, NativeWindowService],
6855
6904
  useFactory: themeAssetServiceFactory
6856
6905
  }
6857
6906
  ]
@@ -6869,11 +6918,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
6869
6918
  exports: declarations
6870
6919
  }]
6871
6920
  }] });
6872
- function themeServiceFactory(cookie, options) {
6921
+ function themeServiceFactory(nativeWindow, cookie, options) {
6873
6922
  if (!_.isNil(options) && _.isNil(options.service)) {
6874
6923
  options.service = cookie;
6875
6924
  }
6876
- return new ThemeService(options);
6925
+ return new ThemeService(options, nativeWindow.document);
6877
6926
  }
6878
6927
  function themeAssetServiceFactory(theme) {
6879
6928
  return new ThemeAssetService(theme);
@@ -7102,7 +7151,9 @@ class VICommonModule {
7102
7151
  ngModule: VICommonModule,
7103
7152
  providers: [
7104
7153
  LoadingService,
7154
+ PlatformService,
7105
7155
  CanDeactivateGuard,
7156
+ { provide: VIEW_UTIL, useFactory: viewUtilFactory },
7106
7157
  { provide: VI_ANGULAR_OPTIONS, useValue: options || {} },
7107
7158
  { provide: Logger, deps: [VI_ANGULAR_OPTIONS], useFactory: loggerServiceFactory },
7108
7159
  { provide: NativeWindowService, deps: [DOCUMENT], useFactory: nativeWindowServiceFactory },
@@ -7177,6 +7228,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
7177
7228
  }] });
7178
7229
  class IVICommonOptions extends ICookieOptions {
7179
7230
  }
7231
+ function viewUtilFactory(nativeWindow, renderer) {
7232
+ ViewUtil.renderer = renderer;
7233
+ ViewUtil.document = nativeWindow.document;
7234
+ return ViewUtil;
7235
+ }
7180
7236
  function loggerServiceFactory(options) {
7181
7237
  return new DefaultLogger(!_.isNil(options.loggerLevel) ? options.loggerLevel : LoggerLevel.LOG);
7182
7238
  }
@@ -10058,5 +10114,5 @@ class TransportLazyModule {
10058
10114
  * Generated bundle index. Do not edit.
10059
10115
  */
10060
10116
 
10061
- 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 };
10117
+ 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 };
10062
10118
  //# sourceMappingURL=ts-core-angular.mjs.map