@acorex/core 5.0.36 → 5.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Pipe, NgModule, Injectable, Inject } from '@angular/core';
3
3
  import * as i1 from '@angular/platform-browser';
4
+ import _ from 'lodash';
4
5
  import { Subject } from 'rxjs';
5
6
  import { DOCUMENT } from '@angular/common';
6
7
  import { Observable } from 'rxjs/internal/Observable';
@@ -43,50 +44,6 @@ class AXObjectUtil {
43
44
  }
44
45
  throw new Error('Unable to copy obj! Its type isn\'t supported.');
45
46
  }
46
- static fetchProp(obj, prop) {
47
- if (typeof obj === 'undefined') {
48
- return false;
49
- }
50
- const index = prop.indexOf('.');
51
- if (index > -1) {
52
- return AXObjectUtil.fetchProp(obj[prop.substring(0, index)], prop.substr(index + 1));
53
- }
54
- return obj[prop];
55
- }
56
- static getPropByPath(obj, path, defaultVal) {
57
- path = path
58
- .replace(/\[/g, '.')
59
- .replace(/]/g, '')
60
- .split('.');
61
- path.forEach((level) => {
62
- if (obj) {
63
- obj = obj[level];
64
- }
65
- });
66
- if (obj === undefined) {
67
- return defaultVal;
68
- }
69
- return obj;
70
- }
71
- static setPropByPath(obj, path, value) {
72
- if (Object(obj) !== obj) {
73
- return obj;
74
- } // When obj is not an object
75
- // If not yet an array, get the keys from the string-path
76
- if (!Array.isArray(path)) {
77
- path = path.toString().match(/[^.[\]]+/g) || [];
78
- }
79
- path.slice(0, -1).reduce((a, c, i) => // Iterate all of them except the last one
80
- Object(a[c]) === a[c] // Does the key exist and is its value an object?
81
- // Yes: then follow that path
82
- ? a[c]
83
- // No: create the key. Is the next key a potential array-index?
84
- : a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1]
85
- ? [] // Yes: assign a new array object
86
- : {}, // No: assign a new plain object
87
- obj)[path[path.length - 1]] = value; // Finally assign the value to the last key
88
- return obj; // Return the top-level object to allow chaining
89
- }
90
47
  }
91
48
 
92
49
  // @dynamic
@@ -152,9 +109,9 @@ class AXSafePipe {
152
109
  }
153
110
  }
154
111
  }
