@acorex/core 19.14.0-next.3 → 19.14.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.
- package/date-time/index.d.ts +2 -1
- package/date-time/lib/calendar.service.d.ts +1 -1
- package/date-time/lib/formatters/date.formatter.d.ts +3 -3
- package/date-time/lib/formatters/time-duration.formatter.d.ts +3 -0
- package/fesm2022/acorex-core-components.mjs.map +1 -1
- package/fesm2022/acorex-core-config.mjs.map +1 -1
- package/fesm2022/acorex-core-constants.mjs +1 -16
- package/fesm2022/acorex-core-constants.mjs.map +1 -1
- package/fesm2022/acorex-core-date-time.mjs +135 -103
- package/fesm2022/acorex-core-date-time.mjs.map +1 -1
- package/fesm2022/acorex-core-events.mjs.map +1 -1
- package/fesm2022/acorex-core-file.mjs.map +1 -1
- package/fesm2022/acorex-core-format.mjs +39 -39
- package/fesm2022/acorex-core-format.mjs.map +1 -1
- package/fesm2022/acorex-core-image.mjs.map +1 -1
- package/fesm2022/acorex-core-locale-en-AU.profile-DNjKIaZS.mjs.map +1 -1
- package/fesm2022/acorex-core-locale.mjs +110 -110
- package/fesm2022/acorex-core-locale.mjs.map +1 -1
- package/fesm2022/acorex-core-memoize.mjs.map +1 -1
- package/fesm2022/acorex-core-network.mjs +42 -43
- package/fesm2022/acorex-core-network.mjs.map +1 -1
- package/fesm2022/acorex-core-pipes.mjs.map +1 -1
- package/fesm2022/acorex-core-platform.mjs +4 -7
- package/fesm2022/acorex-core-platform.mjs.map +1 -1
- package/fesm2022/acorex-core-storage.mjs.map +1 -1
- package/fesm2022/acorex-core-translation.mjs +53 -19
- package/fesm2022/acorex-core-translation.mjs.map +1 -1
- package/fesm2022/acorex-core-types.mjs +1 -7
- package/fesm2022/acorex-core-types.mjs.map +1 -1
- package/fesm2022/acorex-core-utils.mjs +120 -115
- package/fesm2022/acorex-core-utils.mjs.map +1 -1
- package/fesm2022/acorex-core-validation.mjs +12 -8
- package/fesm2022/acorex-core-validation.mjs.map +1 -1
- package/fesm2022/acorex-core.mjs.map +1 -1
- package/format/index.d.ts +1 -1
- package/locale/index.d.ts +4 -4
- package/locale/lib/locale-profile-provider.service.d.ts +2 -2
- package/locale/lib/locale.config.d.ts +1 -1
- package/locale/lib/profiles/en-AU.profile.d.ts +1 -1
- package/locale/lib/profiles/en-US.profile.d.ts +1 -1
- package/locale/lib/profiles/fa-IR.profile.d.ts +1 -1
- package/network/index.d.ts +2 -2
- package/network/lib/download-task.d.ts +1 -1
- package/package.json +1 -1
- package/translation/index.d.ts +1 -1
- package/translation/lib/translation.parser.d.ts +1 -1
- package/translation/lib/translation.resolver.d.ts +1 -1
- package/translation/lib/translation.service.d.ts +1 -1
- package/utils/index.d.ts +2 -2
@@ -1,4 +1,7 @@
|
|
1
1
|
import { AXEventService } from '@acorex/core/events';
|
2
|
+
import * as i1 from '@acorex/core/format';
|
3
|
+
import { AXFormatService, AXFormatModule } from '@acorex/core/format';
|
4
|
+
import { AXLocaleEvents, AXLocaleService } from '@acorex/core/locale';
|
2
5
|
import * as i0 from '@angular/core';
|
3
6
|
import { InjectionToken, inject, Injectable, Pipe, NgModule } from '@angular/core';
|
4
7
|
import { BehaviorSubject, Subject } from 'rxjs';
|
@@ -6,9 +9,6 @@ import { AX_GLOBAL_CONFIG } from '@acorex/core/config';
|
|
6
9
|
import { defaults, orderBy, set, isNil } from 'lodash-es';
|
7
10
|
import { isBrowser } from '@acorex/core/platform';
|
8
11
|
import { translateSync } from '@acorex/core/translation';
|
9
|
-
import { AXLocaleEvents, AXLocaleService } from '@acorex/core/locale';
|
10
|
-
import * as i1 from '@acorex/core/format';
|
11
|
-
import { AXFormatService, AXFormatModule } from '@acorex/core/format';
|
12
12
|
|
13
13
|
class AXCalendar {
|
14
14
|
/**
|
@@ -599,7 +599,9 @@ class AXSolarHijriCalendar extends AXCalendar {
|
|
599
599
|
/*
|
600
600
|
SolarHijri years starting the 33-year rule.
|
601
601
|
*/
|
602
|
-
this.breaks = [
|
602
|
+
this.breaks = [
|
603
|
+
-61, 9, 38, 199, 426, 686, 756, 818, 1111, 1181, 1210, 1635, 2060, 2097, 2192, 2262, 2324, 2394, 2456, 3178,
|
604
|
+
];
|
603
605
|
}
|
604
606
|
create(value) {
|
605
607
|
const a = this.toGregorian(value.year, value.month, value.date);
|
@@ -964,7 +966,10 @@ class AXSolarHijriCalendar extends AXCalendar {
|
|
964
966
|
};
|
965
967
|
}
|
966
968
|
g2d(gy, gm, gd) {
|
967
|
-
let d = this.div((gy + this.div(gm - 8, 6) + 100100) * 1461, 4) +
|
969
|
+
let d = this.div((gy + this.div(gm - 8, 6) + 100100) * 1461, 4) +
|
970
|
+
this.div(153 * this.mod(gm + 9, 12) + 2, 5) +
|
971
|
+
gd -
|
972
|
+
34840408;
|
968
973
|
d = d - this.div(this.div(gy + 100100 + this.div(gm - 8, 6), 100) * 3, 4) + 752;
|
969
974
|
return d;
|
970
975
|
}
|
@@ -1019,9 +1024,9 @@ const AXDateTimeDefaultConfig = {
|
|
1019
1024
|
calendars: {
|
1020
1025
|
gregorian: new AXGregorianCalendar({
|
1021
1026
|
weekdays: [0, 1, 2, 3, 4, 5, 6],
|
1022
|
-
weekend: [5, 6]
|
1027
|
+
weekend: [5, 6],
|
1023
1028
|
}),
|
1024
|
-
|
1029
|
+
'solar-hijri': new AXSolarHijriCalendar({
|
1025
1030
|
weekdays: [6, 0, 1, 2, 3, 4, 5],
|
1026
1031
|
weekend: [6],
|
1027
1032
|
}),
|
@@ -1099,7 +1104,7 @@ class AXCalendarService {
|
|
1099
1104
|
if (!value) {
|
1100
1105
|
return false;
|
1101
1106
|
}
|
1102
|
-
//
|
1107
|
+
//
|
1103
1108
|
if (value instanceof AXDateTime) {
|
1104
1109
|
return true;
|
1105
1110
|
}
|
@@ -1222,6 +1227,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
1222
1227
|
args: [{ name: 'axDate' }]
|
1223
1228
|
}] });
|
1224
1229
|
|
1230
|
+
class AXDateFormatter {
|
1231
|
+
constructor() {
|
1232
|
+
this.calendarService = inject(AXCalendarService);
|
1233
|
+
this.localeService = inject(AXLocaleService);
|
1234
|
+
}
|
1235
|
+
get name() {
|
1236
|
+
return 'date';
|
1237
|
+
}
|
1238
|
+
format(value, options) {
|
1239
|
+
if (isNil(value)) {
|
1240
|
+
return '';
|
1241
|
+
}
|
1242
|
+
//
|
1243
|
+
if (!this.calendarService.isValidDate(value))
|
1244
|
+
return 'Invalid date';
|
1245
|
+
//
|
1246
|
+
const effectiveOptions = typeof options == 'object'
|
1247
|
+
? {
|
1248
|
+
format: options.format ?? 'short',
|
1249
|
+
locale: options.locale,
|
1250
|
+
calendar: options.calendar ?? this.calendarService.calendar.name(),
|
1251
|
+
}
|
1252
|
+
: {
|
1253
|
+
format: options,
|
1254
|
+
calendar: this.calendarService.calendar.name(),
|
1255
|
+
};
|
1256
|
+
//
|
1257
|
+
const formats = this.localeService.activeProfile().formats;
|
1258
|
+
const map = {
|
1259
|
+
short: formats.date.short,
|
1260
|
+
medium: formats.date.medium,
|
1261
|
+
long: formats.date.long,
|
1262
|
+
full: formats.date.full,
|
1263
|
+
};
|
1264
|
+
const format = map[effectiveOptions.format] ?? effectiveOptions.format ?? map['short'];
|
1265
|
+
//
|
1266
|
+
return this.calendarService
|
1267
|
+
.convert(value, effectiveOptions.calendar)
|
1268
|
+
.format(format, { locale: effectiveOptions.locale });
|
1269
|
+
}
|
1270
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXDateFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1271
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXDateFormatter }); }
|
1272
|
+
}
|
1273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXDateFormatter, decorators: [{
|
1274
|
+
type: Injectable
|
1275
|
+
}] });
|
1276
|
+
|
1225
1277
|
class AXDateTimeFormatter {
|
1226
1278
|
constructor() {
|
1227
1279
|
this.localeService = inject(AXLocaleService);
|
@@ -1322,6 +1374,33 @@ class AXTimeDurationFormatter {
|
|
1322
1374
|
// Join the parts according to the format
|
1323
1375
|
return formattedTime.join(format.includes('ms') || format.includes('MS') ? ':' : ':');
|
1324
1376
|
}
|
1377
|
+
millisecondsToMask(milliseconds, start = 'YEAR', end = 'MILLISECOND') {
|
1378
|
+
if (milliseconds <= 0)
|
1379
|
+
return '';
|
1380
|
+
const allUnits = [
|
1381
|
+
{ name: 'YEAR', value: 31536000000 },
|
1382
|
+
{ name: 'MONTH', value: 2592000000 },
|
1383
|
+
{ name: 'WEEK', value: 604800000 },
|
1384
|
+
{ name: 'DAY', value: 86400000 },
|
1385
|
+
{ name: 'HOUR', value: 3600000 },
|
1386
|
+
{ name: 'MINUTE', value: 60000 },
|
1387
|
+
{ name: 'SECOND', value: 1000 },
|
1388
|
+
{ name: 'MILLISECOND', value: 1 },
|
1389
|
+
];
|
1390
|
+
const startIndex = allUnits.findIndex((unit) => unit.name === start);
|
1391
|
+
const endIndex = allUnits.findIndex((unit) => unit.name === end);
|
1392
|
+
const units = allUnits.slice(startIndex, endIndex + 1);
|
1393
|
+
let remaining = milliseconds;
|
1394
|
+
const parts = [];
|
1395
|
+
for (const unit of units) {
|
1396
|
+
if (remaining >= unit.value) {
|
1397
|
+
const value = Math.floor(remaining / unit.value);
|
1398
|
+
remaining = remaining % unit.value;
|
1399
|
+
parts.push(`${value.toString().padStart(2, '0')}(${unit.name})`);
|
1400
|
+
}
|
1401
|
+
}
|
1402
|
+
return parts.join(':');
|
1403
|
+
}
|
1325
1404
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXTimeDurationFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1326
1405
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXTimeDurationFormatter }); }
|
1327
1406
|
}
|
@@ -1329,6 +1408,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
1329
1408
|
type: Injectable
|
1330
1409
|
}] });
|
1331
1410
|
|
1411
|
+
class AXTimeFormatter {
|
1412
|
+
constructor() {
|
1413
|
+
this.calendarService = inject(AXCalendarService);
|
1414
|
+
this.localeService = inject(AXLocaleService);
|
1415
|
+
}
|
1416
|
+
get name() {
|
1417
|
+
return 'time';
|
1418
|
+
}
|
1419
|
+
format(value, options) {
|
1420
|
+
if (isNil(value)) {
|
1421
|
+
return '';
|
1422
|
+
}
|
1423
|
+
//
|
1424
|
+
if (!this.calendarService.isValidDate(value))
|
1425
|
+
return 'Invalid date';
|
1426
|
+
//
|
1427
|
+
const effectiveOptions = typeof options == 'object'
|
1428
|
+
? {
|
1429
|
+
format: options.format ?? 'short',
|
1430
|
+
locale: options.locale,
|
1431
|
+
calendar: options.calendar ?? this.calendarService.calendar.name(),
|
1432
|
+
}
|
1433
|
+
: {
|
1434
|
+
format: options,
|
1435
|
+
calendar: this.calendarService.calendar.name(),
|
1436
|
+
};
|
1437
|
+
//
|
1438
|
+
const formats = this.localeService.activeProfile().formats;
|
1439
|
+
const map = {
|
1440
|
+
short: formats.time.short,
|
1441
|
+
medium: formats.time.medium,
|
1442
|
+
long: formats.time.long,
|
1443
|
+
full: formats.time.full,
|
1444
|
+
};
|
1445
|
+
const format = map[effectiveOptions.format] ?? effectiveOptions.format ?? map['short'];
|
1446
|
+
//
|
1447
|
+
return this.calendarService
|
1448
|
+
.convert(value, effectiveOptions.calendar)
|
1449
|
+
.format(format, { locale: effectiveOptions.locale });
|
1450
|
+
}
|
1451
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXTimeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1452
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXTimeFormatter }); }
|
1453
|
+
}
|
1454
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXTimeFormatter, decorators: [{
|
1455
|
+
type: Injectable
|
1456
|
+
}] });
|
1457
|
+
|
1332
1458
|
class AXTimeLeftFormatter {
|
1333
1459
|
get name() {
|
1334
1460
|
return 'timeleft';
|
@@ -1416,100 +1542,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
1416
1542
|
type: Injectable
|
1417
1543
|
}] });
|
1418
1544
|
|
1419
|
-
class AXDateFormatter {
|
1420
|
-
constructor() {
|
1421
|
-
this.calendarService = inject(AXCalendarService);
|
1422
|
-
this.localeService = inject(AXLocaleService);
|
1423
|
-
}
|
1424
|
-
get name() {
|
1425
|
-
return 'date';
|
1426
|
-
}
|
1427
|
-
format(value, options) {
|
1428
|
-
if (isNil(value)) {
|
1429
|
-
return "";
|
1430
|
-
}
|
1431
|
-
//
|
1432
|
-
if (!this.calendarService.isValidDate(value))
|
1433
|
-
return "Invalid date";
|
1434
|
-
//
|
1435
|
-
const effectiveOptions = typeof options == 'object'
|
1436
|
-
? {
|
1437
|
-
format: options.format ?? 'short',
|
1438
|
-
locale: options.locale,
|
1439
|
-
calendar: options.calendar ?? this.calendarService.calendar.name(),
|
1440
|
-
}
|
1441
|
-
: {
|
1442
|
-
format: options,
|
1443
|
-
calendar: this.calendarService.calendar.name(),
|
1444
|
-
};
|
1445
|
-
//
|
1446
|
-
const formats = this.localeService.activeProfile().formats;
|
1447
|
-
const map = {
|
1448
|
-
"short": formats.date.short,
|
1449
|
-
"medium": formats.date.medium,
|
1450
|
-
"long": formats.date.long,
|
1451
|
-
"full": formats.date.full,
|
1452
|
-
};
|
1453
|
-
const format = map[effectiveOptions.format] ?? effectiveOptions.format ?? map['short'];
|
1454
|
-
//
|
1455
|
-
return this.calendarService
|
1456
|
-
.convert(value, effectiveOptions.calendar)
|
1457
|
-
.format(format, { locale: effectiveOptions.locale });
|
1458
|
-
}
|
1459
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXDateFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1460
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXDateFormatter }); }
|
1461
|
-
}
|
1462
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXDateFormatter, decorators: [{
|
1463
|
-
type: Injectable
|
1464
|
-
}] });
|
1465
|
-
|
1466
|
-
class AXTimeFormatter {
|
1467
|
-
constructor() {
|
1468
|
-
this.calendarService = inject(AXCalendarService);
|
1469
|
-
this.localeService = inject(AXLocaleService);
|
1470
|
-
}
|
1471
|
-
get name() {
|
1472
|
-
return 'time';
|
1473
|
-
}
|
1474
|
-
format(value, options) {
|
1475
|
-
if (isNil(value)) {
|
1476
|
-
return '';
|
1477
|
-
}
|
1478
|
-
//
|
1479
|
-
if (!this.calendarService.isValidDate(value))
|
1480
|
-
return 'Invalid date';
|
1481
|
-
//
|
1482
|
-
const effectiveOptions = typeof options == 'object'
|
1483
|
-
? {
|
1484
|
-
format: options.format ?? 'short',
|
1485
|
-
locale: options.locale,
|
1486
|
-
calendar: options.calendar ?? this.calendarService.calendar.name(),
|
1487
|
-
}
|
1488
|
-
: {
|
1489
|
-
format: options,
|
1490
|
-
calendar: this.calendarService.calendar.name(),
|
1491
|
-
};
|
1492
|
-
//
|
1493
|
-
const formats = this.localeService.activeProfile().formats;
|
1494
|
-
const map = {
|
1495
|
-
short: formats.time.short,
|
1496
|
-
medium: formats.time.medium,
|
1497
|
-
long: formats.time.long,
|
1498
|
-
full: formats.time.full,
|
1499
|
-
};
|
1500
|
-
const format = map[effectiveOptions.format] ?? effectiveOptions.format ?? map['short'];
|
1501
|
-
//
|
1502
|
-
return this.calendarService
|
1503
|
-
.convert(value, effectiveOptions.calendar)
|
1504
|
-
.format(format, { locale: effectiveOptions.locale });
|
1505
|
-
}
|
1506
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXTimeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1507
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXTimeFormatter }); }
|
1508
|
-
}
|
1509
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXTimeFormatter, decorators: [{
|
1510
|
-
type: Injectable
|
1511
|
-
}] });
|
1512
|
-
|
1513
1545
|
class AXDateTimeModule {
|
1514
1546
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1515
1547
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.10", ngImport: i0, type: AXDateTimeModule, imports: [i1.AXFormatModule, AXDateTimePipe], exports: [AXDateTimePipe] }); }
|
@@ -1534,5 +1566,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
1534
1566
|
* Generated bundle index. Do not edit.
|
1535
1567
|
*/
|
1536
1568
|
|
1537
|
-
export { AXCalendar, AXCalendarMonth, AXCalendarService, AXDateTime, AXDateTimeDefaultConfig, AXDateTimeFormatter, AXDateTimeModule, AXDateTimePipe, AXDateTimeRange, AXGregorianCalendar, AXHolidaysLoaderDefault, AXSolarHijriCalendar, AXTimeLeftFormatter, AX_DATETIME_CONFIG, AX_DATETIME_HOLIDAYS_LOADER, dateTimeConfig };
|
1569
|
+
export { AXCalendar, AXCalendarMonth, AXCalendarService, AXDateTime, AXDateTimeDefaultConfig, AXDateTimeFormatter, AXDateTimeModule, AXDateTimePipe, AXDateTimeRange, AXGregorianCalendar, AXHolidaysLoaderDefault, AXSolarHijriCalendar, AXTimeDurationFormatter, AXTimeLeftFormatter, AX_DATETIME_CONFIG, AX_DATETIME_HOLIDAYS_LOADER, dateTimeConfig };
|
1538
1570
|
//# sourceMappingURL=acorex-core-date-time.mjs.map
|