ngx-tethys 19.1.9 → 19.1.11

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,24 @@
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.11](https://github.com/atinc/ngx-tethys/compare/19.1.10...19.1.11) (2025-10-28)
6
+
7
+
8
+ ### Features
9
+
10
+ * **date-picker:** 可选时间时,优化为选择到分 #TINFR-2955 ([#3597](https://github.com/atinc/ngx-tethys/issues/3597)) ([0b12381](https://github.com/atinc/ngx-tethys/commit/0b123812a416e00b6f7382411587f447bfdc7a84)), closes [#TINFR-2955](https://github.com/atinc/ngx-tethys/issues/TINFR-2955)
11
+
12
+
13
+
14
+ ## [19.1.10](https://github.com/atinc/ngx-tethys/compare/19.1.9...19.1.10) (2025-10-28)
15
+
16
+
17
+ ### Features
18
+
19
+ * 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)
20
+
21
+
22
+
5
23
  ## [19.1.9](https://github.com/atinc/ngx-tethys/compare/19.1.8...19.1.9) (2025-10-24)
6
24
 
7
25
 
@@ -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,16 @@ 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
+ const date = new TinyDate(value, timeZone);
472
+ return withTime ? date.setSeconds(0) : date.startOfDay();
469
473
  }
470
474
  }
471
475
  function dateAddAmount(value, amount, mode) {
@@ -2007,8 +2011,7 @@ class DatePopup {
2007
2011
  this.flexibleActiveTab = 'custom';
2008
2012
  }
2009
2013
  if (this.defaultPickerValue() && !hasValue(this.value())) {
2010
- const { value } = transformDateValue(this.defaultPickerValue());
2011
- this.value.set(makeValue(value, this.isRange(), this.timeZone()));
2014
+ this.value.set(this.getDefaultPickerValue());
2012
2015
  }
2013
2016
  this.updateActiveDate();
2014
2017
  this.initDisabledDate();
@@ -2085,8 +2088,7 @@ class DatePopup {
2085
2088
  updateActiveDate() {
2086
2089
  this.clearHoverValue();
2087
2090
  if (!this.value()) {
2088
- const { value } = transformDateValue(this.defaultPickerValue());
2089
- this.value.set(makeValue(value, this.isRange(), this.timeZone()));
2091
+ this.value.set(this.getDefaultPickerValue());
2090
2092
  }
2091
2093
  if (this.isRange()) {
2092
2094
  if (!this.flexible() || this.flexibleDateGranularity() === 'day') {
@@ -2099,6 +2101,10 @@ class DatePopup {
2099
2101
  }
2100
2102
  this.isDisableTimeConfirm();
2101
2103
  }
2104
+ getDefaultPickerValue() {
2105
+ const { value } = transformDateValue(this.defaultPickerValue());
2106
+ return makeValue(value, this.isRange(), true, this.timeZone());
2107
+ }
2102
2108
  initPanelMode() {
2103
2109
  if (!this.endPanelMode()) {
2104
2110
  if (helpers.isArray(this.panelMode())) {
@@ -2610,10 +2616,8 @@ class ThyPicker {
2610
2616
  this.overlayPositions = getFlexiblePositions(this.placement(), 4);
2611
2617
  effect(() => {
2612
2618
  this.innerValue = this.value();
2613
- if (this.innerValue) {
2614
- if (!this.entering) {
2615
- this.updateReadableDate(this.innerValue);
2616
- }
2619
+ if (!this.entering) {
2620
+ this.updateReadableDate(this.innerValue);
2617
2621
  }
2618
2622
  });
2619
2623
  effect(() => {
@@ -2992,7 +2996,7 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
2992
2996
  }
2993
2997
  onValueChange(originalValue) {
2994
2998
  this.setFormatRule();
2995
- const { value, withTime, flexibleDateGranularity } = transformDateValue(originalValue);
2999
+ const { value, flexibleDateGranularity } = transformDateValue(originalValue);
2996
3000
  this.flexibleDateGranularity = flexibleDateGranularity;
2997
3001
  this.setValue(value);
2998
3002
  if (this.isRange) {
@@ -3048,15 +3052,14 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
3048
3052
  this.flexibleDateGranularity = 'day';
3049
3053
  }
3050
3054
  }
3051
- this.setValue(value);
3052
- this.setTimePickerState(withTime);
3053
3055
  this.onlyEmitDate = typeof withTime === 'undefined';
3054
- this.originWithTime = withTime;
3056
+ this.setTimePickerState(this.onlyEmitDate ? value && !!this.thyShowTime() : withTime);
3057
+ this.setValue(value);
3055
3058
  this.setFormatRule();
3056
3059
  this.cdr.markForCheck();
3057
3060
  }
3058
3061
  setTimePickerState(withTime) {
3059
- this.withTime = withTime;
3062
+ this.withTime = !!withTime;
3060
3063
  }
3061
3064
  // Displays the time directly when the time must be displayed by default
3062
3065
  setDefaultTimePickerState() {
@@ -3065,7 +3068,10 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
3065
3068
  // Restore after clearing time to select whether the original picker time is displayed or not
3066
3069
  restoreTimePickerState(value) {
3067
3070
  if (!value) {
3068
- this.withTime = this.thyMustShowTime() || this.originWithTime;
3071
+ this.withTime = this.thyMustShowTime();
3072
+ }
3073
+ else if (this.onlyEmitDate) {
3074
+ this.withTime = !!this.thyShowTime();
3069
3075
  }
3070
3076
  }
3071
3077
  setPanelMode() {
@@ -3088,7 +3094,7 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
3088
3094
  }
3089
3095
  }
3090
3096
  setValue(value) {
3091
- this.thyValue = makeValue(value, this.isRange, this.thyTimeZone());
3097
+ this.thyValue = makeValue(value, this.isRange, this.withTime, this.thyTimeZone());
3092
3098
  }
3093
3099
  setValueByPrecision(value) {
3094
3100
  return setValueByTimestampPrecision(value, this.isRange, this.thyTimestampPrecision(), this.thyTimeZone());