@acorex/core 21.0.0-next.3 → 21.0.0-next.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/index.d.ts +14 -0
- package/date-time/index.d.ts +71 -0
- package/fesm2022/acorex-core-components.mjs +17 -3
- package/fesm2022/acorex-core-components.mjs.map +1 -1
- package/fesm2022/acorex-core-config.mjs +3 -3
- package/fesm2022/acorex-core-config.mjs.map +1 -1
- package/fesm2022/acorex-core-constants.mjs.map +1 -1
- package/fesm2022/acorex-core-date-time.mjs +89 -67
- package/fesm2022/acorex-core-date-time.mjs.map +1 -1
- package/fesm2022/acorex-core-events.mjs +3 -3
- package/fesm2022/acorex-core-events.mjs.map +1 -1
- package/fesm2022/acorex-core-file.mjs +53 -10
- package/fesm2022/acorex-core-file.mjs.map +1 -1
- package/fesm2022/acorex-core-format.mjs +82 -32
- package/fesm2022/acorex-core-format.mjs.map +1 -1
- package/fesm2022/acorex-core-icon.mjs +3 -3
- package/fesm2022/acorex-core-icon.mjs.map +1 -1
- package/fesm2022/acorex-core-image.mjs +11 -3
- package/fesm2022/acorex-core-image.mjs.map +1 -1
- package/fesm2022/acorex-core-locale.mjs +43 -10
- package/fesm2022/acorex-core-locale.mjs.map +1 -1
- package/fesm2022/acorex-core-memoize.mjs.map +1 -1
- package/fesm2022/acorex-core-network.mjs +3 -3
- package/fesm2022/acorex-core-network.mjs.map +1 -1
- package/fesm2022/acorex-core-pipes.mjs +9 -3
- package/fesm2022/acorex-core-pipes.mjs.map +1 -1
- package/fesm2022/acorex-core-platform.mjs +31 -10
- package/fesm2022/acorex-core-platform.mjs.map +1 -1
- package/fesm2022/acorex-core-storage.mjs +43 -12
- package/fesm2022/acorex-core-storage.mjs.map +1 -1
- package/fesm2022/acorex-core-translation.mjs +16 -16
- package/fesm2022/acorex-core-translation.mjs.map +1 -1
- package/fesm2022/acorex-core-utils.mjs +4 -4
- package/fesm2022/acorex-core-utils.mjs.map +1 -1
- package/fesm2022/acorex-core-validation.mjs +44 -40
- package/fesm2022/acorex-core-validation.mjs.map +1 -1
- package/fesm2022/acorex-core.mjs.map +1 -1
- package/file/index.d.ts +43 -0
- package/format/index.d.ts +54 -3
- package/image/index.d.ts +8 -0
- package/locale/index.d.ts +66 -0
- package/package.json +5 -5
- package/pipes/index.d.ts +6 -0
- package/platform/index.d.ts +21 -0
- package/storage/index.d.ts +31 -0
- package/validation/index.d.ts +4 -0
|
@@ -1239,10 +1239,10 @@ class AXCalendarService {
|
|
|
1239
1239
|
calendar: calendar.name(),
|
|
1240
1240
|
});
|
|
1241
1241
|
}
|
|
1242
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1243
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
1242
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCalendarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1243
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCalendarService, providedIn: 'root' }); }
|
|
1244
1244
|
}
|
|
1245
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1245
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXCalendarService, decorators: [{
|
|
1246
1246
|
type: Injectable,
|
|
1247
1247
|
args: [{ providedIn: 'root' }]
|
|
1248
1248
|
}], ctorParameters: () => [] });
|
|
@@ -1266,10 +1266,10 @@ class AXDateTimePipe {
|
|
|
1266
1266
|
const val = this._calendarService.convert(value, calendar.name());
|
|
1267
1267
|
return this.formatService.format(val, 'datetime', format);
|
|
1268
1268
|
}
|
|
1269
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1270
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.
|
|
1269
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateTimePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1270
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: AXDateTimePipe, isStandalone: true, name: "axDate" }); }
|
|
1271
1271
|
}
|
|
1272
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateTimePipe, decorators: [{
|
|
1273
1273
|
type: Pipe,
|
|
1274
1274
|
args: [{ name: 'axDate' }]
|
|
1275
1275
|
}] });
|
|
@@ -1314,10 +1314,10 @@ class AXDateFormatter {
|
|
|
1314
1314
|
.convert(value, effectiveOptions.calendar)
|
|
1315
1315
|
.format(format, { locale: effectiveOptions.locale });
|
|
1316
1316
|
}
|
|
1317
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1318
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
1317
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1318
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateFormatter }); }
|
|
1319
1319
|
}
|
|
1320
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1320
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateFormatter, decorators: [{
|
|
1321
1321
|
type: Injectable
|
|
1322
1322
|
}] });
|
|
1323
1323
|
|
|
@@ -1371,10 +1371,10 @@ class AXDateTimeFormatter {
|
|
|
1371
1371
|
.convert(value, effectiveOptions.calendar)
|
|
1372
1372
|
.format(format, { locale: effectiveOptions.locale });
|
|
1373
1373
|
}
|
|
1374
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1375
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
1374
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateTimeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1375
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateTimeFormatter }); }
|
|
1376
1376
|
}
|
|
1377
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1377
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateTimeFormatter, decorators: [{
|
|
1378
1378
|
type: Injectable
|
|
1379
1379
|
}] });
|
|
1380
1380
|
|
|
@@ -1497,10 +1497,10 @@ class AXTimeDurationFormatter {
|
|
|
1497
1497
|
return result.join(separator);
|
|
1498
1498
|
}
|
|
1499
1499
|
}
|
|
1500
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1501
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
1500
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTimeDurationFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1501
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTimeDurationFormatter }); }
|
|
1502
1502
|
}
|
|
1503
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1503
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTimeDurationFormatter, decorators: [{
|
|
1504
1504
|
type: Injectable
|
|
1505
1505
|
}] });
|
|
1506
1506
|
|
|
@@ -1544,16 +1544,17 @@ class AXTimeFormatter {
|
|
|
1544
1544
|
.convert(value, effectiveOptions.calendar)
|
|
1545
1545
|
.format(format, { locale: effectiveOptions.locale });
|
|
1546
1546
|
}
|
|
1547
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1548
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
1547
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTimeFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1548
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTimeFormatter }); }
|
|
1549
1549
|
}
|
|
1550
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1550
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTimeFormatter, decorators: [{
|
|
1551
1551
|
type: Injectable
|
|
1552
1552
|
}] });
|
|
1553
1553
|
|
|
1554
1554
|
class AXTimeLeftFormatter {
|
|
1555
1555
|
constructor() {
|
|
1556
1556
|
this.translateService = inject(AXTranslationService);
|
|
1557
|
+
this.updateInterval = 1000; // Update every second
|
|
1557
1558
|
}
|
|
1558
1559
|
get name() {
|
|
1559
1560
|
return 'timeleft';
|
|
@@ -1569,24 +1570,30 @@ class AXTimeLeftFormatter {
|
|
|
1569
1570
|
else {
|
|
1570
1571
|
valueNumber = Number(value);
|
|
1571
1572
|
}
|
|
1573
|
+
const isPast = valueNumber < 0;
|
|
1572
1574
|
const sign = this.translateService.translateSync(`@acorex:time.${valueNumber >= 0 ? 'left' : 'ago'}`);
|
|
1573
1575
|
const milliseconds = Math.abs(valueNumber);
|
|
1574
1576
|
const durationInSeconds = Math.round(milliseconds / 1000);
|
|
1575
1577
|
let format = options?.format;
|
|
1576
|
-
// Determine the best format if format is null
|
|
1578
|
+
// Determine the best format if format is null (following standard conventions)
|
|
1579
|
+
// Standard time thresholds based on common social media platforms
|
|
1577
1580
|
if (isNil(format)) {
|
|
1578
|
-
if (durationInSeconds <
|
|
1579
|
-
format = '
|
|
1580
|
-
else if (durationInSeconds <
|
|
1581
|
-
format = '
|
|
1582
|
-
else if (durationInSeconds <
|
|
1583
|
-
format = '
|
|
1584
|
-
else if (durationInSeconds <
|
|
1585
|
-
format = '
|
|
1586
|
-
else if (durationInSeconds <
|
|
1587
|
-
format = '
|
|
1581
|
+
if (durationInSeconds < 10)
|
|
1582
|
+
format = 'now'; // 0-10s: "just now"
|
|
1583
|
+
else if (durationInSeconds < 60)
|
|
1584
|
+
format = 's'; // 10-60s: "X seconds ago"
|
|
1585
|
+
else if (durationInSeconds < 3600)
|
|
1586
|
+
format = 'm'; // 1-60 min: "X minutes ago"
|
|
1587
|
+
else if (durationInSeconds < 86400)
|
|
1588
|
+
format = 'h'; // 1-24 hours: "X hours ago"
|
|
1589
|
+
else if (durationInSeconds < 604800)
|
|
1590
|
+
format = 'd'; // 1-7 days: "X days ago"
|
|
1591
|
+
else if (durationInSeconds < 2592000)
|
|
1592
|
+
format = 'w'; // 1-4 weeks: "X weeks ago"
|
|
1593
|
+
else if (durationInSeconds < 31536000)
|
|
1594
|
+
format = 'M'; // 1-12 months: "X months ago"
|
|
1588
1595
|
else
|
|
1589
|
-
format = 'y';
|
|
1596
|
+
format = 'y'; // 1+ years: "X years ago"
|
|
1590
1597
|
}
|
|
1591
1598
|
// Helper function for zero-padding
|
|
1592
1599
|
const pad = (num) => num.toString().padStart(2, '0');
|
|
@@ -1595,74 +1602,89 @@ class AXTimeLeftFormatter {
|
|
|
1595
1602
|
return useSign ? `${translated} ${sign}` : translated;
|
|
1596
1603
|
};
|
|
1597
1604
|
switch (format) {
|
|
1605
|
+
case 'now':
|
|
1606
|
+
// Just now (0-10 seconds) - Standard: immediate time
|
|
1607
|
+
if (isPast) {
|
|
1608
|
+
return translate('just-now', false);
|
|
1609
|
+
}
|
|
1610
|
+
return translate('right-now', false);
|
|
1598
1611
|
case 's':
|
|
1599
|
-
|
|
1612
|
+
// Seconds (10-59 seconds) - Standard: show exact seconds
|
|
1613
|
+
return `${durationInSeconds} ${translate(durationInSeconds === 1 ? 'second' : 'seconds')}`;
|
|
1600
1614
|
case 'ss':
|
|
1601
1615
|
return `${pad(durationInSeconds)} ${translate('seconds')}`;
|
|
1602
|
-
case 'm':
|
|
1603
|
-
|
|
1616
|
+
case 'm': {
|
|
1617
|
+
// Minutes (1-59 minutes) - Standard: show exact minutes
|
|
1618
|
+
const minutes = Math.round(durationInSeconds / 60);
|
|
1619
|
+
return `${minutes} ${translate(minutes === 1 ? 'minute' : 'minutes')}`;
|
|
1620
|
+
}
|
|
1604
1621
|
case 'mm':
|
|
1605
1622
|
return `${pad(Math.round(durationInSeconds / 60))} ${translate('minutes')}`;
|
|
1606
1623
|
case 'h':
|
|
1607
|
-
case 'H':
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
return `${
|
|
1624
|
+
case 'H': {
|
|
1625
|
+
// Hours (1-23 hours) - Standard: show exact hours
|
|
1626
|
+
const hours = Math.round(durationInSeconds / 3600);
|
|
1627
|
+
return `${hours} ${translate(hours === 1 ? 'hour' : 'hours')}`;
|
|
1628
|
+
}
|
|
1611
1629
|
case 'hh':
|
|
1612
1630
|
case 'HH':
|
|
1613
|
-
if (durationInSeconds < 5340)
|
|
1614
|
-
return `01 ${translate('hour')}`;
|
|
1615
1631
|
return `${pad(Math.round(durationInSeconds / 3600))} ${translate('hours')}`;
|
|
1616
1632
|
case 'd':
|
|
1617
|
-
case 'D':
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
return `${
|
|
1633
|
+
case 'D': {
|
|
1634
|
+
// Days (1-6 days) - Standard: show exact days
|
|
1635
|
+
const days = Math.round(durationInSeconds / 86400);
|
|
1636
|
+
return `${days} ${translate(days === 1 ? 'day' : 'days')}`;
|
|
1637
|
+
}
|
|
1621
1638
|
case 'dd':
|
|
1622
1639
|
case 'DD':
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1640
|
+
return `${pad(Math.round(durationInSeconds / 86400))} ${translate('days')}`;
|
|
1641
|
+
case 'w':
|
|
1642
|
+
case 'W': {
|
|
1643
|
+
// Weeks (1-4 weeks) - Standard: show weeks for 7-30 days
|
|
1644
|
+
const weeks = Math.round(durationInSeconds / 604800);
|
|
1645
|
+
return `${weeks} ${translate(weeks === 1 ? 'week' : 'weeks')}`;
|
|
1646
|
+
}
|
|
1647
|
+
case 'ww':
|
|
1648
|
+
case 'WW':
|
|
1649
|
+
return `${pad(Math.round(durationInSeconds / 604800))} ${translate('weeks')}`;
|
|
1650
|
+
case 'M': {
|
|
1651
|
+
// Months (1-11 months) - Standard: show months
|
|
1652
|
+
const months = Math.round(durationInSeconds / 2592000);
|
|
1653
|
+
return `${months} ${translate(months === 1 ? 'month' : 'months')}`;
|
|
1654
|
+
}
|
|
1630
1655
|
case 'MM':
|
|
1631
|
-
|
|
1632
|
-
return `01 ${translate('month')}`;
|
|
1633
|
-
return `${pad(Math.round(durationInSeconds / (3600 * 24 * 30)))} ${translate('months')}`;
|
|
1656
|
+
return `${pad(Math.round(durationInSeconds / 2592000))} ${translate('months')}`;
|
|
1634
1657
|
case 'y':
|
|
1635
|
-
case 'Y':
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
return `${
|
|
1658
|
+
case 'Y': {
|
|
1659
|
+
// Years (1+ years) - Standard: show years
|
|
1660
|
+
const years = Math.round(durationInSeconds / 31536000);
|
|
1661
|
+
return `${years} ${translate(years === 1 ? 'year' : 'years')}`;
|
|
1662
|
+
}
|
|
1639
1663
|
case 'yy':
|
|
1640
1664
|
case 'YY':
|
|
1641
1665
|
case 'yyyy':
|
|
1642
1666
|
case 'YYYY':
|
|
1643
|
-
|
|
1644
|
-
return `01 ${translate('year')}`;
|
|
1645
|
-
return `${pad(Math.round(durationInSeconds / (3600 * 24 * 365)))} ${translate('years')}`;
|
|
1667
|
+
return `${pad(Math.round(durationInSeconds / 31536000))} ${translate('years')}`;
|
|
1646
1668
|
default:
|
|
1647
1669
|
console.error('Invalid format for timeleft formatter pipe');
|
|
1648
1670
|
return 'Invalid format';
|
|
1649
1671
|
}
|
|
1650
1672
|
}
|
|
1651
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1652
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.
|
|
1673
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTimeLeftFormatter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1674
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTimeLeftFormatter }); }
|
|
1653
1675
|
}
|
|
1654
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1676
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXTimeLeftFormatter, decorators: [{
|
|
1655
1677
|
type: Injectable
|
|
1656
1678
|
}] });
|
|
1657
1679
|
|
|
1658
1680
|
class AXDateTimeModule {
|
|
1659
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.
|
|
1660
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.
|
|
1661
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.
|
|
1681
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1682
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.12", ngImport: i0, type: AXDateTimeModule, imports: [i1.AXFormatModule, AXDateTimePipe], exports: [AXDateTimePipe] }); }
|
|
1683
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateTimeModule, imports: [AXFormatModule.forChild({
|
|
1662
1684
|
formatters: [AXDateTimeFormatter, AXDateFormatter, AXTimeFormatter, AXTimeLeftFormatter, AXTimeDurationFormatter],
|
|
1663
1685
|
})] }); }
|
|
1664
1686
|
}
|
|
1665
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.
|
|
1687
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: AXDateTimeModule, decorators: [{
|
|
1666
1688
|
type: NgModule,
|
|
1667
1689
|
args: [{
|
|
1668
1690
|
imports: [
|