@onemrvapublic/design-system 18.2.16-develop.3 → 18.2.16-develop.5

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 (30) hide show
  1. package/esm2022/mat-paginator/src/onemrva-mat-paginator.component.mjs +6 -2
  2. package/esm2022/shared/index.mjs +2 -1
  3. package/esm2022/shared/src/lib/adapters/date.adapter.mjs +24 -13
  4. package/esm2022/shared/src/lib/adapters/year-month.adapter.mjs +6 -9
  5. package/esm2022/shared/src/lib/modules/index.mjs +1 -3
  6. package/esm2022/shared/src/lib/modules/shared.datepicker.luxon.module.mjs +5 -21
  7. package/esm2022/shared/src/lib/providers/index.mjs +5 -0
  8. package/esm2022/shared/src/lib/providers/onemrva.date.luxon.provider.mjs +6 -0
  9. package/esm2022/shared/src/lib/providers/onemrva.date.luxon.year.month.provider.mjs +6 -0
  10. package/esm2022/shared/src/lib/providers/onemrva.date.native.provider.mjs +22 -0
  11. package/esm2022/shared/src/lib/providers/onemrva.date.native.year.month.provider.mjs +22 -0
  12. package/fesm2022/onemrvapublic-design-system-mat-paginator.mjs +5 -1
  13. package/fesm2022/onemrvapublic-design-system-mat-paginator.mjs.map +1 -1
  14. package/fesm2022/onemrvapublic-design-system-shared.mjs +74 -121
  15. package/fesm2022/onemrvapublic-design-system-shared.mjs.map +1 -1
  16. package/mat-paginator/src/onemrva-mat-paginator.component.d.ts +1 -0
  17. package/package.json +1 -1
  18. package/shared/index.d.ts +1 -0
  19. package/shared/src/lib/adapters/date.adapter.d.ts +8 -5
  20. package/shared/src/lib/adapters/year-month.adapter.d.ts +3 -4
  21. package/shared/src/lib/modules/index.d.ts +0 -2
  22. package/shared/src/lib/providers/index.d.ts +4 -0
  23. package/shared/src/lib/providers/onemrva.date.luxon.provider.d.ts +2 -0
  24. package/shared/src/lib/providers/onemrva.date.luxon.year.month.provider.d.ts +2 -0
  25. package/shared/src/lib/providers/onemrva.date.native.provider.d.ts +2 -0
  26. package/shared/src/lib/providers/onemrva.date.native.year.month.provider.d.ts +2 -0
  27. package/esm2022/shared/src/lib/modules/shared.datepicker.native.module.mjs +0 -51
  28. package/esm2022/shared/src/lib/modules/shared.datepicker.native.year.month.module.mjs +0 -51
  29. package/shared/src/lib/modules/shared.datepicker.native.module.d.ts +0 -12
  30. package/shared/src/lib/modules/shared.datepicker.native.year.month.module.d.ts +0 -12
@@ -17,7 +17,7 @@ import { __decorate } from 'tslib';
17
17
  import * as i1$4 from '@ngx-translate/core';
18
18
  import { TranslateModule, TranslateService } from '@ngx-translate/core';
19
19
  import { countrySpecs, validateIBAN, electronicFormatIBAN, ValidationErrorsIBAN } from 'ibantools';
20
- import { DateAdapter, MatNativeDateModule, MAT_DATE_LOCALE, MAT_DATE_FORMATS, NativeDateAdapter } from '@angular/material/core';
20
+ import { DateAdapter, MatNativeDateModule, MAT_DATE_LOCALE, NativeDateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
21
21
  import { MatDatepickerModule } from '@angular/material/datepicker';
22
22
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
23
23
  import { provideLuxonDateAdapter } from '@angular/material-luxon-adapter';
@@ -1350,14 +1350,7 @@ class OnemrvaDatepickerLuxonSharedModule {
1350
1350
  }
1351
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
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] }); }
1353
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerLuxonSharedModule, imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule] }); }
1361
1354
  }
