@siemens/element-ng 47.11.1 → 47.12.0

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,4 +1,4 @@
1
- import { WeekStart } from './si-datepicker.model';
1
+ import { DatepickerInputConfig, WeekStart } from './si-datepicker.model';
2
2
  export interface DayOfWeek {
3
3
  id: string;
4
4
  index: number;
@@ -300,3 +300,7 @@ export declare const nextMonth: (date: Date) => Date;
300
300
  export declare const previousMonth: (date: Date) => Date;
301
301
  export declare const minDate: (first?: Date, second?: Date) => Date | undefined;
302
302
  export declare const maxDate: (first?: Date, second?: Date) => Date | undefined;
303
+ /**
304
+ * Indicate whether the time use the 12-hour format
305
+ */
306
+ export declare const is12HourFormat: (locale: string, config: DatepickerInputConfig) => boolean;
@@ -118,6 +118,7 @@ export declare class SiDateRangeComponent implements ControlValueAccessor, Valid
118
118
  protected readonly disabled: import("@angular/core").Signal<boolean>;
119
119
  private readonly disabledNgControl;
120
120
  private readonly cdRef;
121
+ private readonly locale;
121
122
  private readonly overlayToggle;
122
123
  private readonly elementRef;
123
124
  private readonly defaultPlacement;
@@ -50,7 +50,6 @@ export declare class SiDatepickerDirective extends SiDateInputDirective implemen
50
50
  */
51
51
  useExternalTrigger(element: ElementRef<HTMLElement>): void;
52
52
  protected focusChange(): void;
53
- private getTime12h;
54
53
  private subscribeDateChanges;
55
54
  /**
56
55
  * Callback when the datepicker changes his value.
@@ -678,6 +678,13 @@ const minDate = (first, second) => {
678
678
  const maxDate = (first, second) => {
679
679
  return !!first && !!second ? (first > second ? first : second) : (first ?? second);
680
680
  };
681
+ /**
682
+ * Indicate whether the time use the 12-hour format
683
+ */
684
+ const is12HourFormat = (locale, config) => {
685
+ const dateFormat = getDatepickerFormat(locale, config, true);
686
+ return dateFormat?.includes('a') ?? false;
687
+ };
681
688
 
682
689
  /**
683
690
  * Returns date / datetime format to be used for rendering a date object as text
@@ -3633,7 +3640,7 @@ class SiDatepickerDirective extends SiDateInputDirective {
3633
3640
  this.subscribeDateChanges(this.overlayToggle.showOverlay(initialFocus, {
3634
3641
  config: this.siDatepickerConfig(),
3635
3642
  date: this.date,
3636
- time12h: this.getTime12h()
3643
+ time12h: is12HourFormat(this.locale, this.siDatepickerConfig() ?? {})
3637
3644
  }));
3638
3645
  }
3639
3646
  /**
@@ -3647,10 +3654,6 @@ class SiDatepickerDirective extends SiDateInputDirective {
3647
3654
  this.show();
3648
3655
  }
3649
3656
  }
3650
- getTime12h() {
3651
- const dateFormat = getDatepickerFormat(this.locale, this.siDatepickerConfig(), true);
3652
- return dateFormat?.includes('a');
3653
- }
3654
3657
  subscribeDateChanges(overlay) {
3655
3658
  this.overlaySubscriptions?.forEach(s => s.unsubscribe());
3656
3659
  overlay?.instance.date.subscribe(d => this.onDateChanged(d));
@@ -3849,6 +3852,7 @@ class SiDateRangeComponent {
3849
3852
  disabled = computed(() => this.disabledInput() || this.disabledNgControl());
3850
3853
  disabledNgControl = signal(false);
3851
3854
  cdRef = inject(ChangeDetectorRef);
3855
+ locale = inject(LOCALE_ID).toString();
3852
3856
  overlayToggle = inject(SiDatepickerOverlayDirective);
3853
3857
  elementRef = inject(ElementRef);
3854
3858
  defaultPlacement = [
@@ -3932,7 +3936,8 @@ class SiDateRangeComponent {
3932
3936
  }
3933
3937
  this.subscribeRangeChanges(this.overlayToggle.showOverlay(true, {
3934
3938
  config: this.siDatepickerConfig(),
3935
- dateRange: this.value()
3939
+ dateRange: this.value(),
3940
+ time12h: is12HourFormat(this.locale, this.siDatepickerConfig())
3936
3941
  }));
3937
3942
  }
3938
3943
  subscribeRangeChanges(overlay) {
@@ -4222,5 +4227,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.6", ngImpor
4222
4227
  * Generated bundle index. Do not edit.
4223
4228
  */
4224
4229
 
4225
- export { CloseCause, SiCalendarButtonComponent, SiDateInputDirective, SiDateRangeComponent, SiDatepickerComponent, SiDatepickerDirective, SiDatepickerModule, SiDatepickerOverlayComponent, SiDatepickerOverlayDirective, SiTimepickerComponent, WEEK_START_OFFSET, addDays, addDaysInRange, addMonthsInRange, addYearsInRange, changeDay, compareDate, compareMonth, compareYear, createDate, daysInMonth, getDateSameOrBetween, getDateWithoutTime, getDatepickerFormat, getDayStrings, getDaysOfWeek, getFirstDateInMonth, getFirstDateInYear, getFirstDayInMonth, getLastDateInMonth, getLocaleMonthNames, getMaxDate, getMinDate, getNamedFormat, getStringforDate, getWeekDayOffset, getWeekEndDate, getWeekOfYear, getWeekStartDate, isAfter, isAfterMonth, isAfterYear, isAnotherMonth, isAnotherMonthOrYear, isAnotherYear, isBetween, isBetweenMonth, isBetweenYears, isSameDate, isSameMonth, isSameOrBefore, isSameOrBeforeMonth, isSameOrBeforeYear, isSameOrBetween, isSameOrBetweenMonth, isSameOrBetweenYears, isSameYear, isValid, maxDate, minDate, nextMonth, parseDate, previousMonth, today };
4230
+ export { CloseCause, SiCalendarButtonComponent, SiDateInputDirective, SiDateRangeComponent, SiDatepickerComponent, SiDatepickerDirective, SiDatepickerModule, SiDatepickerOverlayComponent, SiDatepickerOverlayDirective, SiTimepickerComponent, WEEK_START_OFFSET, addDays, addDaysInRange, addMonthsInRange, addYearsInRange, changeDay, compareDate, compareMonth, compareYear, createDate, daysInMonth, getDateSameOrBetween, getDateWithoutTime, getDatepickerFormat, getDayStrings, getDaysOfWeek, getFirstDateInMonth, getFirstDateInYear, getFirstDayInMonth, getLastDateInMonth, getLocaleMonthNames, getMaxDate, getMinDate, getNamedFormat, getStringforDate, getWeekDayOffset, getWeekEndDate, getWeekOfYear, getWeekStartDate, is12HourFormat, isAfter, isAfterMonth, isAfterYear, isAnotherMonth, isAnotherMonthOrYear, isAnotherYear, isBetween, isBetweenMonth, isBetweenYears, isSameDate, isSameMonth, isSameOrBefore, isSameOrBeforeMonth, isSameOrBeforeYear, isSameOrBetween, isSameOrBetweenMonth, isSameOrBetweenYears, isSameYear, isValid, maxDate, minDate, nextMonth, parseDate, previousMonth, today };
4226
4231
  //# sourceMappingURL=siemens-element-ng-datepicker.mjs.map