@onemrvapublic/design-system 18.2.16-develop.8 → 18.2.16
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/esm2022/shared/index.mjs +1 -2
- package/esm2022/shared/src/lib/adapters/index.mjs +3 -3
- package/esm2022/shared/src/lib/adapters/luxon.date.adapter.mjs +253 -0
- package/esm2022/shared/src/lib/adapters/luxon.utils.mjs +23 -0
- package/esm2022/shared/src/lib/adapters/native.date.adapter.mjs +66 -0
- package/esm2022/shared/src/lib/providers/onemrva.date.luxon.provider.mjs +9 -8
- package/esm2022/shared/src/lib/providers/onemrva.date.luxon.year.month.provider.mjs +9 -8
- package/esm2022/shared/src/lib/providers/onemrva.date.native.provider.mjs +4 -10
- package/esm2022/shared/src/lib/providers/onemrva.date.native.year.month.provider.mjs +4 -10
- package/fesm2022/onemrvapublic-design-system-shared.mjs +270 -138
- package/fesm2022/onemrvapublic-design-system-shared.mjs.map +1 -1
- package/package.json +1 -1
- package/shared/index.d.ts +0 -1
- package/shared/src/lib/adapters/index.d.ts +2 -2
- package/shared/src/lib/adapters/luxon.date.adapter.d.ts +50 -0
- package/shared/src/lib/adapters/luxon.utils.d.ts +26 -0
- package/shared/src/lib/adapters/{date.adapter.d.ts → native.date.adapter.d.ts} +3 -3
- package/esm2022/shared/src/lib/adapters/date.adapter.mjs +0 -66
- package/esm2022/shared/src/lib/adapters/year-month.adapter.mjs +0 -59
- package/esm2022/shared/src/lib/modules/index.mjs +0 -3
- package/esm2022/shared/src/lib/modules/shared.datepicker.luxon.module.mjs +0 -46
- package/esm2022/shared/src/lib/modules/shared.datepicker.luxon.year.month.module.mjs +0 -46
- package/shared/src/lib/adapters/year-month.adapter.d.ts +0 -15
- package/shared/src/lib/modules/index.d.ts +0 -2
- package/shared/src/lib/modules/shared.datepicker.luxon.module.d.ts +0 -12
- package/shared/src/lib/modules/shared.datepicker.luxon.year.month.module.d.ts +0 -12
|
@@ -15,13 +15,10 @@ import { catchError as catchError$1, map, startWith as startWith$1 } from 'rxjs/
|
|
|
15
15
|
import * as i1$3 from '@angular/common/http';
|
|
16
16
|
import { __decorate } from 'tslib';
|
|
17
17
|
import * as i1$4 from '@ngx-translate/core';
|
|
18
|
-
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
|
19
18
|
import { countrySpecs, validateIBAN, electronicFormatIBAN, ValidationErrorsIBAN } from 'ibantools';
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
19
|
+
import { NativeDateAdapter, DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS } from '@angular/material/core';
|
|
20
|
+
import { DateTime, Info } from 'luxon';
|
|
22
21
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
23
|
-
import { provideLuxonDateAdapter } from '@angular/material-luxon-adapter';
|
|
24
|
-
import { DateTime } from 'luxon';
|
|
25
22
|
|
|
26
23
|
class ClipboardIconComponent {
|
|
27
24
|
constructor(_elementRef, clipboardService) {
|
|
@@ -1339,81 +1336,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
|
|
|
1339
1336
|
}]
|
|
1340
1337
|
}] });
|
|
1341
1338
|
|
|
1342
|
-
class
|
|
1343
|
-
constructor(translateService) {
|
|
1344
|
-
this._adapter = inject(DateAdapter);
|
|
1345
|
-
translateService.onLangChange
|
|
1346
|
-
.pipe(takeUntilDestroyed())
|
|
1347
|
-
.subscribe(value => {
|
|
1348
|
-
this._adapter.setLocale(value.lang);
|
|
1349
|
-
});
|
|
1350
|
-
}
|
|
1351
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerLuxonSharedModule, deps: [{ token: i1$4.TranslateService }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1352
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerLuxonSharedModule, imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule] }); }
|
|
1353
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerLuxonSharedModule, providers: [
|
|
1354
|
-
{
|
|
1355
|
-
provide: MAT_DATE_LOCALE,
|
|
1356
|
-
useFactory: (translateService) => translateService.currentLang,
|
|
1357
|
-
deps: [TranslateService],
|
|
1358
|
-
},
|
|
1359
|
-
provideLuxonDateAdapter(ONEMRVA_MAT_LUXON_DATE_FORMATS),
|
|
1360
|
-
], imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule] }); }
|
|
1361
|
-
}
|
|
1362
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerLuxonSharedModule, decorators: [{
|
|
1363
|
-
type: NgModule,
|
|
1364
|
-
args: [{
|
|
1365
|
-
declarations: [],
|
|
1366
|
-
imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule],
|
|
1367
|
-
exports: [],
|
|
1368
|
-
providers: [
|
|
1369
|
-
{
|
|
1370
|
-
provide: MAT_DATE_LOCALE,
|
|
1371
|
-
useFactory: (translateService) => translateService.currentLang,
|
|
1372
|
-
deps: [TranslateService],
|
|
1373
|
-
},
|
|
1374
|
-
provideLuxonDateAdapter(ONEMRVA_MAT_LUXON_DATE_FORMATS),
|
|
1375
|
-
],
|
|
1376
|
-
}]
|
|
1377
|
-
}], ctorParameters: () => [{ type: i1$4.TranslateService }] });
|
|
1378
|
-
|
|
1379
|
-
class OnemrvaDatepickerLuxonYearMonthSharedModule {
|
|
1380
|
-
constructor(translateService) {
|
|
1381
|
-
this._adapter = inject(DateAdapter);
|
|
1382
|
-
translateService.onLangChange
|
|
1383
|
-
.pipe(takeUntilDestroyed())
|
|
1384
|
-
.subscribe(value => {
|
|
1385
|
-
this._adapter.setLocale(value.lang);
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1388
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerLuxonYearMonthSharedModule, deps: [{ token: i1$4.TranslateService }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1389
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerLuxonYearMonthSharedModule, imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule] }); }
|
|
1390
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerLuxonYearMonthSharedModule, providers: [
|
|
1391
|
-
{
|
|
1392
|
-
provide: MAT_DATE_LOCALE,
|
|
1393
|
-
useFactory: (translateService) => translateService.currentLang,
|
|
1394
|
-
deps: [TranslateService],
|
|
1395
|
-
},
|
|
1396
|
-
provideLuxonDateAdapter(ONEMRVA_MAT_LUXON_YEAR_MONTH_FORMATS),
|
|
1397
|
-
], imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule] }); }
|
|
1398
|
-
}
|
|
1399
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerLuxonYearMonthSharedModule, decorators: [{
|
|
1400
|
-
type: NgModule,
|
|
1401
|
-
args: [{
|
|
1402
|
-
declarations: [],
|
|
1403
|
-
imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule],
|
|
1404
|
-
exports: [],
|
|
1405
|
-
providers: [
|
|
1406
|
-
{
|
|
1407
|
-
provide: MAT_DATE_LOCALE,
|
|
1408
|
-
useFactory: (translateService) => translateService.currentLang,
|
|
1409
|
-
deps: [TranslateService],
|
|
1410
|
-
},
|
|
1411
|
-
provideLuxonDateAdapter(ONEMRVA_MAT_LUXON_YEAR_MONTH_FORMATS),
|
|
1412
|
-
],
|
|
1413
|
-
}]
|
|
1414
|
-
}], ctorParameters: () => [{ type: i1$4.TranslateService }] });
|
|
1415
|
-
|
|
1416
|
-
class OnemrvaDateAdapter extends NativeDateAdapter {
|
|
1339
|
+
class OnemrvaNativeDateAdapter extends NativeDateAdapter {
|
|
1417
1340
|
constructor(translateService) {
|
|
1418
1341
|
super();
|
|
1419
1342
|
this.translateService = translateService;
|
|
@@ -1465,98 +1388,303 @@ class OnemrvaDateAdapter extends NativeDateAdapter {
|
|
|
1465
1388
|
this.destroyNotifier$.next();
|
|
1466
1389
|
this.destroyNotifier$.complete();
|
|
1467
1390
|
}
|
|
1468
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type:
|
|
1469
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type:
|
|
1391
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaNativeDateAdapter, deps: [{ token: i1$4.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1392
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaNativeDateAdapter }); }
|
|
1470
1393
|
}
|
|
1471
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type:
|
|
1394
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaNativeDateAdapter, decorators: [{
|
|
1472
1395
|
type: Injectable
|
|
1473
1396
|
}], ctorParameters: () => [{ type: i1$4.TranslateService }] });
|
|
1474
1397
|
|
|
1475
|
-
|
|
1398
|
+
/** InjectionToken for LuxonDateAdapter to configure options. */
|
|
1399
|
+
const MAT_LUXON_DATE_ADAPTER_OPTIONS = new InjectionToken('MAT_LUXON_DATE_ADAPTER_OPTIONS', {
|
|
1400
|
+
providedIn: 'root',
|
|
1401
|
+
factory: MAT_LUXON_DATE_ADAPTER_OPTIONS_FACTORY,
|
|
1402
|
+
});
|
|
1403
|
+
/** @docs-private */
|
|
1404
|
+
function MAT_LUXON_DATE_ADAPTER_OPTIONS_FACTORY() {
|
|
1405
|
+
return {
|
|
1406
|
+
useUtc: false,
|
|
1407
|
+
firstDayOfWeek: 0,
|
|
1408
|
+
defaultOutputCalendar: 'gregory',
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
/** Creates an array and fills it with values. */
|
|
1412
|
+
function luxonRange(length, valueFunction) {
|
|
1413
|
+
const valuesArray = Array(length);
|
|
1414
|
+
for (let i = 0; i < length; i++) {
|
|
1415
|
+
valuesArray[i] = valueFunction(i);
|
|
1416
|
+
}
|
|
1417
|
+
return valuesArray;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
/**
|
|
1421
|
+
* @license
|
|
1422
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1423
|
+
*
|
|
1424
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1425
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
1426
|
+
*/
|
|
1427
|
+
/** Adapts Luxon Dates for use with Angular Material. */
|
|
1428
|
+
class OnemrvaLuxonDateAdapter extends DateAdapter {
|
|
1476
1429
|
constructor(translateService) {
|
|
1477
1430
|
super();
|
|
1478
1431
|
this.translateService = translateService;
|
|
1479
|
-
|
|
1432
|
+
const dateLocale = inject(MAT_DATE_LOCALE, { optional: true });
|
|
1433
|
+
const options = inject(MAT_LUXON_DATE_ADAPTER_OPTIONS, {
|
|
1434
|
+
optional: true,
|
|
1435
|
+
});
|
|
1436
|
+
this._useUTC = !!options?.useUtc;
|
|
1437
|
+
this._firstDayOfWeek = options?.firstDayOfWeek || 0;
|
|
1438
|
+
this._defaultOutputCalendar = options?.defaultOutputCalendar || 'gregory';
|
|
1439
|
+
this.setLocale(dateLocale || DateTime.local().locale);
|
|
1480
1440
|
this.setLocale(this.translateService.currentLang);
|
|
1481
|
-
this.translateService
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1441
|
+
if (this.translateService !== undefined) {
|
|
1442
|
+
this.translateService.onLangChange
|
|
1443
|
+
.pipe(takeUntilDestroyed())
|
|
1444
|
+
.subscribe(({ lang }) => {
|
|
1445
|
+
this.setLocale(lang);
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
getYear(date) {
|
|
1450
|
+
return date.year;
|
|
1451
|
+
}
|
|
1452
|
+
getMonth(date) {
|
|
1453
|
+
// Luxon works with 1-indexed months whereas our code expects 0-indexed.
|
|
1454
|
+
return date.month - 1;
|
|
1455
|
+
}
|
|
1456
|
+
getDate(date) {
|
|
1457
|
+
return date.day;
|
|
1458
|
+
}
|
|
1459
|
+
getDayOfWeek(date) {
|
|
1460
|
+
return date.weekday;
|
|
1461
|
+
}
|
|
1462
|
+
getMonthNames(style) {
|
|
1463
|
+
// Adding outputCalendar option, because LuxonInfo doesn't get effected by LuxonSettings
|
|
1464
|
+
return Info.months(style, {
|
|
1465
|
+
locale: this.locale,
|
|
1466
|
+
outputCalendar: this._defaultOutputCalendar,
|
|
1485
1467
|
});
|
|
1486
1468
|
}
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1469
|
+
getDateNames() {
|
|
1470
|
+
// At the time of writing, Luxon doesn't offer similar
|
|
1471
|
+
// functionality so we have to fall back to the Intl API.
|
|
1472
|
+
const dtf = new Intl.DateTimeFormat(this.locale, {
|
|
1473
|
+
day: 'numeric',
|
|
1474
|
+
timeZone: 'utc',
|
|
1475
|
+
});
|
|
1476
|
+
// Format a UTC date in order to avoid DST issues.
|
|
1477
|
+
return luxonRange(31, i => dtf.format(DateTime.utc(2017, 1, i + 1).toJSDate()));
|
|
1490
1478
|
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1479
|
+
getDayOfWeekNames(style) {
|
|
1480
|
+
// Note that we shift the array once, because Luxon returns Monday as the
|
|
1481
|
+
// first day of the week, whereas our logic assumes that it's Sunday. See:
|
|
1482
|
+
// https://moment.github.io/luxon/api-docs/index.html#infoweekdays
|
|
1483
|
+
const days = Info.weekdays(style, { locale: this.locale });
|
|
1484
|
+
days.unshift(days.pop());
|
|
1485
|
+
return days;
|
|
1486
|
+
}
|
|
1487
|
+
getYearName(date) {
|
|
1488
|
+
return date.toFormat('yyyy', this._getOptions());
|
|
1489
|
+
}
|
|
1490
|
+
getFirstDayOfWeek() {
|
|
1491
|
+
return this._firstDayOfWeek;
|
|
1492
|
+
}
|
|
1493
|
+
getNumDaysInMonth(date) {
|
|
1494
|
+
return date.daysInMonth;
|
|
1495
|
+
}
|
|
1496
|
+
clone(date) {
|
|
1497
|
+
return DateTime.fromObject(date.toObject(), this._getOptions());
|
|
1498
|
+
}
|
|
1499
|
+
createDate(year, month, date) {
|
|
1500
|
+
const options = this._getOptions();
|
|
1501
|
+
if (month < 0 || month > 11) {
|
|
1502
|
+
throw Error(`Invalid month index "${month}". Month index has to be between 0 and 11.`);
|
|
1494
1503
|
}
|
|
1495
|
-
if (
|
|
1496
|
-
|
|
1504
|
+
if (date < 1) {
|
|
1505
|
+
throw Error(`Invalid date "${date}". Date has to be greater than 0.`);
|
|
1497
1506
|
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1507
|
+
// Luxon uses 1-indexed months so we need to add one to the month.
|
|
1508
|
+
const result = this._useUTC
|
|
1509
|
+
? DateTime.utc(year, month + 1, date, options)
|
|
1510
|
+
: DateTime.local(year, month + 1, date, options);
|
|
1511
|
+
if (!this.isValid(result)) {
|
|
1512
|
+
throw Error(`Invalid date "${date}". Reason: "${result.invalidReason}".`);
|
|
1503
1513
|
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1514
|
+
return result;
|
|
1515
|
+
}
|
|
1516
|
+
today() {
|
|
1517
|
+
const options = this._getOptions();
|
|
1518
|
+
return this._useUTC
|
|
1519
|
+
? DateTime.utc(options)
|
|
1520
|
+
: DateTime.local(options);
|
|
1521
|
+
}
|
|
1522
|
+
parse(value, parseFormat) {
|
|
1523
|
+
const options = this._getOptions();
|
|
1524
|
+
if (typeof value == 'string' && value.length > 0) {
|
|
1525
|
+
// This is screwing things up as 062005 would become 05 0602
|
|
1526
|
+
// const iso8601Date = LuxonDateTime.fromISO(value, options);
|
|
1527
|
+
//
|
|
1528
|
+
// if (this.isValid(iso8601Date)) {
|
|
1529
|
+
// console.log(iso8601Date);
|
|
1530
|
+
// return iso8601Date;
|
|
1531
|
+
// }
|
|
1532
|
+
const formats = Array.isArray(parseFormat) ? parseFormat : [parseFormat];
|
|
1533
|
+
if (!parseFormat.length) {
|
|
1534
|
+
throw Error('Formats array must not be empty.');
|
|
1510
1535
|
}
|
|
1536
|
+
console.log(formats);
|
|
1537
|
+
for (const format of formats) {
|
|
1538
|
+
console.log(format);
|
|
1539
|
+
const fromFormat = DateTime.fromFormat(value, format, options);
|
|
1540
|
+
if (this.isValid(fromFormat)) {
|
|
1541
|
+
return fromFormat;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
return this.invalid();
|
|
1511
1545
|
}
|
|
1512
|
-
|
|
1546
|
+
else if (typeof value === 'number') {
|
|
1547
|
+
return DateTime.fromMillis(value, options);
|
|
1548
|
+
}
|
|
1549
|
+
else if (value instanceof Date) {
|
|
1550
|
+
return DateTime.fromJSDate(value, options);
|
|
1551
|
+
}
|
|
1552
|
+
else if (value instanceof DateTime) {
|
|
1553
|
+
return DateTime.fromMillis(value.toMillis(), options);
|
|
1554
|
+
}
|
|
1555
|
+
return null;
|
|
1513
1556
|
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1557
|
+
format(date, displayFormat) {
|
|
1558
|
+
if (!this.isValid(date)) {
|
|
1559
|
+
throw Error('LuxonDateAdapter: Cannot format invalid date.');
|
|
1560
|
+
}
|
|
1561
|
+
if (this._useUTC) {
|
|
1562
|
+
return date.setLocale(this.locale).setZone('utc').toFormat(displayFormat);
|
|
1563
|
+
}
|
|
1564
|
+
else {
|
|
1565
|
+
return date.setLocale(this.locale).toFormat(displayFormat);
|
|
1566
|
+
}
|
|
1516
1567
|
}
|
|
1517
|
-
|
|
1518
|
-
this.
|
|
1519
|
-
this.destroyNotifier$.complete();
|
|
1568
|
+
addCalendarYears(date, years) {
|
|
1569
|
+
return date.reconfigure(this._getOptions()).plus({ years });
|
|
1520
1570
|
}
|
|
1521
|
-
|
|
1522
|
-
|
|
1571
|
+
addCalendarMonths(date, months) {
|
|
1572
|
+
return date.reconfigure(this._getOptions()).plus({ months });
|
|
1573
|
+
}
|
|
1574
|
+
addCalendarDays(date, days) {
|
|
1575
|
+
return date.reconfigure(this._getOptions()).plus({ days });
|
|
1576
|
+
}
|
|
1577
|
+
toIso8601(date) {
|
|
1578
|
+
return date.toISO();
|
|
1579
|
+
}
|
|
1580
|
+
/**
|
|
1581
|
+
* Returns the given value if given a valid Luxon or null. Deserializes valid ISO 8601 strings
|
|
1582
|
+
* (https://www.ietf.org/rfc/rfc3339.txt) and valid Date objects into valid DateTime and empty
|
|
1583
|
+
* string into null. Returns an invalid date for all other values.
|
|
1584
|
+
*/
|
|
1585
|
+
deserialize(value) {
|
|
1586
|
+
const options = this._getOptions();
|
|
1587
|
+
let date;
|
|
1588
|
+
if (value instanceof Date) {
|
|
1589
|
+
date = DateTime.fromJSDate(value, options);
|
|
1590
|
+
}
|
|
1591
|
+
if (typeof value === 'string') {
|
|
1592
|
+
if (!value) {
|
|
1593
|
+
return null;
|
|
1594
|
+
}
|
|
1595
|
+
date = DateTime.fromISO(value, options);
|
|
1596
|
+
}
|
|
1597
|
+
if (date && this.isValid(date)) {
|
|
1598
|
+
return date;
|
|
1599
|
+
}
|
|
1600
|
+
return super.deserialize(value);
|
|
1601
|
+
}
|
|
1602
|
+
isDateInstance(obj) {
|
|
1603
|
+
return obj instanceof DateTime;
|
|
1604
|
+
}
|
|
1605
|
+
isValid(date) {
|
|
1606
|
+
return date.isValid;
|
|
1607
|
+
}
|
|
1608
|
+
invalid() {
|
|
1609
|
+
return DateTime.invalid('Invalid Luxon DateTime object.');
|
|
1610
|
+
}
|
|
1611
|
+
setTime(target, hours, minutes, seconds) {
|
|
1612
|
+
//if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
1613
|
+
if (hours < 0 || hours > 23) {
|
|
1614
|
+
throw Error(`Invalid hours "${hours}". Hours value must be between 0 and 23.`);
|
|
1615
|
+
}
|
|
1616
|
+
if (minutes < 0 || minutes > 59) {
|
|
1617
|
+
throw Error(`Invalid minutes "${minutes}". Minutes value must be between 0 and 59.`);
|
|
1618
|
+
}
|
|
1619
|
+
if (seconds < 0 || seconds > 59) {
|
|
1620
|
+
throw Error(`Invalid seconds "${seconds}". Seconds value must be between 0 and 59.`);
|
|
1621
|
+
}
|
|
1622
|
+
//}
|
|
1623
|
+
return this.clone(target).set({
|
|
1624
|
+
hour: hours,
|
|
1625
|
+
minute: minutes,
|
|
1626
|
+
second: seconds,
|
|
1627
|
+
millisecond: 0,
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
getHours(date) {
|
|
1631
|
+
return date.hour;
|
|
1632
|
+
}
|
|
1633
|
+
getMinutes(date) {
|
|
1634
|
+
return date.minute;
|
|
1635
|
+
}
|
|
1636
|
+
getSeconds(date) {
|
|
1637
|
+
return date.second;
|
|
1638
|
+
}
|
|
1639
|
+
parseTime(value, parseFormat) {
|
|
1640
|
+
const result = this.parse(value, parseFormat);
|
|
1641
|
+
if ((!result || !this.isValid(result)) && typeof value === 'string') {
|
|
1642
|
+
// It seems like Luxon doesn't work well cross-browser for strings that have
|
|
1643
|
+
// additional characters around the time. Try parsing without those characters.
|
|
1644
|
+
return (this.parse(value.replace(/[^0-9:(AM|PM)]/gi, ''), parseFormat) || result);
|
|
1645
|
+
}
|
|
1646
|
+
return result;
|
|
1647
|
+
}
|
|
1648
|
+
addSeconds(date, amount) {
|
|
1649
|
+
return date.reconfigure(this._getOptions()).plus({ seconds: amount });
|
|
1650
|
+
}
|
|
1651
|
+
/** Gets the options that should be used when constructing a new `DateTime` object. */
|
|
1652
|
+
_getOptions() {
|
|
1653
|
+
return {
|
|
1654
|
+
zone: this._useUTC ? 'utc' : undefined,
|
|
1655
|
+
locale: this.locale,
|
|
1656
|
+
outputCalendar: this._defaultOutputCalendar,
|
|
1657
|
+
};
|
|
1658
|
+
}
|
|
1659
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaLuxonDateAdapter, deps: [{ token: i1$4.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1660
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaLuxonDateAdapter }); }
|
|
1523
1661
|
}
|
|
1524
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type:
|
|
1662
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaLuxonDateAdapter, decorators: [{
|
|
1525
1663
|
type: Injectable
|
|
1526
1664
|
}], ctorParameters: () => [{ type: i1$4.TranslateService }] });
|
|
1527
1665
|
|
|
1528
1666
|
function onemrvaDateNativeYearMonthProvider() {
|
|
1529
1667
|
return [
|
|
1530
|
-
{
|
|
1531
|
-
provide: MAT_DATE_LOCALE,
|
|
1532
|
-
useFactory: (translateService) => translateService.currentLang,
|
|
1533
|
-
deps: [TranslateService],
|
|
1534
|
-
},
|
|
1535
1668
|
{
|
|
1536
1669
|
provide: MAT_DATE_FORMATS,
|
|
1537
1670
|
useValue: ONEMRVA_MAT_NATIVE_YEAR_MONTH_FORMAT,
|
|
1538
1671
|
},
|
|
1539
1672
|
{
|
|
1540
1673
|
provide: DateAdapter,
|
|
1541
|
-
|
|
1674
|
+
useClass: OnemrvaNativeDateAdapter,
|
|
1542
1675
|
},
|
|
1543
1676
|
];
|
|
1544
1677
|
}
|
|
1545
1678
|
|
|
1546
1679
|
function onemrvaDateNativeProvider() {
|
|
1547
1680
|
return [
|
|
1548
|
-
{
|
|
1549
|
-
provide: MAT_DATE_LOCALE,
|
|
1550
|
-
useFactory: (translateService) => translateService.currentLang,
|
|
1551
|
-
deps: [TranslateService],
|
|
1552
|
-
},
|
|
1553
1681
|
{
|
|
1554
1682
|
provide: MAT_DATE_FORMATS,
|
|
1555
1683
|
useValue: ONEMRVA_MAT_NATIVE_DATE_FORMAT,
|
|
1556
1684
|
},
|
|
1557
1685
|
{
|
|
1558
1686
|
provide: DateAdapter,
|
|
1559
|
-
useClass:
|
|
1687
|
+
useClass: OnemrvaNativeDateAdapter,
|
|
1560
1688
|
},
|
|
1561
1689
|
];
|
|
1562
1690
|
}
|
|
@@ -1564,22 +1692,26 @@ function onemrvaDateNativeProvider() {
|
|
|
1564
1692
|
function onemrvaDateLuxonProvider() {
|
|
1565
1693
|
return [
|
|
1566
1694
|
{
|
|
1567
|
-
provide:
|
|
1568
|
-
|
|
1569
|
-
|
|
1695
|
+
provide: MAT_DATE_FORMATS,
|
|
1696
|
+
useValue: ONEMRVA_MAT_LUXON_DATE_FORMATS,
|
|
1697
|
+
},
|
|
1698
|
+
{
|
|
1699
|
+
provide: DateAdapter,
|
|
1700
|
+
useClass: OnemrvaLuxonDateAdapter,
|
|
1570
1701
|
},
|
|
1571
|
-
provideLuxonDateAdapter(ONEMRVA_MAT_LUXON_DATE_FORMATS),
|
|
1572
1702
|
];
|
|
1573
1703
|
}
|
|
1574
1704
|
|
|
1575
1705
|
function onemrvaDateLuxonYearMonthProvider() {
|
|
1576
1706
|
return [
|
|
1577
1707
|
{
|
|
1578
|
-
provide:
|
|
1579
|
-
|
|
1580
|
-
|
|
1708
|
+
provide: MAT_DATE_FORMATS,
|
|
1709
|
+
useValue: ONEMRVA_MAT_LUXON_YEAR_MONTH_FORMATS,
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
provide: DateAdapter,
|
|
1713
|
+
useClass: OnemrvaLuxonDateAdapter,
|
|
1581
1714
|
},
|
|
1582
|
-
provideLuxonDateAdapter(ONEMRVA_MAT_LUXON_YEAR_MONTH_FORMATS),
|
|
1583
1715
|
];
|
|
1584
1716
|
}
|
|
1585
1717
|
|
|
@@ -1591,5 +1723,5 @@ function onemrvaDateLuxonYearMonthProvider() {
|
|
|
1591
1723
|
* Generated bundle index. Do not edit.
|
|
1592
1724
|
*/
|
|
1593
1725
|
|
|
1594
|
-
export { CDNUrlModeOptions, CDN_URLS, CDN_URL_MODE, ClipboardIconComponent, CommonCountryLookupService, DefaultStorage, DigitOnlyDirective, HttpRequestCache, IBAN_SUPPORTED_COUNTRIES, IfWidthIsDirective, MatRowClickableDirective, NISS_MASK, ONEMRVA_MAT_LUXON_DATE_FORMATS, ONEMRVA_MAT_LUXON_YEAR_MONTH_FORMATS, ONEMRVA_MAT_NATIVE_DATE_FORMAT, ONEMRVA_MAT_NATIVE_YEAR_MONTH_FORMAT, OnemRvaCDNCountryService, OnemRvaCDNMimeService, OnemRvaCDNService, OnemRvaClipboardDirective, OnemRvaColorDirective, OnemRvaIconRightDirective, OnemrvaBcePipe,
|
|
1726
|
+
export { CDNUrlModeOptions, CDN_URLS, CDN_URL_MODE, ClipboardIconComponent, CommonCountryLookupService, DefaultStorage, DigitOnlyDirective, HttpRequestCache, IBAN_SUPPORTED_COUNTRIES, IfWidthIsDirective, MatRowClickableDirective, NISS_MASK, ONEMRVA_MAT_LUXON_DATE_FORMATS, ONEMRVA_MAT_LUXON_YEAR_MONTH_FORMATS, ONEMRVA_MAT_NATIVE_DATE_FORMAT, ONEMRVA_MAT_NATIVE_YEAR_MONTH_FORMAT, OnemRvaCDNCountryService, OnemRvaCDNMimeService, OnemRvaCDNService, OnemRvaClipboardDirective, OnemRvaColorDirective, OnemRvaIconRightDirective, OnemrvaBcePipe, OnemrvaLuxonDateAdapter, OnemrvaMaskDirective, OnemrvaNativeDateAdapter, OnemrvaNissPipe, OnemrvaSharedModule, OnemrvaTranslateCDNLoader, OnemrvaTranslateHttpLoader, OnemrvaValidators, RequestTimes, WebComponentOverlayContainer, bankAccountValidator, directives, onemrvaDateLuxonProvider, onemrvaDateLuxonYearMonthProvider, onemrvaDateNativeProvider, onemrvaDateNativeYearMonthProvider, setTranslationLanguage, setTranslationLanguageFromWO };
|
|
1595
1727
|
//# sourceMappingURL=onemrvapublic-design-system-shared.mjs.map
|