@acorex/core 3.0.1 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/README.md +23 -2
  2. package/acorex-core.d.ts +1 -0
  3. package/bundles/acorex-core.umd.js +609 -2248
  4. package/bundles/acorex-core.umd.js.map +1 -1
  5. package/esm2015/acorex-core.js +1 -1
  6. package/esm2015/lib/config/configs.js +29 -0
  7. package/esm2015/lib/core.module.js +18 -24
  8. package/esm2015/lib/dateTime/datetime.class.js +236 -0
  9. package/esm2015/lib/dateTime/datetime.module.js +18 -0
  10. package/esm2015/lib/dateTime/datetime.pipe.js +25 -0
  11. package/esm2015/lib/dateTime/georgian.calendar.js +145 -0
  12. package/esm2015/lib/dateTime/index.js +5 -0
  13. package/esm2015/lib/platform/index.js +2 -0
  14. package/esm2015/lib/platform/platform.service.js +119 -0
  15. package/esm2015/lib/translation/index.js +4 -0
  16. package/esm2015/lib/translation/translation.module.js +18 -0
  17. package/esm2015/lib/translation/translator.js +26 -0
  18. package/esm2015/lib/translation/translator.pipe.js +15 -0
  19. package/esm2015/lib/utils/index.js +3 -0
  20. package/esm2015/lib/utils/object-util.js +83 -0
  21. package/esm2015/lib/utils/safe.pipe.js +30 -0
  22. package/esm2015/public-api.js +10 -35
  23. package/fesm2015/acorex-core.js +533 -1839
  24. package/fesm2015/acorex-core.js.map +1 -1
  25. package/lib/{services/config.d.ts → config/configs.d.ts} +1 -1
  26. package/lib/core.module.d.ts +5 -0
  27. package/lib/dateTime/datetime.class.d.ts +96 -0
  28. package/lib/dateTime/datetime.module.d.ts +7 -0
  29. package/lib/dateTime/datetime.pipe.d.ts +8 -0
  30. package/lib/dateTime/georgian.calendar.d.ts +17 -0
  31. package/lib/dateTime/index.d.ts +4 -0
  32. package/lib/platform/index.d.ts +1 -0
  33. package/lib/platform/platform.service.d.ts +22 -0
  34. package/lib/translation/index.d.ts +3 -0
  35. package/lib/translation/translation.module.d.ts +7 -0
  36. package/lib/{translator → translation}/translator.d.ts +0 -0
  37. package/lib/translation/translator.pipe.d.ts +7 -0
  38. package/lib/utils/index.d.ts +2 -0
  39. package/lib/utils/object-util.d.ts +7 -0
  40. package/lib/utils/safe.pipe.d.ts +10 -0
  41. package/package.json +7 -11
  42. package/public-api.d.ts +9 -41
  43. package/acorex-core.metadata.json +0 -1
  44. package/bundles/acorex-core.umd.min.js +0 -17
  45. package/bundles/acorex-core.umd.min.js.map +0 -1
  46. package/esm2015/lib/classes/base-page.class.js +0 -21
  47. package/esm2015/lib/classes/color.class.js +0 -49
  48. package/esm2015/lib/classes/datetime.class.js +0 -314
  49. package/esm2015/lib/classes/menu.class.js +0 -27
  50. package/esm2015/lib/classes/navigator.class.js +0 -1
  51. package/esm2015/lib/classes/popup.class.js +0 -1
  52. package/esm2015/lib/classes/promise.class.js +0 -19
  53. package/esm2015/lib/classes/sectionlist.class.js +0 -1
  54. package/esm2015/lib/classes/select.class.js +0 -3
  55. package/esm2015/lib/error/error.class.js +0 -1
  56. package/esm2015/lib/error/error.module.js +0 -16
  57. package/esm2015/lib/error/error.service.js +0 -25
  58. package/esm2015/lib/events/keyboard.js +0 -1
  59. package/esm2015/lib/http/http-error.class.js +0 -1
  60. package/esm2015/lib/http/http-events.interceptor.js +0 -3
  61. package/esm2015/lib/http/http-request.class.js +0 -1
  62. package/esm2015/lib/http/http-result.class.js +0 -21
  63. package/esm2015/lib/http/http.module.js +0 -29
  64. package/esm2015/lib/http/http.service.js +0 -149
  65. package/esm2015/lib/locale/en.json +0 -249
  66. package/esm2015/lib/locale/fa.json +0 -238
  67. package/esm2015/lib/pipe/datetime.pipe.js +0 -24
  68. package/esm2015/lib/pipe/htmlToText.pipe.js +0 -23
  69. package/esm2015/lib/services/config.js +0 -29
  70. package/esm2015/lib/services/event.service.js +0 -36
  71. package/esm2015/lib/services/navigator.service.js +0 -9
  72. package/esm2015/lib/services/storage.service.js +0 -15
  73. package/esm2015/lib/translator/translator.js +0 -26
  74. package/esm2015/lib/translator/translator.module.js +0 -23
  75. package/esm2015/lib/translator/translator.pipe.js +0 -23
  76. package/esm2015/lib/translator/translator.service.js +0 -21
  77. package/esm2015/lib/utils/array/array-util.js +0 -133
  78. package/esm2015/lib/utils/html/html-util.js +0 -192
  79. package/esm2015/lib/utils/html/html.module.js +0 -16
  80. package/esm2015/lib/utils/math/math-util.js +0 -6
  81. package/esm2015/lib/utils/object/object-util.js +0 -83
  82. package/esm2015/lib/utils/render/on-demand-preload-strategy.service.js +0 -21
  83. package/esm2015/lib/utils/render/render.service.js +0 -112
  84. package/esm2015/lib/utils/render/rendering.module.js +0 -26
  85. package/esm2015/lib/utils/scroll/scroll.directive.js +0 -66
  86. package/esm2015/lib/utils/scroll/scroll.module.js +0 -16
  87. package/esm2015/lib/utils/separator/separator.module.js +0 -16
  88. package/esm2015/lib/utils/separator/separator.pipe.js +0 -22
  89. package/esm5/acorex-core.js +0 -5
  90. package/esm5/lib/classes/base-page.class.js +0 -23
  91. package/esm5/lib/classes/color.class.js +0 -54
  92. package/esm5/lib/classes/datetime.class.js +0 -390
  93. package/esm5/lib/classes/menu.class.js +0 -42
  94. package/esm5/lib/classes/navigator.class.js +0 -1
  95. package/esm5/lib/classes/popup.class.js +0 -1
  96. package/esm5/lib/classes/promise.class.js +0 -22
  97. package/esm5/lib/classes/sectionlist.class.js +0 -1
  98. package/esm5/lib/classes/select.class.js +0 -7
  99. package/esm5/lib/core.module.js +0 -27
  100. package/esm5/lib/error/error.class.js +0 -1
  101. package/esm5/lib/error/error.module.js +0 -19
  102. package/esm5/lib/error/error.service.js +0 -26
  103. package/esm5/lib/events/keyboard.js +0 -1
  104. package/esm5/lib/http/http-error.class.js +0 -1
  105. package/esm5/lib/http/http-events.interceptor.js +0 -3
  106. package/esm5/lib/http/http-request.class.js +0 -1
  107. package/esm5/lib/http/http-result.class.js +0 -24
  108. package/esm5/lib/http/http.module.js +0 -33
  109. package/esm5/lib/http/http.service.js +0 -157
  110. package/esm5/lib/locale/en.json +0 -249
  111. package/esm5/lib/locale/fa.json +0 -238
  112. package/esm5/lib/pipe/datetime.pipe.js +0 -26
  113. package/esm5/lib/pipe/htmlToText.pipe.js +0 -26
  114. package/esm5/lib/services/config.js +0 -37
  115. package/esm5/lib/services/event.service.js +0 -37
  116. package/esm5/lib/services/navigator.service.js +0 -12
  117. package/esm5/lib/services/storage.service.js +0 -18
  118. package/esm5/lib/translator/translator.js +0 -34
  119. package/esm5/lib/translator/translator.module.js +0 -24
  120. package/esm5/lib/translator/translator.pipe.js +0 -25
  121. package/esm5/lib/translator/translator.service.js +0 -24
  122. package/esm5/lib/utils/array/array-util.js +0 -147
  123. package/esm5/lib/utils/html/html-util.js +0 -224
  124. package/esm5/lib/utils/html/html.module.js +0 -19
  125. package/esm5/lib/utils/math/math-util.js +0 -10
  126. package/esm5/lib/utils/object/object-util.js +0 -88
  127. package/esm5/lib/utils/render/on-demand-preload-strategy.service.js +0 -22
  128. package/esm5/lib/utils/render/render.service.js +0 -117
  129. package/esm5/lib/utils/render/rendering.module.js +0 -29
  130. package/esm5/lib/utils/scroll/scroll.directive.js +0 -68
  131. package/esm5/lib/utils/scroll/scroll.module.js +0 -19
  132. package/esm5/lib/utils/separator/separator.module.js +0 -19
  133. package/esm5/lib/utils/separator/separator.pipe.js +0 -25
  134. package/esm5/public-api.js +0 -36
  135. package/fesm5/acorex-core.js +0 -2274
  136. package/fesm5/acorex-core.js.map +0 -1
  137. package/lib/classes/base-page.class.d.ts +0 -10
  138. package/lib/classes/color.class.d.ts +0 -17
  139. package/lib/classes/datetime.class.d.ts +0 -63
  140. package/lib/classes/menu.class.d.ts +0 -33
  141. package/lib/classes/navigator.class.d.ts +0 -5
  142. package/lib/classes/popup.class.d.ts +0 -12
  143. package/lib/classes/promise.class.d.ts +0 -7
  144. package/lib/classes/sectionlist.class.d.ts +0 -8
  145. package/lib/classes/select.class.d.ts +0 -7
  146. package/lib/error/error.class.d.ts +0 -4
  147. package/lib/error/error.module.d.ts +0 -2
  148. package/lib/error/error.service.d.ts +0 -10
  149. package/lib/events/keyboard.d.ts +0 -2
  150. package/lib/http/http-error.class.d.ts +0 -7
  151. package/lib/http/http-events.interceptor.d.ts +0 -10
  152. package/lib/http/http-request.class.d.ts +0 -14
  153. package/lib/http/http-result.class.d.ts +0 -11
  154. package/lib/http/http.module.d.ts +0 -4
  155. package/lib/http/http.service.d.ts +0 -20
  156. package/lib/pipe/datetime.pipe.d.ts +0 -5
  157. package/lib/pipe/htmlToText.pipe.d.ts +0 -4
  158. package/lib/services/event.service.d.ts +0 -6
  159. package/lib/services/navigator.service.d.ts +0 -5
  160. package/lib/services/storage.service.d.ts +0 -4
  161. package/lib/translator/translator.module.d.ts +0 -3
  162. package/lib/translator/translator.pipe.d.ts +0 -5
  163. package/lib/translator/translator.service.d.ts +0 -5
  164. package/lib/utils/array/array-util.d.ts +0 -6
  165. package/lib/utils/html/html-util.d.ts +0 -62
  166. package/lib/utils/html/html.module.d.ts +0 -2
  167. package/lib/utils/math/math-util.d.ts +0 -3
  168. package/lib/utils/object/object-util.d.ts +0 -7
  169. package/lib/utils/render/on-demand-preload-strategy.service.d.ts +0 -7
  170. package/lib/utils/render/render.service.d.ts +0 -14
  171. package/lib/utils/render/rendering.module.d.ts +0 -4
  172. package/lib/utils/scroll/scroll.directive.d.ts +0 -13
  173. package/lib/utils/scroll/scroll.module.d.ts +0 -2
  174. package/lib/utils/separator/separator.module.d.ts +0 -2
  175. package/lib/utils/separator/separator.pipe.d.ts +0 -4
@@ -1,60 +1,8 @@
1
- import * as moment_ from 'jalali-moment';
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe, NgModule, Injectable } from '@angular/core';
3
+ import * as i1 from '@angular/platform-browser';
2
4
  import { Subject } from 'rxjs';
3
- import { EventEmitter, InjectionToken, Injector, ɵɵdefineInjectable, ɵɵinject, INJECTOR, Injectable, NgModule, Pipe, ApplicationRef, ComponentFactoryResolver, ElementRef, Input, HostListener, Directive } from '@angular/core';
4
- import { __decorate, __metadata } from 'tslib';
5
- import { CommonModule } from '@angular/common';
6
- import { HttpHeaders, HttpParams, HttpClient, HttpClientModule } from '@angular/common/http';
7
5
  import merge from 'lodash-es/merge';
8
- import { Router } from '@angular/router';
9
-
10
- class AXColorUtil {
11
- static hex2Rgb(hexColor) {
12
- const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexColor);
13
- return result ? {
14
- r: parseInt(result[1], 16),
15
- g: parseInt(result[2], 16),
16
- b: parseInt(result[3], 16)
17
- } : null;
18
- }
19
- static rgb2Hex(r, g, b, a = 255) {
20
- let alpha;
21
- let hex = (r | 1 << 8).toString(16).slice(1) +
22
- (g | 1 << 8).toString(16).slice(1) +
23
- (b | 1 << 8).toString(16).slice(1);
24
- if (a !== 255) {
25
- alpha = a;
26
- }
27
- else {
28
- alpha = 1;
29
- }
30
- alpha = Math.round(alpha * 100) / 100;
31
- alpha = Math.round(alpha * 255);
32
- const hexAlpha = (alpha + 0x10000).toString(16).substr(-2).toUpperCase();
33
- return '#' + hex + (alpha == 255 ? '' : hexAlpha);
34
- }
35
- ;
36
- static illuminance(hexColor) {
37
- const rgbColor = AXColorUtil.hex2Rgb(hexColor);
38
- if (!rgbColor) {
39
- return -1;
40
- }
41
- const r = rgbColor.r;
42
- const g = rgbColor.g;
43
- const b = rgbColor.b;
44
- const a = [r, g, b].map(v => {
45
- v /= 255;
46
- return (v <= 0.03928) ?
47
- v / 12.92 :
48
- Math.pow(((v + 0.055) / 1.055), 2.4);
49
- });
50
- return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
51
- }
52
- static contrastToWhite(hexColor) {
53
- const whiteIlluminance = 1;
54
- const illuminance = AXColorUtil.illuminance(hexColor);
55
- return whiteIlluminance / illuminance;
56
- }
57
- }
58
6
 
