@acorex/core 6.5.29 → 6.5.31
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 +3 -3
- package/acorex-core.d.ts +5 -5
- package/esm2020/acorex-core.mjs +4 -4
- package/esm2020/lib/classes/base-page.class.mjs +28 -28
- package/esm2020/lib/classes/color.class.mjs +49 -49
- package/esm2020/lib/classes/datetime.class.mjs +314 -314
- package/esm2020/lib/classes/menu.class.mjs +27 -27
- package/esm2020/lib/classes/navigator.class.mjs +2 -2
- package/esm2020/lib/classes/popup.class.mjs +2 -2
- package/esm2020/lib/classes/promise.class.mjs +19 -19
- package/esm2020/lib/classes/sectionlist.class.mjs +2 -2
- package/esm2020/lib/classes/select.class.mjs +3 -3
- package/esm2020/lib/core.module.mjs +27 -27
- package/esm2020/lib/error/error.class.mjs +2 -2
- package/esm2020/lib/error/error.module.mjs +19 -19
- package/esm2020/lib/error/error.service.mjs +21 -21
- package/esm2020/lib/events/keyboard.mjs +2 -2
- package/esm2020/lib/http/http-error.class.mjs +2 -2
- package/esm2020/lib/http/http-events.interceptor.mjs +3 -3
- package/esm2020/lib/http/http-request.class.mjs +2 -2
- package/esm2020/lib/http/http-result.class.mjs +21 -21
- package/esm2020/lib/http/http.module.mjs +37 -37
- package/esm2020/lib/http/http.service.mjs +145 -145
- package/esm2020/lib/locale/en.json +255 -255
- package/esm2020/lib/locale/fa.json +245 -245
- package/esm2020/lib/pipe/datetime.pipe.mjs +25 -25
- package/esm2020/lib/pipe/htmlToText.pipe.mjs +25 -25
- package/esm2020/lib/platform/index.mjs +1 -1
- package/esm2020/lib/platform/platform.service.mjs +150 -150
- package/esm2020/lib/services/config.mjs +29 -29
- package/esm2020/lib/services/event.service.mjs +36 -36
- package/esm2020/lib/services/navigator.service.mjs +10 -10
- package/esm2020/lib/services/storage.service.mjs +16 -16
- package/esm2020/lib/translator/translator.mjs +26 -26
- package/esm2020/lib/translator/translator.module.mjs +25 -25
- package/esm2020/lib/translator/translator.pipe.mjs +24 -24
- package/esm2020/lib/translator/translator.service.mjs +21 -21
- package/esm2020/lib/utils/array/array-util.mjs +133 -133
- package/esm2020/lib/utils/html/html-util.mjs +192 -192
- package/esm2020/lib/utils/html/html.module.mjs +19 -19
- package/esm2020/lib/utils/math/math-util.mjs +6 -6
- package/esm2020/lib/utils/object/object-util.mjs +83 -83
- package/esm2020/lib/utils/render/on-demand-preload-strategy.service.mjs +20 -20
- package/esm2020/lib/utils/render/render.service.mjs +103 -103
- package/esm2020/lib/utils/render/rendering.module.mjs +35 -35
- package/esm2020/lib/utils/scroll/scroll.directive.mjs +54 -54
- package/esm2020/lib/utils/scroll/scroll.module.mjs +19 -19
- package/esm2020/lib/utils/separator/separator.module.mjs +19 -19
- package/esm2020/lib/utils/separator/separator.pipe.mjs +33 -33
- package/esm2020/public-api.mjs +44 -44
- package/fesm2015/acorex-core.mjs +2162 -2162
- package/fesm2015/acorex-core.mjs.map +1 -1
- package/fesm2020/acorex-core.mjs +1651 -1651
- package/fesm2020/acorex-core.mjs.map +1 -1
- package/lib/classes/base-page.class.d.ts +13 -13
- package/lib/classes/color.class.d.ts +17 -17
- package/lib/classes/datetime.class.d.ts +63 -63
- package/lib/classes/menu.class.d.ts +34 -34
- package/lib/classes/navigator.class.d.ts +5 -5
- package/lib/classes/popup.class.d.ts +12 -12
- package/lib/classes/promise.class.d.ts +7 -7
- package/lib/classes/sectionlist.class.d.ts +8 -8
- package/lib/classes/select.class.d.ts +7 -7
- package/lib/core.module.d.ts +9 -9
- package/lib/error/error.class.d.ts +4 -4
- package/lib/error/error.module.d.ts +7 -7
- package/lib/error/error.service.d.ts +13 -13
- package/lib/events/keyboard.d.ts +2 -2
- package/lib/http/http-error.class.d.ts +7 -7
- package/lib/http/http-events.interceptor.d.ts +10 -10
- package/lib/http/http-request.class.d.ts +14 -14
- package/lib/http/http-result.class.d.ts +11 -11
- package/lib/http/http.module.d.ts +10 -10
- package/lib/http/http.service.d.ts +23 -23
- package/lib/pipe/datetime.pipe.d.ts +8 -8
- package/lib/pipe/htmlToText.pipe.d.ts +7 -7
- package/lib/platform/index.d.ts +1 -1
- package/lib/platform/platform.service.d.ts +26 -26
- package/lib/services/config.d.ts +9 -9
- package/lib/services/event.service.d.ts +9 -9
- package/lib/services/navigator.service.d.ts +8 -8
- package/lib/services/storage.service.d.ts +7 -7
- package/lib/translator/translator.d.ts +9 -9
- package/lib/translator/translator.module.d.ts +8 -8
- package/lib/translator/translator.pipe.d.ts +8 -8
- package/lib/translator/translator.service.d.ts +8 -8
- package/lib/utils/array/array-util.d.ts +6 -6
- package/lib/utils/html/html-util.d.ts +62 -62
- package/lib/utils/html/html.module.d.ts +8 -8
- package/lib/utils/math/math-util.d.ts +3 -3
- package/lib/utils/object/object-util.d.ts +7 -7
- package/lib/utils/render/on-demand-preload-strategy.service.d.ts +10 -10
- package/lib/utils/render/render.service.d.ts +18 -18
- package/lib/utils/render/rendering.module.d.ts +8 -8
- package/lib/utils/scroll/scroll.directive.d.ts +18 -18
- package/lib/utils/scroll/scroll.module.d.ts +8 -8
- package/lib/utils/separator/separator.module.d.ts +8 -8
- package/lib/utils/separator/separator.pipe.d.ts +8 -8
- package/package.json +1 -1
- package/public-api.d.ts +43 -43
package/fesm2020/acorex-core.mjs
CHANGED
|
@@ -9,1087 +9,1087 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
|
|
|
9
9
|
import merge from 'lodash-es/merge';
|
|
10
10
|
import * as i1$1 from '@angular/router';
|
|
11
11
|
|
|
12
|
-
class AXColorUtil {
|
|
13
|
-
static hex2Rgb(hexColor) {
|
|
14
|
-
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexColor);
|
|
15
|
-
return result ? {
|
|
16
|
-
r: parseInt(result[1], 16),
|
|
17
|
-
g: parseInt(result[2], 16),
|
|
18
|
-
b: parseInt(result[3], 16)
|
|
19
|
-
} : null;
|
|
20
|
-
}
|
|
21
|
-
static rgb2Hex(r, g, b, a = 255) {
|
|
22
|
-
let alpha;
|
|
23
|
-
let hex = (r | 1 << 8).toString(16).slice(1) +
|
|
24
|
-
(g | 1 << 8).toString(16).slice(1) +
|
|
25
|
-
(b | 1 << 8).toString(16).slice(1);
|
|
26
|
-
if (a !== 255) {
|
|
27
|
-
alpha = a;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
alpha = 1;
|
|
31
|
-
}
|
|
32
|
-
alpha = Math.round(alpha * 100) / 100;
|
|
33
|
-
alpha = Math.round(alpha * 255);
|
|
34
|
-
const hexAlpha = (alpha + 0x10000).toString(16).substr(-2).toUpperCase();
|
|
35
|
-
return '#' + hex + (alpha == 255 ? '' : hexAlpha);
|
|
36
|
-
}
|
|
37
|
-
;
|
|
38
|
-
static illuminance(hexColor) {
|
|
39
|
-
const rgbColor = AXColorUtil.hex2Rgb(hexColor);
|
|
40
|
-
if (!rgbColor) {
|
|
41
|
-
return -1;
|
|
42
|
-
}
|
|
43
|
-
const r = rgbColor.r;
|
|
44
|
-
const g = rgbColor.g;
|
|
45
|
-
const b = rgbColor.b;
|
|
46
|
-
const a = [r, g, b].map(v => {
|
|
47
|
-
v /= 255;
|
|
48
|
-
return (v <= 0.03928) ?
|
|
49
|
-
v / 12.92 :
|
|
50
|
-
Math.pow(((v + 0.055) / 1.055), 2.4);
|
|
51
|
-
});
|
|
52
|
-
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
|
53
|
-
}
|
|
54
|
-
static contrastToWhite(hexColor) {
|
|
55
|
-
const whiteIlluminance = 1;
|
|
56
|
-
const illuminance = AXColorUtil.illuminance(hexColor);
|
|
57
|
-
return whiteIlluminance / illuminance;
|
|
58
|
-
}
|
|
12
|
+
class AXColorUtil {
|
|
13
|
+
static hex2Rgb(hexColor) {
|
|
14
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexColor);
|
|
15
|
+
return result ? {
|
|
16
|
+
r: parseInt(result[1], 16),
|
|
17
|
+
g: parseInt(result[2], 16),
|
|
18
|
+
b: parseInt(result[3], 16)
|
|
19
|
+
} : null;
|
|
20
|
+
}
|
|
21
|
+
static rgb2Hex(r, g, b, a = 255) {
|
|
22
|
+
let alpha;
|
|
23
|
+
let hex = (r | 1 << 8).toString(16).slice(1) +
|
|
24
|
+
(g | 1 << 8).toString(16).slice(1) +
|
|
25
|
+
(b | 1 << 8).toString(16).slice(1);
|
|
26
|
+
if (a !== 255) {
|
|
27
|
+
alpha = a;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
alpha = 1;
|
|
31
|
+
}
|
|
32
|
+
alpha = Math.round(alpha * 100) / 100;
|
|
33
|
+
alpha = Math.round(alpha * 255);
|
|
34
|
+
const hexAlpha = (alpha + 0x10000).toString(16).substr(-2).toUpperCase();
|
|
35
|
+
return '#' + hex + (alpha == 255 ? '' : hexAlpha);
|
|
36
|
+
}
|
|
37
|
+
;
|
|
38
|
+
static illuminance(hexColor) {
|
|
39
|
+
const rgbColor = AXColorUtil.hex2Rgb(hexColor);
|
|
40
|
+
if (!rgbColor) {
|
|
41
|
+
return -1;
|
|
42
|
+
}
|
|
43
|
+
const r = rgbColor.r;
|
|
44
|
+
const g = rgbColor.g;
|
|
45
|
+
const b = rgbColor.b;
|
|
46
|
+
const a = [r, g, b].map(v => {
|
|
47
|
+
v /= 255;
|
|
48
|
+
return (v <= 0.03928) ?
|
|
49
|
+
v / 12.92 :
|
|
50
|
+
Math.pow(((v + 0.055) / 1.055), 2.4);
|
|
51
|
+
});
|
|
52
|
+
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
|
53
|
+
}
|
|
54
|
+
static contrastToWhite(hexColor) {
|
|
55
|
+
const whiteIlluminance = 1;
|
|
56
|
+
const illuminance = AXColorUtil.illuminance(hexColor);
|
|
57
|
+
return whiteIlluminance / illuminance;
|
|
58
|
+
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
// @dynamic
|
|
62
|
-
class AXObjectUtil {
|
|
63
|
-
static deepJSONClone(obj) {
|
|
64
|
-
return obj ? JSON.parse(JSON.stringify(obj)) : null;
|
|
65
|
-
}
|
|
66
|
-
static deepCopy(obj) {
|
|
67
|
-
let copy;
|
|
68
|
-
// Handle the 3 simple types, and null or undefined
|
|
69
|
-
if (null == obj || 'object' !== typeof obj) {
|
|
70
|
-
return obj;
|
|
71
|
-
}
|
|
72
|
-
// Handle Date
|
|
73
|
-
if (obj instanceof Date) {
|
|
74
|
-
copy = new Date();
|
|
75
|
-
copy.setTime(obj.getTime());
|
|
76
|
-
return copy;
|
|
77
|
-
}
|
|
78
|
-
// Handle Array
|
|
79
|
-
if (obj instanceof Array) {
|
|
80
|
-
copy = [];
|
|
81
|
-
for (let i = 0, len = obj.length; i < len; i++) {
|
|
82
|
-
copy[i] = AXObjectUtil.deepCopy(obj[i]);
|
|
83
|
-
}
|
|
84
|
-
return copy;
|
|
85
|
-
}
|
|
86
|
-
// Handle Object
|
|
87
|
-
if (obj instanceof Object) {
|
|
88
|
-
copy = {};
|
|
89
|
-
for (const attr in obj) {
|
|
90
|
-
if (obj.hasOwnProperty(attr)) {
|
|
91
|
-
copy[attr] = AXObjectUtil.deepCopy(obj[attr]);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return copy;
|
|
95
|
-
}
|
|
96
|
-
throw new Error('Unable to copy obj! Its type isn\'t supported.');
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function AXFetchProp(obj, prop) {
|
|
100
|
-
if (typeof obj === 'undefined') {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
const index = prop.indexOf('.');
|
|
104
|
-
if (index > -1) {
|
|
105
|
-
return AXFetchProp(obj[prop.substring(0, index)], prop.substr(index + 1));
|
|
106
|
-
}
|
|
107
|
-
return obj[prop];
|
|
108
|
-
}
|
|
109
|
-
function getPropByPath(obj, path, defaultVal) {
|
|
110
|
-
path = path
|
|
111
|
-
.replace(/\[/g, '.')
|
|
112
|
-
.replace(/]/g, '')
|
|
113
|
-
.split('.');
|
|
114
|
-
path.forEach((level) => {
|
|
115
|
-
if (obj) {
|
|
116
|
-
obj = obj[level];
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
if (obj === undefined) {
|
|
120
|
-
return defaultVal;
|
|
121
|
-
}
|
|
122
|
-
return obj;
|
|
123
|
-
}
|
|
124
|
-
function setPropByPath(obj, path, value) {
|
|
125
|
-
if (Object(obj) !== obj) {
|
|
126
|
-
return obj;
|
|
127
|
-
} // When obj is not an object
|
|
128
|
-
// If not yet an array, get the keys from the string-path
|
|
129
|
-
if (!Array.isArray(path)) {
|
|
130
|
-
path = path.toString().match(/[^.[\]]+/g) || [];
|
|
131
|
-
}
|
|
132
|
-
path.slice(0, -1).reduce((a, c, i) => // Iterate all of them except the last one
|
|
133
|
-
Object(a[c]) === a[c] // Does the key exist and is its value an object?
|
|
134
|
-
// Yes: then follow that path
|
|
135
|
-
? a[c]
|
|
136
|
-
// No: create the key. Is the next key a potential array-index?
|
|
137
|
-
: a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1]
|
|
138
|
-
? [] // Yes: assign a new array object
|
|
139
|
-
: {}, // No: assign a new plain object
|
|
140
|
-
obj)[path[path.length - 1]] = value; // Finally assign the value to the last key
|
|
141
|
-
return obj[path[0]]; // Return the top-level object to allow chaining
|
|
61
|
+
// @dynamic
|
|
62
|
+
class AXObjectUtil {
|
|
63
|
+
static deepJSONClone(obj) {
|
|
64
|
+
return obj ? JSON.parse(JSON.stringify(obj)) : null;
|
|
65
|
+
}
|
|
66
|
+
static deepCopy(obj) {
|
|
67
|
+
let copy;
|
|
68
|
+
// Handle the 3 simple types, and null or undefined
|
|
69
|
+
if (null == obj || 'object' !== typeof obj) {
|
|
70
|
+
return obj;
|
|
71
|
+
}
|
|
72
|
+
// Handle Date
|
|
73
|
+
if (obj instanceof Date) {
|
|
74
|
+
copy = new Date();
|
|
75
|
+
copy.setTime(obj.getTime());
|
|
76
|
+
return copy;
|
|
77
|
+
}
|
|
78
|
+
// Handle Array
|
|
79
|
+
if (obj instanceof Array) {
|
|
80
|
+
copy = [];
|
|
81
|
+
for (let i = 0, len = obj.length; i < len; i++) {
|
|
82
|
+
copy[i] = AXObjectUtil.deepCopy(obj[i]);
|
|
83
|
+
}
|
|
84
|
+
return copy;
|
|
85
|
+
}
|
|
86
|
+
// Handle Object
|
|
87
|
+
if (obj instanceof Object) {
|
|
88
|
+
copy = {};
|
|
89
|
+
for (const attr in obj) {
|
|
90
|
+
if (obj.hasOwnProperty(attr)) {
|
|
91
|
+
copy[attr] = AXObjectUtil.deepCopy(obj[attr]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return copy;
|
|
95
|
+
}
|
|
96
|
+
throw new Error('Unable to copy obj! Its type isn\'t supported.');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function AXFetchProp(obj, prop) {
|
|
100
|
+
if (typeof obj === 'undefined') {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
const index = prop.indexOf('.');
|
|
104
|
+
if (index > -1) {
|
|
105
|
+
return AXFetchProp(obj[prop.substring(0, index)], prop.substr(index + 1));
|
|
106
|
+
}
|
|
107
|
+
return obj[prop];
|
|
108
|
+
}
|
|
109
|
+
function getPropByPath(obj, path, defaultVal) {
|
|
110
|
+
path = path
|
|
111
|
+
.replace(/\[/g, '.')
|
|
112
|
+
.replace(/]/g, '')
|
|
113
|
+
.split('.');
|
|
114
|
+
path.forEach((level) => {
|
|
115
|
+
if (obj) {
|
|
116
|
+
obj = obj[level];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
if (obj === undefined) {
|
|
120
|
+
return defaultVal;
|
|
121
|
+
}
|
|
122
|
+
return obj;
|
|
123
|
+
}
|
|
124
|
+
function setPropByPath(obj, path, value) {
|
|
125
|
+
if (Object(obj) !== obj) {
|
|
126
|
+
return obj;
|
|
127
|
+
} // When obj is not an object
|
|
128
|
+
// If not yet an array, get the keys from the string-path
|
|
129
|
+
if (!Array.isArray(path)) {
|
|
130
|
+
path = path.toString().match(/[^.[\]]+/g) || [];
|
|
131
|
+
}
|
|
132
|
+
path.slice(0, -1).reduce((a, c, i) => // Iterate all of them except the last one
|
|
133
|
+
Object(a[c]) === a[c] // Does the key exist and is its value an object?
|
|
134
|
+
// Yes: then follow that path
|
|
135
|
+
? a[c]
|
|
136
|
+
// No: create the key. Is the next key a potential array-index?
|
|
137
|
+
: a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1]
|
|
138
|
+
? [] // Yes: assign a new array object
|
|
139
|
+
: {}, // No: assign a new plain object
|
|
140
|
+
obj)[path[path.length - 1]] = value; // Finally assign the value to the last key
|
|
141
|
+
return obj[path[0]]; // Return the top-level object to allow chaining
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
// @dynamic
|
|
145
|
-
class AXConfig {
|
|
146
|
-
static get onChange() {
|
|
147
|
-
return AXConfig.dataChangeSubject.asObservable();
|
|
148
|
-
}
|
|
149
|
-
static set(arg1, arg2) {
|
|
150
|
-
if (arg1 && typeof arg1 == 'string') {
|
|
151
|
-
setPropByPath(AXConfig.dataModel, arg1, arg2);
|
|
152
|
-
AXConfig.dataChangeSubject.next(AXConfig.dataModel);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (arg1 && typeof arg1 == 'object') {
|
|
156
|
-
Object.assign(AXConfig.dataModel, arg1);
|
|
157
|
-
AXConfig.dataChangeSubject.next(AXConfig.dataModel);
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
if (!arg1 && !arg2) {
|
|
161
|
-
return AXConfig.dataChangeSubject.asObservable();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
static get(path) {
|
|
165
|
-
return getPropByPath(AXConfig.dataModel, path);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
AXConfig.dataModel = {};
|
|
144
|
+
// @dynamic
|
|
145
|
+
class AXConfig {
|
|
146
|
+
static get onChange() {
|
|
147
|
+
return AXConfig.dataChangeSubject.asObservable();
|
|
148
|
+
}
|
|
149
|
+
static set(arg1, arg2) {
|
|
150
|
+
if (arg1 && typeof arg1 == 'string') {
|
|
151
|
+
setPropByPath(AXConfig.dataModel, arg1, arg2);
|
|
152
|
+
AXConfig.dataChangeSubject.next(AXConfig.dataModel);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (arg1 && typeof arg1 == 'object') {
|
|
156
|
+
Object.assign(AXConfig.dataModel, arg1);
|
|
157
|
+
AXConfig.dataChangeSubject.next(AXConfig.dataModel);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (!arg1 && !arg2) {
|
|
161
|
+
return AXConfig.dataChangeSubject.asObservable();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
static get(path) {
|
|
165
|
+
return getPropByPath(AXConfig.dataModel, path);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
AXConfig.dataModel = {};
|
|
169
169
|
AXConfig.dataChangeSubject = new Subject();
|
|
170
170
|
|
|
171
|
-
class AXDateTime {
|
|
172
|
-
// private get _moment(): moment_.Moment {
|
|
173
|
-
// const m = moment(this.date);
|
|
174
|
-
// if (this.type === 'jalali') {
|
|
175
|
-
// m.locale('fa');
|
|
176
|
-
// }
|
|
177
|
-
// return m;
|
|
178
|
-
// }
|
|
179
|
-
constructor(value = new Date(), type = AXConfig.get('dateTime.type') || 'gregorian') {
|
|
180
|
-
this.type = type;
|
|
181
|
-
if (value instanceof Date) {
|
|
182
|
-
this._date = value;
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
this._date = new Date(value);
|
|
186
|
-
}
|
|
187
|
-
this._moment = moment(this.date);
|
|
188
|
-
if (this.type === 'jalali') {
|
|
189
|
-
this._moment.locale('fa');
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
static convert(value, type = AXConfig.get('dateTime.type') || 'gregorian') {
|
|
193
|
-
let date;
|
|
194
|
-
if (typeof value === 'string' || value instanceof String) {
|
|
195
|
-
date = new AXDateTime(value, type);
|
|
196
|
-
}
|
|
197
|
-
else if (value instanceof Date) {
|
|
198
|
-
date = new AXDateTime(value, type);
|
|
199
|
-
}
|
|
200
|
-
else if (value instanceof AXDateTime) {
|
|
201
|
-
date = value;
|
|
202
|
-
}
|
|
203
|
-
return date;
|
|
204
|
-
}
|
|
205
|
-
get date() {
|
|
206
|
-
return this._date;
|
|
207
|
-
}
|
|
208
|
-
resolveUnit(unit) {
|
|
209
|
-
return this.type === 'jalali' ? 'j' + unit : unit;
|
|
210
|
-
}
|
|
211
|
-
clone() {
|
|
212
|
-
return new AXDateTime(this.date, this.type);
|
|
213
|
-
}
|
|
214
|
-
get dayInMonth() {
|
|
215
|
-
return this._moment.date();
|
|
216
|
-
}
|
|
217
|
-
get dayOfYear() {
|
|
218
|
-
return this._moment.dayOfYear();
|
|
219
|
-
}
|
|
220
|
-
get dayInWeek() {
|
|
221
|
-
return this._moment.day();
|
|
222
|
-
}
|
|
223
|
-
get hour() {
|
|
224
|
-
return this._moment.hour();
|
|
225
|
-
}
|
|
226
|
-
get minute() {
|
|
227
|
-
return this._moment.minute();
|
|
228
|
-
}
|
|
229
|
-
get second() {
|
|
230
|
-
return this._moment.second();
|
|
231
|
-
}
|
|
232
|
-
get year() {
|
|
233
|
-
return this._moment.year();
|
|
234
|
-
}
|
|
235
|
-
get monthOfYear() {
|
|
236
|
-
return this._moment.month();
|
|
237
|
-
}
|
|
238
|
-
get month() {
|
|
239
|
-
return new AXCalendarMonth(this);
|
|
240
|
-
}
|
|
241
|
-
get firstDayOfWeek() {
|
|
242
|
-
const a = moment(this.date);
|
|
243
|
-
if (this.type === 'jalali') {
|
|
244
|
-
this._moment.locale('fa');
|
|
245
|
-
}
|
|
246
|
-
return new AXDateTime(a.startOf('w').toDate(), this.type);
|
|
247
|
-
}
|
|
248
|
-
get endDayOfWeek() {
|
|
249
|
-
const a = moment(this.date);
|
|
250
|
-
if (this.type === 'jalali') {
|
|
251
|
-
this._moment.locale('fa');
|
|
252
|
-
}
|
|
253
|
-
return new AXDateTime(moment(this.date).endOf('w').toDate(), this.type);
|
|
254
|
-
}
|
|
255
|
-
convertStringToJalali(date, format) {
|
|
256
|
-
return moment(date).locale('fa').format('YYYY/M/D');
|
|
257
|
-
}
|
|
258
|
-
convertStringToGregorian(date, format) {
|
|
259
|
-
return new Date(moment.from(date, 'fa', 'YYYY/MM/DD').format('YYYY/MM/DD'));
|
|
260
|
-
}
|
|
261
|
-
add(unit = 'day', amount) {
|
|
262
|
-
return new AXDateTime(moment(this.date).add(amount, this.resolveUnit(unit)).toDate(), this.type);
|
|
263
|
-
}
|
|
264
|
-
addDay(amount) {
|
|
265
|
-
return new AXDateTime(moment(this.date).add(amount, 'd').toDate(), this.type);
|
|
266
|
-
}
|
|
267
|
-
addMonth(amount) {
|
|
268
|
-
return new AXDateTime(moment(this.date).add(amount, 'months').toDate(), this.type);
|
|
269
|
-
}
|
|
270
|
-
addHour(amount) {
|
|
271
|
-
return new AXDateTime(moment(this.date).add(amount, 'hours').toDate(), this.type);
|
|
272
|
-
}
|
|
273
|
-
set(unit = 'day', value) {
|
|
274
|
-
return new AXDateTime(this._moment.set(unit, value).toDate(), this.type);
|
|
275
|
-
}
|
|
276
|
-
duration(end, unit = 'days') {
|
|
277
|
-
const duration = moment.duration(this._moment.diff(end._moment));
|
|
278
|
-
return Math.round(duration.as(unit));
|
|
279
|
-
}
|
|
280
|
-
startOf(unit = 'day') {
|
|
281
|
-
return new AXDateTime(moment(this.date).startOf(this.resolveUnit(unit)).toDate(), this.type);
|
|
282
|
-
}
|
|
283
|
-
endOf(unit = 'day') {
|
|
284
|
-
return new AXDateTime(moment(this.date).endOf(this.resolveUnit(unit)).toDate(), this.type);
|
|
285
|
-
}
|
|
286
|
-
format(format = AXConfig.get('dateTime.shortDateFormat') || (this.type === 'gregorian' ? 'DD-MM-YYYY' : 'YYYY-MM-DD')) {
|
|
287
|
-
if (format === 'P') {
|
|
288
|
-
return this._moment.fromNow();
|
|
289
|
-
}
|
|
290
|
-
return this._moment.format(format);
|
|
291
|
-
}
|
|
292
|
-
toString() {
|
|
293
|
-
return this.format();
|
|
294
|
-
}
|
|
295
|
-
equal(value, unit = 'day') {
|
|
296
|
-
if (!value) {
|
|
297
|
-
return false;
|
|
298
|
-
}
|
|
299
|
-
return this._moment.isSame(moment(value.date), this.resolveUnit(unit));
|
|
300
|
-
}
|
|
301
|
-
convertToJalaliDate(value) {
|
|
302
|
-
const options = {
|
|
303
|
-
numberingSystem: 'latn',
|
|
304
|
-
year: 'numeric',
|
|
305
|
-
month: '2-digit',
|
|
306
|
-
day: '2-digit',
|
|
307
|
-
hour: '2-digit',
|
|
308
|
-
minute: '2-digit',
|
|
309
|
-
second: '2-digit'
|
|
310
|
-
};
|
|
311
|
-
const jDate = new Date(value).toLocaleDateString('fa-IR', options);
|
|
312
|
-
const item = {};
|
|
313
|
-
item.year = jDate.slice(0, 4);
|
|
314
|
-
item.month = jDate.slice(5, 7);
|
|
315
|
-
item.day = jDate.slice(8, 10);
|
|
316
|
-
item.hour = jDate.slice(13, 15);
|
|
317
|
-
item.minutes = jDate.slice(16, 18);
|
|
318
|
-
item.seconds = jDate.slice(19, 21);
|
|
319
|
-
return item;
|
|
320
|
-
}
|
|
321
|
-
toJalaliString(value) {
|
|
322
|
-
const date = this.convertToJalaliDate(value);
|
|
323
|
-
let str = '';
|
|
324
|
-
str = date.year + '-' + date.month + '-' + date.day + 'T' + date.hour + ':' + date.minutes + ':' + date.seconds;
|
|
325
|
-
return str;
|
|
326
|
-
}
|
|
327
|
-
convertToGregorianDate(value) {
|
|
328
|
-
// TODO: check this fucking type
|
|
329
|
-
const options = {
|
|
330
|
-
numberingSystem: 'latn',
|
|
331
|
-
year: 'numeric',
|
|
332
|
-
month: '2-digit',
|
|
333
|
-
day: '2-digit',
|
|
334
|
-
hour: '2-digit',
|
|
335
|
-
minute: '2-digit',
|
|
336
|
-
second: '2-digit'
|
|
337
|
-
};
|
|
338
|
-
const date = new Date(value).toLocaleString('en-us', options);
|
|
339
|
-
const item = {};
|
|
340
|
-
item.year = date.slice(6, 10);
|
|
341
|
-
item.month = date.slice(0, 2);
|
|
342
|
-
item.day = date.slice(3, 5);
|
|
343
|
-
item.hour = date.slice(12, 14);
|
|
344
|
-
item.minutes = date.slice(15, 17);
|
|
345
|
-
item.seconds = date.slice(18, 20);
|
|
346
|
-
return item;
|
|
347
|
-
}
|
|
348
|
-
toGregorianString(value) {
|
|
349
|
-
const date = this.convertToGregorianDate(value);
|
|
350
|
-
let str = '';
|
|
351
|
-
str = date.year + '-' + date.month + '-' + date.day + 'T' + date.hour + ':' + date.minutes + ':' + date.seconds;
|
|
352
|
-
return str;
|
|
353
|
-
}
|
|
354
|
-
compaireNew(value, unit = 'YMD', type = 'jalali') {
|
|
355
|
-
const range = [0, 0];
|
|
356
|
-
let str1;
|
|
357
|
-
let str2;
|
|
358
|
-
if (type === 'jalali') {
|
|
359
|
-
str1 = this.toJalaliString(this.date);
|
|
360
|
-
str2 = this.toJalaliString(value.date ? value.date : value);
|
|
361
|
-
}
|
|
362
|
-
else {
|
|
363
|
-
str1 = this.toGregorianString(this.date);
|
|
364
|
-
str2 = this.toGregorianString(value.date ? value.date : value);
|
|
365
|
-
}
|
|
366
|
-
switch (unit) {
|
|
367
|
-
case 'YMDhms':
|
|
368
|
-
range[0] = 0;
|
|
369
|
-
range[1] = 19;
|
|
370
|
-
break;
|
|
371
|
-
case 'YMDhm':
|
|
372
|
-
range[0] = 0;
|
|
373
|
-
range[1] = 16;
|
|
374
|
-
break;
|
|
375
|
-
case 'YMDh':
|
|
376
|
-
range[0] = 0;
|
|
377
|
-
range[1] = 13;
|
|
378
|
-
break;
|
|
379
|
-
case 'YMD':
|
|
380
|
-
range[0] = 0;
|
|
381
|
-
range[1] = 10;
|
|
382
|
-
break;
|
|
383
|
-
case 'YM':
|
|
384
|
-
range[0] = 0;
|
|
385
|
-
range[1] = 7;
|
|
386
|
-
break;
|
|
387
|
-
case 'h':
|
|
388
|
-
range[0] = 11;
|
|
389
|
-
range[1] = 13;
|
|
390
|
-
break;
|
|
391
|
-
case 'm':
|
|
392
|
-
range[0] = 14;
|
|
393
|
-
range[1] = 16;
|
|
394
|
-
break;
|
|
395
|
-
case 's':
|
|
396
|
-
range[0] = 17;
|
|
397
|
-
range[1] = 19;
|
|
398
|
-
break;
|
|
399
|
-
case 'D':
|
|
400
|
-
range[0] = 8;
|
|
401
|
-
range[1] = 10;
|
|
402
|
-
break;
|
|
403
|
-
case 'M':
|
|
404
|
-
range[0] = 5;
|
|
405
|
-
range[1] = 7;
|
|
406
|
-
break;
|
|
407
|
-
case 'Y':
|
|
408
|
-
range[0] = 0;
|
|
409
|
-
range[1] = 4;
|
|
410
|
-
break;
|
|
411
|
-
}
|
|
412
|
-
if (str1.slice(range[0], range[1]) === str2.slice(range[0], range[1])) {
|
|
413
|
-
return 0;
|
|
414
|
-
}
|
|
415
|
-
else if (str1.slice(range[0], range[1]) > str2.slice(range[0], range[1])) {
|
|
416
|
-
return 1;
|
|
417
|
-
}
|
|
418
|
-
else {
|
|
419
|
-
return -1;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
compaire(value, unit = 'day') {
|
|
423
|
-
if (this._moment.isSame(moment(value.date), this.resolveUnit(unit))) {
|
|
424
|
-
return 0;
|
|
425
|
-
}
|
|
426
|
-
else if (this._moment.isAfter(moment(value.date), this.resolveUnit(unit))) {
|
|
427
|
-
return 1;
|
|
428
|
-
}
|
|
429
|
-
else {
|
|
430
|
-
return -1;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
toISOString() {
|
|
434
|
-
return this._date.toISOString();
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
class AXCalendarMonth {
|
|
438
|
-
constructor(date) {
|
|
439
|
-
this._moment = moment(date.date);
|
|
440
|
-
this.index = date.date.getMonth();
|
|
441
|
-
this.name = this._moment.format('MMMM');
|
|
442
|
-
this.range = new AXDateTimeRange(new AXDateTime(this._moment.startOf('month').toDate(), date.type), new AXDateTime(this._moment.endOf('month').toDate(), date.type));
|
|
443
|
-
}
|
|
444
|
-
get range() {
|
|
445
|
-
return this._range;
|
|
446
|
-
}
|
|
447
|
-
set range(v) {
|
|
448
|
-
this._range = v;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
class AXDateTimeRange {
|
|
452
|
-
constructor(startTime, endTime) {
|
|
453
|
-
this.startTime = startTime;
|
|
454
|
-
this.endTime = endTime;
|
|
455
|
-
}
|
|
456
|
-
duration(unit = 'days') {
|
|
457
|
-
const duration = moment.duration(moment(this.startTime.date).diff(moment(this.endTime.date)));
|
|
458
|
-
return duration.as(unit);
|
|
459
|
-
}
|
|
460
|
-
enumurate(unit = 'day', type = AXConfig.get('dateTime.type') || 'jalali') {
|
|
461
|
-
const result = [];
|
|
462
|
-
for (let index = 0; this.startTime.add(unit, index).compaireNew(this.endTime, this.getViewCompaire(unit), type) <= 0; index++) {
|
|
463
|
-
result.push(this.startTime.add(unit, index));
|
|
464
|
-
}
|
|
465
|
-
return result;
|
|
466
|
-
}
|
|
467
|
-
includes(value, unit = 'day', type = 'jalali') {
|
|
468
|
-
return (value.compaireNew(this.startTime, this.getViewCompaire(unit), type) >= 0 &&
|
|
469
|
-
value.compaireNew(this.endTime, this.getViewCompaire(unit), type) <= 0);
|
|
470
|
-
}
|
|
471
|
-
getViewCompaire(view) {
|
|
472
|
-
switch (view) {
|
|
473
|
-
case 'day':
|
|
474
|
-
return 'YMD';
|
|
475
|
-
case 'month':
|
|
476
|
-
return 'YM';
|
|
477
|
-
case 'year':
|
|
478
|
-
return 'Y';
|
|
479
|
-
}
|
|
480
|
-
}
|
|
171
|
+
class AXDateTime {
|
|
172
|
+
// private get _moment(): moment_.Moment {
|
|
173
|
+
// const m = moment(this.date);
|
|
174
|
+
// if (this.type === 'jalali') {
|
|
175
|
+
// m.locale('fa');
|
|
176
|
+
// }
|
|
177
|
+
// return m;
|
|
178
|
+
// }
|
|
179
|
+
constructor(value = new Date(), type = AXConfig.get('dateTime.type') || 'gregorian') {
|
|
180
|
+
this.type = type;
|
|
181
|
+
if (value instanceof Date) {
|
|
182
|
+
this._date = value;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
this._date = new Date(value);
|
|
186
|
+
}
|
|
187
|
+
this._moment = moment(this.date);
|
|
188
|
+
if (this.type === 'jalali') {
|
|
189
|
+
this._moment.locale('fa');
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
static convert(value, type = AXConfig.get('dateTime.type') || 'gregorian') {
|
|
193
|
+
let date;
|
|
194
|
+
if (typeof value === 'string' || value instanceof String) {
|
|
195
|
+
date = new AXDateTime(value, type);
|
|
196
|
+
}
|
|
197
|
+
else if (value instanceof Date) {
|
|
198
|
+
date = new AXDateTime(value, type);
|
|
199
|
+
}
|
|
200
|
+
else if (value instanceof AXDateTime) {
|
|
201
|
+
date = value;
|
|
202
|
+
}
|
|
203
|
+
return date;
|
|
204
|
+
}
|
|
205
|
+
get date() {
|
|
206
|
+
return this._date;
|
|
207
|
+
}
|
|
208
|
+
resolveUnit(unit) {
|
|
209
|
+
return this.type === 'jalali' ? 'j' + unit : unit;
|
|
210
|
+
}
|
|
211
|
+
clone() {
|
|
212
|
+
return new AXDateTime(this.date, this.type);
|
|
213
|
+
}
|
|
214
|
+
get dayInMonth() {
|
|
215
|
+
return this._moment.date();
|
|
216
|
+
}
|
|
217
|
+
get dayOfYear() {
|
|
218
|
+
return this._moment.dayOfYear();
|
|
219
|
+
}
|
|
220
|
+
get dayInWeek() {
|
|
221
|
+
return this._moment.day();
|
|
222
|
+
}
|
|
223
|
+
get hour() {
|
|
224
|
+
return this._moment.hour();
|
|
225
|
+
}
|
|
226
|
+
get minute() {
|
|
227
|
+
return this._moment.minute();
|
|
228
|
+
}
|
|
229
|
+
get second() {
|
|
230
|
+
return this._moment.second();
|
|
231
|
+
}
|
|
232
|
+
get year() {
|
|
233
|
+
return this._moment.year();
|
|
234
|
+
}
|
|
235
|
+
get monthOfYear() {
|
|
236
|
+
return this._moment.month();
|
|
237
|
+
}
|
|
238
|
+
get month() {
|
|
239
|
+
return new AXCalendarMonth(this);
|
|
240
|
+
}
|
|
241
|
+
get firstDayOfWeek() {
|
|
242
|
+
const a = moment(this.date);
|
|
243
|
+
if (this.type === 'jalali') {
|
|
244
|
+
this._moment.locale('fa');
|
|
245
|
+
}
|
|
246
|
+
return new AXDateTime(a.startOf('w').toDate(), this.type);
|
|
247
|
+
}
|
|
248
|
+
get endDayOfWeek() {
|
|
249
|
+
const a = moment(this.date);
|
|
250
|
+
if (this.type === 'jalali') {
|
|
251
|
+
this._moment.locale('fa');
|
|
252
|
+
}
|
|
253
|
+
return new AXDateTime(moment(this.date).endOf('w').toDate(), this.type);
|
|
254
|
+
}
|
|
255
|
+
convertStringToJalali(date, format) {
|
|
256
|
+
return moment(date).locale('fa').format('YYYY/M/D');
|
|
257
|
+
}
|
|
258
|
+
convertStringToGregorian(date, format) {
|
|
259
|
+
return new Date(moment.from(date, 'fa', 'YYYY/MM/DD').format('YYYY/MM/DD'));
|
|
260
|
+
}
|
|
261
|
+
add(unit = 'day', amount) {
|
|
262
|
+
return new AXDateTime(moment(this.date).add(amount, this.resolveUnit(unit)).toDate(), this.type);
|
|
263
|
+
}
|
|
264
|
+
addDay(amount) {
|
|
265
|
+
return new AXDateTime(moment(this.date).add(amount, 'd').toDate(), this.type);
|
|
266
|
+
}
|
|
267
|
+
addMonth(amount) {
|
|
268
|
+
return new AXDateTime(moment(this.date).add(amount, 'months').toDate(), this.type);
|
|
269
|
+
}
|
|
270
|
+
addHour(amount) {
|
|
271
|
+
return new AXDateTime(moment(this.date).add(amount, 'hours').toDate(), this.type);
|
|
272
|
+
}
|
|
273
|
+
set(unit = 'day', value) {
|
|
274
|
+
return new AXDateTime(this._moment.set(unit, value).toDate(), this.type);
|
|
275
|
+
}
|
|
276
|
+
duration(end, unit = 'days') {
|
|
277
|
+
const duration = moment.duration(this._moment.diff(end._moment));
|
|
278
|
+
return Math.round(duration.as(unit));
|
|
279
|
+
}
|
|
280
|
+
startOf(unit = 'day') {
|
|
281
|
+
return new AXDateTime(moment(this.date).startOf(this.resolveUnit(unit)).toDate(), this.type);
|
|
282
|
+
}
|
|
283
|
+
endOf(unit = 'day') {
|
|
284
|
+
return new AXDateTime(moment(this.date).endOf(this.resolveUnit(unit)).toDate(), this.type);
|
|
285
|
+
}
|
|
286
|
+
format(format = AXConfig.get('dateTime.shortDateFormat') || (this.type === 'gregorian' ? 'DD-MM-YYYY' : 'YYYY-MM-DD')) {
|
|
287
|
+
if (format === 'P') {
|
|
288
|
+
return this._moment.fromNow();
|
|
289
|
+
}
|
|
290
|
+
return this._moment.format(format);
|
|
291
|
+
}
|
|
292
|
+
toString() {
|
|
293
|
+
return this.format();
|
|
294
|
+
}
|
|
295
|
+
equal(value, unit = 'day') {
|
|
296
|
+
if (!value) {
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
return this._moment.isSame(moment(value.date), this.resolveUnit(unit));
|
|
300
|
+
}
|
|
301
|
+
convertToJalaliDate(value) {
|
|
302
|
+
const options = {
|
|
303
|
+
numberingSystem: 'latn',
|
|
304
|
+
year: 'numeric',
|
|
305
|
+
month: '2-digit',
|
|
306
|
+
day: '2-digit',
|
|
307
|
+
hour: '2-digit',
|
|
308
|
+
minute: '2-digit',
|
|
309
|
+
second: '2-digit'
|
|
310
|
+
};
|
|
311
|
+
const jDate = new Date(value).toLocaleDateString('fa-IR', options);
|
|
312
|
+
const item = {};
|
|
313
|
+
item.year = jDate.slice(0, 4);
|
|
314
|
+
item.month = jDate.slice(5, 7);
|
|
315
|
+
item.day = jDate.slice(8, 10);
|
|
316
|
+
item.hour = jDate.slice(13, 15);
|
|
317
|
+
item.minutes = jDate.slice(16, 18);
|
|
318
|
+
item.seconds = jDate.slice(19, 21);
|
|
319
|
+
return item;
|
|
320
|
+
}
|
|
321
|
+
toJalaliString(value) {
|
|
322
|
+
const date = this.convertToJalaliDate(value);
|
|
323
|
+
let str = '';
|
|
324
|
+
str = date.year + '-' + date.month + '-' + date.day + 'T' + date.hour + ':' + date.minutes + ':' + date.seconds;
|
|
325
|
+
return str;
|
|
326
|
+
}
|
|
327
|
+
convertToGregorianDate(value) {
|
|
328
|
+
// TODO: check this fucking type
|
|
329
|
+
const options = {
|
|
330
|
+
numberingSystem: 'latn',
|
|
331
|
+
year: 'numeric',
|
|
332
|
+
month: '2-digit',
|
|
333
|
+
day: '2-digit',
|
|
334
|
+
hour: '2-digit',
|
|
335
|
+
minute: '2-digit',
|
|
336
|
+
second: '2-digit'
|
|
337
|
+
};
|
|
338
|
+
const date = new Date(value).toLocaleString('en-us', options);
|
|
339
|
+
const item = {};
|
|
340
|
+
item.year = date.slice(6, 10);
|
|
341
|
+
item.month = date.slice(0, 2);
|
|
342
|
+
item.day = date.slice(3, 5);
|
|
343
|
+
item.hour = date.slice(12, 14);
|
|
344
|
+
item.minutes = date.slice(15, 17);
|
|
345
|
+
item.seconds = date.slice(18, 20);
|
|
346
|
+
return item;
|
|
347
|
+
}
|
|
348
|
+
toGregorianString(value) {
|
|
349
|
+
const date = this.convertToGregorianDate(value);
|
|
350
|
+
let str = '';
|
|
351
|
+
str = date.year + '-' + date.month + '-' + date.day + 'T' + date.hour + ':' + date.minutes + ':' + date.seconds;
|
|
352
|
+
return str;
|
|
353
|
+
}
|
|
354
|
+
compaireNew(value, unit = 'YMD', type = 'jalali') {
|
|
355
|
+
const range = [0, 0];
|
|
356
|
+
let str1;
|
|
357
|
+
let str2;
|
|
358
|
+
if (type === 'jalali') {
|
|
359
|
+
str1 = this.toJalaliString(this.date);
|
|
360
|
+
str2 = this.toJalaliString(value.date ? value.date : value);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
str1 = this.toGregorianString(this.date);
|
|
364
|
+
str2 = this.toGregorianString(value.date ? value.date : value);
|
|
365
|
+
}
|
|
366
|
+
switch (unit) {
|
|
367
|
+
case 'YMDhms':
|
|
368
|
+
range[0] = 0;
|
|
369
|
+
range[1] = 19;
|
|
370
|
+
break;
|
|
371
|
+
case 'YMDhm':
|
|
372
|
+
range[0] = 0;
|
|
373
|
+
range[1] = 16;
|
|
374
|
+
break;
|
|
375
|
+
case 'YMDh':
|
|
376
|
+
range[0] = 0;
|
|
377
|
+
range[1] = 13;
|
|
378
|
+
break;
|
|
379
|
+
case 'YMD':
|
|
380
|
+
range[0] = 0;
|
|
381
|
+
range[1] = 10;
|
|
382
|
+
break;
|
|
383
|
+
case 'YM':
|
|
384
|
+
range[0] = 0;
|
|
385
|
+
range[1] = 7;
|
|
386
|
+
break;
|
|
387
|
+
case 'h':
|
|
388
|
+
range[0] = 11;
|
|
389
|
+
range[1] = 13;
|
|
390
|
+
break;
|
|
391
|
+
case 'm':
|
|
392
|
+
range[0] = 14;
|
|
393
|
+
range[1] = 16;
|
|
394
|
+
break;
|
|
395
|
+
case 's':
|
|
396
|
+
range[0] = 17;
|
|
397
|
+
range[1] = 19;
|
|
398
|
+
break;
|
|
399
|
+
case 'D':
|
|
400
|
+
range[0] = 8;
|
|
401
|
+
range[1] = 10;
|
|
402
|
+
break;
|
|
403
|
+
case 'M':
|
|
404
|
+
range[0] = 5;
|
|
405
|
+
range[1] = 7;
|
|
406
|
+
break;
|
|
407
|
+
case 'Y':
|
|
408
|
+
range[0] = 0;
|
|
409
|
+
range[1] = 4;
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
if (str1.slice(range[0], range[1]) === str2.slice(range[0], range[1])) {
|
|
413
|
+
return 0;
|
|
414
|
+
}
|
|
415
|
+
else if (str1.slice(range[0], range[1]) > str2.slice(range[0], range[1])) {
|
|
416
|
+
return 1;
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
return -1;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
compaire(value, unit = 'day') {
|
|
423
|
+
if (this._moment.isSame(moment(value.date), this.resolveUnit(unit))) {
|
|
424
|
+
return 0;
|
|
425
|
+
}
|
|
426
|
+
else if (this._moment.isAfter(moment(value.date), this.resolveUnit(unit))) {
|
|
427
|
+
return 1;
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
return -1;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
toISOString() {
|
|
434
|
+
return this._date.toISOString();
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
class AXCalendarMonth {
|
|
438
|
+
constructor(date) {
|
|
439
|
+
this._moment = moment(date.date);
|
|
440
|
+
this.index = date.date.getMonth();
|
|
441
|
+
this.name = this._moment.format('MMMM');
|
|
442
|
+
this.range = new AXDateTimeRange(new AXDateTime(this._moment.startOf('month').toDate(), date.type), new AXDateTime(this._moment.endOf('month').toDate(), date.type));
|
|
443
|
+
}
|
|
444
|
+
get range() {
|
|
445
|
+
return this._range;
|
|
446
|
+
}
|
|
447
|
+
set range(v) {
|
|
448
|
+
this._range = v;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
class AXDateTimeRange {
|
|
452
|
+
constructor(startTime, endTime) {
|
|
453
|
+
this.startTime = startTime;
|
|
454
|
+
this.endTime = endTime;
|
|
455
|
+
}
|
|
456
|
+
duration(unit = 'days') {
|
|
457
|
+
const duration = moment.duration(moment(this.startTime.date).diff(moment(this.endTime.date)));
|
|
458
|
+
return duration.as(unit);
|
|
459
|
+
}
|
|
460
|
+
enumurate(unit = 'day', type = AXConfig.get('dateTime.type') || 'jalali') {
|
|
461
|
+
const result = [];
|
|
462
|
+
for (let index = 0; this.startTime.add(unit, index).compaireNew(this.endTime, this.getViewCompaire(unit), type) <= 0; index++) {
|
|
463
|
+
result.push(this.startTime.add(unit, index));
|
|
464
|
+
}
|
|
465
|
+
return result;
|
|
466
|
+
}
|
|
467
|
+
includes(value, unit = 'day', type = 'jalali') {
|
|
468
|
+
return (value.compaireNew(this.startTime, this.getViewCompaire(unit), type) >= 0 &&
|
|
469
|
+
value.compaireNew(this.endTime, this.getViewCompaire(unit), type) <= 0);
|
|
470
|
+
}
|
|
471
|
+
getViewCompaire(view) {
|
|
472
|
+
switch (view) {
|
|
473
|
+
case 'day':
|
|
474
|
+
return 'YMD';
|
|
475
|
+
case 'month':
|
|
476
|
+
return 'YM';
|
|
477
|
+
case 'year':
|
|
478
|
+
return 'Y';
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
481
|
}
|
|
482
482
|
|
|
483
|
-
class AXBaseMenuItem {
|
|
484
|
-
constructor() {
|
|
485
|
-
this.uid = new Date().getTime().toString();
|
|
486
|
-
this.visible = true;
|
|
487
|
-
this.disable = false;
|
|
488
|
-
this.selected = false;
|
|
489
|
-
this.style = 'ax light';
|
|
490
|
-
this.orderIndex = 0;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
class AXMenuItem extends AXBaseMenuItem {
|
|
494
|
-
constructor() {
|
|
495
|
-
super(...arguments);
|
|
496
|
-
this.divider = false;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
class AXButtonItem extends AXBaseMenuItem {
|
|
500
|
-
constructor() {
|
|
501
|
-
super(...arguments);
|
|
502
|
-
this.dropdown = false;
|
|
503
|
-
this.submitBehavior = false;
|
|
504
|
-
this.cancelBehavior = false;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
class AXCheckItem {
|
|
483
|
+
class AXBaseMenuItem {
|
|
484
|
+
constructor() {
|
|
485
|
+
this.uid = new Date().getTime().toString();
|
|
486
|
+
this.visible = true;
|
|
487
|
+
this.disable = false;
|
|
488
|
+
this.selected = false;
|
|
489
|
+
this.style = 'ax light';
|
|
490
|
+
this.orderIndex = 0;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
class AXMenuItem extends AXBaseMenuItem {
|
|
494
|
+
constructor() {
|
|
495
|
+
super(...arguments);
|
|
496
|
+
this.divider = false;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
class AXButtonItem extends AXBaseMenuItem {
|
|
500
|
+
constructor() {
|
|
501
|
+
super(...arguments);
|
|
502
|
+
this.dropdown = false;
|
|
503
|
+
this.submitBehavior = false;
|
|
504
|
+
this.cancelBehavior = false;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
class AXCheckItem {
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
class AXPromise {
|
|
511
|
-
constructor(executor) {
|
|
512
|
-
this._executor = executor;
|
|
513
|
-
setTimeout(() => {
|
|
514
|
-
this._executor(this.thenAction);
|
|
515
|
-
}, 50);
|
|
516
|
-
}
|
|
517
|
-
static resolve(value) {
|
|
518
|
-
const r = new AXPromise(z => {
|
|
519
|
-
z(value);
|
|
520
|
-
}).then(() => { });
|
|
521
|
-
return r;
|
|
522
|
-
}
|
|
523
|
-
then(action) {
|
|
524
|
-
this.thenAction = action;
|
|
525
|
-
return this;
|
|
526
|
-
}
|
|
510
|
+
class AXPromise {
|
|
511
|
+
constructor(executor) {
|
|
512
|
+
this._executor = executor;
|
|
513
|
+
setTimeout(() => {
|
|
514
|
+
this._executor(this.thenAction);
|
|
515
|
+
}, 50);
|
|
516
|
+
}
|
|
517
|
+
static resolve(value) {
|
|
518
|
+
const r = new AXPromise(z => {
|
|
519
|
+
z(value);
|
|
520
|
+
}).then(() => { });
|
|
521
|
+
return r;
|
|
522
|
+
}
|
|
523
|
+
then(action) {
|
|
524
|
+
this.thenAction = action;
|
|
525
|
+
return this;
|
|
526
|
+
}
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
-
class AXSelectItem {
|
|
529
|
+
class AXSelectItem {
|
|
530
530
|
}
|
|
531
531
|
|
|
532
|
-
/**
|
|
533
|
-
* @deprecated Use AXBasePageComponent from @acorex/components
|
|
534
|
-
*/
|
|
535
|
-
// TODO: Add Angular decorator.
|
|
536
|
-
class AXBasePageComponent {
|
|
537
|
-
constructor() {
|
|
538
|
-
this.onClosed = new EventEmitter();
|
|
539
|
-
}
|
|
540
|
-
close(data) {
|
|
541
|
-
this.onClosed.emit({
|
|
542
|
-
component: this,
|
|
543
|
-
data: data
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
|
-
onClosing(e) {
|
|
547
|
-
}
|
|
548
|
-
ngOnDestroy() {
|
|
549
|
-
this.onClosed.unsubscribe();
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
AXBasePageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXBasePageComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
553
|
-
AXBasePageComponent.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXBasePageComponent });
|
|
554
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXBasePageComponent, decorators: [{
|
|
555
|
-
type: Injectable
|
|
532
|
+
/**
|
|
533
|
+
* @deprecated Use AXBasePageComponent from @acorex/components
|
|
534
|
+
*/
|
|
535
|
+
// TODO: Add Angular decorator.
|
|
536
|
+
class AXBasePageComponent {
|
|
537
|
+
constructor() {
|
|
538
|
+
this.onClosed = new EventEmitter();
|
|
539
|
+
}
|
|
540
|
+
close(data) {
|
|
541
|
+
this.onClosed.emit({
|
|
542
|
+
component: this,
|
|
543
|
+
data: data
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
onClosing(e) {
|
|
547
|
+
}
|
|
548
|
+
ngOnDestroy() {
|
|
549
|
+
this.onClosed.unsubscribe();
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
AXBasePageComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXBasePageComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
553
|
+
AXBasePageComponent.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXBasePageComponent });
|
|
554
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXBasePageComponent, decorators: [{
|
|
555
|
+
type: Injectable
|
|
556
556
|
}] });
|
|
557
557
|
|
|
558
|
-
const AX_ERROR_DISPLAY_INTERCEPTOR = new InjectionToken('ax.error');
|
|
559
|
-
class AXErrorService {
|
|
560
|
-
constructor(injector) {
|
|
561
|
-
this.injector = injector;
|
|
562
|
-
}
|
|
563
|
-
handle(message) {
|
|
564
|
-
const instance = this.injector.get(AX_ERROR_DISPLAY_INTERCEPTOR);
|
|
565
|
-
if (instance) {
|
|
566
|
-
instance.show(message);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
AXErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
571
|
-
AXErrorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorService, providedIn: 'root' });
|
|
572
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorService, decorators: [{
|
|
573
|
-
type: Injectable,
|
|
574
|
-
args: [{ providedIn: 'root' }]
|
|
558
|
+
const AX_ERROR_DISPLAY_INTERCEPTOR = new InjectionToken('ax.error');
|
|
559
|
+
class AXErrorService {
|
|
560
|
+
constructor(injector) {
|
|
561
|
+
this.injector = injector;
|
|
562
|
+
}
|
|
563
|
+
handle(message) {
|
|
564
|
+
const instance = this.injector.get(AX_ERROR_DISPLAY_INTERCEPTOR);
|
|
565
|
+
if (instance) {
|
|
566
|
+
instance.show(message);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
AXErrorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
571
|
+
AXErrorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorService, providedIn: 'root' });
|
|
572
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorService, decorators: [{
|
|
573
|
+
type: Injectable,
|
|
574
|
+
args: [{ providedIn: 'root' }]
|
|
575
575
|
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
576
576
|
|
|
577
|
-
class AXErrorModule {
|
|
578
|
-
}
|
|
579
|
-
AXErrorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
580
|
-
AXErrorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorModule, imports: [CommonModule] });
|
|
581
|
-
AXErrorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorModule, providers: [AXErrorService], imports: [[CommonModule]] });
|
|
582
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorModule, decorators: [{
|
|
583
|
-
type: NgModule,
|
|
584
|
-
args: [{
|
|
585
|
-
declarations: [],
|
|
586
|
-
imports: [CommonModule],
|
|
587
|
-
exports: [],
|
|
588
|
-
providers: [AXErrorService],
|
|
589
|
-
}]
|
|
577
|
+
class AXErrorModule {
|
|
578
|
+
}
|
|
579
|
+
AXErrorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
580
|
+
AXErrorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorModule, imports: [CommonModule] });
|
|
581
|
+
AXErrorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorModule, providers: [AXErrorService], imports: [[CommonModule]] });
|
|
582
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXErrorModule, decorators: [{
|
|
583
|
+
type: NgModule,
|
|
584
|
+
args: [{
|
|
585
|
+
declarations: [],
|
|
586
|
+
imports: [CommonModule],
|
|
587
|
+
exports: [],
|
|
588
|
+
providers: [AXErrorService],
|
|
589
|
+
}]
|
|
590
590
|
}] });
|
|
591
591
|
|
|
592
592
|
const AX_HTTP_EVENT_INTERCEPTOR = new InjectionToken('ax.http.events');
|
|
593
593
|
|
|
594
|
-
class HttpResult {
|
|
595
|
-
constructor(executor) {
|
|
596
|
-
this._executor = executor;
|
|
597
|
-
setTimeout(() => {
|
|
598
|
-
this._executor(this.resultAction, this.errorAction, this.completeAction);
|
|
599
|
-
}, 50);
|
|
600
|
-
}
|
|
601
|
-
result(action) {
|
|
602
|
-
this.resultAction = action;
|
|
603
|
-
return this;
|
|
604
|
-
}
|
|
605
|
-
error(action) {
|
|
606
|
-
this.errorAction = action;
|
|
607
|
-
return this;
|
|
608
|
-
}
|
|
609
|
-
complete(action) {
|
|
610
|
-
this.completeAction = action;
|
|
611
|
-
return this;
|
|
612
|
-
}
|
|
594
|
+
class HttpResult {
|
|
595
|
+
constructor(executor) {
|
|
596
|
+
this._executor = executor;
|
|
597
|
+
setTimeout(() => {
|
|
598
|
+
this._executor(this.resultAction, this.errorAction, this.completeAction);
|
|
599
|
+
}, 50);
|
|
600
|
+
}
|
|
601
|
+
result(action) {
|
|
602
|
+
this.resultAction = action;
|
|
603
|
+
return this;
|
|
604
|
+
}
|
|
605
|
+
error(action) {
|
|
606
|
+
this.errorAction = action;
|
|
607
|
+
return this;
|
|
608
|
+
}
|
|
609
|
+
complete(action) {
|
|
610
|
+
this.completeAction = action;
|
|
611
|
+
return this;
|
|
612
|
+
}
|
|
613
613
|
}
|
|
614
614
|
|
|
615
|
-
// import { catchError, retry, retryWhen, mergeMap, delay, switchMap, scan, takeWhile, flatMap } from 'rxjs/operators';
|
|
616
|
-
// import { of, concat, throwError } from 'rxjs';
|
|
617
|
-
class AXHttpService {
|
|
618
|
-
constructor(http, injector) {
|
|
619
|
-
this.http = http;
|
|
620
|
-
this.injector = injector;
|
|
621
|
-
this.interceptor = this.injector.get(AX_HTTP_EVENT_INTERCEPTOR);
|
|
622
|
-
}
|
|
623
|
-
get(url, config = {}) {
|
|
624
|
-
config.url = url;
|
|
625
|
-
config.method = "get";
|
|
626
|
-
return this.request(config);
|
|
627
|
-
}
|
|
628
|
-
post(url, config = {}) {
|
|
629
|
-
config.url = url;
|
|
630
|
-
config.method = "post";
|
|
631
|
-
return this.request(config);
|
|
632
|
-
}
|
|
633
|
-
delete(url, config = {}) {
|
|
634
|
-
config.url = url;
|
|
635
|
-
config.method = "delete";
|
|
636
|
-
return this.request(config);
|
|
637
|
-
}
|
|
638
|
-
put(url, config = {}) {
|
|
639
|
-
config.url = url;
|
|
640
|
-
config.method = "put";
|
|
641
|
-
return this.request(config);
|
|
642
|
-
}
|
|
643
|
-
request(config) {
|
|
644
|
-
return new HttpResult((result, error, complete) => {
|
|
645
|
-
this.handleBegin(config).then(c => {
|
|
646
|
-
this.http
|
|
647
|
-
.request(config.method, config.url, this.mapOptions(config))
|
|
648
|
-
//.pipe(this.retry)
|
|
649
|
-
.subscribe(data => {
|
|
650
|
-
this.handleResult(data, result, complete, config);
|
|
651
|
-
}, c => {
|
|
652
|
-
this.handleError(c, error, complete, config);
|
|
653
|
-
});
|
|
654
|
-
});
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
handleResult(data, result, complete, config) {
|
|
658
|
-
if (this.interceptor) {
|
|
659
|
-
this.interceptor.success(config, data).then(c => {
|
|
660
|
-
if (result)
|
|
661
|
-
result(c);
|
|
662
|
-
this.handleComplete(complete, config);
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
else {
|
|
666
|
-
//
|
|
667
|
-
if (result)
|
|
668
|
-
result(data);
|
|
669
|
-
this.handleComplete(complete, config);
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
handleBegin(config) {
|
|
673
|
-
return new Promise((resolve) => {
|
|
674
|
-
if (!config.headers)
|
|
675
|
-
config.headers = {};
|
|
676
|
-
if (!config.params)
|
|
677
|
-
config.params = {};
|
|
678
|
-
//
|
|
679
|
-
if (this.interceptor) {
|
|
680
|
-
this.interceptor.begin(config).then(c => {
|
|
681
|
-
resolve(c);
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
else {
|
|
685
|
-
resolve(config);
|
|
686
|
-
}
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
handleComplete(complete, config) {
|
|
690
|
-
if (complete)
|
|
691
|
-
complete();
|
|
692
|
-
if (this.interceptor)
|
|
693
|
-
this.interceptor.complete(config);
|
|
694
|
-
}
|
|
695
|
-
handleError(c, error, complete, config) {
|
|
696
|
-
let r = {
|
|
697
|
-
message: c.message,
|
|
698
|
-
status: c.status,
|
|
699
|
-
code: c.status?.toString(),
|
|
700
|
-
handled: false,
|
|
701
|
-
error: c.error
|
|
702
|
-
};
|
|
703
|
-
if (error) {
|
|
704
|
-
error(r);
|
|
705
|
-
}
|
|
706
|
-
if (!r.handled) {
|
|
707
|
-
if (this.interceptor)
|
|
708
|
-
this.interceptor.error(config, r);
|
|
709
|
-
}
|
|
710
|
-
this.handleComplete(complete, config);
|
|
711
|
-
}
|
|
712
|
-
mapOptions(options) {
|
|
713
|
-
let headers = new HttpHeaders();
|
|
714
|
-
for (const key in options.headers) {
|
|
715
|
-
if (options.headers.hasOwnProperty(key)) {
|
|
716
|
-
const value = options.headers[key];
|
|
717
|
-
headers = headers.set(key, value);
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
let params = new HttpParams();
|
|
721
|
-
for (const key in options.params) {
|
|
722
|
-
if (options.params.hasOwnProperty(key)) {
|
|
723
|
-
const value = options.params[key];
|
|
724
|
-
params = params.set(key, value);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
return {
|
|
728
|
-
headers: headers,
|
|
729
|
-
params: params,
|
|
730
|
-
body: options.body,
|
|
731
|
-
responseType: options.responseType || 'json'
|
|
732
|
-
};
|
|
733
|
-
// if (options.method == "get") {
|
|
734
|
-
// return {
|
|
735
|
-
// headers: headers,
|
|
736
|
-
// params: params
|
|
737
|
-
// };
|
|
738
|
-
// }
|
|
739
|
-
// else {
|
|
740
|
-
// return {
|
|
741
|
-
// headers: headers,
|
|
742
|
-
// params: params,
|
|
743
|
-
// body: options.body
|
|
744
|
-
// };
|
|
745
|
-
// }
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
AXHttpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpService, deps: [{ token: i1.HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
749
|
-
AXHttpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpService });
|
|
750
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpService, decorators: [{
|
|
751
|
-
type: Injectable
|
|
615
|
+
// import { catchError, retry, retryWhen, mergeMap, delay, switchMap, scan, takeWhile, flatMap } from 'rxjs/operators';
|
|
616
|
+
// import { of, concat, throwError } from 'rxjs';
|
|
617
|
+
class AXHttpService {
|
|
618
|
+
constructor(http, injector) {
|
|
619
|
+
this.http = http;
|
|
620
|
+
this.injector = injector;
|
|
621
|
+
this.interceptor = this.injector.get(AX_HTTP_EVENT_INTERCEPTOR);
|
|
622
|
+
}
|
|
623
|
+
get(url, config = {}) {
|
|
624
|
+
config.url = url;
|
|
625
|
+
config.method = "get";
|
|
626
|
+
return this.request(config);
|
|
627
|
+
}
|
|
628
|
+
post(url, config = {}) {
|
|
629
|
+
config.url = url;
|
|
630
|
+
config.method = "post";
|
|
631
|
+
return this.request(config);
|
|
632
|
+
}
|
|
633
|
+
delete(url, config = {}) {
|
|
634
|
+
config.url = url;
|
|
635
|
+
config.method = "delete";
|
|
636
|
+
return this.request(config);
|
|
637
|
+
}
|
|
638
|
+
put(url, config = {}) {
|
|
639
|
+
config.url = url;
|
|
640
|
+
config.method = "put";
|
|
641
|
+
return this.request(config);
|
|
642
|
+
}
|
|
643
|
+
request(config) {
|
|
644
|
+
return new HttpResult((result, error, complete) => {
|
|
645
|
+
this.handleBegin(config).then(c => {
|
|
646
|
+
this.http
|
|
647
|
+
.request(config.method, config.url, this.mapOptions(config))
|
|
648
|
+
//.pipe(this.retry)
|
|
649
|
+
.subscribe(data => {
|
|
650
|
+
this.handleResult(data, result, complete, config);
|
|
651
|
+
}, c => {
|
|
652
|
+
this.handleError(c, error, complete, config);
|
|
653
|
+
});
|
|
654
|
+
});
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
handleResult(data, result, complete, config) {
|
|
658
|
+
if (this.interceptor) {
|
|
659
|
+
this.interceptor.success(config, data).then(c => {
|
|
660
|
+
if (result)
|
|
661
|
+
result(c);
|
|
662
|
+
this.handleComplete(complete, config);
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
//
|
|
667
|
+
if (result)
|
|
668
|
+
result(data);
|
|
669
|
+
this.handleComplete(complete, config);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
handleBegin(config) {
|
|
673
|
+
return new Promise((resolve) => {
|
|
674
|
+
if (!config.headers)
|
|
675
|
+
config.headers = {};
|
|
676
|
+
if (!config.params)
|
|
677
|
+
config.params = {};
|
|
678
|
+
//
|
|
679
|
+
if (this.interceptor) {
|
|
680
|
+
this.interceptor.begin(config).then(c => {
|
|
681
|
+
resolve(c);
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
resolve(config);
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
handleComplete(complete, config) {
|
|
690
|
+
if (complete)
|
|
691
|
+
complete();
|
|
692
|
+
if (this.interceptor)
|
|
693
|
+
this.interceptor.complete(config);
|
|
694
|
+
}
|
|
695
|
+
handleError(c, error, complete, config) {
|
|
696
|
+
let r = {
|
|
697
|
+
message: c.message,
|
|
698
|
+
status: c.status,
|
|
699
|
+
code: c.status?.toString(),
|
|
700
|
+
handled: false,
|
|
701
|
+
error: c.error
|
|
702
|
+
};
|
|
703
|
+
if (error) {
|
|
704
|
+
error(r);
|
|
705
|
+
}
|
|
706
|
+
if (!r.handled) {
|
|
707
|
+
if (this.interceptor)
|
|
708
|
+
this.interceptor.error(config, r);
|
|
709
|
+
}
|
|
710
|
+
this.handleComplete(complete, config);
|
|
711
|
+
}
|
|
712
|
+
mapOptions(options) {
|
|
713
|
+
let headers = new HttpHeaders();
|
|
714
|
+
for (const key in options.headers) {
|
|
715
|
+
if (options.headers.hasOwnProperty(key)) {
|
|
716
|
+
const value = options.headers[key];
|
|
717
|
+
headers = headers.set(key, value);
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
let params = new HttpParams();
|
|
721
|
+
for (const key in options.params) {
|
|
722
|
+
if (options.params.hasOwnProperty(key)) {
|
|
723
|
+
const value = options.params[key];
|
|
724
|
+
params = params.set(key, value);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return {
|
|
728
|
+
headers: headers,
|
|
729
|
+
params: params,
|
|
730
|
+
body: options.body,
|
|
731
|
+
responseType: options.responseType || 'json'
|
|
732
|
+
};
|
|
733
|
+
// if (options.method == "get") {
|
|
734
|
+
// return {
|
|
735
|
+
// headers: headers,
|
|
736
|
+
// params: params
|
|
737
|
+
// };
|
|
738
|
+
// }
|
|
739
|
+
// else {
|
|
740
|
+
// return {
|
|
741
|
+
// headers: headers,
|
|
742
|
+
// params: params,
|
|
743
|
+
// body: options.body
|
|
744
|
+
// };
|
|
745
|
+
// }
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
AXHttpService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpService, deps: [{ token: i1.HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
749
|
+
AXHttpService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpService });
|
|
750
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpService, decorators: [{
|
|
751
|
+
type: Injectable
|
|
752
752
|
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i0.Injector }]; } });
|
|
753
753
|
|
|
754
|
-
class AXHttpModule {
|
|
755
|
-
static forRoot() {
|
|
756
|
-
return {
|
|
757
|
-
ngModule: AXHttpModule,
|
|
758
|
-
providers: [AXHttpService]
|
|
759
|
-
};
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
AXHttpModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
763
|
-
AXHttpModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpModule, imports: [CommonModule,
|
|
764
|
-
HttpClientModule], exports: [HttpClientModule] });
|
|
765
|
-
AXHttpModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpModule, providers: [
|
|
766
|
-
AXHttpService
|
|
767
|
-
], imports: [[
|
|
768
|
-
CommonModule,
|
|
769
|
-
HttpClientModule
|
|
770
|
-
], HttpClientModule] });
|
|
771
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpModule, decorators: [{
|
|
772
|
-
type: NgModule,
|
|
773
|
-
args: [{
|
|
774
|
-
declarations: [],
|
|
775
|
-
imports: [
|
|
776
|
-
CommonModule,
|
|
777
|
-
HttpClientModule
|
|
778
|
-
],
|
|
779
|
-
exports: [HttpClientModule],
|
|
780
|
-
providers: [
|
|
781
|
-
AXHttpService
|
|
782
|
-
]
|
|
783
|
-
}]
|
|
754
|
+
class AXHttpModule {
|
|
755
|
+
static forRoot() {
|
|
756
|
+
return {
|
|
757
|
+
ngModule: AXHttpModule,
|
|
758
|
+
providers: [AXHttpService]
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
AXHttpModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
763
|
+
AXHttpModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpModule, imports: [CommonModule,
|
|
764
|
+
HttpClientModule], exports: [HttpClientModule] });
|
|
765
|
+
AXHttpModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpModule, providers: [
|
|
766
|
+
AXHttpService
|
|
767
|
+
], imports: [[
|
|
768
|
+
CommonModule,
|
|
769
|
+
HttpClientModule
|
|
770
|
+
], HttpClientModule] });
|
|
771
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHttpModule, decorators: [{
|
|
772
|
+
type: NgModule,
|
|
773
|
+
args: [{
|
|
774
|
+
declarations: [],
|
|
775
|
+
imports: [
|
|
776
|
+
CommonModule,
|
|
777
|
+
HttpClientModule
|
|
778
|
+
],
|
|
779
|
+
exports: [HttpClientModule],
|
|
780
|
+
providers: [
|
|
781
|
+
AXHttpService
|
|
782
|
+
]
|
|
783
|
+
}]
|
|
784
784
|
}] });
|
|
785
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 isTouch = (win) => matchMedia(win, '(any-pointer:coarse)');
|
|
830
|
-
const isDesktop = (win) => !isMobile(win);
|
|
831
|
-
const isHybrid = (win) => isCordova(win) || isCapacitorNative(win);
|
|
832
|
-
const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
|
|
833
|
-
const isCapacitorNative = (win) => {
|
|
834
|
-
const capacitor = win['Capacitor'];
|
|
835
|
-
return !!(capacitor && capacitor.isNative);
|
|
836
|
-
};
|
|
837
|
-
const isElectron = (win) => testUserAgent(win, /electron/i);
|
|
838
|
-
const isPWA = (win) => !!(win.matchMedia('(display-mode: standalone)').matches || win.navigator.standalone);
|
|
839
|
-
const testUserAgent = (win, expr) => expr.test(win.navigator.userAgent);
|
|
840
|
-
const matchMedia = (win, query) => win.matchMedia(query).matches;
|
|
841
|
-
const isSMScreen = (win) => matchMedia(win, '(max-width: 640px)');
|
|
842
|
-
const isMDScreen = (win) => matchMedia(win, '(max-width: 768px)');
|
|
843
|
-
const isLGScreen = (win) => matchMedia(win, '(max-width: 1024px)');
|
|
844
|
-
const isXLScreen = (win) => matchMedia(win, '(max-width: 1280px)');
|
|
845
|
-
const is2XLScreen = (win) => matchMedia(win, '(max-width: 1536px)');
|
|
846
|
-
const PLATFORMS_MAP = {
|
|
847
|
-
'Android': isAndroid,
|
|
848
|
-
'iOS': isIOS,
|
|
849
|
-
'Desktop': isDesktop,
|
|
850
|
-
'Mobile': isMobile,
|
|
851
|
-
'Touch': isTouch,
|
|
852
|
-
'Chrome': isChrome,
|
|
853
|
-
'Firefox': isFirefox,
|
|
854
|
-
'Safari': isSafari,
|
|
855
|
-
'Edge': isEdge,
|
|
856
|
-
'Opera': isOpera,
|
|
857
|
-
'Hybrid': isHybrid,
|
|
858
|
-
'PWA': isPWA,
|
|
859
|
-
'Electron': isElectron,
|
|
860
|
-
SM: isSMScreen,
|
|
861
|
-
MD: isMDScreen,
|
|
862
|
-
LG: isLGScreen,
|
|
863
|
-
XL: isXLScreen,
|
|
864
|
-
"2XL": is2XLScreen,
|
|
865
|
-
};
|
|
866
|
-
class AXPlatformEvent {
|
|
867
|
-
}
|
|
868
|
-
class AXPlatform {
|
|
869
|
-
constructor() {
|
|
870
|
-
this.resize = new Subject();
|
|
871
|
-
this.click = new Subject();
|
|
872
|
-
this.scroll = new Subject();
|
|
873
|
-
fromEvent(window, 'resize')
|
|
874
|
-
.pipe(debounceTime(100))
|
|
875
|
-
.pipe(distinctUntilChanged())
|
|
876
|
-
.subscribe((e) => {
|
|
877
|
-
this.resize.next({
|
|
878
|
-
nativeEvent: e,
|
|
879
|
-
source: this
|
|
880
|
-
});
|
|
881
|
-
//
|
|
882
|
-
this._setFullHeightRatio();
|
|
883
|
-
});
|
|
884
|
-
document.addEventListener('click', (e) => {
|
|
885
|
-
this.click.next({
|
|
886
|
-
nativeEvent: e,
|
|
887
|
-
source: this
|
|
888
|
-
});
|
|
889
|
-
}, true);
|
|
890
|
-
document.addEventListener('scroll', (e) => {
|
|
891
|
-
this.scroll.next({
|
|
892
|
-
nativeEvent: e,
|
|
893
|
-
source: this
|
|
894
|
-
});
|
|
895
|
-
}, true);
|
|
896
|
-
// init functions
|
|
897
|
-
this._setFullHeightRatio();
|
|
898
|
-
}
|
|
899
|
-
isRtl() {
|
|
900
|
-
return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';
|
|
901
|
-
}
|
|
902
|
-
isLandscape() {
|
|
903
|
-
return window.innerHeight < window.innerWidth;
|
|
904
|
-
}
|
|
905
|
-
isPortrate() {
|
|
906
|
-
return !this.isLandscape();
|
|
907
|
-
}
|
|
908
|
-
is(name) {
|
|
909
|
-
return PLATFORMS_MAP[name](window) || false;
|
|
910
|
-
}
|
|
911
|
-
switchDarkMode() {
|
|
912
|
-
const _html = document.getElementsByTagName("html")[0];
|
|
913
|
-
_html.classList.add('ax-dark');
|
|
914
|
-
}
|
|
915
|
-
switchLightMode() {
|
|
916
|
-
const _html = document.getElementsByTagName("html")[0];
|
|
917
|
-
_html.classList.remove('ax-dark');
|
|
918
|
-
}
|
|
919
|
-
_setFullHeightRatio() {
|
|
920
|
-
document.querySelector(':root').style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
924
|
-
AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXPlatform, providedIn: 'root' });
|
|
925
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXPlatform, decorators: [{
|
|
926
|
-
type: Injectable,
|
|
927
|
-
args: [{
|
|
928
|
-
providedIn: 'root',
|
|
929
|
-
}]
|
|
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 isTouch = (win) => matchMedia(win, '(any-pointer:coarse)');
|
|
830
|
+
const isDesktop = (win) => !isMobile(win);
|
|
831
|
+
const isHybrid = (win) => isCordova(win) || isCapacitorNative(win);
|
|
832
|
+
const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
|
|
833
|
+
const isCapacitorNative = (win) => {
|
|
834
|
+
const capacitor = win['Capacitor'];
|
|
835
|
+
return !!(capacitor && capacitor.isNative);
|
|
836
|
+
};
|
|
837
|
+
const isElectron = (win) => testUserAgent(win, /electron/i);
|
|
838
|
+
const isPWA = (win) => !!(win.matchMedia('(display-mode: standalone)').matches || win.navigator.standalone);
|
|
839
|
+
const testUserAgent = (win, expr) => expr.test(win.navigator.userAgent);
|
|
840
|
+
const matchMedia = (win, query) => win.matchMedia(query).matches;
|
|
841
|
+
const isSMScreen = (win) => matchMedia(win, '(max-width: 640px)');
|
|
842
|
+
const isMDScreen = (win) => matchMedia(win, '(max-width: 768px)');
|
|
843
|
+
const isLGScreen = (win) => matchMedia(win, '(max-width: 1024px)');
|
|
844
|
+
const isXLScreen = (win) => matchMedia(win, '(max-width: 1280px)');
|
|
845
|
+
const is2XLScreen = (win) => matchMedia(win, '(max-width: 1536px)');
|
|
846
|
+
const PLATFORMS_MAP = {
|
|
847
|
+
'Android': isAndroid,
|
|
848
|
+
'iOS': isIOS,
|
|
849
|
+
'Desktop': isDesktop,
|
|
850
|
+
'Mobile': isMobile,
|
|
851
|
+
'Touch': isTouch,
|
|
852
|
+
'Chrome': isChrome,
|
|
853
|
+
'Firefox': isFirefox,
|
|
854
|
+
'Safari': isSafari,
|
|
855
|
+
'Edge': isEdge,
|
|
856
|
+
'Opera': isOpera,
|
|
857
|
+
'Hybrid': isHybrid,
|
|
858
|
+
'PWA': isPWA,
|
|
859
|
+
'Electron': isElectron,
|
|
860
|
+
SM: isSMScreen,
|
|
861
|
+
MD: isMDScreen,
|
|
862
|
+
LG: isLGScreen,
|
|
863
|
+
XL: isXLScreen,
|
|
864
|
+
"2XL": is2XLScreen,
|
|
865
|
+
};
|
|
866
|
+
class AXPlatformEvent {
|
|
867
|
+
}
|
|
868
|
+
class AXPlatform {
|
|
869
|
+
constructor() {
|
|
870
|
+
this.resize = new Subject();
|
|
871
|
+
this.click = new Subject();
|
|
872
|
+
this.scroll = new Subject();
|
|
873
|
+
fromEvent(window, 'resize')
|
|
874
|
+
.pipe(debounceTime(100))
|
|
875
|
+
.pipe(distinctUntilChanged())
|
|
876
|
+
.subscribe((e) => {
|
|
877
|
+
this.resize.next({
|
|
878
|
+
nativeEvent: e,
|
|
879
|
+
source: this
|
|
880
|
+
});
|
|
881
|
+
//
|
|
882
|
+
this._setFullHeightRatio();
|
|
883
|
+
});
|
|
884
|
+
document.addEventListener('click', (e) => {
|
|
885
|
+
this.click.next({
|
|
886
|
+
nativeEvent: e,
|
|
887
|
+
source: this
|
|
888
|
+
});
|
|
889
|
+
}, true);
|
|
890
|
+
document.addEventListener('scroll', (e) => {
|
|
891
|
+
this.scroll.next({
|
|
892
|
+
nativeEvent: e,
|
|
893
|
+
source: this
|
|
894
|
+
});
|
|
895
|
+
}, true);
|
|
896
|
+
// init functions
|
|
897
|
+
this._setFullHeightRatio();
|
|
898
|
+
}
|
|
899
|
+
isRtl() {
|
|
900
|
+
return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';
|
|
901
|
+
}
|
|
902
|
+
isLandscape() {
|
|
903
|
+
return window.innerHeight < window.innerWidth;
|
|
904
|
+
}
|
|
905
|
+
isPortrate() {
|
|
906
|
+
return !this.isLandscape();
|
|
907
|
+
}
|
|
908
|
+
is(name) {
|
|
909
|
+
return PLATFORMS_MAP[name](window) || false;
|
|
910
|
+
}
|
|
911
|
+
switchDarkMode() {
|
|
912
|
+
const _html = document.getElementsByTagName("html")[0];
|
|
913
|
+
_html.classList.add('ax-dark');
|
|
914
|
+
}
|
|
915
|
+
switchLightMode() {
|
|
916
|
+
const _html = document.getElementsByTagName("html")[0];
|
|
917
|
+
_html.classList.remove('ax-dark');
|
|
918
|
+
}
|
|
919
|
+
_setFullHeightRatio() {
|
|
920
|
+
document.querySelector(':root').style.setProperty('--ax-vh', window.innerHeight / 100 + 'px');
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
924
|
+
AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXPlatform, providedIn: 'root' });
|
|
925
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXPlatform, decorators: [{
|
|
926
|
+
type: Injectable,
|
|
927
|
+
args: [{
|
|
928
|
+
providedIn: 'root',
|
|
929
|
+
}]
|
|
930
930
|
}], ctorParameters: function () { return []; } });
|
|
931
931
|
|
|
932
|
-
class AXDateTimePipe {
|
|
933
|
-
constructor() { }
|
|
934
|
-
transform(value, format) {
|
|
935
|
-
const date = AXDateTime.convert(value);
|
|
936
|
-
if (value == null) {
|
|
937
|
-
return '';
|
|
938
|
-
}
|
|
939
|
-
if (!format) {
|
|
940
|
-
return date.toString();
|
|
941
|
-
}
|
|
942
|
-
else {
|
|
943
|
-
return date.format(format);
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
AXDateTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
948
|
-
AXDateTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXDateTimePipe, name: "dt" });
|
|
949
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXDateTimePipe, decorators: [{
|
|
950
|
-
type: Pipe,
|
|
951
|
-
args: [{ name: 'dt' }]
|
|
932
|
+
class AXDateTimePipe {
|
|
933
|
+
constructor() { }
|
|
934
|
+
transform(value, format) {
|
|
935
|
+
const date = AXDateTime.convert(value);
|
|
936
|
+
if (value == null) {
|
|
937
|
+
return '';
|
|
938
|
+
}
|
|
939
|
+
if (!format) {
|
|
940
|
+
return date.toString();
|
|
941
|
+
}
|
|
942
|
+
else {
|
|
943
|
+
return date.format(format);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
AXDateTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
948
|
+
AXDateTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXDateTimePipe, name: "dt" });
|
|
949
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXDateTimePipe, decorators: [{
|
|
950
|
+
type: Pipe,
|
|
951
|
+
args: [{ name: 'dt' }]
|
|
952
952
|
}], ctorParameters: function () { return []; } });
|
|
953
953
|
|
|
954
|
-
class AXHtmlToTextPipe {
|
|
955
|
-
transform(value) {
|
|
956
|
-
if (value) {
|
|
957
|
-
const regexHtml = /<\/?[^>]+>/gi;
|
|
958
|
-
const regexNbsp = / /gi;
|
|
959
|
-
const regexAmp = /&/gi;
|
|
960
|
-
return value
|
|
961
|
-
.replace(regexHtml, '')
|
|
962
|
-
.replace(regexNbsp, '')
|
|
963
|
-
.replace(regexAmp, '');
|
|
964
|
-
}
|
|
965
|
-
else {
|
|
966
|
-
return '';
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
AXHtmlToTextPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlToTextPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
971
|
-
AXHtmlToTextPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlToTextPipe, name: "html2text" });
|
|
972
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlToTextPipe, decorators: [{
|
|
973
|
-
type: Pipe,
|
|
974
|
-
args: [{ name: 'html2text' }]
|
|
954
|
+
class AXHtmlToTextPipe {
|
|
955
|
+
transform(value) {
|
|
956
|
+
if (value) {
|
|
957
|
+
const regexHtml = /<\/?[^>]+>/gi;
|
|
958
|
+
const regexNbsp = / /gi;
|
|
959
|
+
const regexAmp = /&/gi;
|
|
960
|
+
return value
|
|
961
|
+
.replace(regexHtml, '')
|
|
962
|
+
.replace(regexNbsp, '')
|
|
963
|
+
.replace(regexAmp, '');
|
|
964
|
+
}
|
|
965
|
+
else {
|
|
966
|
+
return '';
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
AXHtmlToTextPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlToTextPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
971
|
+
AXHtmlToTextPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlToTextPipe, name: "html2text" });
|
|
972
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlToTextPipe, decorators: [{
|
|
973
|
+
type: Pipe,
|
|
974
|
+
args: [{ name: 'html2text' }]
|
|
975
975
|
}] });
|
|
976
976
|
|
|
977
|
-
class AXEventService {
|
|
978
|
-
constructor() {
|
|
979
|
-
this.list = [];
|
|
980
|
-
}
|
|
981
|
-
broadcast(key, options) {
|
|
982
|
-
const d = this.list.find(c => c.key === key);
|
|
983
|
-
if (d) {
|
|
984
|
-
d.events.forEach(c => {
|
|
985
|
-
c(options);
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
on(key, callback) {
|
|
990
|
-
let d = this.list.find(c => c.key === key);
|
|
991
|
-
if (!d) {
|
|
992
|
-
d = { key, events: [] };
|
|
993
|
-
this.list.push(d);
|
|
994
|
-
}
|
|
995
|
-
d.events.push(callback);
|
|
996
|
-
}
|
|
997
|
-
destroy(key, callback) {
|
|
998
|
-
const d = this.list.find(c => c.key === key);
|
|
999
|
-
if (d) {
|
|
1000
|
-
d.events = [];
|
|
1001
|
-
}
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
AXEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1005
|
-
AXEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXEventService, providedIn: 'root' });
|
|
1006
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXEventService, decorators: [{
|
|
1007
|
-
type: Injectable,
|
|
1008
|
-
args: [{ providedIn: 'root' }]
|
|
977
|
+
class AXEventService {
|
|
978
|
+
constructor() {
|
|
979
|
+
this.list = [];
|
|
980
|
+
}
|
|
981
|
+
broadcast(key, options) {
|
|
982
|
+
const d = this.list.find(c => c.key === key);
|
|
983
|
+
if (d) {
|
|
984
|
+
d.events.forEach(c => {
|
|
985
|
+
c(options);
|
|
986
|
+
});
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
on(key, callback) {
|
|
990
|
+
let d = this.list.find(c => c.key === key);
|
|
991
|
+
if (!d) {
|
|
992
|
+
d = { key, events: [] };
|
|
993
|
+
this.list.push(d);
|
|
994
|
+
}
|
|
995
|
+
d.events.push(callback);
|
|
996
|
+
}
|
|
997
|
+
destroy(key, callback) {
|
|
998
|
+
const d = this.list.find(c => c.key === key);
|
|
999
|
+
if (d) {
|
|
1000
|
+
d.events = [];
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
AXEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1005
|
+
AXEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXEventService, providedIn: 'root' });
|
|
1006
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXEventService, decorators: [{
|
|
1007
|
+
type: Injectable,
|
|
1008
|
+
args: [{ providedIn: 'root' }]
|
|
1009
1009
|
}] });
|
|
1010
1010
|
|
|
1011
|
-
class AXNavigator {
|
|
1012
|
-
}
|
|
1013
|
-
AXNavigator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXNavigator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1014
|
-
AXNavigator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXNavigator });
|
|
1015
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXNavigator, decorators: [{
|
|
1016
|
-
type: Injectable
|
|
1011
|
+
class AXNavigator {
|
|
1012
|
+
}
|
|
1013
|
+
AXNavigator.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXNavigator, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1014
|
+
AXNavigator.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXNavigator });
|
|
1015
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXNavigator, decorators: [{
|
|
1016
|
+
type: Injectable
|
|
1017
1017
|
}] });
|
|
1018
1018
|
|
|
1019
|
-
class AXStorageService {
|
|
1020
|
-
get(key) {
|
|
1021
|
-
return localStorage.getItem(key);
|
|
1022
|
-
}
|
|
1023
|
-
set(key, value) {
|
|
1024
|
-
localStorage.setItem(key, value);
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
AXStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1028
|
-
AXStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXStorageService });
|
|
1029
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXStorageService, decorators: [{
|
|
1030
|
-
type: Injectable
|
|
1019
|
+
class AXStorageService {
|
|
1020
|
+
get(key) {
|
|
1021
|
+
return localStorage.getItem(key);
|
|
1022
|
+
}
|
|
1023
|
+
set(key, value) {
|
|
1024
|
+
localStorage.setItem(key, value);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
AXStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1028
|
+
AXStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXStorageService });
|
|
1029
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXStorageService, decorators: [{
|
|
1030
|
+
type: Injectable
|
|
1031
1031
|
}] });
|
|
1032
1032
|
|
|
1033
|
-
// @dynamic
|
|
1034
|
-
class AXTranslator {
|
|
1035
|
-
static get onChange() {
|
|
1036
|
-
return AXTranslator.dataChangeSubject.asObservable();
|
|
1037
|
-
}
|
|
1038
|
-
static load(lang, value) {
|
|
1039
|
-
if (typeof value === 'object') {
|
|
1040
|
-
if (!AXTranslator[`__data__${lang}`]) {
|
|
1041
|
-
AXTranslator[`__data__${lang}`] = {};
|
|
1042
|
-
}
|
|
1043
|
-
AXTranslator[`__data__${lang}`] = merge(AXTranslator[`__data__${lang}`], value);
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
static use(lang) {
|
|
1047
|
-
AXTranslator.lang = lang;
|
|
1048
|
-
}
|
|
1049
|
-
static get(key, lang) {
|
|
1050
|
-
return getPropByPath(AXTranslator[`__data__${lang || AXTranslator.lang}`], key) || key;
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
AXTranslator.lang = 'en';
|
|
1033
|
+
// @dynamic
|
|
1034
|
+
class AXTranslator {
|
|
1035
|
+
static get onChange() {
|
|
1036
|
+
return AXTranslator.dataChangeSubject.asObservable();
|
|
1037
|
+
}
|
|
1038
|
+
static load(lang, value) {
|
|
1039
|
+
if (typeof value === 'object') {
|
|
1040
|
+
if (!AXTranslator[`__data__${lang}`]) {
|
|
1041
|
+
AXTranslator[`__data__${lang}`] = {};
|
|
1042
|
+
}
|
|
1043
|
+
AXTranslator[`__data__${lang}`] = merge(AXTranslator[`__data__${lang}`], value);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
static use(lang) {
|
|
1047
|
+
AXTranslator.lang = lang;
|
|
1048
|
+
}
|
|
1049
|
+
static get(key, lang) {
|
|
1050
|
+
return getPropByPath(AXTranslator[`__data__${lang || AXTranslator.lang}`], key) || key;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
AXTranslator.lang = 'en';
|
|
1054
1054
|
AXTranslator.dataChangeSubject = new Subject();
|
|
1055
1055
|
|
|
1056
|
-
class AXTranslatorService {
|
|
1057
|
-
load(lang, value) {
|
|
1058
|
-
AXTranslator.load(lang, value);
|
|
1059
|
-
}
|
|
1060
|
-
use(lang) {
|
|
1061
|
-
AXTranslator.use(lang);
|
|
1062
|
-
}
|
|
1063
|
-
get(key, lang) {
|
|
1064
|
-
return AXTranslator.get(lang, lang);
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
AXTranslatorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1068
|
-
AXTranslatorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorService, providedIn: 'platform' });
|
|
1069
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorService, decorators: [{
|
|
1070
|
-
type: Injectable,
|
|
1071
|
-
args: [{ providedIn: 'platform' }]
|
|
1056
|
+
class AXTranslatorService {
|
|
1057
|
+
load(lang, value) {
|
|
1058
|
+
AXTranslator.load(lang, value);
|
|
1059
|
+
}
|
|
1060
|
+
use(lang) {
|
|
1061
|
+
AXTranslator.use(lang);
|
|
1062
|
+
}
|
|
1063
|
+
get(key, lang) {
|
|
1064
|
+
return AXTranslator.get(lang, lang);
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
AXTranslatorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1068
|
+
AXTranslatorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorService, providedIn: 'platform' });
|
|
1069
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorService, decorators: [{
|
|
1070
|
+
type: Injectable,
|
|
1071
|
+
args: [{ providedIn: 'platform' }]
|
|
1072
1072
|
}] });
|
|
1073
1073
|
|
|
1074
|
-
class AXTranslatorPipe {
|
|
1075
|
-
constructor() { }
|
|
1076
|
-
// transform(value: string, lang?: string): Promise<string> {
|
|
1077
|
-
// return new Promise<string>((resolve, reject) => {
|
|
1078
|
-
// if (!value) {
|
|
1079
|
-
// resolve(value);
|
|
1080
|
-
// }
|
|
1081
|
-
// resolve(this.translate.get(value, lang));
|
|
1082
|
-
// });
|
|
1083
|
-
// }
|
|
1084
|
-
transform(value, lang) {
|
|
1085
|
-
return AXTranslator.get(value, lang);
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1089
|
-
AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
|
|
1090
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorPipe, decorators: [{
|
|
1091
|
-
type: Pipe,
|
|
1092
|
-
args: [{ name: 'trans', pure: true }]
|
|
1074
|
+
class AXTranslatorPipe {
|
|
1075
|
+
constructor() { }
|
|
1076
|
+
// transform(value: string, lang?: string): Promise<string> {
|
|
1077
|
+
// return new Promise<string>((resolve, reject) => {
|
|
1078
|
+
// if (!value) {
|
|
1079
|
+
// resolve(value);
|
|
1080
|
+
// }
|
|
1081
|
+
// resolve(this.translate.get(value, lang));
|
|
1082
|
+
// });
|
|
1083
|
+
// }
|
|
1084
|
+
transform(value, lang) {
|
|
1085
|
+
return AXTranslator.get(value, lang);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1089
|
+
AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
|
|
1090
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorPipe, decorators: [{
|
|
1091
|
+
type: Pipe,
|
|
1092
|
+
args: [{ name: 'trans', pure: true }]
|
|
1093
1093
|
}], ctorParameters: function () { return []; } });
|
|
1094
1094
|
|
|
1095
1095
|
var common$1 = {
|
|
@@ -1624,646 +1624,646 @@ var fa$1 = /*#__PURE__*/Object.freeze({
|
|
|
1624
1624
|
'default': fa
|
|
1625
1625
|
});
|
|
1626
1626
|
|
|
1627
|
-
class AXTranslatorModule {
|
|
1628
|
-
constructor() {
|
|
1629
|
-
AXTranslator.load('en', en$1);
|
|
1630
|
-
AXTranslator.load('fa', fa$1);
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
AXTranslatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1634
|
-
AXTranslatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
|
|
1635
|
-
AXTranslatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorModule, providers: [], imports: [[]] });
|
|
1636
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorModule, decorators: [{
|
|
1637
|
-
type: NgModule,
|
|
1638
|
-
args: [{
|
|
1639
|
-
imports: [],
|
|
1640
|
-
exports: [AXTranslatorPipe],
|
|
1641
|
-
declarations: [AXTranslatorPipe],
|
|
1642
|
-
providers: [],
|
|
1643
|
-
}]
|
|
1627
|
+
class AXTranslatorModule {
|
|
1628
|
+
constructor() {
|
|
1629
|
+
AXTranslator.load('en', en$1);
|
|
1630
|
+
AXTranslator.load('fa', fa$1);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
AXTranslatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1634
|
+
AXTranslatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
|
|
1635
|
+
AXTranslatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorModule, providers: [], imports: [[]] });
|
|
1636
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXTranslatorModule, decorators: [{
|
|
1637
|
+
type: NgModule,
|
|
1638
|
+
args: [{
|
|
1639
|
+
imports: [],
|
|
1640
|
+
exports: [AXTranslatorPipe],
|
|
1641
|
+
declarations: [AXTranslatorPipe],
|
|
1642
|
+
providers: [],
|
|
1643
|
+
}]
|
|
1644
1644
|
}], ctorParameters: function () { return []; } });
|
|
1645
1645
|
|
|
1646
|
-
// @dynamic
|
|
1647
|
-
class AXArrayUtil {
|
|
1648
|
-
static pickRandom(array) {
|
|
1649
|
-
return array[Math.floor(Math.random() * array.length)];
|
|
1650
|
-
}
|
|
1651
|
-
static insert(array, index, ...rest) {
|
|
1652
|
-
array.splice.apply(array, [index, 0].concat(Array.prototype.slice.call(rest, 1)));
|
|
1653
|
-
return array;
|
|
1654
|
-
}
|
|
1655
|
-
static range(min, max) {
|
|
1656
|
-
return new Array(max - min).fill(1).map((d, i) => i);
|
|
1657
|
-
}
|
|
1658
|
-
static filter(array, filters) {
|
|
1659
|
-
if (filters == null || filters.length === 0) {
|
|
1660
|
-
return array;
|
|
1661
|
-
}
|
|
1662
|
-
const lamda = (item) => {
|
|
1663
|
-
let result = true;
|
|
1664
|
-
for (const key in filters) {
|
|
1665
|
-
if (filters.hasOwnProperty(key)) {
|
|
1666
|
-
const f = filters[key];
|
|
1667
|
-
if (f !== 'AND') {
|
|
1668
|
-
const vals = [];
|
|
1669
|
-
const mt = f.field.match(/\[\:(.*?)\]/);
|
|
1670
|
-
if (mt && mt.length > 1) {
|
|
1671
|
-
const p1 = f.field.replace(mt[0], '');
|
|
1672
|
-
const p2 = mt[1];
|
|
1673
|
-
const prop = AXFetchProp(item, p1);
|
|
1674
|
-
if (prop instanceof Array && prop.length) {
|
|
1675
|
-
vals.push(...prop.map(m => (AXFetchProp(m, p2))));
|
|
1676
|
-
}
|
|
1677
|
-
else {
|
|
1678
|
-
result = false;
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
else {
|
|
1682
|
-
vals.push(AXFetchProp(item, f.field));
|
|
1683
|
-
}
|
|
1684
|
-
for (const j in vals) {
|
|
1685
|
-
if (vals.hasOwnProperty(j)) {
|
|
1686
|
-
let v1 = vals[j];
|
|
1687
|
-
const v2 = f.value;
|
|
1688
|
-
if (f.dataType === 'string') {
|
|
1689
|
-
v1 = v1.toString();
|
|
1690
|
-
switch (f.condition) {
|
|
1691
|
-
case 'equal':
|
|
1692
|
-
result = (v1 && v2) && v1.toLowerCase() === v2.toLowerCase();
|
|
1693
|
-
break;
|
|
1694
|
-
case 'not-equal':
|
|
1695
|
-
result = !((v1 && v2) && v1.toLowerCase() === v2.toLowerCase());
|
|
1696
|
-
break;
|
|
1697
|
-
case 'contains':
|
|
1698
|
-
result = ((v1 && v2) && (v1.toLowerCase().includes(v2.toLowerCase())));
|
|
1699
|
-
break;
|
|
1700
|
-
case 'not-contains':
|
|
1701
|
-
result = !((v1 && v2) && (v1.toLowerCase().includes(v2.toLowerCase())));
|
|
1702
|
-
break;
|
|
1703
|
-
case 'start-with':
|
|
1704
|
-
result = ((v1 && v2) && (v1.toLowerCase().startsWith(v2.toLowerCase())));
|
|
1705
|
-
break;
|
|
1706
|
-
case 'end-with':
|
|
1707
|
-
result = ((v1 && v2) && (v1.toLowerCase().endsWith(v2.toLowerCase())));
|
|
1708
|
-
break;
|
|
1709
|
-
case 'is-empty':
|
|
1710
|
-
result = v1 == null || v1 === undefined;
|
|
1711
|
-
break;
|
|
1712
|
-
case 'is-not-empty':
|
|
1713
|
-
result = !(v1 == null || v1 === undefined);
|
|
1714
|
-
break;
|
|
1715
|
-
default:
|
|
1716
|
-
console.error('The condition is not defined');
|
|
1717
|
-
result = false;
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
else if (f.dataType === 'date') {
|
|
1721
|
-
}
|
|
1722
|
-
else if (f.dataType === 'number') {
|
|
1723
|
-
v1 = Number(v1);
|
|
1724
|
-
switch (f.condition) {
|
|
1725
|
-
case 'equal':
|
|
1726
|
-
result = v1 === v2;
|
|
1727
|
-
break;
|
|
1728
|
-
case 'not-equal':
|
|
1729
|
-
result = v1 !== v2;
|
|
1730
|
-
break;
|
|
1731
|
-
case 'contains':
|
|
1732
|
-
result = v2 && v2 instanceof Array && v2.includes(v1);
|
|
1733
|
-
break;
|
|
1734
|
-
case 'less-than':
|
|
1735
|
-
result = v1 < v2;
|
|
1736
|
-
break;
|
|
1737
|
-
case 'less-than-equal':
|
|
1738
|
-
result = v1 <= v2;
|
|
1739
|
-
break;
|
|
1740
|
-
case 'greater-than':
|
|
1741
|
-
result = v1 > v2;
|
|
1742
|
-
break;
|
|
1743
|
-
case 'greater-than-equal':
|
|
1744
|
-
result = v1 >= v2;
|
|
1745
|
-
break;
|
|
1746
|
-
case 'is-empty':
|
|
1747
|
-
result = v1 == null || v1 === undefined;
|
|
1748
|
-
break;
|
|
1749
|
-
case 'is-not-empty':
|
|
1750
|
-
result = !(v1 == null || v1 === undefined);
|
|
1751
|
-
break;
|
|
1752
|
-
default:
|
|
1753
|
-
console.error('The condition is not defined');
|
|
1754
|
-
result = false;
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
else {
|
|
1758
|
-
console.error('The datatype is not supported');
|
|
1759
|
-
result = false;
|
|
1760
|
-
}
|
|
1761
|
-
if (result) {
|
|
1762
|
-
break;
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
if (!result) {
|
|
1768
|
-
return false;
|
|
1769
|
-
}
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
return true;
|
|
1773
|
-
};
|
|
1774
|
-
return array.filter(lamda);
|
|
1775
|
-
}
|
|
1646
|
+
// @dynamic
|
|
1647
|
+
class AXArrayUtil {
|
|
1648
|
+
static pickRandom(array) {
|
|
1649
|
+
return array[Math.floor(Math.random() * array.length)];
|
|
1650
|
+
}
|
|
1651
|
+
static insert(array, index, ...rest) {
|
|
1652
|
+
array.splice.apply(array, [index, 0].concat(Array.prototype.slice.call(rest, 1)));
|
|
1653
|
+
return array;
|
|
1654
|
+
}
|
|
1655
|
+
static range(min, max) {
|
|
1656
|
+
return new Array(max - min).fill(1).map((d, i) => i);
|
|
1657
|
+
}
|
|
1658
|
+
static filter(array, filters) {
|
|
1659
|
+
if (filters == null || filters.length === 0) {
|
|
1660
|
+
return array;
|
|
1661
|
+
}
|
|
1662
|
+
const lamda = (item) => {
|
|
1663
|
+
let result = true;
|
|
1664
|
+
for (const key in filters) {
|
|
1665
|
+
if (filters.hasOwnProperty(key)) {
|
|
1666
|
+
const f = filters[key];
|
|
1667
|
+
if (f !== 'AND') {
|
|
1668
|
+
const vals = [];
|
|
1669
|
+
const mt = f.field.match(/\[\:(.*?)\]/);
|
|
1670
|
+
if (mt && mt.length > 1) {
|
|
1671
|
+
const p1 = f.field.replace(mt[0], '');
|
|
1672
|
+
const p2 = mt[1];
|
|
1673
|
+
const prop = AXFetchProp(item, p1);
|
|
1674
|
+
if (prop instanceof Array && prop.length) {
|
|
1675
|
+
vals.push(...prop.map(m => (AXFetchProp(m, p2))));
|
|
1676
|
+
}
|
|
1677
|
+
else {
|
|
1678
|
+
result = false;
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
else {
|
|
1682
|
+
vals.push(AXFetchProp(item, f.field));
|
|
1683
|
+
}
|
|
1684
|
+
for (const j in vals) {
|
|
1685
|
+
if (vals.hasOwnProperty(j)) {
|
|
1686
|
+
let v1 = vals[j];
|
|
1687
|
+
const v2 = f.value;
|
|
1688
|
+
if (f.dataType === 'string') {
|
|
1689
|
+
v1 = v1.toString();
|
|
1690
|
+
switch (f.condition) {
|
|
1691
|
+
case 'equal':
|
|
1692
|
+
result = (v1 && v2) && v1.toLowerCase() === v2.toLowerCase();
|
|
1693
|
+
break;
|
|
1694
|
+
case 'not-equal':
|
|
1695
|
+
result = !((v1 && v2) && v1.toLowerCase() === v2.toLowerCase());
|
|
1696
|
+
break;
|
|
1697
|
+
case 'contains':
|
|
1698
|
+
result = ((v1 && v2) && (v1.toLowerCase().includes(v2.toLowerCase())));
|
|
1699
|
+
break;
|
|
1700
|
+
case 'not-contains':
|
|
1701
|
+
result = !((v1 && v2) && (v1.toLowerCase().includes(v2.toLowerCase())));
|
|
1702
|
+
break;
|
|
1703
|
+
case 'start-with':
|
|
1704
|
+
result = ((v1 && v2) && (v1.toLowerCase().startsWith(v2.toLowerCase())));
|
|
1705
|
+
break;
|
|
1706
|
+
case 'end-with':
|
|
1707
|
+
result = ((v1 && v2) && (v1.toLowerCase().endsWith(v2.toLowerCase())));
|
|
1708
|
+
break;
|
|
1709
|
+
case 'is-empty':
|
|
1710
|
+
result = v1 == null || v1 === undefined;
|
|
1711
|
+
break;
|
|
1712
|
+
case 'is-not-empty':
|
|
1713
|
+
result = !(v1 == null || v1 === undefined);
|
|
1714
|
+
break;
|
|
1715
|
+
default:
|
|
1716
|
+
console.error('The condition is not defined');
|
|
1717
|
+
result = false;
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
else if (f.dataType === 'date') {
|
|
1721
|
+
}
|
|
1722
|
+
else if (f.dataType === 'number') {
|
|
1723
|
+
v1 = Number(v1);
|
|
1724
|
+
switch (f.condition) {
|
|
1725
|
+
case 'equal':
|
|
1726
|
+
result = v1 === v2;
|
|
1727
|
+
break;
|
|
1728
|
+
case 'not-equal':
|
|
1729
|
+
result = v1 !== v2;
|
|
1730
|
+
break;
|
|
1731
|
+
case 'contains':
|
|
1732
|
+
result = v2 && v2 instanceof Array && v2.includes(v1);
|
|
1733
|
+
break;
|
|
1734
|
+
case 'less-than':
|
|
1735
|
+
result = v1 < v2;
|
|
1736
|
+
break;
|
|
1737
|
+
case 'less-than-equal':
|
|
1738
|
+
result = v1 <= v2;
|
|
1739
|
+
break;
|
|
1740
|
+
case 'greater-than':
|
|
1741
|
+
result = v1 > v2;
|
|
1742
|
+
break;
|
|
1743
|
+
case 'greater-than-equal':
|
|
1744
|
+
result = v1 >= v2;
|
|
1745
|
+
break;
|
|
1746
|
+
case 'is-empty':
|
|
1747
|
+
result = v1 == null || v1 === undefined;
|
|
1748
|
+
break;
|
|
1749
|
+
case 'is-not-empty':
|
|
1750
|
+
result = !(v1 == null || v1 === undefined);
|
|
1751
|
+
break;
|
|
1752
|
+
default:
|
|
1753
|
+
console.error('The condition is not defined');
|
|
1754
|
+
result = false;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
else {
|
|
1758
|
+
console.error('The datatype is not supported');
|
|
1759
|
+
result = false;
|
|
1760
|
+
}
|
|
1761
|
+
if (result) {
|
|
1762
|
+
break;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
if (!result) {
|
|
1768
|
+
return false;
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
return true;
|
|
1773
|
+
};
|
|
1774
|
+
return array.filter(lamda);
|
|
1775
|
+
}
|
|
1776
1776
|
}
|
|
1777
1777
|
|
|
1778
|
-
class AXMathUtil {
|
|
1779
|
-
static randomRange(min, max) {
|
|
1780
|
-
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
1781
|
-
}
|
|
1778
|
+
class AXMathUtil {
|
|
1779
|
+
static randomRange(min, max) {
|
|
1780
|
+
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
1781
|
+
}
|
|
1782
1782
|
}
|
|
1783
1783
|
|
|
1784
|
-
class AXPoint {
|
|
1785
|
-
constructor(x, y) {
|
|
1786
|
-
this.x = x;
|
|
1787
|
-
this.y = y;
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
class AXClientRec {
|
|
1791
|
-
constructor(rec) {
|
|
1792
|
-
this._left = rec.left;
|
|
1793
|
-
this._top = rec.top;
|
|
1794
|
-
this._width = rec.width;
|
|
1795
|
-
this._height = rec.height;
|
|
1796
|
-
this._right = this._left + this._width;
|
|
1797
|
-
this._bottom = this._top + this._height;
|
|
1798
|
-
}
|
|
1799
|
-
get left() {
|
|
1800
|
-
return this._left;
|
|
1801
|
-
}
|
|
1802
|
-
set left(v) {
|
|
1803
|
-
this._left = v;
|
|
1804
|
-
}
|
|
1805
|
-
get top() {
|
|
1806
|
-
return this._top;
|
|
1807
|
-
}
|
|
1808
|
-
set top(v) {
|
|
1809
|
-
this._top = v;
|
|
1810
|
-
}
|
|
1811
|
-
get right() {
|
|
1812
|
-
return this._right;
|
|
1813
|
-
}
|
|
1814
|
-
set right(v) {
|
|
1815
|
-
this._right = v;
|
|
1816
|
-
}
|
|
1817
|
-
get bottom() {
|
|
1818
|
-
return this._bottom;
|
|
1819
|
-
}
|
|
1820
|
-
set bottom(v) {
|
|
1821
|
-
this._bottom = v;
|
|
1822
|
-
}
|
|
1823
|
-
get width() {
|
|
1824
|
-
return this._width;
|
|
1825
|
-
}
|
|
1826
|
-
set width(v) {
|
|
1827
|
-
this._width = v;
|
|
1828
|
-
}
|
|
1829
|
-
get height() {
|
|
1830
|
-
return this._height;
|
|
1831
|
-
}
|
|
1832
|
-
set height(v) {
|
|
1833
|
-
this._height = v;
|
|
1834
|
-
}
|
|
1835
|
-
intersect(rec) {
|
|
1836
|
-
return (this.left < rec.left + rec.width &&
|
|
1837
|
-
this.left + this.width > rec.left &&
|
|
1838
|
-
this.top < rec.top + rec.height &&
|
|
1839
|
-
this.top + this.height > rec.top);
|
|
1840
|
-
}
|
|
1841
|
-
}
|
|
1842
|
-
// @dynamic
|
|
1843
|
-
class AXHtmlUtil {
|
|
1844
|
-
static getBoundingRectPoint(el, placement) {
|
|
1845
|
-
const rec = el.getBoundingClientRect();
|
|
1846
|
-
const width = el.offsetWidth;
|
|
1847
|
-
const height = el.offsetHeight;
|
|
1848
|
-
switch (placement) {
|
|
1849
|
-
case 'top-start':
|
|
1850
|
-
return new AXPoint(rec.left, rec.top);
|
|
1851
|
-
case 'top-middle':
|
|
1852
|
-
return new AXPoint(rec.left + (width / 2), rec.top);
|
|
1853
|
-
case 'top-end':
|
|
1854
|
-
return new AXPoint(rec.left + (width), rec.top);
|
|
1855
|
-
case 'center-end':
|
|
1856
|
-
return new AXPoint(rec.left + (width), rec.top + (height / 2));
|
|
1857
|
-
case 'bottom-end':
|
|
1858
|
-
return new AXPoint(rec.left + (width), rec.top + (height));
|
|
1859
|
-
case 'bottom-middle':
|
|
1860
|
-
return new AXPoint(rec.left + (width / 2), rec.top + (height));
|
|
1861
|
-
case 'bottom-start':
|
|
1862
|
-
return new AXPoint(rec.left, rec.top + (height));
|
|
1863
|
-
case 'center-start':
|
|
1864
|
-
return new AXPoint(rec.left, rec.top + (height / 2));
|
|
1865
|
-
default:
|
|
1866
|
-
return new AXPoint(rec.left + (width / 2), rec.top + (height));
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
static isInRecPoint(pos, rec) {
|
|
1870
|
-
return pos.x >= rec.left && pos.x <= (rec.left + rec.width) && pos.y >= rec.top && (pos.y <= (rec.top + rec.height));
|
|
1871
|
-
}
|
|
1872
|
-
// static isOverLap(rec1: AXClientRecCtor, rec2: AXClientRecCtor): boolean {
|
|
1873
|
-
// const r1: AXClientRec = new AXClientRec(rec1);
|
|
1874
|
-
// const r2: AXClientRec = new AXClientRec(rec2);
|
|
1875
|
-
// return ;
|
|
1876
|
-
// }
|
|
1877
|
-
static isInElementBound(pos, element) {
|
|
1878
|
-
const elBound = element.getBoundingClientRect();
|
|
1879
|
-
return AXHtmlUtil.isInRecPoint(pos, {
|
|
1880
|
-
left: elBound.left,
|
|
1881
|
-
width: elBound.width,
|
|
1882
|
-
top: elBound.top,
|
|
1883
|
-
height: elBound.height
|
|
1884
|
-
});
|
|
1885
|
-
}
|
|
1886
|
-
static getDimensions() {
|
|
1887
|
-
let winW = 630;
|
|
1888
|
-
let winH = 460;
|
|
1889
|
-
if (document.body && document.body.offsetWidth) {
|
|
1890
|
-
winW = document.body.offsetWidth;
|
|
1891
|
-
winH = document.body.offsetHeight;
|
|
1892
|
-
}
|
|
1893
|
-
if (document.compatMode === 'CSS1Compat' && document.documentElement && document.documentElement.offsetWidth) {
|
|
1894
|
-
winW = document.documentElement.offsetWidth;
|
|
1895
|
-
winH = document.documentElement.offsetHeight;
|
|
1896
|
-
}
|
|
1897
|
-
if (window.innerWidth && window.innerHeight) {
|
|
1898
|
-
winW = window.innerWidth;
|
|
1899
|
-
winH = window.innerHeight;
|
|
1900
|
-
}
|
|
1901
|
-
return { width: winW, height: winH };
|
|
1902
|
-
}
|
|
1903
|
-
static getOffsetRight(elem) {
|
|
1904
|
-
let element = elem;
|
|
1905
|
-
const width = element.offsetWidth;
|
|
1906
|
-
let right = 0;
|
|
1907
|
-
while (element.offsetParent) {
|
|
1908
|
-
right += element.offsetLeft;
|
|
1909
|
-
element = element.offsetParent;
|
|
1910
|
-
}
|
|
1911
|
-
right += element.offsetLeft;
|
|
1912
|
-
right = AXHtmlUtil.getDimensions().width - right;
|
|
1913
|
-
right -= width;
|
|
1914
|
-
return right;
|
|
1915
|
-
}
|
|
1916
|
-
static getUID() {
|
|
1917
|
-
return 'el-' + AXMathUtil.randomRange(1000000000, 9999999999).toString();
|
|
1918
|
-
}
|
|
1919
|
-
static getRelatedPosition(source, placement, target, alignment) {
|
|
1920
|
-
const result = { x: 0, y: 0 };
|
|
1921
|
-
const sourcePos = AXHtmlUtil.getBoundingRectPoint(source, placement);
|
|
1922
|
-
let top = 0;
|
|
1923
|
-
let left = 0;
|
|
1924
|
-
switch (alignment) {
|
|
1925
|
-
case 'top-start':
|
|
1926
|
-
top = sourcePos.y;
|
|
1927
|
-
left = sourcePos.x;
|
|
1928
|
-
break;
|
|
1929
|
-
case 'top-middle':
|
|
1930
|
-
top = sourcePos.y;
|
|
1931
|
-
left = sourcePos.x - target.offsetWidth / 2;
|
|
1932
|
-
break;
|
|
1933
|
-
case 'top-end':
|
|
1934
|
-
top = sourcePos.y;
|
|
1935
|
-
left = sourcePos.x - target.offsetWidth;
|
|
1936
|
-
break;
|
|
1937
|
-
case 'center-end':
|
|
1938
|
-
top = sourcePos.y - target.offsetHeight / 2;
|
|
1939
|
-
left = sourcePos.x - target.offsetWidth;
|
|
1940
|
-
break;
|
|
1941
|
-
case 'bottom-end':
|
|
1942
|
-
top = sourcePos.y - target.offsetHeight;
|
|
1943
|
-
left = sourcePos.x - target.offsetWidth;
|
|
1944
|
-
break;
|
|
1945
|
-
case 'bottom-middle':
|
|
1946
|
-
top = sourcePos.y - target.offsetHeight;
|
|
1947
|
-
left = sourcePos.x - target.offsetWidth / 2;
|
|
1948
|
-
break;
|
|
1949
|
-
case 'bottom-start':
|
|
1950
|
-
top = sourcePos.y - target.offsetHeight;
|
|
1951
|
-
left = sourcePos.x;
|
|
1952
|
-
break;
|
|
1953
|
-
case 'center-start':
|
|
1954
|
-
top = sourcePos.y - target.offsetHeight / 2;
|
|
1955
|
-
left = sourcePos.x;
|
|
1956
|
-
break;
|
|
1957
|
-
}
|
|
1958
|
-
result.y = top;
|
|
1959
|
-
result.x = left;
|
|
1960
|
-
return result;
|
|
1961
|
-
}
|
|
1962
|
-
static collision(a, b) {
|
|
1963
|
-
const ac = a.getBoundingClientRect();
|
|
1964
|
-
const bc = b.getBoundingClientRect();
|
|
1965
|
-
if (ac.left < bc.left + bc.width && ac.left + ac.width > bc.left &&
|
|
1966
|
-
ac.top < bc.top + bc.height && ac.top + ac.height > bc.top) {
|
|
1967
|
-
return true;
|
|
1968
|
-
}
|
|
1969
|
-
else {
|
|
1970
|
-
return false;
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1784
|
+
class AXPoint {
|
|
1785
|
+
constructor(x, y) {
|
|
1786
|
+
this.x = x;
|
|
1787
|
+
this.y = y;
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
class AXClientRec {
|
|
1791
|
+
constructor(rec) {
|
|
1792
|
+
this._left = rec.left;
|
|
1793
|
+
this._top = rec.top;
|
|
1794
|
+
this._width = rec.width;
|
|
1795
|
+
this._height = rec.height;
|
|
1796
|
+
this._right = this._left + this._width;
|
|
1797
|
+
this._bottom = this._top + this._height;
|
|
1798
|
+
}
|
|
1799
|
+
get left() {
|
|
1800
|
+
return this._left;
|
|
1801
|
+
}
|
|
1802
|
+
set left(v) {
|
|
1803
|
+
this._left = v;
|
|
1804
|
+
}
|
|
1805
|
+
get top() {
|
|
1806
|
+
return this._top;
|
|
1807
|
+
}
|
|
1808
|
+
set top(v) {
|
|
1809
|
+
this._top = v;
|
|
1810
|
+
}
|
|
1811
|
+
get right() {
|
|
1812
|
+
return this._right;
|
|
1813
|
+
}
|
|
1814
|
+
set right(v) {
|
|
1815
|
+
this._right = v;
|
|
1816
|
+
}
|
|
1817
|
+
get bottom() {
|
|
1818
|
+
return this._bottom;
|
|
1819
|
+
}
|
|
1820
|
+
set bottom(v) {
|
|
1821
|
+
this._bottom = v;
|
|
1822
|
+
}
|
|
1823
|
+
get width() {
|
|
1824
|
+
return this._width;
|
|
1825
|
+
}
|
|
1826
|
+
set width(v) {
|
|
1827
|
+
this._width = v;
|
|
1828
|
+
}
|
|
1829
|
+
get height() {
|
|
1830
|
+
return this._height;
|
|
1831
|
+
}
|
|
1832
|
+
set height(v) {
|
|
1833
|
+
this._height = v;
|
|
1834
|
+
}
|
|
1835
|
+
intersect(rec) {
|
|
1836
|
+
return (this.left < rec.left + rec.width &&
|
|
1837
|
+
this.left + this.width > rec.left &&
|
|
1838
|
+
this.top < rec.top + rec.height &&
|
|
1839
|
+
this.top + this.height > rec.top);
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
// @dynamic
|
|
1843
|
+
class AXHtmlUtil {
|
|
1844
|
+
static getBoundingRectPoint(el, placement) {
|
|
1845
|
+
const rec = el.getBoundingClientRect();
|
|
1846
|
+
const width = el.offsetWidth;
|
|
1847
|
+
const height = el.offsetHeight;
|
|
1848
|
+
switch (placement) {
|
|
1849
|
+
case 'top-start':
|
|
1850
|
+
return new AXPoint(rec.left, rec.top);
|
|
1851
|
+
case 'top-middle':
|
|
1852
|
+
return new AXPoint(rec.left + (width / 2), rec.top);
|
|
1853
|
+
case 'top-end':
|
|
1854
|
+
return new AXPoint(rec.left + (width), rec.top);
|
|
1855
|
+
case 'center-end':
|
|
1856
|
+
return new AXPoint(rec.left + (width), rec.top + (height / 2));
|
|
1857
|
+
case 'bottom-end':
|
|
1858
|
+
return new AXPoint(rec.left + (width), rec.top + (height));
|
|
1859
|
+
case 'bottom-middle':
|
|
1860
|
+
return new AXPoint(rec.left + (width / 2), rec.top + (height));
|
|
1861
|
+
case 'bottom-start':
|
|
1862
|
+
return new AXPoint(rec.left, rec.top + (height));
|
|
1863
|
+
case 'center-start':
|
|
1864
|
+
return new AXPoint(rec.left, rec.top + (height / 2));
|
|
1865
|
+
default:
|
|
1866
|
+
return new AXPoint(rec.left + (width / 2), rec.top + (height));
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
static isInRecPoint(pos, rec) {
|
|
1870
|
+
return pos.x >= rec.left && pos.x <= (rec.left + rec.width) && pos.y >= rec.top && (pos.y <= (rec.top + rec.height));
|
|
1871
|
+
}
|
|
1872
|
+
// static isOverLap(rec1: AXClientRecCtor, rec2: AXClientRecCtor): boolean {
|
|
1873
|
+
// const r1: AXClientRec = new AXClientRec(rec1);
|
|
1874
|
+
// const r2: AXClientRec = new AXClientRec(rec2);
|
|
1875
|
+
// return ;
|
|
1876
|
+
// }
|
|
1877
|
+
static isInElementBound(pos, element) {
|
|
1878
|
+
const elBound = element.getBoundingClientRect();
|
|
1879
|
+
return AXHtmlUtil.isInRecPoint(pos, {
|
|
1880
|
+
left: elBound.left,
|
|
1881
|
+
width: elBound.width,
|
|
1882
|
+
top: elBound.top,
|
|
1883
|
+
height: elBound.height
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
static getDimensions() {
|
|
1887
|
+
let winW = 630;
|
|
1888
|
+
let winH = 460;
|
|
1889
|
+
if (document.body && document.body.offsetWidth) {
|
|
1890
|
+
winW = document.body.offsetWidth;
|
|
1891
|
+
winH = document.body.offsetHeight;
|
|
1892
|
+
}
|
|
1893
|
+
if (document.compatMode === 'CSS1Compat' && document.documentElement && document.documentElement.offsetWidth) {
|
|
1894
|
+
winW = document.documentElement.offsetWidth;
|
|
1895
|
+
winH = document.documentElement.offsetHeight;
|
|
1896
|
+
}
|
|
1897
|
+
if (window.innerWidth && window.innerHeight) {
|
|
1898
|
+
winW = window.innerWidth;
|
|
1899
|
+
winH = window.innerHeight;
|
|
1900
|
+
}
|
|
1901
|
+
return { width: winW, height: winH };
|
|
1902
|
+
}
|
|
1903
|
+
static getOffsetRight(elem) {
|
|
1904
|
+
let element = elem;
|
|
1905
|
+
const width = element.offsetWidth;
|
|
1906
|
+
let right = 0;
|
|
1907
|
+
while (element.offsetParent) {
|
|
1908
|
+
right += element.offsetLeft;
|
|
1909
|
+
element = element.offsetParent;
|
|
1910
|
+
}
|
|
1911
|
+
right += element.offsetLeft;
|
|
1912
|
+
right = AXHtmlUtil.getDimensions().width - right;
|
|
1913
|
+
right -= width;
|
|
1914
|
+
return right;
|
|
1915
|
+
}
|
|
1916
|
+
static getUID() {
|
|
1917
|
+
return 'el-' + AXMathUtil.randomRange(1000000000, 9999999999).toString();
|
|
1918
|
+
}
|
|
1919
|
+
static getRelatedPosition(source, placement, target, alignment) {
|
|
1920
|
+
const result = { x: 0, y: 0 };
|
|
1921
|
+
const sourcePos = AXHtmlUtil.getBoundingRectPoint(source, placement);
|
|
1922
|
+
let top = 0;
|
|
1923
|
+
let left = 0;
|
|
1924
|
+
switch (alignment) {
|
|
1925
|
+
case 'top-start':
|
|
1926
|
+
top = sourcePos.y;
|
|
1927
|
+
left = sourcePos.x;
|
|
1928
|
+
break;
|
|
1929
|
+
case 'top-middle':
|
|
1930
|
+
top = sourcePos.y;
|
|
1931
|
+
left = sourcePos.x - target.offsetWidth / 2;
|
|
1932
|
+
break;
|
|
1933
|
+
case 'top-end':
|
|
1934
|
+
top = sourcePos.y;
|
|
1935
|
+
left = sourcePos.x - target.offsetWidth;
|
|
1936
|
+
break;
|
|
1937
|
+
case 'center-end':
|
|
1938
|
+
top = sourcePos.y - target.offsetHeight / 2;
|
|
1939
|
+
left = sourcePos.x - target.offsetWidth;
|
|
1940
|
+
break;
|
|
1941
|
+
case 'bottom-end':
|
|
1942
|
+
top = sourcePos.y - target.offsetHeight;
|
|
1943
|
+
left = sourcePos.x - target.offsetWidth;
|
|
1944
|
+
break;
|
|
1945
|
+
case 'bottom-middle':
|
|
1946
|
+
top = sourcePos.y - target.offsetHeight;
|
|
1947
|
+
left = sourcePos.x - target.offsetWidth / 2;
|
|
1948
|
+
break;
|
|
1949
|
+
case 'bottom-start':
|
|
1950
|
+
top = sourcePos.y - target.offsetHeight;
|
|
1951
|
+
left = sourcePos.x;
|
|
1952
|
+
break;
|
|
1953
|
+
case 'center-start':
|
|
1954
|
+
top = sourcePos.y - target.offsetHeight / 2;
|
|
1955
|
+
left = sourcePos.x;
|
|
1956
|
+
break;
|
|
1957
|
+
}
|
|
1958
|
+
result.y = top;
|
|
1959
|
+
result.x = left;
|
|
1960
|
+
return result;
|
|
1961
|
+
}
|
|
1962
|
+
static collision(a, b) {
|
|
1963
|
+
const ac = a.getBoundingClientRect();
|
|
1964
|
+
const bc = b.getBoundingClientRect();
|
|
1965
|
+
if (ac.left < bc.left + bc.width && ac.left + ac.width > bc.left &&
|
|
1966
|
+
ac.top < bc.top + bc.height && ac.top + ac.height > bc.top) {
|
|
1967
|
+
return true;
|
|
1968
|
+
}
|
|
1969
|
+
else {
|
|
1970
|
+
return false;
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
1973
|
}
|
|
1974
1974
|
|
|
1975
|
-
class AXHtmlModule {
|
|
1976
|
-
}
|
|
1977
|
-
AXHtmlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1978
|
-
AXHtmlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlModule, declarations: [AXHtmlToTextPipe], imports: [CommonModule], exports: [AXHtmlToTextPipe] });
|
|
1979
|
-
AXHtmlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlModule, providers: [], imports: [[CommonModule]] });
|
|
1980
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlModule, decorators: [{
|
|
1981
|
-
type: NgModule,
|
|
1982
|
-
args: [{
|
|
1983
|
-
declarations: [AXHtmlToTextPipe],
|
|
1984
|
-
imports: [CommonModule],
|
|
1985
|
-
exports: [AXHtmlToTextPipe],
|
|
1986
|
-
providers: []
|
|
1987
|
-
}]
|
|
1975
|
+
class AXHtmlModule {
|
|
1976
|
+
}
|
|
1977
|
+
AXHtmlModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1978
|
+
AXHtmlModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlModule, declarations: [AXHtmlToTextPipe], imports: [CommonModule], exports: [AXHtmlToTextPipe] });
|
|
1979
|
+
AXHtmlModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlModule, providers: [], imports: [[CommonModule]] });
|
|
1980
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHtmlModule, decorators: [{
|
|
1981
|
+
type: NgModule,
|
|
1982
|
+
args: [{
|
|
1983
|
+
declarations: [AXHtmlToTextPipe],
|
|
1984
|
+
imports: [CommonModule],
|
|
1985
|
+
exports: [AXHtmlToTextPipe],
|
|
1986
|
+
providers: []
|
|
1987
|
+
}]
|
|
1988
1988
|
}] });
|
|
1989
1989
|
|
|
1990
|
-
class AXOnDemandPreloadService {
|
|
1991
|
-
constructor() {
|
|
1992
|
-
this.subject = new Subject();
|
|
1993
|
-
this.tmp = AXHtmlUtil.getUID();
|
|
1994
|
-
}
|
|
1995
|
-
startPreload(routePath) {
|
|
1996
|
-
const slices = [];
|
|
1997
|
-
this.subject.next(routePath);
|
|
1998
|
-
}
|
|
1999
|
-
}
|
|
2000
|
-
AXOnDemandPreloadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXOnDemandPreloadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2001
|
-
AXOnDemandPreloadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXOnDemandPreloadService });
|
|
2002
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXOnDemandPreloadService, decorators: [{
|
|
2003
|
-
type: Injectable
|
|
1990
|
+
class AXOnDemandPreloadService {
|
|
1991
|
+
constructor() {
|
|
1992
|
+
this.subject = new Subject();
|
|
1993
|
+
this.tmp = AXHtmlUtil.getUID();
|
|
1994
|
+
}
|
|
1995
|
+
startPreload(routePath) {
|
|
1996
|
+
const slices = [];
|
|
1997
|
+
this.subject.next(routePath);
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
AXOnDemandPreloadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXOnDemandPreloadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2001
|
+
AXOnDemandPreloadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXOnDemandPreloadService });
|
|
2002
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXOnDemandPreloadService, decorators: [{
|
|
2003
|
+
type: Injectable
|
|
2004
2004
|
}], ctorParameters: function () { return []; } });
|
|
2005
2005
|
|
|
2006
|
-
class AXRenderService {
|
|
2007
|
-
constructor(appRef, router, componentFactoryResolver, compiler, modulePreloadService, injector) {
|
|
2008
|
-
this.appRef = appRef;
|
|
2009
|
-
this.router = router;
|
|
2010
|
-
this.componentFactoryResolver = componentFactoryResolver;
|
|
2011
|
-
this.compiler = compiler;
|
|
2012
|
-
this.modulePreloadService = modulePreloadService;
|
|
2013
|
-
this.injector = injector;
|
|
2014
|
-
}
|
|
2015
|
-
appendComponent(componentClass, options = {}, location) {
|
|
2016
|
-
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentClass);
|
|
2017
|
-
const componentRef = componentFactory.create(this.injector);
|
|
2018
|
-
this.appRef.attachView(componentRef.hostView);
|
|
2019
|
-
Object.assign(componentRef.instance, options);
|
|
2020
|
-
//
|
|
2021
|
-
const domElem = componentRef.hostView.rootNodes[0];
|
|
2022
|
-
componentRef.onDestroy(() => {
|
|
2023
|
-
this.appRef.detachView(componentRef.hostView);
|
|
2024
|
-
});
|
|
2025
|
-
if (location) {
|
|
2026
|
-
location.appendChild(domElem);
|
|
2027
|
-
}
|
|
2028
|
-
else {
|
|
2029
|
-
document.body.appendChild(domElem);
|
|
2030
|
-
}
|
|
2031
|
-
setTimeout(() => {
|
|
2032
|
-
componentRef.changeDetectorRef.detectChanges();
|
|
2033
|
-
}, 0);
|
|
2034
|
-
return componentRef;
|
|
2035
|
-
}
|
|
2036
|
-
findLoadedComponentByRoute(path, timeoutTime = 10) {
|
|
2037
|
-
const delay = 200;
|
|
2038
|
-
const loop = timeoutTime * 1000 / delay;
|
|
2039
|
-
return new Promise((resolve, reject) => {
|
|
2040
|
-
let found = null;
|
|
2041
|
-
let preload = false;
|
|
2042
|
-
const theLoop = (i) => {
|
|
2043
|
-
setTimeout(async () => {
|
|
2044
|
-
found = await this._findLoadedComponentByRoute(path);
|
|
2045
|
-
if (--i && found == null) {
|
|
2046
|
-
if (!preload) {
|
|
2047
|
-
this.modulePreloadService.startPreload(path);
|
|
2048
|
-
preload = true;
|
|
2049
|
-
}
|
|
2050
|
-
theLoop(i);
|
|
2051
|
-
}
|
|
2052
|
-
else if (found) {
|
|
2053
|
-
resolve(found);
|
|
2054
|
-
}
|
|
2055
|
-
else {
|
|
2056
|
-
reject();
|
|
2057
|
-
}
|
|
2058
|
-
}, delay);
|
|
2059
|
-
};
|
|
2060
|
-
theLoop(loop);
|
|
2061
|
-
});
|
|
2062
|
-
}
|
|
2063
|
-
async _findLoadedComponentByRoute(search) {
|
|
2064
|
-
let found = null;
|
|
2065
|
-
const f = (children, parentPath) => {
|
|
2066
|
-
for (const p in children) {
|
|
2067
|
-
if (children.hasOwnProperty(p)) {
|
|
2068
|
-
const route = children[p];
|
|
2069
|
-
const pp = (route.path != '' && route.path != null) ? parentPath + '/' + route.path : parentPath;
|
|
2070
|
-
if (pp == search && !route._loadedConfig && route.component) {
|
|
2071
|
-
found = route;
|
|
2072
|
-
return;
|
|
2073
|
-
}
|
|
2074
|
-
else if (route._loadedConfig || route.children) {
|
|
2075
|
-
f(route.children || route._loadedConfig.routes, pp);
|
|
2076
|
-
}
|
|
2077
|
-
}
|
|
2078
|
-
}
|
|
2079
|
-
};
|
|
2080
|
-
for (const p in this.router.config) {
|
|
2081
|
-
if (this.router.config.hasOwnProperty(p)) {
|
|
2082
|
-
const route = this.router.config[p];
|
|
2083
|
-
if (route.path === search && route.component) {
|
|
2084
|
-
found = route;
|
|
2085
|
-
}
|
|
2086
|
-
else if (route['_loadedConfig'] || route.children) {
|
|
2087
|
-
f(route.children || route['_loadedConfig'].routes, route.path);
|
|
2088
|
-
}
|
|
2089
|
-
if (found)
|
|
2090
|
-
break;
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
return found;
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
AXRenderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderService, deps: [{ token: i0.ApplicationRef }, { token: i1$1.Router }, { token: i0.ComponentFactoryResolver }, { token: i0.Compiler }, { token: AXOnDemandPreloadService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2097
|
-
AXRenderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderService, providedIn: 'root' });
|
|
2098
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderService, decorators: [{
|
|
2099
|
-
type: Injectable,
|
|
2100
|
-
args: [{ providedIn: 'root' }]
|
|
2006
|
+
class AXRenderService {
|
|
2007
|
+
constructor(appRef, router, componentFactoryResolver, compiler, modulePreloadService, injector) {
|
|
2008
|
+
this.appRef = appRef;
|
|
2009
|
+
this.router = router;
|
|
2010
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
2011
|
+
this.compiler = compiler;
|
|
2012
|
+
this.modulePreloadService = modulePreloadService;
|
|
2013
|
+
this.injector = injector;
|
|
2014
|
+
}
|
|
2015
|
+
appendComponent(componentClass, options = {}, location) {
|
|
2016
|
+
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentClass);
|
|
2017
|
+
const componentRef = componentFactory.create(this.injector);
|
|
2018
|
+
this.appRef.attachView(componentRef.hostView);
|
|
2019
|
+
Object.assign(componentRef.instance, options);
|
|
2020
|
+
//
|
|
2021
|
+
const domElem = componentRef.hostView.rootNodes[0];
|
|
2022
|
+
componentRef.onDestroy(() => {
|
|
2023
|
+
this.appRef.detachView(componentRef.hostView);
|
|
2024
|
+
});
|
|
2025
|
+
if (location) {
|
|
2026
|
+
location.appendChild(domElem);
|
|
2027
|
+
}
|
|
2028
|
+
else {
|
|
2029
|
+
document.body.appendChild(domElem);
|
|
2030
|
+
}
|
|
2031
|
+
setTimeout(() => {
|
|
2032
|
+
componentRef.changeDetectorRef.detectChanges();
|
|
2033
|
+
}, 0);
|
|
2034
|
+
return componentRef;
|
|
2035
|
+
}
|
|
2036
|
+
findLoadedComponentByRoute(path, timeoutTime = 10) {
|
|
2037
|
+
const delay = 200;
|
|
2038
|
+
const loop = timeoutTime * 1000 / delay;
|
|
2039
|
+
return new Promise((resolve, reject) => {
|
|
2040
|
+
let found = null;
|
|
2041
|
+
let preload = false;
|
|
2042
|
+
const theLoop = (i) => {
|
|
2043
|
+
setTimeout(async () => {
|
|
2044
|
+
found = await this._findLoadedComponentByRoute(path);
|
|
2045
|
+
if (--i && found == null) {
|
|
2046
|
+
if (!preload) {
|
|
2047
|
+
this.modulePreloadService.startPreload(path);
|
|
2048
|
+
preload = true;
|
|
2049
|
+
}
|
|
2050
|
+
theLoop(i);
|
|
2051
|
+
}
|
|
2052
|
+
else if (found) {
|
|
2053
|
+
resolve(found);
|
|
2054
|
+
}
|
|
2055
|
+
else {
|
|
2056
|
+
reject();
|
|
2057
|
+
}
|
|
2058
|
+
}, delay);
|
|
2059
|
+
};
|
|
2060
|
+
theLoop(loop);
|
|
2061
|
+
});
|
|
2062
|
+
}
|
|
2063
|
+
async _findLoadedComponentByRoute(search) {
|
|
2064
|
+
let found = null;
|
|
2065
|
+
const f = (children, parentPath) => {
|
|
2066
|
+
for (const p in children) {
|
|
2067
|
+
if (children.hasOwnProperty(p)) {
|
|
2068
|
+
const route = children[p];
|
|
2069
|
+
const pp = (route.path != '' && route.path != null) ? parentPath + '/' + route.path : parentPath;
|
|
2070
|
+
if (pp == search && !route._loadedConfig && route.component) {
|
|
2071
|
+
found = route;
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2074
|
+
else if (route._loadedConfig || route.children) {
|
|
2075
|
+
f(route.children || route._loadedConfig.routes, pp);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
};
|
|
2080
|
+
for (const p in this.router.config) {
|
|
2081
|
+
if (this.router.config.hasOwnProperty(p)) {
|
|
2082
|
+
const route = this.router.config[p];
|
|
2083
|
+
if (route.path === search && route.component) {
|
|
2084
|
+
found = route;
|
|
2085
|
+
}
|
|
2086
|
+
else if (route['_loadedConfig'] || route.children) {
|
|
2087
|
+
f(route.children || route['_loadedConfig'].routes, route.path);
|
|
2088
|
+
}
|
|
2089
|
+
if (found)
|
|
2090
|
+
break;
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
return found;
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
AXRenderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderService, deps: [{ token: i0.ApplicationRef }, { token: i1$1.Router }, { token: i0.ComponentFactoryResolver }, { token: i0.Compiler }, { token: AXOnDemandPreloadService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2097
|
+
AXRenderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderService, providedIn: 'root' });
|
|
2098
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderService, decorators: [{
|
|
2099
|
+
type: Injectable,
|
|
2100
|
+
args: [{ providedIn: 'root' }]
|
|
2101
2101
|
}], ctorParameters: function () { return [{ type: i0.ApplicationRef }, { type: i1$1.Router }, { type: i0.ComponentFactoryResolver }, { type: i0.Compiler }, { type: AXOnDemandPreloadService }, { type: i0.Injector }]; } });
|
|
2102
2102
|
|
|
2103
|
-
// @dynamic
|
|
2104
|
-
function getOnDemandPreloadServiceFactory() {
|
|
2105
|
-
return new AXOnDemandPreloadService();
|
|
2106
|
-
}
|
|
2107
|
-
class AXRenderingModule {
|
|
2108
|
-
}
|
|
2109
|
-
AXRenderingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2110
|
-
AXRenderingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderingModule });
|
|
2111
|
-
AXRenderingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderingModule, providers: [
|
|
2112
|
-
{
|
|
2113
|
-
provide: AXOnDemandPreloadService,
|
|
2114
|
-
useFactory: getOnDemandPreloadServiceFactory
|
|
2115
|
-
},
|
|
2116
|
-
AXRenderService
|
|
2117
|
-
], imports: [[]] });
|
|
2118
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderingModule, decorators: [{
|
|
2119
|
-
type: NgModule,
|
|
2120
|
-
args: [{
|
|
2121
|
-
imports: [],
|
|
2122
|
-
exports: [],
|
|
2123
|
-
declarations: [],
|
|
2124
|
-
providers: [
|
|
2125
|
-
{
|
|
2126
|
-
provide: AXOnDemandPreloadService,
|
|
2127
|
-
useFactory: getOnDemandPreloadServiceFactory
|
|
2128
|
-
},
|
|
2129
|
-
AXRenderService
|
|
2130
|
-
],
|
|
2131
|
-
}]
|
|
2103
|
+
// @dynamic
|
|
2104
|
+
function getOnDemandPreloadServiceFactory() {
|
|
2105
|
+
return new AXOnDemandPreloadService();
|
|
2106
|
+
}
|
|
2107
|
+
class AXRenderingModule {
|
|
2108
|
+
}
|
|
2109
|
+
AXRenderingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2110
|
+
AXRenderingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderingModule });
|
|
2111
|
+
AXRenderingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderingModule, providers: [
|
|
2112
|
+
{
|
|
2113
|
+
provide: AXOnDemandPreloadService,
|
|
2114
|
+
useFactory: getOnDemandPreloadServiceFactory
|
|
2115
|
+
},
|
|
2116
|
+
AXRenderService
|
|
2117
|
+
], imports: [[]] });
|
|
2118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXRenderingModule, decorators: [{
|
|
2119
|
+
type: NgModule,
|
|
2120
|
+
args: [{
|
|
2121
|
+
imports: [],
|
|
2122
|
+
exports: [],
|
|
2123
|
+
declarations: [],
|
|
2124
|
+
providers: [
|
|
2125
|
+
{
|
|
2126
|
+
provide: AXOnDemandPreloadService,
|
|
2127
|
+
useFactory: getOnDemandPreloadServiceFactory
|
|
2128
|
+
},
|
|
2129
|
+
AXRenderService
|
|
2130
|
+
],
|
|
2131
|
+
}]
|
|
2132
2132
|
}] });
|
|
2133
2133
|
|
|
2134
|
-
class AXHorizontalScrollDirective {
|
|
2135
|
-
constructor(el) {
|
|
2136
|
-
this.el = el;
|
|
2137
|
-
this.scrollValue = 40;
|
|
2138
|
-
}
|
|
2139
|
-
onMouseWheel(e) {
|
|
2140
|
-
const delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
|
|
2141
|
-
this.el.nativeElement.scrollLeft -= delta * this.scrollValue;
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
AXHorizontalScrollDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHorizontalScrollDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2145
|
-
AXHorizontalScrollDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: AXHorizontalScrollDirective, selector: "[horizontalScroll]", inputs: { scrollValue: ["horizontalScroll", "scrollValue"] }, host: { listeners: { "wheel": "onMouseWheel($event)" } }, ngImport: i0 });
|
|
2146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHorizontalScrollDirective, decorators: [{
|
|
2147
|
-
type: Directive,
|
|
2148
|
-
args: [{
|
|
2149
|
-
// tslint:disable-next-line: directive-selector
|
|
2150
|
-
selector: '[horizontalScroll]'
|
|
2151
|
-
}]
|
|
2152
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { scrollValue: [{
|
|
2153
|
-
type: Input,
|
|
2154
|
-
args: ['horizontalScroll']
|
|
2155
|
-
}], onMouseWheel: [{
|
|
2156
|
-
type: HostListener,
|
|
2157
|
-
args: ['wheel', ['$event']]
|
|
2158
|
-
}] } });
|
|
2159
|
-
class AXVerticalScrollDirective {
|
|
2160
|
-
constructor(el) {
|
|
2161
|
-
this.el = el;
|
|
2162
|
-
this.scrollValue = 40;
|
|
2163
|
-
}
|
|
2164
|
-
onMouseWheel(e) {
|
|
2165
|
-
const delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
|
|
2166
|
-
this.el.nativeElement.scrollTop -= delta * this.scrollValue;
|
|
2167
|
-
}
|
|
2168
|
-
}
|
|
2169
|
-
AXVerticalScrollDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXVerticalScrollDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2170
|
-
AXVerticalScrollDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: AXVerticalScrollDirective, selector: "[verticalScroll]", inputs: { scrollValue: ["verticalScroll", "scrollValue"] }, host: { listeners: { "wheel": "onMouseWheel($event)" } }, ngImport: i0 });
|
|
2171
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXVerticalScrollDirective, decorators: [{
|
|
2172
|
-
type: Directive,
|
|
2173
|
-
args: [{
|
|
2174
|
-
// tslint:disable-next-line: directive-selector
|
|
2175
|
-
selector: '[verticalScroll]'
|
|
2176
|
-
}]
|
|
2177
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { scrollValue: [{
|
|
2178
|
-
type: Input,
|
|
2179
|
-
args: ['verticalScroll']
|
|
2180
|
-
}], onMouseWheel: [{
|
|
2181
|
-
type: HostListener,
|
|
2182
|
-
args: ['wheel', ['$event']]
|
|
2134
|
+
class AXHorizontalScrollDirective {
|
|
2135
|
+
constructor(el) {
|
|
2136
|
+
this.el = el;
|
|
2137
|
+
this.scrollValue = 40;
|
|
2138
|
+
}
|
|
2139
|
+
onMouseWheel(e) {
|
|
2140
|
+
const delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
|
|
2141
|
+
this.el.nativeElement.scrollLeft -= delta * this.scrollValue;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
AXHorizontalScrollDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHorizontalScrollDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2145
|
+
AXHorizontalScrollDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: AXHorizontalScrollDirective, selector: "[horizontalScroll]", inputs: { scrollValue: ["horizontalScroll", "scrollValue"] }, host: { listeners: { "wheel": "onMouseWheel($event)" } }, ngImport: i0 });
|
|
2146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXHorizontalScrollDirective, decorators: [{
|
|
2147
|
+
type: Directive,
|
|
2148
|
+
args: [{
|
|
2149
|
+
// tslint:disable-next-line: directive-selector
|
|
2150
|
+
selector: '[horizontalScroll]'
|
|
2151
|
+
}]
|
|
2152
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { scrollValue: [{
|
|
2153
|
+
type: Input,
|
|
2154
|
+
args: ['horizontalScroll']
|
|
2155
|
+
}], onMouseWheel: [{
|
|
2156
|
+
type: HostListener,
|
|
2157
|
+
args: ['wheel', ['$event']]
|
|
2158
|
+
}] } });
|
|
2159
|
+
class AXVerticalScrollDirective {
|
|
2160
|
+
constructor(el) {
|
|
2161
|
+
this.el = el;
|
|
2162
|
+
this.scrollValue = 40;
|
|
2163
|
+
}
|
|
2164
|
+
onMouseWheel(e) {
|
|
2165
|
+
const delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
|
|
2166
|
+
this.el.nativeElement.scrollTop -= delta * this.scrollValue;
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
AXVerticalScrollDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXVerticalScrollDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2170
|
+
AXVerticalScrollDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: AXVerticalScrollDirective, selector: "[verticalScroll]", inputs: { scrollValue: ["verticalScroll", "scrollValue"] }, host: { listeners: { "wheel": "onMouseWheel($event)" } }, ngImport: i0 });
|
|
2171
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXVerticalScrollDirective, decorators: [{
|
|
2172
|
+
type: Directive,
|
|
2173
|
+
args: [{
|
|
2174
|
+
// tslint:disable-next-line: directive-selector
|
|
2175
|
+
selector: '[verticalScroll]'
|
|
2176
|
+
}]
|
|
2177
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { scrollValue: [{
|
|
2178
|
+
type: Input,
|
|
2179
|
+
args: ['verticalScroll']
|
|
2180
|
+
}], onMouseWheel: [{
|
|
2181
|
+
type: HostListener,
|
|
2182
|
+
args: ['wheel', ['$event']]
|
|
2183
2183
|
}] } });
|
|
2184
2184
|
|
|
2185
|
-
class AXScrollModule {
|
|
2186
|
-
}
|
|
2187
|
-
AXScrollModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXScrollModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2188
|
-
AXScrollModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXScrollModule, declarations: [AXHorizontalScrollDirective, AXVerticalScrollDirective], imports: [CommonModule], exports: [AXHorizontalScrollDirective, AXVerticalScrollDirective] });
|
|
2189
|
-
AXScrollModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXScrollModule, providers: [], imports: [[CommonModule]] });
|
|
2190
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXScrollModule, decorators: [{
|
|
2191
|
-
type: NgModule,
|
|
2192
|
-
args: [{
|
|
2193
|
-
declarations: [AXHorizontalScrollDirective, AXVerticalScrollDirective],
|
|
2194
|
-
imports: [CommonModule],
|
|
2195
|
-
exports: [AXHorizontalScrollDirective, AXVerticalScrollDirective],
|
|
2196
|
-
providers: []
|
|
2197
|
-
}]
|
|
2185
|
+
class AXScrollModule {
|
|
2186
|
+
}
|
|
2187
|
+
AXScrollModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXScrollModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2188
|
+
AXScrollModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXScrollModule, declarations: [AXHorizontalScrollDirective, AXVerticalScrollDirective], imports: [CommonModule], exports: [AXHorizontalScrollDirective, AXVerticalScrollDirective] });
|
|
2189
|
+
AXScrollModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXScrollModule, providers: [], imports: [[CommonModule]] });
|
|
2190
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXScrollModule, decorators: [{
|
|
2191
|
+
type: NgModule,
|
|
2192
|
+
args: [{
|
|
2193
|
+
declarations: [AXHorizontalScrollDirective, AXVerticalScrollDirective],
|
|
2194
|
+
imports: [CommonModule],
|
|
2195
|
+
exports: [AXHorizontalScrollDirective, AXVerticalScrollDirective],
|
|
2196
|
+
providers: []
|
|
2197
|
+
}]
|
|
2198
2198
|
}] });
|
|
2199
2199
|
|
|
2200
|
-
// export class AXSeparatorPipe2 implements PipeTransform {
|
|
2201
|
-
// transform(value: any) {
|
|
2202
|
-
// if (value) {
|
|
2203
|
-
// return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
2204
|
-
// } else {
|
|
2205
|
-
// return '0';
|
|
2206
|
-
// }
|
|
2207
|
-
// }
|
|
2208
|
-
// }
|
|
2209
|
-
class AXSeparatorPipe {
|
|
2210
|
-
transform(value, currency = '', decimal = 0, locale = AXConfig.get('layout.rtl') ? 'fa' : 'en') {
|
|
2211
|
-
return (new Intl.NumberFormat(locale, {
|
|
2212
|
-
minimumFractionDigits: 0,
|
|
2213
|
-
maximumFractionDigits: decimal
|
|
2214
|
-
}).format(Number(value)) + (currency != '' ? ' ' + currency : ''));
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
AXSeparatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2218
|
-
AXSeparatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorPipe, name: "separator" });
|
|
2219
|
-
AXSeparatorPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorPipe, providedIn: 'root' });
|
|
2220
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorPipe, decorators: [{
|
|
2221
|
-
type: Pipe,
|
|
2222
|
-
args: [{ name: 'separator' }]
|
|
2223
|
-
}, {
|
|
2224
|
-
type: Injectable,
|
|
2225
|
-
args: [{
|
|
2226
|
-
providedIn: 'root'
|
|
2227
|
-
}]
|
|
2200
|
+
// export class AXSeparatorPipe2 implements PipeTransform {
|
|
2201
|
+
// transform(value: any) {
|
|
2202
|
+
// if (value) {
|
|
2203
|
+
// return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
|
2204
|
+
// } else {
|
|
2205
|
+
// return '0';
|
|
2206
|
+
// }
|
|
2207
|
+
// }
|
|
2208
|
+
// }
|
|
2209
|
+
class AXSeparatorPipe {
|
|
2210
|
+
transform(value, currency = '', decimal = 0, locale = AXConfig.get('layout.rtl') ? 'fa' : 'en') {
|
|
2211
|
+
return (new Intl.NumberFormat(locale, {
|
|
2212
|
+
minimumFractionDigits: 0,
|
|
2213
|
+
maximumFractionDigits: decimal
|
|
2214
|
+
}).format(Number(value)) + (currency != '' ? ' ' + currency : ''));
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
AXSeparatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2218
|
+
AXSeparatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorPipe, name: "separator" });
|
|
2219
|
+
AXSeparatorPipe.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorPipe, providedIn: 'root' });
|
|
2220
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorPipe, decorators: [{
|
|
2221
|
+
type: Pipe,
|
|
2222
|
+
args: [{ name: 'separator' }]
|
|
2223
|
+
}, {
|
|
2224
|
+
type: Injectable,
|
|
2225
|
+
args: [{
|
|
2226
|
+
providedIn: 'root'
|
|
2227
|
+
}]
|
|
2228
2228
|
}] });
|
|
2229
2229
|
|
|
2230
|
-
class AXSeparatorModule {
|
|
2231
|
-
}
|
|
2232
|
-
AXSeparatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2233
|
-
AXSeparatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorModule, declarations: [AXSeparatorPipe], imports: [CommonModule], exports: [AXSeparatorPipe] });
|
|
2234
|
-
AXSeparatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorModule, providers: [], imports: [[CommonModule]] });
|
|
2235
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorModule, decorators: [{
|
|
2236
|
-
type: NgModule,
|
|
2237
|
-
args: [{
|
|
2238
|
-
declarations: [AXSeparatorPipe],
|
|
2239
|
-
imports: [CommonModule],
|
|
2240
|
-
exports: [AXSeparatorPipe],
|
|
2241
|
-
providers: []
|
|
2242
|
-
}]
|
|
2230
|
+
class AXSeparatorModule {
|
|
2231
|
+
}
|
|
2232
|
+
AXSeparatorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2233
|
+
AXSeparatorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorModule, declarations: [AXSeparatorPipe], imports: [CommonModule], exports: [AXSeparatorPipe] });
|
|
2234
|
+
AXSeparatorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorModule, providers: [], imports: [[CommonModule]] });
|
|
2235
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXSeparatorModule, decorators: [{
|
|
2236
|
+
type: NgModule,
|
|
2237
|
+
args: [{
|
|
2238
|
+
declarations: [AXSeparatorPipe],
|
|
2239
|
+
imports: [CommonModule],
|
|
2240
|
+
exports: [AXSeparatorPipe],
|
|
2241
|
+
providers: []
|
|
2242
|
+
}]
|
|
2243
2243
|
}] });
|
|
2244
2244
|
|
|
2245
|
-
const PIPES = [AXDateTimePipe];
|
|
2246
|
-
const MODULES = [AXScrollModule, AXTranslatorModule];
|
|
2247
|
-
const SERVICES = [AXEventService,
|
|
2248
|
-
AXStorageService
|
|
2249
|
-
];
|
|
2250
|
-
class AXCoreModule {
|
|
2251
|
-
}
|
|
2252
|
-
AXCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2253
|
-
AXCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXCoreModule, declarations: [AXDateTimePipe], imports: [AXScrollModule, AXTranslatorModule], exports: [AXDateTimePipe] });
|
|
2254
|
-
AXCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXCoreModule, providers: [...SERVICES], imports: [[...MODULES]] });
|
|
2255
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXCoreModule, decorators: [{
|
|
2256
|
-
type: NgModule,
|
|
2257
|
-
args: [{
|
|
2258
|
-
declarations: [...PIPES],
|
|
2259
|
-
imports: [...MODULES],
|
|
2260
|
-
exports: [...PIPES],
|
|
2261
|
-
providers: [...SERVICES]
|
|
2262
|
-
}]
|
|
2245
|
+
const PIPES = [AXDateTimePipe];
|
|
2246
|
+
const MODULES = [AXScrollModule, AXTranslatorModule];
|
|
2247
|
+
const SERVICES = [AXEventService,
|
|
2248
|
+
AXStorageService
|
|
2249
|
+
];
|
|
2250
|
+
class AXCoreModule {
|
|
2251
|
+
}
|
|
2252
|
+
AXCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2253
|
+
AXCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXCoreModule, declarations: [AXDateTimePipe], imports: [AXScrollModule, AXTranslatorModule], exports: [AXDateTimePipe] });
|
|
2254
|
+
AXCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXCoreModule, providers: [...SERVICES], imports: [[...MODULES]] });
|
|
2255
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: AXCoreModule, decorators: [{
|
|
2256
|
+
type: NgModule,
|
|
2257
|
+
args: [{
|
|
2258
|
+
declarations: [...PIPES],
|
|
2259
|
+
imports: [...MODULES],
|
|
2260
|
+
exports: [...PIPES],
|
|
2261
|
+
providers: [...SERVICES]
|
|
2262
|
+
}]
|
|
2263
2263
|
}] });
|
|
2264
2264
|
|
|
2265
|
-
/**
|
|
2266
|
-
* Generated bundle index. Do not edit.
|
|
2265
|
+
/**
|
|
2266
|
+
* Generated bundle index. Do not edit.
|
|
2267
2267
|
*/
|
|
2268
2268
|
|
|
2269
2269
|
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 };
|