@acorex/core 6.5.13 → 6.5.14

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.
Files changed (143) hide show
  1. package/karma.conf.js +32 -0
  2. package/ng-package.json +10 -0
  3. package/package.json +13 -33
  4. package/src/lib/classes/base-page.class.ts +29 -0
  5. package/src/lib/classes/color.class.ts +61 -0
  6. package/src/lib/classes/datetime.class.ts +373 -0
  7. package/src/lib/classes/menu.class.ts +37 -0
  8. package/{lib/classes/navigator.class.d.ts → src/lib/classes/navigator.class.ts} +1 -1
  9. package/{lib/classes/popup.class.d.ts → src/lib/classes/popup.class.ts} +2 -0
  10. package/src/lib/classes/promise.class.ts +25 -0
  11. package/src/lib/classes/select.class.ts +7 -0
  12. package/src/lib/core.module.ts +21 -0
  13. package/src/lib/error/error.module.ts +13 -0
  14. package/src/lib/error/error.service.ts +23 -0
  15. package/src/lib/error/index.ts +3 -0
  16. package/{lib/events/keyboard.d.ts → src/lib/events/keyboard.ts} +3 -0
  17. package/{lib/http/http-error.class.d.ts → src/lib/http/http-error.class.ts} +2 -2
  18. package/{lib/http/http-events.interceptor.d.ts → src/lib/http/http-events.interceptor.ts} +7 -3
  19. package/{lib/http/http-request.class.d.ts → src/lib/http/http-request.class.ts} +5 -5
  20. package/src/lib/http/http-result.class.ts +34 -0
  21. package/src/lib/http/http.module.ts +25 -0
  22. package/src/lib/http/http.service.ts +159 -0
  23. package/{esm2020 → src}/lib/locale/en.json +6 -6
  24. package/{esm2020 → src}/lib/locale/fa.json +7 -7
  25. package/src/lib/pipe/datetime.pipe.ts +20 -0
  26. package/src/lib/pipe/htmlToText.pipe.ts +18 -0
  27. package/src/lib/platform/index.ts +1 -0
  28. package/src/lib/platform/platform.service.ts +211 -0
  29. package/src/lib/services/config.ts +36 -0
  30. package/src/lib/services/event.service.ts +31 -0
  31. package/src/lib/services/navigator.service.ts +8 -0
  32. package/src/lib/services/storage.service.ts +11 -0
  33. package/src/lib/translator/translator.module.ts +19 -0
  34. package/src/lib/translator/translator.pipe.ts +22 -0
  35. package/src/lib/translator/translator.service.ts +19 -0
  36. package/src/lib/translator/translator.ts +31 -0
  37. package/src/lib/utils/array/array-util.ts +140 -0
  38. package/src/lib/utils/html/html-util.ts +264 -0
  39. package/src/lib/utils/html/html.module.ts +11 -0
  40. package/src/lib/utils/math/math-util.ts +5 -0
  41. package/src/lib/utils/object/object-util.ts +87 -0
  42. package/src/lib/utils/render/on-demand-preload-strategy.service.ts +25 -0
  43. package/src/lib/utils/render/render.service.ts +110 -0
  44. package/src/lib/utils/render/rendering.module.ts +25 -0
  45. package/src/lib/utils/scroll/scroll.directive.ts +35 -0
  46. package/src/lib/utils/scroll/scroll.module.ts +11 -0
  47. package/src/lib/utils/separator/separator.module.ts +11 -0
  48. package/src/lib/utils/separator/separator.pipe.ts +27 -0
  49. package/{public-api.d.ts → src/public-api.ts} +10 -0
  50. package/src/test.ts +28 -0
  51. package/tsconfig.lib.json +25 -0
  52. package/tsconfig.lib.prod.json +6 -0
  53. package/tsconfig.spec.json +18 -0
  54. package/tslint.json +17 -0
  55. package/acorex-core.d.ts +0 -5
  56. package/esm2020/acorex-core.mjs +0 -5
  57. package/esm2020/lib/classes/base-page.class.mjs +0 -28
  58. package/esm2020/lib/classes/color.class.mjs +0 -49
  59. package/esm2020/lib/classes/datetime.class.mjs +0 -314
  60. package/esm2020/lib/classes/menu.class.mjs +0 -27
  61. package/esm2020/lib/classes/navigator.class.mjs +0 -2
  62. package/esm2020/lib/classes/popup.class.mjs +0 -2
  63. package/esm2020/lib/classes/promise.class.mjs +0 -19
  64. package/esm2020/lib/classes/sectionlist.class.mjs +0 -2
  65. package/esm2020/lib/classes/select.class.mjs +0 -3
  66. package/esm2020/lib/core.module.mjs +0 -27
  67. package/esm2020/lib/error/error.class.mjs +0 -2
  68. package/esm2020/lib/error/error.module.mjs +0 -19
  69. package/esm2020/lib/error/error.service.mjs +0 -21
  70. package/esm2020/lib/events/keyboard.mjs +0 -2
  71. package/esm2020/lib/http/http-error.class.mjs +0 -2
  72. package/esm2020/lib/http/http-events.interceptor.mjs +0 -3
  73. package/esm2020/lib/http/http-request.class.mjs +0 -2
  74. package/esm2020/lib/http/http-result.class.mjs +0 -21
  75. package/esm2020/lib/http/http.module.mjs +0 -37
  76. package/esm2020/lib/http/http.service.mjs +0 -145
  77. package/esm2020/lib/pipe/datetime.pipe.mjs +0 -25
  78. package/esm2020/lib/pipe/htmlToText.pipe.mjs +0 -25
  79. package/esm2020/lib/platform/index.mjs +0 -2
  80. package/esm2020/lib/platform/platform.service.mjs +0 -138
  81. package/esm2020/lib/services/config.mjs +0 -29
  82. package/esm2020/lib/services/event.service.mjs +0 -36
  83. package/esm2020/lib/services/navigator.service.mjs +0 -10
  84. package/esm2020/lib/services/storage.service.mjs +0 -16
  85. package/esm2020/lib/translator/translator.mjs +0 -26
  86. package/esm2020/lib/translator/translator.module.mjs +0 -25
  87. package/esm2020/lib/translator/translator.pipe.mjs +0 -24
  88. package/esm2020/lib/translator/translator.service.mjs +0 -21
  89. package/esm2020/lib/utils/array/array-util.mjs +0 -133
  90. package/esm2020/lib/utils/html/html-util.mjs +0 -192
  91. package/esm2020/lib/utils/html/html.module.mjs +0 -19
  92. package/esm2020/lib/utils/math/math-util.mjs +0 -6
  93. package/esm2020/lib/utils/object/object-util.mjs +0 -83
  94. package/esm2020/lib/utils/render/on-demand-preload-strategy.service.mjs +0 -20
  95. package/esm2020/lib/utils/render/render.service.mjs +0 -103
  96. package/esm2020/lib/utils/render/rendering.module.mjs +0 -35
  97. package/esm2020/lib/utils/scroll/scroll.directive.mjs +0 -54
  98. package/esm2020/lib/utils/scroll/scroll.module.mjs +0 -19
  99. package/esm2020/lib/utils/separator/separator.module.mjs +0 -19
  100. package/esm2020/lib/utils/separator/separator.pipe.mjs +0 -33
  101. package/esm2020/public-api.mjs +0 -44
  102. package/fesm2015/acorex-core.mjs +0 -2262
  103. package/fesm2015/acorex-core.mjs.map +0 -1
  104. package/fesm2020/acorex-core.mjs +0 -2258
  105. package/fesm2020/acorex-core.mjs.map +0 -1
  106. package/lib/classes/base-page.class.d.ts +0 -13
  107. package/lib/classes/color.class.d.ts +0 -17
  108. package/lib/classes/datetime.class.d.ts +0 -63
  109. package/lib/classes/menu.class.d.ts +0 -34
  110. package/lib/classes/promise.class.d.ts +0 -7
  111. package/lib/classes/select.class.d.ts +0 -7
  112. package/lib/core.module.d.ts +0 -9
  113. package/lib/error/error.module.d.ts +0 -7
  114. package/lib/error/error.service.d.ts +0 -13
  115. package/lib/http/http-result.class.d.ts +0 -11
  116. package/lib/http/http.module.d.ts +0 -10
  117. package/lib/http/http.service.d.ts +0 -23
  118. package/lib/pipe/datetime.pipe.d.ts +0 -8
  119. package/lib/pipe/htmlToText.pipe.d.ts +0 -7
  120. package/lib/platform/index.d.ts +0 -1
  121. package/lib/platform/platform.service.d.ts +0 -25
  122. package/lib/services/config.d.ts +0 -9
  123. package/lib/services/event.service.d.ts +0 -9
  124. package/lib/services/navigator.service.d.ts +0 -8
  125. package/lib/services/storage.service.d.ts +0 -7
  126. package/lib/translator/translator.d.ts +0 -9
  127. package/lib/translator/translator.module.d.ts +0 -8
  128. package/lib/translator/translator.pipe.d.ts +0 -8
  129. package/lib/translator/translator.service.d.ts +0 -8
  130. package/lib/utils/array/array-util.d.ts +0 -6
  131. package/lib/utils/html/html-util.d.ts +0 -62
  132. package/lib/utils/html/html.module.d.ts +0 -8
  133. package/lib/utils/math/math-util.d.ts +0 -3
  134. package/lib/utils/object/object-util.d.ts +0 -7
  135. package/lib/utils/render/on-demand-preload-strategy.service.d.ts +0 -10
  136. package/lib/utils/render/render.service.d.ts +0 -18
  137. package/lib/utils/render/rendering.module.d.ts +0 -8
  138. package/lib/utils/scroll/scroll.directive.d.ts +0 -18
  139. package/lib/utils/scroll/scroll.module.d.ts +0 -8
  140. package/lib/utils/separator/separator.module.d.ts +0 -8
  141. package/lib/utils/separator/separator.pipe.d.ts +0 -8
  142. /package/{lib/classes/sectionlist.class.d.ts → src/lib/classes/sectionlist.class.ts} +0 -0
  143. /package/{lib/error/error.class.d.ts → src/lib/error/error.class.ts} +0 -0