59
7
  // @dynamic
60
8
  class AXObjectUtil {
@@ -93,51 +41,93 @@ class AXObjectUtil {
93
41
  }
94
42
  throw new Error('Unable to copy obj! Its type isn\'t supported.');
95
43
  }
96
- }
97
- function AXFetchProp(obj, prop) {
98
- if (typeof obj === 'undefined') {
99
- return false;
44
+ static fetchProp(obj, prop) {
45
+ if (typeof obj === 'undefined') {
46
+ return false;
47
+ }
48
+ const index = prop.indexOf('.');
49
+ if (index > -1) {
50
+ return AXObjectUtil.fetchProp(obj[prop.substring(0, index)], prop.substr(index + 1));
51
+ }
52
+ return obj[prop];
53
+ }
54
+ static getPropByPath(obj, path, defaultVal) {
55
+ path = path
56
+ .replace(/\[/g, '.')
57
+ .replace(/]/g, '')
58
+ .split('.');
59
+ path.forEach((level) => {
60
+ if (obj) {
61
+ obj = obj[level];
62
+ }
63
+ });
64
+ if (obj === undefined) {
65
+ return defaultVal;
66
+ }
67
+ return obj;
100
68
  }
101
- const index = prop.indexOf('.');
102
- if (index > -1) {
103
- return AXFetchProp(obj[prop.substring(0, index)], prop.substr(index + 1));
69
+ static setPropByPath(obj, path, value) {
70
+ if (Object(obj) !== obj) {
71
+ return obj;
72
+ } // When obj is not an object
73
+ // If not yet an array, get the keys from the string-path
74
+ if (!Array.isArray(path)) {
75
+ path = path.toString().match(/[^.[\]]+/g) || [];
76
+ }
77
+ path.slice(0, -1).reduce((a, c, i) => // Iterate all of them except the last one
78
+ Object(a[c]) === a[c] // Does the key exist and is its value an object?
79
+ // Yes: then follow that path
80
+ ? a[c]
81
+ // No: create the key. Is the next key a potential array-index?
82
+ : a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1]
83
+ ? [] // Yes: assign a new array object
84
+ : {}, // No: assign a new plain object
85
+ obj)[path[path.length - 1]] = value; // Finally assign the value to the last key
86
+ return obj; // Return the top-level object to allow chaining
104
87
  }
105
- return obj[prop];
106
- }
107
- function getPropByPath(obj, path, defaultVal) {
108
- path = path
109
- .replace(/\[/g, '.')
110
- .replace(/]/g, '')
111
- .split('.');
112
- path.forEach((level) => {
113
- if (obj) {
114
- obj = obj[level];
88
+ }
89
+
90
+ class AXSafePipe {
91
+ constructor(sanitizer) {
92
+ this.sanitizer = sanitizer;
93
+ }
94
+ transform(value, type) {
95
+ if (value == null || value == undefined || value == '')
96
+ return null;
97
+ switch (type) {
98
+ case 'html': return this.sanitizer.bypassSecurityTrustHtml(value);
99
+ case 'style': return this.sanitizer.bypassSecurityTrustStyle(value);
100
+ case 'script': return this.sanitizer.bypassSecurityTrustScript(value);
101
+ case 'url': return this.sanitizer.bypassSecurityTrustUrl(value);
102
+ case 'resourceUrl': return this.sanitizer.bypassSecurityTrustResourceUrl(value);
103
+ default: throw new Error(`Invalid safe type specified: ${type}`);
115
104
  }
116
- });
117
- if (obj === undefined) {
118
- return defaultVal;
119
105
  }
120
- return obj;
121
106
  }
122
- function setPropByPath(obj, path, value) {
123
- if (Object(obj) !== obj) {
124
- return obj;
125
- } // When obj is not an object
126
- // If not yet an array, get the keys from the string-path
127
- if (!Array.isArray(path)) {
128
- path = path.toString().match(/[^.[\]]+/g) || [];
129
- }
130
- path.slice(0, -1).reduce((a, c, i) => // Iterate all of them except the last one
131
- Object(a[c]) === a[c] // Does the key exist and is its value an object?
132
- // Yes: then follow that path
133
- ? a[c]
134
- // No: create the key. Is the next key a potential array-index?
135
- : a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1]
136
- ? [] // Yes: assign a new array object
137
- : {}, // No: assign a new plain object
138
- obj)[path[path.length - 1]] = value; // Finally assign the value to the last key
139
- return obj; // Return the top-level object to allow chaining
140
- }
107
+ AXSafePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXSafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
108
+ AXSafePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXSafePipe, name: "safe" });
109
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXSafePipe, decorators: [{
110
+ type: Pipe,
111
+ args: [{
112
+ name: 'safe',
113
+ pure: true
114
+ }]
115
+ }], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; } });
116
+
117
+ class AXCoreModule {
118
+ }
119
+ AXCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
120
+ AXCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXCoreModule, declarations: [AXSafePipe], exports: [AXSafePipe] });
121
+ AXCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXCoreModule, providers: [], imports: [[]] });
122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXCoreModule, decorators: [{
123
+ type: NgModule,
124
+ args: [{
125
+ imports: [],
126
+ exports: [AXSafePipe],
127
+ declarations: [AXSafePipe],
128
+ providers: [],
129
+ }]
130
+ }] });
141
131
 
142
132
  // @dynamic
