@acorex/core 4.2.67 → 4.2.72

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,10 +1,11 @@
1
1
  import moment from 'jalali-moment';
2
- import { Subject } from 'rxjs';
2
+ import { Subject, fromEvent } from 'rxjs';
3
3
  import * as i0 from '@angular/core';
4
4
  import { EventEmitter, Injectable, InjectionToken, NgModule, Pipe, Directive, Input, HostListener } from '@angular/core';
5
5
  import { CommonModule } from '@angular/common';
6
6
  import * as i1 from '@angular/common/http';
7
7
  import { HttpHeaders, HttpParams, HttpClientModule } from '@angular/common/http';
8
+ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
8
9
  import merge from 'lodash-es/merge';
9
10
  import * as i1$1 from '@angular/router';
10
11
 
@@ -782,6 +783,140 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
782
783
  }]
783
784
  }] });
784
785
 
786
+ const isChrome = (win) => testUserAgent(win, /Chrome/i);
787
+ const isFirefox = (win) => testUserAgent(win, /Firefox/i);
788
+ const isEdge = (win) => testUserAgent(win, /Edge/i);
789
+ const isSafari = (win) => testUserAgent(win, /Safari/i);
790
+ const isOpera = (win) => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);
791
+ const isMSIE = (win) => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);
792
+ const isMobileWeb = (win) => isMobile(win) && !isHybrid(win);
793
+ const isIpad = (win) => {
794
+ // iOS 12 and below
795
+ if (testUserAgent(win, /iPad/i)) {
796
+ return true;
797
+ }
798
+ // iOS 13+
799
+ if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
800
+ return true;
801
+ }
802
+ return false;
803
+ };
804
+ const isIphone = (win) => testUserAgent(win, /iPhone/i);
805
+ const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
806
+ const isAndroid = (win) => testUserAgent(win, /android|sink/i);
807
+ const isAndroidTablet = (win) => {
808
+ return isAndroid(win) && !testUserAgent(win, /mobile/i);
809
+ };
810
+ const isPhablet = (win) => {
811
+ const width = win.innerWidth;
812
+ const height = win.innerHeight;
813
+ const smallest = Math.min(width, height);
814
+ const largest = Math.max(width, height);
815
+ return (smallest > 390 && smallest < 520) &&
816
+ (largest > 620 && largest < 800);
817
+ };
818
+ const isTablet = (win) => {
819
+ const width = win.innerWidth;
820
+ const height = win.innerHeight;
821
+ const smallest = Math.min(width, height);
822
+ const largest = Math.max(width, height);
823
+ return (isIpad(win) ||
824
+ isAndroidTablet(win) ||
825
+ ((smallest > 460 && smallest < 820) &&
826
+ (largest > 780 && largest < 1400)));
827
+ };
828
+ const isMobile = (win) => matchMedia(win, '(any-pointer:coarse)');
829
+ const isDesktop = (win) => !isMobile(win);
830
+ const isHybrid = (win) => isCordova(win) || isCapacitorNative(win);
831
+ const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
832
+ const isCapacitorNative = (win) => {
833
+ const capacitor = win['Capacitor'];
834
+ return !!(capacitor && capacitor.isNative);
835
+ };
836
+ const isElectron = (win) => testUserAgent(win, /electron/i);
837
+ const isPWA = (win) => !!(win.matchMedia('(display-mode: standalone)').matches || win.navigator.standalone);
838
+ const testUserAgent = (win, expr) => expr.test(win.navigator.userAgent);
839
+ const matchMedia = (win, query) => win.matchMedia(query).matches;
840
+ const PLATFORMS_MAP = {
841
+ 'Android': isAndroid,
842
+ 'iOS': isIOS,
843
+ 'Desktop': isDesktop,
844
+ 'Mobile': isMobile,
845
+ 'Chrome': isChrome,
846
+ 'Firefox': isFirefox,
847
+ 'Safari': isSafari,
848
+ 'Edge': isEdge,
849
+ 'Opera': isOpera,
850
+ 'Hybrid': isHybrid,
851
+ 'PWA': isPWA,
852
+ 'Electron': isElectron,
853
+ };
854
+ class AXPlatformEvent {
855
+ }
856
+ class AXPlatform {
857
+ constructor() {
858
+ this.resize = new Subject();
859
+ this.click = new Subject();
860
+ this.scroll = new Subject();
861
+ fromEvent(window, 'resize')
862
+ .pipe(debounceTime(100))
863
+ .pipe(distinctUntilChanged())
864
+ .subscribe((e) => {
865
+ this.resize.next({
866
+ nativeEvent: e,
867
+ source: this
868
+ });
869
+ //
870
+ this._setFullHeightRatio();
871
+ });
872
+ document.addEventListener('click', (e) => {
873
+ this.click.next({
874
+ nativeEvent: e,
875
+ source: this
876
+ });
877
+ }, true);
878
+ document.addEventListener('scroll', (e) => {
879
+ this.scroll.next({
880
+ nativeEvent: e,
881
+ source: this
882
+ });
883
+ }, true);
884
+ // init functions
885
+ this._setFullHeightRatio();
886
+ }
887
+ isRtl() {
888
+ return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';
889
+ }
890
+ isLandscape() {
891
+ return window.innerHeight < window.innerWidth;
892
+ }
893
+ isPortrate() {
894
+ return !this.isLandscape();
895
+ }
896
+ is(name) {
897
+ return PLATFORMS_MAP[name](window) || false;
898
+ }
899
+ switchDarkMode() {
900
+ const _html = document.getElementsByTagName("html")[0];
901
+ _html.classList.add('ax-dark');
902
+ }
903
+ switchLightMode() {
904
+ const _html = document.getElementsByTagName("html")[0];
905
+ _html.classList.remove('ax-dark');
906
+ }
907
+ _setFullHeightRatio() {
908
+ document.querySelector(':root').style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
909
+ }
910
+ }
911
+ AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
912
+ AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXPlatform, providedIn: 'platform' });
913
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXPlatform, decorators: [{
914
+ type: Injectable,
915
+ args: [{
916
+ providedIn: 'platform',
917
+ }]
918
+ }], ctorParameters: function () { return []; } });
919
+
785
920
  class AXDateTimePipe {
786
921
  constructor() { }
787
922
  transform(value, format) {
@@ -2118,5 +2253,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
2118
2253
  * Generated bundle index. Do not edit.
2119
2254
  */
2120
2255
 
2121
- export { AXArrayUtil, AXBaseMenuItem, AXBasePageComponent, AXButtonItem, AXCalendarMonth, AXCheckItem, AXClientRec, AXColorUtil, AXConfig, AXCoreModule, AXDateTime, AXDateTimePipe, AXDateTimeRange, AXErrorModule, AXErrorService, AXEventService, AXFetchProp, AXHorizontalScrollDirective, AXHtmlModule, AXHtmlToTextPipe, AXHtmlUtil, AXHttpModule, AXHttpService, AXMathUtil, AXMenuItem, AXNavigator, AXObjectUtil, AXOnDemandPreloadService, AXPoint, AXPromise, AXRenderService, AXRenderingModule, AXScrollModule, AXSelectItem, AXSeparatorModule, AXSeparatorPipe, AXStorageService, AXTranslator, AXTranslatorModule, AXTranslatorPipe, AXTranslatorService, AXVerticalScrollDirective, AX_ERROR_DISPLAY_INTERCEPTOR, AX_HTTP_EVENT_INTERCEPTOR, HttpResult, getOnDemandPreloadServiceFactory, getPropByPath, setPropByPath };
2256
+ export { AXArrayUtil, AXBaseMenuItem, AXBasePageComponent, AXButtonItem, AXCalendarMonth, AXCheckItem, AXClientRec, AXColorUtil, AXConfig, AXCoreModule, AXDateTime, AXDateTimePipe, AXDateTimeRange, AXErrorModule, AXErrorService, AXEventService, AXFetchProp, AXHorizontalScrollDirective, AXHtmlModule, AXHtmlToTextPipe, AXHtmlUtil, AXHttpModule, AXHttpService, AXMathUtil, AXMenuItem, AXNavigator, AXObjectUtil, AXOnDemandPreloadService, AXPlatform, AXPlatformEvent, AXPoint, AXPromise, AXRenderService, AXRenderingModule, AXScrollModule, AXSelectItem, AXSeparatorModule, AXSeparatorPipe, AXStorageService, AXTranslator, AXTranslatorModule, AXTranslatorPipe, AXTranslatorService, AXVerticalScrollDirective, AX_ERROR_DISPLAY_INTERCEPTOR, AX_HTTP_EVENT_INTERCEPTOR, HttpResult, getOnDemandPreloadServiceFactory, getPropByPath, setPropByPath, testUserAgent };
2122
2257
  //# sourceMappingURL=acorex-core.mjs.map