1362
1355
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerLuxonSharedModule, decorators: [{
1363
1356
  type: NgModule,
@@ -1365,100 +1358,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1365
1358
  declarations: [],
1366
1359
  imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule],
1367
1360
  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 OnemrvaDatepickerSharedModule {
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: OnemrvaDatepickerSharedModule, 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: OnemrvaDatepickerSharedModule, imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule] }); }
1390
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerSharedModule, providers: [
1391
- {
1392
- provide: MAT_DATE_LOCALE,
1393
- useFactory: (translateService) => translateService.currentLang,
1394
- deps: [TranslateService],
1395
- },
1396
- {
1397
- provide: MAT_DATE_FORMATS,
1398
- useValue: ONEMRVA_MAT_NATIVE_DATE_FORMAT,
1399
- },
1400
- ], imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule] }); }
1401
- }
1402
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerSharedModule, decorators: [{
1403
- type: NgModule,
1404
- args: [{
1405
- declarations: [],
1406
- imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule],
1407
- exports: [],
1408
- providers: [
1409
- {
1410
- provide: MAT_DATE_LOCALE,
1411
- useFactory: (translateService) => translateService.currentLang,
1412
- deps: [TranslateService],
1413
- },
1414
- {
1415
- provide: MAT_DATE_FORMATS,
1416
- useValue: ONEMRVA_MAT_NATIVE_DATE_FORMAT,
1417
- },
1418
- ],
1419
- }]
1420
- }], ctorParameters: () => [{ type: i1$4.TranslateService }] });
1421
-
1422
- class OnemrvaDatepickerYearMonthSharedModule {
1423
- constructor(translateService) {
1424
- this._adapter = inject(DateAdapter);
1425
- translateService.onLangChange
1426
- .pipe(takeUntilDestroyed())
1427
- .subscribe(value => {
1428
- this._adapter.setLocale(value.lang);
1429
- });
1430
- }
1431
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerYearMonthSharedModule, deps: [{ token: i1$4.TranslateService }], target: i0.ɵɵFactoryTarget.NgModule }); }
1432
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerYearMonthSharedModule, imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule] }); }
1433
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerYearMonthSharedModule, providers: [
1434
- {
1435
- provide: MAT_DATE_LOCALE,
1436
- useFactory: (translateService) => translateService.currentLang,
1437
- deps: [TranslateService],
1438
- },
1439
- {
1440
- provide: MAT_DATE_FORMATS,
1441
- useValue: ONEMRVA_MAT_NATIVE_YEAR_MONTH_FORMAT,
1442
- },
1443
- ], imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule] }); }
1444
- }
1445
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDatepickerYearMonthSharedModule, decorators: [{
1446
- type: NgModule,
1447
- args: [{
1448
- declarations: [],
1449
- imports: [MatDatepickerModule, TranslateModule, MatNativeDateModule],
1450
- exports: [],
1451
- providers: [
1452
- {
1453
- provide: MAT_DATE_LOCALE,
1454
- useFactory: (translateService) => translateService.currentLang,
1455
- deps: [TranslateService],
1456
- },
1457
- {
1458
- provide: MAT_DATE_FORMATS,
1459
- useValue: ONEMRVA_MAT_NATIVE_YEAR_MONTH_FORMAT,
1460
- },
1461
- ],
1361
+ providers: [],
1462
1362
  }]
1463
1363
  }], ctorParameters: () => [{ type: i1$4.TranslateService }] });
1464
1364
 
@@ -1500,30 +1400,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1500
1400
  }], ctorParameters: () => [{ type: i1$4.TranslateService }] });
1501
1401
 
