ngx-tethys 19.1.0-next.1 → 19.1.0-next.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 +114 -0
- package/arrow-switcher/arrow-switcher.component.d.ts +5 -1
- package/badge/badge.component.d.ts +1 -1
- package/color-picker/coordinates.directive.d.ts +1 -2
- package/date-picker/abstract-picker.component.d.ts +50 -52
- package/date-picker/abstract-picker.directive.d.ts +15 -40
- package/date-picker/base-picker.component.d.ts +12 -40
- package/date-picker/date-picker.config.d.ts +3 -0
- package/date-picker/lib/calendar/calendar-footer.component.d.ts +24 -19
- package/date-picker/lib/calendar/calendar-header.component.d.ts +15 -15
- package/date-picker/lib/calendar/calendar-table.component.d.ts +15 -16
- package/date-picker/lib/date/date-table-cell.component.d.ts +6 -3
- package/date-picker/lib/date/date-table.component.d.ts +2 -3
- package/date-picker/lib/date-carousel/date-carousel.component.d.ts +2 -3
- package/date-picker/lib/decade/decade-header.component.d.ts +2 -5
- package/date-picker/lib/decade/decade-table.component.d.ts +3 -5
- package/date-picker/lib/month/month-table.component.d.ts +1 -2
- package/date-picker/lib/popups/date-popup.component.d.ts +33 -34
- package/date-picker/lib/popups/inner-popup.component.d.ts +22 -29
- package/date-picker/lib/quarter/quarter-table.component.d.ts +1 -4
- package/date-picker/lib/year/year-header.component.d.ts +2 -4
- package/date-picker/lib/year/year-table.component.d.ts +2 -4
- package/date-picker/month-picker.component.d.ts +2 -2
- package/date-picker/picker.component.d.ts +31 -36
- package/date-picker/picker.pipes.d.ts +4 -5
- package/date-picker/picker.util.d.ts +5 -5
- package/date-picker/picker.validators.d.ts +4 -8
- package/date-picker/quarter-picker.component.d.ts +2 -3
- package/date-picker/styles/range-picker.scss +1 -0
- package/date-picker/week-picker.component.d.ts +0 -1
- package/date-picker/year-picker.component.d.ts +2 -3
- package/dropdown/dropdown-menu.component.d.ts +1 -1
- package/dropdown/dropdown.directive.d.ts +4 -3
- package/empty/empty.component.d.ts +2 -1
- package/fesm2022/ngx-tethys-arrow-switcher.mjs +15 -3
- package/fesm2022/ngx-tethys-arrow-switcher.mjs.map +1 -1
- package/fesm2022/ngx-tethys-autocomplete.mjs +4 -4
- package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
- package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
- package/fesm2022/ngx-tethys-checkbox.mjs +2 -2
- package/fesm2022/ngx-tethys-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-tethys-color-picker.mjs +4 -6
- package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-copy.mjs +2 -2
- package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
- package/fesm2022/ngx-tethys-date-picker.mjs +855 -1072
- package/fesm2022/ngx-tethys-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-divider.mjs +5 -5
- package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dropdown.mjs +9 -11
- package/fesm2022/ngx-tethys-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-tethys-empty.mjs +5 -2
- package/fesm2022/ngx-tethys-empty.mjs.map +1 -1
- package/fesm2022/ngx-tethys-flexible-text.mjs +4 -5
- package/fesm2022/ngx-tethys-flexible-text.mjs.map +1 -1
- package/fesm2022/ngx-tethys-i18n.mjs +26 -6
- package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
- package/fesm2022/ngx-tethys-image.mjs +5 -7
- package/fesm2022/ngx-tethys-image.mjs.map +1 -1
- package/fesm2022/ngx-tethys-layout.mjs +291 -334
- package/fesm2022/ngx-tethys-layout.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +183 -217
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-message.mjs +29 -36
- package/fesm2022/ngx-tethys-message.mjs.map +1 -1
- package/fesm2022/ngx-tethys-notify.mjs +33 -41
- package/fesm2022/ngx-tethys-notify.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property.mjs +1 -0
- package/fesm2022/ngx-tethys-property.mjs.map +1 -1
- package/fesm2022/ngx-tethys-radio.mjs +4 -4
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-resizable.mjs +20 -17
- package/fesm2022/ngx-tethys-resizable.mjs.map +1 -1
- package/fesm2022/ngx-tethys-select.mjs +164 -228
- package/fesm2022/ngx-tethys-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-shared.mjs +423 -587
- package/fesm2022/ngx-tethys-shared.mjs.map +1 -1
- package/fesm2022/ngx-tethys-skeleton.mjs +1 -2
- package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
- package/fesm2022/ngx-tethys-stepper.mjs.map +1 -1
- package/fesm2022/ngx-tethys-table.mjs +1 -2
- package/fesm2022/ngx-tethys-table.mjs.map +1 -1
- package/fesm2022/ngx-tethys-time-picker.mjs +244 -271
- package/fesm2022/ngx-tethys-time-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tooltip.mjs +109 -93
- package/fesm2022/ngx-tethys-tooltip.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs +215 -281
- package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-upload.mjs +2 -2
- package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/i18n/i18n.d.ts +7 -2
- package/i18n/locales/de-de.d.ts +5 -1
- package/i18n/locales/en-us.d.ts +5 -1
- package/i18n/locales/ja-jp.d.ts +5 -1
- package/i18n/locales/zh-hans.d.ts +5 -1
- package/i18n/locales/zh-hant.d.ts +5 -1
- package/image/preview/image-preview.component.d.ts +2 -2
- package/layout/header.component.d.ts +15 -19
- package/layout/layout.component.d.ts +3 -2
- package/layout/sidebar-header.component.d.ts +7 -8
- package/layout/sidebar.component.d.ts +32 -62
- package/list/list-item-meta.component.d.ts +7 -9
- package/list/list-item.component.d.ts +0 -2
- package/list/list.component.d.ts +2 -8
- package/list/selection/selection-list.d.ts +33 -46
- package/message/abstract/abstract-message.component.d.ts +2 -3
- package/message/message-container.component.d.ts +0 -1
- package/message/message.component.d.ts +1 -3
- package/notify/notify-container.component.d.ts +0 -1
- package/notify/notify.component.d.ts +7 -12
- package/package.json +1 -1
- package/resizable/resizable.directive.d.ts +2 -1
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- package/select/custom-select/custom-select.component.d.ts +33 -56
- package/select/native-select/native-select.component.d.ts +7 -13
- package/shared/base-form-check.component.d.ts +6 -8
- package/shared/directives/string-or-template-outlet.directive.d.ts +5 -6
- package/shared/directives/thy-autofocus.directive.d.ts +4 -6
- package/shared/directives/thy-contextmenu.directive.d.ts +2 -2
- package/shared/directives/thy-ctrl-enter.directive.d.ts +2 -2
- package/shared/directives/thy-enter.directive.d.ts +2 -2
- package/shared/directives/thy-scroll.directive.d.ts +5 -8
- package/shared/directives/thy-show.d.ts +5 -6
- package/shared/directives/thy-stop-propagation.directive.d.ts +4 -4
- package/shared/directives/view-outlet.directive.d.ts +6 -7
- package/shared/ng-transclude.directive.d.ts +2 -3
- package/shared/option/group/option-group.component.d.ts +5 -9
- package/shared/option/list-option/list-option.component.d.ts +9 -13
- package/shared/option/option.component.d.ts +10 -17
- package/shared/option/option.token.d.ts +4 -3
- package/shared/option/options-container.component.d.ts +1 -1
- package/shared/select/select-control/select-control.component.d.ts +38 -53
- package/stepper/stepper.component.d.ts +1 -1
- package/table/table-column.component.d.ts +15 -5
- package/time-picker/inner/inner-time-picker.class.d.ts +15 -13
- package/time-picker/inner/inner-time-picker.component.d.ts +26 -26
- package/time-picker/time-picker-panel.component.d.ts +18 -20
- package/time-picker/time-picker.component.d.ts +22 -30
- package/tooltip/tooltip.directive.d.ts +20 -22
- package/tree-select/tree-select.component.d.ts +53 -70
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CdkConnectedOverlay, CdkOverlayOrigin, OverlayModule } from '@angular/cdk/overlay';
|
|
2
2
|
import { formatDate, NgClass, NgTemplateOutlet, CommonModule, isPlatformBrowser, registerLocaleData } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable, inject,
|
|
4
|
+
import { Injectable, inject, input, model, output, effect, Directive, ChangeDetectionStrategy, Component, signal, InjectionToken, Pipe, ChangeDetectorRef, forwardRef, computed, NgModule, viewChild, DestroyRef, linkedSignal, Input, ElementRef, PLATFORM_ID, NgZone, numberAttribute } from '@angular/core';
|
|
5
5
|
import localeZhHans from '@angular/common/locales/zh-Hans';
|
|
6
|
-
import {
|
|
7
|
-
import { injectLocale, ThyI18nService
|
|
6
|
+
import { coerceBooleanProperty, TinyDate, subDays, startOfDay, startOfWeek, addDays, addWeeks, helpers, coerceArray, isTemplateRef, isEmpty, isString, isFunction, isUndefinedOrNull, valueFunctionProp, endOfDay, sortRangeValue, elementMatchClosest, warnDeprecation } from 'ngx-tethys/util';
|
|
7
|
+
import { injectLocale, ThyI18nService } from 'ngx-tethys/i18n';
|
|
8
8
|
import { ThyIcon, ThyIconModule } from 'ngx-tethys/icon';
|
|
9
9
|
import * as i1 from '@angular/forms';
|
|
10
10
|
import { FormsModule, NG_VALUE_ACCESSOR, NG_VALIDATORS } from '@angular/forms';
|
|
@@ -19,7 +19,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
|
19
19
|
import { ThyEnterDirective } from 'ngx-tethys/shared';
|
|
20
20
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
21
21
|
import { ThyPopover, ThyPopoverModule } from 'ngx-tethys/popover';
|
|
22
|
-
import { tap, mapTo,
|
|
22
|
+
import { tap, mapTo, debounceTime } from 'rxjs/operators';
|
|
23
23
|
|
|
24
24
|
function DATE_HELPER_SERVICE_FACTORY() {
|
|
25
25
|
return new DateHelperByDatePipe();
|
|
@@ -61,23 +61,21 @@ class CalendarHeader {
|
|
|
61
61
|
constructor() {
|
|
62
62
|
this.dateHelper = inject(DateHelperService);
|
|
63
63
|
this.locale = injectLocale('datePicker');
|
|
64
|
-
this.showSuperPreBtn = true;
|
|
65
|
-
this.showSuperNextBtn = true;
|
|
66
|
-
this.showPreBtn = true;
|
|
67
|
-
this.showNextBtn = true;
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
64
|
+
this.showSuperPreBtn = input(true, { transform: coerceBooleanProperty });
|
|
65
|
+
this.showSuperNextBtn = input(true, { transform: coerceBooleanProperty });
|
|
66
|
+
this.showPreBtn = input(true, { transform: coerceBooleanProperty });
|
|
67
|
+
this.showNextBtn = input(true, { transform: coerceBooleanProperty });
|
|
68
|
+
this.value = model();
|
|
69
|
+
this.valueChange = output();
|
|
70
|
+
this.panelModeChange = output();
|
|
70
71
|
this.prefixCls = 'thy-calendar';
|
|
72
|
+
effect(() => {
|
|
73
|
+
this.render();
|
|
74
|
+
});
|
|
71
75
|
}
|
|
72
76
|
ngOnInit() {
|
|
73
|
-
if (!this.value) {
|
|
74
|
-
this.value
|
|
75
|
-
}
|
|
76
|
-
this.selectors = this.getSelectors();
|
|
77
|
-
}
|
|
78
|
-
ngOnChanges(changes) {
|
|
79
|
-
if (changes.value) {
|
|
80
|
-
this.render();
|
|
77
|
+
if (!this.value()) {
|
|
78
|
+
this.value.set(new TinyDate());
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
superPrevious() {
|
|
@@ -100,46 +98,32 @@ class CalendarHeader {
|
|
|
100
98
|
return selector ? selector.onClick() : null;
|
|
101
99
|
}
|
|
102
100
|
render() {
|
|
103
|
-
if (this.value) {
|
|
101
|
+
if (this.value()) {
|
|
104
102
|
this.selectors = this.getSelectors();
|
|
105
103
|
}
|
|
106
104
|
}
|
|
107
105
|
gotoMonth(amount) {
|
|
108
|
-
this.changeValue(this.value.addMonths(amount));
|
|
106
|
+
this.changeValue(this.value().addMonths(amount));
|
|
109
107
|
}
|
|
110
108
|
gotoYear(amount) {
|
|
111
|
-
this.changeValue(this.value.addYears(amount));
|
|
109
|
+
this.changeValue(this.value().addYears(amount));
|
|
112
110
|
}
|
|
113
111
|
changeValue(value) {
|
|
114
|
-
if (this.value !== value) {
|
|
115
|
-
this.value
|
|
116
|
-
this.valueChange.emit(
|
|
117
|
-
this.render();
|
|
112
|
+
if (this.value() !== value) {
|
|
113
|
+
this.value.set(value);
|
|
114
|
+
this.valueChange.emit(value);
|
|
118
115
|
}
|
|
119
116
|
}
|
|
120
117
|
formatDateTime(format) {
|
|
121
|
-
|
|
118
|
+
const date = this.value().nativeDate;
|
|
119
|
+
return this.dateHelper.format(date, format);
|
|
122
120
|
}
|
|
123
121
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: CalendarHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
124
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
122
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: CalendarHeader, isStandalone: true, inputs: { showSuperPreBtn: { classPropertyName: "showSuperPreBtn", publicName: "showSuperPreBtn", isSignal: true, isRequired: false, transformFunction: null }, showSuperNextBtn: { classPropertyName: "showSuperNextBtn", publicName: "showSuperNextBtn", isSignal: true, isRequired: false, transformFunction: null }, showPreBtn: { classPropertyName: "showPreBtn", publicName: "showPreBtn", isSignal: true, isRequired: false, transformFunction: null }, showNextBtn: { classPropertyName: "showNextBtn", publicName: "showNextBtn", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange", panelModeChange: "panelModeChange" }, ngImport: i0 }); }
|
|
125
123
|
}
|
|
126
124
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: CalendarHeader, decorators: [{
|
|
127
125
|
type: Directive
|
|
128
|
-
}],
|
|
129
|
-
type: Input
|
|
130
|
-
}], showSuperNextBtn: [{
|
|
131
|
-
type: Input
|
|
132
|
-
}], showPreBtn: [{
|
|
133
|
-
type: Input
|
|
134
|
-
}], showNextBtn: [{
|
|
135
|
-
type: Input
|
|
136
|
-
}], value: [{
|
|
137
|
-
type: Input
|
|
138
|
-
}], valueChange: [{
|
|
139
|
-
type: Output
|
|
140
|
-
}], panelModeChange: [{
|
|
141
|
-
type: Output
|
|
142
|
-
}] } });
|
|
126
|
+
}], ctorParameters: () => [] });
|
|
143
127
|
|
|
144
128
|
/**
|
|
145
129
|
* @private
|
|
@@ -156,11 +140,11 @@ class MonthHeader extends CalendarHeader {
|
|
|
156
140
|
];
|
|
157
141
|
}
|
|
158
142
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: MonthHeader, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
159
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: MonthHeader, isStandalone: true, selector: "month-header", usesInheritance: true, ngImport: i0, template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
143
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: MonthHeader, isStandalone: true, selector: "month-header", usesInheritance: true, ngImport: i0, template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
160
144
|
}
|
|
161
145
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: MonthHeader, decorators: [{
|
|
162
146
|
type: Component,
|
|
163
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'month-header', imports: [NgClass, ThyIcon], template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n" }]
|
|
147
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'month-header', imports: [NgClass, ThyIcon], template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n" }]
|
|
164
148
|
}] });
|
|
165
149
|
|
|
166
150
|
/**
|
|
@@ -168,91 +152,73 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
168
152
|
*/
|
|
169
153
|
class CalendarFooter {
|
|
170
154
|
constructor() {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
this.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
155
|
+
/**
|
|
156
|
+
* 是否支持设置时间 (时、分)
|
|
157
|
+
*/
|
|
158
|
+
this.showTime = input(false, { transform: coerceBooleanProperty });
|
|
159
|
+
/**
|
|
160
|
+
* 是否展示时间 (时、分)
|
|
161
|
+
*/
|
|
162
|
+
this.mustShowTime = input(false, { transform: coerceBooleanProperty });
|
|
163
|
+
this.value = model();
|
|
164
|
+
this.timeZone = input();
|
|
165
|
+
this.disableTimeConfirm = input(false, { transform: coerceBooleanProperty });
|
|
166
|
+
this.selectTime = output();
|
|
167
|
+
this.clickOk = output();
|
|
168
|
+
this.clickRemove = output();
|
|
169
|
+
this.showTimePickerChange = output();
|
|
170
|
+
this.isShowTime = signal(false);
|
|
171
|
+
this.isCanTime = signal(false);
|
|
180
172
|
this.locale = injectLocale('datePicker');
|
|
173
|
+
effect(() => {
|
|
174
|
+
this.initTimeShowMode();
|
|
175
|
+
});
|
|
181
176
|
}
|
|
182
177
|
ngOnInit() {
|
|
183
|
-
this.
|
|
184
|
-
if (!this.value) {
|
|
185
|
-
this.value = new TinyDate(undefined, this.timeZone);
|
|
186
|
-
}
|
|
178
|
+
this.initValue();
|
|
187
179
|
}
|
|
188
|
-
|
|
189
|
-
if (
|
|
190
|
-
this.
|
|
180
|
+
initValue() {
|
|
181
|
+
if (!this.value()) {
|
|
182
|
+
const defaultDate = new TinyDate(undefined, this.timeZone());
|
|
183
|
+
this.value.set(defaultDate);
|
|
191
184
|
}
|
|
192
185
|
}
|
|
193
186
|
onSelectTime(date) {
|
|
194
|
-
this.selectTime.emit(new TinyDate(date, this.timeZone));
|
|
187
|
+
this.selectTime.emit(new TinyDate(date, this.timeZone()));
|
|
195
188
|
}
|
|
196
189
|
onTimeOk() {
|
|
197
|
-
if (this.disableTimeConfirm) {
|
|
190
|
+
if (this.disableTimeConfirm()) {
|
|
198
191
|
return;
|
|
199
192
|
}
|
|
200
|
-
this.selectTime.emit(this.value);
|
|
193
|
+
this.selectTime.emit(this.value());
|
|
201
194
|
this.clickOk.emit();
|
|
202
195
|
}
|
|
203
196
|
onClear() {
|
|
204
|
-
this.value
|
|
197
|
+
this.value.set(null);
|
|
205
198
|
this.clickRemove.emit();
|
|
206
199
|
}
|
|
207
200
|
changeTimeShowMode(type) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
this.isShowTime = false;
|
|
212
|
-
break;
|
|
213
|
-
case 'show':
|
|
214
|
-
this.isCanTime = false;
|
|
215
|
-
this.isShowTime = true;
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
this.showTimePickerChange.emit(this.isShowTime);
|
|
201
|
+
this.isCanTime.set(type === 'can');
|
|
202
|
+
this.isShowTime.set(type === 'show');
|
|
203
|
+
this.showTimePickerChange.emit(this.isShowTime());
|
|
219
204
|
}
|
|
220
|
-
|
|
221
|
-
if (this.mustShowTime) {
|
|
205
|
+
initTimeShowMode() {
|
|
206
|
+
if (this.mustShowTime()) {
|
|
222
207
|
this.changeTimeShowMode('show');
|
|
223
208
|
}
|
|
224
209
|
else {
|
|
225
|
-
if (this.showTime) {
|
|
210
|
+
if (this.showTime()) {
|
|
226
211
|
this.changeTimeShowMode('can');
|
|
227
212
|
}
|
|
228
213
|
}
|
|
229
214
|
}
|
|
230
215
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: CalendarFooter, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
231
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: CalendarFooter, isStandalone: true, selector: "calendar-footer", inputs: { showTime: "showTime", mustShowTime: "mustShowTime", value: "value", timeZone: "timeZone", disableTimeConfirm:
|
|
216
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: CalendarFooter, isStandalone: true, selector: "calendar-footer", inputs: { showTime: { classPropertyName: "showTime", publicName: "showTime", isSignal: true, isRequired: false, transformFunction: null }, mustShowTime: { classPropertyName: "mustShowTime", publicName: "mustShowTime", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null }, disableTimeConfirm: { classPropertyName: "disableTimeConfirm", publicName: "disableTimeConfirm", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", selectTime: "selectTime", clickOk: "clickOk", clickRemove: "clickRemove", showTimePickerChange: "showTimePickerChange" }, exportAs: ["calendarFooter"], ngImport: i0, template: "@let showTime = isShowTime();\n@let canTime = isCanTime();\n\n@if (showTime || canTime) {\n <div class=\"time-picker-section\" (click)=\"$event.stopPropagation()\">\n @if (canTime) {\n <a href=\"javascript:;\" class=\"link-has-icon time-picker-set-btn\" (click)=\"changeTimeShowMode('show')\">\n <thy-icon thyIconName=\"clock-circle\"></thy-icon>{{ locale().setTime }}\n </a>\n }\n @if (showTime) {\n <thy-inner-time-picker\n class=\"time-picker-wrap\"\n [showMeridian]=\"false\"\n [timeZone]=\"timeZone()\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onSelectTime($event)\"></thy-inner-time-picker>\n }\n <div class=\"time-picker-btn-wrap\">\n @if (!canTime) {\n <button [disabled]=\"disableTimeConfirm()\" class=\"time-picker-ok-btn\" thyButton=\"primary\" thySize=\"sm\" (click)=\"onTimeOk()\">\n {{ locale().ok }}\n </button>\n }\n <button class=\"time-picker-clear-btn\" thyButton=\"link-secondary\" thySize=\"sm\" (click)=\"onClear()\">{{ locale().clear }}</button>\n </div>\n </div>\n}\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "component", type: ThyInnerTimePicker, selector: "thy-inner-time-picker", inputs: ["hourStep", "minuteStep", "secondsStep", "readonlyInput", "disabled", "mousewheel", "arrowKeys", "showSpinners", "showMeridian", "showMinutes", "showSeconds", "meridians", "min", "max", "hoursPlaceholder", "minutesPlaceholder", "secondsPlaceholder", "timeZone"], outputs: ["disabledChange", "isValid"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ThyButton, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thyBlock"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
232
217
|
}
|
|
233
218
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: CalendarFooter, decorators: [{
|
|
234
219
|
type: Component,
|
|
235
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'calendar-footer', exportAs: 'calendarFooter', imports: [ThyIcon, ThyInnerTimePicker, FormsModule, ThyButton], template: "@if (
|
|
236
|
-
}],
|
|
237
|
-
type: Input
|
|
238
|
-
}], mustShowTime: [{
|
|
239
|
-
type: Input
|
|
240
|
-
}], value: [{
|
|
241
|
-
type: Input
|
|
242
|
-
}], timeZone: [{
|
|
243
|
-
type: Input
|
|
244
|
-
}], disableTimeConfirm: [{
|
|
245
|
-
type: Input,
|
|
246
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
247
|
-
}], selectTime: [{
|
|
248
|
-
type: Output
|
|
249
|
-
}], clickOk: [{
|
|
250
|
-
type: Output
|
|
251
|
-
}], clickRemove: [{
|
|
252
|
-
type: Output
|
|
253
|
-
}], showTimePickerChange: [{
|
|
254
|
-
type: Output
|
|
255
|
-
}] } });
|
|
220
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'calendar-footer', exportAs: 'calendarFooter', imports: [ThyIcon, ThyInnerTimePicker, FormsModule, ThyButton], template: "@let showTime = isShowTime();\n@let canTime = isCanTime();\n\n@if (showTime || canTime) {\n <div class=\"time-picker-section\" (click)=\"$event.stopPropagation()\">\n @if (canTime) {\n <a href=\"javascript:;\" class=\"link-has-icon time-picker-set-btn\" (click)=\"changeTimeShowMode('show')\">\n <thy-icon thyIconName=\"clock-circle\"></thy-icon>{{ locale().setTime }}\n </a>\n }\n @if (showTime) {\n <thy-inner-time-picker\n class=\"time-picker-wrap\"\n [showMeridian]=\"false\"\n [timeZone]=\"timeZone()\"\n [ngModel]=\"value()\"\n (ngModelChange)=\"onSelectTime($event)\"></thy-inner-time-picker>\n }\n <div class=\"time-picker-btn-wrap\">\n @if (!canTime) {\n <button [disabled]=\"disableTimeConfirm()\" class=\"time-picker-ok-btn\" thyButton=\"primary\" thySize=\"sm\" (click)=\"onTimeOk()\">\n {{ locale().ok }}\n </button>\n }\n <button class=\"time-picker-clear-btn\" thyButton=\"link-secondary\" thySize=\"sm\" (click)=\"onClear()\">{{ locale().clear }}</button>\n </div>\n </div>\n}\n" }]
|
|
221
|
+
}], ctorParameters: () => [] });
|
|
256
222
|
|
|
257
223
|
/**
|
|
258
224
|
* @deprecated
|
|
@@ -300,6 +266,7 @@ const DEFAULT_DATE_PICKER_CONFIG = {
|
|
|
300
266
|
];
|
|
301
267
|
}
|
|
302
268
|
};
|
|
269
|
+
const QUARTER_FORMAT = "'Q'q";
|
|
303
270
|
const THY_DATE_PICKER_CONFIG = new InjectionToken('thy-date-picker-config');
|
|
304
271
|
function useDatePickerDefaultConfig() {
|
|
305
272
|
const locale = injectLocale('datePicker');
|
|
@@ -440,7 +407,7 @@ function getFlexibleAdvancedReadableValue(tinyDates, flexibleDateGranularity, se
|
|
|
440
407
|
}
|
|
441
408
|
switch (flexibleDateGranularity) {
|
|
442
409
|
case 'year':
|
|
443
|
-
const yearFormatStr = locale()
|
|
410
|
+
const yearFormatStr = locale().datePicker.yearFormat;
|
|
444
411
|
if (tinyDates[0].isSameYear(tinyDates[1])) {
|
|
445
412
|
value = `${tinyDates[0].format(yearFormatStr)}`;
|
|
446
413
|
}
|
|
@@ -449,7 +416,7 @@ function getFlexibleAdvancedReadableValue(tinyDates, flexibleDateGranularity, se
|
|
|
449
416
|
}
|
|
450
417
|
break;
|
|
451
418
|
case 'quarter':
|
|
452
|
-
const quarterFormatStr = locale()
|
|
419
|
+
const quarterFormatStr = locale().datePicker.yearQuarterFormat;
|
|
453
420
|
if (tinyDates[0].isSameQuarter(tinyDates[1])) {
|
|
454
421
|
value = `${tinyDates[0].format(quarterFormatStr)}`;
|
|
455
422
|
}
|
|
@@ -458,7 +425,7 @@ function getFlexibleAdvancedReadableValue(tinyDates, flexibleDateGranularity, se
|
|
|
458
425
|
}
|
|
459
426
|
break;
|
|
460
427
|
case 'month':
|
|
461
|
-
const monthFormatStr = locale()
|
|
428
|
+
const monthFormatStr = locale().datePicker.yearMonthFormat;
|
|
462
429
|
if (tinyDates[0].isSameMonth(tinyDates[1])) {
|
|
463
430
|
value = `${tinyDates[0].format(monthFormatStr)}`;
|
|
464
431
|
}
|
|
@@ -657,9 +624,9 @@ class ThyQuarterPickerFormatPipe {
|
|
|
657
624
|
this.datePickerConfigService = datePickerConfigService;
|
|
658
625
|
}
|
|
659
626
|
transform(originalValue, formatStr, separator) {
|
|
660
|
-
const { value
|
|
627
|
+
const { value } = transformDateValue(originalValue);
|
|
661
628
|
if (!formatStr) {
|
|
662
|
-
formatStr =
|
|
629
|
+
formatStr = `yyyy-${QUARTER_FORMAT}`;
|
|
663
630
|
}
|
|
664
631
|
if (!value) {
|
|
665
632
|
return;
|
|
@@ -690,9 +657,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
690
657
|
* @private
|
|
691
658
|
*/
|
|
692
659
|
class ThyDatePickerFormatStringPipe {
|
|
693
|
-
constructor() {
|
|
694
|
-
this.dateHelper = inject(DateHelperService);
|
|
695
|
-
}
|
|
696
660
|
transform(originalValue) {
|
|
697
661
|
const { withTime } = transformDateValue(originalValue);
|
|
698
662
|
return withTime ? 'yyyy-MM-dd HH:mm' : 'yyyy-MM-dd';
|
|
@@ -732,7 +696,7 @@ class DateCarousel {
|
|
|
732
696
|
this.cdr = inject(ChangeDetectorRef);
|
|
733
697
|
this.dateHelper = inject(DateHelperService);
|
|
734
698
|
this.locale = injectLocale('datePicker');
|
|
735
|
-
this.
|
|
699
|
+
this.activeDate = input();
|
|
736
700
|
this.selectableData = {};
|
|
737
701
|
this.selectedValue = [];
|
|
738
702
|
this.initialized = false;
|
|
@@ -914,7 +878,7 @@ class DateCarousel {
|
|
|
914
878
|
this.cdr.markForCheck();
|
|
915
879
|
}
|
|
916
880
|
getSelectableYear(currentDate, preOrNextcount = 0) {
|
|
917
|
-
currentDate = currentDate || this.activeDate || new TinyDate().startOfYear();
|
|
881
|
+
currentDate = currentDate || this.activeDate() || new TinyDate().startOfYear();
|
|
918
882
|
return {
|
|
919
883
|
type: 'year',
|
|
920
884
|
content: `${currentDate.addYears(preOrNextcount).getYear()}`,
|
|
@@ -924,17 +888,17 @@ class DateCarousel {
|
|
|
924
888
|
};
|
|
925
889
|
}
|
|
926
890
|
getSelectableQuarter(currentDate, preOrNextcount = 0) {
|
|
927
|
-
currentDate = currentDate || this.activeDate || new TinyDate().startOfQuarter();
|
|
891
|
+
currentDate = currentDate || this.activeDate() || new TinyDate().startOfQuarter();
|
|
928
892
|
return {
|
|
929
893
|
type: 'quarter',
|
|
930
|
-
content: `${currentDate.addQuarters(preOrNextcount).format(
|
|
894
|
+
content: `${currentDate.addQuarters(preOrNextcount).format(QUARTER_FORMAT)}`,
|
|
931
895
|
startValue: currentDate.addQuarters(preOrNextcount).startOfQuarter(),
|
|
932
896
|
endValue: currentDate.addQuarters(preOrNextcount).endOfQuarter(),
|
|
933
897
|
classMap: {}
|
|
934
898
|
};
|
|
935
899
|
}
|
|
936
900
|
getSelectableMonth(currentDate, preOrNextcount = 0) {
|
|
937
|
-
currentDate = currentDate || this.activeDate || new TinyDate().startOfMonth();
|
|
901
|
+
currentDate = currentDate || this.activeDate() || new TinyDate().startOfMonth();
|
|
938
902
|
// Selectable months for advanced range selector
|
|
939
903
|
const cell = {
|
|
940
904
|
type: 'month',
|
|
@@ -1077,7 +1041,7 @@ class DateCarousel {
|
|
|
1077
1041
|
this.selectedValueChange$.complete();
|
|
1078
1042
|
}
|
|
1079
1043
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DateCarousel, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1080
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DateCarousel, isStandalone: true, selector: "date-carousel", inputs: { activeDate: "activeDate"
|
|
1044
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DateCarousel, isStandalone: true, selector: "date-carousel", inputs: { activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "thy-date-picker-advanced-carousel" }, providers: [
|
|
1081
1045
|
{
|
|
1082
1046
|
provide: NG_VALUE_ACCESSOR,
|
|
1083
1047
|
multi: true,
|
|
@@ -1093,13 +1057,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
1093
1057
|
multi: true,
|
|
1094
1058
|
useExisting: forwardRef(() => DateCarousel)
|
|
1095
1059
|
}
|
|
1096
|
-
],
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
}], activeDate: [{
|
|
1101
|
-
type: Input
|
|
1102
|
-
}] } });
|
|
1060
|
+
], host: {
|
|
1061
|
+
class: 'thy-date-picker-advanced-carousel'
|
|
1062
|
+
}, imports: [NgTemplateOutlet, ThyButton, ThyIcon, NgClass, DatePickerAdvancedShowYearTipPipe], template: "<ng-container\n *ngTemplateOutlet=\"carouselItem; context: { title: locale().yearText, type: 'year', selectableData: selectableData.year }\"></ng-container>\n\n<ng-container\n *ngTemplateOutlet=\"\n carouselItem;\n context: { title: locale().quarterText, type: 'quarter', selectableData: selectableData.quarter }\n \"></ng-container>\n\n<ng-container\n *ngTemplateOutlet=\"\n carouselItem;\n context: { title: locale().monthText, type: 'month', selectableData: selectableData.month }\n \"></ng-container>\n\n<ng-template #carouselItem let-title=\"title\" let-selectableData=\"selectableData\" let-type=\"type\">\n <div class=\"carousel-item carousel-item-{{ type }}\">\n <p class=\"carousel-item-title\">{{ title }}</p>\n <div class=\"carousel-item-content\">\n <button thyButton=\"outline-default\" thySize=\"sm\" class=\"right-space\" (click)=\"prevClick(type)\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </button>\n @for (item of selectableData; track $index) {\n <div\n class=\"selectable-button right-space\"\n (click)=\"selectDate(type, item)\"\n (mouseenter)=\"onMouseenter($event, type, item)\"\n (mouseleave)=\"onMouseleave($event, type, item)\"\n [ngClass]=\"item.classMap\">\n @if (item | showYearTip: type) {\n <span class=\"year-tip\">{{ item?.startValue?.getYear() }}</span>\n }\n @if (item.isInRange && isSelected(item)) {\n <thy-icon thyIconName=\"close\"></thy-icon>\n }\n @if (item.isInRange && !isSelected(item)) {\n <thy-icon thyIconName=\"plus\"></thy-icon>\n }\n @if (!item.isInRange) {\n <span>{{ item?.content }}</span>\n }\n </div>\n }\n <button thyButton=\"outline-default\" thySize=\"sm\" (click)=\"nextClick(type)\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </button>\n </div>\n </div>\n</ng-template>\n" }]
|
|
1063
|
+
}] });
|
|
1103
1064
|
|
|
1104
1065
|
/**
|
|
1105
1066
|
* @private
|
|
@@ -1124,11 +1085,11 @@ class DateHeader extends CalendarHeader {
|
|
|
1124
1085
|
];
|
|
1125
1086
|
}
|
|
1126
1087
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DateHeader, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1127
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DateHeader, isStandalone: true, selector: "date-header", usesInheritance: true, ngImport: i0, template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1088
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DateHeader, isStandalone: true, selector: "date-header", usesInheritance: true, ngImport: i0, template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1128
1089
|
}
|
|
1129
1090
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DateHeader, decorators: [{
|
|
1130
1091
|
type: Component,
|
|
1131
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'date-header', imports: [NgClass, ThyIcon], template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n" }]
|
|
1092
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'date-header', imports: [NgClass, ThyIcon], template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n" }]
|
|
1132
1093
|
}] });
|
|
1133
1094
|
|
|
1134
1095
|
/**
|
|
@@ -1142,16 +1103,20 @@ class CalendarTable {
|
|
|
1142
1103
|
this.bodyRows = [];
|
|
1143
1104
|
this.MAX_ROW = 6;
|
|
1144
1105
|
this.MAX_COL = 7;
|
|
1145
|
-
this.prefixCls = 'thy-calendar';
|
|
1146
|
-
this.
|
|
1147
|
-
this.
|
|
1148
|
-
this.
|
|
1149
|
-
this.
|
|
1150
|
-
this.
|
|
1151
|
-
this.
|
|
1106
|
+
this.prefixCls = input('thy-calendar');
|
|
1107
|
+
this.value = model();
|
|
1108
|
+
this.activeDate = model(new TinyDate());
|
|
1109
|
+
this.showWeek = input(false, { transform: coerceBooleanProperty });
|
|
1110
|
+
this.selectedValue = input([]);
|
|
1111
|
+
this.hoverValue = input([]);
|
|
1112
|
+
this.timeZone = input();
|
|
1113
|
+
this.disabledDate = input();
|
|
1114
|
+
this.cellRender = input();
|
|
1115
|
+
this.valueChange = output();
|
|
1116
|
+
this.cellHover = output(); // Emitted when hover on a day by mouse enter
|
|
1152
1117
|
}
|
|
1153
1118
|
render() {
|
|
1154
|
-
if (this.activeDate) {
|
|
1119
|
+
if (this.activeDate()) {
|
|
1155
1120
|
this.headRow = this.makeHeadRow();
|
|
1156
1121
|
this.bodyRows = this.makeBodyRows();
|
|
1157
1122
|
}
|
|
@@ -1163,14 +1128,14 @@ class CalendarTable {
|
|
|
1163
1128
|
return item.trackByIndex;
|
|
1164
1129
|
}
|
|
1165
1130
|
hasRangeValue() {
|
|
1166
|
-
return this.selectedValue?.length > 0 || this.hoverValue?.length > 0;
|
|
1131
|
+
return this.selectedValue()?.length > 0 || this.hoverValue()?.length > 0;
|
|
1167
1132
|
}
|
|
1168
1133
|
ngOnInit() {
|
|
1169
1134
|
this.render();
|
|
1170
1135
|
}
|
|
1171
1136
|
ngOnChanges(changes) {
|
|
1172
1137
|
if (changes.activeDate && !changes.activeDate.currentValue) {
|
|
1173
|
-
this.activeDate
|
|
1138
|
+
this.activeDate.set(new TinyDate(undefined, this.timeZone()));
|
|
1174
1139
|
}
|
|
1175
1140
|
if (changes.disabledDate ||
|
|
1176
1141
|
changes.locale ||
|
|
@@ -1204,55 +1169,41 @@ class CalendarTable {
|
|
|
1204
1169
|
return (!left && !right) || (left && right && right.isSameDay(left));
|
|
1205
1170
|
}
|
|
1206
1171
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: CalendarTable, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1207
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
1172
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: CalendarTable, isStandalone: true, inputs: { prefixCls: { classPropertyName: "prefixCls", publicName: "prefixCls", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: false, transformFunction: null }, showWeek: { classPropertyName: "showWeek", publicName: "showWeek", isSignal: true, isRequired: false, transformFunction: null }, selectedValue: { classPropertyName: "selectedValue", publicName: "selectedValue", isSignal: true, isRequired: false, transformFunction: null }, hoverValue: { classPropertyName: "hoverValue", publicName: "hoverValue", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null }, disabledDate: { classPropertyName: "disabledDate", publicName: "disabledDate", isSignal: true, isRequired: false, transformFunction: null }, cellRender: { classPropertyName: "cellRender", publicName: "cellRender", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", activeDate: "activeDateChange", valueChange: "valueChange", cellHover: "cellHover" }, usesOnChanges: true, ngImport: i0 }); }
|
|
1208
1173
|
}
|
|
1209
1174
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: CalendarTable, decorators: [{
|
|
1210
1175
|
type: Directive
|
|
1211
|
-
}]
|
|
1212
|
-
type: Input
|
|
1213
|
-
}], value: [{
|
|
1214
|
-
type: Input
|
|
1215
|
-
}], activeDate: [{
|
|
1216
|
-
type: Input
|
|
1217
|
-
}], showWeek: [{
|
|
1218
|
-
type: Input
|
|
1219
|
-
}], selectedValue: [{
|
|
1220
|
-
type: Input
|
|
1221
|
-
}], hoverValue: [{
|
|
1222
|
-
type: Input
|
|
1223
|
-
}], timeZone: [{
|
|
1224
|
-
type: Input
|
|
1225
|
-
}], disabledDate: [{
|
|
1226
|
-
type: Input
|
|
1227
|
-
}], cellRender: [{
|
|
1228
|
-
type: Input
|
|
1229
|
-
}], fullCellRender: [{
|
|
1230
|
-
type: Input
|
|
1231
|
-
}], valueChange: [{
|
|
1232
|
-
type: Output
|
|
1233
|
-
}], cellHover: [{
|
|
1234
|
-
type: Output
|
|
1235
|
-
}] } });
|
|
1176
|
+
}] });
|
|
1236
1177
|
|
|
1237
1178
|
/**
|
|
1238
1179
|
* @private
|
|
1239
1180
|
*/
|
|
1240
1181
|
class DateTableCell {
|
|
1241
1182
|
constructor() {
|
|
1183
|
+
this.datePickerConfigService = inject(ThyDatePickerConfigService);
|
|
1242
1184
|
this.isTemplateRef = isTemplateRef;
|
|
1185
|
+
this.prefixCls = input();
|
|
1186
|
+
this.cell = input();
|
|
1243
1187
|
this.isNonEmptyString = (v) => isEmpty(v) && isString(v);
|
|
1188
|
+
this.functionRenderResult = computed(() => {
|
|
1189
|
+
const renderFn = this.cellRender();
|
|
1190
|
+
if (!isFunction(renderFn)) {
|
|
1191
|
+
return false;
|
|
1192
|
+
}
|
|
1193
|
+
const result = renderFn(this.cell().value);
|
|
1194
|
+
return !isUndefinedOrNull(result);
|
|
1195
|
+
});
|
|
1196
|
+
this.cellRender = computed(() => {
|
|
1197
|
+
return this.cell()?.dateCellRender || this.datePickerConfigService.config?.dateCellRender;
|
|
1198
|
+
});
|
|
1244
1199
|
}
|
|
1245
1200
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DateTableCell, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1246
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DateTableCell, isStandalone: true, selector: "[date-table-cell]", inputs: { prefixCls: "prefixCls", cell: "cell" }, exportAs: ["dateTableCell"], ngImport: i0, template: "\n@switch (
|
|
1201
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DateTableCell, isStandalone: true, selector: "[date-table-cell]", inputs: { prefixCls: { classPropertyName: "prefixCls", publicName: "prefixCls", isSignal: true, isRequired: false, transformFunction: null }, cell: { classPropertyName: "cell", publicName: "cell", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["dateTableCell"], ngImport: i0, template: "@let prefixClass = prefixCls();\n@let dateCell = cell();\n@let dateCellRender = cellRender();\n\n@switch (prefixClass) {\n @case ('thy-calendar') {\n @switch (true) {\n @case (isTemplateRef(dateCellRender)) {\n <ng-container *ngTemplateOutlet=\"dateCellRender; context: { $implicit: dateCell.value }\"></ng-container>\n }\n @case (isNonEmptyString(dateCellRender)) {\n <span [innerHTML]=\"dateCellRender\"></span>\n }\n @case (functionRenderResult()) {\n <span [innerHTML]=\"$any(dateCellRender)(dateCell.value)\"></span>\n }\n @default {\n <div class=\"{{ prefixClass }}-date\" [attr.aria-selected]=\"dateCell.isSelected\" [attr.aria-disabled]=\"dateCell.isDisabled\">\n {{ dateCell.content }}\n </div>\n }\n }\n }\n @case ('thy-calendar-full') {\n <div\n tabindex=\"0\"\n class=\"{{ prefixClass }}-date thy-calendar-full-cell-inner\"\n [class.thy-calendar-full-calendar-date-today]=\"dateCell.isToday\">\n @if (dateCell.fullCellRender) {\n <ng-container *ngTemplateOutlet=\"$any(dateCell.fullCellRender); context: { $implicit: dateCell.value }\"> </ng-container>\n } @else {\n <div class=\"{{ prefixClass }}-date-value\">\n <span class=\"{{ prefixClass }}-date-value-today-text\">\n <span class=\"{{ prefixClass }}-date-value-text\">{{ dateCell.content }}</span>\n </span>\n </div>\n <div class=\"{{ prefixClass }}-date-content\">\n <ng-container *ngTemplateOutlet=\"$any(dateCellRender); context: { $implicit: dateCell.value }\"> </ng-container>\n </div>\n }\n </div>\n }\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
1247
1202
|
}
|
|
1248
1203
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DateTableCell, decorators: [{
|
|
1249
1204
|
type: Component,
|
|
1250
|
-
args: [{ selector: '[date-table-cell]', exportAs: 'dateTableCell', imports: [NgTemplateOutlet], template: "\n@switch (
|
|
1251
|
-
}]
|
|
1252
|
-
type: Input
|
|
1253
|
-
}], cell: [{
|
|
1254
|
-
type: Input
|
|
1255
|
-
}] } });
|
|
1205
|
+
args: [{ selector: '[date-table-cell]', exportAs: 'dateTableCell', imports: [NgTemplateOutlet], template: "@let prefixClass = prefixCls();\n@let dateCell = cell();\n@let dateCellRender = cellRender();\n\n@switch (prefixClass) {\n @case ('thy-calendar') {\n @switch (true) {\n @case (isTemplateRef(dateCellRender)) {\n <ng-container *ngTemplateOutlet=\"dateCellRender; context: { $implicit: dateCell.value }\"></ng-container>\n }\n @case (isNonEmptyString(dateCellRender)) {\n <span [innerHTML]=\"dateCellRender\"></span>\n }\n @case (functionRenderResult()) {\n <span [innerHTML]=\"$any(dateCellRender)(dateCell.value)\"></span>\n }\n @default {\n <div class=\"{{ prefixClass }}-date\" [attr.aria-selected]=\"dateCell.isSelected\" [attr.aria-disabled]=\"dateCell.isDisabled\">\n {{ dateCell.content }}\n </div>\n }\n }\n }\n @case ('thy-calendar-full') {\n <div\n tabindex=\"0\"\n class=\"{{ prefixClass }}-date thy-calendar-full-cell-inner\"\n [class.thy-calendar-full-calendar-date-today]=\"dateCell.isToday\">\n @if (dateCell.fullCellRender) {\n <ng-container *ngTemplateOutlet=\"$any(dateCell.fullCellRender); context: { $implicit: dateCell.value }\"> </ng-container>\n } @else {\n <div class=\"{{ prefixClass }}-date-value\">\n <span class=\"{{ prefixClass }}-date-value-today-text\">\n <span class=\"{{ prefixClass }}-date-value-text\">{{ dateCell.content }}</span>\n </span>\n </div>\n <div class=\"{{ prefixClass }}-date-content\">\n <ng-container *ngTemplateOutlet=\"$any(dateCellRender); context: { $implicit: dateCell.value }\"> </ng-container>\n </div>\n }\n </div>\n }\n}\n" }]
|
|
1206
|
+
}] });
|
|
1256
1207
|
|
|
1257
1208
|
/**
|
|
1258
1209
|
* @private
|
|
@@ -1262,17 +1213,19 @@ class DateTable extends CalendarTable {
|
|
|
1262
1213
|
super();
|
|
1263
1214
|
this.dateHelper = inject(DateHelperService);
|
|
1264
1215
|
this.datePickerConfigService = inject(ThyDatePickerConfigService);
|
|
1265
|
-
this.dayHover =
|
|
1216
|
+
this.dayHover = output(); // Emitted when hover on a day by mouse enter
|
|
1266
1217
|
}
|
|
1267
1218
|
chooseDate(value) {
|
|
1268
1219
|
// Only change date not change time
|
|
1269
|
-
const
|
|
1270
|
-
|
|
1220
|
+
const activeDate = this.activeDate();
|
|
1221
|
+
const timeZone = this.timeZone();
|
|
1222
|
+
const date = new TinyDate(TinyDate.createDateInTimeZone(value.getFullYear(), value.getMonth(), value.getDate(), activeDate?.getHours(), activeDate?.getMinutes(), activeDate?.getSeconds(), timeZone), timeZone);
|
|
1223
|
+
this.activeDate.set(date.clone());
|
|
1271
1224
|
this.valueChange.emit(date);
|
|
1272
1225
|
}
|
|
1273
1226
|
makeHeadRow() {
|
|
1274
1227
|
const weekDays = [];
|
|
1275
|
-
const start = this.activeDate.calendarStart({ weekStartsOn: this.datePickerConfigService.config.weekStartsOn });
|
|
1228
|
+
const start = this.activeDate().calendarStart({ weekStartsOn: this.datePickerConfigService.config.weekStartsOn });
|
|
1276
1229
|
for (let colIndex = 0; colIndex < this.MAX_COL; colIndex++) {
|
|
1277
1230
|
const day = start.addDays(colIndex);
|
|
1278
1231
|
weekDays[colIndex] = {
|
|
@@ -1288,13 +1241,15 @@ class DateTable extends CalendarTable {
|
|
|
1288
1241
|
}
|
|
1289
1242
|
getVeryShortWeekFormat() {
|
|
1290
1243
|
if (this.dateHelper.relyOnDatePipe) {
|
|
1291
|
-
|
|
1244
|
+
const locale = this.locale();
|
|
1245
|
+
const prefixCls = this.prefixCls();
|
|
1246
|
+
return prefixCls === 'thy-calendar-full' ? locale.fullWeekFormat : locale.weekFormat;
|
|
1292
1247
|
}
|
|
1293
1248
|
return 'dd';
|
|
1294
1249
|
}
|
|
1295
1250
|
makeBodyRows() {
|
|
1296
1251
|
const dateRows = [];
|
|
1297
|
-
const firstDayOfMonth = this.activeDate.calendarStart({ weekStartsOn: this.datePickerConfigService.config.weekStartsOn });
|
|
1252
|
+
const firstDayOfMonth = this.activeDate().calendarStart({ weekStartsOn: this.datePickerConfigService.config.weekStartsOn });
|
|
1298
1253
|
for (let week = 0; week < this.MAX_ROW; week++) {
|
|
1299
1254
|
const weekStart = firstDayOfMonth.addDays(week * 7);
|
|
1300
1255
|
const row = {
|
|
@@ -1315,21 +1270,22 @@ class DateTable extends CalendarTable {
|
|
|
1315
1270
|
isDisabled: false,
|
|
1316
1271
|
isToday: false,
|
|
1317
1272
|
title: title,
|
|
1318
|
-
dateCellRender: valueFunctionProp(this.cellRender, date),
|
|
1273
|
+
dateCellRender: valueFunctionProp(this.cellRender(), date),
|
|
1319
1274
|
content: `${date.getDate()}`,
|
|
1320
1275
|
onClick: () => this.chooseDate(date),
|
|
1321
1276
|
onMouseEnter: () => this.dayHover.emit(date)
|
|
1322
1277
|
};
|
|
1323
1278
|
this.addCellProperty(cell, date);
|
|
1324
|
-
if (this.showWeek && !row.weekNum) {
|
|
1279
|
+
if (this.showWeek() && !row.weekNum) {
|
|
1325
1280
|
row.weekNum = this.dateHelper.getISOWeek(date.nativeDate);
|
|
1326
1281
|
}
|
|
1327
1282
|
if (date.isToday()) {
|
|
1328
1283
|
cell.isToday = true;
|
|
1329
1284
|
row.isCurrent = true;
|
|
1330
1285
|
}
|
|
1331
|
-
|
|
1332
|
-
|
|
1286
|
+
const selectedValue = this.selectedValue();
|
|
1287
|
+
if (selectedValue?.length > 0) {
|
|
1288
|
+
const [startSelected, endSelected] = selectedValue;
|
|
1333
1289
|
if (date.isSameDay(startSelected)) {
|
|
1334
1290
|
row.isActive = true;
|
|
1335
1291
|
}
|
|
@@ -1337,22 +1293,24 @@ class DateTable extends CalendarTable {
|
|
|
1337
1293
|
row.isActive = true;
|
|
1338
1294
|
}
|
|
1339
1295
|
}
|
|
1340
|
-
else if (date.isSameDay(this.value)) {
|
|
1296
|
+
else if (date.isSameDay(this.value())) {
|
|
1341
1297
|
row.isActive = true;
|
|
1342
1298
|
}
|
|
1343
1299
|
row.dateCells.push(cell);
|
|
1344
1300
|
}
|
|
1301
|
+
const prefixCls = this.prefixCls();
|
|
1345
1302
|
row.classMap = {
|
|
1346
|
-
[`${
|
|
1347
|
-
[`${
|
|
1303
|
+
[`${prefixCls}-current-week`]: row.isCurrent,
|
|
1304
|
+
[`${prefixCls}-active-week`]: row.isActive
|
|
1348
1305
|
};
|
|
1349
1306
|
dateRows.push(row);
|
|
1350
1307
|
}
|
|
1351
1308
|
return dateRows;
|
|
1352
1309
|
}
|
|
1353
1310
|
addCellProperty(cell, date) {
|
|
1354
|
-
|
|
1355
|
-
|
|
1311
|
+
const selectedValue = this.selectedValue();
|
|
1312
|
+
if (selectedValue?.length > 0) {
|
|
1313
|
+
const [startSelected, endSelected] = selectedValue;
|
|
1356
1314
|
if (startSelected?.isSameDay(date)) {
|
|
1357
1315
|
cell.isSelected = true;
|
|
1358
1316
|
}
|
|
@@ -1364,55 +1322,53 @@ class DateTable extends CalendarTable {
|
|
|
1364
1322
|
cell.isInRange = startSelected?.isBeforeDay(date) && date.isBeforeDay(endSelected);
|
|
1365
1323
|
}
|
|
1366
1324
|
else {
|
|
1367
|
-
cell.isSelected = date.isSameDay(this.value);
|
|
1325
|
+
cell.isSelected = date.isSameDay(this.value());
|
|
1368
1326
|
}
|
|
1369
|
-
|
|
1370
|
-
cell.
|
|
1327
|
+
const activeDate = this.activeDate();
|
|
1328
|
+
cell.isLastMonthCell = date.isBeforeMonth(activeDate);
|
|
1329
|
+
cell.isNextMonthCell = date.isAfterMonth(activeDate);
|
|
1371
1330
|
cell.isToday = date.isToday();
|
|
1372
|
-
cell.isDisabled = !!this.disabledDate?.(date.nativeDate);
|
|
1331
|
+
cell.isDisabled = !!this.disabledDate()?.(date.nativeDate);
|
|
1373
1332
|
cell.classMap = this.getClassMap(cell);
|
|
1374
1333
|
}
|
|
1375
1334
|
getClassMap(cell) {
|
|
1335
|
+
const prefixCls = this.prefixCls();
|
|
1376
1336
|
return {
|
|
1377
|
-
[`${
|
|
1378
|
-
[`${
|
|
1379
|
-
[`${
|
|
1380
|
-
[`${
|
|
1381
|
-
[`${
|
|
1382
|
-
[`${
|
|
1383
|
-
[`${
|
|
1384
|
-
[`${
|
|
1385
|
-
[`${
|
|
1337
|
+
[`${prefixCls}-cell`]: true,
|
|
1338
|
+
[`${prefixCls}-today`]: cell.isToday,
|
|
1339
|
+
[`${prefixCls}-last-month-cell`]: cell.isLastMonthCell,
|
|
1340
|
+
[`${prefixCls}-next-month-btn-day`]: cell.isNextMonthCell,
|
|
1341
|
+
[`${prefixCls}-selected-day`]: cell.isSelected,
|
|
1342
|
+
[`${prefixCls}-disabled-cell`]: cell.isDisabled,
|
|
1343
|
+
[`${prefixCls}-selected-start-date`]: !!cell.isSelectedStartDate,
|
|
1344
|
+
[`${prefixCls}-selected-end-date`]: !!cell.isSelectedEndDate,
|
|
1345
|
+
[`${prefixCls}-in-range-cell`]: !!cell.isInRange
|
|
1386
1346
|
};
|
|
1387
1347
|
}
|
|
1388
1348
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DateTable, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1389
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DateTable, isStandalone: true, selector: "date-table", outputs: { dayHover: "dayHover" }, exportAs: ["dateTable"], usesInheritance: true, ngImport: i0, template: "<table class=\"{{
|
|
1349
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DateTable, isStandalone: true, selector: "date-table", outputs: { dayHover: "dayHover" }, exportAs: ["dateTable"], usesInheritance: true, ngImport: i0, template: "@let prefixClass = prefixCls();\n<table class=\"{{ prefixClass }}-table\" cellSpacing=\"0\" role=\"grid\">\n <thead>\n <tr role=\"row\">\n @if (showWeek()) {\n <th role=\"columnheader\" [title]=\"locale().week\" class=\"{{ prefixClass }}-column-header {{ prefixClass }}-week-number-header\">\n <span class=\"{{ prefixClass }}-column-header-inner\">{{ locale().prefixWeek }}</span>\n </th>\n }\n @for (cell of headRow; track $index) {\n <th role=\"columnheader\" title=\"{{ cell.title }}\" class=\"{{ prefixClass }}-column-header\">\n @if (prefixClass === 'thy-calendar') {\n <span class=\"{{ prefixClass }}-column-header-inner\">{{ cell.content }}</span>\n }\n @if (prefixClass === 'thy-calendar-full') {\n <span class=\"{{ prefixClass }}-column-header-inner\">{{ cell.content }}</span>\n }\n </th>\n }\n </tr>\n </thead>\n <tbody class=\"{{ prefixClass }}-tbody\">\n @for (row of bodyRows; track $index) {\n <tr [ngClass]=\"row.classMap\" role=\"row\">\n @if (row.weekNum) {\n <td role=\"gridcell\" class=\"{{ prefixClass }}-week-number-cell\">\n {{ row.weekNum }}\n </td>\n }\n @for (cell of row.dateCells; track $index) {\n <td\n role=\"gridcell\"\n [ngClass]=\"cell.classMap\"\n (click)=\"cell.isDisabled ? null : cell.onClick()\"\n date-table-cell\n [prefixCls]=\"prefixClass\"\n [cell]=\"cell\"></td>\n }\n </tr>\n }\n </tbody>\n</table>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: DateTableCell, selector: "[date-table-cell]", inputs: ["prefixCls", "cell"], exportAs: ["dateTableCell"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1390
1350
|
}
|
|
1391
1351
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DateTable, decorators: [{
|
|
1392
1352
|
type: Component,
|
|
1393
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'date-table', exportAs: 'dateTable', imports: [NgClass, DateTableCell], template: "<table class=\"{{
|
|
1394
|
-
}], ctorParameters: () => []
|
|
1395
|
-
type: Output
|
|
1396
|
-
}] } });
|
|
1353
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'date-table', exportAs: 'dateTable', imports: [NgClass, DateTableCell], template: "@let prefixClass = prefixCls();\n<table class=\"{{ prefixClass }}-table\" cellSpacing=\"0\" role=\"grid\">\n <thead>\n <tr role=\"row\">\n @if (showWeek()) {\n <th role=\"columnheader\" [title]=\"locale().week\" class=\"{{ prefixClass }}-column-header {{ prefixClass }}-week-number-header\">\n <span class=\"{{ prefixClass }}-column-header-inner\">{{ locale().prefixWeek }}</span>\n </th>\n }\n @for (cell of headRow; track $index) {\n <th role=\"columnheader\" title=\"{{ cell.title }}\" class=\"{{ prefixClass }}-column-header\">\n @if (prefixClass === 'thy-calendar') {\n <span class=\"{{ prefixClass }}-column-header-inner\">{{ cell.content }}</span>\n }\n @if (prefixClass === 'thy-calendar-full') {\n <span class=\"{{ prefixClass }}-column-header-inner\">{{ cell.content }}</span>\n }\n </th>\n }\n </tr>\n </thead>\n <tbody class=\"{{ prefixClass }}-tbody\">\n @for (row of bodyRows; track $index) {\n <tr [ngClass]=\"row.classMap\" role=\"row\">\n @if (row.weekNum) {\n <td role=\"gridcell\" class=\"{{ prefixClass }}-week-number-cell\">\n {{ row.weekNum }}\n </td>\n }\n @for (cell of row.dateCells; track $index) {\n <td\n role=\"gridcell\"\n [ngClass]=\"cell.classMap\"\n (click)=\"cell.isDisabled ? null : cell.onClick()\"\n date-table-cell\n [prefixCls]=\"prefixClass\"\n [cell]=\"cell\"></td>\n }\n </tr>\n }\n </tbody>\n</table>\n" }]
|
|
1354
|
+
}], ctorParameters: () => [] });
|
|
1397
1355
|
|
|
1398
1356
|
/**
|
|
1399
1357
|
* @private
|
|
1400
1358
|
*/
|
|
1401
1359
|
class DecadeHeader extends CalendarHeader {
|
|
1402
1360
|
constructor() {
|
|
1403
|
-
super();
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
return parseInt(`${this.value.getYear() / 100}`, 10) * 100;
|
|
1407
|
-
}
|
|
1408
|
-
get endYear() {
|
|
1409
|
-
return this.startYear + 99;
|
|
1361
|
+
super(...arguments);
|
|
1362
|
+
this.startYear = computed(() => parseInt(`${this.value().getYear() / 100}`, 10) * 100);
|
|
1363
|
+
this.endYear = computed(() => this.startYear() + 99);
|
|
1410
1364
|
}
|
|
1411
1365
|
superPrevious() {
|
|
1412
|
-
this.
|
|
1366
|
+
const newValue = this.value().addYears(-100);
|
|
1367
|
+
this.changeValue(newValue);
|
|
1413
1368
|
}
|
|
1414
1369
|
superNext() {
|
|
1415
|
-
this.
|
|
1370
|
+
const newValue = this.value().addYears(100);
|
|
1371
|
+
this.changeValue(newValue);
|
|
1416
1372
|
}
|
|
1417
1373
|
getSelectors() {
|
|
1418
1374
|
return [
|
|
@@ -1420,45 +1376,42 @@ class DecadeHeader extends CalendarHeader {
|
|
|
1420
1376
|
className: `${this.prefixCls}-decade-btn`,
|
|
1421
1377
|
title: '',
|
|
1422
1378
|
onClick: () => { },
|
|
1423
|
-
label: `${this.startYear}-${this.endYear}`
|
|
1379
|
+
label: `${this.startYear()}-${this.endYear()}`
|
|
1424
1380
|
}
|
|
1425
1381
|
];
|
|
1426
1382
|
}
|
|
1427
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DecadeHeader, deps:
|
|
1428
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DecadeHeader, isStandalone: true, selector: "decade-header", usesInheritance: true, ngImport: i0, template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1383
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DecadeHeader, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1384
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DecadeHeader, isStandalone: true, selector: "decade-header", usesInheritance: true, ngImport: i0, template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1429
1385
|
}
|
|
1430
1386
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DecadeHeader, decorators: [{
|
|
1431
1387
|
type: Component,
|
|
1432
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'decade-header', imports: [NgClass, ThyIcon], template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n" }]
|
|
1433
|
-
}]
|
|
1388
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'decade-header', imports: [NgClass, ThyIcon], template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n" }]
|
|
1389
|
+
}] });
|
|
1434
1390
|
|
|
1435
1391
|
/**
|
|
1436
1392
|
* @private
|
|
1437
1393
|
*/
|
|
1438
1394
|
class DecadeTable extends CalendarTable {
|
|
1439
|
-
get startYear() {
|
|
1440
|
-
return parseInt(`${this.activeDate.getYear() / 100}`, 10) * 100;
|
|
1441
|
-
}
|
|
1442
|
-
get endYear() {
|
|
1443
|
-
return this.startYear + 99;
|
|
1444
|
-
}
|
|
1445
1395
|
constructor() {
|
|
1446
|
-
super();
|
|
1396
|
+
super(...arguments);
|
|
1447
1397
|
this.MAX_ROW = 4;
|
|
1448
1398
|
this.MAX_COL = 3;
|
|
1399
|
+
this.startYear = computed(() => parseInt(`${this.activeDate().getYear() / 100}`, 10) * 100);
|
|
1400
|
+
this.endYear = computed(() => this.startYear() + 99);
|
|
1449
1401
|
}
|
|
1450
1402
|
chooseDecade(startYear) {
|
|
1451
|
-
|
|
1452
|
-
this.
|
|
1403
|
+
const newValue = (this.value() || new TinyDate()).setYear(startYear);
|
|
1404
|
+
this.value.set(newValue);
|
|
1405
|
+
this.valueChange.emit(newValue);
|
|
1453
1406
|
}
|
|
1454
1407
|
makeHeadRow() {
|
|
1455
1408
|
return [];
|
|
1456
1409
|
}
|
|
1457
1410
|
makeBodyRows() {
|
|
1458
1411
|
const decades = [];
|
|
1459
|
-
const currentYear = this.value && this.value.getYear();
|
|
1460
|
-
const startYear = this.startYear;
|
|
1461
|
-
const endYear = this.endYear;
|
|
1412
|
+
const currentYear = this.value() && this.value().getYear();
|
|
1413
|
+
const startYear = this.startYear();
|
|
1414
|
+
const endYear = this.endYear();
|
|
1462
1415
|
const previousYear = startYear - 10;
|
|
1463
1416
|
let index = 0;
|
|
1464
1417
|
for (let rowIndex = 0; rowIndex < this.MAX_ROW; rowIndex++) {
|
|
@@ -1489,24 +1442,25 @@ class DecadeTable extends CalendarTable {
|
|
|
1489
1442
|
return decades;
|
|
1490
1443
|
}
|
|
1491
1444
|
getClassMap(cell) {
|
|
1445
|
+
const prefixCls = this.prefixCls();
|
|
1492
1446
|
return {
|
|
1493
|
-
[`${
|
|
1494
|
-
[`${
|
|
1495
|
-
[`${
|
|
1496
|
-
[`${
|
|
1447
|
+
[`${prefixCls}-decade-panel-cell`]: true,
|
|
1448
|
+
[`${prefixCls}-decade-panel-selected-cell`]: cell.isSelected,
|
|
1449
|
+
[`${prefixCls}-decade-panel-last-century-cell`]: cell.isLowerThanStart,
|
|
1450
|
+
[`${prefixCls}-decade-panel-next-century-cell`]: cell.isBiggerThanEnd
|
|
1497
1451
|
};
|
|
1498
1452
|
}
|
|
1499
1453
|
cellClick(event, cell) {
|
|
1500
1454
|
event.stopPropagation();
|
|
1501
1455
|
cell.onClick();
|
|
1502
1456
|
}
|
|
1503
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DecadeTable, deps:
|
|
1504
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DecadeTable, isStandalone: true, selector: "decade-table", exportAs: ["decadeTable"], usesInheritance: true, ngImport: i0, template: "<table class=\"{{
|
|
1457
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DecadeTable, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1458
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DecadeTable, isStandalone: true, selector: "decade-table", exportAs: ["decadeTable"], usesInheritance: true, ngImport: i0, template: "@let prefixClass = prefixCls();\n<table class=\"{{ prefixClass }}-decade-panel-table\" cellSpacing=\"0\" role=\"grid\">\n <tbody class=\"{{ prefixClass }}-decade-panel-tbody\">\n @for (row of bodyRows; track $index) {\n <tr role=\"row\">\n @for (cell of row.dateCells; track $index) {\n <td role=\"gridcell\" title=\"{{ cell.title }}\" (click)=\"cellClick($event, cell)\" [ngClass]=\"cell.classMap\">\n <a class=\"{{ prefixClass }}-decade-panel-decade\">{{ cell.content }}</a>\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1505
1459
|
}
|
|
1506
1460
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DecadeTable, decorators: [{
|
|
1507
1461
|
type: Component,
|
|
1508
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'decade-table', exportAs: 'decadeTable', imports: [NgClass], template: "<table class=\"{{
|
|
1509
|
-
}]
|
|
1462
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'decade-table', exportAs: 'decadeTable', imports: [NgClass], template: "@let prefixClass = prefixCls();\n<table class=\"{{ prefixClass }}-decade-panel-table\" cellSpacing=\"0\" role=\"grid\">\n <tbody class=\"{{ prefixClass }}-decade-panel-tbody\">\n @for (row of bodyRows; track $index) {\n <tr role=\"row\">\n @for (cell of row.dateCells; track $index) {\n <td role=\"gridcell\" title=\"{{ cell.title }}\" (click)=\"cellClick($event, cell)\" [ngClass]=\"cell.classMap\">\n <a class=\"{{ prefixClass }}-decade-panel-decade\">{{ cell.content }}</a>\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n" }]
|
|
1463
|
+
}] });
|
|
1510
1464
|
|
|
1511
1465
|
/**
|
|
1512
1466
|
* @private
|
|
@@ -1519,8 +1473,9 @@ class MonthTable extends CalendarTable {
|
|
|
1519
1473
|
this.MAX_COL = 3;
|
|
1520
1474
|
}
|
|
1521
1475
|
chooseMonth(month) {
|
|
1522
|
-
|
|
1523
|
-
this.
|
|
1476
|
+
const newValue = this.activeDate().setMonth(month);
|
|
1477
|
+
this.value.set(newValue);
|
|
1478
|
+
this.valueChange.emit(newValue);
|
|
1524
1479
|
this.render();
|
|
1525
1480
|
}
|
|
1526
1481
|
makeHeadRow() {
|
|
@@ -1535,9 +1490,9 @@ class MonthTable extends CalendarTable {
|
|
|
1535
1490
|
trackByIndex: rowIndex
|
|
1536
1491
|
};
|
|
1537
1492
|
for (let colIndex = 0; colIndex < this.MAX_COL; colIndex++) {
|
|
1538
|
-
const month = this.activeDate.setMonth(monthValue);
|
|
1539
|
-
const monthFormat = this.locale().
|
|
1540
|
-
const isDisabled = this.disabledDate ? this.disabledDate(this.activeDate.setMonth(monthValue).nativeDate) : false;
|
|
1493
|
+
const month = this.activeDate().setMonth(monthValue);
|
|
1494
|
+
const monthFormat = this.locale().monthFormat;
|
|
1495
|
+
const isDisabled = this.disabledDate ? this.disabledDate()(this.activeDate().setMonth(monthValue).nativeDate) : false;
|
|
1541
1496
|
const content = this.dateHelper.format(month.nativeDate, monthFormat);
|
|
1542
1497
|
const cell = {
|
|
1543
1498
|
trackByIndex: colIndex,
|
|
@@ -1546,7 +1501,7 @@ class MonthTable extends CalendarTable {
|
|
|
1546
1501
|
content,
|
|
1547
1502
|
title: content,
|
|
1548
1503
|
classMap: null,
|
|
1549
|
-
isSelected: month.isSameMonth(this.value),
|
|
1504
|
+
isSelected: month.isSameMonth(this.value()),
|
|
1550
1505
|
onClick: () => this.chooseMonth(cell.value.getMonth()),
|
|
1551
1506
|
onMouseEnter: () => { }
|
|
1552
1507
|
};
|
|
@@ -1559,8 +1514,8 @@ class MonthTable extends CalendarTable {
|
|
|
1559
1514
|
return months;
|
|
1560
1515
|
}
|
|
1561
1516
|
addCellProperty(cell, month) {
|
|
1562
|
-
if (this.selectedValue?.length > 0) {
|
|
1563
|
-
const [startSelected, endSelected] = this.selectedValue;
|
|
1517
|
+
if (this.selectedValue()?.length > 0) {
|
|
1518
|
+
const [startSelected, endSelected] = this.selectedValue();
|
|
1564
1519
|
if (startSelected?.isSameMonth(month)) {
|
|
1565
1520
|
cell.isSelectedStartDate = true;
|
|
1566
1521
|
cell.isSelected = true;
|
|
@@ -1573,7 +1528,7 @@ class MonthTable extends CalendarTable {
|
|
|
1573
1528
|
cell.isEndSingle = !startSelected && !!endSelected;
|
|
1574
1529
|
cell.isInRange = startSelected?.isBeforeMonth(month) && month?.isBeforeMonth(endSelected);
|
|
1575
1530
|
}
|
|
1576
|
-
else if (month.isSameMonth(this.value)) {
|
|
1531
|
+
else if (month.isSameMonth(this.value())) {
|
|
1577
1532
|
cell.isSelected = true;
|
|
1578
1533
|
}
|
|
1579
1534
|
cell.classMap = this.getClassMap(cell);
|
|
@@ -1583,20 +1538,21 @@ class MonthTable extends CalendarTable {
|
|
|
1583
1538
|
return monthCell.isDisabled ? null : monthCell.onClick();
|
|
1584
1539
|
}
|
|
1585
1540
|
getClassMap(cell) {
|
|
1541
|
+
const prefixCls = this.prefixCls();
|
|
1586
1542
|
return {
|
|
1587
|
-
[`${
|
|
1588
|
-
[`${
|
|
1589
|
-
[`${
|
|
1590
|
-
[`${
|
|
1591
|
-
[`${
|
|
1543
|
+
[`${prefixCls}-month-panel-cell`]: true,
|
|
1544
|
+
[`${prefixCls}-month-panel-cell-disabled`]: cell.isDisabled,
|
|
1545
|
+
[`${prefixCls}-month-panel-selected-cell`]: cell.isSelected,
|
|
1546
|
+
[`${prefixCls}-in-range-cell`]: !!cell.isInRange,
|
|
1547
|
+
[`${prefixCls}-month-panel-current-cell`]: new TinyDate().getYear() === this.activeDate().getYear() && cell.value.getMonth() === new TinyDate().getMonth()
|
|
1592
1548
|
};
|
|
1593
1549
|
}
|
|
1594
1550
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: MonthTable, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1595
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: MonthTable, isStandalone: true, selector: "month-table", exportAs: ["monthTable"], usesInheritance: true, ngImport: i0, template: "<table class=\"{{
|
|
1551
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: MonthTable, isStandalone: true, selector: "month-table", exportAs: ["monthTable"], usesInheritance: true, ngImport: i0, template: "@let prefixClass = prefixCls();\n<table class=\"{{ prefixClass }}-month-panel-table\" cellSpacing=\"0\" role=\"grid\">\n <tbody class=\"{{ prefixClass }}-month-panel-tbody\">\n @for (row of bodyRows; track trackByBodyRow($index, row)) {\n <tr role=\"row\">\n @for (monthCell of row.dateCells; track trackByBodyColumn($index, monthCell)) {\n <td role=\"gridcell\" title=\"{{ monthCell.title }}\" (click)=\"monthCellClick($event, monthCell)\" [ngClass]=\"monthCell.classMap\">\n @switch (prefixClass) {\n @case ('thy-calendar') {\n <div class=\"{{ prefixClass }}-month-panel-month\">{{ monthCell.content }}</div>\n }\n }\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1596
1552
|
}
|
|
1597
1553
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: MonthTable, decorators: [{
|
|
1598
1554
|
type: Component,
|
|
1599
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'month-table', exportAs: 'monthTable', imports: [NgClass], template: "<table class=\"{{
|
|
1555
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'month-table', exportAs: 'monthTable', imports: [NgClass], template: "@let prefixClass = prefixCls();\n<table class=\"{{ prefixClass }}-month-panel-table\" cellSpacing=\"0\" role=\"grid\">\n <tbody class=\"{{ prefixClass }}-month-panel-tbody\">\n @for (row of bodyRows; track trackByBodyRow($index, row)) {\n <tr role=\"row\">\n @for (monthCell of row.dateCells; track trackByBodyColumn($index, monthCell)) {\n <td role=\"gridcell\" title=\"{{ monthCell.title }}\" (click)=\"monthCellClick($event, monthCell)\" [ngClass]=\"monthCell.classMap\">\n @switch (prefixClass) {\n @case ('thy-calendar') {\n <div class=\"{{ prefixClass }}-month-panel-month\">{{ monthCell.content }}</div>\n }\n }\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n" }]
|
|
1600
1556
|
}], ctorParameters: () => [] });
|
|
1601
1557
|
|
|
1602
1558
|
/**
|
|
@@ -1604,14 +1560,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
1604
1560
|
*/
|
|
1605
1561
|
class QuarterTable extends CalendarTable {
|
|
1606
1562
|
constructor() {
|
|
1607
|
-
super();
|
|
1608
|
-
this.dateHelper = inject(DateHelperService);
|
|
1563
|
+
super(...arguments);
|
|
1609
1564
|
this.MAX_ROW = 1;
|
|
1610
1565
|
this.MAX_COL = 4;
|
|
1611
1566
|
}
|
|
1612
1567
|
chooseQuarter(quarter) {
|
|
1613
|
-
|
|
1614
|
-
this.
|
|
1568
|
+
const newValue = this.activeDate().setQuarter(quarter);
|
|
1569
|
+
this.value.set(newValue);
|
|
1570
|
+
this.valueChange.emit(newValue);
|
|
1615
1571
|
this.render();
|
|
1616
1572
|
}
|
|
1617
1573
|
makeHeadRow() {
|
|
@@ -1626,9 +1582,9 @@ class QuarterTable extends CalendarTable {
|
|
|
1626
1582
|
trackByIndex: rowIndex
|
|
1627
1583
|
};
|
|
1628
1584
|
for (let colIndex = 0; colIndex < this.MAX_COL; colIndex++) {
|
|
1629
|
-
const quarter = this.activeDate.setQuarter(quarterValue + 1);
|
|
1630
|
-
const isDisabled = this.disabledDate ? this.disabledDate(quarter.nativeDate) : false;
|
|
1631
|
-
const content = `${quarter.format(
|
|
1585
|
+
const quarter = this.activeDate().setQuarter(quarterValue + 1);
|
|
1586
|
+
const isDisabled = this.disabledDate ? this.disabledDate()(quarter.nativeDate) : false;
|
|
1587
|
+
const content = `${quarter.format(QUARTER_FORMAT)}`;
|
|
1632
1588
|
const cell = {
|
|
1633
1589
|
trackByIndex: colIndex,
|
|
1634
1590
|
value: quarter.nativeDate,
|
|
@@ -1636,7 +1592,7 @@ class QuarterTable extends CalendarTable {
|
|
|
1636
1592
|
content,
|
|
1637
1593
|
title: content,
|
|
1638
1594
|
classMap: null,
|
|
1639
|
-
isSelected: quarter.isSameQuarter(this.value),
|
|
1595
|
+
isSelected: quarter.isSameQuarter(this.value()),
|
|
1640
1596
|
onClick: () => {
|
|
1641
1597
|
this.chooseQuarter(quarter.getQuarter());
|
|
1642
1598
|
},
|
|
@@ -1651,8 +1607,9 @@ class QuarterTable extends CalendarTable {
|
|
|
1651
1607
|
return quarters;
|
|
1652
1608
|
}
|
|
1653
1609
|
addCellProperty(cell, quarter) {
|
|
1654
|
-
|
|
1655
|
-
|
|
1610
|
+
const selectedValue = this.selectedValue();
|
|
1611
|
+
if (selectedValue?.length > 0) {
|
|
1612
|
+
const [startSelected, endSelected] = selectedValue;
|
|
1656
1613
|
if (startSelected?.isSameQuarter(quarter)) {
|
|
1657
1614
|
cell.isSelectedStartDate = true;
|
|
1658
1615
|
cell.isSelected = true;
|
|
@@ -1665,7 +1622,7 @@ class QuarterTable extends CalendarTable {
|
|
|
1665
1622
|
cell.isEndSingle = !startSelected && !!endSelected;
|
|
1666
1623
|
cell.isInRange = startSelected?.isBeforeQuarter(quarter) && quarter?.isBeforeQuarter(endSelected);
|
|
1667
1624
|
}
|
|
1668
|
-
else if (quarter.isSameQuarter(this.value)) {
|
|
1625
|
+
else if (quarter.isSameQuarter(this.value())) {
|
|
1669
1626
|
cell.isSelected = true;
|
|
1670
1627
|
}
|
|
1671
1628
|
cell.classMap = this.getClassMap(cell, quarter);
|
|
@@ -1675,37 +1632,39 @@ class QuarterTable extends CalendarTable {
|
|
|
1675
1632
|
return quarterCell.isDisabled ? null : quarterCell.onClick();
|
|
1676
1633
|
}
|
|
1677
1634
|
getClassMap(cell, quarter) {
|
|
1635
|
+
const prefixCls = this.prefixCls();
|
|
1678
1636
|
return {
|
|
1679
|
-
[`${
|
|
1680
|
-
[`${
|
|
1681
|
-
[`${
|
|
1682
|
-
[`${
|
|
1683
|
-
[`${
|
|
1637
|
+
[`${prefixCls}-quarter-panel-cell`]: true,
|
|
1638
|
+
[`${prefixCls}-quarter-panel-cell-disabled`]: cell.isDisabled,
|
|
1639
|
+
[`${prefixCls}-quarter-panel-selected-cell`]: cell.isSelected,
|
|
1640
|
+
[`${prefixCls}-in-range-cell`]: !!cell.isInRange,
|
|
1641
|
+
[`${prefixCls}-quarter-panel-current-cell`]: new TinyDate().getYear() === this.activeDate().getYear() && quarter.getQuarter() === new TinyDate().getQuarter()
|
|
1684
1642
|
};
|
|
1685
1643
|
}
|
|
1686
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: QuarterTable, deps:
|
|
1687
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: QuarterTable, isStandalone: true, selector: "quarter-table", exportAs: ["quarterTable"], usesInheritance: true, ngImport: i0, template: "<table class=\"{{
|
|
1644
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: QuarterTable, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1645
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: QuarterTable, isStandalone: true, selector: "quarter-table", exportAs: ["quarterTable"], usesInheritance: true, ngImport: i0, template: "@let prefixClass = prefixCls();\n<table class=\"{{ prefixClass }}-quarter-panel-table\" cellSpacing=\"0\" role=\"grid\">\n <tbody class=\"{{ prefixClass }}-quarter-panel-tbody\">\n @for (row of bodyRows; track trackByBodyRow($index, row)) {\n <tr role=\"row\">\n @for (quarterCell of row.dateCells; track trackByBodyColumn($index, quarterCell)) {\n <td\n role=\"gridcell\"\n title=\"{{ quarterCell.title }}\"\n (click)=\"quarterCellClick($event, quarterCell)\"\n [ngClass]=\"quarterCell.classMap\">\n <a class=\"{{ prefixClass }}-quarter-panel-quarter\">{{ quarterCell.content }}</a>\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1688
1646
|
}
|
|
1689
1647
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: QuarterTable, decorators: [{
|
|
1690
1648
|
type: Component,
|
|
1691
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'quarter-table', exportAs: 'quarterTable', imports: [NgClass], template: "<table class=\"{{
|
|
1692
|
-
}]
|
|
1649
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'quarter-table', exportAs: 'quarterTable', imports: [NgClass], template: "@let prefixClass = prefixCls();\n<table class=\"{{ prefixClass }}-quarter-panel-table\" cellSpacing=\"0\" role=\"grid\">\n <tbody class=\"{{ prefixClass }}-quarter-panel-tbody\">\n @for (row of bodyRows; track trackByBodyRow($index, row)) {\n <tr role=\"row\">\n @for (quarterCell of row.dateCells; track trackByBodyColumn($index, quarterCell)) {\n <td\n role=\"gridcell\"\n title=\"{{ quarterCell.title }}\"\n (click)=\"quarterCellClick($event, quarterCell)\"\n [ngClass]=\"quarterCell.classMap\">\n <a class=\"{{ prefixClass }}-quarter-panel-quarter\">{{ quarterCell.content }}</a>\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n" }]
|
|
1650
|
+
}] });
|
|
1693
1651
|
|
|
1694
1652
|
/**
|
|
1695
1653
|
* @private
|
|
1696
1654
|
*/
|
|
1697
1655
|
class YearHeader extends CalendarHeader {
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
return this.startYear + 9;
|
|
1656
|
+
constructor() {
|
|
1657
|
+
super(...arguments);
|
|
1658
|
+
this.startYear = computed(() => parseInt(`${this.value().getYear() / 10}`, 10) * 10);
|
|
1659
|
+
this.endYear = computed(() => this.startYear() + 9);
|
|
1703
1660
|
}
|
|
1704
1661
|
superPrevious() {
|
|
1705
|
-
this.
|
|
1662
|
+
const newValue = this.value().addYears(-10);
|
|
1663
|
+
this.changeValue(newValue);
|
|
1706
1664
|
}
|
|
1707
1665
|
superNext() {
|
|
1708
|
-
this.
|
|
1666
|
+
const newValue = this.value().addYears(10);
|
|
1667
|
+
this.changeValue(newValue);
|
|
1709
1668
|
}
|
|
1710
1669
|
getSelectors() {
|
|
1711
1670
|
return [
|
|
@@ -1713,16 +1672,16 @@ class YearHeader extends CalendarHeader {
|
|
|
1713
1672
|
className: `${this.prefixCls}-year-btn`,
|
|
1714
1673
|
title: '',
|
|
1715
1674
|
onClick: () => this.changePanel('decade'),
|
|
1716
|
-
label: `${this.startYear}-${this.endYear}`
|
|
1675
|
+
label: `${this.startYear()}-${this.endYear()}`
|
|
1717
1676
|
}
|
|
1718
1677
|
];
|
|
1719
1678
|
}
|
|
1720
1679
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: YearHeader, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1721
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: YearHeader, isStandalone: true, selector: "year-header", usesInheritance: true, ngImport: i0, template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1680
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: YearHeader, isStandalone: true, selector: "year-header", usesInheritance: true, ngImport: i0, template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1722
1681
|
}
|
|
1723
1682
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: YearHeader, decorators: [{
|
|
1724
1683
|
type: Component,
|
|
1725
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'year-header', imports: [NgClass, ThyIcon], template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n" }]
|
|
1684
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'year-header', imports: [NgClass, ThyIcon], template: "<div class=\"{{ prefixCls }}-header\">\n <div style=\"position: relative\">\n <a\n class=\"{{ prefixCls }}-prev-year-btn\"\n [ngClass]=\"showSuperPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superPrevious()\"\n [title]=\"locale().previousYear\">\n <thy-icon thyIconName=\"angle-double-left\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-prev-month-btn\"\n [ngClass]=\"showPreBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"previous()\"\n [title]=\"locale().previousMonth\">\n <thy-icon thyIconName=\"angle-left\"></thy-icon>\n </a>\n\n <span class=\"{{ prefixCls }}-my-select\">\n @for (selector of selectors; track $index) {\n <a class=\"{{ selector.className }}\" role=\"button\" (click)=\"selectorClick($event, selector)\" title=\"{{ selector.title || null }}\">\n {{ selector.label }}\n </a>\n }\n </span>\n\n <a\n class=\"{{ prefixCls }}-next-month-btn\"\n [ngClass]=\"showNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"next()\"\n [title]=\"locale().nextMonth\">\n <thy-icon thyIconName=\"angle-right\"></thy-icon>\n </a>\n <a\n class=\"{{ prefixCls }}-next-year-btn\"\n [ngClass]=\"showSuperNextBtn() ? 'd-block' : 'd-none'\"\n role=\"button\"\n (click)=\"superNext()\"\n [title]=\"locale().nextYear\">\n <thy-icon thyIconName=\"angle-double-right\"></thy-icon>\n </a>\n </div>\n</div>\n" }]
|
|
1726
1685
|
}] });
|
|
1727
1686
|
|
|
1728
1687
|
/**
|
|
@@ -1730,14 +1689,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
1730
1689
|
*/
|
|
1731
1690
|
class YearTable extends CalendarTable {
|
|
1732
1691
|
constructor() {
|
|
1733
|
-
super();
|
|
1692
|
+
super(...arguments);
|
|
1734
1693
|
this.MAX_ROW = 4;
|
|
1735
1694
|
this.MAX_COL = 3;
|
|
1736
|
-
this.decadePanelShow =
|
|
1695
|
+
this.decadePanelShow = output();
|
|
1737
1696
|
}
|
|
1738
1697
|
chooseYear(year) {
|
|
1739
|
-
|
|
1740
|
-
this.
|
|
1698
|
+
const newValue = this.activeDate().setYear(year);
|
|
1699
|
+
this.value.set(newValue);
|
|
1700
|
+
this.valueChange.emit(newValue);
|
|
1741
1701
|
this.render();
|
|
1742
1702
|
}
|
|
1743
1703
|
makeHeadRow() {
|
|
@@ -1745,7 +1705,8 @@ class YearTable extends CalendarTable {
|
|
|
1745
1705
|
}
|
|
1746
1706
|
makeBodyRows() {
|
|
1747
1707
|
const years = [];
|
|
1748
|
-
const
|
|
1708
|
+
const activeDate = this.activeDate();
|
|
1709
|
+
const currentYear = activeDate && activeDate.getYear();
|
|
1749
1710
|
const startYear = parseInt(`${currentYear / 10}`, 10) * 10;
|
|
1750
1711
|
const endYear = startYear + 9;
|
|
1751
1712
|
const previousYear = startYear - 1;
|
|
@@ -1757,16 +1718,18 @@ class YearTable extends CalendarTable {
|
|
|
1757
1718
|
};
|
|
1758
1719
|
for (let colIndex = 0; colIndex < this.MAX_COL; colIndex++) {
|
|
1759
1720
|
const yearNum = previousYear + yearValue;
|
|
1760
|
-
const year =
|
|
1721
|
+
const year = activeDate.setYear(yearNum);
|
|
1761
1722
|
const content = String(yearNum);
|
|
1762
|
-
const
|
|
1723
|
+
const disabledDate = this.disabledDate();
|
|
1724
|
+
const isDisabled = disabledDate ? disabledDate(year.nativeDate) : false;
|
|
1725
|
+
const value = this.value();
|
|
1763
1726
|
const cell = {
|
|
1764
1727
|
trackByIndex: colIndex,
|
|
1765
1728
|
isDisabled,
|
|
1766
1729
|
content,
|
|
1767
1730
|
value: year.nativeDate,
|
|
1768
1731
|
title: content,
|
|
1769
|
-
isSelected: yearNum === (
|
|
1732
|
+
isSelected: yearNum === (value && value.getYear()),
|
|
1770
1733
|
isSameDecade: yearNum >= startYear && yearNum <= endYear,
|
|
1771
1734
|
classMap: {},
|
|
1772
1735
|
onClick: () => this.chooseYear(cell.value?.getFullYear()),
|
|
@@ -1781,8 +1744,9 @@ class YearTable extends CalendarTable {
|
|
|
1781
1744
|
return years;
|
|
1782
1745
|
}
|
|
1783
1746
|
addCellProperty(cell, year) {
|
|
1784
|
-
|
|
1785
|
-
|
|
1747
|
+
const selectedValue = this.selectedValue();
|
|
1748
|
+
if (selectedValue?.length > 0) {
|
|
1749
|
+
const [startSelected, endSelected] = selectedValue;
|
|
1786
1750
|
if (startSelected?.isSameYear(year)) {
|
|
1787
1751
|
cell.isSelected = true;
|
|
1788
1752
|
}
|
|
@@ -1793,7 +1757,7 @@ class YearTable extends CalendarTable {
|
|
|
1793
1757
|
cell.isEndSingle = !startSelected && !!endSelected;
|
|
1794
1758
|
cell.isInRange = startSelected?.isBeforeYear(year) && year?.isBeforeYear(endSelected);
|
|
1795
1759
|
}
|
|
1796
|
-
else if (year.isSameYear(this.value)) {
|
|
1760
|
+
else if (year.isSameYear(this.value())) {
|
|
1797
1761
|
cell.isSelected = true;
|
|
1798
1762
|
}
|
|
1799
1763
|
cell.classMap = this.getClassMap(cell);
|
|
@@ -1803,23 +1767,22 @@ class YearTable extends CalendarTable {
|
|
|
1803
1767
|
return yearCell.isDisabled ? null : yearCell.onClick();
|
|
1804
1768
|
}
|
|
1805
1769
|
getClassMap(cell) {
|
|
1770
|
+
const prefixCls = this.prefixCls();
|
|
1806
1771
|
return {
|
|
1807
|
-
[`${
|
|
1808
|
-
[`${
|
|
1809
|
-
[`${
|
|
1810
|
-
[`${
|
|
1811
|
-
[`${
|
|
1772
|
+
[`${prefixCls}-year-panel-cell`]: true,
|
|
1773
|
+
[`${prefixCls}-year-panel-selected-cell`]: cell.isSelected,
|
|
1774
|
+
[`${prefixCls}-year-panel-cell-disabled`]: cell.isDisabled,
|
|
1775
|
+
[`${prefixCls}-year-panel-cell-in-view`]: cell.isSameDecade,
|
|
1776
|
+
[`${prefixCls}-in-range-cell`]: !!cell.isInRange
|
|
1812
1777
|
};
|
|
1813
1778
|
}
|
|
1814
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: YearTable, deps:
|
|
1815
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: YearTable, isStandalone: true, selector: "year-table", outputs: { decadePanelShow: "decadePanelShow" }, usesInheritance: true, ngImport: i0, template: "<table class=\"{{
|
|
1779
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: YearTable, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1780
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: YearTable, isStandalone: true, selector: "year-table", outputs: { decadePanelShow: "decadePanelShow" }, usesInheritance: true, ngImport: i0, template: "@let prefixClass = prefixCls();\n<table class=\"{{ prefixClass }}-year-panel-table\" cellSpacing=\"0\" role=\"grid\">\n <tbody class=\"{{ prefixClass }}-year-panel-tbody\">\n @for (row of bodyRows; track trackByBodyRow($index, row)) {\n <tr role=\"row\">\n @for (yearCell of row.dateCells; track trackByBodyColumn($index, yearCell)) {\n <td role=\"gridcell\" title=\"{{ yearCell.title }}\" (click)=\"yearCellClick($event, yearCell)\" [ngClass]=\"yearCell.classMap\">\n <a class=\"{{ prefixClass }}-year-panel-year\">{{ yearCell.content }}</a>\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1816
1781
|
}
|
|
1817
1782
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: YearTable, decorators: [{
|
|
1818
1783
|
type: Component,
|
|
1819
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'year-table', imports: [NgClass], template: "<table class=\"{{
|
|
1820
|
-
}]
|
|
1821
|
-
type: Output
|
|
1822
|
-
}] } });
|
|
1784
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'year-table', imports: [NgClass], template: "@let prefixClass = prefixCls();\n<table class=\"{{ prefixClass }}-year-panel-table\" cellSpacing=\"0\" role=\"grid\">\n <tbody class=\"{{ prefixClass }}-year-panel-tbody\">\n @for (row of bodyRows; track trackByBodyRow($index, row)) {\n <tr role=\"row\">\n @for (yearCell of row.dateCells; track trackByBodyColumn($index, yearCell)) {\n <td role=\"gridcell\" title=\"{{ yearCell.title }}\" (click)=\"yearCellClick($event, yearCell)\" [ngClass]=\"yearCell.classMap\">\n <a class=\"{{ prefixClass }}-year-panel-year\">{{ yearCell.content }}</a>\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n" }]
|
|
1785
|
+
}] });
|
|
1823
1786
|
|
|
1824
1787
|
/**
|
|
1825
1788
|
* @private
|
|
@@ -1828,72 +1791,90 @@ class InnerPopup {
|
|
|
1828
1791
|
constructor() {
|
|
1829
1792
|
this.dateHelper = inject(DateHelperService);
|
|
1830
1793
|
this.locale = injectLocale('datePicker');
|
|
1831
|
-
this.
|
|
1832
|
-
this.
|
|
1833
|
-
this.
|
|
1834
|
-
this.
|
|
1835
|
-
this.
|
|
1836
|
-
this.
|
|
1794
|
+
this.showWeek = input(false, { transform: coerceBooleanProperty });
|
|
1795
|
+
this.isRange = input(false, { transform: coerceBooleanProperty });
|
|
1796
|
+
this.activeDate = model();
|
|
1797
|
+
this.rangeActiveDate = input(); // Range ONLY
|
|
1798
|
+
this.disabledDate = input();
|
|
1799
|
+
this.dateRender = input();
|
|
1800
|
+
this.selectedValue = input(); // Range ONLY
|
|
1801
|
+
this.hoverValue = input(); // Range ONLY
|
|
1802
|
+
this.panelMode = input(null, {
|
|
1803
|
+
transform: (value) => {
|
|
1804
|
+
if (value === 'time') {
|
|
1805
|
+
return 'date';
|
|
1806
|
+
}
|
|
1807
|
+
return value;
|
|
1808
|
+
}
|
|
1809
|
+
});
|
|
1810
|
+
this.timeZone = input();
|
|
1811
|
+
this.showDateRangeInput = input(false, { transform: coerceBooleanProperty });
|
|
1812
|
+
this.partType = input();
|
|
1813
|
+
this.endPanelMode = input();
|
|
1814
|
+
this.value = model();
|
|
1815
|
+
this.panelModeChange = output();
|
|
1816
|
+
this.headerChange = output();
|
|
1817
|
+
this.selectDate = output();
|
|
1818
|
+
this.dayHover = output();
|
|
1837
1819
|
this.prefixCls = 'thy-calendar';
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
return this._showDateRangeInput;
|
|
1844
|
-
}
|
|
1845
|
-
ngOnChanges(changes) {
|
|
1846
|
-
if (changes.activeDate && !changes.activeDate.currentValue) {
|
|
1847
|
-
this.activeDate = new TinyDate(undefined, this.timeZone);
|
|
1848
|
-
}
|
|
1849
|
-
if (changes.panelMode && changes.panelMode.currentValue === 'time') {
|
|
1850
|
-
this.panelMode = 'date';
|
|
1851
|
-
}
|
|
1820
|
+
effect(() => {
|
|
1821
|
+
if (!this.activeDate()) {
|
|
1822
|
+
this.activeDate.set(new TinyDate(undefined, this.timeZone()));
|
|
1823
|
+
}
|
|
1824
|
+
});
|
|
1852
1825
|
}
|
|
1853
1826
|
getReadableValue(value) {
|
|
1854
1827
|
return value ? this.dateHelper.format(value.nativeDate, 'yyyy-MM-dd') : '';
|
|
1855
1828
|
}
|
|
1856
1829
|
onSelectDate(date) {
|
|
1857
|
-
const value = date instanceof TinyDate ? date : new TinyDate(date, this.timeZone);
|
|
1830
|
+
const value = date instanceof TinyDate ? date : new TinyDate(date, this.timeZone());
|
|
1858
1831
|
this.selectDate.emit(value);
|
|
1859
1832
|
}
|
|
1860
1833
|
onChooseMonth(value) {
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1834
|
+
const activeDate = this.activeDate().setMonth(value.getMonth());
|
|
1835
|
+
const endPanelMode = this.endPanelMode();
|
|
1836
|
+
this.activeDate.set(activeDate);
|
|
1837
|
+
if (endPanelMode === 'month') {
|
|
1838
|
+
this.value.set(value);
|
|
1864
1839
|
this.selectDate.emit(value);
|
|
1865
1840
|
}
|
|
1866
1841
|
else {
|
|
1867
1842
|
this.headerChange.emit(value);
|
|
1868
|
-
this.panelModeChange.emit(
|
|
1843
|
+
this.panelModeChange.emit(endPanelMode);
|
|
1869
1844
|
}
|
|
1870
1845
|
}
|
|
1871
1846
|
onChooseQuarter(value) {
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1847
|
+
const activeDate = this.activeDate().setQuarter(value.getQuarter());
|
|
1848
|
+
const endPanelMode = this.endPanelMode();
|
|
1849
|
+
this.activeDate.set(activeDate);
|
|
1850
|
+
if (endPanelMode === 'quarter') {
|
|
1851
|
+
this.value.set(value);
|
|
1875
1852
|
this.selectDate.emit(value);
|
|
1876
1853
|
}
|
|
1877
1854
|
else {
|
|
1878
1855
|
this.headerChange.emit(value);
|
|
1879
|
-
this.panelModeChange.emit(
|
|
1856
|
+
this.panelModeChange.emit(endPanelMode);
|
|
1880
1857
|
}
|
|
1881
1858
|
}
|
|
1882
1859
|
onChooseYear(value) {
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1860
|
+
const activeDate = this.activeDate().setYear(value.getYear());
|
|
1861
|
+
const endPanelMode = this.endPanelMode();
|
|
1862
|
+
this.activeDate.set(activeDate);
|
|
1863
|
+
if (endPanelMode === 'year') {
|
|
1864
|
+
this.value.set(value);
|
|
1886
1865
|
this.selectDate.emit(value);
|
|
1887
1866
|
}
|
|
1888
1867
|
else {
|
|
1889
1868
|
this.headerChange.emit(value);
|
|
1890
|
-
this.panelModeChange.emit(
|
|
1869
|
+
this.panelModeChange.emit(endPanelMode);
|
|
1891
1870
|
}
|
|
1892
1871
|
}
|
|
1893
1872
|
onChooseDecade(value) {
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1873
|
+
const activeDate = this.activeDate().setYear(value.getYear());
|
|
1874
|
+
const endPanelMode = this.endPanelMode();
|
|
1875
|
+
this.activeDate.set(activeDate);
|
|
1876
|
+
if (endPanelMode === 'decade') {
|
|
1877
|
+
this.value.set(value);
|
|
1897
1878
|
this.selectDate.emit(value);
|
|
1898
1879
|
}
|
|
1899
1880
|
else {
|
|
@@ -1902,9 +1883,10 @@ class InnerPopup {
|
|
|
1902
1883
|
}
|
|
1903
1884
|
}
|
|
1904
1885
|
enablePrevNext(direction, mode) {
|
|
1905
|
-
if (this.isRange) {
|
|
1906
|
-
|
|
1907
|
-
|
|
1886
|
+
if (this.isRange()) {
|
|
1887
|
+
const partType = this.partType();
|
|
1888
|
+
if ((partType === 'left' && direction === 'next') || (partType === 'right' && direction === 'prev')) {
|
|
1889
|
+
const [headerLeftDate, headerRightDate] = this.rangeActiveDate();
|
|
1908
1890
|
return isAfterMoreThanOneMonth(headerRightDate, headerLeftDate);
|
|
1909
1891
|
}
|
|
1910
1892
|
else {
|
|
@@ -1916,9 +1898,10 @@ class InnerPopup {
|
|
|
1916
1898
|
}
|
|
1917
1899
|
}
|
|
1918
1900
|
enableSuperPrevNext(direction, panelMode) {
|
|
1919
|
-
if (this.isRange) {
|
|
1920
|
-
|
|
1921
|
-
|
|
1901
|
+
if (this.isRange()) {
|
|
1902
|
+
const partType = this.partType();
|
|
1903
|
+
if ((partType === 'left' && direction === 'next') || (partType === 'right' && direction === 'prev')) {
|
|
1904
|
+
const [headerLeftDate, headerRightDate] = this.rangeActiveDate();
|
|
1922
1905
|
if (panelMode === 'date') {
|
|
1923
1906
|
return isAfterMoreThanLessOneYear(headerRightDate, headerLeftDate);
|
|
1924
1907
|
}
|
|
@@ -1938,7 +1921,7 @@ class InnerPopup {
|
|
|
1938
1921
|
}
|
|
1939
1922
|
}
|
|
1940
1923
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: InnerPopup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1941
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: InnerPopup, isStandalone: true, selector: "inner-popup", inputs: { showWeek: "showWeek", isRange: "isRange", activeDate: "activeDate", rangeActiveDate: "rangeActiveDate",
|
|
1924
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: InnerPopup, isStandalone: true, selector: "inner-popup", inputs: { showWeek: { classPropertyName: "showWeek", publicName: "showWeek", isSignal: true, isRequired: false, transformFunction: null }, isRange: { classPropertyName: "isRange", publicName: "isRange", isSignal: true, isRequired: false, transformFunction: null }, activeDate: { classPropertyName: "activeDate", publicName: "activeDate", isSignal: true, isRequired: false, transformFunction: null }, rangeActiveDate: { classPropertyName: "rangeActiveDate", publicName: "rangeActiveDate", isSignal: true, isRequired: false, transformFunction: null }, disabledDate: { classPropertyName: "disabledDate", publicName: "disabledDate", isSignal: true, isRequired: false, transformFunction: null }, dateRender: { classPropertyName: "dateRender", publicName: "dateRender", isSignal: true, isRequired: false, transformFunction: null }, selectedValue: { classPropertyName: "selectedValue", publicName: "selectedValue", isSignal: true, isRequired: false, transformFunction: null }, hoverValue: { classPropertyName: "hoverValue", publicName: "hoverValue", isSignal: true, isRequired: false, transformFunction: null }, panelMode: { classPropertyName: "panelMode", publicName: "panelMode", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null }, showDateRangeInput: { classPropertyName: "showDateRangeInput", publicName: "showDateRangeInput", isSignal: true, isRequired: false, transformFunction: null }, partType: { classPropertyName: "partType", publicName: "partType", isSignal: true, isRequired: false, transformFunction: null }, endPanelMode: { classPropertyName: "endPanelMode", publicName: "endPanelMode", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeDate: "activeDateChange", value: "valueChange", panelModeChange: "panelModeChange", headerChange: "headerChange", selectDate: "selectDate", dayHover: "dayHover" }, host: { properties: { "class.thy-calendar-picker-inner-popup-with-range-input": "showDateRangeInput()" }, classAttribute: "thy-calendar-picker-inner-popup" }, exportAs: ["innerPopup"], ngImport: i0, template: "@if (showDateRangeInput()) {\n <div class=\"{{ prefixCls }}-picker-inner-popup-range-input\">\n <input thyInput thySize=\"sm\" [value]=\"getReadableValue(selectedValue()[0])\" [placeholder]=\"locale().startDate\" />\n <span class=\"split\"></span>\n <input thyInput thySize=\"sm\" [value]=\"getReadableValue(selectedValue()[1])\" [placeholder]=\"locale().endDate\" />\n </div>\n}\n@switch (panelMode()) {\n @case ('decade') {\n <div class=\"{{ prefixCls }}-decade\">\n <decade-header\n [(value)]=\"activeDate\"\n [showSuperPreBtn]=\"enableSuperPrevNext('prev', 'decade')\"\n [showSuperNextBtn]=\"enableSuperPrevNext('next', 'decade')\"\n [showNextBtn]=\"false\"\n [showPreBtn]=\"false\"\n (panelModeChange)=\"panelModeChange.emit($event)\"\n (valueChange)=\"headerChange.emit($event)\">\n </decade-header>\n <div class=\"{{ prefixCls }}-body\">\n <decade-table [value]=\"value()\" [activeDate]=\"activeDate()\" (valueChange)=\"onChooseDecade($event)\"></decade-table>\n </div>\n </div>\n }\n @case ('year') {\n <div class=\"{{ prefixCls }}-year\">\n <year-header\n [(value)]=\"activeDate\"\n [showSuperPreBtn]=\"enableSuperPrevNext('prev', 'year')\"\n [showSuperNextBtn]=\"enableSuperPrevNext('next', 'year')\"\n [showNextBtn]=\"false\"\n [showPreBtn]=\"false\"\n (panelModeChange)=\"panelModeChange.emit($event)\"\n (valueChange)=\"headerChange.emit($event)\">\n </year-header>\n <div class=\"{{ prefixCls }}-body\">\n <year-table\n [value]=\"value()\"\n [activeDate]=\"activeDate()\"\n [disabledDate]=\"disabledDate()\"\n (valueChange)=\"onChooseYear($event)\"\n [selectedValue]=\"selectedValue()\">\n </year-table>\n </div>\n </div>\n }\n @case ('month') {\n <div class=\"{{ prefixCls }}-month\">\n <month-header\n [(value)]=\"activeDate\"\n [showSuperPreBtn]=\"enableSuperPrevNext('prev', 'month')\"\n [showSuperNextBtn]=\"enableSuperPrevNext('next', 'month')\"\n [showNextBtn]=\"false\"\n [showPreBtn]=\"false\"\n (panelModeChange)=\"panelModeChange.emit($event)\"\n (valueChange)=\"headerChange.emit($event)\">\n </month-header>\n <div class=\"{{ prefixCls }}-body\">\n <month-table\n [value]=\"value()\"\n [activeDate]=\"activeDate()\"\n [disabledDate]=\"disabledDate()\"\n (valueChange)=\"onChooseMonth($event)\"\n [selectedValue]=\"selectedValue()\">\n </month-table>\n </div>\n </div>\n }\n @case ('quarter') {\n <div class=\"{{ prefixCls }}-quarter\">\n <month-header\n [(value)]=\"activeDate\"\n [showSuperPreBtn]=\"enableSuperPrevNext('prev', 'month')\"\n [showSuperNextBtn]=\"enableSuperPrevNext('next', 'month')\"\n [showNextBtn]=\"false\"\n [showPreBtn]=\"false\"\n (panelModeChange)=\"panelModeChange.emit($event)\"\n (valueChange)=\"headerChange.emit($event)\">\n </month-header>\n <div class=\"{{ prefixCls }}-body\">\n <quarter-table\n [value]=\"value()\"\n [activeDate]=\"activeDate()\"\n [disabledDate]=\"disabledDate()\"\n (valueChange)=\"onChooseQuarter($event)\"\n [selectedValue]=\"selectedValue()\">\n </quarter-table>\n </div>\n </div>\n }\n @default {\n <date-header\n [(value)]=\"activeDate\"\n [showSuperPreBtn]=\"enableSuperPrevNext('prev', 'date')\"\n [showSuperNextBtn]=\"enableSuperPrevNext('next', 'date')\"\n [showPreBtn]=\"enablePrevNext('prev', 'date')\"\n [showNextBtn]=\"enablePrevNext('next', 'date')\"\n (panelModeChange)=\"panelModeChange.emit($event)\"\n (valueChange)=\"headerChange.emit($event)\"></date-header>\n <div class=\"{{ prefixCls }}-body\">\n <date-table\n [showWeek]=\"showWeek()\"\n [value]=\"value()\"\n [activeDate]=\"activeDate()\"\n (valueChange)=\"onSelectDate($event)\"\n showWeekNumber=\"false\"\n [disabledDate]=\"disabledDate()\"\n [cellRender]=\"dateRender()\"\n [selectedValue]=\"selectedValue()\"\n [hoverValue]=\"hoverValue()\"\n [timeZone]=\"timeZone()\"\n (dayHover)=\"dayHover.emit($event)\"></date-table>\n </div>\n }\n}\n", dependencies: [{ kind: "directive", type: ThyInputDirective, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: ["thySize"], exportAs: ["thyInput"] }, { kind: "component", type: DecadeHeader, selector: "decade-header" }, { kind: "component", type: DecadeTable, selector: "decade-table", exportAs: ["decadeTable"] }, { kind: "component", type: YearHeader, selector: "year-header" }, { kind: "component", type: YearTable, selector: "year-table", outputs: ["decadePanelShow"] }, { kind: "component", type: MonthHeader, selector: "month-header" }, { kind: "component", type: MonthTable, selector: "month-table", exportAs: ["monthTable"] }, { kind: "component", type: QuarterTable, selector: "quarter-table", exportAs: ["quarterTable"] }, { kind: "component", type: DateHeader, selector: "date-header" }, { kind: "component", type: DateTable, selector: "date-table", outputs: ["dayHover"], exportAs: ["dateTable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1942
1925
|
}
|
|
1943
1926
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: InnerPopup, decorators: [{
|
|
1944
1927
|
type: Component,
|
|
@@ -1953,55 +1936,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
1953
1936
|
QuarterTable,
|
|
1954
1937
|
DateHeader,
|
|
1955
1938
|
DateTable
|
|
1956
|
-
],
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
type: HostBinding,
|
|
1962
|
-
args: ['class.thy-calendar-picker-inner-popup-with-range-input']
|
|
1963
|
-
}], showWeek: [{
|
|
1964
|
-
type: Input
|
|
1965
|
-
}], isRange: [{
|
|
1966
|
-
type: Input
|
|
1967
|
-
}], activeDate: [{
|
|
1968
|
-
type: Input
|
|
1969
|
-
}], rangeActiveDate: [{
|
|
1970
|
-
type: Input
|
|
1971
|
-
}], enablePrev: [{
|
|
1972
|
-
type: Input
|
|
1973
|
-
}], enableNext: [{
|
|
1974
|
-
type: Input
|
|
1975
|
-
}], disabledDate: [{
|
|
1976
|
-
type: Input
|
|
1977
|
-
}], dateRender: [{
|
|
1978
|
-
type: Input
|
|
1979
|
-
}], selectedValue: [{
|
|
1980
|
-
type: Input
|
|
1981
|
-
}], hoverValue: [{
|
|
1982
|
-
type: Input
|
|
1983
|
-
}], panelMode: [{
|
|
1984
|
-
type: Input
|
|
1985
|
-
}], timeZone: [{
|
|
1986
|
-
type: Input
|
|
1987
|
-
}], showDateRangeInput: [{
|
|
1988
|
-
type: Input,
|
|
1989
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1990
|
-
}], partType: [{
|
|
1991
|
-
type: Input
|
|
1992
|
-
}], endPanelMode: [{
|
|
1993
|
-
type: Input
|
|
1994
|
-
}], panelModeChange: [{
|
|
1995
|
-
type: Output
|
|
1996
|
-
}], value: [{
|
|
1997
|
-
type: Input
|
|
1998
|
-
}], headerChange: [{
|
|
1999
|
-
type: Output
|
|
2000
|
-
}], selectDate: [{
|
|
2001
|
-
type: Output
|
|
2002
|
-
}], dayHover: [{
|
|
2003
|
-
type: Output
|
|
2004
|
-
}] } });
|
|
1939
|
+
], host: {
|
|
1940
|
+
class: 'thy-calendar-picker-inner-popup',
|
|
1941
|
+
'[class.thy-calendar-picker-inner-popup-with-range-input]': 'showDateRangeInput()'
|
|
1942
|
+
}, template: "@if (showDateRangeInput()) {\n <div class=\"{{ prefixCls }}-picker-inner-popup-range-input\">\n <input thyInput thySize=\"sm\" [value]=\"getReadableValue(selectedValue()[0])\" [placeholder]=\"locale().startDate\" />\n <span class=\"split\"></span>\n <input thyInput thySize=\"sm\" [value]=\"getReadableValue(selectedValue()[1])\" [placeholder]=\"locale().endDate\" />\n </div>\n}\n@switch (panelMode()) {\n @case ('decade') {\n <div class=\"{{ prefixCls }}-decade\">\n <decade-header\n [(value)]=\"activeDate\"\n [showSuperPreBtn]=\"enableSuperPrevNext('prev', 'decade')\"\n [showSuperNextBtn]=\"enableSuperPrevNext('next', 'decade')\"\n [showNextBtn]=\"false\"\n [showPreBtn]=\"false\"\n (panelModeChange)=\"panelModeChange.emit($event)\"\n (valueChange)=\"headerChange.emit($event)\">\n </decade-header>\n <div class=\"{{ prefixCls }}-body\">\n <decade-table [value]=\"value()\" [activeDate]=\"activeDate()\" (valueChange)=\"onChooseDecade($event)\"></decade-table>\n </div>\n </div>\n }\n @case ('year') {\n <div class=\"{{ prefixCls }}-year\">\n <year-header\n [(value)]=\"activeDate\"\n [showSuperPreBtn]=\"enableSuperPrevNext('prev', 'year')\"\n [showSuperNextBtn]=\"enableSuperPrevNext('next', 'year')\"\n [showNextBtn]=\"false\"\n [showPreBtn]=\"false\"\n (panelModeChange)=\"panelModeChange.emit($event)\"\n (valueChange)=\"headerChange.emit($event)\">\n </year-header>\n <div class=\"{{ prefixCls }}-body\">\n <year-table\n [value]=\"value()\"\n [activeDate]=\"activeDate()\"\n [disabledDate]=\"disabledDate()\"\n (valueChange)=\"onChooseYear($event)\"\n [selectedValue]=\"selectedValue()\">\n </year-table>\n </div>\n </div>\n }\n @case ('month') {\n <div class=\"{{ prefixCls }}-month\">\n <month-header\n [(value)]=\"activeDate\"\n [showSuperPreBtn]=\"enableSuperPrevNext('prev', 'month')\"\n [showSuperNextBtn]=\"enableSuperPrevNext('next', 'month')\"\n [showNextBtn]=\"false\"\n [showPreBtn]=\"false\"\n (panelModeChange)=\"panelModeChange.emit($event)\"\n (valueChange)=\"headerChange.emit($event)\">\n </month-header>\n <div class=\"{{ prefixCls }}-body\">\n <month-table\n [value]=\"value()\"\n [activeDate]=\"activeDate()\"\n [disabledDate]=\"disabledDate()\"\n (valueChange)=\"onChooseMonth($event)\"\n [selectedValue]=\"selectedValue()\">\n </month-table>\n </div>\n </div>\n }\n @case ('quarter') {\n <div class=\"{{ prefixCls }}-quarter\">\n <month-header\n [(value)]=\"activeDate\"\n [showSuperPreBtn]=\"enableSuperPrevNext('prev', 'month')\"\n [showSuperNextBtn]=\"enableSuperPrevNext('next', 'month')\"\n [showNextBtn]=\"false\"\n [showPreBtn]=\"false\"\n (panelModeChange)=\"panelModeChange.emit($event)\"\n (valueChange)=\"headerChange.emit($event)\">\n </month-header>\n <div class=\"{{ prefixCls }}-body\">\n <quarter-table\n [value]=\"value()\"\n [activeDate]=\"activeDate()\"\n [disabledDate]=\"disabledDate()\"\n (valueChange)=\"onChooseQuarter($event)\"\n [selectedValue]=\"selectedValue()\">\n </quarter-table>\n </div>\n </div>\n }\n @default {\n <date-header\n [(value)]=\"activeDate\"\n [showSuperPreBtn]=\"enableSuperPrevNext('prev', 'date')\"\n [showSuperNextBtn]=\"enableSuperPrevNext('next', 'date')\"\n [showPreBtn]=\"enablePrevNext('prev', 'date')\"\n [showNextBtn]=\"enablePrevNext('next', 'date')\"\n (panelModeChange)=\"panelModeChange.emit($event)\"\n (valueChange)=\"headerChange.emit($event)\"></date-header>\n <div class=\"{{ prefixCls }}-body\">\n <date-table\n [showWeek]=\"showWeek()\"\n [value]=\"value()\"\n [activeDate]=\"activeDate()\"\n (valueChange)=\"onSelectDate($event)\"\n showWeekNumber=\"false\"\n [disabledDate]=\"disabledDate()\"\n [cellRender]=\"dateRender()\"\n [selectedValue]=\"selectedValue()\"\n [hoverValue]=\"hoverValue()\"\n [timeZone]=\"timeZone()\"\n (dayHover)=\"dayHover.emit($event)\"></date-table>\n </div>\n }\n}\n" }]
|
|
1943
|
+
}], ctorParameters: () => [] });
|
|
2005
1944
|
|
|
2006
1945
|
/**
|
|
2007
1946
|
* @private
|
|
@@ -2011,22 +1950,47 @@ class DatePopup {
|
|
|
2011
1950
|
this.cdr = inject(ChangeDetectorRef);
|
|
2012
1951
|
this.datePickerConfigService = inject(ThyDatePickerConfigService);
|
|
2013
1952
|
this.locale = injectLocale('datePicker');
|
|
2014
|
-
this.
|
|
2015
|
-
this.
|
|
2016
|
-
this.
|
|
2017
|
-
this.
|
|
2018
|
-
this.
|
|
2019
|
-
this.
|
|
1953
|
+
this.isRange = input(false, { transform: coerceBooleanProperty });
|
|
1954
|
+
this.showWeek = input(false, { transform: coerceBooleanProperty });
|
|
1955
|
+
this.format = input();
|
|
1956
|
+
this.disabledDate = model();
|
|
1957
|
+
this.minDate = input();
|
|
1958
|
+
this.maxDate = input();
|
|
1959
|
+
this.showToday = input(false, { transform: coerceBooleanProperty });
|
|
1960
|
+
/**
|
|
1961
|
+
* 是否支持设置时间(时、分)
|
|
1962
|
+
*/
|
|
1963
|
+
this.showTime = input();
|
|
1964
|
+
/**
|
|
1965
|
+
* 是否展示时间(时、分)
|
|
1966
|
+
*/
|
|
1967
|
+
this.mustShowTime = input(false, { transform: coerceBooleanProperty });
|
|
1968
|
+
this.dateRender = input();
|
|
1969
|
+
this.className = input();
|
|
1970
|
+
this.panelMode = model(undefined);
|
|
1971
|
+
this.value = model();
|
|
1972
|
+
this.defaultPickerValue = input();
|
|
1973
|
+
this.showShortcut = model();
|
|
1974
|
+
this.shortcutPresets = model();
|
|
1975
|
+
this.shortcutPosition = input();
|
|
1976
|
+
this.flexible = input(false, { transform: coerceBooleanProperty });
|
|
1977
|
+
this.flexibleDateGranularity = model();
|
|
1978
|
+
this.timestampPrecision = input();
|
|
1979
|
+
this.timeZone = input();
|
|
1980
|
+
this.panelModeChange = output();
|
|
1981
|
+
this.calendarChange = output();
|
|
1982
|
+
this.valueChange = output();
|
|
1983
|
+
this.resultOk = output(); // Emitted when done with date selecting
|
|
1984
|
+
this.showTimePickerChange = output();
|
|
1985
|
+
this.dateValueChange = output();
|
|
2020
1986
|
this.prefixCls = 'thy-calendar';
|
|
2021
1987
|
this.showTimePicker = false;
|
|
2022
1988
|
this.selectedValue = []; // Range ONLY
|
|
2023
1989
|
this.hoverValue = []; // Range ONLY
|
|
2024
1990
|
this.flexibleActiveTab = 'advanced';
|
|
2025
1991
|
this.partTypeMap = { left: 0, right: 1 };
|
|
2026
|
-
this.
|
|
2027
|
-
|
|
2028
|
-
get hasTimePicker() {
|
|
2029
|
-
return !!this.showTime;
|
|
1992
|
+
this.endPanelMode = signal(undefined);
|
|
1993
|
+
this.disableTimeConfirm = signal(false);
|
|
2030
1994
|
}
|
|
2031
1995
|
setProperty(key, value) {
|
|
2032
1996
|
this[key] = value;
|
|
@@ -2035,26 +1999,30 @@ class DatePopup {
|
|
|
2035
1999
|
ngOnInit() {
|
|
2036
2000
|
this.initShortcutPresets();
|
|
2037
2001
|
this.initPanelMode();
|
|
2038
|
-
if (this.flexible && this.flexibleDateGranularity === 'day') {
|
|
2002
|
+
if (this.flexible() && this.flexibleDateGranularity() === 'day') {
|
|
2039
2003
|
this.flexibleActiveTab = 'custom';
|
|
2040
2004
|
}
|
|
2041
|
-
if (this.defaultPickerValue && !hasValue(this.value)) {
|
|
2042
|
-
const { value } = transformDateValue(this.defaultPickerValue);
|
|
2043
|
-
this.value
|
|
2005
|
+
if (this.defaultPickerValue() && !hasValue(this.value())) {
|
|
2006
|
+
const { value } = transformDateValue(this.defaultPickerValue());
|
|
2007
|
+
this.value.set(makeValue(value, this.isRange(), this.timeZone()));
|
|
2044
2008
|
}
|
|
2045
2009
|
this.updateActiveDate();
|
|
2046
2010
|
this.initDisabledDate();
|
|
2047
|
-
if (this.isRange && this.flexible && this.value) {
|
|
2048
|
-
this.advancedSelectedValue = {
|
|
2011
|
+
if (this.isRange() && this.flexible() && this.value()) {
|
|
2012
|
+
this.advancedSelectedValue = {
|
|
2013
|
+
begin: this.value()[0],
|
|
2014
|
+
end: this.value()[1],
|
|
2015
|
+
dateGranularity: this.flexibleDateGranularity()
|
|
2016
|
+
};
|
|
2049
2017
|
}
|
|
2050
2018
|
}
|
|
2051
2019
|
ngOnChanges(changes) {
|
|
2052
2020
|
if (changes.panelMode) {
|
|
2053
|
-
if (helpers.isArray(this.panelMode)) {
|
|
2054
|
-
this.endPanelMode
|
|
2021
|
+
if (helpers.isArray(this.panelMode())) {
|
|
2022
|
+
this.endPanelMode.set([...this.panelMode()]);
|
|
2055
2023
|
}
|
|
2056
2024
|
else {
|
|
2057
|
-
this.endPanelMode
|
|
2025
|
+
this.endPanelMode.set(this.panelMode());
|
|
2058
2026
|
}
|
|
2059
2027
|
}
|
|
2060
2028
|
if (changes.defaultPickerValue) {
|
|
@@ -2066,26 +2034,27 @@ class DatePopup {
|
|
|
2066
2034
|
}
|
|
2067
2035
|
initShortcutPresets() {
|
|
2068
2036
|
const { shortcutRangesPresets, shortcutDatePresets, showShortcut } = this.datePickerConfigService;
|
|
2069
|
-
this.showShortcut
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2037
|
+
this.showShortcut.set(['date', 'date,date'].includes(this.panelMode().toString()) && isUndefinedOrNull(this.showShortcut())
|
|
2038
|
+
? showShortcut
|
|
2039
|
+
: this.showShortcut());
|
|
2040
|
+
if (this.showShortcut()) {
|
|
2041
|
+
if (!this.shortcutPresets()) {
|
|
2042
|
+
this.shortcutPresets.set(this.isRange() ? shortcutRangesPresets : shortcutDatePresets);
|
|
2043
|
+
}
|
|
2044
|
+
this.innerShortcutPresets = isFunction(this.shortcutPresets())
|
|
2045
|
+
? this.shortcutPresets()()
|
|
2046
|
+
: this.shortcutPresets();
|
|
2078
2047
|
if (this.innerShortcutPresets.length) {
|
|
2079
2048
|
const minDate = this.getMinTinyDate();
|
|
2080
2049
|
const maxDate = this.getMaxTinyDate();
|
|
2081
2050
|
const minTime = minDate ? minDate.getTime() : null;
|
|
2082
2051
|
const maxTime = maxDate ? maxDate.getTime() : null;
|
|
2083
|
-
if (this.isRange) {
|
|
2052
|
+
if (this.isRange()) {
|
|
2084
2053
|
this.innerShortcutPresets.forEach((preset) => {
|
|
2085
2054
|
const begin = getShortcutValue(preset.value[0]);
|
|
2086
|
-
const beginTime = new TinyDate(startOfDay(begin), this.timeZone).getTime();
|
|
2055
|
+
const beginTime = new TinyDate(startOfDay(begin), this.timeZone()).getTime();
|
|
2087
2056
|
const end = getShortcutValue(preset.value[1]);
|
|
2088
|
-
const endTime = new TinyDate(endOfDay(end), this.timeZone).getTime();
|
|
2057
|
+
const endTime = new TinyDate(endOfDay(end), this.timeZone()).getTime();
|
|
2089
2058
|
if ((minDate && endTime < minTime) || (maxDate && beginTime > maxTime)) {
|
|
2090
2059
|
preset.disabled = true;
|
|
2091
2060
|
}
|
|
@@ -2097,7 +2066,7 @@ class DatePopup {
|
|
|
2097
2066
|
else {
|
|
2098
2067
|
this.innerShortcutPresets.forEach((preset) => {
|
|
2099
2068
|
const singleValue = getShortcutValue(preset.value);
|
|
2100
|
-
const singleTime = new TinyDate(singleValue, this.timeZone).getTime();
|
|
2069
|
+
const singleTime = new TinyDate(singleValue, this.timeZone()).getTime();
|
|
2101
2070
|
if ((minDate && singleTime < minTime) || (maxDate && singleTime > maxTime)) {
|
|
2102
2071
|
preset.disabled = true;
|
|
2103
2072
|
}
|
|
@@ -2111,36 +2080,36 @@ class DatePopup {
|
|
|
2111
2080
|
}
|
|
2112
2081
|
updateActiveDate() {
|
|
2113
2082
|
this.clearHoverValue();
|
|
2114
|
-
if (!this.value) {
|
|
2115
|
-
const { value } = transformDateValue(this.defaultPickerValue);
|
|
2116
|
-
this.value
|
|
2083
|
+
if (!this.value()) {
|
|
2084
|
+
const { value } = transformDateValue(this.defaultPickerValue());
|
|
2085
|
+
this.value.set(makeValue(value, this.isRange(), this.timeZone()));
|
|
2117
2086
|
}
|
|
2118
|
-
if (this.isRange) {
|
|
2119
|
-
if (!this.flexible || this.flexibleDateGranularity === 'day') {
|
|
2120
|
-
this.selectedValue = this.value;
|
|
2087
|
+
if (this.isRange()) {
|
|
2088
|
+
if (!this.flexible() || this.flexibleDateGranularity() === 'day') {
|
|
2089
|
+
this.selectedValue = this.value();
|
|
2121
2090
|
}
|
|
2122
|
-
this.activeDate = this.normalizeRangeValue(this.value, this.getPanelMode(this.endPanelMode));
|
|
2091
|
+
this.activeDate = this.normalizeRangeValue(this.value(), this.getPanelMode(this.endPanelMode()));
|
|
2123
2092
|
}
|
|
2124
2093
|
else {
|
|
2125
|
-
this.activeDate = this.value;
|
|
2094
|
+
this.activeDate = this.value();
|
|
2126
2095
|
}
|
|
2127
2096
|
this.isDisableTimeConfirm();
|
|
2128
2097
|
}
|
|
2129
2098
|
initPanelMode() {
|
|
2130
|
-
if (!this.endPanelMode) {
|
|
2131
|
-
if (helpers.isArray(this.panelMode)) {
|
|
2132
|
-
this.endPanelMode
|
|
2099
|
+
if (!this.endPanelMode()) {
|
|
2100
|
+
if (helpers.isArray(this.panelMode())) {
|
|
2101
|
+
this.endPanelMode.set([...this.panelMode()]);
|
|
2133
2102
|
}
|
|
2134
2103
|
else {
|
|
2135
|
-
this.endPanelMode
|
|
2104
|
+
this.endPanelMode.set(this.panelMode());
|
|
2136
2105
|
}
|
|
2137
2106
|
}
|
|
2138
2107
|
else {
|
|
2139
|
-
if (helpers.isArray(this.endPanelMode)) {
|
|
2140
|
-
this.panelMode
|
|
2108
|
+
if (helpers.isArray(this.endPanelMode())) {
|
|
2109
|
+
this.panelMode.set([...this.endPanelMode()]);
|
|
2141
2110
|
}
|
|
2142
2111
|
else {
|
|
2143
|
-
this.panelMode
|
|
2112
|
+
this.panelMode.set(this.endPanelMode());
|
|
2144
2113
|
}
|
|
2145
2114
|
}
|
|
2146
2115
|
}
|
|
@@ -2148,18 +2117,18 @@ class DatePopup {
|
|
|
2148
2117
|
let minDate;
|
|
2149
2118
|
let maxDate;
|
|
2150
2119
|
let disabledDateFn;
|
|
2151
|
-
if (this.minDate) {
|
|
2152
|
-
const { value } = transformDateValue(this.minDate);
|
|
2153
|
-
minDate = new TinyDate(value, this.timeZone);
|
|
2120
|
+
if (this.minDate()) {
|
|
2121
|
+
const { value } = transformDateValue(this.minDate());
|
|
2122
|
+
minDate = new TinyDate(value, this.timeZone());
|
|
2154
2123
|
}
|
|
2155
|
-
if (this.maxDate) {
|
|
2156
|
-
const { value } = transformDateValue(this.maxDate);
|
|
2157
|
-
maxDate = new TinyDate(value, this.timeZone);
|
|
2124
|
+
if (this.maxDate()) {
|
|
2125
|
+
const { value } = transformDateValue(this.maxDate());
|
|
2126
|
+
maxDate = new TinyDate(value, this.timeZone());
|
|
2158
2127
|
}
|
|
2159
|
-
if (this.disabledDate) {
|
|
2160
|
-
disabledDateFn = this.disabledDate;
|
|
2128
|
+
if (this.disabledDate()) {
|
|
2129
|
+
disabledDateFn = this.disabledDate();
|
|
2161
2130
|
}
|
|
2162
|
-
this.disabledDate
|
|
2131
|
+
this.disabledDate.set(d => {
|
|
2163
2132
|
let expression = false;
|
|
2164
2133
|
if (minDate) {
|
|
2165
2134
|
expression = d < minDate.startOfDay().nativeDate;
|
|
@@ -2171,23 +2140,23 @@ class DatePopup {
|
|
|
2171
2140
|
expression = disabledDateFn(d);
|
|
2172
2141
|
}
|
|
2173
2142
|
return expression;
|
|
2174
|
-
};
|
|
2143
|
+
});
|
|
2175
2144
|
}
|
|
2176
2145
|
onShowTimePickerChange(show) {
|
|
2177
2146
|
this.showTimePicker = show;
|
|
2178
2147
|
this.showTimePickerChange.emit(show);
|
|
2179
2148
|
}
|
|
2180
2149
|
onClickOk() {
|
|
2181
|
-
this.setValue(this.value);
|
|
2182
|
-
this.valueChange.emit(this.value);
|
|
2150
|
+
this.setValue(this.value());
|
|
2151
|
+
this.valueChange.emit(this.value());
|
|
2183
2152
|
this.resultOk.emit();
|
|
2184
2153
|
}
|
|
2185
2154
|
onClickRemove() {
|
|
2186
|
-
this.value
|
|
2187
|
-
this.valueChange.emit(this.value);
|
|
2155
|
+
this.value.set(this.isRange() ? [] : null);
|
|
2156
|
+
this.valueChange.emit(this.value());
|
|
2188
2157
|
}
|
|
2189
2158
|
onDayHover(value) {
|
|
2190
|
-
if (this.isRange && this.selectedValue[0] && !this.selectedValue[1]) {
|
|
2159
|
+
if (this.isRange() && this.selectedValue[0] && !this.selectedValue[1]) {
|
|
2191
2160
|
// When right value is selected, don't do hover
|
|
2192
2161
|
const base = this.selectedValue[0]; // Use the left of selected value as the base to decide later hoverValue
|
|
2193
2162
|
if (base.isBeforeDay(value)) {
|
|
@@ -2199,43 +2168,43 @@ class DatePopup {
|
|
|
2199
2168
|
}
|
|
2200
2169
|
}
|
|
2201
2170
|
onPanelModeChange(mode, partType) {
|
|
2202
|
-
if (this.isRange) {
|
|
2203
|
-
this.panelMode[this.getPartTypeIndex(partType)] = mode;
|
|
2171
|
+
if (this.isRange()) {
|
|
2172
|
+
this.panelMode()[this.getPartTypeIndex(partType)] = mode;
|
|
2204
2173
|
}
|
|
2205
2174
|
else {
|
|
2206
|
-
this.panelMode
|
|
2175
|
+
this.panelMode.set(mode);
|
|
2207
2176
|
}
|
|
2208
|
-
this.panelModeChange.emit(this.panelMode);
|
|
2177
|
+
this.panelModeChange.emit(this.panelMode());
|
|
2209
2178
|
}
|
|
2210
2179
|
onHeaderChange(value, partType) {
|
|
2211
|
-
if (this.isRange) {
|
|
2180
|
+
if (this.isRange()) {
|
|
2212
2181
|
this.activeDate[this.getPartTypeIndex(partType)] = value;
|
|
2213
|
-
this.activeDate = this.normalizeRangeValue(this.activeDate, this.getPanelMode(this.endPanelMode, partType));
|
|
2182
|
+
this.activeDate = this.normalizeRangeValue(this.activeDate, this.getPanelMode(this.endPanelMode(), partType));
|
|
2214
2183
|
}
|
|
2215
2184
|
else {
|
|
2216
2185
|
this.activeDate = value;
|
|
2217
2186
|
}
|
|
2218
2187
|
}
|
|
2219
2188
|
onSelectTime(value, partType) {
|
|
2220
|
-
if (this.isRange) {
|
|
2189
|
+
if (this.isRange()) {
|
|
2221
2190
|
// TODO:range picker set time
|
|
2222
2191
|
}
|
|
2223
2192
|
else {
|
|
2224
|
-
this.setValue(new TinyDate(value.nativeDate, this.timeZone));
|
|
2193
|
+
this.setValue(new TinyDate(value.nativeDate, this.timeZone()));
|
|
2225
2194
|
}
|
|
2226
2195
|
}
|
|
2227
2196
|
selectTab(active) {
|
|
2228
2197
|
this.flexibleActiveTab = active;
|
|
2229
2198
|
}
|
|
2230
2199
|
clearFlexibleValue() {
|
|
2231
|
-
this.flexibleDateGranularity
|
|
2200
|
+
this.flexibleDateGranularity.set(null);
|
|
2232
2201
|
if (this.flexibleActiveTab === 'advanced') {
|
|
2233
2202
|
this.advancedSelectedValue = {};
|
|
2234
2203
|
}
|
|
2235
2204
|
else {
|
|
2236
2205
|
this.selectedValue = [];
|
|
2237
2206
|
}
|
|
2238
|
-
this.valueChange.emit({ begin: null, end: null, dateGranularity: this.flexibleDateGranularity });
|
|
2207
|
+
this.valueChange.emit({ begin: null, end: null, dateGranularity: this.flexibleDateGranularity() });
|
|
2239
2208
|
}
|
|
2240
2209
|
changeValueFromAdvancedSelect(value) {
|
|
2241
2210
|
this.valueChange.emit(value);
|
|
@@ -2244,7 +2213,7 @@ class DatePopup {
|
|
|
2244
2213
|
this.dateValueChange.emit({ value: [value.begin, value.end] });
|
|
2245
2214
|
}
|
|
2246
2215
|
changeValueFromSelect(value, partType) {
|
|
2247
|
-
if (this.isRange) {
|
|
2216
|
+
if (this.isRange()) {
|
|
2248
2217
|
// clear advanced date when select a custom date
|
|
2249
2218
|
this.advancedSelectedValue = {};
|
|
2250
2219
|
const [left, right] = this.selectedValue;
|
|
@@ -2260,7 +2229,7 @@ class DatePopup {
|
|
|
2260
2229
|
this.setRangeValue('right', value);
|
|
2261
2230
|
this.selectedValue = sortRangeValue(this.selectedValue); // Sort
|
|
2262
2231
|
this.selectedValue = this.getSelectedRangeValueByMode(this.selectedValue);
|
|
2263
|
-
this.activeDate = this.normalizeRangeValue(this.selectedValue, this.getPanelMode(this.endPanelMode, partType));
|
|
2232
|
+
this.activeDate = this.normalizeRangeValue(this.selectedValue, this.getPanelMode(this.endPanelMode(), partType));
|
|
2264
2233
|
this.setValue(this.cloneRangeDate(this.selectedValue));
|
|
2265
2234
|
this.calendarChange.emit(this.cloneRangeDate(this.selectedValue));
|
|
2266
2235
|
this.dateValueChange.emit({ value: this.cloneRangeDate(this.selectedValue) });
|
|
@@ -2273,7 +2242,7 @@ class DatePopup {
|
|
|
2273
2242
|
}
|
|
2274
2243
|
}
|
|
2275
2244
|
getSelectedRangeValueByMode(value) {
|
|
2276
|
-
const panelMode = this.getPanelMode(this.endPanelMode);
|
|
2245
|
+
const panelMode = this.getPanelMode(this.endPanelMode());
|
|
2277
2246
|
if (panelMode === 'year') {
|
|
2278
2247
|
return [value[0].startOfYear(), value[1].endOfYear()];
|
|
2279
2248
|
}
|
|
@@ -2291,10 +2260,10 @@ class DatePopup {
|
|
|
2291
2260
|
}
|
|
2292
2261
|
}
|
|
2293
2262
|
updateHourMinute(value) {
|
|
2294
|
-
if (!this.value) {
|
|
2263
|
+
if (!this.value()) {
|
|
2295
2264
|
return value;
|
|
2296
2265
|
}
|
|
2297
|
-
const originDate = this.value;
|
|
2266
|
+
const originDate = this.value();
|
|
2298
2267
|
const dateTime = [value.getHours(), value.getMinutes(), value.getSeconds()];
|
|
2299
2268
|
const originDateTime = [originDate.getHours(), originDate.getMinutes(), originDate.getSeconds()];
|
|
2300
2269
|
const isEqualTime = dateTime.toString() === originDateTime.toString();
|
|
@@ -2306,7 +2275,7 @@ class DatePopup {
|
|
|
2306
2275
|
}
|
|
2307
2276
|
}
|
|
2308
2277
|
enablePrevNext(direction, partType) {
|
|
2309
|
-
if (this.isRange && this.panelMode === this.endPanelMode) {
|
|
2278
|
+
if (this.isRange() && this.panelMode() === this.endPanelMode()) {
|
|
2310
2279
|
const [start, end] = this.activeDate;
|
|
2311
2280
|
const showMiddle = !start.addMonths(1).isSame(end, 'month'); // One month diff then don't show middle prev/next
|
|
2312
2281
|
if ((partType === 'left' && direction === 'next') || (partType === 'right' && direction === 'prev')) {
|
|
@@ -2319,7 +2288,7 @@ class DatePopup {
|
|
|
2319
2288
|
}
|
|
2320
2289
|
}
|
|
2321
2290
|
getPanelMode(panelMode, partType) {
|
|
2322
|
-
if (this.isRange) {
|
|
2291
|
+
if (this.isRange()) {
|
|
2323
2292
|
return panelMode[this.getPartTypeIndex(partType)];
|
|
2324
2293
|
}
|
|
2325
2294
|
else {
|
|
@@ -2327,16 +2296,16 @@ class DatePopup {
|
|
|
2327
2296
|
}
|
|
2328
2297
|
}
|
|
2329
2298
|
getValueBySelector(partType) {
|
|
2330
|
-
if (this.isRange) {
|
|
2299
|
+
if (this.isRange()) {
|
|
2331
2300
|
const valueShow = this.selectedValue; // Use the real time value that without decorations when timepicker is shown up
|
|
2332
2301
|
return valueShow[this.getPartTypeIndex(partType)];
|
|
2333
2302
|
}
|
|
2334
2303
|
else {
|
|
2335
|
-
return this.value;
|
|
2304
|
+
return this.value();
|
|
2336
2305
|
}
|
|
2337
2306
|
}
|
|
2338
2307
|
getActiveDate(partType) {
|
|
2339
|
-
if (this.isRange) {
|
|
2308
|
+
if (this.isRange()) {
|
|
2340
2309
|
return this.activeDate[this.getPartTypeIndex(partType)];
|
|
2341
2310
|
}
|
|
2342
2311
|
else {
|
|
@@ -2347,23 +2316,27 @@ class DatePopup {
|
|
|
2347
2316
|
return this.partTypeMap[partType];
|
|
2348
2317
|
}
|
|
2349
2318
|
getMinTinyDate() {
|
|
2350
|
-
return this.minDate ? new TinyDate(transformDateValue(this.minDate).value, this.timeZone) : null;
|
|
2319
|
+
return this.minDate() ? new TinyDate(transformDateValue(this.minDate()).value, this.timeZone()) : null;
|
|
2351
2320
|
}
|
|
2352
2321
|
getMaxTinyDate() {
|
|
2353
|
-
return this.maxDate ? new TinyDate(transformDateValue(this.maxDate).value, this.timeZone) : null;
|
|
2322
|
+
return this.maxDate() ? new TinyDate(transformDateValue(this.maxDate()).value, this.timeZone()) : null;
|
|
2354
2323
|
}
|
|
2355
2324
|
clearHoverValue() {
|
|
2356
2325
|
this.hoverValue = [];
|
|
2357
2326
|
}
|
|
2358
2327
|
setValue(value) {
|
|
2359
|
-
this.value
|
|
2360
|
-
if (this.isRange && this.flexible) {
|
|
2361
|
-
this.flexibleDateGranularity
|
|
2362
|
-
this.valueChange.emit({
|
|
2328
|
+
this.value.set(value);
|
|
2329
|
+
if (this.isRange() && this.flexible()) {
|
|
2330
|
+
this.flexibleDateGranularity.set('day');
|
|
2331
|
+
this.valueChange.emit({
|
|
2332
|
+
begin: value[0],
|
|
2333
|
+
end: value[1],
|
|
2334
|
+
dateGranularity: this.flexibleDateGranularity()
|
|
2335
|
+
});
|
|
2363
2336
|
}
|
|
2364
2337
|
else {
|
|
2365
|
-
if (!this.showTime || !this.showTimePicker) {
|
|
2366
|
-
this.valueChange.emit(this.value);
|
|
2338
|
+
if (!this.showTime() || !this.showTimePicker) {
|
|
2339
|
+
this.valueChange.emit(this.value());
|
|
2367
2340
|
}
|
|
2368
2341
|
}
|
|
2369
2342
|
this.isDisableTimeConfirm();
|
|
@@ -2378,7 +2351,7 @@ class DatePopup {
|
|
|
2378
2351
|
};
|
|
2379
2352
|
const headerMode = headerModes[mode];
|
|
2380
2353
|
const [start, end] = value;
|
|
2381
|
-
const newStart = start || new TinyDate(undefined, this.timeZone);
|
|
2354
|
+
const newStart = start || new TinyDate(undefined, this.timeZone());
|
|
2382
2355
|
let newEnd = end;
|
|
2383
2356
|
if (!newEnd || newStart.isSame(end, headerMode)) {
|
|
2384
2357
|
newEnd = dateAddAmount(newStart, 1, headerMode);
|
|
@@ -2393,17 +2366,17 @@ class DatePopup {
|
|
|
2393
2366
|
return [value[0] && value[0].clone(), value[1] && value[1].clone()];
|
|
2394
2367
|
}
|
|
2395
2368
|
isDisableTimeConfirm() {
|
|
2396
|
-
if (this.isRange || !this.showTime) {
|
|
2369
|
+
if (this.isRange() || !this.showTime()) {
|
|
2397
2370
|
return;
|
|
2398
2371
|
}
|
|
2399
|
-
const date = this.value ? this.value : new TinyDate(undefined, this.timeZone);
|
|
2372
|
+
const date = this.value() ? this.value() : new TinyDate(undefined, this.timeZone());
|
|
2400
2373
|
const minDate = this.getMinTinyDate();
|
|
2401
2374
|
const maxDate = this.getMaxTinyDate();
|
|
2402
2375
|
if ((minDate && date.getTime() < minDate.getTime()) || (maxDate && date.getTime() > maxDate.getTime())) {
|
|
2403
|
-
this.disableTimeConfirm
|
|
2376
|
+
this.disableTimeConfirm.set(true);
|
|
2404
2377
|
}
|
|
2405
2378
|
else {
|
|
2406
|
-
this.disableTimeConfirm
|
|
2379
|
+
this.disableTimeConfirm.set(false);
|
|
2407
2380
|
}
|
|
2408
2381
|
}
|
|
2409
2382
|
getSelectedShortcutPreset(date) {
|
|
@@ -2452,92 +2425,38 @@ class DatePopup {
|
|
|
2452
2425
|
const end = getShortcutValue(value[1]);
|
|
2453
2426
|
if (begin && end) {
|
|
2454
2427
|
this.selectedValue = this.getSelectedShortcutPreset([
|
|
2455
|
-
new TinyDate(begin, this.timeZone).startOfDay(),
|
|
2456
|
-
new TinyDate(end, this.timeZone).endOfDay()
|
|
2428
|
+
new TinyDate(begin, this.timeZone()).startOfDay(),
|
|
2429
|
+
new TinyDate(end, this.timeZone()).endOfDay()
|
|
2457
2430
|
]);
|
|
2458
2431
|
selectedPresetValue = this.cloneRangeDate(this.selectedValue);
|
|
2459
2432
|
}
|
|
2460
2433
|
}
|
|
2461
2434
|
else {
|
|
2462
|
-
const originDate = this.value;
|
|
2463
|
-
const zonedTime = this.createInZoneTime(new TinyDate(getShortcutValue(value), this.timeZone), originDate?.getHours() ?? 0, originDate?.getMinutes() ?? 0, originDate?.getSeconds() ?? 0);
|
|
2464
|
-
const singleTinyDate = this.updateHourMinute(new TinyDate(zonedTime, this.timeZone));
|
|
2435
|
+
const originDate = this.value();
|
|
2436
|
+
const zonedTime = this.createInZoneTime(new TinyDate(getShortcutValue(value), this.timeZone()), originDate?.getHours() ?? 0, originDate?.getMinutes() ?? 0, originDate?.getSeconds() ?? 0);
|
|
2437
|
+
const singleTinyDate = this.updateHourMinute(new TinyDate(zonedTime, this.timeZone()));
|
|
2465
2438
|
selectedPresetValue = this.getSelectedShortcutPreset(singleTinyDate);
|
|
2466
2439
|
}
|
|
2467
2440
|
this.setValue(selectedPresetValue);
|
|
2468
|
-
const shortcutPresetsValue = setValueByTimestampPrecision(shortcutPresets?.value, this.isRange, this.timestampPrecision, this.timeZone);
|
|
2441
|
+
const shortcutPresetsValue = setValueByTimestampPrecision(shortcutPresets?.value, this.isRange(), this.timestampPrecision(), this.timeZone());
|
|
2469
2442
|
this.dateValueChange.emit({
|
|
2470
2443
|
value: helpers.isArray(value) ? this.selectedValue : selectedPresetValue,
|
|
2471
2444
|
triggerPreset: Object.assign({}, shortcutPresets, { value: shortcutPresetsValue })
|
|
2472
2445
|
});
|
|
2473
|
-
if (!helpers.isArray(value) && this.showTime && this.showTimePicker) {
|
|
2446
|
+
if (!helpers.isArray(value) && this.showTime() && this.showTimePicker) {
|
|
2474
2447
|
this.updateActiveDate();
|
|
2475
2448
|
}
|
|
2476
2449
|
}
|
|
2477
2450
|
createInZoneTime(date, hours, minutes, seconds) {
|
|
2478
|
-
return TinyDate.createDateInTimeZone(date.getYear(), date.getMonth(), date.getDate(), hours, minutes, seconds, this.timeZone);
|
|
2451
|
+
return TinyDate.createDateInTimeZone(date.getYear(), date.getMonth(), date.getDate(), hours, minutes, seconds, this.timeZone());
|
|
2479
2452
|
}
|
|
2480
2453
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DatePopup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2481
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DatePopup, isStandalone: true, selector: "date-popup", inputs: { isRange: "isRange", showWeek: "showWeek", format: "format", disabledDate: "disabledDate", minDate: "minDate", maxDate: "maxDate", showToday: "showToday", showTime: "showTime", mustShowTime: "mustShowTime", dateRender: "dateRender", className: "className", panelMode: "panelMode", value: "value", defaultPickerValue: "defaultPickerValue", showShortcut: "showShortcut", shortcutPresets: "shortcutPresets", shortcutPosition: "shortcutPosition", flexible: "flexible", flexibleDateGranularity: "flexibleDateGranularity", timestampPrecision: "timestampPrecision", timeZone: "timeZone" }, outputs: { panelModeChange: "panelModeChange", calendarChange: "calendarChange", valueChange: "valueChange", resultOk: "resultOk", showTimePickerChange: "showTimePickerChange", dateValueChange: "dateValueChange" }, exportAs: ["datePopup"], usesOnChanges: true, ngImport: i0, template: "<div class=\"{{ prefixCls }}-picker-container {{ className }}\">\n <div\n class=\"{{ prefixCls }} {{ showWeek ? prefixCls + '-week-number' : '' }}\n {{ isRange ? prefixCls + '-range' : '' }} {{ prefixCls }}-picker-shortcut-{{ shortcutPosition === 'left' ? 'left' : 'bottom' }}\">\n @if (showShortcut) {\n <div class=\"{{ prefixCls }}-picker-shortcut\">\n @for (item of innerShortcutPresets; track $index) {\n <div class=\"{{ prefixCls }}-picker-shortcut-item\" [class.disabled]=\"item.disabled\" (click)=\"shortcutSetValue(item)\">\n {{ item.title }}\n </div>\n }\n </div>\n }\n <div class=\"{{ prefixCls }}-panel\">\n <div class=\"{{ prefixCls }}-date-panel\">\n @if (flexible) {\n <div class=\"{{ prefixCls }}-date-panel-flexible\">\n <div class=\"{{ prefixCls }}-date-panel-flexible-tab\">\n <thy-nav thyType=\"pulled\" thySize=\"sm\">\n <a href=\"javascript:;\" thyNavLink [thyNavLinkActive]=\"flexibleActiveTab === 'advanced'\" (click)=\"selectTab('advanced')\">{{\n locale().advance\n }}</a>\n <a href=\"javascript:;\" thyNavLink [thyNavLinkActive]=\"flexibleActiveTab === 'custom'\" (click)=\"selectTab('custom')\">{{\n locale().custom\n }}</a>\n </thy-nav>\n <button thyButtonIcon=\"sweep\" thySize=\"sm\" class=\"clear-date-button\" (click)=\"clearFlexibleValue()\"></button>\n </div>\n <ng-container>\n <div class=\"{{ prefixCls }}-date-panel-advanced\" [hidden]=\"flexibleActiveTab !== 'advanced'\">\n <date-carousel\n name=\"dateCarousel\"\n (ngModelChange)=\"changeValueFromAdvancedSelect($event)\"\n [(ngModel)]=\"advancedSelectedValue\"\n [activeDate]=\"selectedValue[0]\"></date-carousel>\n </div>\n </ng-container>\n <div [hidden]=\"flexibleActiveTab !== 'custom'\">\n <ng-container *ngTemplateOutlet=\"tplInnerPopup\"></ng-container>\n </div>\n </div>\n } @else {\n @if (isRange) {\n <ng-container *ngTemplateOutlet=\"tplRangePart; context: { partType: 'left' }\"></ng-container>\n <ng-container *ngTemplateOutlet=\"tplRangePart; context: { partType: 'right' }\"></ng-container>\n } @else {\n <div>\n <ng-container *ngTemplateOutlet=\"tplInnerPopup\"></ng-container>\n </div>\n }\n @if (!isRange) {\n <ng-container *ngTemplateOutlet=\"tplFooter\"></ng-container>\n }\n }\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #tplInnerPopup let-partType=\"partType\">\n <inner-popup\n [showWeek]=\"showWeek\"\n [isRange]=\"isRange\"\n [panelMode]=\"getPanelMode(panelMode, partType)\"\n [endPanelMode]=\"getPanelMode(endPanelMode, partType)\"\n [partType]=\"partType\"\n [showDateRangeInput]=\"flexible && flexibleActiveTab === 'custom'\"\n (panelModeChange)=\"onPanelModeChange($event, partType)\"\n [value]=\"getValueBySelector(partType)\"\n [selectedValue]=\"selectedValue\"\n [activeDate]=\"getActiveDate(partType)\"\n [rangeActiveDate]=\"activeDate\"\n [disabledDate]=\"disabledDate\"\n [dateRender]=\"dateRender\"\n [hoverValue]=\"hoverValue\"\n [timeZone]=\"timeZone\"\n [enablePrev]=\"enablePrevNext('prev', partType)\"\n [enableNext]=\"enablePrevNext('next', partType)\"\n (dayHover)=\"onDayHover($event)\"\n (selectDate)=\"changeValueFromSelect($event, partType)\"\n (headerChange)=\"onHeaderChange($event, partType)\"></inner-popup>\n</ng-template>\n\n<ng-template #tplFooter>\n <calendar-footer\n [showTime]=\"showTime\"\n [mustShowTime]=\"mustShowTime\"\n [value]=\"value\"\n [timeZone]=\"timeZone\"\n [disableTimeConfirm]=\"disableTimeConfirm\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n (selectTime)=\"onSelectTime($event)\"\n (clickOk)=\"onClickOk()\"\n (clickRemove)=\"onClickRemove()\"></calendar-footer>\n</ng-template>\n\n<!-- Single ONLY -->\n\n<!-- Range ONLY -->\n<ng-template #tplRangePart let-partType=\"partType\">\n <div class=\"{{ prefixCls }}-range-part {{ prefixCls }}-range-{{ partType }}\">\n <div style=\"outline: none\">\n <ng-container *ngTemplateOutlet=\"tplInnerPopup; context: { partType: partType }\"></ng-container>\n </div>\n </div>\n</ng-template>\n", dependencies: [{ kind: "component", type: ThyNav, selector: "thy-nav", inputs: ["thyType", "thySize", "thyHorizontal", "thyVertical", "thyFill", "thyResponsive", "thyPauseReCalculate", "thyInsideClosable", "thyPopoverOptions", "thyExtra"] }, { kind: "directive", type: ThyNavItemDirective, selector: "[thyNavLink],[thyNavItem]", inputs: ["id", "thyNavItemActive", "thyNavLinkActive", "thyNavItemDisabled"] }, { kind: "component", type: ThyButtonIcon, selector: "thy-button-icon,[thy-button-icon],[thyButtonIcon]", inputs: ["thySize", "thyIcon", "thyButtonIcon", "thyShape", "thyLight", "thyActive", "thyTheme", "thyColor"] }, { kind: "component", type: DateCarousel, selector: "date-carousel", inputs: ["activeDate"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: InnerPopup, selector: "inner-popup", inputs: ["showWeek", "isRange", "activeDate", "rangeActiveDate", "enablePrev", "enableNext", "disabledDate", "dateRender", "selectedValue", "hoverValue", "panelMode", "timeZone", "showDateRangeInput", "partType", "endPanelMode", "value"], outputs: ["panelModeChange", "headerChange", "selectDate", "dayHover"], exportAs: ["innerPopup"] }, { kind: "component", type: CalendarFooter, selector: "calendar-footer", inputs: ["showTime", "mustShowTime", "value", "timeZone", "disableTimeConfirm"], outputs: ["selectTime", "clickOk", "clickRemove", "showTimePickerChange"], exportAs: ["calendarFooter"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2454
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: DatePopup, isStandalone: true, selector: "date-popup", inputs: { isRange: { classPropertyName: "isRange", publicName: "isRange", isSignal: true, isRequired: false, transformFunction: null }, showWeek: { classPropertyName: "showWeek", publicName: "showWeek", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, disabledDate: { classPropertyName: "disabledDate", publicName: "disabledDate", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null }, showToday: { classPropertyName: "showToday", publicName: "showToday", isSignal: true, isRequired: false, transformFunction: null }, showTime: { classPropertyName: "showTime", publicName: "showTime", isSignal: true, isRequired: false, transformFunction: null }, mustShowTime: { classPropertyName: "mustShowTime", publicName: "mustShowTime", isSignal: true, isRequired: false, transformFunction: null }, dateRender: { classPropertyName: "dateRender", publicName: "dateRender", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, panelMode: { classPropertyName: "panelMode", publicName: "panelMode", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, defaultPickerValue: { classPropertyName: "defaultPickerValue", publicName: "defaultPickerValue", isSignal: true, isRequired: false, transformFunction: null }, showShortcut: { classPropertyName: "showShortcut", publicName: "showShortcut", isSignal: true, isRequired: false, transformFunction: null }, shortcutPresets: { classPropertyName: "shortcutPresets", publicName: "shortcutPresets", isSignal: true, isRequired: false, transformFunction: null }, shortcutPosition: { classPropertyName: "shortcutPosition", publicName: "shortcutPosition", isSignal: true, isRequired: false, transformFunction: null }, flexible: { classPropertyName: "flexible", publicName: "flexible", isSignal: true, isRequired: false, transformFunction: null }, flexibleDateGranularity: { classPropertyName: "flexibleDateGranularity", publicName: "flexibleDateGranularity", isSignal: true, isRequired: false, transformFunction: null }, timestampPrecision: { classPropertyName: "timestampPrecision", publicName: "timestampPrecision", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabledDate: "disabledDateChange", panelMode: "panelModeChange", value: "valueChange", showShortcut: "showShortcutChange", shortcutPresets: "shortcutPresetsChange", flexibleDateGranularity: "flexibleDateGranularityChange", panelModeChange: "panelModeChange", calendarChange: "calendarChange", valueChange: "valueChange", resultOk: "resultOk", showTimePickerChange: "showTimePickerChange", dateValueChange: "dateValueChange" }, exportAs: ["datePopup"], usesOnChanges: true, ngImport: i0, template: "<div class=\"{{ prefixCls }}-picker-container {{ className() }}\">\n <div\n class=\"{{ prefixCls }} {{ showWeek() ? prefixCls + '-week-number' : '' }}\n {{ isRange() ? prefixCls + '-range' : '' }} {{ prefixCls }}-picker-shortcut-{{ shortcutPosition() === 'left' ? 'left' : 'bottom' }}\">\n @if (showShortcut()) {\n <div class=\"{{ prefixCls }}-picker-shortcut\">\n @for (item of innerShortcutPresets; track $index) {\n <div class=\"{{ prefixCls }}-picker-shortcut-item\" [class.disabled]=\"item.disabled\" (click)=\"shortcutSetValue(item)\">\n {{ item.title }}\n </div>\n }\n </div>\n }\n <div class=\"{{ prefixCls }}-panel\">\n <div class=\"{{ prefixCls }}-date-panel\">\n @if (flexible()) {\n <div class=\"{{ prefixCls }}-date-panel-flexible\">\n <div class=\"{{ prefixCls }}-date-panel-flexible-tab\">\n <thy-nav thyType=\"pulled\" thySize=\"sm\">\n <a href=\"javascript:;\" thyNavLink [thyNavLinkActive]=\"flexibleActiveTab === 'advanced'\" (click)=\"selectTab('advanced')\">{{\n locale().advance\n }}</a>\n <a href=\"javascript:;\" thyNavLink [thyNavLinkActive]=\"flexibleActiveTab === 'custom'\" (click)=\"selectTab('custom')\">{{\n locale().custom\n }}</a>\n </thy-nav>\n <button thyButtonIcon=\"sweep\" thySize=\"sm\" class=\"clear-date-button\" (click)=\"clearFlexibleValue()\"></button>\n </div>\n <ng-container>\n <div class=\"{{ prefixCls }}-date-panel-advanced\" [hidden]=\"flexibleActiveTab !== 'advanced'\">\n <date-carousel\n name=\"dateCarousel\"\n (ngModelChange)=\"changeValueFromAdvancedSelect($event)\"\n [(ngModel)]=\"advancedSelectedValue\"\n [activeDate]=\"selectedValue[0]\"></date-carousel>\n </div>\n </ng-container>\n <div [hidden]=\"flexibleActiveTab !== 'custom'\">\n <ng-container *ngTemplateOutlet=\"tplInnerPopup\"></ng-container>\n </div>\n </div>\n } @else {\n @if (isRange()) {\n <ng-container *ngTemplateOutlet=\"tplRangePart; context: { partType: 'left' }\"></ng-container>\n <ng-container *ngTemplateOutlet=\"tplRangePart; context: { partType: 'right' }\"></ng-container>\n } @else {\n <div>\n <ng-container *ngTemplateOutlet=\"tplInnerPopup\"></ng-container>\n </div>\n }\n @if (!isRange()) {\n <ng-container *ngTemplateOutlet=\"tplFooter\"></ng-container>\n }\n }\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #tplInnerPopup let-partType=\"partType\">\n <inner-popup\n [showWeek]=\"showWeek()\"\n [isRange]=\"isRange()\"\n [panelMode]=\"getPanelMode(panelMode(), partType)\"\n [endPanelMode]=\"getPanelMode(endPanelMode(), partType)\"\n [partType]=\"partType\"\n [showDateRangeInput]=\"flexible() && flexibleActiveTab === 'custom'\"\n (panelModeChange)=\"onPanelModeChange($event, partType)\"\n [value]=\"getValueBySelector(partType)\"\n [selectedValue]=\"selectedValue\"\n [activeDate]=\"getActiveDate(partType)\"\n [rangeActiveDate]=\"activeDate\"\n [disabledDate]=\"disabledDate()\"\n [dateRender]=\"dateRender()\"\n [hoverValue]=\"hoverValue\"\n [timeZone]=\"timeZone()\"\n (dayHover)=\"onDayHover($event)\"\n (selectDate)=\"changeValueFromSelect($event, partType)\"\n (headerChange)=\"onHeaderChange($event, partType)\"></inner-popup>\n</ng-template>\n\n<ng-template #tplFooter>\n <calendar-footer\n [showTime]=\"showTime()\"\n [mustShowTime]=\"mustShowTime()\"\n [value]=\"value()\"\n [timeZone]=\"timeZone()\"\n [disableTimeConfirm]=\"disableTimeConfirm()\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n (selectTime)=\"onSelectTime($event)\"\n (clickOk)=\"onClickOk()\"\n (clickRemove)=\"onClickRemove()\"></calendar-footer>\n</ng-template>\n\n<!-- Single ONLY -->\n\n<!-- Range ONLY -->\n<ng-template #tplRangePart let-partType=\"partType\">\n <div class=\"{{ prefixCls }}-range-part {{ prefixCls }}-range-{{ partType }}\">\n <div style=\"outline: none\">\n <ng-container *ngTemplateOutlet=\"tplInnerPopup; context: { partType: partType }\"></ng-container>\n </div>\n </div>\n</ng-template>\n", dependencies: [{ kind: "component", type: ThyNav, selector: "thy-nav", inputs: ["thyType", "thySize", "thyHorizontal", "thyVertical", "thyFill", "thyResponsive", "thyPauseReCalculate", "thyInsideClosable", "thyPopoverOptions", "thyExtra"] }, { kind: "directive", type: ThyNavItemDirective, selector: "[thyNavLink],[thyNavItem]", inputs: ["id", "thyNavItemActive", "thyNavLinkActive", "thyNavItemDisabled"] }, { kind: "component", type: ThyButtonIcon, selector: "thy-button-icon,[thy-button-icon],[thyButtonIcon]", inputs: ["thySize", "thyIcon", "thyButtonIcon", "thyShape", "thyLight", "thyActive", "thyTheme", "thyColor"] }, { kind: "component", type: DateCarousel, selector: "date-carousel", inputs: ["activeDate"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: InnerPopup, selector: "inner-popup", inputs: ["showWeek", "isRange", "activeDate", "rangeActiveDate", "disabledDate", "dateRender", "selectedValue", "hoverValue", "panelMode", "timeZone", "showDateRangeInput", "partType", "endPanelMode", "value"], outputs: ["activeDateChange", "valueChange", "panelModeChange", "headerChange", "selectDate", "dayHover"], exportAs: ["innerPopup"] }, { kind: "component", type: CalendarFooter, selector: "calendar-footer", inputs: ["showTime", "mustShowTime", "value", "timeZone", "disableTimeConfirm"], outputs: ["valueChange", "selectTime", "clickOk", "clickRemove", "showTimePickerChange"], exportAs: ["calendarFooter"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2482
2455
|
}
|
|
2483
2456
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DatePopup, decorators: [{
|
|
2484
2457
|
type: Component,
|
|
2485
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'date-popup', exportAs: 'datePopup', imports: [ThyNav, ThyNavItemDirective, ThyButtonIcon, DateCarousel, FormsModule, NgTemplateOutlet, InnerPopup, CalendarFooter], template: "<div class=\"{{ prefixCls }}-picker-container {{ className }}\">\n <div\n class=\"{{ prefixCls }} {{ showWeek ? prefixCls + '-week-number' : '' }}\n {{ isRange ? prefixCls + '-range' : '' }} {{ prefixCls }}-picker-shortcut-{{ shortcutPosition === 'left' ? 'left' : 'bottom' }}\">\n @if (showShortcut) {\n <div class=\"{{ prefixCls }}-picker-shortcut\">\n @for (item of innerShortcutPresets; track $index) {\n <div class=\"{{ prefixCls }}-picker-shortcut-item\" [class.disabled]=\"item.disabled\" (click)=\"shortcutSetValue(item)\">\n {{ item.title }}\n </div>\n }\n </div>\n }\n <div class=\"{{ prefixCls }}-panel\">\n <div class=\"{{ prefixCls }}-date-panel\">\n @if (flexible) {\n <div class=\"{{ prefixCls }}-date-panel-flexible\">\n <div class=\"{{ prefixCls }}-date-panel-flexible-tab\">\n <thy-nav thyType=\"pulled\" thySize=\"sm\">\n <a href=\"javascript:;\" thyNavLink [thyNavLinkActive]=\"flexibleActiveTab === 'advanced'\" (click)=\"selectTab('advanced')\">{{\n locale().advance\n }}</a>\n <a href=\"javascript:;\" thyNavLink [thyNavLinkActive]=\"flexibleActiveTab === 'custom'\" (click)=\"selectTab('custom')\">{{\n locale().custom\n }}</a>\n </thy-nav>\n <button thyButtonIcon=\"sweep\" thySize=\"sm\" class=\"clear-date-button\" (click)=\"clearFlexibleValue()\"></button>\n </div>\n <ng-container>\n <div class=\"{{ prefixCls }}-date-panel-advanced\" [hidden]=\"flexibleActiveTab !== 'advanced'\">\n <date-carousel\n name=\"dateCarousel\"\n (ngModelChange)=\"changeValueFromAdvancedSelect($event)\"\n [(ngModel)]=\"advancedSelectedValue\"\n [activeDate]=\"selectedValue[0]\"></date-carousel>\n </div>\n </ng-container>\n <div [hidden]=\"flexibleActiveTab !== 'custom'\">\n <ng-container *ngTemplateOutlet=\"tplInnerPopup\"></ng-container>\n </div>\n </div>\n } @else {\n @if (isRange) {\n <ng-container *ngTemplateOutlet=\"tplRangePart; context: { partType: 'left' }\"></ng-container>\n <ng-container *ngTemplateOutlet=\"tplRangePart; context: { partType: 'right' }\"></ng-container>\n } @else {\n <div>\n <ng-container *ngTemplateOutlet=\"tplInnerPopup\"></ng-container>\n </div>\n }\n @if (!isRange) {\n <ng-container *ngTemplateOutlet=\"tplFooter\"></ng-container>\n }\n }\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #tplInnerPopup let-partType=\"partType\">\n <inner-popup\n [showWeek]=\"showWeek\"\n [isRange]=\"isRange\"\n [panelMode]=\"getPanelMode(panelMode, partType)\"\n [endPanelMode]=\"getPanelMode(endPanelMode, partType)\"\n [partType]=\"partType\"\n [showDateRangeInput]=\"flexible && flexibleActiveTab === 'custom'\"\n (panelModeChange)=\"onPanelModeChange($event, partType)\"\n [value]=\"getValueBySelector(partType)\"\n [selectedValue]=\"selectedValue\"\n [activeDate]=\"getActiveDate(partType)\"\n [rangeActiveDate]=\"activeDate\"\n [disabledDate]=\"disabledDate\"\n [dateRender]=\"dateRender\"\n [hoverValue]=\"hoverValue\"\n [timeZone]=\"timeZone
|
|
2486
|
-
}]
|
|
2487
|
-
type: Input
|
|
2488
|
-
}], showWeek: [{
|
|
2489
|
-
type: Input
|
|
2490
|
-
}], format: [{
|
|
2491
|
-
type: Input
|
|
2492
|
-
}], disabledDate: [{
|
|
2493
|
-
type: Input
|
|
2494
|
-
}], minDate: [{
|
|
2495
|
-
type: Input
|
|
2496
|
-
}], maxDate: [{
|
|
2497
|
-
type: Input
|
|
2498
|
-
}], showToday: [{
|
|
2499
|
-
type: Input
|
|
2500
|
-
}], showTime: [{
|
|
2501
|
-
type: Input
|
|
2502
|
-
}], mustShowTime: [{
|
|
2503
|
-
type: Input
|
|
2504
|
-
}], dateRender: [{
|
|
2505
|
-
type: Input
|
|
2506
|
-
}], className: [{
|
|
2507
|
-
type: Input
|
|
2508
|
-
}], panelMode: [{
|
|
2509
|
-
type: Input
|
|
2510
|
-
}], value: [{
|
|
2511
|
-
type: Input
|
|
2512
|
-
}], defaultPickerValue: [{
|
|
2513
|
-
type: Input
|
|
2514
|
-
}], showShortcut: [{
|
|
2515
|
-
type: Input
|
|
2516
|
-
}], shortcutPresets: [{
|
|
2517
|
-
type: Input
|
|
2518
|
-
}], shortcutPosition: [{
|
|
2519
|
-
type: Input
|
|
2520
|
-
}], flexible: [{
|
|
2521
|
-
type: Input
|
|
2522
|
-
}], flexibleDateGranularity: [{
|
|
2523
|
-
type: Input
|
|
2524
|
-
}], timestampPrecision: [{
|
|
2525
|
-
type: Input
|
|
2526
|
-
}], timeZone: [{
|
|
2527
|
-
type: Input
|
|
2528
|
-
}], panelModeChange: [{
|
|
2529
|
-
type: Output
|
|
2530
|
-
}], calendarChange: [{
|
|
2531
|
-
type: Output
|
|
2532
|
-
}], valueChange: [{
|
|
2533
|
-
type: Output
|
|
2534
|
-
}], resultOk: [{
|
|
2535
|
-
type: Output
|
|
2536
|
-
}], showTimePickerChange: [{
|
|
2537
|
-
type: Output
|
|
2538
|
-
}], dateValueChange: [{
|
|
2539
|
-
type: Output
|
|
2540
|
-
}] } });
|
|
2458
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'date-popup', exportAs: 'datePopup', imports: [ThyNav, ThyNavItemDirective, ThyButtonIcon, DateCarousel, FormsModule, NgTemplateOutlet, InnerPopup, CalendarFooter], template: "<div class=\"{{ prefixCls }}-picker-container {{ className() }}\">\n <div\n class=\"{{ prefixCls }} {{ showWeek() ? prefixCls + '-week-number' : '' }}\n {{ isRange() ? prefixCls + '-range' : '' }} {{ prefixCls }}-picker-shortcut-{{ shortcutPosition() === 'left' ? 'left' : 'bottom' }}\">\n @if (showShortcut()) {\n <div class=\"{{ prefixCls }}-picker-shortcut\">\n @for (item of innerShortcutPresets; track $index) {\n <div class=\"{{ prefixCls }}-picker-shortcut-item\" [class.disabled]=\"item.disabled\" (click)=\"shortcutSetValue(item)\">\n {{ item.title }}\n </div>\n }\n </div>\n }\n <div class=\"{{ prefixCls }}-panel\">\n <div class=\"{{ prefixCls }}-date-panel\">\n @if (flexible()) {\n <div class=\"{{ prefixCls }}-date-panel-flexible\">\n <div class=\"{{ prefixCls }}-date-panel-flexible-tab\">\n <thy-nav thyType=\"pulled\" thySize=\"sm\">\n <a href=\"javascript:;\" thyNavLink [thyNavLinkActive]=\"flexibleActiveTab === 'advanced'\" (click)=\"selectTab('advanced')\">{{\n locale().advance\n }}</a>\n <a href=\"javascript:;\" thyNavLink [thyNavLinkActive]=\"flexibleActiveTab === 'custom'\" (click)=\"selectTab('custom')\">{{\n locale().custom\n }}</a>\n </thy-nav>\n <button thyButtonIcon=\"sweep\" thySize=\"sm\" class=\"clear-date-button\" (click)=\"clearFlexibleValue()\"></button>\n </div>\n <ng-container>\n <div class=\"{{ prefixCls }}-date-panel-advanced\" [hidden]=\"flexibleActiveTab !== 'advanced'\">\n <date-carousel\n name=\"dateCarousel\"\n (ngModelChange)=\"changeValueFromAdvancedSelect($event)\"\n [(ngModel)]=\"advancedSelectedValue\"\n [activeDate]=\"selectedValue[0]\"></date-carousel>\n </div>\n </ng-container>\n <div [hidden]=\"flexibleActiveTab !== 'custom'\">\n <ng-container *ngTemplateOutlet=\"tplInnerPopup\"></ng-container>\n </div>\n </div>\n } @else {\n @if (isRange()) {\n <ng-container *ngTemplateOutlet=\"tplRangePart; context: { partType: 'left' }\"></ng-container>\n <ng-container *ngTemplateOutlet=\"tplRangePart; context: { partType: 'right' }\"></ng-container>\n } @else {\n <div>\n <ng-container *ngTemplateOutlet=\"tplInnerPopup\"></ng-container>\n </div>\n }\n @if (!isRange()) {\n <ng-container *ngTemplateOutlet=\"tplFooter\"></ng-container>\n }\n }\n </div>\n </div>\n </div>\n</div>\n\n<ng-template #tplInnerPopup let-partType=\"partType\">\n <inner-popup\n [showWeek]=\"showWeek()\"\n [isRange]=\"isRange()\"\n [panelMode]=\"getPanelMode(panelMode(), partType)\"\n [endPanelMode]=\"getPanelMode(endPanelMode(), partType)\"\n [partType]=\"partType\"\n [showDateRangeInput]=\"flexible() && flexibleActiveTab === 'custom'\"\n (panelModeChange)=\"onPanelModeChange($event, partType)\"\n [value]=\"getValueBySelector(partType)\"\n [selectedValue]=\"selectedValue\"\n [activeDate]=\"getActiveDate(partType)\"\n [rangeActiveDate]=\"activeDate\"\n [disabledDate]=\"disabledDate()\"\n [dateRender]=\"dateRender()\"\n [hoverValue]=\"hoverValue\"\n [timeZone]=\"timeZone()\"\n (dayHover)=\"onDayHover($event)\"\n (selectDate)=\"changeValueFromSelect($event, partType)\"\n (headerChange)=\"onHeaderChange($event, partType)\"></inner-popup>\n</ng-template>\n\n<ng-template #tplFooter>\n <calendar-footer\n [showTime]=\"showTime()\"\n [mustShowTime]=\"mustShowTime()\"\n [value]=\"value()\"\n [timeZone]=\"timeZone()\"\n [disableTimeConfirm]=\"disableTimeConfirm()\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n (selectTime)=\"onSelectTime($event)\"\n (clickOk)=\"onClickOk()\"\n (clickRemove)=\"onClickRemove()\"></calendar-footer>\n</ng-template>\n\n<!-- Single ONLY -->\n\n<!-- Range ONLY -->\n<ng-template #tplRangePart let-partType=\"partType\">\n <div class=\"{{ prefixCls }}-range-part {{ prefixCls }}-range-{{ partType }}\">\n <div style=\"outline: none\">\n <ng-container *ngTemplateOutlet=\"tplInnerPopup; context: { partType: partType }\"></ng-container>\n </div>\n </div>\n</ng-template>\n" }]
|
|
2459
|
+
}] });
|
|
2541
2460
|
|
|
2542
2461
|
class LibPackerModule {
|
|
2543
2462
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: LibPackerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
@@ -2642,81 +2561,99 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
2642
2561
|
* @private
|
|
2643
2562
|
*/
|
|
2644
2563
|
class ThyPicker {
|
|
2564
|
+
get realOpenState() {
|
|
2565
|
+
// The value that really decide the open state of overlay
|
|
2566
|
+
return this.isOpenHandledByUser() ? !!this.opened() : this.overlayOpen;
|
|
2567
|
+
}
|
|
2568
|
+
get readonlyState() {
|
|
2569
|
+
return this.isRange() || this.readonly() || this.mode() !== 'date';
|
|
2570
|
+
}
|
|
2645
2571
|
constructor() {
|
|
2646
2572
|
this.changeDetector = inject(ChangeDetectorRef);
|
|
2647
2573
|
this.dateHelper = inject(DateHelperService);
|
|
2648
2574
|
this.i18n = inject(ThyI18nService);
|
|
2649
|
-
this.isRange = false;
|
|
2650
|
-
this.
|
|
2651
|
-
this.
|
|
2652
|
-
this.
|
|
2653
|
-
this.
|
|
2654
|
-
this.
|
|
2655
|
-
this.
|
|
2656
|
-
this.
|
|
2575
|
+
this.isRange = input(false, { transform: coerceBooleanProperty });
|
|
2576
|
+
this.opened = input(undefined);
|
|
2577
|
+
this.disabled = input(false, { transform: coerceBooleanProperty });
|
|
2578
|
+
this.placeholder = input();
|
|
2579
|
+
this.readonly = input(false, { transform: coerceBooleanProperty });
|
|
2580
|
+
this.allowClear = input(false, { transform: coerceBooleanProperty });
|
|
2581
|
+
this.autoFocus = input(false, { transform: coerceBooleanProperty });
|
|
2582
|
+
this.className = input();
|
|
2583
|
+
this.size = input();
|
|
2584
|
+
this.suffixIcon = input();
|
|
2585
|
+
this.placement = input('bottomLeft');
|
|
2586
|
+
this.flexible = input(false, { transform: coerceBooleanProperty });
|
|
2587
|
+
this.mode = input();
|
|
2588
|
+
this.hasBackdrop = input(false, { transform: coerceBooleanProperty });
|
|
2589
|
+
this.separator = input();
|
|
2590
|
+
this.timeZone = input();
|
|
2591
|
+
this.blur = output();
|
|
2592
|
+
this.valueChange = output();
|
|
2593
|
+
this.openChange = output(); // Emitted when overlay's open state change
|
|
2594
|
+
this.inputChange = output();
|
|
2595
|
+
this.origin = viewChild('origin');
|
|
2596
|
+
this.cdkConnectedOverlay = viewChild(CdkConnectedOverlay);
|
|
2597
|
+
this.pickerInput = viewChild('pickerInput');
|
|
2598
|
+
this.overlayContainer = viewChild('overlayContainer');
|
|
2599
|
+
this.format = input();
|
|
2600
|
+
this.flexibleDateGranularity = input();
|
|
2601
|
+
this.value = input();
|
|
2657
2602
|
this.entering = false;
|
|
2658
2603
|
this.prefixCls = 'thy-calendar';
|
|
2659
2604
|
this.isShowDatePopup = false;
|
|
2660
2605
|
this.overlayOpen = false; // Available when "open"=undefined
|
|
2661
|
-
this.overlayPositions = getFlexiblePositions(this.placement, 4);
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
this.updateReadableDate(this.innerValue);
|
|
2669
|
-
}
|
|
2670
|
-
get flexibleDateGranularity() {
|
|
2671
|
-
return this.innerflexibleDateGranularity;
|
|
2672
|
-
}
|
|
2673
|
-
set flexibleDateGranularity(granularity) {
|
|
2674
|
-
this.innerflexibleDateGranularity = granularity;
|
|
2675
|
-
this.updateReadableDate(this.innerValue);
|
|
2676
|
-
}
|
|
2677
|
-
get value() {
|
|
2678
|
-
return this.innerValue;
|
|
2679
|
-
}
|
|
2680
|
-
set value(value) {
|
|
2681
|
-
this.innerValue = value;
|
|
2682
|
-
if (!this.entering) {
|
|
2683
|
-
this.updateReadableDate(this.innerValue);
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
get realOpenState() {
|
|
2687
|
-
// The value that really decide the open state of overlay
|
|
2688
|
-
return this.isOpenHandledByUser() ? !!this.open : this.overlayOpen;
|
|
2689
|
-
}
|
|
2690
|
-
get readonlyState() {
|
|
2691
|
-
return this.isRange || this.readonly || this.mode !== 'date';
|
|
2692
|
-
}
|
|
2693
|
-
ngOnChanges(changes) {
|
|
2694
|
-
// open by user
|
|
2695
|
-
if (changes.open && changes.open.currentValue !== undefined) {
|
|
2696
|
-
if (changes.open.currentValue) {
|
|
2697
|
-
this.showDatePopup();
|
|
2606
|
+
this.overlayPositions = getFlexiblePositions(this.placement(), 4);
|
|
2607
|
+
effect(() => {
|
|
2608
|
+
this.innerValue = this.value();
|
|
2609
|
+
if (this.innerValue) {
|
|
2610
|
+
if (!this.entering) {
|
|
2611
|
+
this.updateReadableDate(this.innerValue);
|
|
2612
|
+
}
|
|
2698
2613
|
}
|
|
2699
|
-
|
|
2700
|
-
|
|
2614
|
+
});
|
|
2615
|
+
effect(() => {
|
|
2616
|
+
this.innerFormat = this.format();
|
|
2617
|
+
if (this.innerFormat) {
|
|
2618
|
+
this.updateReadableDate(this.innerValue);
|
|
2701
2619
|
}
|
|
2702
|
-
}
|
|
2703
|
-
|
|
2704
|
-
this.
|
|
2705
|
-
|
|
2620
|
+
});
|
|
2621
|
+
effect(() => {
|
|
2622
|
+
this.innerflexibleDateGranularity = this.flexibleDateGranularity();
|
|
2623
|
+
if (this.innerflexibleDateGranularity) {
|
|
2624
|
+
this.updateReadableDate(this.innerValue);
|
|
2625
|
+
}
|
|
2626
|
+
});
|
|
2627
|
+
effect(() => {
|
|
2628
|
+
if (this.timeZone()) {
|
|
2629
|
+
this.formatDate(this.innerValue);
|
|
2630
|
+
}
|
|
2631
|
+
});
|
|
2632
|
+
effect(() => {
|
|
2633
|
+
const openedState = this.opened();
|
|
2634
|
+
if (openedState != undefined) {
|
|
2635
|
+
if (openedState) {
|
|
2636
|
+
this.showDatePopup();
|
|
2637
|
+
}
|
|
2638
|
+
else {
|
|
2639
|
+
this.closeDatePopup();
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
});
|
|
2706
2643
|
}
|
|
2707
2644
|
ngAfterViewInit() {
|
|
2708
|
-
this.overlayPositions = getFlexiblePositions(this.placement, 4);
|
|
2709
|
-
if (this.autoFocus) {
|
|
2645
|
+
this.overlayPositions = getFlexiblePositions(this.placement(), 4);
|
|
2646
|
+
if (this.autoFocus()) {
|
|
2710
2647
|
this.focus();
|
|
2711
2648
|
}
|
|
2712
2649
|
}
|
|
2713
2650
|
focus() {
|
|
2714
|
-
this.pickerInput
|
|
2651
|
+
this.pickerInput()?.nativeElement.focus();
|
|
2715
2652
|
}
|
|
2716
2653
|
onBlur(event) {
|
|
2717
2654
|
this.blur.emit(event);
|
|
2718
2655
|
if (this.entering) {
|
|
2719
|
-
this.valueChange.emit(this.pickerInput
|
|
2656
|
+
this.valueChange.emit(this.pickerInput()?.nativeElement.value);
|
|
2720
2657
|
}
|
|
2721
2658
|
this.entering = false;
|
|
2722
2659
|
}
|
|
@@ -2729,7 +2666,7 @@ class ThyPicker {
|
|
|
2729
2666
|
if (this.readonlyState) {
|
|
2730
2667
|
return;
|
|
2731
2668
|
}
|
|
2732
|
-
this.valueChange.emit(this.pickerInput
|
|
2669
|
+
this.valueChange.emit(this.pickerInput()?.nativeElement.value || this.getReadableValue(new TinyDate(undefined, this.timeZone())));
|
|
2733
2670
|
this.entering = false;
|
|
2734
2671
|
}
|
|
2735
2672
|
showOverlay() {
|
|
@@ -2738,8 +2675,8 @@ class ThyPicker {
|
|
|
2738
2675
|
this.showDatePopup();
|
|
2739
2676
|
this.openChange.emit(this.overlayOpen);
|
|
2740
2677
|
setTimeout(() => {
|
|
2741
|
-
if (this.cdkConnectedOverlay && this.cdkConnectedOverlay
|
|
2742
|
-
this.cdkConnectedOverlay
|
|
2678
|
+
if (this.cdkConnectedOverlay() && this.cdkConnectedOverlay()?.overlayRef) {
|
|
2679
|
+
this.cdkConnectedOverlay()?.overlayRef.updatePosition();
|
|
2743
2680
|
}
|
|
2744
2681
|
});
|
|
2745
2682
|
}
|
|
@@ -2764,7 +2701,7 @@ class ThyPicker {
|
|
|
2764
2701
|
}, 200);
|
|
2765
2702
|
}
|
|
2766
2703
|
onClickInputBox() {
|
|
2767
|
-
if (!this.disabled && !this.readonly && !this.isOpenHandledByUser()) {
|
|
2704
|
+
if (!this.disabled() && !this.readonly() && !this.isOpenHandledByUser()) {
|
|
2768
2705
|
this.showOverlay();
|
|
2769
2706
|
}
|
|
2770
2707
|
}
|
|
@@ -2780,7 +2717,7 @@ class ThyPicker {
|
|
|
2780
2717
|
onClickClear(event) {
|
|
2781
2718
|
event.preventDefault();
|
|
2782
2719
|
event.stopPropagation();
|
|
2783
|
-
this.innerValue = this.isRange ? [] : null;
|
|
2720
|
+
this.innerValue = this.isRange() ? [] : null;
|
|
2784
2721
|
this.valueChange.emit(this.innerValue);
|
|
2785
2722
|
}
|
|
2786
2723
|
getPartTypeIndex(partType) {
|
|
@@ -2790,7 +2727,7 @@ class ThyPicker {
|
|
|
2790
2727
|
if (value === null) {
|
|
2791
2728
|
return true;
|
|
2792
2729
|
}
|
|
2793
|
-
else if (this.isRange) {
|
|
2730
|
+
else if (this.isRange()) {
|
|
2794
2731
|
return !value || !Array.isArray(value) || value.every(val => !val);
|
|
2795
2732
|
}
|
|
2796
2733
|
else {
|
|
@@ -2799,18 +2736,18 @@ class ThyPicker {
|
|
|
2799
2736
|
}
|
|
2800
2737
|
// Whether open state is permanently controlled by user himself
|
|
2801
2738
|
isOpenHandledByUser() {
|
|
2802
|
-
return this.
|
|
2739
|
+
return this.opened() !== undefined;
|
|
2803
2740
|
}
|
|
2804
2741
|
getReadableValue(tinyDate) {
|
|
2805
2742
|
let value;
|
|
2806
|
-
if (this.isRange) {
|
|
2807
|
-
if (this.flexible && this.innerflexibleDateGranularity !== 'day') {
|
|
2808
|
-
return getFlexibleAdvancedReadableValue(tinyDate, this.innerflexibleDateGranularity, this.separator, this.i18n.getLocale());
|
|
2743
|
+
if (this.isRange()) {
|
|
2744
|
+
if (this.flexible() && this.innerflexibleDateGranularity !== 'day') {
|
|
2745
|
+
return getFlexibleAdvancedReadableValue(tinyDate, this.innerflexibleDateGranularity, this.separator(), this.i18n.getLocale());
|
|
2809
2746
|
}
|
|
2810
2747
|
else {
|
|
2811
2748
|
const start = tinyDate[0] ? this.formatDate(tinyDate[0]) : '';
|
|
2812
2749
|
const end = tinyDate[1] ? this.formatDate(tinyDate[1]) : '';
|
|
2813
|
-
return start && end ? `${start}${this.separator}${end}` : null;
|
|
2750
|
+
return start && end ? `${start}${this.separator()}${end}` : null;
|
|
2814
2751
|
}
|
|
2815
2752
|
}
|
|
2816
2753
|
else {
|
|
@@ -2829,83 +2766,24 @@ class ThyPicker {
|
|
|
2829
2766
|
}
|
|
2830
2767
|
}
|
|
2831
2768
|
getPlaceholder() {
|
|
2832
|
-
return this.isRange && this.placeholder && Array.isArray(this.placeholder)
|
|
2833
|
-
? this.placeholder.join(this.separator)
|
|
2834
|
-
: this.placeholder;
|
|
2769
|
+
return this.isRange() && this.placeholder() && Array.isArray(this.placeholder())
|
|
2770
|
+
? this.placeholder().join(this.separator())
|
|
2771
|
+
: this.placeholder();
|
|
2835
2772
|
}
|
|
2836
2773
|
updateReadableDate(setValue) {
|
|
2837
2774
|
const readableValue = this.getReadableValue(setValue);
|
|
2838
|
-
if (readableValue === this.pickerInput
|
|
2775
|
+
if (readableValue === this.pickerInput()?.nativeElement['value']) {
|
|
2839
2776
|
return;
|
|
2840
2777
|
}
|
|
2841
|
-
this.pickerInput.nativeElement.value = readableValue;
|
|
2778
|
+
this.pickerInput().nativeElement.value = readableValue;
|
|
2842
2779
|
}
|
|
2843
2780
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyPicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2844
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyPicker, isStandalone: true, selector: "thy-picker", inputs: { isRange: "isRange",
|
|
2781
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyPicker, isStandalone: true, selector: "thy-picker", inputs: { isRange: { classPropertyName: "isRange", publicName: "isRange", isSignal: true, isRequired: false, transformFunction: null }, opened: { classPropertyName: "opened", publicName: "opened", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, autoFocus: { classPropertyName: "autoFocus", publicName: "autoFocus", isSignal: true, isRequired: false, transformFunction: null }, className: { classPropertyName: "className", publicName: "className", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, suffixIcon: { classPropertyName: "suffixIcon", publicName: "suffixIcon", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, flexible: { classPropertyName: "flexible", publicName: "flexible", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, hasBackdrop: { classPropertyName: "hasBackdrop", publicName: "hasBackdrop", isSignal: true, isRequired: false, transformFunction: null }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null }, format: { classPropertyName: "format", publicName: "format", isSignal: true, isRequired: false, transformFunction: null }, flexibleDateGranularity: { classPropertyName: "flexibleDateGranularity", publicName: "flexibleDateGranularity", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { blur: "blur", valueChange: "valueChange", openChange: "openChange", inputChange: "inputChange" }, viewQueries: [{ propertyName: "origin", first: true, predicate: ["origin"], descendants: true, isSignal: true }, { propertyName: "cdkConnectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }, { propertyName: "pickerInput", first: true, predicate: ["pickerInput"], descendants: true, isSignal: true }, { propertyName: "overlayContainer", first: true, predicate: ["overlayContainer"], descendants: true, isSignal: true }], exportAs: ["thyPicker"], ngImport: i0, template: "<span\n cdkOverlayOrigin\n #origin=\"cdkOverlayOrigin\"\n class=\"{{ prefixCls }}-picker {{ size() ? prefixCls + '-picker-' + size() : '' }} {{ className() }}\"\n (click)=\"onClickInputBox()\">\n <ng-container>\n <input\n #pickerInput\n thyInput\n class=\"form-control-{{ size() }} form-control {{ prefixCls }}-picker-input\"\n [ngClass]=\"{ 'panel-is-opened': realOpenState }\"\n [thySize]=\"size()\"\n [tabindex]=\"-1\"\n [class.thy-input-disabled]=\"disabled()\"\n [class.thy-input-readonly]=\"readonly()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonlyState\"\n (blur)=\"onBlur($event)\"\n (input)=\"onInput($event)\"\n placeholder=\"{{ getPlaceholder() }}\"\n thyEnter\n (thyEnter)=\"onEnter()\" />\n <ng-container *ngTemplateOutlet=\"tplRightRest\"></ng-container>\n </ng-container>\n</span>\n\n<!-- Right operator icons -->\n<ng-template #tplRightRest>\n <span class=\"{{ prefixCls }}-picker-clear\">\n @if (!disabled() && !isEmptyValue(value()) && allowClear() && !readonly()) {\n <thy-icon\n thyIconName=\"close-circle-bold-fill\"\n (click)=\"onClickClear($event)\"\n ngClass=\"remove-link remove-link-{{ size() }}\"></thy-icon>\n }\n </span>\n <span class=\"{{ prefixCls }}-picker-icon\">\n <thy-icon [thyIconName]=\"suffixIcon()\" ngClass=\"remove-link-{{ size() ? size() : 'default' }}\"></thy-icon>\n </span>\n</ng-template>\n\n<!-- Overlay -->\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"realOpenState\"\n [cdkConnectedOverlayHasBackdrop]=\"hasBackdrop()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n cdkConnectedOverlayTransformOriginOn=\".thy-picker-container\"\n (positionChange)=\"onPositionChange($event)\"\n (backdropClick)=\"onClickBackdrop()\"\n (detach)=\"onOverlayDetach()\">\n <div\n #overlayContainer\n style=\"position: relative\"\n class=\"thy-picker-container\"\n [@scaleXMotion]=\"placement() === 'left' || placement() === 'right' ? 'enter' : 'void'\"\n [@scaleYMotion]=\"placement() === 'top' || placement() === 'bottom' ? 'enter' : 'void'\"\n [@scaleMotion]=\"\n placement() !== 'left' && placement() !== 'right' && placement() !== 'top' && placement() !== 'bottom' ? 'enter' : 'void'\n \">\n <!-- Compatible for overlay that not support offset dynamically and immediately -->\n <ng-content></ng-content>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: ThyInputDirective, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: ["thySize"], exportAs: ["thyInput"] }, { kind: "directive", type: ThyEnterDirective, selector: "[thyEnter]", outputs: ["thyEnter"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }], animations: [scaleXMotion, scaleYMotion, scaleMotion], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2845
2782
|
}
|
|
2846
2783
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyPicker, decorators: [{
|
|
2847
2784
|
type: Component,
|
|
2848
|
-
args: [{ selector: 'thy-picker', exportAs: 'thyPicker', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CdkOverlayOrigin, ThyInputDirective, ThyEnterDirective, NgTemplateOutlet, ThyIcon, NgClass, CdkConnectedOverlay], animations: [scaleXMotion, scaleYMotion, scaleMotion], template: "<span\n cdkOverlayOrigin\n #origin=\"cdkOverlayOrigin\"\n class=\"{{ prefixCls }}-picker {{ size ? prefixCls + '-picker-' + size : '' }} {{ className }}\"\n (click)=\"onClickInputBox()\">\n <ng-container>\n <input\n #pickerInput\n thyInput\n class=\"form-control-{{ size }} form-control {{ prefixCls }}-picker-input\"\n [ngClass]=\"{ 'panel-is-opened': realOpenState }\"\n [thySize]=\"size\"\n [tabindex]=\"-1\"\n [class.thy-input-disabled]=\"disabled\"\n [class.thy-input-readonly]=\"readonly\"\n [disabled]=\"disabled\"\n [readonly]=\"readonlyState\"\n (blur)=\"onBlur($event)\"\n (input)=\"onInput($event)\"\n placeholder=\"{{ getPlaceholder() }}\"\n thyEnter\n (thyEnter)=\"onEnter()\" />\n <ng-container *ngTemplateOutlet=\"tplRightRest\"></ng-container>\n </ng-container>\n</span>\n\n<!-- Right operator icons -->\n<ng-template #tplRightRest>\n <span class=\"{{ prefixCls }}-picker-clear\">\n @if (!disabled && !isEmptyValue(value) && allowClear && !readonly) {\n <thy-icon\n thyIconName=\"close-circle-bold-fill\"\n (click)=\"onClickClear($event)\"\n
|
|
2849
|
-
}],
|
|
2850
|
-
type: Input
|
|
2851
|
-
}], open: [{
|
|
2852
|
-
type: Input
|
|
2853
|
-
}], disabled: [{
|
|
2854
|
-
type: Input
|
|
2855
|
-
}], placeholder: [{
|
|
2856
|
-
type: Input
|
|
2857
|
-
}], readonly: [{
|
|
2858
|
-
type: Input
|
|
2859
|
-
}], allowClear: [{
|
|
2860
|
-
type: Input
|
|
2861
|
-
}], autoFocus: [{
|
|
2862
|
-
type: Input
|
|
2863
|
-
}], className: [{
|
|
2864
|
-
type: Input
|
|
2865
|
-
}], size: [{
|
|
2866
|
-
type: Input
|
|
2867
|
-
}], suffixIcon: [{
|
|
2868
|
-
type: Input
|
|
2869
|
-
}], placement: [{
|
|
2870
|
-
type: Input
|
|
2871
|
-
}], flexible: [{
|
|
2872
|
-
type: Input
|
|
2873
|
-
}], mode: [{
|
|
2874
|
-
type: Input
|
|
2875
|
-
}], hasBackdrop: [{
|
|
2876
|
-
type: Input,
|
|
2877
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
2878
|
-
}], separator: [{
|
|
2879
|
-
type: Input
|
|
2880
|
-
}], timeZone: [{
|
|
2881
|
-
type: Input
|
|
2882
|
-
}], blur: [{
|
|
2883
|
-
type: Output
|
|
2884
|
-
}], valueChange: [{
|
|
2885
|
-
type: Output
|
|
2886
|
-
}], openChange: [{
|
|
2887
|
-
type: Output
|
|
2888
|
-
}], inputChange: [{
|
|
2889
|
-
type: Output
|
|
2890
|
-
}], origin: [{
|
|
2891
|
-
type: ViewChild,
|
|
2892
|
-
args: ['origin', { static: true }]
|
|
2893
|
-
}], cdkConnectedOverlay: [{
|
|
2894
|
-
type: ViewChild,
|
|
2895
|
-
args: [CdkConnectedOverlay, { static: true }]
|
|
2896
|
-
}], pickerInput: [{
|
|
2897
|
-
type: ViewChild,
|
|
2898
|
-
args: ['pickerInput', { static: true }]
|
|
2899
|
-
}], overlayContainer: [{
|
|
2900
|
-
type: ViewChild,
|
|
2901
|
-
args: ['overlayContainer', { static: false }]
|
|
2902
|
-
}], format: [{
|
|
2903
|
-
type: Input
|
|
2904
|
-
}], flexibleDateGranularity: [{
|
|
2905
|
-
type: Input
|
|
2906
|
-
}], value: [{
|
|
2907
|
-
type: Input
|
|
2908
|
-
}] } });
|
|
2785
|
+
args: [{ selector: 'thy-picker', exportAs: 'thyPicker', changeDetection: ChangeDetectionStrategy.OnPush, imports: [CdkOverlayOrigin, ThyInputDirective, ThyEnterDirective, NgTemplateOutlet, ThyIcon, NgClass, CdkConnectedOverlay], animations: [scaleXMotion, scaleYMotion, scaleMotion], template: "<span\n cdkOverlayOrigin\n #origin=\"cdkOverlayOrigin\"\n class=\"{{ prefixCls }}-picker {{ size() ? prefixCls + '-picker-' + size() : '' }} {{ className() }}\"\n (click)=\"onClickInputBox()\">\n <ng-container>\n <input\n #pickerInput\n thyInput\n class=\"form-control-{{ size() }} form-control {{ prefixCls }}-picker-input\"\n [ngClass]=\"{ 'panel-is-opened': realOpenState }\"\n [thySize]=\"size()\"\n [tabindex]=\"-1\"\n [class.thy-input-disabled]=\"disabled()\"\n [class.thy-input-readonly]=\"readonly()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonlyState\"\n (blur)=\"onBlur($event)\"\n (input)=\"onInput($event)\"\n placeholder=\"{{ getPlaceholder() }}\"\n thyEnter\n (thyEnter)=\"onEnter()\" />\n <ng-container *ngTemplateOutlet=\"tplRightRest\"></ng-container>\n </ng-container>\n</span>\n\n<!-- Right operator icons -->\n<ng-template #tplRightRest>\n <span class=\"{{ prefixCls }}-picker-clear\">\n @if (!disabled() && !isEmptyValue(value()) && allowClear() && !readonly()) {\n <thy-icon\n thyIconName=\"close-circle-bold-fill\"\n (click)=\"onClickClear($event)\"\n ngClass=\"remove-link remove-link-{{ size() }}\"></thy-icon>\n }\n </span>\n <span class=\"{{ prefixCls }}-picker-icon\">\n <thy-icon [thyIconName]=\"suffixIcon()\" ngClass=\"remove-link-{{ size() ? size() : 'default' }}\"></thy-icon>\n </span>\n</ng-template>\n\n<!-- Overlay -->\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"realOpenState\"\n [cdkConnectedOverlayHasBackdrop]=\"hasBackdrop()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n cdkConnectedOverlayTransformOriginOn=\".thy-picker-container\"\n (positionChange)=\"onPositionChange($event)\"\n (backdropClick)=\"onClickBackdrop()\"\n (detach)=\"onOverlayDetach()\">\n <div\n #overlayContainer\n style=\"position: relative\"\n class=\"thy-picker-container\"\n [@scaleXMotion]=\"placement() === 'left' || placement() === 'right' ? 'enter' : 'void'\"\n [@scaleYMotion]=\"placement() === 'top' || placement() === 'bottom' ? 'enter' : 'void'\"\n [@scaleMotion]=\"\n placement() !== 'left' && placement() !== 'right' && placement() !== 'top' && placement() !== 'bottom' ? 'enter' : 'void'\n \">\n <!-- Compatible for overlay that not support offset dynamically and immediately -->\n <ng-content></ng-content>\n </div>\n</ng-template>\n" }]
|
|
2786
|
+
}], ctorParameters: () => [] });
|
|
2909
2787
|
|
|
2910
2788
|
/**
|
|
2911
2789
|
* @private
|
|
@@ -2921,22 +2799,6 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
|
|
|
2921
2799
|
get thyMode() {
|
|
2922
2800
|
return this._panelMode;
|
|
2923
2801
|
}
|
|
2924
|
-
/**
|
|
2925
|
-
* 快捷选项面板的显示位置
|
|
2926
|
-
* @type left | bottom
|
|
2927
|
-
*/
|
|
2928
|
-
set thyShortcutPosition(position) {
|
|
2929
|
-
if (!!position) {
|
|
2930
|
-
this.shortcutPosition = position;
|
|
2931
|
-
}
|
|
2932
|
-
}
|
|
2933
|
-
/**
|
|
2934
|
-
* 自定义快捷选项
|
|
2935
|
-
* @type ThyShortcutPreset[]
|
|
2936
|
-
*/
|
|
2937
|
-
set thyShortcutPresets(presets) {
|
|
2938
|
-
this.shortcutPresets = presets;
|
|
2939
|
-
}
|
|
2940
2802
|
/**
|
|
2941
2803
|
* 是否禁用
|
|
2942
2804
|
* @default false
|
|
@@ -2948,16 +2810,17 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
|
|
|
2948
2810
|
return this.disabled;
|
|
2949
2811
|
}
|
|
2950
2812
|
get realOpenState() {
|
|
2951
|
-
return this.picker.realOpenState;
|
|
2813
|
+
return this.picker().realOpenState;
|
|
2952
2814
|
}
|
|
2953
2815
|
get isShowDatePopup() {
|
|
2954
|
-
return this.picker.isShowDatePopup;
|
|
2816
|
+
return this.picker().isShowDatePopup;
|
|
2955
2817
|
}
|
|
2956
2818
|
initValue() {
|
|
2957
2819
|
this.thyValue = this.isRange ? [] : null;
|
|
2958
2820
|
}
|
|
2959
2821
|
constructor() {
|
|
2960
2822
|
super();
|
|
2823
|
+
this.destroyRef = inject(DestroyRef);
|
|
2961
2824
|
this.cdr = inject(ChangeDetectorRef);
|
|
2962
2825
|
this.locale = injectLocale('datePicker');
|
|
2963
2826
|
this._panelMode = 'date';
|
|
@@ -2965,81 +2828,142 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
|
|
|
2965
2828
|
/**
|
|
2966
2829
|
* 是否显示清除按钮
|
|
2967
2830
|
*/
|
|
2968
|
-
this.thyAllowClear = true;
|
|
2831
|
+
this.thyAllowClear = input(true, { transform: coerceBooleanProperty });
|
|
2969
2832
|
/**
|
|
2970
2833
|
* 是否自动获取焦点
|
|
2971
|
-
* @default false
|
|
2972
2834
|
*/
|
|
2973
|
-
this.thyAutoFocus = false;
|
|
2835
|
+
this.thyAutoFocus = input(false, { transform: coerceBooleanProperty });
|
|
2836
|
+
this.thyOpen = input(undefined, { transform: coerceBooleanProperty });
|
|
2837
|
+
this.opened = linkedSignal(this.thyOpen);
|
|
2838
|
+
this.thyDisabledDate = input();
|
|
2839
|
+
/**
|
|
2840
|
+
* 最小值
|
|
2841
|
+
*/
|
|
2842
|
+
this.thyMinDate = input();
|
|
2843
|
+
/**
|
|
2844
|
+
* 最大值
|
|
2845
|
+
*/
|
|
2846
|
+
this.thyMaxDate = input();
|
|
2847
|
+
/**
|
|
2848
|
+
* 输入框提示文字
|
|
2849
|
+
* @type string | string[]
|
|
2850
|
+
*/
|
|
2851
|
+
this.thyPlaceHolder = input(undefined);
|
|
2852
|
+
this.placeholder = signal(undefined);
|
|
2853
|
+
/**
|
|
2854
|
+
* 是否只读
|
|
2855
|
+
*/
|
|
2856
|
+
this.thyReadonly = input(false, { transform: coerceBooleanProperty });
|
|
2857
|
+
/**
|
|
2858
|
+
* 选择器 className
|
|
2859
|
+
*/
|
|
2860
|
+
this.thyOriginClassName = input();
|
|
2861
|
+
/**
|
|
2862
|
+
* 弹出层 className
|
|
2863
|
+
*/
|
|
2864
|
+
this.thyPanelClassName = input();
|
|
2974
2865
|
/**
|
|
2975
2866
|
* 输入框的大小
|
|
2976
|
-
* @type xs | sm | md | lg | default
|
|
2977
2867
|
*/
|
|
2978
|
-
this.thySize = 'default';
|
|
2868
|
+
this.thySize = input('default');
|
|
2979
2869
|
/**
|
|
2980
2870
|
* 设置时间戳精度
|
|
2981
2871
|
* @default seconds 10位
|
|
2982
2872
|
*/
|
|
2983
|
-
this.thyTimestampPrecision = this.datePickerConfigService.config?.timestampPrecision || 'seconds';
|
|
2873
|
+
this.thyTimestampPrecision = input(this.datePickerConfigService.config?.timestampPrecision || 'seconds');
|
|
2874
|
+
/**
|
|
2875
|
+
* 展示的日期格式
|
|
2876
|
+
* @default yyyy-MM-dd
|
|
2877
|
+
*/
|
|
2878
|
+
this.thyFormat = model();
|
|
2984
2879
|
/**
|
|
2985
2880
|
* 区间分隔符,不传值默认为 "~"
|
|
2986
2881
|
*/
|
|
2987
|
-
this.thySeparator = this.datePickerConfigService.config?.separator;
|
|
2882
|
+
this.thySeparator = input(this.datePickerConfigService.config?.separator);
|
|
2988
2883
|
this.separator = computed(() => {
|
|
2989
|
-
return ` ${this.thySeparator?.trim()} `;
|
|
2884
|
+
return ` ${this.thySeparator()?.trim()} `;
|
|
2990
2885
|
});
|
|
2991
2886
|
/**
|
|
2992
2887
|
* @description.en-us only for range picker, Whether to automatically take the beginning and ending unixTime of the day
|
|
2993
2888
|
* @description.zh-cn 是否取值开始日期的00:00以及截止日期的24:00
|
|
2994
2889
|
* @default false
|
|
2995
2890
|
*/
|
|
2996
|
-
this.thyAutoStartAndEnd = false;
|
|
2891
|
+
this.thyAutoStartAndEnd = input(false, { transform: coerceBooleanProperty });
|
|
2997
2892
|
/**
|
|
2998
2893
|
* 面板默认日期
|
|
2999
|
-
* @type CompatibleDate | number | null
|
|
3000
2894
|
*/
|
|
3001
|
-
this.thyDefaultPickerValue = null;
|
|
2895
|
+
this.thyDefaultPickerValue = input(null);
|
|
3002
2896
|
/**
|
|
3003
2897
|
* 自定义的后缀图标
|
|
3004
2898
|
*/
|
|
3005
|
-
this.thySuffixIcon = 'calendar';
|
|
2899
|
+
this.thySuffixIcon = input('calendar');
|
|
2900
|
+
/**
|
|
2901
|
+
* 是否展示快捷选项面板
|
|
2902
|
+
* @default false
|
|
2903
|
+
*/
|
|
2904
|
+
this.thyShowShortcut = input(undefined, { transform: coerceBooleanProperty });
|
|
2905
|
+
/**
|
|
2906
|
+
* 快捷选项面板的显示位置
|
|
2907
|
+
* @type left | bottom
|
|
2908
|
+
*/
|
|
2909
|
+
this.thyShortcutPosition = input('left', { transform: (value) => value || 'left' });
|
|
2910
|
+
/**
|
|
2911
|
+
* 自定义快捷选项
|
|
2912
|
+
* @type ThyShortcutPreset[]
|
|
2913
|
+
*/
|
|
2914
|
+
this.thyShortcutPresets = input();
|
|
2915
|
+
/**
|
|
2916
|
+
* 是否支持选择时间
|
|
2917
|
+
*/
|
|
2918
|
+
this.thyShowTime = input(false, {
|
|
2919
|
+
transform: (value) => (typeof value === 'object' ? value : coerceBooleanProperty(value))
|
|
2920
|
+
});
|
|
2921
|
+
/**
|
|
2922
|
+
* 是否展示时间(时、分)
|
|
2923
|
+
*/
|
|
2924
|
+
this.thyMustShowTime = input(false, { transform: coerceBooleanProperty });
|
|
2925
|
+
this.showWeek = computed(() => this.thyMode === 'week');
|
|
2926
|
+
this.flexible = computed(() => this.thyMode === 'flexible');
|
|
3006
2927
|
/**
|
|
3007
2928
|
* 日期变化的回调
|
|
3008
2929
|
*/
|
|
3009
|
-
this.thyDateChange =
|
|
3010
|
-
this.thyOpenChange =
|
|
2930
|
+
this.thyDateChange = output();
|
|
2931
|
+
this.thyOpenChange = output();
|
|
2932
|
+
this.picker = viewChild(ThyPicker);
|
|
2933
|
+
/**
|
|
2934
|
+
* 时区,不传使用默认时区
|
|
2935
|
+
*/
|
|
2936
|
+
this.thyTimeZone = input();
|
|
3011
2937
|
this.disabled = false;
|
|
3012
|
-
this.shortcutPosition = 'left';
|
|
3013
|
-
this.destroyed$ = new Subject();
|
|
3014
2938
|
this.isCustomPlaceHolder = false;
|
|
3015
2939
|
this.onlyEmitDate = false;
|
|
3016
2940
|
this.onChangeFn = () => void 0;
|
|
2941
|
+
effect(() => {
|
|
2942
|
+
if (this.isCustomPlaceHolder) {
|
|
2943
|
+
this.placeholder.set(this.thyPlaceHolder());
|
|
2944
|
+
}
|
|
2945
|
+
});
|
|
2946
|
+
effect(() => {
|
|
2947
|
+
if (this.thyTimeZone()) {
|
|
2948
|
+
this.setValue(this.innerValue);
|
|
2949
|
+
}
|
|
2950
|
+
});
|
|
3017
2951
|
}
|
|
3018
2952
|
ngOnInit() {
|
|
3019
2953
|
this.setDefaultPlaceHolder();
|
|
2954
|
+
this.setDefaultTimePickerState();
|
|
3020
2955
|
this.initValue();
|
|
3021
|
-
this.isFlexible();
|
|
3022
|
-
}
|
|
3023
|
-
isFlexible() {
|
|
3024
|
-
this.flexible = this.thyMode === 'flexible';
|
|
3025
2956
|
}
|
|
3026
2957
|
onDateValueChange(event) {
|
|
3027
2958
|
this.thyDateChange.emit(event);
|
|
3028
2959
|
}
|
|
3029
2960
|
ngOnChanges(changes) {
|
|
3030
|
-
if (changes.thyPlaceHolder && changes.thyPlaceHolder.firstChange && typeof
|
|
2961
|
+
if (changes.thyPlaceHolder && changes.thyPlaceHolder.firstChange && typeof changes.thyPlaceHolder.currentValue !== 'undefined') {
|
|
3031
2962
|
this.isCustomPlaceHolder = true;
|
|
3032
2963
|
}
|
|
3033
|
-
if (changes.thyTimeZone && changes.thyTimeZone.currentValue) {
|
|
3034
|
-
this.setValue(this.innerValue);
|
|
3035
|
-
}
|
|
3036
|
-
}
|
|
3037
|
-
ngOnDestroy() {
|
|
3038
|
-
this.destroyed$.next();
|
|
3039
|
-
this.destroyed$.complete();
|
|
3040
2964
|
}
|
|
3041
2965
|
closeOverlay() {
|
|
3042
|
-
this.picker.hideOverlay();
|
|
2966
|
+
this.picker().hideOverlay();
|
|
3043
2967
|
}
|
|
3044
2968
|
getAutoStartAndEndValue(begin, end) {
|
|
3045
2969
|
let value;
|
|
@@ -3072,7 +2996,7 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
|
|
|
3072
2996
|
let value = { begin: null, end: null };
|
|
3073
2997
|
if (vAsRange.length) {
|
|
3074
2998
|
const [begin, end] = vAsRange;
|
|
3075
|
-
if (this.thyAutoStartAndEnd) {
|
|
2999
|
+
if (this.thyAutoStartAndEnd()) {
|
|
3076
3000
|
value = this.getAutoStartAndEndValue(begin, end);
|
|
3077
3001
|
}
|
|
3078
3002
|
else {
|
|
@@ -3080,7 +3004,7 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
|
|
|
3080
3004
|
}
|
|
3081
3005
|
}
|
|
3082
3006
|
const [beginUnixTime, endUnixTime] = this.setValueByPrecision(value);
|
|
3083
|
-
this.onChangeFn(Object.assign({ begin: beginUnixTime, end: endUnixTime }, this.flexible ? { granularity: flexibleDateGranularity } : {}));
|
|
3007
|
+
this.onChangeFn(Object.assign({ begin: beginUnixTime, end: endUnixTime }, this.flexible() ? { granularity: flexibleDateGranularity } : {}));
|
|
3084
3008
|
}
|
|
3085
3009
|
else {
|
|
3086
3010
|
const value = { date: null, with_time: this.withTime ? 1 : 0 };
|
|
@@ -3096,26 +3020,26 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
|
|
|
3096
3020
|
}
|
|
3097
3021
|
}
|
|
3098
3022
|
setFormatRule() {
|
|
3099
|
-
if (!this.thyFormat) {
|
|
3023
|
+
if (!this.thyFormat()) {
|
|
3100
3024
|
if (this.withTime) {
|
|
3101
|
-
this.thyFormat
|
|
3025
|
+
this.thyFormat.set('yyyy-MM-dd HH:mm');
|
|
3102
3026
|
}
|
|
3103
3027
|
else {
|
|
3104
3028
|
if (!this.onlyEmitDate) {
|
|
3105
|
-
this.thyFormat
|
|
3029
|
+
this.thyFormat.set('yyyy-MM-dd');
|
|
3106
3030
|
}
|
|
3107
3031
|
}
|
|
3108
3032
|
}
|
|
3109
3033
|
}
|
|
3110
3034
|
onOpenChange(open) {
|
|
3111
|
-
this.
|
|
3035
|
+
this.opened.set(open);
|
|
3112
3036
|
this.thyOpenChange.emit(open);
|
|
3113
3037
|
}
|
|
3114
3038
|
writeValue(originalValue) {
|
|
3115
3039
|
const { value, withTime, flexibleDateGranularity } = transformDateValue(originalValue);
|
|
3116
3040
|
this.flexibleDateGranularity = flexibleDateGranularity;
|
|
3117
3041
|
this.innerValue = value;
|
|
3118
|
-
if (this.flexible && value && value.length) {
|
|
3042
|
+
if (this.flexible() && value && value.length) {
|
|
3119
3043
|
if (!this.flexibleDateGranularity) {
|
|
3120
3044
|
this.flexibleDateGranularity = 'day';
|
|
3121
3045
|
}
|
|
@@ -3130,87 +3054,51 @@ class AbstractPickerComponent extends TabIndexDisabledControlValueAccessorMixin
|
|
|
3130
3054
|
setTimePickerState(withTime) {
|
|
3131
3055
|
this.withTime = withTime;
|
|
3132
3056
|
}
|
|
3057
|
+
// Displays the time directly when the time must be displayed by default
|
|
3058
|
+
setDefaultTimePickerState() {
|
|
3059
|
+
this.withTime = this.thyMustShowTime();
|
|
3060
|
+
}
|
|
3061
|
+
// Restore after clearing time to select whether the original picker time is displayed or not
|
|
3062
|
+
restoreTimePickerState(value) {
|
|
3063
|
+
if (!value) {
|
|
3064
|
+
this.withTime = this.thyMustShowTime() || this.originWithTime;
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3067
|
+
setPanelMode() {
|
|
3068
|
+
const mode = this.thyMode ?? 'date';
|
|
3069
|
+
if (this.isRange) {
|
|
3070
|
+
this.panelMode = this.flexible() ? ['date', 'date'] : [mode, mode];
|
|
3071
|
+
}
|
|
3072
|
+
else {
|
|
3073
|
+
this.panelMode = mode;
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3133
3076
|
setDisabledState(disabled) {
|
|
3134
3077
|
this.thyDisabled = disabled;
|
|
3135
3078
|
this.cdr.markForCheck();
|
|
3136
3079
|
}
|
|
3137
3080
|
setDefaultPlaceHolder() {
|
|
3138
3081
|
if (!this.isCustomPlaceHolder) {
|
|
3139
|
-
|
|
3082
|
+
const placeholder = this.isRange ? [this.locale().startDate, this.locale().endDate] : this.locale().placeholder;
|
|
3083
|
+
this.placeholder.set(placeholder);
|
|
3140
3084
|
}
|
|
3141
|
-
this.cdr.markForCheck();
|
|
3142
3085
|
}
|
|
3143
3086
|
setValue(value) {
|
|
3144
|
-
this.thyValue = makeValue(value, this.isRange, this.thyTimeZone);
|
|
3087
|
+
this.thyValue = makeValue(value, this.isRange, this.thyTimeZone());
|
|
3145
3088
|
}
|
|
3146
3089
|
setValueByPrecision(value) {
|
|
3147
|
-
return setValueByTimestampPrecision(value, this.isRange, this.thyTimestampPrecision, this.thyTimeZone);
|
|
3090
|
+
return setValueByTimestampPrecision(value, this.isRange, this.thyTimestampPrecision(), this.thyTimeZone());
|
|
3148
3091
|
}
|
|
3149
3092
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: AbstractPickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3150
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
3093
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.2.8", type: AbstractPickerComponent, isStandalone: true, inputs: { thyMode: { classPropertyName: "thyMode", publicName: "thyMode", isSignal: false, isRequired: false, transformFunction: null }, thyAllowClear: { classPropertyName: "thyAllowClear", publicName: "thyAllowClear", isSignal: true, isRequired: false, transformFunction: null }, thyAutoFocus: { classPropertyName: "thyAutoFocus", publicName: "thyAutoFocus", isSignal: true, isRequired: false, transformFunction: null }, thyOpen: { classPropertyName: "thyOpen", publicName: "thyOpen", isSignal: true, isRequired: false, transformFunction: null }, thyDisabledDate: { classPropertyName: "thyDisabledDate", publicName: "thyDisabledDate", isSignal: true, isRequired: false, transformFunction: null }, thyMinDate: { classPropertyName: "thyMinDate", publicName: "thyMinDate", isSignal: true, isRequired: false, transformFunction: null }, thyMaxDate: { classPropertyName: "thyMaxDate", publicName: "thyMaxDate", isSignal: true, isRequired: false, transformFunction: null }, thyPlaceHolder: { classPropertyName: "thyPlaceHolder", publicName: "thyPlaceHolder", isSignal: true, isRequired: false, transformFunction: null }, thyReadonly: { classPropertyName: "thyReadonly", publicName: "thyReadonly", isSignal: true, isRequired: false, transformFunction: null }, thyOriginClassName: { classPropertyName: "thyOriginClassName", publicName: "thyOriginClassName", isSignal: true, isRequired: false, transformFunction: null }, thyPanelClassName: { classPropertyName: "thyPanelClassName", publicName: "thyPanelClassName", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyTimestampPrecision: { classPropertyName: "thyTimestampPrecision", publicName: "thyTimestampPrecision", isSignal: true, isRequired: false, transformFunction: null }, thyFormat: { classPropertyName: "thyFormat", publicName: "thyFormat", isSignal: true, isRequired: false, transformFunction: null }, thySeparator: { classPropertyName: "thySeparator", publicName: "thySeparator", isSignal: true, isRequired: false, transformFunction: null }, thyAutoStartAndEnd: { classPropertyName: "thyAutoStartAndEnd", publicName: "thyAutoStartAndEnd", isSignal: true, isRequired: false, transformFunction: null }, thyDefaultPickerValue: { classPropertyName: "thyDefaultPickerValue", publicName: "thyDefaultPickerValue", isSignal: true, isRequired: false, transformFunction: null }, thySuffixIcon: { classPropertyName: "thySuffixIcon", publicName: "thySuffixIcon", isSignal: true, isRequired: false, transformFunction: null }, thyShowShortcut: { classPropertyName: "thyShowShortcut", publicName: "thyShowShortcut", isSignal: true, isRequired: false, transformFunction: null }, thyShortcutPosition: { classPropertyName: "thyShortcutPosition", publicName: "thyShortcutPosition", isSignal: true, isRequired: false, transformFunction: null }, thyShortcutPresets: { classPropertyName: "thyShortcutPresets", publicName: "thyShortcutPresets", isSignal: true, isRequired: false, transformFunction: null }, thyShowTime: { classPropertyName: "thyShowTime", publicName: "thyShowTime", isSignal: true, isRequired: false, transformFunction: null }, thyMustShowTime: { classPropertyName: "thyMustShowTime", publicName: "thyMustShowTime", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: false, isRequired: false, transformFunction: coerceBooleanProperty }, thyTimeZone: { classPropertyName: "thyTimeZone", publicName: "thyTimeZone", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyFormat: "thyFormatChange", thyDateChange: "thyDateChange", thyOpenChange: "thyOpenChange" }, viewQueries: [{ propertyName: "picker", first: true, predicate: ThyPicker, descendants: true, isSignal: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0 }); }
|
|
3151
3094
|
}
|
|
3152
3095
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: AbstractPickerComponent, decorators: [{
|
|
3153
3096
|
type: Directive
|
|
3154
3097
|
}], ctorParameters: () => [], propDecorators: { thyMode: [{
|
|
3155
3098
|
type: Input
|
|
3156
|
-
}], thyAllowClear: [{
|
|
3157
|
-
type: Input,
|
|
3158
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
3159
|
-
}], thyAutoFocus: [{
|
|
3160
|
-
type: Input,
|
|
3161
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
3162
|
-
}], thyOpen: [{
|
|
3163
|
-
type: Input,
|
|
3164
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
3165
|
-
}], thyDisabledDate: [{
|
|
3166
|
-
type: Input
|
|
3167
|
-
}], thyMinDate: [{
|
|
3168
|
-
type: Input
|
|
3169
|
-
}], thyMaxDate: [{
|
|
3170
|
-
type: Input
|
|
3171
|
-
}], thyPlaceHolder: [{
|
|
3172
|
-
type: Input
|
|
3173
|
-
}], thyReadonly: [{
|
|
3174
|
-
type: Input,
|
|
3175
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
3176
|
-
}], thyOriginClassName: [{
|
|
3177
|
-
type: Input
|
|
3178
|
-
}], thyPanelClassName: [{
|
|
3179
|
-
type: Input
|
|
3180
|
-
}], thySize: [{
|
|
3181
|
-
type: Input
|
|
3182
|
-
}], thyTimestampPrecision: [{
|
|
3183
|
-
type: Input
|
|
3184
|
-
}], thyFormat: [{
|
|
3185
|
-
type: Input
|
|
3186
|
-
}], thySeparator: [{
|
|
3187
|
-
type: Input
|
|
3188
|
-
}], thyAutoStartAndEnd: [{
|
|
3189
|
-
type: Input,
|
|
3190
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
3191
|
-
}], thyDefaultPickerValue: [{
|
|
3192
|
-
type: Input
|
|
3193
|
-
}], thySuffixIcon: [{
|
|
3194
|
-
type: Input
|
|
3195
|
-
}], thyShowShortcut: [{
|
|
3196
|
-
type: Input,
|
|
3197
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
3198
|
-
}], thyShortcutPosition: [{
|
|
3199
|
-
type: Input
|
|
3200
|
-
}], thyShortcutPresets: [{
|
|
3201
|
-
type: Input
|
|
3202
|
-
}], thyDateChange: [{
|
|
3203
|
-
type: Output
|
|
3204
|
-
}], thyOpenChange: [{
|
|
3205
|
-
type: Output
|
|
3206
|
-
}], picker: [{
|
|
3207
|
-
type: ViewChild,
|
|
3208
|
-
args: [ThyPicker, { static: true }]
|
|
3209
3099
|
}], thyDisabled: [{
|
|
3210
3100
|
type: Input,
|
|
3211
3101
|
args: [{ transform: coerceBooleanProperty }]
|
|
3212
|
-
}], thyTimeZone: [{
|
|
3213
|
-
type: Input
|
|
3214
3102
|
}] } });
|
|
3215
3103
|
|
|
3216
3104
|
/**
|
|
@@ -3220,35 +3108,20 @@ class BasePicker extends AbstractPickerComponent {
|
|
|
3220
3108
|
constructor() {
|
|
3221
3109
|
super(...arguments);
|
|
3222
3110
|
this.element = inject(ElementRef);
|
|
3223
|
-
this.
|
|
3111
|
+
this.thyPicker = viewChild('thyPicker');
|
|
3112
|
+
this.thyDateRender = input();
|
|
3224
3113
|
/**
|
|
3225
3114
|
* 是否有幕布
|
|
3226
|
-
* @default true
|
|
3227
3115
|
*/
|
|
3228
|
-
this.thyHasBackdrop = true;
|
|
3229
|
-
/**
|
|
3230
|
-
* @type EventEmitter<ThyPanelMode | ThyPanelMode[]>
|
|
3231
|
-
*/
|
|
3232
|
-
this.thyOnPanelChange = new EventEmitter();
|
|
3233
|
-
/**
|
|
3234
|
-
* @type EventEmitter<Date[]>
|
|
3235
|
-
*/
|
|
3236
|
-
this.thyOnCalendarChange = new EventEmitter();
|
|
3237
|
-
/**
|
|
3238
|
-
* 是否展示时间(时、分)
|
|
3239
|
-
* @default false
|
|
3240
|
-
*/
|
|
3241
|
-
this.thyMustShowTime = false;
|
|
3116
|
+
this.thyHasBackdrop = input(true, { transform: coerceBooleanProperty$1 });
|
|
3242
3117
|
/**
|
|
3243
3118
|
* 弹出位置
|
|
3244
3119
|
* @type top | topLeft | topRight | bottom | bottomLeft | bottomRight | left | leftTop | leftBottom | right | rightTop | rightBottom
|
|
3245
3120
|
*/
|
|
3246
|
-
this.thyPlacement = 'bottomLeft';
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
this.thyOnOk = new EventEmitter();
|
|
3251
|
-
this.takeUntilDestroyed = takeUntilDestroyed();
|
|
3121
|
+
this.thyPlacement = input('bottomLeft');
|
|
3122
|
+
this.thyOnPanelChange = output();
|
|
3123
|
+
this.thyOnCalendarChange = output();
|
|
3124
|
+
this.thyOnOk = output();
|
|
3252
3125
|
this.thyClickDispatcher = inject(ThyClickDispatcher);
|
|
3253
3126
|
this.platformId = inject(PLATFORM_ID);
|
|
3254
3127
|
this.ngZone = inject(NgZone);
|
|
@@ -3256,33 +3129,30 @@ class BasePicker extends AbstractPickerComponent {
|
|
|
3256
3129
|
set thyMode(value) {
|
|
3257
3130
|
this._panelMode = value ?? 'date';
|
|
3258
3131
|
if (this.initialized) {
|
|
3259
|
-
this.
|
|
3132
|
+
this.setPanelMode();
|
|
3133
|
+
this.setFormat();
|
|
3260
3134
|
}
|
|
3261
3135
|
}
|
|
3262
3136
|
get thyMode() {
|
|
3263
3137
|
return this._panelMode;
|
|
3264
3138
|
}
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
* @default false
|
|
3268
|
-
*/
|
|
3269
|
-
get thyShowTime() {
|
|
3270
|
-
return this._showTime;
|
|
3271
|
-
}
|
|
3272
|
-
set thyShowTime(value) {
|
|
3273
|
-
this._showTime = typeof value === 'object' ? value : coerceBooleanProperty$1(value);
|
|
3139
|
+
open() {
|
|
3140
|
+
this.opened.set(true);
|
|
3274
3141
|
}
|
|
3275
3142
|
ngOnInit() {
|
|
3276
3143
|
super.ngOnInit();
|
|
3277
|
-
this.
|
|
3144
|
+
this.setPanelMode();
|
|
3145
|
+
this.setFormat();
|
|
3278
3146
|
this.initialized = true;
|
|
3279
3147
|
if (isPlatformBrowser(this.platformId)) {
|
|
3280
3148
|
this.thyClickDispatcher
|
|
3281
3149
|
.clicked(0)
|
|
3282
|
-
.pipe(this.
|
|
3150
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
3283
3151
|
.subscribe((event) => {
|
|
3284
3152
|
if (!this.element.nativeElement.contains(event.target) &&
|
|
3285
|
-
!this.thyPicker
|
|
3153
|
+
!this.thyPicker()
|
|
3154
|
+
?.overlayContainer()
|
|
3155
|
+
?.nativeElement.contains(event.target) &&
|
|
3286
3156
|
this.realOpenState) {
|
|
3287
3157
|
this.ngZone.run(() => {
|
|
3288
3158
|
this.closeOverlay();
|
|
@@ -3293,13 +3163,13 @@ class BasePicker extends AbstractPickerComponent {
|
|
|
3293
3163
|
}
|
|
3294
3164
|
}
|
|
3295
3165
|
onValueChange(value) {
|
|
3296
|
-
this.thyPicker.entering = false;
|
|
3166
|
+
this.thyPicker().entering = false;
|
|
3297
3167
|
this.restoreTimePickerState(value);
|
|
3298
3168
|
super.onValueChange(value);
|
|
3299
|
-
if (!this.flexible) {
|
|
3169
|
+
if (!this.flexible()) {
|
|
3300
3170
|
this.closeOverlay();
|
|
3301
3171
|
}
|
|
3302
|
-
this.innerPreviousDate = this.thyPicker.getReadableValue(this.thyValue);
|
|
3172
|
+
this.innerPreviousDate = this.thyPicker().getReadableValue(this.thyValue);
|
|
3303
3173
|
}
|
|
3304
3174
|
onInputValueChange(formatDate) {
|
|
3305
3175
|
if (!formatDate || !formatDate.length) {
|
|
@@ -3309,8 +3179,8 @@ class BasePicker extends AbstractPickerComponent {
|
|
|
3309
3179
|
return;
|
|
3310
3180
|
}
|
|
3311
3181
|
let value = formatDate;
|
|
3312
|
-
const valueValid = isValidStringDate(value, this.thyTimeZone);
|
|
3313
|
-
const valueLimitValid = valueValid ? this.isValidDateLimit(parseStringDate(value, this.thyTimeZone)) : false;
|
|
3182
|
+
const valueValid = isValidStringDate(value, this.thyTimeZone());
|
|
3183
|
+
const valueLimitValid = valueValid ? this.isValidDateLimit(parseStringDate(value, this.thyTimeZone())) : false;
|
|
3314
3184
|
if (valueValid && valueLimitValid) {
|
|
3315
3185
|
this.innerPreviousDate = value;
|
|
3316
3186
|
}
|
|
@@ -3318,38 +3188,23 @@ class BasePicker extends AbstractPickerComponent {
|
|
|
3318
3188
|
value = this.innerPreviousDate;
|
|
3319
3189
|
}
|
|
3320
3190
|
const tinyDate = value
|
|
3321
|
-
? this.thyShowTime
|
|
3322
|
-
? parseStringDate(value, this.thyTimeZone)
|
|
3323
|
-
: parseStringDate(value, this.thyTimeZone).startOfDay()
|
|
3191
|
+
? this.thyShowTime()
|
|
3192
|
+
? parseStringDate(value, this.thyTimeZone())
|
|
3193
|
+
: parseStringDate(value, this.thyTimeZone()).startOfDay()
|
|
3324
3194
|
: null;
|
|
3325
3195
|
this.restoreTimePickerState(tinyDate);
|
|
3326
3196
|
super.onValueChange(tinyDate);
|
|
3327
3197
|
}
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
this.withTime = this.thyMustShowTime;
|
|
3331
|
-
if (this.isRange) {
|
|
3332
|
-
this.panelMode = this.flexible ? ['date', 'date'] : [value, value];
|
|
3333
|
-
}
|
|
3334
|
-
else {
|
|
3335
|
-
this.panelMode = value;
|
|
3336
|
-
}
|
|
3337
|
-
this.showWeek = value === 'week';
|
|
3338
|
-
if (!this.thyFormat) {
|
|
3198
|
+
setFormat() {
|
|
3199
|
+
if (!this.thyFormat()) {
|
|
3339
3200
|
const inputFormats = {
|
|
3340
3201
|
year: 'yyyy',
|
|
3341
|
-
quarter:
|
|
3202
|
+
quarter: `yyyy-${QUARTER_FORMAT}`,
|
|
3342
3203
|
month: 'yyyy-MM',
|
|
3343
3204
|
week: this.locale().weekThFormat,
|
|
3344
|
-
date: this.thyShowTime ? 'yyyy-MM-dd HH:mm' : 'yyyy-MM-dd'
|
|
3205
|
+
date: this.thyShowTime() ? 'yyyy-MM-dd HH:mm' : 'yyyy-MM-dd'
|
|
3345
3206
|
};
|
|
3346
|
-
this.thyFormat
|
|
3347
|
-
}
|
|
3348
|
-
}
|
|
3349
|
-
// Restore after clearing time to select whether the original picker time is displayed or not
|
|
3350
|
-
restoreTimePickerState(value) {
|
|
3351
|
-
if (!value) {
|
|
3352
|
-
this.withTime = this.thyMustShowTime || this.originWithTime;
|
|
3207
|
+
this.thyFormat.set(this.flexible() ? inputFormats['date'] : inputFormats[this.thyMode]);
|
|
3353
3208
|
}
|
|
3354
3209
|
}
|
|
3355
3210
|
// Emit thyOnCalendarChange when select date by thy-range-picker
|
|
@@ -3389,7 +3244,7 @@ class BasePicker extends AbstractPickerComponent {
|
|
|
3389
3244
|
}
|
|
3390
3245
|
}
|
|
3391
3246
|
onFocus(event) {
|
|
3392
|
-
this.picker.focus();
|
|
3247
|
+
this.picker().focus();
|
|
3393
3248
|
}
|
|
3394
3249
|
onBlur(event) {
|
|
3395
3250
|
// Tab 聚焦后自动聚焦到 input 输入框,此分支下直接返回,无需触发 onTouchedFn
|
|
@@ -3399,26 +3254,26 @@ class BasePicker extends AbstractPickerComponent {
|
|
|
3399
3254
|
this.onTouchedFn();
|
|
3400
3255
|
}
|
|
3401
3256
|
onInputDate(value) {
|
|
3402
|
-
if (value && isValidStringDate(value, this.thyTimeZone)) {
|
|
3403
|
-
if (this.thyShowTime) {
|
|
3404
|
-
this.withTime = hasTimeInStringDate(value, this.thyTimeZone);
|
|
3257
|
+
if (value && isValidStringDate(value, this.thyTimeZone())) {
|
|
3258
|
+
if (this.thyShowTime()) {
|
|
3259
|
+
this.withTime = hasTimeInStringDate(value, this.thyTimeZone());
|
|
3405
3260
|
}
|
|
3406
|
-
this.thyValue = parseStringDate(value, this.thyTimeZone);
|
|
3261
|
+
this.thyValue = parseStringDate(value, this.thyTimeZone());
|
|
3407
3262
|
}
|
|
3408
3263
|
}
|
|
3409
3264
|
isValidDateLimit(date) {
|
|
3410
3265
|
let disable = false;
|
|
3411
|
-
if (this.thyDisabledDate !== undefined) {
|
|
3412
|
-
disable = this.thyDisabledDate(date.nativeDate);
|
|
3266
|
+
if (this.thyDisabledDate() !== undefined) {
|
|
3267
|
+
disable = this.thyDisabledDate()(date.nativeDate);
|
|
3413
3268
|
}
|
|
3414
|
-
const minDate = this.thyMinDate ? new TinyDate(transformDateValue(this.thyMinDate).value, this.thyTimeZone) : null;
|
|
3415
|
-
const maxDate = this.thyMaxDate ? new TinyDate(transformDateValue(this.thyMaxDate).value, this.thyTimeZone) : null;
|
|
3269
|
+
const minDate = this.thyMinDate() ? new TinyDate(transformDateValue(this.thyMinDate()).value, this.thyTimeZone()) : null;
|
|
3270
|
+
const maxDate = this.thyMaxDate() ? new TinyDate(transformDateValue(this.thyMaxDate()).value, this.thyTimeZone()) : null;
|
|
3416
3271
|
return ((!minDate || date.startOfDay().nativeDate >= minDate.startOfDay().nativeDate) &&
|
|
3417
3272
|
(!maxDate || date.startOfDay().nativeDate <= maxDate.startOfDay().nativeDate) &&
|
|
3418
3273
|
!disable);
|
|
3419
3274
|
}
|
|
3420
3275
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BasePicker, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3421
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
3276
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: BasePicker, isStandalone: true, selector: "ng-component", inputs: { thyDateRender: { classPropertyName: "thyDateRender", publicName: "thyDateRender", isSignal: true, isRequired: false, transformFunction: null }, thyMode: { classPropertyName: "thyMode", publicName: "thyMode", isSignal: false, isRequired: false, transformFunction: null }, thyHasBackdrop: { classPropertyName: "thyHasBackdrop", publicName: "thyHasBackdrop", isSignal: true, isRequired: false, transformFunction: null }, thyPlacement: { classPropertyName: "thyPlacement", publicName: "thyPlacement", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyOnPanelChange: "thyOnPanelChange", thyOnCalendarChange: "thyOnCalendarChange", thyOnOk: "thyOnOk" }, host: { listeners: { "focus": "onFocus($event)", "blur": "onBlur($event)" }, properties: { "attr.tabindex": "tabIndex" } }, viewQueries: [{ propertyName: "thyPicker", first: true, predicate: ["thyPicker"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
|
|
3422
3277
|
}
|
|
3423
3278
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: BasePicker, decorators: [{
|
|
3424
3279
|
type: Component,
|
|
@@ -3430,29 +3285,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
3430
3285
|
'(blur)': 'onBlur($event)'
|
|
3431
3286
|
}
|
|
3432
3287
|
}]
|
|
3433
|
-
}], propDecorators: {
|
|
3434
|
-
type: ViewChild,
|
|
3435
|
-
args: ['thyPicker', { static: true }]
|
|
3436
|
-
}], thyDateRender: [{
|
|
3288
|
+
}], propDecorators: { thyMode: [{
|
|
3437
3289
|
type: Input
|
|
3438
|
-
}], thyMode: [{
|
|
3439
|
-
type: Input
|
|
3440
|
-
}], thyHasBackdrop: [{
|
|
3441
|
-
type: Input,
|
|
3442
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
3443
|
-
}], thyOnPanelChange: [{
|
|
3444
|
-
type: Output
|
|
3445
|
-
}], thyOnCalendarChange: [{
|
|
3446
|
-
type: Output
|
|
3447
|
-
}], thyShowTime: [{
|
|
3448
|
-
type: Input
|
|
3449
|
-
}], thyMustShowTime: [{
|
|
3450
|
-
type: Input,
|
|
3451
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
3452
|
-
}], thyPlacement: [{
|
|
3453
|
-
type: Input
|
|
3454
|
-
}], thyOnOk: [{
|
|
3455
|
-
type: Output
|
|
3456
3290
|
}] } });
|
|
3457
3291
|
|
|
3458
3292
|
/**
|
|
@@ -3474,7 +3308,7 @@ class ThyDatePicker extends BasePicker {
|
|
|
3474
3308
|
multi: true,
|
|
3475
3309
|
useExisting: forwardRef(() => ThyDatePicker)
|
|
3476
3310
|
}
|
|
3477
|
-
], exportAs: ["thyDatePicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3311
|
+
], exportAs: ["thyDatePicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n", dependencies: [{ kind: "component", type: ThyPicker, selector: "thy-picker", inputs: ["isRange", "opened", "disabled", "placeholder", "readonly", "allowClear", "autoFocus", "className", "size", "suffixIcon", "placement", "flexible", "mode", "hasBackdrop", "separator", "timeZone", "format", "flexibleDateGranularity", "value"], outputs: ["blur", "valueChange", "openChange", "inputChange"], exportAs: ["thyPicker"] }, { kind: "component", type: DatePopup, selector: "date-popup", inputs: ["isRange", "showWeek", "format", "disabledDate", "minDate", "maxDate", "showToday", "showTime", "mustShowTime", "dateRender", "className", "panelMode", "value", "defaultPickerValue", "showShortcut", "shortcutPresets", "shortcutPosition", "flexible", "flexibleDateGranularity", "timestampPrecision", "timeZone"], outputs: ["disabledDateChange", "panelModeChange", "valueChange", "showShortcutChange", "shortcutPresetsChange", "flexibleDateGranularityChange", "calendarChange", "resultOk", "showTimePickerChange", "dateValueChange"], exportAs: ["datePopup"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3478
3312
|
}
|
|
3479
3313
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDatePicker, decorators: [{
|
|
3480
3314
|
type: Component,
|
|
@@ -3486,7 +3320,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
3486
3320
|
}
|
|
3487
3321
|
], imports: [ThyPicker, DatePopup], host: {
|
|
3488
3322
|
'[attr.tabindex]': 'tabIndex'
|
|
3489
|
-
}, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3323
|
+
}, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n" }]
|
|
3490
3324
|
}], ctorParameters: () => [] });
|
|
3491
3325
|
|
|
3492
3326
|
/**
|
|
@@ -3500,19 +3334,19 @@ class ThyMonthPicker extends BasePicker {
|
|
|
3500
3334
|
/**
|
|
3501
3335
|
* 展示的月份格式
|
|
3502
3336
|
*/
|
|
3503
|
-
this.thyFormat = 'yyyy-MM';
|
|
3337
|
+
this.thyFormat = model('yyyy-MM');
|
|
3504
3338
|
this.hostRenderer = useHostRenderer();
|
|
3505
3339
|
this.hostRenderer.addClass('thy-calendar-picker');
|
|
3506
3340
|
this.thyMode = 'month';
|
|
3507
3341
|
}
|
|
3508
3342
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyMonthPicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3509
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyMonthPicker, isStandalone: true, selector: "thy-month-picker", inputs: { thyFormat: "thyFormat" }, providers: [
|
|
3343
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyMonthPicker, isStandalone: true, selector: "thy-month-picker", inputs: { thyFormat: { classPropertyName: "thyFormat", publicName: "thyFormat", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyFormat: "thyFormatChange" }, providers: [
|
|
3510
3344
|
{
|
|
3511
3345
|
provide: NG_VALUE_ACCESSOR,
|
|
3512
3346
|
multi: true,
|
|
3513
3347
|
useExisting: forwardRef(() => ThyMonthPicker)
|
|
3514
3348
|
}
|
|
3515
|
-
], exportAs: ["thyMonthPicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3349
|
+
], exportAs: ["thyMonthPicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n", dependencies: [{ kind: "component", type: ThyPicker, selector: "thy-picker", inputs: ["isRange", "opened", "disabled", "placeholder", "readonly", "allowClear", "autoFocus", "className", "size", "suffixIcon", "placement", "flexible", "mode", "hasBackdrop", "separator", "timeZone", "format", "flexibleDateGranularity", "value"], outputs: ["blur", "valueChange", "openChange", "inputChange"], exportAs: ["thyPicker"] }, { kind: "component", type: DatePopup, selector: "date-popup", inputs: ["isRange", "showWeek", "format", "disabledDate", "minDate", "maxDate", "showToday", "showTime", "mustShowTime", "dateRender", "className", "panelMode", "value", "defaultPickerValue", "showShortcut", "shortcutPresets", "shortcutPosition", "flexible", "flexibleDateGranularity", "timestampPrecision", "timeZone"], outputs: ["disabledDateChange", "panelModeChange", "valueChange", "showShortcutChange", "shortcutPresetsChange", "flexibleDateGranularityChange", "calendarChange", "resultOk", "showTimePickerChange", "dateValueChange"], exportAs: ["datePopup"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3516
3350
|
}
|
|
3517
3351
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyMonthPicker, decorators: [{
|
|
3518
3352
|
type: Component,
|
|
@@ -3522,10 +3356,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
3522
3356
|
multi: true,
|
|
3523
3357
|
useExisting: forwardRef(() => ThyMonthPicker)
|
|
3524
3358
|
}
|
|
3525
|
-
], imports: [ThyPicker, DatePopup], template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3526
|
-
}], ctorParameters: () => []
|
|
3527
|
-
type: Input
|
|
3528
|
-
}] } });
|
|
3359
|
+
], imports: [ThyPicker, DatePopup], template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n" }]
|
|
3360
|
+
}], ctorParameters: () => [] });
|
|
3529
3361
|
|
|
3530
3362
|
/**
|
|
3531
3363
|
* 日期范围选择组件
|
|
@@ -3546,7 +3378,7 @@ class ThyRangePicker extends BasePicker {
|
|
|
3546
3378
|
multi: true,
|
|
3547
3379
|
useExisting: forwardRef(() => ThyRangePicker)
|
|
3548
3380
|
}
|
|
3549
|
-
], exportAs: ["thyRangePicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3381
|
+
], exportAs: ["thyRangePicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n", dependencies: [{ kind: "component", type: ThyPicker, selector: "thy-picker", inputs: ["isRange", "opened", "disabled", "placeholder", "readonly", "allowClear", "autoFocus", "className", "size", "suffixIcon", "placement", "flexible", "mode", "hasBackdrop", "separator", "timeZone", "format", "flexibleDateGranularity", "value"], outputs: ["blur", "valueChange", "openChange", "inputChange"], exportAs: ["thyPicker"] }, { kind: "component", type: DatePopup, selector: "date-popup", inputs: ["isRange", "showWeek", "format", "disabledDate", "minDate", "maxDate", "showToday", "showTime", "mustShowTime", "dateRender", "className", "panelMode", "value", "defaultPickerValue", "showShortcut", "shortcutPresets", "shortcutPosition", "flexible", "flexibleDateGranularity", "timestampPrecision", "timeZone"], outputs: ["disabledDateChange", "panelModeChange", "valueChange", "showShortcutChange", "shortcutPresetsChange", "flexibleDateGranularityChange", "calendarChange", "resultOk", "showTimePickerChange", "dateValueChange"], exportAs: ["datePopup"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3550
3382
|
}
|
|
3551
3383
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyRangePicker, decorators: [{
|
|
3552
3384
|
type: Component,
|
|
@@ -3556,7 +3388,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
3556
3388
|
multi: true,
|
|
3557
3389
|
useExisting: forwardRef(() => ThyRangePicker)
|
|
3558
3390
|
}
|
|
3559
|
-
], imports: [ThyPicker, DatePopup], template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3391
|
+
], imports: [ThyPicker, DatePopup], template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n" }]
|
|
3560
3392
|
}], ctorParameters: () => [] });
|
|
3561
3393
|
|
|
3562
3394
|
/**
|
|
@@ -3567,7 +3399,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
3567
3399
|
class ThyWeekPicker extends BasePicker {
|
|
3568
3400
|
constructor() {
|
|
3569
3401
|
super();
|
|
3570
|
-
this.showWeek = true;
|
|
3571
3402
|
this.hostRenderer = useHostRenderer();
|
|
3572
3403
|
this.hostRenderer.addClass('thy-calendar-picker');
|
|
3573
3404
|
this.thyMode = 'week';
|
|
@@ -3579,7 +3410,7 @@ class ThyWeekPicker extends BasePicker {
|
|
|
3579
3410
|
multi: true,
|
|
3580
3411
|
useExisting: forwardRef(() => ThyWeekPicker)
|
|
3581
3412
|
}
|
|
3582
|
-
], exportAs: ["thyWeekPicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3413
|
+
], exportAs: ["thyWeekPicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n", dependencies: [{ kind: "component", type: ThyPicker, selector: "thy-picker", inputs: ["isRange", "opened", "disabled", "placeholder", "readonly", "allowClear", "autoFocus", "className", "size", "suffixIcon", "placement", "flexible", "mode", "hasBackdrop", "separator", "timeZone", "format", "flexibleDateGranularity", "value"], outputs: ["blur", "valueChange", "openChange", "inputChange"], exportAs: ["thyPicker"] }, { kind: "component", type: DatePopup, selector: "date-popup", inputs: ["isRange", "showWeek", "format", "disabledDate", "minDate", "maxDate", "showToday", "showTime", "mustShowTime", "dateRender", "className", "panelMode", "value", "defaultPickerValue", "showShortcut", "shortcutPresets", "shortcutPosition", "flexible", "flexibleDateGranularity", "timestampPrecision", "timeZone"], outputs: ["disabledDateChange", "panelModeChange", "valueChange", "showShortcutChange", "shortcutPresetsChange", "flexibleDateGranularityChange", "calendarChange", "resultOk", "showTimePickerChange", "dateValueChange"], exportAs: ["datePopup"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3583
3414
|
}
|
|
3584
3415
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyWeekPicker, decorators: [{
|
|
3585
3416
|
type: Component,
|
|
@@ -3589,7 +3420,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
3589
3420
|
multi: true,
|
|
3590
3421
|
useExisting: forwardRef(() => ThyWeekPicker)
|
|
3591
3422
|
}
|
|
3592
|
-
], imports: [ThyPicker, DatePopup], template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3423
|
+
], imports: [ThyPicker, DatePopup], template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n" }]
|
|
3593
3424
|
}], ctorParameters: () => [] });
|
|
3594
3425
|
|
|
3595
3426
|
/**
|
|
@@ -3602,9 +3433,8 @@ class ThyYearPicker extends BasePicker {
|
|
|
3602
3433
|
super();
|
|
3603
3434
|
/**
|
|
3604
3435
|
* 展示的年份格式
|
|
3605
|
-
* @type string
|
|
3606
3436
|
*/
|
|
3607
|
-
this.thyFormat = 'yyyy';
|
|
3437
|
+
this.thyFormat = model('yyyy');
|
|
3608
3438
|
this.isRange = false;
|
|
3609
3439
|
this.endPanelMode = 'year';
|
|
3610
3440
|
this.hostRenderer = useHostRenderer();
|
|
@@ -3612,13 +3442,13 @@ class ThyYearPicker extends BasePicker {
|
|
|
3612
3442
|
this.thyMode = 'year';
|
|
3613
3443
|
}
|
|
3614
3444
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyYearPicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
3615
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyYearPicker, isStandalone: true, selector: "thy-year-picker", inputs: { thyFormat: "thyFormat" }, providers: [
|
|
3445
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyYearPicker, isStandalone: true, selector: "thy-year-picker", inputs: { thyFormat: { classPropertyName: "thyFormat", publicName: "thyFormat", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyFormat: "thyFormatChange" }, providers: [
|
|
3616
3446
|
{
|
|
3617
3447
|
provide: NG_VALUE_ACCESSOR,
|
|
3618
3448
|
multi: true,
|
|
3619
3449
|
useExisting: forwardRef(() => ThyYearPicker)
|
|
3620
3450
|
}
|
|
3621
|
-
], exportAs: ["thyYearPicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3451
|
+
], exportAs: ["thyYearPicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n", dependencies: [{ kind: "component", type: ThyPicker, selector: "thy-picker", inputs: ["isRange", "opened", "disabled", "placeholder", "readonly", "allowClear", "autoFocus", "className", "size", "suffixIcon", "placement", "flexible", "mode", "hasBackdrop", "separator", "timeZone", "format", "flexibleDateGranularity", "value"], outputs: ["blur", "valueChange", "openChange", "inputChange"], exportAs: ["thyPicker"] }, { kind: "component", type: DatePopup, selector: "date-popup", inputs: ["isRange", "showWeek", "format", "disabledDate", "minDate", "maxDate", "showToday", "showTime", "mustShowTime", "dateRender", "className", "panelMode", "value", "defaultPickerValue", "showShortcut", "shortcutPresets", "shortcutPosition", "flexible", "flexibleDateGranularity", "timestampPrecision", "timeZone"], outputs: ["disabledDateChange", "panelModeChange", "valueChange", "showShortcutChange", "shortcutPresetsChange", "flexibleDateGranularityChange", "calendarChange", "resultOk", "showTimePickerChange", "dateValueChange"], exportAs: ["datePopup"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
3622
3452
|
}
|
|
3623
3453
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyYearPicker, decorators: [{
|
|
3624
3454
|
type: Component,
|
|
@@ -3628,10 +3458,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
3628
3458
|
multi: true,
|
|
3629
3459
|
useExisting: forwardRef(() => ThyYearPicker)
|
|
3630
3460
|
}
|
|
3631
|
-
], imports: [ThyPicker, DatePopup], template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3632
|
-
}], ctorParameters: () => []
|
|
3633
|
-
type: Input
|
|
3634
|
-
}] } });
|
|
3461
|
+
], imports: [ThyPicker, DatePopup], template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n" }]
|
|
3462
|
+
}], ctorParameters: () => [] });
|
|
3635
3463
|
|
|
3636
3464
|
const DATE_PICKER_REQUIRED_VALIDATOR = {
|
|
3637
3465
|
provide: NG_VALIDATORS,
|
|
@@ -3642,20 +3470,21 @@ const DATE_PICKER_REQUIRED_VALIDATOR = {
|
|
|
3642
3470
|
* @private
|
|
3643
3471
|
*/
|
|
3644
3472
|
class DatePickerRequiredValidator {
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3473
|
+
constructor() {
|
|
3474
|
+
this.required = input(false, {
|
|
3475
|
+
transform: (value) => {
|
|
3476
|
+
return value != null && value !== false && `${value}` !== 'false';
|
|
3477
|
+
}
|
|
3478
|
+
});
|
|
3650
3479
|
}
|
|
3651
3480
|
validate(control) {
|
|
3652
|
-
return this.required ? this.validateRequired(control) : null;
|
|
3481
|
+
return this.required() ? this.validateRequired(control) : null;
|
|
3653
3482
|
}
|
|
3654
3483
|
validateRequired(control) {
|
|
3655
3484
|
return isEmptyInputDateValue(control.value) ? { required: true } : null;
|
|
3656
3485
|
}
|
|
3657
3486
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DatePickerRequiredValidator, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3658
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
3487
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: DatePickerRequiredValidator, isStandalone: true, selector: "[thyDatePicker][required][formControlName],[thyDatePicker][required][formControl],[thyDatePicker][required][ngModel],thy-date-picker[required][formControlName],thy-date-picker[required][formControl],thy-date-picker[required][ngModel]", inputs: { required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, providers: [DATE_PICKER_REQUIRED_VALIDATOR], ngImport: i0 }); }
|
|
3659
3488
|
}
|
|
3660
3489
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: DatePickerRequiredValidator, decorators: [{
|
|
3661
3490
|
type: Directive,
|
|
@@ -3663,9 +3492,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
3663
3492
|
selector: '[thyDatePicker][required][formControlName],[thyDatePicker][required][formControl],[thyDatePicker][required][ngModel],thy-date-picker[required][formControlName],thy-date-picker[required][formControl],thy-date-picker[required][ngModel]',
|
|
3664
3493
|
providers: [DATE_PICKER_REQUIRED_VALIDATOR]
|
|
3665
3494
|
}]
|
|
3666
|
-
}]
|
|
3667
|
-
type: Input
|
|
3668
|
-
}] } });
|
|
3495
|
+
}] });
|
|
3669
3496
|
const RANGE_PICKER_REQUIRED_VALIDATOR = {
|
|
3670
3497
|
provide: NG_VALIDATORS,
|
|
3671
3498
|
useExisting: forwardRef(() => RangePickerRequiredValidator),
|
|
@@ -3675,20 +3502,21 @@ const RANGE_PICKER_REQUIRED_VALIDATOR = {
|
|
|
3675
3502
|
* @private
|
|
3676
3503
|
*/
|
|
3677
3504
|
class RangePickerRequiredValidator {
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3505
|
+
constructor() {
|
|
3506
|
+
this.required = input(false, {
|
|
3507
|
+
transform: (value) => {
|
|
3508
|
+
return value != null && value !== false && `${value}` !== 'false';
|
|
3509
|
+
}
|
|
3510
|
+
});
|
|
3683
3511
|
}
|
|
3684
3512
|
validate(control) {
|
|
3685
|
-
return this.required ? this.validateRequired(control) : null;
|
|
3513
|
+
return this.required() ? this.validateRequired(control) : null;
|
|
3686
3514
|
}
|
|
3687
3515
|
validateRequired(control) {
|
|
3688
3516
|
return isEmptyInputRangeValue(control.value) ? { required: true } : null;
|
|
3689
3517
|
}
|
|
3690
3518
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: RangePickerRequiredValidator, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3691
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
3519
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: RangePickerRequiredValidator, isStandalone: true, selector: "[thyRangePicker][required][formControlName],[thyRangePicker][required][formControl],[thyRangePicker][required][ngModel],thy-range-picker[required][formControlName],thy-range-picker[required][formControl],thy-range-picker[required][ngModel]", inputs: { required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, providers: [RANGE_PICKER_REQUIRED_VALIDATOR], ngImport: i0 }); }
|
|
3692
3520
|
}
|
|
3693
3521
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: RangePickerRequiredValidator, decorators: [{
|
|
3694
3522
|
type: Directive,
|
|
@@ -3696,9 +3524,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
3696
3524
|
selector: '[thyRangePicker][required][formControlName],[thyRangePicker][required][formControl],[thyRangePicker][required][ngModel],thy-range-picker[required][formControlName],thy-range-picker[required][formControl],thy-range-picker[required][ngModel]',
|
|
3697
3525
|
providers: [RANGE_PICKER_REQUIRED_VALIDATOR]
|
|
3698
3526
|
}]
|
|
3699
|
-
}]
|
|
3700
|
-
type: Input
|
|
3701
|
-
}] } });
|
|
3527
|
+
}] });
|
|
3702
3528
|
function isEmptyInputRangeValue(value) {
|
|
3703
3529
|
return value == null || (instanceOfRangeEntry(value) && (value.begin == null || value.end == null));
|
|
3704
3530
|
}
|
|
@@ -3713,135 +3539,120 @@ class PickerDirective extends AbstractPickerComponent {
|
|
|
3713
3539
|
constructor() {
|
|
3714
3540
|
super(...arguments);
|
|
3715
3541
|
this.elementRef = inject(ElementRef);
|
|
3542
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
3716
3543
|
this.thyPopover = inject(ThyPopover);
|
|
3717
|
-
this.
|
|
3544
|
+
this.thyDateRender = input();
|
|
3545
|
+
this.thyOnPanelChange = output();
|
|
3546
|
+
this.thyOnCalendarChange = output();
|
|
3718
3547
|
/**
|
|
3719
|
-
*
|
|
3548
|
+
* 弹出位置
|
|
3549
|
+
* @type top | topLeft | topRight | bottom | bottomLeft | bottomRight | left | leftTop | leftBottom | right | rightTop | rightBottom
|
|
3720
3550
|
*/
|
|
3721
|
-
this.
|
|
3551
|
+
this.thyPlacement = input('bottom');
|
|
3722
3552
|
/**
|
|
3723
|
-
*
|
|
3553
|
+
* 弹出 DatePicker 的偏移量
|
|
3724
3554
|
*/
|
|
3725
|
-
this.
|
|
3555
|
+
this.thyOffset = input(4, {
|
|
3556
|
+
transform: (value) => {
|
|
3557
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
3558
|
+
warnDeprecation(`thyOffset parameter will be deprecated, please use thyPopoverOptions instead.`);
|
|
3559
|
+
}
|
|
3560
|
+
return numberAttribute(value);
|
|
3561
|
+
}
|
|
3562
|
+
});
|
|
3726
3563
|
/**
|
|
3727
|
-
*
|
|
3728
|
-
* @default false
|
|
3564
|
+
* 是否有幕布
|
|
3729
3565
|
*/
|
|
3730
|
-
this.
|
|
3566
|
+
this.thyHasBackdrop = input(true, {
|
|
3567
|
+
transform: (value) => {
|
|
3568
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
3569
|
+
warnDeprecation(`thyOffset parameter will be deprecated, please use thyPopoverOptions instead.`);
|
|
3570
|
+
}
|
|
3571
|
+
return coerceBooleanProperty$1(value);
|
|
3572
|
+
}
|
|
3573
|
+
});
|
|
3731
3574
|
/**
|
|
3732
|
-
*
|
|
3733
|
-
* @type top | topLeft | topRight | bottom | bottomLeft | bottomRight | left | leftTop | leftBottom | right | rightTop | rightBottom
|
|
3575
|
+
* popover 的其它参数
|
|
3734
3576
|
*/
|
|
3735
|
-
this.
|
|
3736
|
-
this.offset = 4;
|
|
3737
|
-
this.hasBackdrop = true;
|
|
3577
|
+
this.thyPopoverOptions = input();
|
|
3738
3578
|
/**
|
|
3739
3579
|
* 是否阻止冒泡
|
|
3740
3580
|
*/
|
|
3741
|
-
this.thyStopPropagation = true;
|
|
3742
|
-
this.destroy$ = new Subject();
|
|
3581
|
+
this.thyStopPropagation = input(true, { transform: coerceBooleanProperty$1 });
|
|
3743
3582
|
this.el = this.elementRef.nativeElement;
|
|
3744
3583
|
this.$click = fromEvent(this.el, 'click').pipe(tap(e => {
|
|
3745
|
-
if (this.thyStopPropagation) {
|
|
3584
|
+
if (this.thyStopPropagation()) {
|
|
3746
3585
|
e.stopPropagation();
|
|
3747
3586
|
}
|
|
3748
3587
|
}), mapTo(true));
|
|
3749
|
-
this.takeUntilDestroyed = takeUntilDestroyed();
|
|
3750
|
-
}
|
|
3751
|
-
get thyShowTime() {
|
|
3752
|
-
return this._showTime;
|
|
3753
|
-
}
|
|
3754
|
-
set thyShowTime(value) {
|
|
3755
|
-
this._showTime = typeof value === 'object' ? value : coerceBooleanProperty$1(value);
|
|
3756
|
-
}
|
|
3757
|
-
/**
|
|
3758
|
-
* 弹出 DatePicker 的偏移量
|
|
3759
|
-
* @default 4
|
|
3760
|
-
*/
|
|
3761
|
-
set thyOffset(value) {
|
|
3762
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
3763
|
-
warnDeprecation(`thyOffset parameter will be deprecated, please use thyPopoverOptions instead.`);
|
|
3764
|
-
}
|
|
3765
|
-
this.offset = value;
|
|
3766
|
-
}
|
|
3767
|
-
/**
|
|
3768
|
-
* 是否有幕布
|
|
3769
|
-
* @default true
|
|
3770
|
-
*/
|
|
3771
|
-
set thyHasBackdrop(value) {
|
|
3772
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
3773
|
-
warnDeprecation(`thyHasBackdrop parameter will be deprecated, please use thyPopoverOptions instead.`);
|
|
3774
|
-
}
|
|
3775
|
-
this.hasBackdrop = value;
|
|
3776
3588
|
}
|
|
3777
3589
|
ngOnInit() {
|
|
3778
|
-
this.
|
|
3779
|
-
}
|
|
3780
|
-
getInitialState() {
|
|
3781
|
-
this.thyMode = this.thyMode || 'date';
|
|
3782
|
-
this.flexible = this.thyMode === 'flexible';
|
|
3783
|
-
if (this.isRange) {
|
|
3784
|
-
this.panelMode = this.flexible ? ['date', 'date'] : [this.thyMode, this.thyMode];
|
|
3785
|
-
}
|
|
3786
|
-
else {
|
|
3787
|
-
this.panelMode = this.thyMode;
|
|
3788
|
-
}
|
|
3789
|
-
this.showWeek = this.thyMode === 'week';
|
|
3590
|
+
this.setPanelMode();
|
|
3790
3591
|
}
|
|
3791
3592
|
openOverlay() {
|
|
3792
|
-
this.
|
|
3593
|
+
this.setPanelMode();
|
|
3793
3594
|
const popoverRef = this.thyPopover.open(DatePopup, Object.assign({
|
|
3794
3595
|
origin: this.el,
|
|
3795
|
-
hasBackdrop: this.
|
|
3596
|
+
hasBackdrop: this.thyHasBackdrop(),
|
|
3796
3597
|
backdropClass: 'thy-overlay-transparent-backdrop',
|
|
3797
|
-
offset: this.
|
|
3598
|
+
offset: this.thyOffset(),
|
|
3798
3599
|
outsideClosable: true,
|
|
3799
3600
|
initialState: {
|
|
3800
3601
|
isRange: this.isRange,
|
|
3801
3602
|
panelMode: this.panelMode,
|
|
3802
|
-
showWeek: this.showWeek,
|
|
3603
|
+
showWeek: this.showWeek(),
|
|
3803
3604
|
value: this.thyValue,
|
|
3804
|
-
showTime: this.thyShowTime,
|
|
3605
|
+
showTime: this.thyShowTime(),
|
|
3805
3606
|
mustShowTime: this.withTime,
|
|
3806
|
-
format: this.thyFormat,
|
|
3807
|
-
dateRender: this.thyDateRender,
|
|
3808
|
-
disabledDate: this.thyDisabledDate,
|
|
3809
|
-
placeholder: this.
|
|
3810
|
-
className: this.thyPanelClassName,
|
|
3811
|
-
defaultPickerValue: this.thyDefaultPickerValue,
|
|
3812
|
-
minDate: this.thyMinDate,
|
|
3813
|
-
maxDate: this.thyMaxDate,
|
|
3814
|
-
showShortcut: this.thyShowShortcut,
|
|
3815
|
-
shortcutPresets: this.
|
|
3816
|
-
shortcutPosition: this.
|
|
3817
|
-
flexible: this.flexible,
|
|
3607
|
+
format: this.thyFormat(),
|
|
3608
|
+
dateRender: this.thyDateRender(),
|
|
3609
|
+
disabledDate: this.thyDisabledDate(),
|
|
3610
|
+
placeholder: this.placeholder(),
|
|
3611
|
+
className: this.thyPanelClassName(),
|
|
3612
|
+
defaultPickerValue: this.thyDefaultPickerValue(),
|
|
3613
|
+
minDate: this.thyMinDate(),
|
|
3614
|
+
maxDate: this.thyMaxDate(),
|
|
3615
|
+
showShortcut: this.thyShowShortcut(),
|
|
3616
|
+
shortcutPresets: this.thyShortcutPresets(),
|
|
3617
|
+
shortcutPosition: this.thyShortcutPosition(),
|
|
3618
|
+
flexible: this.flexible(),
|
|
3818
3619
|
flexibleDateGranularity: this.flexibleDateGranularity,
|
|
3819
|
-
timestampPrecision: this.thyTimestampPrecision
|
|
3620
|
+
timestampPrecision: this.thyTimestampPrecision()
|
|
3820
3621
|
},
|
|
3821
|
-
placement: this.thyPlacement
|
|
3822
|
-
}, this.thyPopoverOptions));
|
|
3622
|
+
placement: this.thyPlacement()
|
|
3623
|
+
}, this.thyPopoverOptions()));
|
|
3823
3624
|
if (popoverRef) {
|
|
3824
3625
|
const componentInstance = popoverRef.componentInstance;
|
|
3825
|
-
|
|
3826
|
-
|
|
3626
|
+
if (this.valueChangeSubscription) {
|
|
3627
|
+
this.valueChangeSubscription.unsubscribe();
|
|
3628
|
+
}
|
|
3629
|
+
this.valueChangeSubscription = componentInstance.valueChange?.subscribe((event) => this.onValueChange(event));
|
|
3630
|
+
if (this.calendarChangeSubscription) {
|
|
3631
|
+
this.calendarChangeSubscription.unsubscribe();
|
|
3632
|
+
}
|
|
3633
|
+
this.calendarChangeSubscription = componentInstance.calendarChange?.subscribe((event) => {
|
|
3827
3634
|
const rangeValue = coerceArray$1(event).map(x => x.nativeDate);
|
|
3828
3635
|
this.thyOnCalendarChange.emit(rangeValue);
|
|
3829
3636
|
});
|
|
3830
|
-
|
|
3831
|
-
.
|
|
3832
|
-
|
|
3637
|
+
if (this.showTimePickerChangeSubscription) {
|
|
3638
|
+
this.showTimePickerChangeSubscription.unsubscribe();
|
|
3639
|
+
}
|
|
3640
|
+
this.showTimePickerChangeSubscription = componentInstance.showTimePickerChange?.subscribe((event) => this.onShowTimePickerChange(event));
|
|
3833
3641
|
// eslint-disable-next-line max-len
|
|
3834
3642
|
componentInstance.ngOnChanges({ value: {} }); // dynamically created components don't call ngOnChanges, manual call
|
|
3835
|
-
|
|
3643
|
+
if (this.dateValueChangeSubscription) {
|
|
3644
|
+
this.dateValueChangeSubscription.unsubscribe();
|
|
3645
|
+
}
|
|
3646
|
+
this.dateValueChangeSubscription = componentInstance.dateValueChange?.subscribe((event) => {
|
|
3836
3647
|
this.thyDateChange.emit(event);
|
|
3837
3648
|
});
|
|
3838
3649
|
popoverRef
|
|
3839
3650
|
.afterOpened()
|
|
3840
|
-
.pipe(
|
|
3651
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
3841
3652
|
.subscribe(() => this.thyOpenChange.emit(true));
|
|
3842
3653
|
popoverRef
|
|
3843
3654
|
.afterClosed()
|
|
3844
|
-
.pipe(
|
|
3655
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
3845
3656
|
.subscribe(() => this.thyOpenChange.emit(false));
|
|
3846
3657
|
}
|
|
3847
3658
|
}
|
|
@@ -3849,70 +3660,45 @@ class PickerDirective extends AbstractPickerComponent {
|
|
|
3849
3660
|
this.thyPopover.close();
|
|
3850
3661
|
}
|
|
3851
3662
|
initActionSubscribe() {
|
|
3852
|
-
this.$click.pipe(debounceTime(50),
|
|
3853
|
-
if (!this.thyDisabled && !this.thyReadonly) {
|
|
3663
|
+
this.$click.pipe(debounceTime(50), takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
|
3664
|
+
if (!this.thyDisabled && !this.thyReadonly()) {
|
|
3854
3665
|
this.openOverlay();
|
|
3855
3666
|
}
|
|
3856
3667
|
});
|
|
3857
3668
|
}
|
|
3858
3669
|
ngAfterViewInit() {
|
|
3859
|
-
this.setDefaultTimePickerState();
|
|
3860
3670
|
this.initActionSubscribe();
|
|
3861
3671
|
}
|
|
3862
3672
|
ngOnDestroy() {
|
|
3863
|
-
this.
|
|
3864
|
-
|
|
3673
|
+
if (this.valueChangeSubscription) {
|
|
3674
|
+
this.valueChangeSubscription.unsubscribe();
|
|
3675
|
+
}
|
|
3676
|
+
if (this.calendarChangeSubscription) {
|
|
3677
|
+
this.calendarChangeSubscription.unsubscribe();
|
|
3678
|
+
}
|
|
3679
|
+
if (this.showTimePickerChangeSubscription) {
|
|
3680
|
+
this.showTimePickerChangeSubscription.unsubscribe();
|
|
3681
|
+
}
|
|
3682
|
+
if (this.dateValueChangeSubscription) {
|
|
3683
|
+
this.dateValueChangeSubscription.unsubscribe();
|
|
3684
|
+
}
|
|
3865
3685
|
}
|
|
3866
3686
|
onValueChange(value) {
|
|
3867
3687
|
this.restoreTimePickerState(value);
|
|
3868
3688
|
super.onValueChange(value);
|
|
3869
|
-
if (!this.flexible) {
|
|
3689
|
+
if (!this.flexible()) {
|
|
3870
3690
|
this.closeOverlay();
|
|
3871
3691
|
}
|
|
3872
3692
|
}
|
|
3873
|
-
// Displays the time directly when the time must be displayed by default
|
|
3874
|
-
setDefaultTimePickerState() {
|
|
3875
|
-
this.withTime = this.thyMustShowTime;
|
|
3876
|
-
}
|
|
3877
|
-
// Restore after clearing time to select whether the original picker time is displayed or not
|
|
3878
|
-
restoreTimePickerState(value) {
|
|
3879
|
-
if (!value) {
|
|
3880
|
-
this.withTime = this.thyMustShowTime || this.originWithTime;
|
|
3881
|
-
}
|
|
3882
|
-
}
|
|
3883
3693
|
onShowTimePickerChange(show) {
|
|
3884
3694
|
this.withTime = show;
|
|
3885
3695
|
}
|
|
3886
3696
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: PickerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
3887
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
3697
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: PickerDirective, isStandalone: true, inputs: { thyDateRender: { classPropertyName: "thyDateRender", publicName: "thyDateRender", isSignal: true, isRequired: false, transformFunction: null }, thyPlacement: { classPropertyName: "thyPlacement", publicName: "thyPlacement", isSignal: true, isRequired: false, transformFunction: null }, thyOffset: { classPropertyName: "thyOffset", publicName: "thyOffset", isSignal: true, isRequired: false, transformFunction: null }, thyHasBackdrop: { classPropertyName: "thyHasBackdrop", publicName: "thyHasBackdrop", isSignal: true, isRequired: false, transformFunction: null }, thyPopoverOptions: { classPropertyName: "thyPopoverOptions", publicName: "thyPopoverOptions", isSignal: true, isRequired: false, transformFunction: null }, thyStopPropagation: { classPropertyName: "thyStopPropagation", publicName: "thyStopPropagation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyOnPanelChange: "thyOnPanelChange", thyOnCalendarChange: "thyOnCalendarChange" }, usesInheritance: true, ngImport: i0 }); }
|
|
3888
3698
|
}
|
|
3889
3699
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: PickerDirective, decorators: [{
|
|
3890
3700
|
type: Directive
|
|
3891
|
-
}]
|
|
3892
|
-
type: Input
|
|
3893
|
-
}], thyOnPanelChange: [{
|
|
3894
|
-
type: Output
|
|
3895
|
-
}], thyOnCalendarChange: [{
|
|
3896
|
-
type: Output
|
|
3897
|
-
}], thyShowTime: [{
|
|
3898
|
-
type: Input
|
|
3899
|
-
}], thyMustShowTime: [{
|
|
3900
|
-
type: Input,
|
|
3901
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
3902
|
-
}], thyPlacement: [{
|
|
3903
|
-
type: Input
|
|
3904
|
-
}], thyOffset: [{
|
|
3905
|
-
type: Input,
|
|
3906
|
-
args: [{ transform: numberAttribute }]
|
|
3907
|
-
}], thyHasBackdrop: [{
|
|
3908
|
-
type: Input,
|
|
3909
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
3910
|
-
}], thyPopoverOptions: [{
|
|
3911
|
-
type: Input
|
|
3912
|
-
}], thyStopPropagation: [{
|
|
3913
|
-
type: Input,
|
|
3914
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
3915
|
-
}] } });
|
|
3701
|
+
}] });
|
|
3916
3702
|
|
|
3917
3703
|
/**
|
|
3918
3704
|
* 日期选择指令
|
|
@@ -3992,9 +3778,8 @@ class ThyQuarterPicker extends BasePicker {
|
|
|
3992
3778
|
super();
|
|
3993
3779
|
/**
|
|
3994
3780
|
* 展示的季度格式
|
|
3995
|
-
* @type string
|
|
3996
3781
|
*/
|
|
3997
|
-
this.thyFormat =
|
|
3782
|
+
this.thyFormat = model(`yyyy-${QUARTER_FORMAT}`);
|
|
3998
3783
|
this.isRange = false;
|
|
3999
3784
|
this.endPanelMode = 'quarter';
|
|
4000
3785
|
this.hostRenderer = useHostRenderer();
|
|
@@ -4002,13 +3787,13 @@ class ThyQuarterPicker extends BasePicker {
|
|
|
4002
3787
|
this.thyMode = 'quarter';
|
|
4003
3788
|
}
|
|
4004
3789
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyQuarterPicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4005
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyQuarterPicker, isStandalone: true, selector: "thy-quarter-picker", inputs: { thyFormat: "thyFormat" }, providers: [
|
|
3790
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyQuarterPicker, isStandalone: true, selector: "thy-quarter-picker", inputs: { thyFormat: { classPropertyName: "thyFormat", publicName: "thyFormat", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyFormat: "thyFormatChange" }, providers: [
|
|
4006
3791
|
{
|
|
4007
3792
|
provide: NG_VALUE_ACCESSOR,
|
|
4008
3793
|
multi: true,
|
|
4009
3794
|
useExisting: forwardRef(() => ThyQuarterPicker)
|
|
4010
3795
|
}
|
|
4011
|
-
], exportAs: ["thyQuarterPicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
3796
|
+
], exportAs: ["thyQuarterPicker"], usesInheritance: true, ngImport: i0, template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n", dependencies: [{ kind: "component", type: ThyPicker, selector: "thy-picker", inputs: ["isRange", "opened", "disabled", "placeholder", "readonly", "allowClear", "autoFocus", "className", "size", "suffixIcon", "placement", "flexible", "mode", "hasBackdrop", "separator", "timeZone", "format", "flexibleDateGranularity", "value"], outputs: ["blur", "valueChange", "openChange", "inputChange"], exportAs: ["thyPicker"] }, { kind: "component", type: DatePopup, selector: "date-popup", inputs: ["isRange", "showWeek", "format", "disabledDate", "minDate", "maxDate", "showToday", "showTime", "mustShowTime", "dateRender", "className", "panelMode", "value", "defaultPickerValue", "showShortcut", "shortcutPresets", "shortcutPosition", "flexible", "flexibleDateGranularity", "timestampPrecision", "timeZone"], outputs: ["disabledDateChange", "panelModeChange", "valueChange", "showShortcutChange", "shortcutPresetsChange", "flexibleDateGranularityChange", "calendarChange", "resultOk", "showTimePickerChange", "dateValueChange"], exportAs: ["datePopup"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
4012
3797
|
}
|
|
4013
3798
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyQuarterPicker, decorators: [{
|
|
4014
3799
|
type: Component,
|
|
@@ -4018,10 +3803,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
4018
3803
|
multi: true,
|
|
4019
3804
|
useExisting: forwardRef(() => ThyQuarterPicker)
|
|
4020
3805
|
}
|
|
4021
|
-
], imports: [ThyPicker, DatePopup], template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [
|
|
4022
|
-
}], ctorParameters: () => []
|
|
4023
|
-
type: Input
|
|
4024
|
-
}] } });
|
|
3806
|
+
], imports: [ThyPicker, DatePopup], template: "<thy-picker\n #thyPicker\n [isRange]=\"isRange\"\n [value]=\"thyValue\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n (valueChange)=\"onInputValueChange($event)\"\n [opened]=\"opened()\"\n [disabled]=\"thyDisabled\"\n [format]=\"thyFormat()\"\n [separator]=\"separator()\"\n [mode]=\"thyMode\"\n [allowClear]=\"thyAllowClear()\"\n [className]=\"thyOriginClassName()\"\n [autoFocus]=\"thyAutoFocus()\"\n [placeholder]=\"placeholder()\"\n [readonly]=\"thyReadonly()\"\n [size]=\"thySize()\"\n [timeZone]=\"thyTimeZone()\"\n [suffixIcon]=\"thySuffixIcon()\"\n [placement]=\"thyPlacement()\"\n [hasBackdrop]=\"thyHasBackdrop()\"\n (openChange)=\"onOpenChange($event)\"\n (blur)=\"onBlur($event)\"\n (inputChange)=\"onInputDate($event)\">\n @if (isShowDatePopup) {\n <date-popup\n [attr.tabindex]=\"-1\"\n [isRange]=\"isRange\"\n [showWeek]=\"showWeek()\"\n [panelMode]=\"panelMode\"\n [flexible]=\"flexible()\"\n [flexibleDateGranularity]=\"flexibleDateGranularity\"\n [defaultPickerValue]=\"thyDefaultPickerValue()\"\n (panelModeChange)=\"thyOnPanelChange.emit($event)\"\n (showTimePickerChange)=\"onShowTimePickerChange($event)\"\n [value]=\"thyValue\"\n (valueChange)=\"onValueChange($event)\"\n (calendarChange)=\"onCalendarChange($event)\"\n [showTime]=\"thyShowTime()\"\n [mustShowTime]=\"withTime\"\n [format]=\"thyFormat()\"\n [dateRender]=\"thyDateRender()\"\n [disabledDate]=\"thyDisabledDate()\"\n [minDate]=\"thyMinDate()\"\n [maxDate]=\"thyMaxDate()\"\n [showShortcut]=\"thyShowShortcut()\"\n [shortcutPresets]=\"thyShortcutPresets()\"\n [shortcutPosition]=\"thyShortcutPosition()\"\n [timestampPrecision]=\"thyTimestampPrecision()\"\n (dateValueChange)=\"onDateValueChange($event)\"\n [className]=\"thyPanelClassName()\"\n (resultOk)=\"onResultOk()\"\n [timeZone]=\"thyTimeZone()\"></date-popup>\n }\n</thy-picker>\n" }]
|
|
3807
|
+
}], ctorParameters: () => [] });
|
|
4025
3808
|
|
|
4026
3809
|
registerLocaleData(localeZhHans, 'zh-Hans');
|
|
4027
3810
|
class ThyDatePickerModule {
|
|
@@ -4122,5 +3905,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
4122
3905
|
* Generated bundle index. Do not edit.
|
|
4123
3906
|
*/
|
|
4124
3907
|
|
|
4125
|
-
export { AbstractPickerComponent, BasePicker, CalendarFooter, CalendarHeader, DATE_HELPER_SERVICE_FACTORY, DEFAULT_DATE_PICKER_CONFIG, DateCarousel, DateHeader, DateHelperByDatePipe, DateHelperService, DatePickerAdvancedShowYearTipPipe, DatePickerRequiredValidator, DatePopup, DateTable, DateTableCell, DecadeHeader, DecadeTable, InnerPopup, LibPackerModule, MonthHeader, MonthTable, PickerDirective, QuarterTable, RangePickerRequiredValidator, THY_DATE_PICKER_CONFIG, THY_DATE_PICKER_CONFIG_PROVIDER, ThyDatePicker, ThyDatePickerConfigService, ThyDatePickerDirective, ThyDatePickerFormatPipe, ThyDatePickerFormatStringPipe, ThyDatePickerModule, ThyMonthPicker, ThyPicker, ThyQuarterPicker, ThyQuarterPickerFormatPipe, ThyRangePicker, ThyRangePickerDirective, ThyWeekPicker, ThyYearPicker, YearHeader, YearTable, useDatePickerDefaultConfig };
|
|
3908
|
+
export { AbstractPickerComponent, BasePicker, CalendarFooter, CalendarHeader, DATE_HELPER_SERVICE_FACTORY, DEFAULT_DATE_PICKER_CONFIG, DateCarousel, DateHeader, DateHelperByDatePipe, DateHelperService, DatePickerAdvancedShowYearTipPipe, DatePickerRequiredValidator, DatePopup, DateTable, DateTableCell, DecadeHeader, DecadeTable, InnerPopup, LibPackerModule, MonthHeader, MonthTable, PickerDirective, QUARTER_FORMAT, QuarterTable, RangePickerRequiredValidator, THY_DATE_PICKER_CONFIG, THY_DATE_PICKER_CONFIG_PROVIDER, ThyDatePicker, ThyDatePickerConfigService, ThyDatePickerDirective, ThyDatePickerFormatPipe, ThyDatePickerFormatStringPipe, ThyDatePickerModule, ThyMonthPicker, ThyPicker, ThyQuarterPicker, ThyQuarterPickerFormatPipe, ThyRangePicker, ThyRangePickerDirective, ThyWeekPicker, ThyYearPicker, YearHeader, YearTable, useDatePickerDefaultConfig };
|
|
4126
3909
|
//# sourceMappingURL=ngx-tethys-date-picker.mjs.map
|