155
- AXSafePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXSafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
156
- AXSafePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXSafePipe, name: "safe" });
157
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXSafePipe, decorators: [{
112
+ AXSafePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXSafePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
113
+ AXSafePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXSafePipe, name: "safe" });
114
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXSafePipe, decorators: [{
158
115
  type: Pipe,
159
116
  args: [{
160
117
  name: 'safe',
@@ -164,10 +121,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
164
121
 
165
122
  class AXCoreModule {
166
123
  }
167
- AXCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
168
- AXCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXCoreModule, declarations: [AXSafePipe], exports: [AXSafePipe] });
169
- AXCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXCoreModule, providers: [], imports: [[]] });
170
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXCoreModule, decorators: [{
124
+ AXCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
125
+ AXCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXCoreModule, declarations: [AXSafePipe], exports: [AXSafePipe] });
126
+ AXCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXCoreModule, providers: [], imports: [[]] });
127
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXCoreModule, decorators: [{
171
128
  type: NgModule,
172
129
  args: [{
173
130
  imports: [],
@@ -184,13 +141,12 @@ class AXConfig {
184
141
  }
185
142
  static set(arg1, arg2) {
186
143
  if (arg1 && typeof arg1 == 'string') {
187
- AXObjectUtil.setPropByPath(AXConfig.dataModel, arg1, arg2);
144
+ _.set(AXConfig.dataModel, arg1, arg2);
188
145
  AXConfig.dataChangeSubject.next(AXConfig.dataModel);
189
146
  return;
190
147
  }
191
148
  if (arg1 && typeof arg1 == 'object') {
192
- //TODO : fix override
193
- Object.assign(AXConfig.dataModel, arg1);
149
+ _.merge(AXConfig.dataModel, arg1);
194
150
  AXConfig.dataChangeSubject.next(AXConfig.dataModel);
195
151
  return;
196
152
  }
@@ -199,7 +155,7 @@ class AXConfig {
199
155
  }
200
156
  }
201
157
  static get(path, defaultValue) {
202
- return AXObjectUtil.getPropByPath(AXConfig.dataModel, path) || defaultValue;
158
+ return _.get(AXConfig.dataModel, path, defaultValue);
203
159
  }
204
160
  }
205
161
  AXConfig.dataModel = {};
@@ -207,11 +163,8 @@ AXConfig.dataChangeSubject = new Subject();
207
163
 
208
164
  // @dynamic
209
165
  class AXDateTime {
210
- constructor(value = new Date(), calendar = AXConfig.get('dateTime.type') || 'gregorian') {
166
+ constructor(value = new Date(), calendar = AXConfig.get(`dateTime.calendar`)) {
211
167
  this._calendar =
212
- // typeof calendar == 'string'
213
- // ? eval(`new ${AX_CALENDARS.find((c) => c.name == calendar).type}()`)
214
- // : calendar;
215
168
  typeof calendar == 'string'
216
169
  ? AXConfig.get(`dateTime.calendars.${calendar}`)
217
170
  : calendar;
@@ -222,7 +175,7 @@ class AXDateTime {
222
175
  this._date = new Date(value);
223
176
  }
224
177
  }
225
- static convert(value, calendar = AXConfig.get('dateTime.type') || 'gregorian') {
178
+ static convert(value, calendar = AXConfig.get('dateTime.calendar')) {
226
179
  let date;
227
180
  if (typeof value === 'string' || value instanceof String) {
228
181
  date = new AXDateTime(value, calendar);
@@ -290,8 +243,7 @@ class AXDateTime {
290
243
  endOf(unit = 'day') {
291
244
  return this._calendar.endOf(this.date, unit);
292
245
  }
293
- format(format = AXConfig.get('dateTime.shortDateFormat') ||
294
- 'DDD, dd MMM yyyy') {
246
+ format(format = AXConfig.get('dateTime.shortDateFormat')) {
295
247
  format = format.replace('ss', this.pad(this.date.getSeconds(), 2));
296
248
  format = format.replace('s', this.date.getSeconds().toString());
297
249
  format = format.replace('dd', this.pad(this.calendar.dayOfMonth(this.date), 2));
@@ -472,16 +424,16 @@ class AXDateTimePipe {
472
424
  }
473
425
  const date = value instanceof AXDateTime ? value.clone() : AXDateTime.convert(value, calendar);
474
426
  if (!format) {
475
- return date.toString();
427
+ return date.format(AXConfig.get('dateTime.shortDateFormat'));
476
428
  }
477
429
  else {
478
430
  return date.format(format);
479
431
  }
480
432
  }
481
433
  }
482
- AXDateTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
483
- AXDateTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXDateTimePipe, name: "axDate" });
484
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXDateTimePipe, decorators: [{
434
+ AXDateTimePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
435
+ AXDateTimePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXDateTimePipe, name: "axDate" });
436
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXDateTimePipe, decorators: [{
485
437
  type: Pipe,
486
438
  args: [{ name: 'axDate' }]
487
439
  }], ctorParameters: function () { return []; } });
@@ -1004,15 +956,17 @@ class AXDateTimeModule {
1004
956
  calendars: {
1005
957
  jalali: new JalaliCalendar(),
1006
958
  gregorian: new GeorgianCalendar()
1007
- }
959
+ },
960
+ calendar: 'gregorian',
961
+ shortDateFormat: 'DDD, dd MMM yyyy'
1008
962
  }
1009
963
  });
1010
964
  }
1011
965
  }
1012
- AXDateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1013
- AXDateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXDateTimeModule, declarations: [AXDateTimePipe], exports: [AXDateTimePipe] });
1014
- AXDateTimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXDateTimeModule, providers: [], imports: [[]] });
1015
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXDateTimeModule, decorators: [{
966
+ AXDateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
967
+ AXDateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXDateTimeModule, declarations: [AXDateTimePipe], exports: [AXDateTimePipe] });
968
+ AXDateTimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXDateTimeModule, providers: [], imports: [[]] });
969
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXDateTimeModule, decorators: [{
1016
970
  type: NgModule,
1017
971
  args: [{
1018
972
  imports: [],
@@ -1049,9 +1003,9 @@ class AXEventService {
1049
1003
  }
1050
1004
  }
1051
1005
  }
1052
- AXEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1053
- AXEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXEventService, providedIn: 'root' });
1054
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXEventService, decorators: [{
1006
+ AXEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1007
+ AXEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXEventService, providedIn: 'root' });
1008
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXEventService, decorators: [{
1055
1009
  type: Injectable,
1056
1010
  args: [{ providedIn: 'root' }]
1057
1011
  }] });
