@leanix/components 0.4.741 → 0.4.743

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Input, Component, signal, ChangeDetectionStrategy, HostBinding, input, computed, EventEmitter, HostListener, Output, Injectable, ElementRef, ViewChild, Inject, model, Directive, Optional, Pipe, NgModule, output, inject, DestroyRef, ChangeDetectorRef, effect, ContentChild, afterRenderEffect, ContentChildren, ViewChildren, forwardRef, TemplateRef, viewChild, booleanAttribute, SecurityContext, Self, Host, Injector, ApplicationRef, createComponent } from '@angular/core';
2
+ import { InjectionToken, Input, Component, signal, ChangeDetectionStrategy, HostBinding, input, computed, EventEmitter, HostListener, Output, Injectable, ElementRef, ViewChild, Inject, model, Directive, Optional, Pipe, inject, NgModule, output, DestroyRef, ChangeDetectorRef, effect, ContentChild, afterRenderEffect, ContentChildren, ViewChildren, forwardRef, TemplateRef, viewChild, booleanAttribute, SecurityContext, Self, Host, Injector, ApplicationRef, createComponent } from '@angular/core';
3
3
  import * as i1 from '@ngx-translate/core';
4
4
  import { TranslatePipe, TranslateModule } from '@ngx-translate/core';
5
5
  import { NgTemplateOutlet, NgClass, AsyncPipe, UpperCasePipe, DecimalPipe, CommonModule, formatDate } from '@angular/common';
@@ -16,7 +16,7 @@ import { CdkStepper, CdkStepperModule } from '@angular/cdk/stepper';
16
16
  import * as i1$1 from '@angular/cdk/bidi';
17
17
  import { registerIcon } from '@ui5/webcomponents-base/dist/asset-registries/Icons.js';
18
18
  import Color from 'color';
19
- import { format, distanceInWords, startOfDay } from 'date-fns';
19
+ import { isValid, format, formatDistance, startOfDay } from 'date-fns';
20
20
  import DOMPurify from 'dompurify';
21
21
  import { isArray, isEqual, split, uniqueId, pick, intersection, isNil, curry } from 'lodash-es';
22
22
  import { Renderer, marked } from 'marked';
@@ -73,9 +73,9 @@ import { coerceNumberProperty } from '@angular/cdk/coercion';
73
73
  const DATE_FORMATS = new InjectionToken('DATE_FORMATS', {
74
74
  providedIn: 'root',
75
75
  factory: () => ({
76
- getDateFormat: () => 'YYYY-MM-DD',
77
- getDateTimeFormat: () => 'YYYY-MM-DD HH:mm',
78
- getDateTimeFormatWithSeconds: () => 'YYYY-MM-DD HH:mm:ss'
76
+ getDateFormat: () => 'yyyy-MM-dd',
77
+ getDateTimeFormat: () => 'yyyy-MM-dd HH:mm',
78
+ getDateTimeFormatWithSeconds: () => 'yyyy-MM-dd HH:mm:ss'
79
79
  })
80
80
  });
81
81
  const DATE_FN_LOCALE = new InjectionToken('DATE_FN_LOCALE');
@@ -1902,8 +1902,15 @@ class CustomDatePipe {
1902
1902
  this.getDateFnLocale = getDateFnLocale;
1903
1903
  }
1904
1904
  transform(value, f) {
1905
+ if (!value) {
1906
+ return '';
1907
+ }
1908
+ const date = value instanceof Date ? value : new Date(value);
1909
+ if (!isValid(date)) {
1910
+ return '';
1911
+ }
1905
1912
  const locale = this.getDateFnLocale ? this.getDateFnLocale() : null;
1906
- return value ? format(value, f, { locale }) : '';
1913
+ return format(date, f, { locale });
1907
1914
  }
1908
1915
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: CustomDatePipe, deps: [{ token: DATE_FN_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Pipe }); }
1909
1916
  static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: CustomDatePipe, isStandalone: true, name: "lxDate" }); }
@@ -2020,28 +2027,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
2020
2027
  }] });
2021
2028
 