@@ -0,0 +1,110 @@
1
+ import {
2
+ ApplicationRef, ComponentFactoryResolver, ComponentRef, Injectable,
3
+ Injector, EmbeddedViewRef, Type, Compiler, NgModuleFactory
4
+ } from '@angular/core';
5
+ import { Router, Route } from '@angular/router';
6
+ import { AXOnDemandPreloadService } from './on-demand-preload-strategy.service';
7
+
8
+
9
+
10
+ @Injectable({ providedIn: 'root' })
11
+ export class AXRenderService {
12
+ constructor(
13
+ private appRef: ApplicationRef,
14
+ private router: Router,
15
+ private componentFactoryResolver: ComponentFactoryResolver,
16
+ private compiler: Compiler,
17
+ private modulePreloadService: AXOnDemandPreloadService,
18
+ private injector: Injector) {
19
+ }
20
+
21
+
22
+
23
+ appendComponent<T>(
24
+ componentClass: Type<T>,
25
+ options: any = {},
26
+ location?: Element): ComponentRef<any> {
27
+
28
+ const componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentClass);
29
+ const componentRef = componentFactory.create(this.injector);
30
+ this.appRef.attachView(componentRef.hostView);
31
+ Object.assign(componentRef.instance, options);
32
+ //
33
+ const domElem = (componentRef.hostView as EmbeddedViewRef<any>).rootNodes[0] as HTMLElement;
34
+ componentRef.onDestroy(() => {
35
+ this.appRef.detachView(componentRef.hostView);
36
+ });
37
+ if (location) {
38
+ location.appendChild(domElem);
39
+ } else {
40
+ document.body.appendChild(domElem);
41
+ }
42
+ setTimeout(() => {
43
+ componentRef.changeDetectorRef.detectChanges();
44
+ }, 0);
45
+ return componentRef;
46
+ }
47
+
48
+ findLoadedComponentByRoute(path: string, timeoutTime: number = 10): Promise<Route> {
49
+ const delay = 200;
50
+ const loop = timeoutTime * 1000 / delay;
51
+ return new Promise((resolve, reject) => {
52
+ let found: Route = null;
53
+ let preload: boolean = false;
54
+ const theLoop = (i) => {
55
+ setTimeout(async () => {
56
+ found = await this._findLoadedComponentByRoute(path);
57
+ if (--i && found == null) {
58
+ if (!preload) {
59
+ this.modulePreloadService.startPreload(path);
60
+ preload = true;
61
+ }
62
+ theLoop(i);
63
+ }
64
+ else if (found) {
65
+ resolve(found);
66
+ }
67
+ else {
68
+ reject();
69
+ }
70
+ }, delay);
71
+ };
72
+ theLoop(loop);
73
+ });
74
+ }
75
+
76
+ private async _findLoadedComponentByRoute(search) {
77
+
78
+ let found: Route = null;
79
+ const f = (children, parentPath) => {
80
+ for (const p in children) {
81
+ if (children.hasOwnProperty(p)) {
82
+ const route = children[p];
83
+ const pp = (route.path != '' && route.path != null) ? parentPath + '/' + route.path : parentPath;
84
+ if (pp == search && !route._loadedConfig && route.component) {
85
+ found = route;
86
+ return;
87
+ } else if (route._loadedConfig || route.children) {
88
+ f(route.children || route._loadedConfig.routes, pp);
89
+ }
90
+ }
91
+ }
92
+ };
93
+
94
+ for (const p in this.router.config) {
95
+ if (this.router.config.hasOwnProperty(p)) {
96
+ const route = this.router.config[p];
97
+ if (route.path === search && route.component) {
98
+ found = route;
99
+ }
100
+ else if (route['_loadedConfig'] || route.children) {
101
+ f(route.children || route['_loadedConfig'].routes, route.path);
102
+ }
103
+ if (found)
104
+ break;
105
+ }
106
+ }
107
+ return found;
108
+ }
109
+
110
+ }
@@ -0,0 +1,25 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { AXRenderService } from './render.service';
3
+ import { AXOnDemandPreloadService } from './on-demand-preload-strategy.service';
4
+
5
+
6
+ // @dynamic
7
+ export function getOnDemandPreloadServiceFactory() {
8
+ return new AXOnDemandPreloadService();
9
+ }
10
+
11
+ @NgModule({
12
+ imports: [],
13
+ exports: [],
14
+ declarations: [],
15
+ providers: [
16
+ {
17
+ provide: AXOnDemandPreloadService,
18
+ useFactory: getOnDemandPreloadServiceFactory
19
+ },
20
+ AXRenderService
21
+ ],
22
+ })
23
+ export class AXRenderingModule {
24
+
25
+ }
@@ -0,0 +1,35 @@
1
+ import { Directive, HostListener, Input } from '@angular/core';
2
+ import { ElementRef } from '@angular/core';
3
+
4
+ @Directive({
5
+ // tslint:disable-next-line: directive-selector
6
+ selector: '[horizontalScroll]'
7
+ })
8
+ export class AXHorizontalScrollDirective {
9
+ constructor(private el: ElementRef<HTMLElement>) { }
10
+
11
+ @Input('horizontalScroll')
12
+ scrollValue = 40;
13
+
14
+ @HostListener('wheel', ['$event'])
15
+ onMouseWheel(e) {
16
+ const delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
17
+ this.el.nativeElement.scrollLeft -= delta * this.scrollValue;
18
+ }
19
+ }
20
+ @Directive({
21
+ // tslint:disable-next-line: directive-selector
22
+ selector: '[verticalScroll]'
23
+ })
24
+ export class AXVerticalScrollDirective {
25
+ constructor(private el: ElementRef<HTMLElement>) { }
26
+
27
+ @Input('verticalScroll')
28
+ scrollValue = 40;
29
+
30
+ @HostListener('wheel', ['$event'])
31
+ onMouseWheel(e) {
32
+ const delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
33
+ this.el.nativeElement.scrollTop -= delta * this.scrollValue;
34
+ }
35
+ }
@@ -0,0 +1,11 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { AXHorizontalScrollDirective, AXVerticalScrollDirective } from './scroll.directive';
4
+
5
+ @NgModule({
6
+ declarations: [AXHorizontalScrollDirective, AXVerticalScrollDirective],
7
+ imports: [CommonModule],
8
+ exports: [AXHorizontalScrollDirective, AXVerticalScrollDirective],
9
+ providers: []
10
+ })
11
+ export class AXScrollModule { }
@@ -0,0 +1,11 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { AXSeparatorPipe } from './separator.pipe';
4
+
5
+ @NgModule({
6
+ declarations: [AXSeparatorPipe],
7
+ imports: [CommonModule],
8
+ exports: [AXSeparatorPipe],
9
+ providers: []
10
+ })
11
+ export class AXSeparatorModule { }
@@ -0,0 +1,27 @@
1
+ import { Pipe, PipeTransform, Injectable } from '@angular/core';
2
+ import { AXConfig } from '../../services/config';
3
+
4
+ @Pipe({ name: 'separator' })
5
+ @Injectable({
6
+ providedIn: 'root'
7
+ })
8
+
9
+ // export class AXSeparatorPipe2 implements PipeTransform {
10
+ // transform(value: any) {
11
+ // if (value) {
12
+ // return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
13
+ // } else {
14
+ // return '0';
15
+ // }
16
+ // }
17
+ // }
18
+ export class AXSeparatorPipe implements PipeTransform {
19
+ transform(value: number | string, currency: string = '', decimal: number = 0, locale: string = AXConfig.get('layout.rtl') ? 'fa' : 'en'): string {
20
+ return (
21
+ new Intl.NumberFormat(locale, {
22
+ minimumFractionDigits: 0,
23
+ maximumFractionDigits: decimal
24
+ }).format(Number(value)) + (currency != '' ? ' ' + currency : '')
25
+ );
26
+ }
27
+ }
@@ -7,27 +7,36 @@ export * from './lib/classes/promise.class';
7
7
  export * from './lib/classes/sectionlist.class';
