@masterteam/components 0.0.143 → 0.0.144

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.
@@ -2,9 +2,11 @@ import { providePrimeNG } from 'primeng/config';
2
2
  import Aura from '@primeuix/themes/aura';
3
3
  import { updatePreset, definePreset } from '@primeuix/themes';
4
4
  import { MessageService, ConfirmationService } from 'primeng/api';
5
- import { computed } from '@angular/core';
5
+ import * as i0 from '@angular/core';
6
+ import { InjectionToken, makeEnvironmentProviders, computed, inject, LOCALE_ID, Pipe } from '@angular/core';
6
7
  import { tap, catchError, finalize } from 'rxjs/operators';
7
8
  import { HttpContextToken } from '@angular/common/http';
9
+ import { formatDate } from '@angular/common';
8
10
 
9
11
  /**
10
12
  * Converts a hex color string to an HSL tuple.
@@ -491,6 +493,25 @@ function provideMTConfirmation() {
491
493
  return ConfirmationService;
492
494
  }
493
495
 
496
+ const DEFAULT_MT_DATE_FORMATS = {
497
+ date: 'dd/MM/yyyy',
498
+ dateTime: 'short',
499
+ };
500
+ const MT_DATE_FORMATS = new InjectionToken('MT_DATE_FORMATS', {
501
+ factory: () => ({ ...DEFAULT_MT_DATE_FORMATS }),
502
+ });
503
+ function provideMTDateFormats(formats) {
504
+ return makeEnvironmentProviders([
505
+ {
506
+ provide: MT_DATE_FORMATS,
507
+ useFactory: () => ({
508
+ ...DEFAULT_MT_DATE_FORMATS,
509
+ ...formats,
510
+ }),
511
+ },
512
+ ]);
513
+ }
514
+
494
515
  class ValidatorConfig {
495
516
  type;
496
517
  value;
@@ -1390,6 +1411,31 @@ function getContrastColor(bgColor) {
1390
1411
  return luminance > 0.5 ? '' : '#ffffff';
1391
1412
  }
1392
1413
 
1414
+ class MTDateFormatPipe {
1415
+ locale = inject(LOCALE_ID);
1416
+ formats = inject(MT_DATE_FORMATS);
1417
+ transform(value, type = 'date') {
1418
+ if (value === null || value === undefined || value === '') {
1419
+ return '';
1420
+ }
1421
+ try {
1422
+ return formatDate(value, type === 'dateTime' ? this.formats.dateTime : this.formats.date, this.locale, this.formats.timezone);
1423
+ }
1424
+ catch {
1425
+ return String(value);
1426
+ }
1427
+ }
1428
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MTDateFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1429
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.2.8", ngImport: i0, type: MTDateFormatPipe, isStandalone: true, name: "mtDateFormat" });
1430
+ }
1431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: MTDateFormatPipe, decorators: [{
1432
+ type: Pipe,
1433
+ args: [{
1434
+ name: 'mtDateFormat',
1435
+ standalone: true,
1436
+ }]
1437
+ }] });
1438
+
1393
1439
  /*
1394
1440
  * Public API Surface of components
1395
1441
  */
@@ -1399,5 +1445,5 @@ function getContrastColor(bgColor) {
1399
1445
  * Generated bundle index. Do not edit.
1400
1446
  */
1401
1447
 
1402
- export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DateFieldConfig, EditorFieldConfig, IconFieldConfig, LookupMatrixFieldConfig, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, changeBackgroundColor, changePrimaryColor, changeTextColor, createCustomValidator, createEntityAdapter, endLoading, generateTailwindPalette, getContrastColor, getLightColor, handleApiRequest, isInvalid, provideMTComponents, provideMTConfirmation, provideMTMessages, setLoadingError, startLoading, wrapValidatorWithMessage };
1448
+ export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DEFAULT_MT_DATE_FORMATS, DateFieldConfig, EditorFieldConfig, IconFieldConfig, LookupMatrixFieldConfig, MTDateFormatPipe, MT_DATE_FORMATS, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, changeBackgroundColor, changePrimaryColor, changeTextColor, createCustomValidator, createEntityAdapter, endLoading, generateTailwindPalette, getContrastColor, getLightColor, handleApiRequest, isInvalid, provideMTComponents, provideMTConfirmation, provideMTDateFormats, provideMTMessages, setLoadingError, startLoading, wrapValidatorWithMessage };
1403
1449
  //# sourceMappingURL=masterteam-components.mjs.map