2022
2029
  class LxTimeAgo {
2023
- constructor(getDateFnLocale) {
2024
- this.getDateFnLocale = getDateFnLocale;
2030
+ constructor() {
2031
+ this.getDateFnLocale = inject(DATE_FN_LOCALE, { optional: true });
2025
2032
  }
2026
2033
  transform(input) {
2034
+ if (!input) {
2035
+ return '';
2036
+ }
2037
+ const date = typeof input === 'string' ? new Date(input) : input;
2038
+ if (!isValid(date)) {
2039
+ return '';
2040
+ }
2027
2041
  const locale = this.getDateFnLocale ? this.getDateFnLocale() : null;
2028
- return distanceInWords(new Date(), input, { locale, addSuffix: true });
2042
+ return formatDistance(date, new Date(), { locale, addSuffix: true });
2029
2043
  }
2030
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LxTimeAgo, deps: [{ token: DATE_FN_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Pipe }); }
2044
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LxTimeAgo, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
2031
2045
  static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: LxTimeAgo, isStandalone: true, name: "lxTimeAgo" }); }
2032
2046
  }
2033
2047
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LxTimeAgo, decorators: [{
2034
2048
  type: Pipe,
2035
2049
  args: [{
2036
- name: 'lxTimeAgo',
2037
- pure: true
2050
+ name: 'lxTimeAgo'
2038
2051
  }]
2039
- }], ctorParameters: () => [{ type: Function, decorators: [{
2040
- type: Optional
2041
- }, {
2042
- type: Inject,
2043
- args: [DATE_FN_LOCALE]
2044
- }] }] });
2052
+ }] });
2045
2053
 
2046
2054
  class LxTranslatePipe {
2047
2055
  constructor(translate, cdRef, globalTranslationOptionsProvider) {
@@ -4581,6 +4589,9 @@ function isValidDateString(dateString) {
4581
4589
  /* format method is monkey-patched in date-input component, leaving this implementation as dummy */
4582
4590
  class DateFormatter {
4583
4591
  format(date, format$1, locale) {
4592
+ if (!locale || typeof locale === 'string') {
4593
+ return format(date, format$1);
4594
+ }
4584
4595
  return format(date, format$1, { locale });
4585
4596
  }
4586
4597
  }
@@ -5522,12 +5533,12 @@ class DatepickerConfig {
5522
5533
  this.minMode = 'day';
5523
5534
  this.maxMode = 'year';
5524
5535
  this.showWeeks = true;
5525
- this.formatDay = 'DD';
5536
+ this.formatDay = 'dd';
5526
5537
  this.formatMonth = 'MMMM';
5527
- this.formatYear = 'YYYY';
5538
+ this.formatYear = 'yyyy';
5528
5539
  this.formatDayHeader = 'dd';
5529
- this.formatDayTitle = 'MMMM YYYY';
5530
- this.formatMonthTitle = 'YYYY';
5540
+ this.formatDayTitle = 'MMMM yyyy';
5541
+ this.formatMonthTitle = 'yyyy';
5531
5542
  this.onlyCurrentMonth = false;
5532
5543
  this.monthColLimit = 3;
5533
5544
  this.yearColLimit = 5;
@@ -5774,17 +5785,17 @@ class DateInputComponent {
5774
5785
  /** If false week numbers will be hidden */
5775
5786
  this.showWeeks = true;
5776
5787
  /** Format of day in month */
5777
- this.formatDay = 'DD';
5788
+ this.formatDay = 'dd';
5778
5789
  /** Format of month in year */
5779
5790
  this.formatMonth = 'MMMM';
5780
5791
  /** Format of year in year range */
5781
- this.formatYear = 'YYYY';
5792
+ this.formatYear = 'yyyy';
5782
5793
  /** Format of day in week header */
5783
5794
  this.formatDayHeader = 'dd';
5784
5795
  /** Format of title when selecting day */
5785
- this.formatDayTitle = 'MMMM YYYY';
5796
+ this.formatDayTitle = 'MMMM yyyy';
5786
5797
  /** Format of title when selecting month */
5787
- this.formatMonthTitle = 'YYYY';
5798
+ this.formatMonthTitle = 'yyyy';
5788
5799
  /** Starting day of the week from 0-6 (0=Sunday, ..., 6=Saturday) public */
5789
5800
  this.startingDay = 0;
5790
5801
  /** Number of years displayed in year selection */