@@ -1079,9 +1033,9 @@ class AXHotkeysService {
1079
1033
  });
1080
1034
  }
1081
1035
  }
1082
- AXHotkeysService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXHotkeysService, deps: [{ token: i1.EventManager }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
1083
- AXHotkeysService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXHotkeysService });
1084
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXHotkeysService, decorators: [{
1036
+ AXHotkeysService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXHotkeysService, deps: [{ token: i1.EventManager }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
1037
+ AXHotkeysService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXHotkeysService });
1038
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXHotkeysService, decorators: [{
1085
1039
  type: Injectable
1086
1040
  }], ctorParameters: function () { return [{ type: i1.EventManager }, { type: Document, decorators: [{
1087
1041
  type: Inject,
@@ -1105,7 +1059,7 @@ class AXTranslator {
1105
1059
  AXTranslator.lang = lang;
1106
1060
  }
1107
1061
  static get(key, lang) {
1108
- return AXObjectUtil.getPropByPath(AXTranslator[`__data__${lang || AXTranslator.lang}`], key) || key;
1062
+ return _.get(AXTranslator[`__data__${lang || AXTranslator.lang}`], key, key);
1109
1063
  }
1110
1064
  }
1111
1065
  AXTranslator.lang = 'en';
@@ -1116,19 +1070,19 @@ class AXTranslatorPipe {
1116
1070
  return AXTranslator.get(value, lang);
1117
1071
  }
1118
1072
  }
1119
- AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1120
- AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
1121
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXTranslatorPipe, decorators: [{
1073
+ AXTranslatorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXTranslatorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1074
+ AXTranslatorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXTranslatorPipe, name: "trans" });
1075
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXTranslatorPipe, decorators: [{
1122
1076
  type: Pipe,
1123
1077
  args: [{ name: 'trans', pure: true }]
1124
1078
  }] });
1125
1079
 
1126
1080
  class AXTranslationModule {
1127
1081
  }
1128
- AXTranslationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1129
- AXTranslationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
1130
- AXTranslationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXTranslationModule, providers: [], imports: [[]] });
1131
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXTranslationModule, decorators: [{
1082
+ AXTranslationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXTranslationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1083
+ AXTranslationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXTranslationModule, declarations: [AXTranslatorPipe], exports: [AXTranslatorPipe] });
1084
+ AXTranslationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXTranslationModule, providers: [], imports: [[]] });
1085
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXTranslationModule, decorators: [{
1132
1086
  type: NgModule,
1133
1087
  args: [{
1134
1088
  imports: [],
@@ -1253,9 +1207,9 @@ class AXPlatform {
1253
1207
  _html.classList.remove('ax-dark');
1254
1208
  }
1255
1209
  }
1256
- AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1257
- AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXPlatform, providedIn: 'platform' });
1258
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: AXPlatform, decorators: [{
1210
+ AXPlatform.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXPlatform, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1211
+ AXPlatform.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXPlatform, providedIn: 'platform' });
1212
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: AXPlatform, decorators: [{
1259
1213
  type: Injectable,
1260
1214
  args: [{
1261
1215
  providedIn: 'platform',
@@ -1271,5 +1225,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
1271
1225
  * Generated bundle index. Do not edit.
1272
1226
  */
1273
1227
 
1274
- export { AXCalendarMonth, AXConfig, AXCoreModule, AXDateTime, AXDateTimeModule, AXDateTimePipe, AXDateTimeRange, AXDrawingUtil, AXEventService, AXHotkeysService, AXObjectUtil, AXPlatform, AXPlatformEvent, AXSafePipe, AXStringUtil, AXTranslationModule, AXTranslator, AXTranslatorPipe, GeorgianCalendar, testUserAgent };
1228
+ export { AXCalendarMonth, AXConfig, AXCoreModule, AXDateTime, AXDateTimeModule, AXDateTimePipe, AXDateTimeRange, AXDrawingUtil, AXEventService, AXHotkeysService, AXObjectUtil, AXPlatform, AXPlatformEvent, AXSafePipe, AXStringUtil, AXTranslationModule, AXTranslator, AXTranslatorPipe, GeorgianCalendar, JalaliCalendar, testUserAgent };
1275
1229
  //# sourceMappingURL=acorex-core.mjs.map