8
8
  export * from './lib/classes/select.class';
9
9
  export * from './lib/classes/base-page.class';
10
+
10
11
  export * from './lib/error/error.class';
11
12
  export * from './lib/error/error.module';
12
13
  export * from './lib/error/error.service';
14
+
13
15
  export * from './lib/events/keyboard';
16
+
14
17
  export * from './lib/http/http-error.class';
15
18
  export * from './lib/http/http-events.interceptor';
16
19
  export * from './lib/http/http-request.class';
17
20
  export * from './lib/http/http-result.class';
18
21
  export * from './lib/http/http.module';
19
22
  export * from './lib/http/http.service';
23
+
20
24
  export * from './lib/platform/index';
25
+
21
26
  export * from './lib/pipe/datetime.pipe';
22
27
  export * from './lib/pipe/htmlToText.pipe';
28
+
23
29
  export * from './lib/services/event.service';
24
30
  export * from './lib/services/navigator.service';
25
31
  export * from './lib/services/storage.service';
26
32
  export * from './lib/services/config';
33
+
34
+
27
35
  export * from './lib/translator/translator.service';
28
36
  export * from './lib/translator/translator.pipe';
29
37
  export * from './lib/translator/translator';
30
38
  export * from './lib/translator/translator.module';
39
+
31
40
  export * from './lib/utils/array/array-util';