143
133
  class AXConfig {
@@ -146,7 +136,7 @@ class AXConfig {
146
136
  }
147
137
  static set(arg1, arg2) {
148
138
  if (arg1 && typeof arg1 == 'string') {
149
- setPropByPath(AXConfig.dataModel, arg1, arg2);
139
+ AXObjectUtil.setPropByPath(AXConfig.dataModel, arg1, arg2);
150
140
  AXConfig.dataChangeSubject.next(AXConfig.dataModel);
151
141
  return;
152
142
  }
@@ -159,285 +149,167 @@ class AXConfig {
159
149
  return AXConfig.dataChangeSubject.asObservable();
160
150
  }
161
151
  }
162
- static get(path) {
163
- return getPropByPath(AXConfig.dataModel, path);
152
+ static get(path, defaultValue) {
153
+ return AXObjectUtil.getPropByPath(AXConfig.dataModel, path) || defaultValue;
164
154
  }
165
155
  }
166
156
  AXConfig.dataModel = {};
167
157
  AXConfig.dataChangeSubject = new Subject();
168
158
 
169
- const moment = moment_;
159
+ const AX_CALENDARS = [
160
+ {
161
+ name: 'gregorian',
162
+ type: 'GeorgianCalendar'
163
+ },
164
+ {
165
+ name: 'jalali',
166
+ type: 'JalaliCalendar'
167
+ }
168
+ ];
169
+ /**
170
+ * Standard links:
171
+ * {@link Foo} or {@linkplain Foo} or [[Foo]]
172
+ *
173
+ * Code links: (Puts Foo inside <code> tags)
174
+ * {@linkcode Foo} or [[`Foo`]]
175
+ */
176
+ // @dynamic
170
177
  class AXDateTime {
171
- // private get _moment(): moment_.Moment {
172
- // const m = moment(this.date);
173
- // if (this.type === 'jalali') {
174
- // m.locale('fa');
175
- // }
176
- // return m;
177
- // }
178
- constructor(value = new Date(), type = AXConfig.get('dateTime.type') || 'gregorian') {
179
- this.type = type;
178
+ constructor(value = new Date(), calendar = AXConfig.get('dateTime.type') || 'gregorian') {
179
+ this._calendar =
180
+ typeof calendar == 'string'
181
+ ? eval(`new ${AX_CALENDARS.find((c) => c.name == calendar).type}()`)
182
+ : calendar;
180
183
  if (value instanceof Date) {
181
184
  this._date = value;
182
185
  }
183
186
  else {
184
187
  this._date = new Date(value);
185
188
  }
186
- this._moment = moment(this.date);
187
- if (this.type === 'jalali') {
188
- this._moment.locale('fa');
189
- }
190
189
  }
191
- static convert(value, type = AXConfig.get('dateTime.type') || 'gregorian') {
190
+ static convert(value, calendar = AXConfig.get('dateTime.type') || 'gregorian') {
192
191
  let date;
193
192
  if (typeof value === 'string' || value instanceof String) {
194
- date = new AXDateTime(value, type);
193
+ date = new AXDateTime(value, calendar);
195
194
  }
196
195
  else if (value instanceof Date) {
197
- date = new AXDateTime(value, type);
196
+ date = new AXDateTime(value, calendar);
198
197
  }
199
198
  else if (value instanceof AXDateTime) {
200
- date = value;
199
+ date = new AXDateTime(value.date, calendar);
201
200
  }
202
201
  return date;
203
202
  }
203
+ /**
204
+ * This comment _supports_ [Markdown](https://marked.js.org/)
205
+ */
204
206
  get date() {
205
207
  return this._date;
206
208
  }
207
- resolveUnit(unit) {
208
- return this.type === 'jalali' ? 'j' + unit : unit;
209
+ get calendar() {
210
+ return this._calendar;
209
211
  }
210
212
  clone() {
211
- return new AXDateTime(this.date, this.type);
213
+ return new AXDateTime(this.date, this.calendar.name());
212
214
  }
213
215
  get dayInMonth() {
214
- return this._moment.date();
216
+ return this._calendar.dayInMonth(this.date);
215
217
  }
216
218
  get dayOfYear() {
217
- return this._moment.dayOfYear();
219
+ return this._calendar.dayOfYear(this.date);
218
220
  }
219
221
  get dayInWeek() {
220
- return this._moment.day();
222
+ return this._calendar.dayInWeek(this.date);
221
223
  }
222
224
  get hour() {
223
- return this._moment.hour();
225
+ return this._date.getHours();
224
226
  }
225
227
  get minute() {
226
- return this._moment.minute();
228
+ return this._date.getMinutes();
227
229
  }
228
230
  get second() {
229
- return this._moment.second();
231
+ return this._date.getSeconds();
230
232
  }
231
233
  get year() {
232
- return this._moment.year();
234
+ return this._calendar.year(this.date);
233
235
  }
234
236
  get monthOfYear() {
235
- return this._moment.month();
237
+ return this._calendar.monthOfYear(this.date);
236
238
  }
237
239
  get month() {
238
240
  return new AXCalendarMonth(this);
239
241
  }
240
- get firstDayOfWeek() {
241
- const a = moment(this.date);
242
- if (this.type === 'jalali') {
243
- this._moment.locale('fa');
244
- }
245
- return new AXDateTime(a.startOf('w').toDate(), this.type);
246
- }
247
- get endDayOfWeek() {
248
- const a = moment(this.date);
249
- if (this.type === 'jalali') {
250
- this._moment.locale('fa');
251
- }
252
- return new AXDateTime(moment(this.date).endOf('w').toDate(), this.type);
253
- }
254
- convertStringToJalali(date, format) {
255
- return moment(date).locale('fa').format('YYYY/M/D');
256
- }
257
- convertStringToGregorian(date, format) {
258
- return new Date((moment.from(date, 'fa', 'YYYY/MM/DD').format('YYYY/MM/DD')));
259
- }
260
- add(unit = 'day', amount) {
261
- return new AXDateTime(moment(this.date).add(amount, this.resolveUnit(unit)).toDate(), this.type);
262
- }
263
- addDay(amount) {
264
- return new AXDateTime(moment(this.date).add(amount, 'd').toDate(), this.type);
265
- }
266
- addMonth(amount) {
267
- return new AXDateTime(moment(this.date).add(amount, 'months').toDate(), this.type);
268
- }
269
- addHour(amount) {
270
- return new AXDateTime(moment(this.date).add(amount, 'hours').toDate(), this.type);
242
+ add(unit, amount) {
243
+ return this._calendar.add(this.date, unit, amount);
271
244
  }
272
245
  set(unit = 'day', value) {
273
- return new AXDateTime(this._moment.set(unit, value).toDate(), this.type);
246
+ return this._calendar.set(this.date, unit, value);
274
247
  }
275
- duration(end, unit = 'days') {
276
- const duration = moment.duration(this._moment.diff(end._moment));
277
- return Math.round(duration.as(unit));
248
+ duration(end, unit = 'day') {
249
+ const range = new AXDateTimeRange(this, AXDateTime.convert(end, this.calendar.name()));
250
+ return range.duration();
278
251
  }
279
252
  startOf(unit = 'day') {
280
- return new AXDateTime(moment(this.date).startOf(this.resolveUnit(unit)).toDate(), this.type);
253
+ return this._calendar.startOf(this.date, unit);
281
254
  }
282
255
  endOf(unit = 'day') {
283
- return new AXDateTime(moment(this.date).endOf(this.resolveUnit(unit)).toDate(), this.type);
284
- }
285
- format(format = AXConfig.get('dateTime.shortDateFormat') || (this.type === 'gregorian' ? 'DD-MM-YYYY' : 'YYYY-MM-DD')) {
286
- if (format === 'P') {
287
- return this._moment.fromNow();
288
- }
289
- return this._moment.format(format);
256
+ return this._calendar.endOf(this.date, unit);
257
+ }
258
+ format(format = AXConfig.get('dateTime.shortDateFormat') ||
259
+ 'DDD, dd MMM yyyy') {
260
+ format = format.replace('ss', this.pad(this.date.getSeconds(), 2));
261
+ format = format.replace('s', this.date.getSeconds().toString());
262
+ format = format.replace('dd', this.pad(this.calendar.dayInMonth(this.date), 2));
263
+ format = format.replace('d', this.calendar.dayInMonth(this.date).toString());
264
+ format = format.replace('mm', this.pad(this.date.getMinutes(), 2));
265
+ format = format.replace('m', this.date.getMinutes().toString());
266
+ format = format.replace('MMMM', this.calendar.monthNames[this.calendar.monthOfYear(this.date) - 1]);
267
+ format = format.replace('MMM', this.calendar.monthShortNames[this.calendar.monthOfYear(this.date) - 1]);
268
+ format = format.replace('MM', this.pad(this.calendar.monthOfYear(this.date), 2));
269
+ format = format.replace(/M(?![ao])/, this.calendar.monthOfYear(this.date).toString());
270
+ format = format.replace('DDDD', this.calendar.dayNames[this.calendar.dayInWeek(this.date) - 1]);
271
+ format = format.replace('DDD', this.calendar.dayShortNames[this.calendar.dayInWeek(this.date) - 1]);
272
+ format = format.replace(/D(?!e)/, this.calendar.dayNames[this.calendar.dayInWeek(this.date) - 1].substring(0, 3));
273
+ format = format.replace('yyyy', this.calendar.year(this.date).toString());
274
+ format = format.replace('YYYY', this.calendar.year(this.date).toString());
275
+ format = format.replace('yy', this.calendar.year(this.date).toString().substring(2));
276
+ format = format.replace('YY', this.calendar.year(this.date).toString().substring(2));
277
+ format = format.replace('HH', this.pad(this.date.getHours(), 2));
278
+ format = format.replace('H', this.date.getHours().toString());
279
+ return format;
280
+ }
281
+ pad(n, width, z = '0') {
282
+ n = n + '';
283
+ return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
290
284
  }
291
285
  toString() {
292
286
  return this.format();
293
287
  }
294
288
  equal(value, unit = 'day') {
295
- if (!value) {
296
- return false;
297
- }
298
- return this._moment.isSame(moment(value.date), this.resolveUnit(unit));
299
- }
300
- convertToJalaliDate(value) {
301
- const options = {
302
- numberingSystem: 'latn',
303
- year: 'numeric',
304
- month: '2-digit',
305
- day: '2-digit',
306
- hour: '2-digit',
307
- minute: '2-digit',
308
- second: '2-digit'
309
- };
310
- const jDate = new Date(value).toLocaleDateString('fa-IR', options);
311
- const item = {};
312
- item.year = jDate.slice(0, 4);
313
- item.month = jDate.slice(5, 7);
314
- item.day = jDate.slice(8, 10);
315
- item.hour = jDate.slice(13, 15);
316
- item.minutes = jDate.slice(16, 18);
317
- item.seconds = jDate.slice(19, 21);
318
- return item;
319
- }
320
- toJalaliString(value) {
321
- const date = this.convertToJalaliDate(value);
322
- let str = '';
323
- str = date.year + '-' + date.month + '-' + date.day + 'T' + date.hour + ':' + date.minutes + ':' + date.seconds;
324
- return str;
325
- }
326
- convertToGregorianDate(value) {
327
- const options = {
328
- numberingSystem: 'latn',
329
- year: 'numeric',
330
- month: '2-digit',
331
- day: '2-digit',
332
- hour: '2-digit',
333
- minute: '2-digit',
334
- second: '2-digit'
335
- };
336
- const date = new Date(value).toLocaleString('en-us', options);
337
- const item = {};
338
- item.year = date.slice(6, 10);
339
- item.month = date.slice(0, 2);
340
- item.day = date.slice(3, 5);
341
- item.hour = date.slice(12, 14);
342
- item.minutes = date.slice(15, 17);
343
- item.seconds = date.slice(18, 20);
344
- return item;
345
- }
346
- toGregorianString(value) {
347
- const date = this.convertToGregorianDate(value);
348
- let str = '';
349
- str = date.year + '-' + date.month + '-' + date.day + 'T' + date.hour + ':' + date.minutes + ':' + date.seconds;
350
- return str;
351
- }
352
- compaireNew(value, unit = 'YMD', type = 'jalali') {
353
- const range = [0, 0];
354
- let str1;
355
- let str2;
356
- if (type === 'jalali') {
357
- str1 = this.toJalaliString(this.date);
358
- str2 = this.toJalaliString(value.date ? value.date : value);
359
- }
360
- else {
361
- str1 = this.toGregorianString(this.date);
362
- str2 = this.toGregorianString(value.date ? value.date : value);
363
- }
364
- switch (unit) {
365
- case 'YMDhms':
366
- range[0] = 0;
367
- range[1] = 19;
368
- break;
369
- case 'YMDhm':
370
- range[0] = 0;
371
- range[1] = 16;
372
- break;
373
- case 'YMDh':
374
- range[0] = 0;
375
- range[1] = 13;
376
- break;
377
- case 'YMD':
378
- range[0] = 0;
379
- range[1] = 10;
380
- break;
381
- case 'YM':
382
- range[0] = 0;
383
- range[1] = 7;
384
- break;
385
- case 'h':
386
- range[0] = 11;
387
- range[1] = 13;
388
- break;
389
- case 'm':
390
- range[0] = 14;
391
- range[1] = 16;
392
- break;
393
- case 's':
394
- range[0] = 17;
395
- range[1] = 19;
396
- break;
397
- case 'D':
398
- range[0] = 8;
399
- range[1] = 10;
400
- break;
401
- case 'M':
402
- range[0] = 5;
403
- range[1] = 7;
404
- break;
405
- case 'Y':
406
- range[0] = 0;
407
- range[1] = 4;
408
- break;
409
- }
410
- if (str1.slice(range[0], range[1]) === str2.slice(range[0], range[1])) {
411
- return 0;
412
- }
413
- else if (str1.slice(range[0], range[1]) > str2.slice(range[0], range[1])) {
414
- return 1;
415
- }
416
- else {
417
- return -1;
418
- }
289
+ return this.compaire(value, unit) == 0;
419
290
  }
420
291
  compaire(value, unit = 'day') {
421
- if (this._moment.isSame(moment(value.date), this.resolveUnit(unit))) {
292
+ // TODO:
293
+ const val = AXDateTime.convert(value);
294
+ if (this.date == val.date) {
422
295
  return 0;
423
296
  }
424
- else if (this._moment.isAfter(moment(value.date), this.resolveUnit(unit))) {
297
+ else if (this.date > val.date) {
425
298
  return 1;
426
299
  }
427
300
  else {
428
301
  return -1;
429
302
  }
430
303
  }
431
- toISOString() {
432
- return this._date.toISOString();
304
+ convert(calendar) {
305
+ return AXDateTime.convert(this, calendar);
433
306
  }
434
307
  }
435
308
  class AXCalendarMonth {
436
309
  constructor(date) {
437
- this._moment = moment(date.date);
438
310
  this.index = date.date.getMonth();
439
- this.name = this._moment.format('MMMM');
440
- this.range = new AXDateTimeRange(new AXDateTime(this._moment.startOf('month').toDate(), date.type), new AXDateTime(this._moment.endOf('month').toDate(), date.type));
311
+ this.name = date.format('MMMM');
312
+ this.range = new AXDateTimeRange(new AXDateTime(date.startOf('month').date, date.calendar), new AXDateTime(date.endOf('month').date, date.calendar));
441
313
  }
442
314
  get range() {
443
315
  return this._range;
@@ -451,330 +323,81 @@ class AXDateTimeRange {
451
323
  this.startTime = startTime;
452
324
  this.endTime = endTime;
453
325
  }
454
- duration(unit = 'days') {
455
- const duration = moment.duration(moment(this.startTime.date).diff(moment(this.endTime.date)));
456
- return duration.as(unit);
457
- }
458
- enumurate(unit = 'day', type = AXConfig.get('dateTime.type') || 'jalali') {
459
- const result = [];
460
- for (let index = 0; this.startTime.add(unit, index).compaireNew(this.endTime, this.getViewCompaire(unit), type) <= 0; index++) {
461
- result.push(this.startTime.add(unit, index));
462
- }
326
+ duration() {
327
+ const result = {
328
+ miliseconds: 0,
329
+ seconds: 0,
330
+ minutes: 0,
331
+ hours: 0,
332
+ days: 0,
333
+ months: 0,
334
+ years: 0,
335
+ total: {
336
+ miliseconds: 0,
337
+ seconds: 0,
338
+ minutes: 0,
339
+ hours: 0,
340
+ days: 0,
341
+ weeks: 0,
342
+ months: 0,
343
+ years: 0,
344
+ },
345
+ };
346
+ const one_second = 1000;
347
+ const one_min = one_second * 60;
348
+ const one_hour = one_min * 60;
349
+ const one_day = one_hour * 24;
350
+ const one_week = one_day * 7;
351
+ const one_year = 365.25 * one_day;
352
+ const one_month = one_year / 12;
353
+ const startTime = this.startTime.date.getTime();
354
+ const endTime = this.endTime.date.getTime();
355
+ const diff = Math.abs(endTime - startTime);
356
+ //
357
+ result.total.miliseconds = diff;
358
+ result.total.seconds = Number((diff / one_second).toFixed(2));
359
+ result.total.minutes = Number((diff / one_min).toFixed(2));
360
+ result.total.hours = Number((diff / one_hour).toFixed(2));
361
+ result.total.days = Number((diff / one_day).toFixed(2));
362
+ result.total.weeks = Number((diff / one_week).toFixed(2));
363
+ //
364
+ // let months = (this.endTime.year - this.startTime.year) * 12;
365
+ // months += this.endTime.monthOfYear - this.startTime.monthOfYear + 1;
366
+ // if (this.endTime.dayOfYear < this.startTime.dayOfYear) {
367
+ // months--;
368
+ // }
369
+ // result.total.months = Math.abs(months);
370
+ // TODO: review
371
+ result.total.months = Number((diff / one_month).toFixed(2));
372
+ result.total.years = Number((diff / one_year).toFixed(2));
373
+ //
374
+ result.miliseconds = result.total.miliseconds % 1000;
375
+ result.seconds = Number((result.total.seconds % 60).toFixed(0));
376
+ result.minutes = Number((result.total.minutes % 60).toFixed(0));
377
+ result.hours = Number((result.total.hours % 24).toFixed(0));
378
+ // TODO: review
379
+ result.days = Number((result.total.days % 30.4).toFixed(0));
380
+ result.months = Number((result.total.months % 12).toFixed(0));
381
+ result.years = Number(result.total.years.toFixed(0));
463
382
  return result;
464
383
  }
465
- includes(value, unit = 'day', type = 'jalali') {
466
- return (value.compaireNew(this.startTime, this.getViewCompaire(unit), type) >= 0 &&
467
- value.compaireNew(this.endTime, this.getViewCompaire(unit), type) <= 0);
384
+ enumurate(unit = 'day') {
385
+ // TODO: ??
386
+ return [];
468
387
  }
469
- getViewCompaire(view) {
470
- switch (view) {
471
- case 'day':
472
- return 'YMD';
473
- case 'month':
474
- return 'YM';
475
- case 'year':
476
- return 'Y';
477
- }
478
- }
479
- }
480
-
481
- class AXBaseMenuItem {
482
- constructor() {
483
- this.uid = new Date().getTime().toString();
484
- this.visible = true;
485
- this.disable = false;
486
- this.selected = false;
487
- this.style = 'ax light';
488
- this.orderIndex = 0;
489
- }
490
- }
491
- class AXMenuItem extends AXBaseMenuItem {
492
- constructor() {
493
- super(...arguments);
494
- this.divider = false;
495
- }
496
- }
497
- class AXButtonItem extends AXBaseMenuItem {
498
- constructor() {
499
- super(...arguments);
500
- this.dropdown = false;
501
- this.submitBehavior = false;
502
- this.cancelBehavior = false;
503
- }
504
- }
505
- class AXCheckItem {
506
- }
507
-
508
- class AXPromise {
509
- constructor(executor) {
510
- this._executor = executor;
511
- setTimeout(() => {
512
- this._executor(this.thenAction);
513
- }, 50);
514
- }
515
- static resolve(value) {
516
- const r = new AXPromise(z => {
517
- z(value);
518
- }).then(() => { });
519
- return r;
520
- }
521
- then(action) {
522
- this.thenAction = action;
523
- return this;
524
- }
525
- }
526
-
527
- class AXSelectItem {
528
- }
529
-
530
- /**
531
- * @deprecated Use AXBasePageComponent from @acorex/components
532
- */
533
- class AXBasePageComponent {
534
- constructor() {
535
- this.onClosed = new EventEmitter();
536
- }
537
- close(data) {
538
- this.onClosed.emit({
539
- component: this,
540
- data: data
541
- });
542
- }
543
- onClosing(e) {
544
- }
545
- ngOnDestroy() {
546
- this.onClosed.unsubscribe();
547
- }
548
- }
549
-
550
- const AX_ERROR_DISPLAY_INTERCEPTOR = new InjectionToken('ax.error');
551
- let AXErrorService = class AXErrorService {
552
- constructor(injector) {
553
- this.injector = injector;
554
- }
555
- handle(message) {
556
- const instance = this.injector.get(AX_ERROR_DISPLAY_INTERCEPTOR);
557
- if (instance) {
558
- instance.show(message);
559
- }
560
- }
561
- };
562
- AXErrorService.ctorParameters = () => [
563
- { type: Injector }
564
- ];
565
- AXErrorService.ɵprov = ɵɵdefineInjectable({ factory: function AXErrorService_Factory() { return new AXErrorService(ɵɵinject(INJECTOR)); }, token: AXErrorService, providedIn: "root" });
566
- AXErrorService = __decorate([
567
- Injectable({ providedIn: 'root' }),
568
- __metadata("design:paramtypes", [Injector])
569
- ], AXErrorService);
570
-
571
- let AXErrorModule = class AXErrorModule {
572
- };
573
- AXErrorModule = __decorate([
574
- NgModule({
575
- declarations: [],
576
- imports: [CommonModule],
577
- exports: [],
578
- providers: [AXErrorService],
579
- })
580
- ], AXErrorModule);
581
-
582
- const AX_HTTP_EVENT_INTERCEPTOR = new InjectionToken('ax.http.events');
583
-
584
- class HttpResult {
585
- constructor(executor) {
586
- this._executor = executor;
587
- setTimeout(() => {
588
- this._executor(this.resultAction, this.errorAction, this.completeAction);
589
- }, 50);
590
- }
591
- result(action) {
592
- this.resultAction = action;
593
- return this;
594
- }
595
- error(action) {
596
- this.errorAction = action;
597
- return this;
598
- }
599
- complete(action) {
600
- this.completeAction = action;
601
- return this;
388
+ includes(value, unit = 'day') {
389
+ // TODO: ??
390
+ return true;
602
391
  }
603
392
  }
604
393
 
605
- // import { catchError, retry, retryWhen, mergeMap, delay, switchMap, scan, takeWhile, flatMap } from 'rxjs/operators';
606
- // import { of, concat, throwError } from 'rxjs';
607
- let AXHttpService = class AXHttpService {
608
- constructor(http, injector) {
609
- this.http = http;
610
- this.injector = injector;
611
- this.interceptor = this.injector.get(AX_HTTP_EVENT_INTERCEPTOR);
612
- }
613
- get(url, config = {}) {
614
- config.url = url;
615
- config.method = "get";
616
- return this.request(config);
617
- }
618
- post(url, config = {}) {
619
- config.url = url;
620
- config.method = "post";
621
- return this.request(config);
622
- }
623
- delete(url, config = {}) {
624
- config.url = url;
625
- config.method = "delete";
626
- return this.request(config);
627
- }
628
- put(url, config = {}) {
629
- config.url = url;
630
- config.method = "put";
631
- return this.request(config);
632
- }
633
- request(config) {
634
- return new HttpResult((result, error, complete) => {
635
- this.handleBegin(config).then(c => {
636
- this.http
637
- .request(config.method, config.url, this.mapOptions(config))
638
- //.pipe(this.retry)
639
- .subscribe(data => {
640
- this.handleResult(data, result, complete, config);
641
- }, c => {
642
- this.handleError(c, error, complete, config);
643
- });
644
- });
645
- });
646
- }
647
- handleResult(data, result, complete, config) {
648
- if (this.interceptor) {
649
- this.interceptor.success(config, data).then(c => {
650
- if (result)
651
- result(c);
652
- this.handleComplete(complete, config);
653
- });
654
- }
655
- else {
656
- //
657
- if (result)
658
- result(data);
659
- this.handleComplete(complete, config);
660
- }
661
- }
662
- handleBegin(config) {
663
- return new Promise((resolve) => {
664
- if (!config.headers)
665
- config.headers = {};
666
- if (!config.params)
667
- config.params = {};
668
- //
669
- if (this.interceptor) {
670
- this.interceptor.begin(config).then(c => {
671
- resolve(c);
672
- });
673
- }
674
- else {
675
- resolve(config);
676
- }
677
- });
678
- }
679
- handleComplete(complete, config) {
680
- if (complete)
681
- complete();
682
- if (this.interceptor)
683
- this.interceptor.complete(config);
684
- }
685
- handleError(c, error, complete, config) {
686
- var _a;
687
- let r = {
688
- message: c.message,
689
- status: c.status,
690
- code: (_a = c.status) === null || _a === void 0 ? void 0 : _a.toString(),
691
- handled: false,
692
- error: c.error
693
- };
694
- if (error) {
695
- error(r);
696
- }
697
- if (!r.handled) {
698
- if (this.interceptor)
699
- this.interceptor.error(config, r);
700
- }
701
- this.handleComplete(complete, config);
702
- }
703
- mapOptions(options) {
704
- let headers = new HttpHeaders();
705
- for (const key in options.headers) {
706
- if (options.headers.hasOwnProperty(key)) {
707
- const value = options.headers[key];
708
- headers = headers.set(key, value);
709
- }
710
- }
711
- let params = new HttpParams();
712
- for (const key in options.params) {
713
- if (options.params.hasOwnProperty(key)) {
714
- const value = options.params[key];
715
- params = params.set(key, value);
716
- }
717
- }
718
- return {
719
- headers: headers,
720
- params: params,
721
- body: options.body,
722
- responseType: options.responseType || 'json'
723
- };
724
- // if (options.method == "get") {
725
- // return {
726
- // headers: headers,
727
- // params: params
728
- // };
729
- // }
730
- // else {
731
- // return {
732
- // headers: headers,
733
- // params: params,
734
- // body: options.body
735
- // };
736
- // }
737
- }
738
- };
739
- AXHttpService.ctorParameters = () => [
740
- { type: HttpClient },
741
- { type: Injector }
742
- ];
743
- AXHttpService = __decorate([
744
- Injectable(),
745
- __metadata("design:paramtypes", [HttpClient, Injector])
746
- ], AXHttpService);
747
-
748
- var AXHttpModule_1;
749
- let AXHttpModule = AXHttpModule_1 = class AXHttpModule {
750
- static forRoot() {
751
- return {
752
- ngModule: AXHttpModule_1,
753
- providers: [AXHttpService]
754
- };
755
- }
756
- };
757
- AXHttpModule = AXHttpModule_1 = __decorate([
758
- NgModule({
759
- declarations: [],
760
- imports: [
761
- CommonModule,
762
- HttpClientModule
763
- ],
764
- exports: [HttpClientModule],
765
- providers: [
766
- AXHttpService
767
- ]
768
- })
769
- ], AXHttpModule);
770
-
771
- let AXDateTimePipe = class AXDateTimePipe {
394
+ class AXDateTimePipe {
772
395
  constructor() { }
773
- transform(value, format) {
774
- const date = AXDateTime.convert(value);
396
+ transform(value, format, calendar) {
775
397
  if (value == null) {
776
398
  return '';
777
399
  }
400
+ const date = value instanceof AXDateTime ? value.clone() : AXDateTime.convert(value, calendar);
778
401
  if (!format) {
779
402
  return date.toString();
780
403
  }
@@ -782,81 +405,172 @@ let AXDateTimePipe = class AXDateTimePipe {
782
405
  return date.format(format);
783
406
  }
784
407
  }
785
- };
786
- AXDateTimePipe = __decorate([
787
- Pipe({ name: 'dt' }),
788
- __metadata("design:paramtypes", [])
789
- ], AXDateTimePipe);
790
-
791
- let AXHtmlToTextPipe = class AXHtmlToTextPipe {
792
- transform(value) {
793
- if (value) {
794
- const regexHtml = /<\/?[^>]+>/gi;
795
- const regexNbsp = /&nbsp;/gi;
796
- const regexAmp = /&amp;/gi;
797
- return value
798
- .replace(regexHtml, '')
799
- .replace(regexNbsp, '')
800
- .replace(regexAmp, '');
801
- }
802
- else {
803
- return '';
804
- }
805
- }
806
- };
807
- AXHtmlToTextPipe = __decorate([
808
- Pipe({ name: 'html2text' })
809
- ], AXHtmlToTextPipe);
810
-
811
- let AXEventService = class AXEventService {
408
+ }
409
+ AXDateTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
410
+ AXDateTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXDateTimePipe, name: "axDate" });
411
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXDateTimePipe, decorators: [{
412
+ type: Pipe,
413
+ args: [{ name: 'axDate' }]
414
+ }], ctorParameters: function () { return []; } });
415
+
416
+ class AXDateTimeModule {
417
+ }
418
+ AXDateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
419
+ AXDateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXDateTimeModule, declarations: [AXDateTimePipe], exports: [AXDateTimePipe] });
420
+ AXDateTimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXDateTimeModule, providers: [], imports: [[]] });
421
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXDateTimeModule, decorators: [{
422
+ type: NgModule,
423
+ args: [{
424
+ imports: [],
425
+ exports: [AXDateTimePipe],
426
+ declarations: [AXDateTimePipe],
427
+ providers: [],
428
+ }]
429
+ }] });
430
+
431
+ class GeorgianCalendar {
812
432
  constructor() {
813
- this.list = [];
814
- }
815
- broadcast(key, options) {
816
- const d = this.list.find(c => c.key === key);
817
- if (d) {
818
- d.events.forEach(c => {
819
- c(options);
820
- });
433
+ this.monthNames = [
434
+ "January", "February", "March",
435
+ "April", "May", "June", "July",
436
+ "August", "September", "October",
437
+ "November", "December"
438
+ ];
439
+ this.monthShortNames = [
440
+ "Jan", "Feb", "Mar",
441
+ "Apr", "May", "Jun", "Jul",
442
+ "Aug", "Sep", "Oct",
443
+ "Nov", "Dec"
444
+ ];
445
+ this.dayNames = [
446
+ "Sunday", "Monday", "Tuesday", "Wednesday",
447
+ "Thursday", "Friday", "Saturday"
448
+ ];
449
+ this.dayShortNames = [
450
+ "Sun", "Mon", "Tue", "Wed",
451
+ "Thu", "Fri", "Sat"
452
+ ];
453
+ }
454
+ name() {
455
+ return 'gregorian';
456
+ }
457
+ dayInMonth(date) {
458
+ return date.getDate();
459
+ }
460
+ dayOfYear(date) {
461
+ const start = +new Date(date.getFullYear(), 0, 0);
462
+ const diff = +date - start;
463
+ const oneDay = 1000 * 60 * 60 * 24;
464
+ return Math.floor(diff / oneDay);
465
+ }
466
+ dayInWeek(date) {
467
+ return date.getDay() + 1;
468
+ }
469
+ year(date) {
470
+ return date.getFullYear();
471
+ }
472
+ monthOfYear(date) {
473
+ return date.getMonth() + 1;
474
+ }
475
+ add(date, unit, amount) {
476
+ let value = date.valueOf();
477
+ switch (unit) {
478
+ case 'second':
479
+ value += 1000 * amount;
480
+ break;
481
+ case 'minute':
482
+ value += 60000 * amount;
483
+ break;
484
+ case 'hour':
485
+ value += 3600000 * amount;
486
+ break;
487
+ case 'month':
488
+ const v = new Date(value);
489
+ var mo = date.getMonth();
490
+ var yr = date.getFullYear();
491
+ mo = (mo + amount) % 12;
492
+ if (0 > mo) {
493
+ yr += (date.getMonth() + amount - mo - 12) / 12;
494
+ mo += 12;
495
+ }
496
+ else
497
+ yr += ((date.getMonth() + amount - mo) / 12);
498
+ v.setMonth(mo);
499
+ v.setFullYear(yr);
500
+ value = v.valueOf();
501
+ break;
502
+ case 'week':
503
+ value += 7 * 86400000 * amount;
504
+ break;
505
+ case 'year':
506
+ const yv = new Date(value);
507
+ yv.setFullYear(yv.getFullYear() + amount);
508
+ value = v.valueOf();
509
+ break;
510
+ case 'day':
511
+ default:
512
+ value += 86400000 * amount;
821
513
  }
514
+ return new AXDateTime(new Date(value), this.name());
822
515
  }
823
- on(key, callback) {
824
- let d = this.list.find(c => c.key === key);
825
- if (!d) {
826
- d = { key, events: [] };
827
- this.list.push(d);
828
- }
829
- d.events.push(callback);
516
+ set(date, unit, value) {
517
+ throw new Error("Method not implemented.");
830
518
  }
831
- destroy(key, callback) {
832
- const d = this.list.find(c => c.key === key);
833
- if (d) {
834
- d.events = [];
519
+ startOf(date, unit) {
520
+ const clone = new Date(date.valueOf());
521
+ switch (unit) {
522
+ case 'second':
523
+ clone.setHours(clone.getHours(), clone.getMinutes(), clone.getSeconds(), 0);
524
+ return new AXDateTime(clone, this.name());
525
+ case 'minute':
526
+ clone.setHours(clone.getHours(), clone.getMinutes(), 0, 0);
527
+ return new AXDateTime(clone, this.name());
528
+ case 'hour':
529
+ clone.setHours(clone.getHours(), 0, 0, 0);
530
+ return new AXDateTime(clone, this.name());
531
+ default:
532
+ case 'day':
533
+ clone.setHours(0, 0, 0, 0);
534
+ return new AXDateTime(clone, this.name());
535
+ case "week":
536
+ const diff = clone.getDate() - clone.getDay() + (clone.getDay() === 0 ? -6 : 1);
537
+ clone.setDate(diff);
538
+ return new AXDateTime(clone, this.name()).startOf('day');
539
+ case "month":
540
+ clone.setDate(1);
541
+ return new AXDateTime(clone, this.name()).startOf('day');
542
+ case "year":
543
+ clone.setMonth(0);
544
+ clone.setDate(1);
545
+ return new AXDateTime(clone, this.name()).startOf('day');
546
+ }
547
+ }
548
+ endOf(date, unit) {
549
+ const clone = new Date(date.valueOf());
550
+ switch (unit) {
551
+ case 'second':
552
+ clone.setHours(clone.getHours(), clone.getMinutes(), clone.getSeconds(), 999);
553
+ return new AXDateTime(clone, this.name());
554
+ case 'minute':
555
+ clone.setHours(clone.getHours(), clone.getMinutes(), 59, 999);
556
+ return new AXDateTime(clone, this.name());
557
+ case 'hour':
558
+ clone.setHours(clone.getHours(), 59, 59, 999);
559
+ return new AXDateTime(clone, this.name());
560
+ default:
561
+ case 'day':
562
+ clone.setHours(23, 59, 59, 999);
563
+ return new AXDateTime(clone, this.name());
564
+ case 'week':
565
+ return this.startOf(date, 'week').add('day', 6).endOf('day');
566
+ case 'month':
567
+ return new AXDateTime(new Date(date.getFullYear(), date.getMonth() + 1, 0), this.name()).endOf('day');
568
+ case "year":
569
+ clone.setMonth(11);
570
+ return new AXDateTime(clone, this.name()).endOf('month');
835
571
  }
836
572
  }
837
- };
838
- AXEventService.ɵprov = ɵɵdefineInjectable({ factory: function AXEventService_Factory() { return new AXEventService(); }, token: AXEventService, providedIn: "root" });
839
- AXEventService = __decorate([
840
- Injectable({ providedIn: 'root' })
841
- ], AXEventService);
842
-
843
- let AXNavigator = class AXNavigator {
844
- };
845
- AXNavigator = __decorate([
846
- Injectable()
847
- ], AXNavigator);
848
-
849
- let AXStorageService = class AXStorageService {
850
- get(key) {
851
- return localStorage.getItem(key);
852
- }
853
- set(key, value) {
854
- localStorage.setItem(key, value);
855
- }
856
- };
857
- AXStorageService = __decorate([
858
- Injectable()
859
- ], AXStorageService);
573
+ }
860
574
 
861
575
  // @dynamic
862
576
  class AXTranslator {
@@ -875,1183 +589,163 @@ class AXTranslator {
875
589
  AXTranslator.lang = lang;
876
590
  }
877
591
  static get(key, lang) {
878
- return getPropByPath(AXTranslator[`__data__${lang || AXTranslator.lang}`], key) || key;
592
+ return AXObjectUtil.getPropByPath(AXTranslator[`__data__${lang || AXTranslator.lang}`], key) || key;
879
593
  }
880
594
  }
881
595
  AXTranslator.lang = 'en';
882
596
  AXTranslator.dataChangeSubject = new Subject();
883
597
 
884
- let AXTranslatorService = class AXTranslatorService {
885
- load(lang, value) {
886
- AXTranslator.load(lang, value);
887
- }
888
- use(lang) {
889
- AXTranslator.use(lang);
890
- }
891
- get(key, lang) {
892
- return AXTranslator.get(lang, lang);
893
- }
894
- };
895
- AXTranslatorService.ɵprov = ɵɵdefineInjectable({ factory: function AXTranslatorService_Factory() { return new AXTranslatorService(); }, token: AXTranslatorService, providedIn: "platform" });
896
- AXTranslatorService = __decorate([
897
- Injectable({ providedIn: 'platform' })
898
- ], AXTranslatorService);
899
-
900
- let AXTranslatorPipe = class AXTranslatorPipe {
901
- constructor() { }
902
- // transform(value: string, lang?: string): Promise<string> {
903
- // return new Promise<string>((resolve, reject) => {
904
- // if (!value) {
905
- // resolve(value);
906
- // }
907
- // resolve(this.translate.get(value, lang));
908
- // });
909
- // }
598
+ class AXTranslatorPipe {
910
599
  transform(value, lang) {
911
600
  return AXTranslator.get(value, lang);
912
601
  }
913
- };
914
- AXTranslatorPipe = __decorate([
915
- Pipe({ name: 'trans', pure: true }),
916
- __metadata("design:paramtypes", [])
917
- ], AXTranslatorPipe);
918
-
919
- var common = {
920
- search: "Search",
921
- yes: "yes",
922
- no: "No",
923
- confirm: "Confirm",
924
- okay: "Okay",
925
- cancel: "Cancel",
926
- remove: "Remove",
927
- edit: "Edit",
928
- configs: "Configs",
929
- noDataFound: "No data found!",
930
- searching: "searching ...",
931
- save: "Save",
932
- "save-as": "Save As...",
933
- title: "Title",
934
- description: "Description",
935
- name: "Name",
936
- uniquename: "Unique Name",
937
- size: "Size",
938
- "add-item": "Add Item",
939
- color: "Color",
940
- display: "Display",
941
- "min-value": "Min Value",
942
- value: "Value",
943
- "max-value": "Max Value",
944
- "refresh-rate": "Refresh Rate",
945
- condition: "Condition"
946
- };
947
- var dateTime = {
948
- weekdaysShort: {
949
- sun: "Sun",
950
- mon: "Mon",
951
- tue: "Tue",
952
- wed: "Wed",
953
- thu: "Thu",
954
- fri: "Fri",
955
- sat: "Sat"
956
- },
957
- dayTime: {
958
- am: "am",
959
- pm: "pm",
960
- m: "m",
961
- a: "a",
962
- p: "p"
963
- },
964
- today: "today",
965
- duration: {
966
- format_second: "{0} second(s)",
967
- format_minute: "{0} minute(s)"
968
- }
969
- };
970
- var queryBuilder = {
971
- contains: "contains",
972
- "start-with": "start-with",
973
- "end-with": "end-with",
974
- equal: "equal",
975
- "not-equal": "not-equal",
976
- "null": "null",
977
- "not-null": "not-null",
978
- "greater-than": "greater-than",
979
- gt: "greater-than",
980
- "greater-than-equal": "greater-than-equal",
981
- gte: "greater-than-equal",
982
- "less-than": "less-than",
983
- lt: "less-than",
984
- "less-than-equal": "less-than-equal",
985
- lte: "less-than-equal",
986
- "true": "true",
987
- "false": "false",
988
- empty: "empty"
989
- };
990
- var validation = {
991
- messages: {
992
- required: "This field is required!",
993
- email: "Please enter a valid email address!",
994
- phone: "Please enter a valid phone number!"
995
- }
996
- };
997
- var dataGrid = {
998
- page: "page",
999
- more: "more",
1000
- to: "To",
1001
- of: "Of",
1002
- next: "next",
1003
- last: "last",
1004
- first: "first",
1005
- previous: "previous",
1006
- loadingOoo: "Loading...",
1007
- selectAll: "selectAll",
1008
- searchOoo: "Search...",
1009
- blanks: "blanks",
1010
- filterOoo: "Filter...",
1011
- equals: "Equals",
1012
- notEqual: "NotEqual",
1013
- lessThan: "LessThan",
1014
- greaterThan: "GreaterThan",
1015
- lessThanOrEqual: "LessThanOrEqual",
1016
- greaterThanOrEqual: "GreaterThanOrEqual",
1017
- inRange: "InRange",
1018
- inRangeStart: "To",
1019
- inRangeEnd: "From",
1020
- contains: "Contains",
1021
- notContains: "NotContains",
1022
- startsWith: "Starts with",
1023
- endsWith: "Ends with",
1024
- andCondition: "AND",
1025
- orCondition: "OR",
1026
- applyFilter: "Apply",
1027
- resetFilter: "Reset",
1028
- clearFilter: "Clear",
1029
- group: "Group",
1030
- columns: "Columns",
1031
- filters: "Filters",
1032
- groups: "Groups",
1033
- values: "Values",
1034
- enabled: "Enabled",
1035
- pinColumn: "Pin Column",
1036
- groupBy: "Group by",
1037
- ungroupBy: "UnGroup by",
1038
- resetColumns: "ResetColumns",
1039
- expandAll: "ExpandAll",
1040
- collapseAll: "CollapseAll",
1041
- toolPanel: "ToolPanel",
1042
- "export": "Exporto",
1043
- csvExport: "csv Export",
1044
- excelExport: "Excel Export (.xlsx)",
1045
- excelXmlExport: "Excel Exporto (.xml)",
1046
- chartRange: "Chart Range",
1047
- columnChart: "Column",
1048
- groupedColumn: "Grouped",
1049
- stackedColumn: "Stacked",
1050
- normalizedColumn: "normalized Column",
1051
- barChart: "bar Chart",
1052
- groupedBar: "Grouped",
1053
- stackedBar: "Stacked",
1054
- normalizedBar: "normalized Bar",
1055
- pie: "Pie",
1056
- doughnut: "Doughnut",
1057
- line: "Line",
1058
- xyChart: "X Y (Scatter)",
1059
- scatter: "Scatter",
1060
- bubble: "Bubble",
1061
- areaChart: "Area",
1062
- area: "Area",
1063
- stackedArea: "Stacked",
1064
- normalizedArea: "100% Stacked",
1065
- histogramChart: "Histogram",
1066
- pinLeft: "Pin Left",
1067
- pinRight: "Pin Right",
1068
- noPin: "Dont Pin",
1069
- sum: "Sum",
1070
- min: "Min",
1071
- max: "Max",
1072
- none: "None",
1073
- count: "Count",
1074
- avg: "Average",
1075
- filteredRows: "Filtered",
1076
- selectedRows: "Selected",
1077
- totalRows: "Total Rows",
1078
- totalAndFilteredRows: "Rows",
1079
- copy: "Copy",
1080
- copyWithHeaders: "Copy With Headers",
1081
- ctrlC: "Ctrl C",
1082
- paste: "Paste",
1083
- ctrlV: "Ctrl V",
1084
- pivotChartTitle: "Pivot Chart",
1085
- rangeChartTitle: "Range Chart",
1086
- settings: "Settings",
1087
- data: "Data",
1088
- format: "Format",
1089
- categories: "Categories",
1090
- series: "Series",
1091
- xyValues: "X Y Values",
1092
- paired: "Paired Mode",
1093
- axis: "Axis",
1094
- color: "Color",
1095
- thickness: "Thickness",
1096
- xType: "X Type",
1097
- automatic: "Automatic",
1098
- category: "Category",
1099
- number: "Number",
1100
- time: "Time",
1101
- xRotation: "X Rotation",
1102
- yRotation: "Y Rotation",
1103
- ticks: "Ticks",
1104
- width: "Width",
1105
- length: "Length",
1106
- padding: "Padding",
1107
- chart: "Chart",
1108
- title: "Title",
1109
- background: "Background",
1110
- font: "Font",
1111
- top: "Top",
1112
- right: "Right",
1113
- bottom: "Bottom",
1114
- left: "Left",
1115
- labels: "Labels",
1116
- size: "Size",
1117
- minSize: "Minimum Size",
1118
- maxSize: "Maximum Size",
1119
- legend: "Legend",
1120
- position: "Position",
1121
- markerSize: "Marker Size",
1122
- markerStroke: "Marker Stroke",
1123
- markerPadding: "Marker Padding",
1124
- itemPaddingX: "Item Padding X",
1125
- itemPaddingY: "Item Padding Y",
1126
- strokeWidth: "Stroke Width",
1127
- offset: "Offset",
1128
- offsets: "Offsets",
1129
- tooltips: "Tooltips",
1130
- callout: "Callout",
1131
- markers: "Markers",
1132
- shadow: "Shadow",
1133
- blur: "Blur",
1134
- xOffset: "X Offset",
1135
- yOffset: "Y Offset",
1136
- lineWidth: "Line Width",
1137
- normal: "Normal",
1138
- bold: "Bold",
1139
- italic: "Italic",
1140
- boldItalic: "Bold Italic",
1141
- predefined: "Predefined",
1142
- fillOpacity: "Fill Opacity",
1143
- strokeOpacity: "Line Opacity",
1144
- histogramBinCount: "Bin Count",
1145
- columnGroup: "Column",
1146
- barGroup: "Bar",
1147
- pieGroup: "Pie",
1148
- lineGroup: "Line",
1149
- scatterGroup: "Scatter",
1150
- areaGroup: "Area",
1151
- histogramGroup: "Histogram",
1152
- groupedColumnTooltip: "Grouped",
1153
- stackedColumnTooltip: "Stacked",
1154
- normalizedColumnTooltip: "100% Stacked",
1155
- groupedBarTooltip: "Grouped",
1156
- stackedBarTooltip: "Stacked",
1157
- pieTooltip: "Pie",
1158
- doughnutTooltip: "Doughnut",
1159
- lineTooltip: "Line",
1160
- groupedAreaTooltip: "Grouped",
1161
- stackedAreaTooltip: "Stacked",
1162
- scatterTooltip: "Scatter",
1163
- bubbleTooltip: "Bubble",
1164
- histogramTooltip: "Histogram"
1165
- };
1166
- var en = {
1167
- common: common,
1168
- dateTime: dateTime,
1169
- queryBuilder: queryBuilder,
1170
- validation: validation,
1171
- dataGrid: dataGrid
1172
- };
1173
-
1174
- var en$1 = /*#__PURE__*/Object.freeze({
1175
- __proto__: null,
1176
- common: common,
1177
- dateTime: dateTime,
1178
- queryBuilder: queryBuilder,
1179
- validation: validation,
1180
- dataGrid: dataGrid,
1181
- 'default': en
1182
- });
1183
-
1184
- var common$1 = {
1185
- search: "جستجو",
1186
- yes: "بله",
1187
- no: "خیر",
1188
- confirm: "تایید",
1189
- okay: "تایید",
1190
- cancel: "انصراف",
1191
- remove: "حذف",
1192
- edit: "ویرایش",
1193
- configs: "پیکربندی",
1194
- noDataFound: "موردی یافت نشد!",
1195
- searching: "درحال جستجو ...",
1196
- "save-as": "ذخیره به عنوان ...",
1197
- title: "عنوان",
1198
- description: "توضیحات",
1199
- name: "نام",
1200
- uniquename: "نام شناسه یکتا",
1201
- size: "اندازه",
1202
- "add-item": "افزودن",
1203
- color: "رنگ",
1204
- display: "نمایش",
1205
- value: "مقدار",
1206
- "min-value": "مقدار کمینه",
1207
- "max-value": "مقدار بیشینه",
1208
- "refresh-rate": "نرخ بروز رسانی",
1209
- condition: "شرط"
1210
- };
1211
- var dateTime$1 = {
1212
- weekdaysShort: {
1213
- sun: "ی",
1214
- mon: "د",
1215
- tue: "س",
1216
- wed: "چ",
1217
- thu: "پ",
1218
- fri: "ج",
1219
- sat: "ش"
1220
- },
1221
- dayTime: {
1222
- am: "ق ظ",
1223
- pm: "ب ظُ",
1224
- m: ".ظ",
1225
- a: "ق",
1226
- p: "ب"
1227
- },
1228
- today: "امروز",
1229
- duration: {
1230
- format_second: "{0} ثانیه",
1231
- format_minute: "{0} دقیقه"
1232
- }
1233
- };
1234
- var queryBuilder$1 = {
1235
- contains: "شامل",
1236
- "start-with": "شروع شود با",
1237
- "end-with": "پایان با",
1238
- equal: "برابر با",
1239
- "not-equal": "نا برابر با",
1240
- "null": " خالی باشد",
1241
- "not-null": "خالی نباشد",
1242
- "greater-than": "بزرگ تر",
1243
- gt: "بزرگ تر",
1244
- "greater-than-equal": "بزرگتر مساوی",
1245
- gte: "بزرگتر مساوی",
1246
- "less-than": "کوچکتر",
1247
- lt: "کوچکتر",
1248
- "less-than-equal": "کوچکتر مساوی",
1249
- lte: "کوچکتر مساوی",
1250
- "true": "true",
1251
- "false": "false"
1252
- };
1253
- var validation$1 = {
1254
- messages: {
1255
- required: "مقدار این فیلد الزامی می باشد!",
1256
- email: "این آدرس ایمیل معتبر نمی باشد!",
1257
- phone: "این شماره تلفن معتبر نمی باشد!"
1258
- }
1259
- };
1260
- var dataGrid$1 = {
1261
- page: "صفحه",
1262
- more: "بیشتر",
1263
- to: "تا",
1264
- of: "از",
1265
- next: "بعدی",
1266
- last: "آخرین",
1267
- first: "اولین",
1268
- previous: "قبلی",
1269
- loadingOoo: "لطفا منتظر بمانید ...",
1270
- selectAll: "انتخاب همه",
1271
- searchOoo: "جستجو ...",
1272
- blanks: "جای خالی",
1273
- filterOoo: "فیلتر ...",
1274
- equals: "برابر",
1275
- notEqual: "نابرابر",
1276
- lessThan: "کوچکتر از",
1277
- greaterThan: "بزرگتر از",
1278
- lessThanOrEqual: "کوچکتر مساوی",
1279
- greaterThanOrEqual: "بزرکتر مساوی",
1280
- inRange: "در محدوده",
1281
- inRangeStart: "تا",
1282
- inRangeEnd: "از",
1283
- contains: "شامل",
1284
- notContains: "شامل نمی شود",
1285
- startsWith: "شروع شود با",
1286
- endsWith: "پایان با",
1287
- andCondition: "و",
1288
- orCondition: "یا",
1289
- applyFilter: "اعمال",
1290
- resetFilter: "تنظیم مجدد فیلتر",
1291
- clearFilter: "پاک کردن فیلتر",
1292
- group: "گروه",
1293
- columns: "ستون ها",
1294
- filters: "فیاتر ها",
1295
- groups: "گروه ها ",
1296
- values: "مقدار ها",
1297
- enabled: "فعال شده",
1298
- pinColumn: "سنجاق",
1299
- groupBy: "دسته بندی بر اساس",
1300
- ungroupBy: "حذف دسته بندی",
1301
- resetColumns: "تنظیم مجدد ستون ها",
1302
- expandAll: "باز کردن همه",
1303
- collapseAll: "بستن همه",
1304
- toolPanel: "پنل ابزار",
1305
- "export": "خروجی",
1306
- csvExport: "csv خروجی",
1307
- excelExport: "خروجی اکسل (.xlsx)",
1308
- excelXmlExport: "خروجی اکسل (.xml)",
1309
- chartRange: "محدوده نمودار",
1310
- columnChart: "ستون",
1311
- groupedColumn: "دسته بندی شده",
1312
- stackedColumn: "انباشته",
1313
- normalizedColumn: "ستون نرمال",
1314
- barChart: "نمودار میله ای",
1315
- groupedBar: "دسته بندی شده",
1316
- stackedBar: "انباشته",
1317
- normalizedBar: "نوار ",
1318
- pie: "پای",
1319
- doughnut: "Doughnut",
1320
- line: "خط",
1321
- xyChart: "X Y (پراکندگی)",
1322
- scatter: "پراکندگی",
1323
- bubble: "حباب",
1324
- areaChart: "حوزه",
1325
- area: "حوزه",
1326
- stackedArea: "انباشته ",
1327
- normalizedArea: "100% انباشته",
1328
- histogramChart: "هیستوگرام",
1329
- pinLeft: "سنجاق چپ",
1330
- pinRight: "سنجاق راست",
1331
- noPin: "حذف سنجاق",
1332
- sum: "مجموع",
1333
- min: "مینیمم",
1334
- max: "ماکزیمم",
1335
- none: "هیچ",
1336
- count: "شمردن",
1337
- avg: "میانگین",
1338
- filteredRows: "فیلتر شده",
1339
- selectedRows: "انتخاب شده",
1340
- totalRows: "مجموع ردیف ها",
1341
- totalAndFilteredRows: "سطر ها",
1342
- copy: "کپی",
1343
- copyWithHeaders: "کپی با هدر ها",
1344
- ctrlC: "Ctrl C",
1345
- paste: "جایگزینی",
1346
- ctrlV: "Ctrl V",
1347
- pivotChartTitle: "نمودار محوری",
1348
- rangeChartTitle: "نمودار محدوده",
1349
- settings: "تنظیمات",
1350
- data: "تاریخ",
1351
- format: "قالب",
1352
- categories: "دسته بندی ها",
1353
- series: "Series",
1354
- xyValues: "X Y مقادیر",
1355
- paired: "حالت زوج",
1356
- axis: "محور",
1357
- color: "رنگ",
1358
- thickness: "ضخامت",
1359
- xType: "X Type",
1360
- automatic: "خودکار",
1361
- category: "دسته بندی",
1362
- number: "عدد",
1363
- time: "زمان",
1364
- xRotation: "X چرخش",
1365
- yRotation: "Y چرخش",
1366
- ticks: "نمادها",
1367
- width: "عرض",
1368
- length: "طول",
1369
- padding: "لایه گزاری",
1370
- chart: "جدول",
1371
- title: "عنوان",
1372
- background: "زمینه",
1373
- font: "فونت",
1374
- top: "بالا",
1375
- right: "راست",
1376
- bottom: "پایین",
1377
- left: "چپ",
1378
- labels: "برچسب",
1379
- size: "اندازه",
1380
- minSize: "حداقل اندازه",
1381
- maxSize: "بیشترین اندازه",
1382
- position: "موقعیت",
1383
- markerSize: "اندازه نشانگر",
1384
- callout: "فراخوان",
1385
- markers: "نشانه گرها",
1386
- shadow: "سایه",
1387
- blur: "محو شدن",
1388
- xOffset: "X انحراف",
1389
- yOffset: "Y انحراف",
1390
- lineWidth: "عرض خط",
1391
- normal: "نرمال",
1392
- italic: "Italic",
1393
- boldItalic: "Bold Italic",
1394
- predefined: "Predefined",
1395
- fillOpacity: "Fill Opacity",
1396
- strokeOpacity: "Line Opacity",
1397
- histogramBinCount: "Bin Count",
1398
- columnGroup: "ستون",
1399
- barGroup: "Bar",
1400
- pieGroup: "Pie",
1401
- lineGroup: "خط",
1402
- areaGroup: "حوزه",
1403
- histogramGroup: "هیستوگرام",
1404
- groupedColumnTooltip: "دسته بندی شده",
1405
- stackedColumnTooltip: "Stacked",
1406
- normalizedColumnTooltip: "100% Stacked",
1407
- groupedBarTooltip: "دسته بندی شده",
1408
- stackedBarTooltip: "Stacked",
1409
- pieTooltip: "Pie",
1410
- doughnutTooltip: "Doughnut",
1411
- lineTooltip: "خط",
1412
- groupedAreaTooltip: "گروه بندی شده",
1413
- stackedAreaTooltip: "Stacked",
1414
- scatterTooltip: "Scatter",
1415
- bubbleTooltip: "حباب",
1416
- histogramTooltip: "هیستوگرام",
1417
- autosizeThiscolumn: "تنظیم اندازه ستون ",
1418
- autosizeAllColumns: "تنظیم اندازه همه ستون ها"
1419
- };
1420
- var fa = {
1421
- common: common$1,
1422
- dateTime: dateTime$1,
1423
- queryBuilder: queryBuilder$1,
1424
- validation: validation$1,
1425
- dataGrid: dataGrid$1
1426
- };
1427
-
1428
- var fa$1 = /*#__PURE__*/Object.freeze({
1429
- __proto__: null,
1430
- common: common$1,
1431
- dateTime: dateTime$1,
1432
- queryBuilder: queryBuilder$1,
1433
- validation: validation$1,
1434
- dataGrid: dataGrid$1,
1435
- 'default': fa
1436
- });
1437
-
1438
- let AXTranslatorModule = class AXTranslatorModule {
1439
- constructor() {
1440
- AXTranslator.load('en', en$1);
1441
- AXTranslator.load('fa', fa$1);
1442
- }
1443
- };
1444
- AXTranslatorModule = __decorate([
1445
- NgModule({
1446
- imports: [],
1447
- exports: [AXTranslatorPipe],
1448
- declarations: [AXTranslatorPipe],
1449
- providers: [],
1450
- }),
1451
- __metadata("design:paramtypes", [])
1452
- ], AXTranslatorModule);
1453
-
1454
- // @dynamic
1455
- class AXArrayUtil {
1456
- static pickRandom(array) {
1457
- return array[Math.floor(Math.random() * array.length)];
1458
- }
1459
- static insert(array, index, ...rest) {
1460
- array.splice.apply(array, [index, 0].concat(Array.prototype.slice.call(rest, 1)));
1461
- return array;
1462
- }
1463
- static range(min, max) {
1464
- return new Array(max - min).fill(1).map((d, i) => i);
1465
- }
1466
- static filter(array, filters) {
1467
- if (filters == null || filters.length === 0) {
1468
- return array;
1469
- }
1470
- const lamda = (item) => {
1471
- let result = true;
1472
- for (const key in filters) {
1473
- if (filters.hasOwnProperty(key)) {
1474
- const f = filters[key];
1475
- if (f !== 'AND') {
1476
- const vals = [];
1477
- const mt = f.field.match(/\[\:(.*?)\]/);
1478
- if (mt && mt.length > 1) {
1479
- const p1 = f.field.replace(mt[0], '');
1480
- const p2 = mt[1];
1481
- const prop = AXFetchProp(item, p1);
1482
- if (prop instanceof Array && prop.length) {
1483
- vals.push(...prop.map(m => (AXFetchProp(m, p2))));
1484
- }
1485
- else {
1486
- result = false;
1487
- }
1488
- }
1489
- else {
1490
- vals.push(AXFetchProp(item, f.field));
1491
- }
1492
- for (const j in vals) {
1493
- if (vals.hasOwnProperty(j)) {
1494
- let v1 = vals[j];
1495
- const v2 = f.value;
1496
- if (f.dataType === 'string') {
1497
- v1 = v1.toString();
1498
- switch (f.condition) {
1499
- case 'equal':
1500
- result = (v1 && v2) && v1.toLowerCase() === v2.toLowerCase();
1501
- break;
1502
- case 'not-equal':
1503
- result = !((v1 && v2) && v1.toLowerCase() === v2.toLowerCase());
1504
- break;
1505
- case 'contains':
1506
- result = ((v1 && v2) && (v1.toLowerCase().includes(v2.toLowerCase())));
1507
- break;
1508
- case 'not-contains':
1509
- result = !((v1 && v2) && (v1.toLowerCase().includes(v2.toLowerCase())));
1510
- break;
1511
- case 'start-with':
1512
- result = ((v1 && v2) && (v1.toLowerCase().startsWith(v2.toLowerCase())));
1513
- break;
1514
- case 'end-with':
1515
- result = ((v1 && v2) && (v1.toLowerCase().endsWith(v2.toLowerCase())));
1516
- break;
1517
- case 'is-empty':
1518
- result = v1 == null || v1 === undefined;
1519
- break;
1520
- case 'is-not-empty':
1521
- result = !(v1 == null || v1 === undefined);
1522
- break;
1523
- default:
1524
- console.error('The condition is not defined');
1525
- result = false;
1526
- }
1527
- }
1528
- else if (f.dataType === 'date') {
1529
- }
1530
- else if (f.dataType === 'number') {
1531
- v1 = Number(v1);
1532
- switch (f.condition) {
1533
- case 'equal':
1534
- result = v1 === v2;
1535
- break;
1536
- case 'not-equal':
1537
- result = v1 !== v2;
1538
- break;
1539
- case 'contains':
1540
- result = v2 && v2 instanceof Array && v2.includes(v1);
1541
- break;
1542
- case 'less-than':
1543
- result = v1 < v2;
1544
- break;
1545
- case 'less-than-equal':
1546
- result = v1 <= v2;
1547
- break;
1548
- case 'greater-than':
1549
- result = v1 > v2;
1550
- break;
1551
- case 'greater-than-equal':
1552
- result = v1 >= v2;
1553
- break;
1554
- case 'is-empty':
1555
- result = v1 == null || v1 === undefined;
1556
- break;
1557
- case 'is-not-empty':
1558
- result = !(v1 == null || v1 === undefined);
1559
- break;
1560
- default:
1561
- console.error('The condition is not defined');
1562
- result = false;
1563
- }
1564
- }
1565
- else {
1566
- console.error('The datatype is not supported');
1567
- result = false;
1568
- }
1569
- if (result) {
1570
- break;
1571
- }
1572
- }
1573
- }
1574
- }
1575
- if (!result) {
1576
- return false;
1577
- }
1578
- }
1579
- }
1580
- return true;
1581
- };
1582
- return array.filter(lamda);
1583
- }
1584
- }
1585
-
1586
- class AXMathUtil {
1587
- static randomRange(min, max) {
1588
- return Math.floor(Math.random() * (max - min + 1) + min);
1589
- }
1590
- }
1591
-
1592
- class AXPoint {
1593
- constructor(x, y) {
1594
- this.x = x;
1595
- this.y = y;
1596
- }
1597
602
  }
1598
- class AXClientRec {
1599
- constructor(rec) {
1600
- this._left = rec.left;
1601
- this._top = rec.top;
1602
- this._width = rec.width;
1603
- this._height = rec.height;
1604
- this._right = this._left + this._width;
1605
- this._bottom = this._top + this._height;
1606
- }
1607
- get left() {
1608
- return this._left;
1609
- }
1610
- set left(v) {
1611
- this._left = v;
1612
- }
1613
- get top() {
1614
- return this._top;
1615
- }
1616
- set top(v) {
1617
- this._top = v;
1618
- }
1619
- get right() {
1620
- return this._right;
1621
- }
1622
- set right(v) {
1623
- this._right = v;
1624
- }
1625
- get bottom() {
1626
- return this._bottom;
1627
- }
1628
- set bottom(v) {
1629
- this._bottom = v;
1630
- }
1631
- get width() {
1632
- return this._width;
1633
- }
1634
- set width(v) {
1635
- this._width = v;
1636
- }
1637
- get height() {
1638
- return this._height;
1639
- }
1640
- set height(v) {
1641
- this._height = v;
1642
- }
1643
- intersect(rec) {
1644
- return (this.left < rec.left + rec.width &&
1645
- this.left + this.width > rec.left &&
1646
- this.top < rec.top + rec.height &&
1647
- this.top + this.height > rec.top);
1648
- }
603
+ AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
604
+ AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
605
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXTranslatorPipe, decorators: [{
606
+ type: Pipe,
607
+ args: [{ name: 'trans', pure: true }]
608
+ }] });
609
+
610
+ class AXTranslationModule {
1649
611
  }
1650
- // @dynamic
1651
- class AXHtmlUtil {
1652
- static getBoundingRectPoint(el, placement) {
1653
- const rec = el.getBoundingClientRect();
1654
- const width = el.offsetWidth;
1655
- const height = el.offsetHeight;
1656
- switch (placement) {
1657
- case 'top-start':
1658
- return new AXPoint(rec.left, rec.top);
1659
- case 'top-middle':
1660
- return new AXPoint(rec.left + (width / 2), rec.top);
1661
- case 'top-end':
1662
- return new AXPoint(rec.left + (width), rec.top);
1663
- case 'center-end':
1664
- return new AXPoint(rec.left + (width), rec.top + (height / 2));
1665
- case 'bottom-end':
1666
- return new AXPoint(rec.left + (width), rec.top + (height));
1667
- case 'bottom-middle':
1668
- return new AXPoint(rec.left + (width / 2), rec.top + (height));
1669
- case 'bottom-start':
1670
- return new AXPoint(rec.left, rec.top + (height));
1671
- case 'center-start':
1672
- return new AXPoint(rec.left, rec.top + (height / 2));
1673
- default:
1674
- return new AXPoint(rec.left + (width / 2), rec.top + (height));
1675
- }
1676
- }
1677
- static isInRecPoint(pos, rec) {
1678
- return pos.x >= rec.left && pos.x <= (rec.left + rec.width) && pos.y >= rec.top && (pos.y <= (rec.top + rec.height));
1679
- }
1680
- // static isOverLap(rec1: AXClientRecCtor, rec2: AXClientRecCtor): boolean {
1681
- // const r1: AXClientRec = new AXClientRec(rec1);
1682
- // const r2: AXClientRec = new AXClientRec(rec2);
1683
- // return ;
1684
- // }
1685
- static isInElementBound(pos, element) {
1686
- const elBound = element.getBoundingClientRect();
1687
- return AXHtmlUtil.isInRecPoint(pos, {
1688
- left: elBound.left,
1689
- width: elBound.width,
1690
- top: elBound.top,
1691
- height: elBound.height
1692
- });
1693
- }
1694
- static getDimensions() {
1695
- let winW = 630;
1696
- let winH = 460;
1697
- if (document.body && document.body.offsetWidth) {
1698
- winW = document.body.offsetWidth;
1699
- winH = document.body.offsetHeight;
1700
- }
1701
- if (document.compatMode === 'CSS1Compat' && document.documentElement && document.documentElement.offsetWidth) {
1702
- winW = document.documentElement.offsetWidth;
1703
- winH = document.documentElement.offsetHeight;
1704
- }
1705
- if (window.innerWidth && window.innerHeight) {
1706
- winW = window.innerWidth;
1707
- winH = window.innerHeight;
1708
- }
1709
- return { width: winW, height: winH };
1710
- }
1711
- static getOffsetRight(elem) {
1712
- let element = elem;
1713
- const width = element.offsetWidth;
1714
- let right = 0;
1715
- while (element.offsetParent) {
1716
- right += element.offsetLeft;
1717
- element = element.offsetParent;
1718
- }
1719
- right += element.offsetLeft;
1720
- right = AXHtmlUtil.getDimensions().width - right;
1721
- right -= width;
1722
- return right;
1723
- }
1724
- static getUID() {
1725
- return 'el-' + AXMathUtil.randomRange(1000000000, 9999999999).toString();
1726
- }
1727
- static getRelatedPosition(source, placement, target, alignment) {
1728
- const result = { x: 0, y: 0 };
1729
- const sourcePos = AXHtmlUtil.getBoundingRectPoint(source, placement);
1730
- let top = 0;
1731
- let left = 0;
1732
- switch (alignment) {
1733
- case 'top-start':
1734
- top = sourcePos.y;
1735
- left = sourcePos.x;
1736
- break;
1737
- case 'top-middle':
1738
- top = sourcePos.y;
1739
- left = sourcePos.x - target.offsetWidth / 2;
1740
- break;
1741
- case 'top-end':
1742
- top = sourcePos.y;
1743
- left = sourcePos.x - target.offsetWidth;
1744
- break;
1745
- case 'center-end':
1746
- top = sourcePos.y - target.offsetHeight / 2;
1747
- left = sourcePos.x - target.offsetWidth;
1748
- break;
1749
- case 'bottom-end':
1750
- top = sourcePos.y - target.offsetHeight;
1751
- left = sourcePos.x - target.offsetWidth;
1752
- break;
1753
- case 'bottom-middle':
1754
- top = sourcePos.y - target.offsetHeight;
1755
- left = sourcePos.x - target.offsetWidth / 2;
1756
- break;
1757
- case 'bottom-start':
1758
- top = sourcePos.y - target.offsetHeight;
1759
- left = sourcePos.x;
1760
- break;
1761
- case 'center-start':
1762
- top = sourcePos.y - target.offsetHeight / 2;
1763
- left = sourcePos.x;
1764
- break;
1765
- }
1766
- result.y = top;
1767
- result.x = left;
1768
- return result;
1769
- }
1770
- static collision(a, b) {
1771
- const ac = a.getBoundingClientRect();
1772
- const bc = b.getBoundingClientRect();
1773
- if (ac.left < bc.left + bc.width && ac.left + ac.width > bc.left &&
1774
- ac.top < bc.top + bc.height && ac.top + ac.height > bc.top) {
1775
- return true;
1776
- }
1777
- else {
1778
- return false;
1779
- }
1780
- }
1781
- }
1782
-
1783
- let AXHtmlModule = class AXHtmlModule {
612
+ AXTranslationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
613
+ AXTranslationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
614
+ AXTranslationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXTranslationModule, providers: [], imports: [[]] });
615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXTranslationModule, decorators: [{
616
+ type: NgModule,
617
+ args: [{
618
+ imports: [],
619
+ exports: [AXTranslatorPipe],
620
+ declarations: [AXTranslatorPipe],
621
+ providers: [],
622
+ }]
623
+ }] });
624
+
625
+ const isChrome = (win) => testUserAgent(win, /Chrome/i);
626
+ const isFirefox = (win) => testUserAgent(win, /Firefox/i);
627
+ const isEdge = (win) => testUserAgent(win, /Edge/i);
628
+ const isSafari = (win) => testUserAgent(win, /Safari/i);
629
+ const isOpera = (win) => testUserAgent(win, /Opera/i) || testUserAgent(win, /OPR/i);
630
+ const isMSIE = (win) => testUserAgent(win, /MSIE/i) || testUserAgent(win, /Trident/i);
631
+ const isMobileWeb = (win) => isMobile(win) && !isHybrid(win);
632
+ const isIpad = (win) => {
633
+ // iOS 12 and below
634
+ if (testUserAgent(win, /iPad/i)) {
635
+ return true;
636
+ }
637
+ // iOS 13+
638
+ if (testUserAgent(win, /Macintosh/i) && isMobile(win)) {
639
+ return true;
640
+ }
641
+ return false;
1784
642
  };
1785
- AXHtmlModule = __decorate([
1786
- NgModule({
1787
- declarations: [AXHtmlToTextPipe],
1788
- imports: [CommonModule],
1789
- exports: [AXHtmlToTextPipe],
1790
- providers: []
1791
- })
1792
- ], AXHtmlModule);
1793
-
1794
- let AXOnDemandPreloadService = class AXOnDemandPreloadService {
1795
- constructor() {
1796
- this.subject = new Subject();
1797
- this.tmp = AXHtmlUtil.getUID();
1798
- }
1799
- startPreload(routePath) {
1800
- const slices = [];
1801
- this.subject.next(routePath);
1802
- //console.log('ss', this.tmp);
1803
- }
643
+ const isIphone = (win) => testUserAgent(win, /iPhone/i);
644
+ const isIOS = (win) => testUserAgent(win, /iPhone|iPod/i) || isIpad(win);
645
+ const isAndroid = (win) => testUserAgent(win, /android|sink/i);
646
+ const isAndroidTablet = (win) => {
647
+ return isAndroid(win) && !testUserAgent(win, /mobile/i);
1804
648
  };
1805
- AXOnDemandPreloadService = __decorate([
1806
- Injectable(),
1807
- __metadata("design:paramtypes", [])
1808
- ], AXOnDemandPreloadService);
1809
-
1810
- let AXRenderService = class AXRenderService {
1811
- constructor(appRef, router, componentFactoryResolver, modulePreloadService, injector) {
1812
- this.appRef = appRef;
1813
- this.router = router;
1814
- this.componentFactoryResolver = componentFactoryResolver;
1815
- this.modulePreloadService = modulePreloadService;
1816
- this.injector = injector;
1817
- }
1818
- appendComponent(componentClass, options = {}, location) {
1819
- const componentFactory = this.componentFactoryResolver.resolveComponentFactory(componentClass);
1820
- const componentRef = componentFactory.create(this.injector);
1821
- this.appRef.attachView(componentRef.hostView);
1822
- Object.assign(componentRef.instance, options);
1823
- //
1824
- const domElem = componentRef.hostView.rootNodes[0];
1825
- componentRef.onDestroy(() => {
1826
- this.appRef.detachView(componentRef.hostView);
1827
- });
1828
- if (location) {
1829
- location.appendChild(domElem);
1830
- }
1831
- else {
1832
- document.body.appendChild(domElem);
1833
- }
1834
- setTimeout(() => {
1835
- componentRef.changeDetectorRef.detectChanges();
1836
- }, 0);
1837
- return componentRef;
1838
- }
1839
- findLoadedComponentByRoute(path, timeoutTime = 10) {
1840
- const delay = 200;
1841
- const loop = timeoutTime * 1000 / delay;
1842
- return new Promise((resolve, reject) => {
1843
- let found = null;
1844
- let preload = false;
1845
- const theLoop = (i) => {
1846
- setTimeout(() => {
1847
- found = this._findLoadedComponentByRoute(path);
1848
- if (--i && found == null) {
1849
- if (!preload) {
1850
- this.modulePreloadService.startPreload(path);
1851
- preload = true;
1852
- }
1853
- theLoop(i);
1854
- }
1855
- else if (found) {
1856
- resolve(found);
1857
- }
1858
- else {
1859
- reject();
1860
- }
1861
- }, delay);
1862
- };
1863
- theLoop(loop);
1864
- });
1865
- }
1866
- _findLoadedComponentByRoute(search) {
1867
- let found = null;
1868
- const f = (list, path) => {
1869
- for (const p in list) {
1870
- if (list.hasOwnProperty(p)) {
1871
- const route = list[p];
1872
- const pp = (route.path != '' && route.path != null) ? path + '/' + route.path : path;
1873
- if (pp == search && !route._loadedConfig && route.component) {
1874
- found = route;
1875
- break;
1876
- }
1877
- else if (route._loadedConfig) {
1878
- f(route._loadedConfig.routes, pp);
1879
- }
1880
- }
1881
- }
1882
- };
1883
- for (const p in this.router.config) {
1884
- if (this.router.config.hasOwnProperty(p)) {
1885
- const route = this.router.config[p];
1886
- if (route.path === search && route.component) {
1887
- found = route;
1888
- }
1889
- else if (route['_loadedConfig']) {
1890
- f(route['_loadedConfig'].routes, route.path);
1891
- }
1892
- }
1893
- }
1894
- return found;
1895
- }
649
+ const isPhablet = (win) => {
650
+ const width = win.innerWidth;
651
+ const height = win.innerHeight;
652
+ const smallest = Math.min(width, height);
653
+ const largest = Math.max(width, height);
654
+ return (smallest > 390 && smallest < 520) &&
655
+ (largest > 620 && largest < 800);
1896
656
  };
1897
- AXRenderService.ctorParameters = () => [
1898
- { type: ApplicationRef },
1899
- { type: Router },
1900
- { type: ComponentFactoryResolver },
1901
- { type: AXOnDemandPreloadService },
1902
- { type: Injector }
1903
- ];
1904
- AXRenderService.ɵprov = ɵɵdefineInjectable({ factory: function AXRenderService_Factory() { return new AXRenderService(ɵɵinject(ApplicationRef), ɵɵinject(Router), ɵɵinject(ComponentFactoryResolver), ɵɵinject(AXOnDemandPreloadService), ɵɵinject(INJECTOR)); }, token: AXRenderService, providedIn: "root" });
1905
- AXRenderService = __decorate([
1906
- Injectable({ providedIn: 'root' }),
1907
- __metadata("design:paramtypes", [ApplicationRef,
1908
- Router,
1909
- ComponentFactoryResolver,
1910
- AXOnDemandPreloadService,
1911
- Injector])
1912
- ], AXRenderService);
1913
-
1914
- // @dynamic
1915
- function getOnDemandPreloadServiceFactory() {
1916
- return new AXOnDemandPreloadService();
1917
- }
1918
- let AXRenderingModule = class AXRenderingModule {
657
+ const isTablet = (win) => {
658
+ const width = win.innerWidth;
659
+ const height = win.innerHeight;
660
+ const smallest = Math.min(width, height);
661
+ const largest = Math.max(width, height);
662
+ return (isIpad(win) ||
663
+ isAndroidTablet(win) ||
664
+ ((smallest > 460 && smallest < 820) &&
665
+ (largest > 780 && largest < 1400)));
1919
666
  };
1920
- AXRenderingModule = __decorate([
1921
- NgModule({
1922
- imports: [],
1923
- exports: [],
1924
- declarations: [],
1925
- providers: [
1926
- {
1927
- provide: AXOnDemandPreloadService,
1928
- useFactory: getOnDemandPreloadServiceFactory
1929
- },
1930
- AXRenderService
1931
- ],
1932
- })
1933
- ], AXRenderingModule);
1934
-
1935
- let AXHorizontalScrollDirective = class AXHorizontalScrollDirective {
1936
- constructor(el) {
1937
- this.el = el;
1938
- this.scrollValue = 40;
667
+ const isMobile = (win) => matchMedia(win, '(any-pointer:coarse)');
668
+ const isDesktop = (win) => !isMobile(win);
669
+ const isHybrid = (win) => isCordova(win) || isCapacitorNative(win);
670
+ const isCordova = (win) => !!(win['cordova'] || win['phonegap'] || win['PhoneGap']);
671
+ const isCapacitorNative = (win) => {
672
+ const capacitor = win['Capacitor'];
673
+ return !!(capacitor && capacitor.isNative);
674
+ };
675
+ const isElectron = (win) => testUserAgent(win, /electron/i);
676
+ const isPWA = (win) => !!(win.matchMedia('(display-mode: standalone)').matches || win.navigator.standalone);
677
+ const testUserAgent = (win, expr) => expr.test(win.navigator.userAgent);
678
+ const matchMedia = (win, query) => win.matchMedia(query).matches;
679
+ const PLATFORMS_MAP = {
680
+ 'Android': isAndroid,
681
+ 'iOS': isIOS,
682
+ 'Desktop': isDesktop,
683
+ 'Mobile': isMobile,
684
+ 'Chrome': isChrome,
685
+ 'Firefox': isFirefox,
686
+ 'Safari': isSafari,
687
+ 'Edge': isEdge,
688
+ 'Opera': isOpera,
689
+ 'Hybrid': isHybrid,
690
+ 'PWA': isPWA,
691
+ 'Electron': isElectron,
692
+ };
693
+ class AXPlatformEvent {
694
+ }
695
+ class AXPlatform {
696
+ constructor() {
697
+ this.resize = new Subject();
698
+ this.click = new Subject();
699
+ this.scroll = new Subject();
700
+ window.addEventListener('resize', (e) => {
701
+ this.resize.next({
702
+ nativeEvent: e,
703
+ source: this
704
+ });
705
+ });
706
+ document.addEventListener('click', (e) => {
707
+ this.click.next({
708
+ nativeEvent: e,
709
+ source: this
710
+ });
711
+ }, true);
712
+ document.addEventListener('scroll', (e) => {
713
+ this.scroll.next({
714
+ nativeEvent: e,
715
+ source: this
716
+ });
717
+ }, true);
1939
718
  }
1940
- onMouseWheel(e) {
1941
- const delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
1942
- this.el.nativeElement.scrollLeft -= delta * this.scrollValue;
719
+ isRtl() {
720
+ return document.dir == 'rtl' || document.body.dir == 'rtl' || document.body.style.direction == 'rtl';
1943
721
  }
1944
- };
1945
- AXHorizontalScrollDirective.ctorParameters = () => [
1946
- { type: ElementRef }
1947
- ];
1948
- __decorate([
1949
- Input('horizontalScroll'),
1950
- __metadata("design:type", Object)
1951
- ], AXHorizontalScrollDirective.prototype, "scrollValue", void 0);
1952
- __decorate([
1953
- HostListener('wheel', ['$event']),
1954
- __metadata("design:type", Function),
1955
- __metadata("design:paramtypes", [Object]),
1956
- __metadata("design:returntype", void 0)
1957
- ], AXHorizontalScrollDirective.prototype, "onMouseWheel", null);
1958
- AXHorizontalScrollDirective = __decorate([
1959
- Directive({
1960
- // tslint:disable-next-line: directive-selector
1961
- selector: '[horizontalScroll]'
1962
- }),
1963
- __metadata("design:paramtypes", [ElementRef])
1964
- ], AXHorizontalScrollDirective);
1965
- let AXVerticalScrollDirective = class AXVerticalScrollDirective {
1966
- constructor(el) {
1967
- this.el = el;
1968
- this.scrollValue = 40;
1969
- }
1970
- onMouseWheel(e) {
1971
- const delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.detail));
1972
- this.el.nativeElement.scrollTop -= delta * this.scrollValue;
722
+ isLandscape() {
723
+ return window.innerHeight < window.innerWidth;
1973
724
  }
1974
- };
1975
- AXVerticalScrollDirective.ctorParameters = () => [
1976
- { type: ElementRef }
1977
- ];
1978
- __decorate([
1979
- Input('verticalScroll'),
1980
- __metadata("design:type", Object)
1981
- ], AXVerticalScrollDirective.prototype, "scrollValue", void 0);
1982
- __decorate([
1983
- HostListener('wheel', ['$event']),
1984
- __metadata("design:type", Function),
1985
- __metadata("design:paramtypes", [Object]),
1986
- __metadata("design:returntype", void 0)
1987
- ], AXVerticalScrollDirective.prototype, "onMouseWheel", null);
1988
- AXVerticalScrollDirective = __decorate([
1989
- Directive({
1990
- // tslint:disable-next-line: directive-selector
1991
- selector: '[verticalScroll]'
1992
- }),
1993
- __metadata("design:paramtypes", [ElementRef])
1994
- ], AXVerticalScrollDirective);
1995
-
1996
- let AXScrollModule = class AXScrollModule {
1997
- };
1998
- AXScrollModule = __decorate([
1999
- NgModule({
2000
- declarations: [AXHorizontalScrollDirective, AXVerticalScrollDirective],
2001
- imports: [CommonModule],
2002
- exports: [AXHorizontalScrollDirective, AXVerticalScrollDirective],
2003
- providers: []
2004
- })
2005
- ], AXScrollModule);
2006
-
2007
- let AXSeparatorPipe = class AXSeparatorPipe {
2008
- transform(value) {
2009
- if (value) {
2010
- return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
2011
- }
2012
- else {
2013
- return '0';
2014
- }
725
+ isPortrate() {
726
+ return !this.isLandscape();
2015
727
  }
2016
- };
2017
- AXSeparatorPipe.ɵprov = ɵɵdefineInjectable({ factory: function AXSeparatorPipe_Factory() { return new AXSeparatorPipe(); }, token: AXSeparatorPipe, providedIn: "root" });
2018
- AXSeparatorPipe = __decorate([
2019
- Pipe({ name: 'separator' }),
2020
- Injectable({
2021
- providedIn: 'root'
2022
- })
2023
- ], AXSeparatorPipe);
2024
-
2025
- let AXSeparatorModule = class AXSeparatorModule {
2026
- };
2027
- AXSeparatorModule = __decorate([
2028
- NgModule({
2029
- declarations: [AXSeparatorPipe],
2030
- imports: [CommonModule],
2031
- exports: [AXSeparatorPipe],
2032
- providers: []
2033
- })
2034
- ], AXSeparatorModule);
728
+ is(name) {
729
+ return PLATFORMS_MAP[name](window) || false;
730
+ }
731
+ }
732
+ AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
733
+ AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXPlatform, providedIn: 'platform' });
734
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.6", ngImport: i0, type: AXPlatform, decorators: [{
735
+ type: Injectable,
736
+ args: [{
737
+ providedIn: 'platform',
738
+ }]
739
+ }], ctorParameters: function () { return []; } });
2035
740
 
2036
- const PIPES = [AXDateTimePipe];
2037
- const MODULES = [AXScrollModule, AXTranslatorModule];
2038
- const SERVICES = [AXEventService,
2039
- AXStorageService
2040
- ];
2041
- let AXCoreModule = class AXCoreModule {
2042
- };
2043
- AXCoreModule = __decorate([
2044
- NgModule({
2045
- declarations: [...PIPES],
2046
- imports: [...MODULES],
2047
- exports: [...PIPES],
2048
- providers: [...SERVICES]
2049
- })
2050
- ], AXCoreModule);
741
+ /**
742
+ * Public API refrences of core libraries
743
+ * @module @acorex/core
744
+ */
2051
745
 
2052
746
  /**
2053
747
  * Generated bundle index. Do not edit.
2054
748
  */
2055
749
 
2056
- export { AXArrayUtil, AXBaseMenuItem, AXBasePageComponent, AXButtonItem, AXCalendarMonth, AXCheckItem, AXClientRec, AXColorUtil, AXConfig, AXCoreModule, AXDateTime, AXDateTimePipe, AXDateTimeRange, AXErrorModule, AXErrorService, AXEventService, AXFetchProp, AXHorizontalScrollDirective, AXHtmlModule, AXHtmlToTextPipe, AXHtmlUtil, AXHttpModule, AXHttpService, AXMathUtil, AXMenuItem, AXNavigator, AXObjectUtil, AXOnDemandPreloadService, AXPoint, AXPromise, AXRenderService, AXRenderingModule, AXScrollModule, AXSelectItem, AXSeparatorModule, AXSeparatorPipe, AXStorageService, AXTranslator, AXTranslatorModule, AXTranslatorPipe, AXTranslatorService, AXVerticalScrollDirective, AX_ERROR_DISPLAY_INTERCEPTOR, AX_HTTP_EVENT_INTERCEPTOR, HttpResult, getOnDemandPreloadServiceFactory, getPropByPath, setPropByPath };
750
+ export { AXCalendarMonth, AXConfig, AXCoreModule, AXDateTime, AXDateTimeModule, AXDateTimePipe, AXDateTimeRange, AXObjectUtil, AXPlatform, AXPlatformEvent, AXSafePipe, AXTranslationModule, AXTranslator, AXTranslatorPipe, AX_CALENDARS, GeorgianCalendar, testUserAgent };
2057
751
  //# sourceMappingURL=acorex-core.js.map