1502
1402
  class OnemrvaDateAdapter extends NativeDateAdapter {
1503
- constructor() {
1403
+ constructor(translateService) {
1504
1404
  super();
1505
- this.dateFormat = ONEMRVA_MAT_NATIVE_DATE_FORMAT.display.dateInput;
1405
+ this.translateService = translateService;
1506
1406
  this.destroyNotifier$ = new Subject();
1407
+ this.localeChanges = new Subject();
1408
+ this.setLocale(this.translateService.currentLang);
1409
+ this.localeChanges.next(this);
1410
+ if (this.translateService !== undefined) {
1411
+ this.translateService.onLangChange
1412
+ .pipe(takeUntil(this.destroyNotifier$))
1413
+ .subscribe(({ lang }) => {
1414
+ this.setLocale(lang);
1415
+ this.localeChanges.next(this);
1416
+ });
1417
+ }
1507
1418
  }
1508
- format(date) {
1419
+ format(date, formats) {
1509
1420
  const dt = DateTime.fromJSDate(date);
1510
- return dt.toFormat(this.dateFormat);
1421
+ return dt.toFormat(formats);
1511
1422
  }
1512
- parse(value) {
1423
+ parse(value, formats) {
1424
+ console.log(formats);
1513
1425
  if (value && typeof value === 'string') {
1514
1426
  value = value.replace(/\D/g, '/');
1515
1427
  }
1516
1428
  if (value === null || value === '') {
1517
1429
  return null;
1518
1430
  }
1519
- const dt = DateTime.fromFormat(value, this.dateFormat, {
1431
+ const dt = DateTime.fromFormat(value, formats.display.dateInput, {
1520
1432
  locale: this.locale,
1521
1433
  });
1522
1434
  if (dt.isValid) {
1523
1435
  return dt.toJSDate();
1524
1436
  }
1525
- const formats = ['ddMMyyyy', 'd/M/yyyy', 'dd/M/yyyy', 'd/MM/yyyy'];
1526
- for (const format of formats) {
1437
+ for (const format of formats.parse.dateInput) {
1527
1438
  const parsed = DateTime.fromFormat(value, format, {
1528
1439
  locale: this.locale,
1529
1440
  });
@@ -1540,18 +1451,17 @@ class OnemrvaDateAdapter extends NativeDateAdapter {
1540
1451
  this.destroyNotifier$.next();
1541
1452
  this.destroyNotifier$.complete();
1542
1453
  }
1543
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDateAdapter, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1454
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDateAdapter, deps: [{ token: i1$4.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1544
1455
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDateAdapter }); }
1545
1456
  }
1546
1457
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImport: i0, type: OnemrvaDateAdapter, decorators: [{
1547
1458
  type: Injectable
1548
- }], ctorParameters: () => [] });
1459
+ }], ctorParameters: () => [{ type: i1$4.TranslateService }] });
1549
1460
 
1550
1461
  class OnemrvaYearMonthAdapter extends NativeDateAdapter {
1551
1462
  constructor(translateService) {
1552
1463
  super();
1553
1464
  this.translateService = translateService;
1554
- this.dateFormat = ONEMRVA_MAT_NATIVE_YEAR_MONTH_FORMAT.display.monthYearLabel;
1555
1465
  this.destroyNotifier$ = new Subject();
1556
1466
  this.setLocale(this.translateService.currentLang);
1557
1467
  this.translateService.onLangChange
@@ -1560,25 +1470,24 @@ class OnemrvaYearMonthAdapter extends NativeDateAdapter {
1560
1470
  this.setLocale(lang);
1561
1471
  });
1562
1472
  }
1563
- format(date) {
1473
+ format(date, formats) {
1564
1474
  const dt = DateTime.fromJSDate(date);
1565
- return dt.toFormat(this.dateFormat);
1475
+ return dt.toFormat(formats);
1566
1476
  }
1567
- parse(value) {
1477
+ parse(value, formats) {
1568
1478
  if (value && typeof value === 'string') {
1569
1479
  value = value.replace(/\D/g, '/');
1570
1480
  }
1571
1481
  if (value === null || value === '') {
1572
1482
  return null;
1573
1483
  }
1574
- const dt = DateTime.fromFormat(value, this.dateFormat, {
1484
+ const dt = DateTime.fromFormat(value, formats.display.dateInput, {
1575
1485
  locale: this.locale,
1576
1486
  });
1577
1487
  if (dt.isValid) {
1578
1488
  return dt.toJSDate();
1579
1489
  }
1580
- const formats = ['MMyyyy', 'M/yyyy', 'MM/yyyy'];
1581
- for (const format of formats) {
1490
+ for (const format of formats.parse.dateInput) {
1582
1491
  const parsed = DateTime.fromFormat(value, format, {
1583
1492
  locale: this.locale,
1584
1493
  });
@@ -1602,6 +1511,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1602
1511
  type: Injectable
1603
1512
  }], ctorParameters: () => [{ type: i1$4.TranslateService }] });
1604
1513
 
1514
+ function onemrvaDateNativeYearMonthProvider() {
1515
+ return [
1516
+ {
1517
+ provide: MAT_DATE_LOCALE,
1518
+ useFactory: (translateService) => translateService.currentLang,
1519
+ deps: [TranslateService],
1520
+ },
1521
+ {
1522
+ provide: MAT_DATE_FORMATS,
1523
+ useValue: ONEMRVA_MAT_NATIVE_YEAR_MONTH_FORMAT,
1524
+ },
1525
+ {
1526
+ provide: DateAdapter,
1527
+ useValue: OnemrvaDateAdapter,
1528
+ },
1529
+ ];
1530
+ }
1531
+
1532
+ function onemrvaDateNativeProvider() {
1533
+ return [
1534
+ {
1535
+ provide: MAT_DATE_LOCALE,
1536
+ useFactory: (translateService) => translateService.currentLang,
1537
+ deps: [TranslateService],
1538
+ },
1539
+ {
1540
+ provide: MAT_DATE_FORMATS,
1541
+ useValue: ONEMRVA_MAT_NATIVE_DATE_FORMAT,
1542
+ },
1543
+ {
1544
+ provide: DateAdapter,
1545
+ useClass: OnemrvaDateAdapter,
1546
+ },
1547
+ ];
1548
+ }
1549
+
1550
+ function onemrvaDateLuxonProvider() {
1551
+ return [provideLuxonDateAdapter(ONEMRVA_MAT_LUXON_DATE_FORMATS)];
1552
+ }
1553
+
1554
+ function onemrvaDateLuxonYearMonthProvider() {
1555
+ return [provideLuxonDateAdapter(ONEMRVA_MAT_LUXON_YEAR_MONTH_FORMATS)];
1556
+ }
1557
+
1605
1558
  /*
1606
1559
  * Public API Surface of shared
1607
1560
  */
@@ -1610,5 +1563,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.8", ngImpor
1610
1563
  * Generated bundle index. Do not edit.
1611
1564
  */
1612
1565
 
1613
- 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, OnemrvaDateAdapter, OnemrvaDatepickerLuxonSharedModule, OnemrvaDatepickerLuxonYearMonthSharedModule, OnemrvaDatepickerSharedModule, OnemrvaDatepickerYearMonthSharedModule, OnemrvaMaskDirective, OnemrvaNissPipe, OnemrvaSharedModule, OnemrvaTranslateCDNLoader, OnemrvaTranslateHttpLoader, OnemrvaValidators, OnemrvaYearMonthAdapter, RequestTimes, WebComponentOverlayContainer, bankAccountValidator, directives, setTranslationLanguage, setTranslationLanguageFromWO };
1566
+ 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, OnemrvaDateAdapter, OnemrvaDatepickerLuxonSharedModule, OnemrvaDatepickerLuxonYearMonthSharedModule, OnemrvaMaskDirective, OnemrvaNissPipe, OnemrvaSharedModule, OnemrvaTranslateCDNLoader, OnemrvaTranslateHttpLoader, OnemrvaValidators, OnemrvaYearMonthAdapter, RequestTimes, WebComponentOverlayContainer, bankAccountValidator, directives, onemrvaDateLuxonProvider, onemrvaDateLuxonYearMonthProvider, onemrvaDateNativeProvider, onemrvaDateNativeYearMonthProvider, setTranslationLanguage, setTranslationLanguageFromWO };
1614
1567
  //# sourceMappingURL=onemrvapublic-design-system-shared.mjs.map