@acorex/core 6.0.1 → 6.0.7
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.
- package/README.md +24 -24
- package/config/index.d.ts +5 -0
- package/config/public-api.d.ts +1 -0
- package/config/src/configs.d.ts +9 -0
- package/dateTime/index.d.ts +5 -0
- package/dateTime/{public-api.ts → public-api.d.ts} +1 -1
- package/dateTime/src/datetime.class.d.ts +100 -0
- package/dateTime/src/datetime.module.d.ts +8 -0
- package/dateTime/src/datetime.pipe.d.ts +8 -0
- package/dateTime/src/georgian.calendar.d.ts +20 -0
- package/dateTime/src/jalali.calendar.d.ts +35 -0
- package/esm2020/acorex-core.mjs +5 -0
- package/esm2020/config/acorex-core-config.mjs +5 -0
- package/esm2020/config/public-api.mjs +2 -0
- package/esm2020/config/src/configs.mjs +32 -0
- package/esm2020/dateTime/acorex-core-dateTime.mjs +5 -0
- package/esm2020/dateTime/public-api.mjs +6 -0
- package/esm2020/dateTime/src/datetime.class.mjs +296 -0
- package/esm2020/dateTime/src/datetime.module.mjs +33 -0
- package/esm2020/dateTime/src/datetime.pipe.mjs +26 -0
- package/esm2020/dateTime/src/georgian.calendar.mjs +189 -0
- package/esm2020/dateTime/src/jalali.calendar.mjs +359 -0
- package/esm2020/events/acorex-core-events.mjs +5 -0
- package/esm2020/events/public-api.mjs +2 -0
- package/esm2020/events/src/event.service.mjs +36 -0
- package/esm2020/http/acorex-core-http.mjs +5 -0
- package/esm2020/http/public-api.mjs +6 -0
- package/esm2020/http/src/http-error.class.mjs +2 -0
- package/esm2020/http/src/http-events.interceptor.mjs +3 -0
- package/esm2020/http/src/http-request.class.mjs +2 -0
- package/esm2020/http/src/http-result.class.mjs +21 -0
- package/esm2020/http/src/http.module.mjs +29 -0
- package/esm2020/http/src/http.service.mjs +147 -0
- package/esm2020/pipes/acorex-core-pipes.mjs +5 -0
- package/esm2020/pipes/public-api.mjs +3 -0
- package/esm2020/pipes/src/pipes.module.mjs +19 -0
- package/esm2020/pipes/src/safe.pipe.mjs +30 -0
- package/esm2020/platform/acorex-core-platform.mjs +5 -0
- package/esm2020/platform/public-api.mjs +2 -0
- package/esm2020/platform/src/platform.service.mjs +141 -0
- package/esm2020/public-api.mjs +5 -0
- package/esm2020/translation/acorex-core-translation.mjs +5 -0
- package/esm2020/translation/public-api.mjs +4 -0
- package/esm2020/translation/src/translation.module.mjs +18 -0
- package/esm2020/translation/src/translator.mjs +43 -0
- package/esm2020/translation/src/translator.pipe.mjs +15 -0
- package/esm2020/utils/acorex-core-utils.mjs +5 -0
- package/esm2020/utils/public-api.mjs +5 -0
- package/esm2020/utils/src/color-util.mjs +71 -0
- package/esm2020/utils/src/drawing-util.mjs +27 -0
- package/esm2020/utils/src/object-util.mjs +39 -0
- package/esm2020/utils/src/string-util.mjs +19 -0
- package/events/index.d.ts +5 -0
- package/events/public-api.d.ts +1 -0
- package/events/src/event.service.d.ts +9 -0
- package/fesm2015/acorex-core-config.mjs +39 -0
- package/fesm2015/acorex-core-config.mjs.map +1 -0
- package/fesm2015/acorex-core-dateTime.mjs +900 -0
- package/fesm2015/acorex-core-dateTime.mjs.map +1 -0
- package/fesm2015/acorex-core-events.mjs +43 -0
- package/fesm2015/acorex-core-events.mjs.map +1 -0
- package/fesm2015/acorex-core-http.mjs +201 -0
- package/fesm2015/acorex-core-http.mjs.map +1 -0
- package/fesm2015/acorex-core-pipes.mjs +53 -0
- package/fesm2015/acorex-core-pipes.mjs.map +1 -0
- package/fesm2015/acorex-core-platform.mjs +148 -0
- package/fesm2015/acorex-core-platform.mjs.map +1 -0
- package/fesm2015/acorex-core-translation.mjs +80 -0
- package/fesm2015/acorex-core-translation.mjs.map +1 -0
- package/fesm2015/acorex-core-utils.mjs +163 -0
- package/fesm2015/acorex-core-utils.mjs.map +1 -0
- package/fesm2015/acorex-core.mjs +11 -0
- package/fesm2015/acorex-core.mjs.map +1 -0
- package/fesm2020/acorex-core-config.mjs +39 -0
- package/fesm2020/acorex-core-config.mjs.map +1 -0
- package/fesm2020/acorex-core-dateTime.mjs +900 -0
- package/fesm2020/acorex-core-dateTime.mjs.map +1 -0
- package/fesm2020/acorex-core-events.mjs +43 -0
- package/fesm2020/acorex-core-events.mjs.map +1 -0
- package/fesm2020/acorex-core-http.mjs +200 -0
- package/fesm2020/acorex-core-http.mjs.map +1 -0
- package/fesm2020/acorex-core-pipes.mjs +53 -0
- package/fesm2020/acorex-core-pipes.mjs.map +1 -0
- package/fesm2020/acorex-core-platform.mjs +148 -0
- package/fesm2020/acorex-core-platform.mjs.map +1 -0
- package/fesm2020/acorex-core-translation.mjs +79 -0
- package/fesm2020/acorex-core-translation.mjs.map +1 -0
- package/fesm2020/acorex-core-utils.mjs +163 -0
- package/fesm2020/acorex-core-utils.mjs.map +1 -0
- package/fesm2020/acorex-core.mjs +11 -0
- package/fesm2020/acorex-core.mjs.map +1 -0
- package/http/index.d.ts +5 -0
- package/http/{public-api.ts → public-api.d.ts} +1 -1
- package/http/src/{http-error.class.ts → http-error.class.d.ts} +2 -2
- package/http/src/{http-events.interceptor.ts → http-events.interceptor.d.ts} +3 -7
- package/http/src/{http-request.class.ts → http-request.class.d.ts} +5 -5
- package/http/src/http-result.class.d.ts +11 -0
- package/http/src/http.module.d.ts +8 -0
- package/http/src/http.service.d.ts +23 -0
- package/index.d.ts +5 -0
- package/package.json +106 -23
- package/pipes/index.d.ts +5 -0
- package/pipes/public-api.d.ts +2 -0
- package/pipes/src/pipes.module.d.ts +8 -0
- package/pipes/src/safe.pipe.d.ts +10 -0
- package/platform/index.d.ts +5 -0
- package/platform/public-api.d.ts +1 -0
- package/platform/src/platform.service.d.ts +25 -0
- package/public-api.d.ts +1 -0
- package/translation/index.d.ts +5 -0
- package/translation/{public-api.ts → public-api.d.ts} +1 -1
- package/translation/src/translation.module.d.ts +7 -0
- package/translation/src/translator.d.ts +11 -0
- package/translation/src/translator.pipe.d.ts +7 -0
- package/utils/index.d.ts +5 -0
- package/utils/{public-api.ts → public-api.d.ts} +1 -1
- package/utils/src/color-util.d.ts +20 -0
- package/utils/src/drawing-util.d.ts +17 -0
- package/utils/src/object-util.d.ts +4 -0
- package/utils/src/string-util.d.ts +6 -0
- package/.browserslistrc +0 -16
- package/config/ax-preset.js +0 -186
- package/config/index.ts +0 -1
- package/config/ng-package.json +0 -6
- package/config/public-api.ts +0 -1
- package/config/src/configs.ts +0 -37
- package/dateTime/index.ts +0 -1
- package/dateTime/ng-package.json +0 -6
- package/dateTime/src/datetime.class.ts +0 -452
- package/dateTime/src/datetime.module.ts +0 -29
- package/dateTime/src/datetime.pipe.ts +0 -21
- package/dateTime/src/georgian.calendar.ts +0 -205
- package/dateTime/src/jalali.calendar.ts +0 -416
- package/events/index.ts +0 -1
- package/events/ng-package.json +0 -6
- package/events/public-api.ts +0 -1
- package/events/src/event.service.ts +0 -31
- package/http/index.ts +0 -1
- package/http/ng-package.json +0 -6
- package/http/src/http-result.class.ts +0 -34
- package/http/src/http.module.ts +0 -25
- package/http/src/http.service.ts +0 -161
- package/index.ts +0 -1
- package/karma.conf.js +0 -44
- package/ng-package.json +0 -7
- package/pipes/index.ts +0 -1
- package/pipes/ng-package.json +0 -6
- package/pipes/public-api.ts +0 -2
- package/pipes/src/pipes.module.ts +0 -11
- package/pipes/src/safe.pipe.ts +0 -24
- package/platform/index.ts +0 -1
- package/platform/ng-package.json +0 -6
- package/platform/public-api.ts +0 -1
- package/platform/src/platform.service.ts +0 -207
- package/public-api.ts +0 -4
- package/test.ts +0 -27
- package/translation/index.ts +0 -1
- package/translation/ng-package.json +0 -6
- package/translation/src/translation.module.ts +0 -12
- package/translation/src/translator.pipe.ts +0 -9
- package/translation/src/translator.ts +0 -49
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -17
- package/utils/index.ts +0 -1
- package/utils/ng-package.json +0 -6
- package/utils/src/color-util.ts +0 -83
- package/utils/src/drawing-util.ts +0 -43
- package/utils/src/object-util.ts +0 -82
- package/utils/src/string-util.ts +0 -25
package/karma.conf.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Karma configuration file, see link for more information
|
|
2
|
-
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
|
3
|
-
|
|
4
|
-
module.exports = function (config) {
|
|
5
|
-
config.set({
|
|
6
|
-
basePath: '',
|
|
7
|
-
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
|
8
|
-
plugins: [
|
|
9
|
-
require('karma-jasmine'),
|
|
10
|
-
require('karma-chrome-launcher'),
|
|
11
|
-
require('karma-jasmine-html-reporter'),
|
|
12
|
-
require('karma-coverage'),
|
|
13
|
-
require('@angular-devkit/build-angular/plugins/karma')
|
|
14
|
-
],
|
|
15
|
-
client: {
|
|
16
|
-
jasmine: {
|
|
17
|
-
// you can add configuration options for Jasmine here
|
|
18
|
-
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
|
19
|
-
// for example, you can disable the random execution with `random: false`
|
|
20
|
-
// or set a specific seed with `seed: 4321`
|
|
21
|
-
},
|
|
22
|
-
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
|
23
|
-
},
|
|
24
|
-
jasmineHtmlReporter: {
|
|
25
|
-
suppressAll: true // removes the duplicated traces
|
|
26
|
-
},
|
|
27
|
-
coverageReporter: {
|
|
28
|
-
dir: require('path').join(__dirname, '../../../coverage/acorex/core'),
|
|
29
|
-
subdir: '.',
|
|
30
|
-
reporters: [
|
|
31
|
-
{ type: 'html' },
|
|
32
|
-
{ type: 'text-summary' }
|
|
33
|
-
]
|
|
34
|
-
},
|
|
35
|
-
reporters: ['progress', 'kjhtml'],
|
|
36
|
-
port: 9876,
|
|
37
|
-
colors: true,
|
|
38
|
-
logLevel: config.LOG_INFO,
|
|
39
|
-
autoWatch: true,
|
|
40
|
-
browsers: ['Chrome'],
|
|
41
|
-
singleRun: false,
|
|
42
|
-
restartOnFileChange: true
|
|
43
|
-
});
|
|
44
|
-
};
|
package/ng-package.json
DELETED
package/pipes/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './public-api'
|
package/pipes/ng-package.json
DELETED
package/pipes/public-api.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { AXSafePipe } from './safe.pipe';
|
|
4
|
-
|
|
5
|
-
@NgModule({
|
|
6
|
-
declarations: [AXSafePipe],
|
|
7
|
-
imports: [CommonModule],
|
|
8
|
-
exports: [AXSafePipe],
|
|
9
|
-
providers: [],
|
|
10
|
-
})
|
|
11
|
-
export class AXPipesModule {}
|
package/pipes/src/safe.pipe.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
import { DomSanitizer, SafeHtml, SafeStyle, SafeScript, SafeUrl, SafeResourceUrl } from '@angular/platform-browser';
|
|
3
|
-
|
|
4
|
-
@Pipe({
|
|
5
|
-
name: 'safe',
|
|
6
|
-
pure: true
|
|
7
|
-
})
|
|
8
|
-
export class AXSafePipe implements PipeTransform {
|
|
9
|
-
|
|
10
|
-
constructor(protected sanitizer: DomSanitizer) { }
|
|
11
|
-
|
|
12
|
-
public transform(value: any, type: string): SafeHtml | SafeStyle | SafeScript | SafeUrl | SafeResourceUrl {
|
|
13
|
-
if (value == null || value == undefined || value == '')
|
|
14
|
-
return '';
|
|
15
|
-
switch (type) {
|
|
16
|
-
case 'html': return this.sanitizer.bypassSecurityTrustHtml(value);
|
|
17
|
-
case 'style': return this.sanitizer.bypassSecurityTrustStyle(value);
|
|
18
|
-
case 'script': return this.sanitizer.bypassSecurityTrustScript(value);
|
|
19
|
-
case 'url': return this.sanitizer.bypassSecurityTrustUrl(value);
|
|
20
|
-
case 'resourceUrl': return this.sanitizer.bypassSecurityTrustResourceUrl(value);
|
|
21
|
-
default: throw new Error(`Invalid safe type specified: ${type}`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
package/platform/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './public-api'
|
package/platform/ng-package.json
DELETED
package/platform/public-api.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './src/platform.service';
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { fromEvent, Subject } from 'rxjs';
|
|
3
|
-
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
4
|
-
|
|
5
|
-
export type AXPlatforms = 'Android' | 'Desktop' | 'iOS' | 'Mobile';
|
|
6
|
-
export type AXBrowsers =
|
|
7
|
-
| 'Chrome'
|
|
8
|
-
| 'Safari'
|
|
9
|
-
| 'Edge'
|
|
10
|
-
| 'Firefox'
|
|
11
|
-
| 'Opera'
|
|
12
|
-
| 'MSIE';
|
|
13
|
-
export type AXTechnologies = 'PWA' | 'Hybrid' | 'Electron';
|
|
14
|
-
|
|
15
|
-
const isChrome = (win: Window): boolean => testUserAgent(win, /Chrome/i);
|
|
16
|
-
|
|
17
|
-
const isFirefox = (win: Window): boolean => testUserAgent(win, /Firefox/i);
|
|
18
|
-
|
|
19
|
-
const isEdge = (win: Window): boolean => testUserAgent(win, /Edge/i);
|
|
20
|
-
|
|
21
|
-
const isSafari = (win: Window): boolean => testUserAgent(win, /Safari/i);
|
|
22
|
-
|
|
23
|
-
const isOpera = (win: Window): boolean =>
|
|
24
|
-
testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);
|
|
25
|
-
|
|
26
|
-
const isMSIE = (win: Window): boolean =>
|
|
27
|
-
testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);
|
|
28
|
-
|
|
29
|
-
const isMobileWeb = (win: Window): boolean => isMobile(win) && !isHybrid(win);
|
|
30
|
-
|
|
31
|
-
const isIpad = (win: Window) => {
|
|
32
|
-
// iOS 12 and below
|
|
33
|
-
if (testUserAgent(win, /iPad/i)) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// iOS 13+
|
|
38
|
-
if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return false;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const isIphone = (win: Window) => testUserAgent(win, /iPhone/i);
|
|
46
|
-
|
|
47
|
-
const isIOS = (win: Window) =>
|
|
48
|
-
testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
|
|
49
|
-
|
|
50
|
-
const isAndroid = (win: Window) => testUserAgent(win, /android|sink/i);
|
|
51
|
-
|
|
52
|
-
const isAndroidTablet = (win: Window) => {
|
|
53
|
-
return isAndroid(win) && !testUserAgent(win, /mobile/i);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const isPhablet = (win: Window) => {
|
|
57
|
-
const width = win.innerWidth;
|
|
58
|
-
const height = win.innerHeight;
|
|
59
|
-
const smallest = Math.min(width, height);
|
|
60
|
-
const largest = Math.max(width, height);
|
|
61
|
-
|
|
62
|
-
return smallest > 390 && smallest < 520 && largest > 620 && largest < 800;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const isTablet = (win: Window) => {
|
|
66
|
-
const width = win.innerWidth;
|
|
67
|
-
const height = win.innerHeight;
|
|
68
|
-
const smallest = Math.min(width, height);
|
|
69
|
-
const largest = Math.max(width, height);
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
isIpad(win) ||
|
|
73
|
-
isAndroidTablet(win) ||
|
|
74
|
-
(smallest > 460 && smallest < 820 && largest > 780 && largest < 1400)
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const isMobile = (win: Window) => matchMedia(win, '(any-pointer:coarse)');
|
|
79
|
-
|
|
80
|
-
const isDesktop = (win: Window) => !isMobile(win);
|
|
81
|
-
|
|
82
|
-
const isHybrid = (win: Window) => isCordova(win) || isCapacitorNative(win);
|
|
83
|
-
|
|
84
|
-
const isCordova = (win: any): boolean =>
|
|
85
|
-
!!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
|
|
86
|
-
|
|
87
|
-
const isCapacitorNative = (win: any): boolean => {
|
|
88
|
-
const capacitor = win['Capacitor'];
|
|
89
|
-
return !!(capacitor && capacitor.isNative);
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const isElectron = (win: Window): boolean => testUserAgent(win, /electron/i);
|
|
93
|
-
|
|
94
|
-
const isPWA = (win: Window): boolean =>
|
|
95
|
-
!!(
|
|
96
|
-
win.matchMedia('(display-mode: standalone)').matches ||
|
|
97
|
-
(win.navigator as any).standalone
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
export const testUserAgent = (win: Window, expr: RegExp) =>
|
|
101
|
-
expr.test(win.navigator.userAgent);
|
|
102
|
-
|
|
103
|
-
const matchMedia = (win: Window, query: string): boolean =>
|
|
104
|
-
win.matchMedia(query).matches;
|
|
105
|
-
|
|
106
|
-
const PLATFORMS_MAP: any = {
|
|
107
|
-
Android: isAndroid,
|
|
108
|
-
iOS: isIOS,
|
|
109
|
-
Desktop: isDesktop,
|
|
110
|
-
Mobile: isMobile,
|
|
111
|
-
Chrome: isChrome,
|
|
112
|
-
Firefox: isFirefox,
|
|
113
|
-
Safari: isSafari,
|
|
114
|
-
Edge: isEdge,
|
|
115
|
-
Opera: isOpera,
|
|
116
|
-
Hybrid: isHybrid,
|
|
117
|
-
PWA: isPWA,
|
|
118
|
-
Electron: isElectron,
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export class AXPlatformEvent {
|
|
122
|
-
nativeEvent!: UIEvent | Event;
|
|
123
|
-
source!: AXPlatform;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
@Injectable({
|
|
127
|
-
providedIn: 'platform',
|
|
128
|
-
})
|
|
129
|
-
export class AXPlatform {
|
|
130
|
-
resize: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();
|
|
131
|
-
click: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();
|
|
132
|
-
scroll: Subject<AXPlatformEvent> = new Subject<AXPlatformEvent>();
|
|
133
|
-
|
|
134
|
-
isRtl(): boolean {
|
|
135
|
-
return (
|
|
136
|
-
document.dir == 'rtl' ||
|
|
137
|
-
document.body.dir == 'rtl' ||
|
|
138
|
-
document.body.style.direction == 'rtl'
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
isLandscape(): boolean {
|
|
143
|
-
return window.innerHeight < window.innerWidth;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
isPortrate(): boolean {
|
|
147
|
-
return !this.isLandscape();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
is(name: AXPlatforms | AXBrowsers | AXTechnologies): boolean {
|
|
151
|
-
return PLATFORMS_MAP[name](window) || false;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
switchDarkMode() {
|
|
155
|
-
const _html = document.getElementsByTagName('html')[0];
|
|
156
|
-
_html.classList.add('ax-dark');
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
switchLightMode() {
|
|
160
|
-
const _html = document.getElementsByTagName('html')[0];
|
|
161
|
-
_html.classList.remove('ax-dark');
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
private _setFullHeightRatio() {
|
|
165
|
-
document
|
|
166
|
-
.querySelector<HTMLElement>(':root')
|
|
167
|
-
?.style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
constructor() {
|
|
171
|
-
fromEvent<UIEvent>(window, 'resize')
|
|
172
|
-
.pipe(debounceTime(100))
|
|
173
|
-
.pipe(distinctUntilChanged())
|
|
174
|
-
.subscribe((e) => {
|
|
175
|
-
this.resize.next({
|
|
176
|
-
nativeEvent: e,
|
|
177
|
-
source: this,
|
|
178
|
-
});
|
|
179
|
-
//
|
|
180
|
-
this._setFullHeightRatio();
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
document.addEventListener(
|
|
184
|
-
'click',
|
|
185
|
-
(e) => {
|
|
186
|
-
this.click.next({
|
|
187
|
-
nativeEvent: e,
|
|
188
|
-
source: this,
|
|
189
|
-
});
|
|
190
|
-
},
|
|
191
|
-
true
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
document.addEventListener(
|
|
195
|
-
'scroll',
|
|
196
|
-
(e) => {
|
|
197
|
-
this.scroll.next({
|
|
198
|
-
nativeEvent: e,
|
|
199
|
-
source: this,
|
|
200
|
-
});
|
|
201
|
-
},
|
|
202
|
-
true
|
|
203
|
-
);
|
|
204
|
-
// init functions
|
|
205
|
-
this._setFullHeightRatio();
|
|
206
|
-
}
|
|
207
|
-
}
|
package/public-api.ts
DELETED
package/test.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
<T>(id: string): T;
|
|
14
|
-
keys(): string[];
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// First, initialize the Angular testing environment.
|
|
19
|
-
getTestBed().initTestEnvironment(
|
|
20
|
-
BrowserDynamicTestingModule,
|
|
21
|
-
platformBrowserDynamicTesting(),
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
// Then we find all the tests.
|
|
25
|
-
const context = require.context('./', true, /\.spec\.ts$/);
|
|
26
|
-
// And load the modules.
|
|
27
|
-
context.keys().forEach(context);
|
package/translation/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './public-api'
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { AXTranslatorPipe } from './translator.pipe';
|
|
3
|
-
|
|
4
|
-
@NgModule({
|
|
5
|
-
imports: [],
|
|
6
|
-
exports: [AXTranslatorPipe],
|
|
7
|
-
declarations: [AXTranslatorPipe],
|
|
8
|
-
providers: [],
|
|
9
|
-
})
|
|
10
|
-
export class AXTranslationModule {
|
|
11
|
-
|
|
12
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
-
import { AXTranslator } from './translator';
|
|
3
|
-
|
|
4
|
-
@Pipe({ name: 'trans', pure: true })
|
|
5
|
-
export class AXTranslatorPipe implements PipeTransform {
|
|
6
|
-
transform(value: string, arg1?: object | string, arg2?: object): string {
|
|
7
|
-
return AXTranslator.get(value, arg1, arg2);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Subject, Observable } from 'rxjs';
|
|
2
|
-
import merge from 'lodash-es/merge';
|
|
3
|
-
import * as _ from 'lodash';
|
|
4
|
-
|
|
5
|
-
// @dynamic
|
|
6
|
-
export class AXTranslator {
|
|
7
|
-
private static lang: string = 'en';
|
|
8
|
-
private static dataChangeSubject = new Subject<any>();
|
|
9
|
-
private static _varsRegx = /((\$\{[a-zA-Z_0-9\.]+\})+)/gm;
|
|
10
|
-
private static _varNameRegx = /[a-zA-Z_0-9\.]+/gm;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
static get onChange(): Observable<any> {
|
|
14
|
-
return AXTranslator.dataChangeSubject.asObservable();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
public static load(lang: string, value: any) {
|
|
18
|
-
if (typeof value === 'object') {
|
|
19
|
-
if (!AXTranslator[`__data__${lang}`]) {
|
|
20
|
-
AXTranslator[`__data__${lang}`] = {};
|
|
21
|
-
}
|
|
22
|
-
AXTranslator[`__data__${lang}`] = merge(AXTranslator[`__data__${lang}`], value);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public static use(lang: string) {
|
|
27
|
-
AXTranslator.lang = lang;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public static get(key: string, arg1?: object | string, arg2?: object): string {
|
|
31
|
-
|
|
32
|
-
const lang = arg1 && typeof arg1 == 'string' ? arg1 : AXTranslator.lang;
|
|
33
|
-
const params = arg1 && typeof arg1 == 'object' ? arg1 : arg2;
|
|
34
|
-
let result = _.get(AXTranslator[`__data__${lang}`], key, key);
|
|
35
|
-
const vars = typeof (result) == 'string' ? result?.match(this._varsRegx) : [];
|
|
36
|
-
if (vars?.length) {
|
|
37
|
-
vars.forEach((v:any) => {
|
|
38
|
-
const varKey = v.match(this._varNameRegx)?.length ? v.match(this._varNameRegx)[0] : null;
|
|
39
|
-
if (varKey) {
|
|
40
|
-
const p = _.get(params, varKey) || this.get(varKey, lang);
|
|
41
|
-
if (p) {
|
|
42
|
-
result = result.replace(v, p);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
return typeof (result) == 'string' ? result : JSON.stringify(result);
|
|
48
|
-
}
|
|
49
|
-
}
|
package/tsconfig.lib.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../../out-tsc/lib",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"inlineSources": true,
|
|
9
|
-
"types": []
|
|
10
|
-
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
"src/test.ts",
|
|
13
|
-
"**/*.spec.ts"
|
|
14
|
-
]
|
|
15
|
-
}
|
package/tsconfig.lib.prod.json
DELETED
package/tsconfig.spec.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
2
|
-
{
|
|
3
|
-
"extends": "../../../tsconfig.json",
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../../out-tsc/spec",
|
|
6
|
-
"types": [
|
|
7
|
-
"jasmine"
|
|
8
|
-
]
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"src/test.ts"
|
|
12
|
-
],
|
|
13
|
-
"include": [
|
|
14
|
-
"**/*.spec.ts",
|
|
15
|
-
"**/*.d.ts"
|
|
16
|
-
]
|
|
17
|
-
}
|
package/utils/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './public-api';
|
package/utils/ng-package.json
DELETED
package/utils/src/color-util.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
export type AXColorMode = 'rgba' | 'hex' | 'hsla' | 'hsva';
|
|
2
|
-
|
|
3
|
-
import tinycolor, { ColorInput } from 'tinycolor2';
|
|
4
|
-
import tinygradient from 'tinygradient'
|
|
5
|
-
|
|
6
|
-
export type AXColorFormat = ColorInput;
|
|
7
|
-
|
|
8
|
-
export class AXColorUtil {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
static to(color: AXColorFormat, mode: AXColorMode): AXColorFormat {
|
|
12
|
-
const _color = tinycolor(color)
|
|
13
|
-
switch (mode) {
|
|
14
|
-
case 'rgba': ;
|
|
15
|
-
return _color.toRgb();
|
|
16
|
-
case 'hsla':
|
|
17
|
-
return _color.toHsl();
|
|
18
|
-
case 'hsva':
|
|
19
|
-
return _color.toHsv();
|
|
20
|
-
default:
|
|
21
|
-
return _color.toHex();
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
static toString(color: AXColorFormat, mode: AXColorMode): string {
|
|
26
|
-
const _color = tinycolor(color)
|
|
27
|
-
switch (mode) {
|
|
28
|
-
case 'rgba':
|
|
29
|
-
return _color.toRgbString();
|
|
30
|
-
case 'hsla':
|
|
31
|
-
return _color.toHslString();
|
|
32
|
-
case 'hsva':
|
|
33
|
-
return _color.toHsvString();
|
|
34
|
-
default:
|
|
35
|
-
return _color.toHexString();
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
static mix(baseColor: AXColorFormat, hex: AXColorFormat, percentage: number): string {
|
|
40
|
-
return tinycolor.mix(baseColor, hex, percentage).toString('rgb');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
static multiply(color1: AXColorFormat, color2: AXColorFormat): string {
|
|
44
|
-
let rgb1 = tinycolor(color1).toRgb();
|
|
45
|
-
let rgb2 = tinycolor(color2).toRgb();
|
|
46
|
-
rgb1.b = Math.floor(rgb1.b * rgb2.b / 255);
|
|
47
|
-
rgb1.g = Math.floor(rgb1.g * rgb2.g / 255);
|
|
48
|
-
rgb1.r = Math.floor(rgb1.r * rgb2.r / 255);
|
|
49
|
-
return tinycolor('rgb ' + rgb1.r + ' ' + rgb1.g + ' ' + rgb1.b).toString('rgb');
|
|
50
|
-
}
|
|
51
|
-
static toHexSting(color: string): string {
|
|
52
|
-
const _color = tinycolor(color)
|
|
53
|
-
return _color.toHexString()
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
static toRGBString(color: AXColorFormat): string {
|
|
57
|
-
const _color = tinycolor(color)
|
|
58
|
-
return _color.toRgbString()
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
static contrastToWhite(color: AXColorFormat): number {
|
|
62
|
-
return tinycolor.readability("#fff", color);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
static lighten(hex: AXColorFormat, percentage?: number) {
|
|
67
|
-
return tinycolor(hex).lighten(percentage)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
static darken(hex: AXColorFormat, percentage?: number) {
|
|
71
|
-
return tinycolor(hex).darken(percentage)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static equal(color1: AXColorFormat, color2: AXColorFormat): boolean {
|
|
75
|
-
return tinycolor.equals(color1, color2);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
static gradient(values: any[] | { color: any, pos: number }[]): tinygradient.Instance {
|
|
80
|
-
return tinygradient([...values])
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export interface AXPoint {
|
|
2
|
-
x: number;
|
|
3
|
-
y: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface AXBoundingClientRect {
|
|
7
|
-
left?: number;
|
|
8
|
-
top?: number;
|
|
9
|
-
width?: number;
|
|
10
|
-
height?: number;
|
|
11
|
-
bottom?: number;
|
|
12
|
-
right?: number;
|
|
13
|
-
}
|
|
14
|
-
// @dynamic
|
|
15
|
-
export class AXDrawingUtil {
|
|
16
|
-
static collision(a: HTMLElement, b: HTMLElement): boolean {
|
|
17
|
-
const ac = a.getBoundingClientRect();
|
|
18
|
-
const bc = b.getBoundingClientRect();
|
|
19
|
-
|
|
20
|
-
if (ac.left < bc.left + bc.width && ac.left + ac.width > bc.left &&
|
|
21
|
-
ac.top < bc.top + bc.height && ac.top + ac.height > bc.top) {
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static isInElementBound(pos: AXPoint, element: HTMLElement): boolean {
|
|
30
|
-
const elBound = element.getBoundingClientRect();
|
|
31
|
-
return AXDrawingUtil.isInRecPoint(pos, {
|
|
32
|
-
left: elBound.x,
|
|
33
|
-
width: elBound.width,
|
|
34
|
-
top: elBound.y,
|
|
35
|
-
height: elBound.height
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
static isInRecPoint(pos: AXPoint, rec: AXBoundingClientRect | any): boolean {
|
|
40
|
-
return pos.x >= rec.left && pos.x <= (rec.left + rec.width) && pos.y >= rec.top && (pos.y <= (rec.top + rec.height));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}
|