ngx-tethys 19.1.9 → 19.1.10

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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [19.1.10](https://github.com/atinc/ngx-tethys/compare/19.1.9...19.1.10) (2025-10-28)
6
+
7
+
8
+ ### Features
9
+
10
+ * withTime 为0或只选日期时,选择日期优化为选中为当天0点 #TINFR-2955 [@wumeimin](https://github.com/wumeimin) [@wangkai](https://github.com/wangkai) ([#3586](https://github.com/atinc/ngx-tethys/issues/3586)) ([5fd3f37](https://github.com/atinc/ngx-tethys/commit/5fd3f37bf0b4b4e3e9710e3eaea3da6c63cb0b0b)), closes [#TINFR-2955](https://github.com/atinc/ngx-tethys/issues/TINFR-2955)
11
+
12
+
13
+
5
14
  ## [19.1.9](https://github.com/atinc/ngx-tethys/compare/19.1.8...19.1.9) (2025-10-24)
6
15
 
7
16
 
@@ -142,7 +142,6 @@ export declare abstract class AbstractPickerComponent extends TabIndexDisabledCo
142
142
  flexibleDateGranularity: ThyDateGranularity;
143
143
  protected isCustomPlaceHolder: boolean;
144
144
  private onlyEmitDate;
145
- protected originWithTime: boolean;
146
145
  protected innerValue: ThyCompatibleDate;
147
146
  get realOpenState(): boolean;
148
147
  get isShowDatePopup(): boolean;
@@ -62,6 +62,7 @@ export declare class DatePopup implements OnInit, OnChanges {
62
62
  ngOnChanges(changes: SimpleChanges): void;
63
63
  initShortcutPresets(): void;
64
64
  updateActiveDate(): void;
65
+ private getDefaultPickerValue;
65
66
  initPanelMode(): void;
66
67
  initDisabledDate(): void;
67
68
  onShowTimePickerChange(show: boolean): void;
@@ -12,7 +12,7 @@ export declare function transformDateValue(value: ThyCompatibleDate | Compatible
12
12
  export declare function getFlexibleAdvancedReadableValue(tinyDates: TinyDate[], flexibleDateGranularity: ThyDateGranularity, separator: string, locale: Signal<ThyI18nLocale>): string;
13
13
  export declare function convertDate(date: Date | number | TinyDate): Date;
14
14
  export declare function hasValue(value: CompatibleValue): boolean;
15
- export declare function makeValue(value: ThyCompatibleDate | null, isRange?: boolean, timeZone?: string): CompatibleValue;
15
+ export declare function makeValue(value: ThyCompatibleDate | null, isRange: boolean, withTime: boolean, timeZone?: string): CompatibleValue;
16
16
  export declare function dateAddAmount(value: TinyDate, amount: number, mode: ThyPanelMode): TinyDate;
17
17
  export declare function isAfterMoreThanOneMonth(rightDate: TinyDate, leftDate: TinyDate): boolean;
18
18
  export declare function isAfterMoreThanLessOneYear(rightDate: TinyDate, leftDate: TinyDate): boolean;
@@ -460,12 +460,15 @@ function hasValue(value) {
460
460
  return !!value;
461
461
  }
462
462
  }
463
- function makeValue(value, isRange = false, timeZone) {
463
+ function makeValue(value, isRange = false, withTime, timeZone) {
464
464
  if (isRange) {
465
465
  return Array.isArray(value) ? value.map(val => new TinyDate(val, timeZone)) : [];
466
466
  }
467
467
  else {
468
- return value ? new TinyDate(value, timeZone) : null;
468
+ if (!value) {
469
+ return null;
470
+ }
471
+ return withTime ? new TinyDate(value, timeZone) : new TinyDate(value, timeZone).startOfDay();
469
472
  }
470
473
  }
471
474
  function dateAddAmount(value, amount, mode) {
@@ -2007,8 +2010,7 @@ class DatePopup {
2007
2010
  this.flexibleActiveTab = 'custom';
2008
2011
  }
2009
2012
  if (this.defaultPickerValue() && !hasValue(this.value())) {
2010
- const { value } = transformDateValue(this.defaultPickerValue());
2011
- this.value.set(makeValue(value, this.isRange(), this.timeZone()));
2013
+ this.value.set(this.getDefaultPickerValue());
2012
2014
  }
2013
2015
  this.updateActiveDate();
2014
2016
  this.initDisabledDate();
@@ -2085,8 +2087,7 @@ class DatePopup {
2085
2087
  updateActiveDate() {
2086
2088
  this.clearHoverValue();
2087
2089
  if (!this.value()) {
2088
- const { value } = transformDateValue(this.defaultPickerValue());
2089
- this.value.set(makeValue(value, this.isRange(), this.timeZone()));
2090
+ this.value.set(this.getDefaultPickerValue());
2090
2091
  }
2091
2092
  if (this.isRange()) {
2092
2093
  if (!this.flexible() || this.flexibleDateGranularity() === 'day') {
@@ -2099,6 +2100,10 @@ class DatePopup {
2099
2100
  }
2100
2101
  this.isDisableTimeConfirm();
2101
2102
  }
2103
+ getDefaultPickerValue() {
2104
+ const { value } = transformDateValue(this.defaultPickerValue());
2105
+ return makeValue(value, this.isRange(), true, this.timeZone());
2106
+ }
2102
2107
  initPanelMode() {
2103
2108
  if (!this.endPanelMode()) {
2104
2109
  if (helpers.isArray(this.panelMode())) {
@@ -2610,10 +2615,8 @@ class ThyPicker {
2610
2615
  this.overlayPositions = getFlexiblePositions(this.placement(), 4);
2611
2616
  effect(() => {
2612
2617
  this.innerValue = this.value();
2613
- if (this.innerValue) {
2614
- if (!this.entering) {
2615
- this.updateReadableDate(this.innerValue);
2616
- }
2618
+ if (!this.entering) {
2619
+ this.updateReadableDate(this.innerValue);
2617
2620
  }
2618
2621
  });
2619
2622
  effect(() => {
@@ -2992,7 +2995,7 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
2992
2995
  }
2993
2996
  onValueChange(originalValue) {
2994
2997
  this.setFormatRule();
2995
- const { value, withTime, flexibleDateGranularity } = transformDateValue(originalValue);
2998
+ const { value, flexibleDateGranularity } = transformDateValue(originalValue);
2996
2999
  this.flexibleDateGranularity = flexibleDateGranularity;
2997
3000
  this.setValue(value);
2998
3001
  if (this.isRange) {
@@ -3048,15 +3051,14 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
3048
3051
  this.flexibleDateGranularity = 'day';
3049
3052
  }
3050
3053
  }
3051
- this.setValue(value);
3052
- this.setTimePickerState(withTime);
3053
3054
  this.onlyEmitDate = typeof withTime === 'undefined';
3054
- this.originWithTime = withTime;
3055
+ this.setTimePickerState(this.onlyEmitDate ? value && !!this.thyShowTime() : withTime);
3056
+ this.setValue(value);
3055
3057
  this.setFormatRule();
3056
3058
  this.cdr.markForCheck();
3057
3059
  }
3058
3060
  setTimePickerState(withTime) {
3059
- this.withTime = withTime;
3061
+ this.withTime = !!withTime;
3060
3062
  }
3061
3063
  // Displays the time directly when the time must be displayed by default
3062
3064
  setDefaultTimePickerState() {
@@ -3065,7 +3067,10 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
3065
3067
  // Restore after clearing time to select whether the original picker time is displayed or not
3066
3068
  restoreTimePickerState(value) {
3067
3069
  if (!value) {
3068
- this.withTime = this.thyMustShowTime() || this.originWithTime;
3070
+ this.withTime = this.thyMustShowTime();
3071
+ }
3072
+ else if (this.onlyEmitDate) {
3073
+ this.withTime = !!this.thyShowTime();
3069
3074
  }
3070
3075
  }
3071
3076
  setPanelMode() {
@@ -3088,7 +3093,7 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
3088
3093
  }
3089
3094
  }
3090
3095
  setValue(value) {
3091
- this.thyValue = makeValue(value, this.isRange, this.thyTimeZone());
3096
+ this.thyValue = makeValue(value, this.isRange, this.withTime, this.thyTimeZone());
3092
3097
  }
3093
3098
  setValueByPrecision(value) {
3094
3099
  return setValueByTimestampPrecision(value, this.isRange, this.thyTimestampPrecision(), this.thyTimeZone());