32
41
  export * from './lib/utils/html/html-util';
33
42
  export * from './lib/utils/html/html.module';
@@ -41,3 +50,4 @@ export * from './lib/utils/scroll/scroll.module';
41
50
  export * from './lib/utils/separator/separator.module';
42
51
  export * from './lib/utils/separator/separator.pipe';
43
52
  export * from './lib/core.module';
53
+
package/src/test.ts ADDED
@@ -0,0 +1,28 @@
1
+ // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+ import 'zone.js';
4
+ import 'zone.js/testing';
5
+ import { getTestBed } from '@angular/core/testing';
6
+ import {
7
+ BrowserDynamicTestingModule,
8
+ platformBrowserDynamicTesting
9
+ } from '@angular/platform-browser-dynamic/testing';
10
+
11
+ declare const require: {
12
+ context(path: string, deep?: boolean, filter?: RegExp): {
13
+ keys(): string[];
14
+ <T>(id: string): T;
15
+ };
16
+ };
17
+
18
+ // First, initialize the Angular testing environment.
19
+ getTestBed().initTestEnvironment(
20
+ BrowserDynamicTestingModule,
21
+ platformBrowserDynamicTesting(), {
22
+ teardown: { destroyAfterEach: false }
23
+ }
24
+ );
25
+ // Then we find all the tests.
26
+ const context = require.context('./', true, /\.spec\.ts$/);
27
+ // And load the modules.
28
+ context.keys().map(context);
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "allowSyntheticDefaultImports": true,
5
+ "outDir": "../../../out-tsc/lib",
6
+ "target": "es2015",
7
+ "declaration": true,
8
+ "inlineSources": true,
9
+ "esModuleInterop": true,
10
+ "types": [],
11
+ "lib": [
12
+ "dom",
13
+ "es2018"
14
+ ]
15
+ },
16
+ "angularCompilerOptions": {
17
+ "skipTemplateCodegen": true,
18
+ "strictMetadataEmit": true,
19
+ "enableResourceInlining": true
20
+ },
21
+ "exclude": [
22
+ "src/test.ts",
23
+ "**/*.spec.ts"
24
+ ]
25
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "./tsconfig.lib.json",
3
+ "angularCompilerOptions": {
4
+ "enableIvy": false
5
+ }
6
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": "../../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../../out-tsc/spec",
5
+ "types": [
6
+ "jasmine",
7
+ "node"
8
+ ],
9
+ "resolveJsonModule":true
10
+ },
11
+ "files": [
12
+ "src/test.ts"
13
+ ],
14
+ "include": [
15
+ "**/*.spec.ts",
16
+ "**/*.d.ts"
17
+ ]
18
+ }
package/tslint.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../../../tslint.json",
3
+ "rules": {
4
+ "directive-selector": [
5
+ true,
6
+ "attribute",
7
+ "lib",
8
+ "camelCase"
9
+ ],
10
+ "component-selector": [
11
+ true,
12
+ "element",
13
+ "lib",
14
+ "kebab-case"
15
+ ]
16
+ }
17
+ }
package/acorex-core.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@acorex/core" />
5
- export * from './public-api';
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './public-api';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNvcmV4LWNvcmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9hY29yZXgvY29yZS9zcmMvYWNvcmV4LWNvcmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -1,28 +0,0 @@
1
- import { EventEmitter, Injectable } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * @deprecated Use AXBasePageComponent from @acorex/components
5
- */
6
- // TODO: Add Angular decorator.
7
- export class AXBasePageComponent {
8
- constructor() {
9
- this.onClosed = new EventEmitter();
10
- }
11
- close(data) {
12
- this.onClosed.emit({
13
- component: this,
14
- data: data
15
- });
16
- }
17
- onClosing(e) {
18
- }
19
- ngOnDestroy() {
20
- this.onClosed.unsubscribe();
21
- }
22
- }
23
- AXBasePageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXBasePageComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
24
- AXBasePageComponent.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXBasePageComponent });
25
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXBasePageComponent, decorators: [{
26
- type: Injectable
27
- }] });
28
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmFzZS1wYWdlLmNsYXNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvYWNvcmV4L2NvcmUvc3JjL2xpYi9jbGFzc2VzL2Jhc2UtcGFnZS5jbGFzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFFekQ7O0dBRUc7QUFDSCwrQkFBK0I7QUFFL0IsTUFBTSxPQUFnQixtQkFBbUI7SUFEekM7UUFHSSxhQUFRLEdBQXNCLElBQUksWUFBWSxFQUFPLENBQUM7S0FpQnpEO0lBZkcsS0FBSyxDQUFDLElBQVU7UUFDWixJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQztZQUNmLFNBQVMsRUFBRSxJQUFJO1lBQ2YsSUFBSSxFQUFFLElBQUk7U0FD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XColorUtil {
2
- static hex2Rgb(hexColor) {
3
- const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexColor);
4
- return result ? {
5
- r: parseInt(result[1], 16),
6
- g: parseInt(result[2], 16),
7
- b: parseInt(result[3], 16)
8
- } : null;
9
- }
10
- static rgb2Hex(r, g, b, a = 255) {
11
- let alpha;
12
- let hex = (r | 1 << 8).toString(16).slice(1) +
13
- (g | 1 << 8).toString(16).slice(1) +
14
- (b | 1 << 8).toString(16).slice(1);
15
- if (a !== 255) {
16
- alpha = a;
17
- }
18
- else {
19
- alpha = 1;
20
- }
21
- alpha = Math.round(alpha * 100) / 100;
22
- alpha = Math.round(alpha * 255);
23
- const hexAlpha = (alpha + 0x10000).toString(16).substr(-2).toUpperCase();
24
- return '#' + hex + (alpha == 255 ? '' : hexAlpha);
25
- }
26
- ;
27
- static illuminance(hexColor) {
28
- const rgbColor = AXColorUtil.hex2Rgb(hexColor);
29
- if (!rgbColor) {
30
- return -1;
31
- }
32
- const r = rgbColor.r;
33
- const g = rgbColor.g;
34
- const b = rgbColor.b;
35
- const a = [r, g, b].map(v => {
36
- v /= 255;
37
- return (v <= 0.03928) ?
38
- v / 12.92 :
39
- Math.pow(((v + 0.055) / 1.055), 2.4);
40
- });
41
- return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
42
- }
43
- static contrastToWhite(hexColor) {
44
- const whiteIlluminance = 1;
45
- const illuminance = AXColorUtil.illuminance(hexColor);
46
- return whiteIlluminance / illuminance;
47
- }
48
- }
49
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sb3IuY2xhc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9hY29yZXgvY29yZS9zcmMvbGliL2NsYXNzZXMvY29sb3IuY2xhc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBUU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ID0gL14jPyhbYS1mXFxkXXsyfSkoW2EtZlxcZF17Mn0pKFthLWZcXGRdezJ9KSQvaS5leGVjKGhleENvbG9yKTtcclxuICAgICAgICByZXR1cm4gcmVzdWx0ID8ge1xyXG4gICAgICAgICAgICByOiBwYXJzZUludChyZXN1bHRbMV0sIDE2KSxcclxuICAgICAgICAgICAgZzogcGFyc2VJbnQocmVzdWx0WzJdLCAxNiksXHJcbiAgICAgICAgICAgIGI6IHBhcnNlSW50KHJlc3VsdFszXSwgMTYpXHJcbiAgICAgICAgfSA6IG51bGw7XHJcbiAgICB9XHJcblxyXG4gICAgc3RhdGljIHJnYjJIZXgocjogbnVtYmVyLCBnOiBudW1iZXIsIGI6IG51bWJlciwgYTogbnVtYmVyID0gMjU1KTogc3RyaW5nIHtcclxuICAgICAgICBsZXQgYWxwaGE7XHJcbiAgICAgICAgbGV0IGhleCA9IChyIHwgMSA8PCA4KS50b1N0cmluZygxNikuc2xpY2UoMSkgK1xyXG4gICAgICAgICAgICAoZyB8IDEgPDwgOCkudG9TdHJpbmcoMTYpLnNsaWNlKDEpICtcclxuICAgICAgICAgICAgKGIgfCAxIDw8IDgpLnRvU3RyaW5nKDE2KS5zbGljZSgxKTtcclxuICAgICAgICBpZiAoYSAhPT0gMjU1KSB7XHJcbiAgICAgICAgICAgIGFscGhhID0gYTtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICBhbHBoYSA9IDE7XHJcbiAgICAgICAgfVxyXG5cclxuICAgICAgICBhbHBoYSA9IE1hdGgucm91bmQoYWxwaGEgKiAxMDApIC8gMTAwO1xyXG4gICAgICAgIGFscGhhID0gTWF0aC5yb3VuZChhbHBoYSAqIDI1NSk7XHJcbiAgICAgICAgY29uc3QgaGV4QWxwaGEgPSAoYWxwaGEgKyAweDEwMDAwKS50b1N0cmluZygxNikuc3Vic3RyKC0yKS50b1VwcGVyQ2FzZSgpO1xyXG4gICAgICAgIHJldHVybiAnIycgKyBoZXggKyAoYWxwaGEg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