ngx-tethys 19.1.0-next.2 → 19.1.0-next.4
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 +24 -0
- package/badge/badge.component.d.ts +1 -1
- package/date-picker/date-picker.config.d.ts +2 -0
- package/date-picker/lib/date/date-table-cell.component.d.ts +7 -3
- package/empty/empty.component.d.ts +2 -1
- package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
- package/fesm2022/ngx-tethys-date-picker.mjs +20 -10
- package/fesm2022/ngx-tethys-date-picker.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-list.mjs +37 -52
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-message.mjs +28 -34
- 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-resizable.mjs +20 -17
- package/fesm2022/ngx-tethys-resizable.mjs.map +1 -1
- package/fesm2022/ngx-tethys-stepper.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.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- 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/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/stepper/stepper.component.d.ts +1 -1
- 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
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, forwardRef, inject, ChangeDetectorRef,
|
|
2
|
+
import { Injectable, forwardRef, inject, ChangeDetectorRef, input, model, output, computed, ChangeDetectionStrategy, Component, NgZone, viewChild, ElementRef, effect, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
5
5
|
import { coerceNumberProperty } from '@angular/cdk/coercion';
|
|
6
|
-
import { TinyDate,
|
|
6
|
+
import { TinyDate, isFunction, coerceBooleanProperty, isValid } from 'ngx-tethys/util';
|
|
7
7
|
import { Subscription } from 'rxjs';
|
|
8
8
|
import { __decorate, __metadata } from 'tslib';
|
|
9
9
|
import { MiniStore, MiniAction, reqAnimFrame, getFlexiblePositions, scaleXMotion, scaleYMotion, scaleMotion } from 'ngx-tethys/core';
|
|
10
10
|
import { DecimalPipe, NgTemplateOutlet, NgClass, CommonModule } from '@angular/common';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { CdkConnectedOverlay, CdkOverlayOrigin, OverlayModule } from '@angular/cdk/overlay';
|
|
12
|
+
import { ThyButton, ThyButtonModule } from 'ngx-tethys/button';
|
|
13
13
|
import { ThyIcon, ThyIconModule } from 'ngx-tethys/icon';
|
|
14
14
|
import { ThyInputDirective, ThyInputModule } from 'ngx-tethys/input';
|
|
15
|
-
import { ThyButton, ThyButtonModule } from 'ngx-tethys/button';
|
|
16
15
|
import { ThyPopoverModule } from 'ngx-tethys/popover';
|
|
17
16
|
import { ThySharedModule } from 'ngx-tethys/shared';
|
|
17
|
+
import { injectLocale } from 'ngx-tethys/i18n';
|
|
18
18
|
|
|
19
19
|
const hoursPerDay = 24;
|
|
20
20
|
const hoursPerDayHalf = 12;
|
|
@@ -33,10 +33,12 @@ function isValidDate(value) {
|
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
35
|
function isValidLimit(controls, newDate) {
|
|
36
|
-
|
|
36
|
+
const min = isFunction(controls.min) ? controls.min() : controls.min;
|
|
37
|
+
const max = isFunction(controls.max) ? controls.max() : controls.max;
|
|
38
|
+
if (min && newDate < min) {
|
|
37
39
|
return false;
|
|
38
40
|
}
|
|
39
|
-
if (
|
|
41
|
+
if (max && newDate > max) {
|
|
40
42
|
return false;
|
|
41
43
|
}
|
|
42
44
|
return true;
|
|
@@ -146,14 +148,18 @@ function isInputValid(hours, minutes = '0', seconds = '0', isPM) {
|
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
function canChangeValue(state, event) {
|
|
149
|
-
|
|
151
|
+
const mousewheel = state.mousewheel();
|
|
152
|
+
const arrowKeys = state.arrowKeys();
|
|
153
|
+
const readonlyInput = state.readonlyInput();
|
|
154
|
+
const disabled = state.disabled();
|
|
155
|
+
if (readonlyInput || disabled) {
|
|
150
156
|
return false;
|
|
151
157
|
}
|
|
152
158
|
if (event) {
|
|
153
|
-
if (event.source === 'wheel' && !
|
|
159
|
+
if (event.source === 'wheel' && !mousewheel) {
|
|
154
160
|
return false;
|
|
155
161
|
}
|
|
156
|
-
if (event.source === 'key' && !
|
|
162
|
+
if (event.source === 'key' && !arrowKeys) {
|
|
157
163
|
return false;
|
|
158
164
|
}
|
|
159
165
|
}
|
|
@@ -215,7 +221,12 @@ function getControlsValue(state) {
|
|
|
215
221
|
}
|
|
216
222
|
function timePickerControls(value, state) {
|
|
217
223
|
const hoursPerDayHalf = 12;
|
|
218
|
-
const
|
|
224
|
+
const min = state.min();
|
|
225
|
+
const max = state.max();
|
|
226
|
+
const hourStep = state.hourStep();
|
|
227
|
+
const minuteStep = state.minuteStep();
|
|
228
|
+
const secondsStep = state.secondsStep();
|
|
229
|
+
const showSeconds = state.showSeconds();
|
|
219
230
|
const res = {
|
|
220
231
|
canIncrementHours: true,
|
|
221
232
|
canIncrementMinutes: true,
|
|
@@ -336,7 +347,9 @@ class ThyTimePickerStore extends MiniStore {
|
|
|
336
347
|
return state;
|
|
337
348
|
}
|
|
338
349
|
const _newTime = changeTime(state.value, { hour: event.step }, timeZone);
|
|
339
|
-
|
|
350
|
+
const max = state.config.max();
|
|
351
|
+
const min = state.config.min();
|
|
352
|
+
if ((max || min) && !isValidLimit(state.config, _newTime)) {
|
|
340
353
|
return state;
|
|
341
354
|
}
|
|
342
355
|
this.setState({ value: _newTime });
|
|
@@ -347,7 +360,9 @@ class ThyTimePickerStore extends MiniStore {
|
|
|
347
360
|
return state;
|
|
348
361
|
}
|
|
349
362
|
const _newTime = changeTime(state.value, { minute: event.step }, timeZone);
|
|
350
|
-
|
|
363
|
+
const max = state.config.max();
|
|
364
|
+
const min = state.config.min();
|
|
365
|
+
if ((max || min) && !isValidLimit(state.config, _newTime)) {
|
|
351
366
|
return state;
|
|
352
367
|
}
|
|
353
368
|
this.setState({ value: _newTime });
|
|
@@ -360,7 +375,9 @@ class ThyTimePickerStore extends MiniStore {
|
|
|
360
375
|
const _newTime = changeTime(state.value, {
|
|
361
376
|
seconds: event.step
|
|
362
377
|
}, timeZone);
|
|
363
|
-
|
|
378
|
+
const max = state.config.max();
|
|
379
|
+
const min = state.config.min();
|
|
380
|
+
if ((max || min) && !isValidLimit(state.config, _newTime)) {
|
|
364
381
|
return state;
|
|
365
382
|
}
|
|
366
383
|
this.setState({ value: _newTime });
|
|
@@ -381,7 +398,9 @@ class ThyTimePickerStore extends MiniStore {
|
|
|
381
398
|
config: value,
|
|
382
399
|
controls: _newControlsState
|
|
383
400
|
};
|
|
384
|
-
|
|
401
|
+
const showMeridian = isFunction(state.config.showMeridian) ? state.config.showMeridian() : state.config.showMeridian;
|
|
402
|
+
const newShowMeridian = isFunction(_newState.config.showMeridian) ? _newState.config.showMeridian() : _newState.config.showMeridian;
|
|
403
|
+
if (showMeridian !== newShowMeridian) {
|
|
385
404
|
if (state.value) {
|
|
386
405
|
_newState.value = new TinyDate(state.value, timeZone)?.nativeDate;
|
|
387
406
|
}
|
|
@@ -440,14 +459,50 @@ const TIMEPICKER_CONTROL_VALUE_ACCESSOR = {
|
|
|
440
459
|
* @internal
|
|
441
460
|
*/
|
|
442
461
|
class ThyInnerTimePicker {
|
|
443
|
-
get isEditable() {
|
|
444
|
-
return !(this.readonlyInput || this.disabled);
|
|
445
|
-
}
|
|
446
462
|
constructor() {
|
|
447
463
|
this._cd = inject(ChangeDetectorRef);
|
|
448
464
|
this._store = inject(ThyTimePickerStore);
|
|
465
|
+
this._config = inject(TimePickerConfig);
|
|
466
|
+
/** hours change step */
|
|
467
|
+
this.hourStep = input(this._config.hourStep);
|
|
468
|
+
/** minutes change step */
|
|
469
|
+
this.minuteStep = input(this._config.minuteStep);
|
|
470
|
+
/** seconds change step */
|
|
471
|
+
this.secondsStep = input(this._config.secondsStep);
|
|
472
|
+
/** if true hours and minutes fields will be readonly */
|
|
473
|
+
this.readonlyInput = input(this._config.readonlyInput);
|
|
474
|
+
/** if true hours and minutes fields will be disabled */
|
|
475
|
+
this.disabled = model(this._config.disabled);
|
|
476
|
+
/** if true scroll inside hours and minutes inputs will change time */
|
|
477
|
+
this.mousewheel = input(this._config.mousewheel);
|
|
478
|
+
/** if true the values of hours and minutes can be changed using the up/down arrow keys on the keyboard */
|
|
479
|
+
this.arrowKeys = input(this._config.arrowKeys);
|
|
480
|
+
/** if true spinner arrows above and below the inputs will be shown */
|
|
481
|
+
this.showSpinners = input(this._config.showSpinners);
|
|
482
|
+
/** if true meridian button will be shown */
|
|
483
|
+
this.showMeridian = input(this._config.showMeridian);
|
|
484
|
+
/** show minutes in timePicker */
|
|
485
|
+
this.showMinutes = input(this._config.showMinutes);
|
|
486
|
+
/** show seconds in timePicker */
|
|
487
|
+
this.showSeconds = input(this._config.showSeconds);
|
|
488
|
+
/** meridian labels based on locale */
|
|
489
|
+
this.meridians = input(this._config.meridians);
|
|
490
|
+
/** minimum time user can select */
|
|
491
|
+
this.min = input(this._config.min);
|
|
492
|
+
/** maximum time user can select */
|
|
493
|
+
this.max = input(this._config.max);
|
|
494
|
+
/** placeholder for hours field in timePicker */
|
|
495
|
+
this.hoursPlaceholder = input(this._config.hoursPlaceholder);
|
|
496
|
+
/** placeholder for minutes field in timePicker */
|
|
497
|
+
this.minutesPlaceholder = input(this._config.minutesPlaceholder);
|
|
498
|
+
/** placeholder for seconds field in timePicker */
|
|
499
|
+
this.secondsPlaceholder = input(this._config.secondsPlaceholder);
|
|
500
|
+
/** timezone */
|
|
501
|
+
this.timeZone = input();
|
|
449
502
|
/** emits true if value is a valid date */
|
|
450
|
-
this.isValid =
|
|
503
|
+
this.isValid = output();
|
|
504
|
+
this.isEditable = computed(() => !(this.readonlyInput() || this.disabled()));
|
|
505
|
+
this.isPM = computed(() => this.showMeridian() && this.meridian === this.meridians()[1]);
|
|
451
506
|
// min/max validation for input fields
|
|
452
507
|
this.invalidHours = false;
|
|
453
508
|
this.invalidMinutes = false;
|
|
@@ -456,17 +511,15 @@ class ThyInnerTimePicker {
|
|
|
456
511
|
this.onChange = Function.prototype;
|
|
457
512
|
this.onTouched = Function.prototype;
|
|
458
513
|
this.timerPickerSubscription = new Subscription();
|
|
459
|
-
const _config = inject(TimePickerConfig);
|
|
460
514
|
const _cd = this._cd;
|
|
461
515
|
const _store = this._store;
|
|
462
|
-
Object.assign(this, _config);
|
|
463
516
|
this.timerPickerSubscription.add(_store
|
|
464
517
|
.select(state => state.value)
|
|
465
518
|
.subscribe((value) => {
|
|
466
519
|
// update UI values if date changed
|
|
467
520
|
this._renderTime(value);
|
|
468
521
|
this.onChange(value);
|
|
469
|
-
this._store.updateControls(getControlsValue(this), this.timeZone);
|
|
522
|
+
this._store.updateControls(getControlsValue(this), this.timeZone());
|
|
470
523
|
}));
|
|
471
524
|
this.timerPickerSubscription.add(_store
|
|
472
525
|
.select(state => state.controls)
|
|
@@ -481,29 +534,23 @@ class ThyInnerTimePicker {
|
|
|
481
534
|
this.invalidMinutes = false;
|
|
482
535
|
this.invalidSeconds = false;
|
|
483
536
|
}
|
|
484
|
-
isPM() {
|
|
485
|
-
return this.showMeridian && this.meridian === this.meridians[1];
|
|
486
|
-
}
|
|
487
537
|
prevDef($event) {
|
|
488
538
|
$event.preventDefault();
|
|
489
539
|
}
|
|
490
540
|
wheelSign($event) {
|
|
491
541
|
return Math.sign($event.deltaY) * -1;
|
|
492
542
|
}
|
|
493
|
-
ngOnChanges(changes) {
|
|
494
|
-
this._store.updateControls(getControlsValue(this), this.timeZone);
|
|
495
|
-
}
|
|
496
543
|
changeHours(step, source = '') {
|
|
497
544
|
this.resetValidation();
|
|
498
|
-
this._store.changeHours({ step, source }, this.timeZone);
|
|
545
|
+
this._store.changeHours({ step, source }, this.timeZone());
|
|
499
546
|
}
|
|
500
547
|
changeMinutes(step, source = '') {
|
|
501
548
|
this.resetValidation();
|
|
502
|
-
this._store.changeMinutes({ step, source }, this.timeZone);
|
|
549
|
+
this._store.changeMinutes({ step, source }, this.timeZone());
|
|
503
550
|
}
|
|
504
551
|
changeSeconds(step, source = '') {
|
|
505
552
|
this.resetValidation();
|
|
506
|
-
this._store.changeSeconds({ step, source }, this.timeZone);
|
|
553
|
+
this._store.changeSeconds({ step, source }, this.timeZone());
|
|
507
554
|
}
|
|
508
555
|
updateHours(hours) {
|
|
509
556
|
this.resetValidation();
|
|
@@ -547,11 +594,11 @@ class ThyInnerTimePicker {
|
|
|
547
594
|
minute: this.minutes,
|
|
548
595
|
seconds: this.seconds,
|
|
549
596
|
isPM: this.isPM()
|
|
550
|
-
}, this.max, this.min, this.timeZone);
|
|
597
|
+
}, this.max(), this.min(), this.timeZone());
|
|
551
598
|
}
|
|
552
599
|
_updateTime() {
|
|
553
|
-
const _seconds = this.showSeconds ? this.seconds : void 0;
|
|
554
|
-
const _minutes = this.showMinutes ? this.minutes : void 0;
|
|
600
|
+
const _seconds = this.showSeconds() ? this.seconds : void 0;
|
|
601
|
+
const _minutes = this.showMinutes() ? this.minutes : void 0;
|
|
555
602
|
if (!isInputValid(this.hours, _minutes, _seconds, this.isPM())) {
|
|
556
603
|
this.isValid.emit(false);
|
|
557
604
|
this.onChange(null);
|
|
@@ -562,10 +609,10 @@ class ThyInnerTimePicker {
|
|
|
562
609
|
minute: this.minutes,
|
|
563
610
|
seconds: this.seconds,
|
|
564
611
|
isPM: this.isPM()
|
|
565
|
-
}, this.timeZone);
|
|
612
|
+
}, this.timeZone());
|
|
566
613
|
}
|
|
567
614
|
toggleMeridian() {
|
|
568
|
-
if (!this.showMeridian || !this.isEditable) {
|
|
615
|
+
if (!this.showMeridian() || !this.isEditable()) {
|
|
569
616
|
return;
|
|
570
617
|
}
|
|
571
618
|
const _hoursPerDayHalf = 12;
|
|
@@ -576,7 +623,7 @@ class ThyInnerTimePicker {
|
|
|
576
623
|
}
|
|
577
624
|
writeValue(obj) {
|
|
578
625
|
if (isValidDate(obj)) {
|
|
579
|
-
this._store.writeValue(parseTime(obj, this.timeZone));
|
|
626
|
+
this._store.writeValue(parseTime(obj, this.timeZone()));
|
|
580
627
|
}
|
|
581
628
|
else if (obj == null) {
|
|
582
629
|
this._store.writeValue(null);
|
|
@@ -589,7 +636,7 @@ class ThyInnerTimePicker {
|
|
|
589
636
|
this.onTouched = fn;
|
|
590
637
|
}
|
|
591
638
|
setDisabledState(isDisabled) {
|
|
592
|
-
this.disabled
|
|
639
|
+
this.disabled.set(isDisabled);
|
|
593
640
|
this._cd.markForCheck();
|
|
594
641
|
}
|
|
595
642
|
ngOnDestroy() {
|
|
@@ -600,14 +647,14 @@ class ThyInnerTimePicker {
|
|
|
600
647
|
this.hours = '';
|
|
601
648
|
this.minutes = '';
|
|
602
649
|
this.seconds = '';
|
|
603
|
-
this.meridian = this.meridians[0];
|
|
650
|
+
this.meridian = this.meridians()[0];
|
|
604
651
|
return;
|
|
605
652
|
}
|
|
606
|
-
const _value = parseTime(value, this.timeZone);
|
|
653
|
+
const _value = parseTime(value, this.timeZone());
|
|
607
654
|
const _hoursPerDayHalf = 12;
|
|
608
655
|
let _hours = _value.getHours();
|
|
609
|
-
if (this.showMeridian) {
|
|
610
|
-
this.meridian = this.meridians[_hours >= _hoursPerDayHalf ? 1 : 0];
|
|
656
|
+
if (this.showMeridian()) {
|
|
657
|
+
this.meridian = this.meridians()[_hours >= _hoursPerDayHalf ? 1 : 0];
|
|
611
658
|
_hours = _hours % _hoursPerDayHalf;
|
|
612
659
|
// should be 12 PM, not 00 PM
|
|
613
660
|
if (_hours === 0) {
|
|
@@ -619,50 +666,12 @@ class ThyInnerTimePicker {
|
|
|
619
666
|
this.seconds = padNumber(_value.getUTCSeconds());
|
|
620
667
|
}
|
|
621
668
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInnerTimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
622
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyInnerTimePicker, isStandalone: true, selector: "thy-inner-time-picker", inputs: { hourStep: "hourStep", minuteStep: "minuteStep", secondsStep: "secondsStep", readonlyInput: "readonlyInput", disabled: "disabled", mousewheel: "mousewheel", arrowKeys: "arrowKeys", showSpinners: "showSpinners", showMeridian: "showMeridian", showMinutes: "showMinutes", showSeconds: "showSeconds", meridians: "meridians", min: "min", max: "max", hoursPlaceholder: "hoursPlaceholder", minutesPlaceholder: "minutesPlaceholder", secondsPlaceholder: "secondsPlaceholder", timeZone: "timeZone" }, outputs: { isValid: "isValid" }, providers: [TIMEPICKER_CONTROL_VALUE_ACCESSOR, ThyTimePickerStore],
|
|
669
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyInnerTimePicker, isStandalone: true, selector: "thy-inner-time-picker", inputs: { hourStep: { classPropertyName: "hourStep", publicName: "hourStep", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, secondsStep: { classPropertyName: "secondsStep", publicName: "secondsStep", isSignal: true, isRequired: false, transformFunction: null }, readonlyInput: { classPropertyName: "readonlyInput", publicName: "readonlyInput", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, mousewheel: { classPropertyName: "mousewheel", publicName: "mousewheel", isSignal: true, isRequired: false, transformFunction: null }, arrowKeys: { classPropertyName: "arrowKeys", publicName: "arrowKeys", isSignal: true, isRequired: false, transformFunction: null }, showSpinners: { classPropertyName: "showSpinners", publicName: "showSpinners", isSignal: true, isRequired: false, transformFunction: null }, showMeridian: { classPropertyName: "showMeridian", publicName: "showMeridian", isSignal: true, isRequired: false, transformFunction: null }, showMinutes: { classPropertyName: "showMinutes", publicName: "showMinutes", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, meridians: { classPropertyName: "meridians", publicName: "meridians", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, hoursPlaceholder: { classPropertyName: "hoursPlaceholder", publicName: "hoursPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, minutesPlaceholder: { classPropertyName: "minutesPlaceholder", publicName: "minutesPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, secondsPlaceholder: { classPropertyName: "secondsPlaceholder", publicName: "secondsPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, timeZone: { classPropertyName: "timeZone", publicName: "timeZone", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", isValid: "isValid" }, providers: [TIMEPICKER_CONTROL_VALUE_ACCESSOR, ThyTimePickerStore], ngImport: i0, template: "<table>\n <tbody>\n <tr class=\"text-center\" [hidden]=\"!showSpinners()\">\n <!-- increment hours button-->\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canIncrementHours || !isEditable()\" (click)=\"changeHours(hourStep())\"\n ><span class=\"thy-chevron thy-chevron-up\"></span\n ></a>\n </td>\n <!-- divider -->\n @if (showMinutes()) {\n <td> </td>\n }\n <!-- increment minutes button -->\n @if (showMinutes()) {\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canIncrementMinutes || !isEditable()\" (click)=\"changeMinutes(minuteStep())\"\n ><span class=\"thy-chevron thy-chevron-up\"></span\n ></a>\n </td>\n }\n <!-- divider -->\n @if (showSeconds()) {\n <td> </td>\n }\n <!-- increment seconds button -->\n @if (showSeconds()) {\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canIncrementSeconds || !isEditable()\" (click)=\"changeSeconds(secondsStep())\">\n <span class=\"thy-chevron thy-chevron-up\"></span>\n </a>\n </td>\n }\n <!-- space between -->\n @if (showMeridian()) {\n <td> </td>\n }\n <!-- meridian placeholder-->\n @if (showMeridian()) {\n <td></td>\n }\n </tr>\n <tr>\n <!-- hours -->\n <td class=\"form-group\" [class.has-error]=\"invalidHours\">\n <input\n type=\"text\"\n [class.is-invalid]=\"invalidHours\"\n class=\"form-control text-center thy-time-picker-field\"\n [placeholder]=\"hoursPlaceholder()\"\n maxlength=\"2\"\n [readonly]=\"readonlyInput()\"\n [disabled]=\"disabled()\"\n [value]=\"hours\"\n (wheel)=\"prevDef($event); changeHours(hourStep() * wheelSign($event), 'wheel')\"\n (keydown.ArrowUp)=\"changeHours(hourStep(), 'key')\"\n (keydown.ArrowDown)=\"changeHours(-hourStep(), 'key')\"\n (change)=\"updateHours($event.target.value)\" />\n </td>\n\n <!-- divider -->\n @if (showMinutes()) {\n <td> : </td>\n }\n <!-- minutes -->\n @if (showMinutes()) {\n <td class=\"form-group\" [class.has-error]=\"invalidMinutes\">\n <input\n type=\"text\"\n [class.is-invalid]=\"invalidMinutes\"\n class=\"form-control text-center thy-time-picker-field\"\n [placeholder]=\"minutesPlaceholder()\"\n maxlength=\"2\"\n [readonly]=\"readonlyInput()\"\n [disabled]=\"disabled()\"\n [value]=\"minutes\"\n (wheel)=\"prevDef($event); changeMinutes(minuteStep() * wheelSign($event), 'wheel')\"\n (keydown.ArrowUp)=\"changeMinutes(minuteStep(), 'key')\"\n (keydown.ArrowDown)=\"changeMinutes(-minuteStep(), 'key')\"\n (change)=\"updateMinutes($event.target.value)\" />\n </td>\n }\n <!-- divider -->\n @if (showSeconds()) {\n <td> : </td>\n }\n <!-- seconds -->\n @if (showSeconds()) {\n <td class=\"form-group\" [class.has-error]=\"invalidSeconds\">\n <input\n type=\"text\"\n [class.is-invalid]=\"invalidSeconds\"\n class=\"form-control text-center thy-time-picker-field\"\n [placeholder]=\"secondsPlaceholder()\"\n maxlength=\"2\"\n [readonly]=\"readonlyInput()\"\n [disabled]=\"disabled()\"\n [value]=\"seconds\"\n (wheel)=\"prevDef($event); changeSeconds(secondsStep() * wheelSign($event), 'wheel')\"\n (keydown.ArrowUp)=\"changeSeconds(secondsStep(), 'key')\"\n (keydown.ArrowDown)=\"changeSeconds(-secondsStep(), 'key')\"\n (change)=\"updateSeconds($event.target.value)\" />\n </td>\n }\n <!-- space between -->\n @if (showMeridian()) {\n <td> </td>\n }\n <!-- meridian -->\n @if (showMeridian()) {\n <td>\n <button\n type=\"button\"\n class=\"btn btn-default text-center\"\n [disabled]=\"!isEditable() || !canToggleMeridian\"\n [class.disabled]=\"!isEditable() || !canToggleMeridian\"\n (click)=\"toggleMeridian()\">\n {{ meridian }}\n </button>\n </td>\n }\n </tr>\n <tr class=\"text-center\" [hidden]=\"!showSpinners()\">\n <!-- decrement hours button-->\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canDecrementHours || !isEditable()\" (click)=\"changeHours(-hourStep())\">\n <span class=\"thy-chevron thy-chevron-down\"></span>\n </a>\n </td>\n <!-- divider -->\n @if (showMinutes()) {\n <td> </td>\n }\n <!-- decrement minutes button-->\n @if (showMinutes()) {\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canDecrementMinutes || !isEditable()\" (click)=\"changeMinutes(-minuteStep())\">\n <span class=\"thy-chevron thy-chevron-down\"></span>\n </a>\n </td>\n }\n <!-- divider -->\n @if (showSeconds()) {\n <td> </td>\n }\n <!-- decrement seconds button-->\n @if (showSeconds()) {\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canDecrementSeconds || !isEditable()\" (click)=\"changeSeconds(-secondsStep())\">\n <span class=\"thy-chevron thy-chevron-down\"></span>\n </a>\n </td>\n }\n <!-- space between -->\n @if (showMeridian()) {\n <td> </td>\n }\n <!-- meridian placeholder-->\n @if (showMeridian()) {\n <td></td>\n }\n </tr>\n </tbody>\n</table>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
623
670
|
}
|
|
624
671
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInnerTimePicker, decorators: [{
|
|
625
672
|
type: Component,
|
|
626
|
-
args: [{ selector: 'thy-inner-time-picker', changeDetection: ChangeDetectionStrategy.OnPush, providers: [TIMEPICKER_CONTROL_VALUE_ACCESSOR, ThyTimePickerStore], imports: [], template: "<table>\n <tbody>\n <tr class=\"text-center\" [hidden]=\"!showSpinners\">\n <!-- increment hours button-->\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canIncrementHours || !isEditable\" (click)=\"changeHours(hourStep)\"\n ><span class=\"thy-chevron thy-chevron-up\"></span\n ></a>\n </td>\n <!-- divider -->\n @if (showMinutes) {\n <td> </td>\n }\n <!-- increment minutes button -->\n @if (showMinutes) {\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canIncrementMinutes || !isEditable\" (click)=\"changeMinutes(minuteStep)\"\n ><span class=\"thy-chevron thy-chevron-up\"></span\n ></a>\n </td>\n }\n <!-- divider -->\n @if (showSeconds) {\n <td> </td>\n }\n <!-- increment seconds button -->\n @if (showSeconds) {\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canIncrementSeconds || !isEditable\" (click)=\"changeSeconds(secondsStep)\">\n <span class=\"thy-chevron thy-chevron-up\"></span>\n </a>\n </td>\n }\n <!-- space between -->\n @if (showMeridian) {\n <td> </td>\n }\n <!-- meridian placeholder-->\n @if (showMeridian) {\n <td></td>\n }\n </tr>\n <tr>\n <!-- hours -->\n <td class=\"form-group\" [class.has-error]=\"invalidHours\">\n <input\n type=\"text\"\n [class.is-invalid]=\"invalidHours\"\n class=\"form-control text-center thy-time-picker-field\"\n [placeholder]=\"hoursPlaceholder\"\n maxlength=\"2\"\n [readonly]=\"readonlyInput\"\n [disabled]=\"disabled\"\n [value]=\"hours\"\n (wheel)=\"prevDef($event); changeHours(hourStep * wheelSign($event), 'wheel')\"\n (keydown.ArrowUp)=\"changeHours(hourStep, 'key')\"\n (keydown.ArrowDown)=\"changeHours(-hourStep, 'key')\"\n (change)=\"updateHours($event.target.value)\"
|
|
627
|
-
}], ctorParameters: () => []
|
|
628
|
-
type: Input
|
|
629
|
-
}], minuteStep: [{
|
|
630
|
-
type: Input
|
|
631
|
-
}], secondsStep: [{
|
|
632
|
-
type: Input
|
|
633
|
-
}], readonlyInput: [{
|
|
634
|
-
type: Input
|
|
635
|
-
}], disabled: [{
|
|
636
|
-
type: Input
|
|
637
|
-
}], mousewheel: [{
|
|
638
|
-
type: Input
|
|
639
|
-
}], arrowKeys: [{
|
|
640
|
-
type: Input
|
|
641
|
-
}], showSpinners: [{
|
|
642
|
-
type: Input
|
|
643
|
-
}], showMeridian: [{
|
|
644
|
-
type: Input
|
|
645
|
-
}], showMinutes: [{
|
|
646
|
-
type: Input
|
|
647
|
-
}], showSeconds: [{
|
|
648
|
-
type: Input
|
|
649
|
-
}], meridians: [{
|
|
650
|
-
type: Input
|
|
651
|
-
}], min: [{
|
|
652
|
-
type: Input
|
|
653
|
-
}], max: [{
|
|
654
|
-
type: Input
|
|
655
|
-
}], hoursPlaceholder: [{
|
|
656
|
-
type: Input
|
|
657
|
-
}], minutesPlaceholder: [{
|
|
658
|
-
type: Input
|
|
659
|
-
}], secondsPlaceholder: [{
|
|
660
|
-
type: Input
|
|
661
|
-
}], timeZone: [{
|
|
662
|
-
type: Input
|
|
663
|
-
}], isValid: [{
|
|
664
|
-
type: Output
|
|
665
|
-
}] } });
|
|
673
|
+
args: [{ selector: 'thy-inner-time-picker', changeDetection: ChangeDetectionStrategy.OnPush, providers: [TIMEPICKER_CONTROL_VALUE_ACCESSOR, ThyTimePickerStore], imports: [], template: "<table>\n <tbody>\n <tr class=\"text-center\" [hidden]=\"!showSpinners()\">\n <!-- increment hours button-->\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canIncrementHours || !isEditable()\" (click)=\"changeHours(hourStep())\"\n ><span class=\"thy-chevron thy-chevron-up\"></span\n ></a>\n </td>\n <!-- divider -->\n @if (showMinutes()) {\n <td> </td>\n }\n <!-- increment minutes button -->\n @if (showMinutes()) {\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canIncrementMinutes || !isEditable()\" (click)=\"changeMinutes(minuteStep())\"\n ><span class=\"thy-chevron thy-chevron-up\"></span\n ></a>\n </td>\n }\n <!-- divider -->\n @if (showSeconds()) {\n <td> </td>\n }\n <!-- increment seconds button -->\n @if (showSeconds()) {\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canIncrementSeconds || !isEditable()\" (click)=\"changeSeconds(secondsStep())\">\n <span class=\"thy-chevron thy-chevron-up\"></span>\n </a>\n </td>\n }\n <!-- space between -->\n @if (showMeridian()) {\n <td> </td>\n }\n <!-- meridian placeholder-->\n @if (showMeridian()) {\n <td></td>\n }\n </tr>\n <tr>\n <!-- hours -->\n <td class=\"form-group\" [class.has-error]=\"invalidHours\">\n <input\n type=\"text\"\n [class.is-invalid]=\"invalidHours\"\n class=\"form-control text-center thy-time-picker-field\"\n [placeholder]=\"hoursPlaceholder()\"\n maxlength=\"2\"\n [readonly]=\"readonlyInput()\"\n [disabled]=\"disabled()\"\n [value]=\"hours\"\n (wheel)=\"prevDef($event); changeHours(hourStep() * wheelSign($event), 'wheel')\"\n (keydown.ArrowUp)=\"changeHours(hourStep(), 'key')\"\n (keydown.ArrowDown)=\"changeHours(-hourStep(), 'key')\"\n (change)=\"updateHours($event.target.value)\" />\n </td>\n\n <!-- divider -->\n @if (showMinutes()) {\n <td> : </td>\n }\n <!-- minutes -->\n @if (showMinutes()) {\n <td class=\"form-group\" [class.has-error]=\"invalidMinutes\">\n <input\n type=\"text\"\n [class.is-invalid]=\"invalidMinutes\"\n class=\"form-control text-center thy-time-picker-field\"\n [placeholder]=\"minutesPlaceholder()\"\n maxlength=\"2\"\n [readonly]=\"readonlyInput()\"\n [disabled]=\"disabled()\"\n [value]=\"minutes\"\n (wheel)=\"prevDef($event); changeMinutes(minuteStep() * wheelSign($event), 'wheel')\"\n (keydown.ArrowUp)=\"changeMinutes(minuteStep(), 'key')\"\n (keydown.ArrowDown)=\"changeMinutes(-minuteStep(), 'key')\"\n (change)=\"updateMinutes($event.target.value)\" />\n </td>\n }\n <!-- divider -->\n @if (showSeconds()) {\n <td> : </td>\n }\n <!-- seconds -->\n @if (showSeconds()) {\n <td class=\"form-group\" [class.has-error]=\"invalidSeconds\">\n <input\n type=\"text\"\n [class.is-invalid]=\"invalidSeconds\"\n class=\"form-control text-center thy-time-picker-field\"\n [placeholder]=\"secondsPlaceholder()\"\n maxlength=\"2\"\n [readonly]=\"readonlyInput()\"\n [disabled]=\"disabled()\"\n [value]=\"seconds\"\n (wheel)=\"prevDef($event); changeSeconds(secondsStep() * wheelSign($event), 'wheel')\"\n (keydown.ArrowUp)=\"changeSeconds(secondsStep(), 'key')\"\n (keydown.ArrowDown)=\"changeSeconds(-secondsStep(), 'key')\"\n (change)=\"updateSeconds($event.target.value)\" />\n </td>\n }\n <!-- space between -->\n @if (showMeridian()) {\n <td> </td>\n }\n <!-- meridian -->\n @if (showMeridian()) {\n <td>\n <button\n type=\"button\"\n class=\"btn btn-default text-center\"\n [disabled]=\"!isEditable() || !canToggleMeridian\"\n [class.disabled]=\"!isEditable() || !canToggleMeridian\"\n (click)=\"toggleMeridian()\">\n {{ meridian }}\n </button>\n </td>\n }\n </tr>\n <tr class=\"text-center\" [hidden]=\"!showSpinners()\">\n <!-- decrement hours button-->\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canDecrementHours || !isEditable()\" (click)=\"changeHours(-hourStep())\">\n <span class=\"thy-chevron thy-chevron-down\"></span>\n </a>\n </td>\n <!-- divider -->\n @if (showMinutes()) {\n <td> </td>\n }\n <!-- decrement minutes button-->\n @if (showMinutes()) {\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canDecrementMinutes || !isEditable()\" (click)=\"changeMinutes(-minuteStep())\">\n <span class=\"thy-chevron thy-chevron-down\"></span>\n </a>\n </td>\n }\n <!-- divider -->\n @if (showSeconds()) {\n <td> </td>\n }\n <!-- decrement seconds button-->\n @if (showSeconds()) {\n <td>\n <a class=\"btn btn-link\" [class.disabled]=\"!canDecrementSeconds || !isEditable()\" (click)=\"changeSeconds(-secondsStep())\">\n <span class=\"thy-chevron thy-chevron-down\"></span>\n </a>\n </td>\n }\n <!-- space between -->\n @if (showMeridian()) {\n <td> </td>\n }\n <!-- meridian placeholder-->\n @if (showMeridian()) {\n <td></td>\n }\n </tr>\n </tbody>\n</table>\n" }]
|
|
674
|
+
}], ctorParameters: () => [] });
|
|
666
675
|
|
|
667
676
|
/**
|
|
668
677
|
* 时间选择面板组件
|
|
@@ -673,41 +682,50 @@ class ThyTimePanel {
|
|
|
673
682
|
this.cdr = inject(ChangeDetectorRef);
|
|
674
683
|
this.ngZone = inject(NgZone);
|
|
675
684
|
this.locale = injectLocale('timePicker');
|
|
685
|
+
this.hourListRef = viewChild('hourListElement');
|
|
686
|
+
this.minuteListRef = viewChild('minuteListElement');
|
|
687
|
+
this.secondListRef = viewChild('secondListElement');
|
|
688
|
+
/**
|
|
689
|
+
* 展示的日期格式,支持 'HH:mm:ss' | 'HH:mm' | 'mm:ss'
|
|
690
|
+
* @type string
|
|
691
|
+
* @default HH:mm:ss
|
|
692
|
+
*/
|
|
693
|
+
this.thyFormat = input('HH:mm:ss');
|
|
676
694
|
/**
|
|
677
695
|
* 小时间隔步长
|
|
678
696
|
* @type number
|
|
679
697
|
*/
|
|
680
|
-
this.thyHourStep = 1;
|
|
698
|
+
this.thyHourStep = input(1);
|
|
681
699
|
/**
|
|
682
700
|
* 分钟间隔步长
|
|
683
701
|
* @type number
|
|
684
702
|
*/
|
|
685
|
-
this.thyMinuteStep = 1;
|
|
703
|
+
this.thyMinuteStep = input(1);
|
|
686
704
|
/**
|
|
687
705
|
* 秒间隔步长
|
|
688
706
|
* @type number
|
|
689
707
|
*/
|
|
690
|
-
this.thySecondStep = 1;
|
|
708
|
+
this.thySecondStep = input(1);
|
|
691
709
|
/**
|
|
692
710
|
* 展示选择此刻
|
|
693
711
|
* @type boolean
|
|
694
712
|
*/
|
|
695
|
-
this.thyShowSelectNow = true;
|
|
713
|
+
this.thyShowSelectNow = input(true, { transform: coerceBooleanProperty });
|
|
696
714
|
/**
|
|
697
715
|
* 展示底部操作
|
|
698
716
|
* @type boolean
|
|
699
717
|
*/
|
|
700
|
-
this.thyShowOperations = true;
|
|
718
|
+
this.thyShowOperations = input(true, { transform: coerceBooleanProperty });
|
|
701
719
|
/**
|
|
702
720
|
* 选择时间触发的事件
|
|
703
721
|
* @type EventEmitter<Date>
|
|
704
722
|
*/
|
|
705
|
-
this.thyPickChange =
|
|
723
|
+
this.thyPickChange = output();
|
|
706
724
|
/**
|
|
707
725
|
* 关闭面板事件
|
|
708
726
|
* @type EventEmitter<void>
|
|
709
727
|
*/
|
|
710
|
-
this.thyClosePanel =
|
|
728
|
+
this.thyClosePanel = output();
|
|
711
729
|
// margin-top + 1px border
|
|
712
730
|
this.SCROLL_OFFSET_SPACING = 5;
|
|
713
731
|
this.SCROLL_DEFAULT_DURATION = 120;
|
|
@@ -715,33 +733,36 @@ class ThyTimePanel {
|
|
|
715
733
|
this.hourRange = [];
|
|
716
734
|
this.minuteRange = [];
|
|
717
735
|
this.secondRange = [];
|
|
718
|
-
this.showHourColumn =
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
736
|
+
this.showHourColumn = computed(() => {
|
|
737
|
+
const format = this.thyFormat();
|
|
738
|
+
if (format) {
|
|
739
|
+
return new Set(format).has('H') || new Set(format).has('h');
|
|
740
|
+
}
|
|
741
|
+
return true;
|
|
742
|
+
});
|
|
743
|
+
this.showMinuteColumn = computed(() => {
|
|
744
|
+
const format = this.thyFormat();
|
|
745
|
+
if (format) {
|
|
746
|
+
return new Set(format).has('m');
|
|
747
|
+
}
|
|
748
|
+
return true;
|
|
749
|
+
});
|
|
750
|
+
this.showSecondColumn = computed(() => {
|
|
751
|
+
const format = this.thyFormat();
|
|
752
|
+
if (format) {
|
|
753
|
+
return new Set(format).has('s');
|
|
754
|
+
}
|
|
755
|
+
return true;
|
|
756
|
+
});
|
|
757
|
+
this.showColumnCount = computed(() => {
|
|
758
|
+
const showHour = this.showHourColumn();
|
|
759
|
+
const showMinute = this.showMinuteColumn();
|
|
760
|
+
const showSecond = this.showSecondColumn();
|
|
761
|
+
return [showHour, showMinute, showSecond].filter(m => m).length || 3;
|
|
762
|
+
});
|
|
722
763
|
this.onValueChangeFn = () => void 0;
|
|
723
764
|
this.onTouchedFn = () => void 0;
|
|
724
765
|
}
|
|
725
|
-
/**
|
|
726
|
-
* 展示的日期格式,支持 'HH:mm:ss' | 'HH:mm' | 'mm:ss'
|
|
727
|
-
* @type string
|
|
728
|
-
* @default HH:mm:ss
|
|
729
|
-
*/
|
|
730
|
-
set thyFormat(value) {
|
|
731
|
-
if (value) {
|
|
732
|
-
const formatSet = new Set(value);
|
|
733
|
-
this.showHourColumn = formatSet.has('H') || formatSet.has('h');
|
|
734
|
-
this.showMinuteColumn = formatSet.has('m');
|
|
735
|
-
this.showSecondColumn = formatSet.has('s');
|
|
736
|
-
}
|
|
737
|
-
else {
|
|
738
|
-
this.showHourColumn = true;
|
|
739
|
-
this.showMinuteColumn = true;
|
|
740
|
-
this.showSecondColumn = true;
|
|
741
|
-
}
|
|
742
|
-
this.showColumnCount = [this.showHourColumn, this.showMinuteColumn, this.showSecondColumn].filter(m => m).length;
|
|
743
|
-
this.cdr.markForCheck();
|
|
744
|
-
}
|
|
745
766
|
ngOnInit() {
|
|
746
767
|
this.generateTimeRange();
|
|
747
768
|
this.initialValue();
|
|
@@ -750,27 +771,27 @@ class ThyTimePanel {
|
|
|
750
771
|
});
|
|
751
772
|
}
|
|
752
773
|
generateTimeRange() {
|
|
753
|
-
this.hourRange = this.buildTimeRange(24, this.thyHourStep);
|
|
754
|
-
this.minuteRange = this.buildTimeRange(60, this.thyMinuteStep);
|
|
755
|
-
this.secondRange = this.buildTimeRange(60, this.thySecondStep);
|
|
774
|
+
this.hourRange = this.buildTimeRange(24, this.thyHourStep());
|
|
775
|
+
this.minuteRange = this.buildTimeRange(60, this.thyMinuteStep());
|
|
776
|
+
this.secondRange = this.buildTimeRange(60, this.thySecondStep());
|
|
756
777
|
}
|
|
757
778
|
pickHours(hours, index) {
|
|
758
779
|
this.value.setHours(hours.value);
|
|
759
780
|
this.hour = hours.value;
|
|
760
781
|
this.thyPickChange.emit(this.value);
|
|
761
|
-
this.scrollTo(this.hourListRef.nativeElement, index);
|
|
782
|
+
this.scrollTo(this.hourListRef().nativeElement, index);
|
|
762
783
|
}
|
|
763
784
|
pickMinutes(minutes, index) {
|
|
764
785
|
this.value.setMinutes(minutes.value);
|
|
765
786
|
this.minute = minutes.value;
|
|
766
787
|
this.thyPickChange.emit(this.value);
|
|
767
|
-
this.scrollTo(this.minuteListRef.nativeElement, index);
|
|
788
|
+
this.scrollTo(this.minuteListRef().nativeElement, index);
|
|
768
789
|
}
|
|
769
790
|
pickSeconds(seconds, index) {
|
|
770
791
|
this.value.setSeconds(seconds.value);
|
|
771
792
|
this.second = seconds.value;
|
|
772
793
|
this.thyPickChange.emit(this.value);
|
|
773
|
-
this.scrollTo(this.secondListRef.nativeElement, index);
|
|
794
|
+
this.scrollTo(this.secondListRef().nativeElement, index);
|
|
774
795
|
}
|
|
775
796
|
selectNow() {
|
|
776
797
|
this.value = new TinyDate()?.nativeDate;
|
|
@@ -824,14 +845,17 @@ class ThyTimePanel {
|
|
|
824
845
|
this.second = this.value.getSeconds();
|
|
825
846
|
}
|
|
826
847
|
resetScrollPosition() {
|
|
827
|
-
|
|
828
|
-
|
|
848
|
+
const hourListRef = this.hourListRef();
|
|
849
|
+
if (hourListRef) {
|
|
850
|
+
hourListRef.nativeElement.scrollTop = 0;
|
|
829
851
|
}
|
|
830
|
-
|
|
831
|
-
|
|
852
|
+
const minuteListRef = this.minuteListRef();
|
|
853
|
+
if (minuteListRef) {
|
|
854
|
+
minuteListRef.nativeElement.scrollTop = 0;
|
|
832
855
|
}
|
|
833
|
-
|
|
834
|
-
|
|
856
|
+
const secondListRef = this.secondListRef();
|
|
857
|
+
if (secondListRef) {
|
|
858
|
+
secondListRef.nativeElement.scrollTop = 0;
|
|
835
859
|
}
|
|
836
860
|
this.initialScrollPosition = false;
|
|
837
861
|
}
|
|
@@ -853,14 +877,17 @@ class ThyTimePanel {
|
|
|
853
877
|
});
|
|
854
878
|
}
|
|
855
879
|
autoScroll(duration = this.SCROLL_DEFAULT_DURATION) {
|
|
856
|
-
|
|
857
|
-
|
|
880
|
+
const hourListRef = this.hourListRef();
|
|
881
|
+
if (hourListRef) {
|
|
882
|
+
this.scrollTo(hourListRef.nativeElement, this.hourRange.findIndex(m => m.value === this.hour), duration);
|
|
858
883
|
}
|
|
859
|
-
|
|
860
|
-
|
|
884
|
+
const minuteListRef = this.minuteListRef();
|
|
885
|
+
if (minuteListRef) {
|
|
886
|
+
this.scrollTo(minuteListRef.nativeElement, this.minuteRange.findIndex(m => m.value === this.minute), duration);
|
|
861
887
|
}
|
|
862
|
-
|
|
863
|
-
|
|
888
|
+
const secondListRef = this.secondListRef();
|
|
889
|
+
if (secondListRef) {
|
|
890
|
+
this.scrollTo(secondListRef.nativeElement, this.secondRange.findIndex(m => m.value === this.second), duration);
|
|
864
891
|
}
|
|
865
892
|
}
|
|
866
893
|
ngOnDestroy() {
|
|
@@ -870,13 +897,13 @@ class ThyTimePanel {
|
|
|
870
897
|
}, 200);
|
|
871
898
|
}
|
|
872
899
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimePanel, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
873
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyTimePanel, isStandalone: true, selector: "thy-time-picker-panel", inputs: { thyFormat: "thyFormat", thyHourStep: "thyHourStep", thyMinuteStep: "thyMinuteStep", thySecondStep: "thySecondStep", thyShowSelectNow:
|
|
900
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyTimePanel, isStandalone: true, selector: "thy-time-picker-panel", inputs: { thyFormat: { classPropertyName: "thyFormat", publicName: "thyFormat", isSignal: true, isRequired: false, transformFunction: null }, thyHourStep: { classPropertyName: "thyHourStep", publicName: "thyHourStep", isSignal: true, isRequired: false, transformFunction: null }, thyMinuteStep: { classPropertyName: "thyMinuteStep", publicName: "thyMinuteStep", isSignal: true, isRequired: false, transformFunction: null }, thySecondStep: { classPropertyName: "thySecondStep", publicName: "thySecondStep", isSignal: true, isRequired: false, transformFunction: null }, thyShowSelectNow: { classPropertyName: "thyShowSelectNow", publicName: "thyShowSelectNow", isSignal: true, isRequired: false, transformFunction: null }, thyShowOperations: { classPropertyName: "thyShowOperations", publicName: "thyShowOperations", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyPickChange: "thyPickChange", thyClosePanel: "thyClosePanel" }, host: { properties: { "class.thy-time-picker-panel-has-bottom-operation": "thyShowOperations()", "class.thy-time-picker-panel-columns-2": "showColumnCount() === 2", "class.thy-time-picker-panel-columns-3": "showColumnCount() === 3" }, classAttribute: "thy-time-picker-panel" }, providers: [
|
|
874
901
|
{
|
|
875
902
|
provide: NG_VALUE_ACCESSOR,
|
|
876
903
|
multi: true,
|
|
877
904
|
useExisting: forwardRef(() => ThyTimePanel)
|
|
878
905
|
}
|
|
879
|
-
], viewQueries: [{ propertyName: "hourListRef", first: true, predicate: ["hourListElement"], descendants: true }, { propertyName: "minuteListRef", first: true, predicate: ["minuteListElement"], descendants: true }, { propertyName: "secondListRef", first: true, predicate: ["secondListElement"], descendants: true }], ngImport: i0, template: "<div class=\"{{ prefixCls }}-content\">\n @if (showHourColumn) {\n <ul #hourListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-hour-column\">\n @for (time of hourRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"hour === time.value\"\n (click)=\"pickHours(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n @if (showMinuteColumn) {\n <ul #minuteListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-minute-column\">\n @for (time of minuteRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"minute === time.value\"\n (click)=\"pickMinutes(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n @if (showSecondColumn) {\n <ul #secondListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-second-column\">\n @for (time of secondRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"second === time.value\"\n (click)=\"pickSeconds(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n</div>\n\n@if (thyShowOperations) {\n <div class=\"{{ prefixCls }}-bottom-operation\">\n @if (thyShowSelectNow) {\n <a href=\"javascript:;\" class=\"{{ prefixCls }}-time-now\" (click)=\"selectNow()\">{{ locale().now }}</a>\n }\n <button class=\"{{ prefixCls }}-time-confirm\" thyButton=\"primary\" thySize=\"xs\" class=\"confirm\" (click)=\"confirmPickTime()\">\n {{ locale().ok }}\n </button>\n </div>\n}\n", dependencies: [{ kind: "component", type: ThyButton, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thyBlock"] }, { kind: "pipe", type: DecimalPipe, name: "number" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
906
|
+
], viewQueries: [{ propertyName: "hourListRef", first: true, predicate: ["hourListElement"], descendants: true, isSignal: true }, { propertyName: "minuteListRef", first: true, predicate: ["minuteListElement"], descendants: true, isSignal: true }, { propertyName: "secondListRef", first: true, predicate: ["secondListElement"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"{{ prefixCls }}-content\">\n @if (showHourColumn()) {\n <ul #hourListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-hour-column\">\n @for (time of hourRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"hour === time.value\"\n (click)=\"pickHours(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n @if (showMinuteColumn()) {\n <ul #minuteListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-minute-column\">\n @for (time of minuteRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"minute === time.value\"\n (click)=\"pickMinutes(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n @if (showSecondColumn()) {\n <ul #secondListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-second-column\">\n @for (time of secondRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"second === time.value\"\n (click)=\"pickSeconds(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n</div>\n\n@if (thyShowOperations()) {\n <div class=\"{{ prefixCls }}-bottom-operation\">\n @if (thyShowSelectNow()) {\n <a href=\"javascript:;\" class=\"{{ prefixCls }}-time-now\" (click)=\"selectNow()\">{{ locale().now }}</a>\n }\n <button class=\"{{ prefixCls }}-time-confirm\" thyButton=\"primary\" thySize=\"xs\" class=\"confirm\" (click)=\"confirmPickTime()\">\n {{ locale().ok }}\n </button>\n </div>\n}\n", dependencies: [{ kind: "component", type: ThyButton, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thyBlock"] }, { kind: "pipe", type: DecimalPipe, name: "number" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
880
907
|
}
|
|
881
908
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimePanel, decorators: [{
|
|
882
909
|
type: Component,
|
|
@@ -888,38 +915,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
888
915
|
}
|
|
889
916
|
], host: {
|
|
890
917
|
class: 'thy-time-picker-panel',
|
|
891
|
-
'[class.thy-time-picker-panel-has-bottom-operation]': `thyShowOperations`,
|
|
892
|
-
'[class.thy-time-picker-panel-columns-2]': `showColumnCount === 2`,
|
|
893
|
-
'[class.thy-time-picker-panel-columns-3]': `showColumnCount === 3`
|
|
894
|
-
}, imports: [ThyButton, DecimalPipe], template: "<div class=\"{{ prefixCls }}-content\">\n @if (showHourColumn) {\n <ul #hourListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-hour-column\">\n @for (time of hourRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"hour === time.value\"\n (click)=\"pickHours(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n @if (showMinuteColumn) {\n <ul #minuteListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-minute-column\">\n @for (time of minuteRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"minute === time.value\"\n (click)=\"pickMinutes(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n @if (showSecondColumn) {\n <ul #secondListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-second-column\">\n @for (time of secondRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"second === time.value\"\n (click)=\"pickSeconds(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n</div>\n\n@if (thyShowOperations) {\n <div class=\"{{ prefixCls }}-bottom-operation\">\n @if (thyShowSelectNow) {\n <a href=\"javascript:;\" class=\"{{ prefixCls }}-time-now\" (click)=\"selectNow()\">{{ locale().now }}</a>\n }\n <button class=\"{{ prefixCls }}-time-confirm\" thyButton=\"primary\" thySize=\"xs\" class=\"confirm\" (click)=\"confirmPickTime()\">\n {{ locale().ok }}\n </button>\n </div>\n}\n" }]
|
|
895
|
-
}],
|
|
896
|
-
type: ViewChild,
|
|
897
|
-
args: ['hourListElement', { static: false }]
|
|
898
|
-
}], minuteListRef: [{
|
|
899
|
-
type: ViewChild,
|
|
900
|
-
args: ['minuteListElement', { static: false }]
|
|
901
|
-
}], secondListRef: [{
|
|
902
|
-
type: ViewChild,
|
|
903
|
-
args: ['secondListElement', { static: false }]
|
|
904
|
-
}], thyFormat: [{
|
|
905
|
-
type: Input
|
|
906
|
-
}], thyHourStep: [{
|
|
907
|
-
type: Input
|
|
908
|
-
}], thyMinuteStep: [{
|
|
909
|
-
type: Input
|
|
910
|
-
}], thySecondStep: [{
|
|
911
|
-
type: Input
|
|
912
|
-
}], thyShowSelectNow: [{
|
|
913
|
-
type: Input,
|
|
914
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
915
|
-
}], thyShowOperations: [{
|
|
916
|
-
type: Input,
|
|
917
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
918
|
-
}], thyPickChange: [{
|
|
919
|
-
type: Output
|
|
920
|
-
}], thyClosePanel: [{
|
|
921
|
-
type: Output
|
|
922
|
-
}] } });
|
|
918
|
+
'[class.thy-time-picker-panel-has-bottom-operation]': `thyShowOperations()`,
|
|
919
|
+
'[class.thy-time-picker-panel-columns-2]': `showColumnCount() === 2`,
|
|
920
|
+
'[class.thy-time-picker-panel-columns-3]': `showColumnCount() === 3`
|
|
921
|
+
}, imports: [ThyButton, DecimalPipe], template: "<div class=\"{{ prefixCls }}-content\">\n @if (showHourColumn()) {\n <ul #hourListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-hour-column\">\n @for (time of hourRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"hour === time.value\"\n (click)=\"pickHours(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n @if (showMinuteColumn()) {\n <ul #minuteListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-minute-column\">\n @for (time of minuteRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"minute === time.value\"\n (click)=\"pickMinutes(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n @if (showSecondColumn()) {\n <ul #secondListElement class=\"{{ prefixCls }}-time-column {{ prefixCls }}-second-column\">\n @for (time of secondRange; track $index; let i = $index) {\n <li\n class=\"{{ prefixCls }}-time-column-cell\"\n [class.thy-time-picker-panel-time-column-cell-selected]=\"second === time.value\"\n (click)=\"pickSeconds(time, i)\">\n <span class=\"{{ prefixCls }}-time-column-cell-inner\">{{ time.value | number: '2.0-0' }}</span>\n </li>\n }\n </ul>\n }\n</div>\n\n@if (thyShowOperations()) {\n <div class=\"{{ prefixCls }}-bottom-operation\">\n @if (thyShowSelectNow()) {\n <a href=\"javascript:;\" class=\"{{ prefixCls }}-time-now\" (click)=\"selectNow()\">{{ locale().now }}</a>\n }\n <button class=\"{{ prefixCls }}-time-confirm\" thyButton=\"primary\" thySize=\"xs\" class=\"confirm\" (click)=\"confirmPickTime()\">\n {{ locale().ok }}\n </button>\n </div>\n}\n" }]
|
|
922
|
+
}], ctorParameters: () => [] });
|
|
923
923
|
|
|
924
924
|
/**
|
|
925
925
|
* 时间选择组件
|
|
@@ -930,85 +930,100 @@ class ThyTimePicker {
|
|
|
930
930
|
this.cdr = inject(ChangeDetectorRef);
|
|
931
931
|
this.elementRef = inject(ElementRef);
|
|
932
932
|
this.locale = injectLocale('timePicker');
|
|
933
|
+
this.cdkConnectedOverlay = viewChild(CdkConnectedOverlay);
|
|
934
|
+
this.origin = viewChild('origin');
|
|
935
|
+
this.inputRef = viewChild('pickerInput');
|
|
936
|
+
this.overlayContainer = viewChild('overlayContainer');
|
|
933
937
|
/**
|
|
934
938
|
* 输入框大小
|
|
935
939
|
* @type 'xs' | 'sm' | 'md' | 'lg' | 'default'
|
|
936
940
|
*/
|
|
937
|
-
this.thySize = 'default';
|
|
941
|
+
this.thySize = input('default');
|
|
938
942
|
/**
|
|
939
943
|
* 输入框提示文字
|
|
940
944
|
* @type string
|
|
941
945
|
*/
|
|
942
|
-
this.thyPlaceholder = this.locale().placeholder;
|
|
946
|
+
this.thyPlaceholder = input(this.locale().placeholder);
|
|
943
947
|
/**
|
|
944
948
|
* 弹出位置
|
|
945
949
|
* @type 'top' | 'topLeft'| 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight' | 'left' | 'leftTop' | 'leftBottom' | 'right' | 'rightTop' | 'rightBottom'
|
|
946
950
|
*/
|
|
947
|
-
this.thyPlacement = 'bottomLeft';
|
|
951
|
+
this.thyPlacement = input('bottomLeft');
|
|
952
|
+
/**
|
|
953
|
+
* 展示的日期格式,支持 'HH:mm:ss' | 'HH:mm' | 'mm:ss'
|
|
954
|
+
* @type string
|
|
955
|
+
* @default HH:mm:ss
|
|
956
|
+
*/
|
|
957
|
+
this.thyFormat = input('HH:mm:ss', { transform: (value) => value || 'HH:mm:ss' });
|
|
948
958
|
/**
|
|
949
959
|
* 小时间隔步长
|
|
950
960
|
* @type number
|
|
951
961
|
*/
|
|
952
|
-
this.thyHourStep = 1;
|
|
962
|
+
this.thyHourStep = input(1);
|
|
953
963
|
/**
|
|
954
964
|
* 分钟间隔步长
|
|
955
965
|
* @type number
|
|
956
966
|
*/
|
|
957
|
-
this.thyMinuteStep = 1;
|
|
967
|
+
this.thyMinuteStep = input(1);
|
|
958
968
|
/**
|
|
959
969
|
* 秒间隔步长
|
|
960
970
|
* @type number
|
|
961
971
|
*/
|
|
962
|
-
this.thySecondStep = 1;
|
|
972
|
+
this.thySecondStep = input(1);
|
|
973
|
+
/**
|
|
974
|
+
* 弹出层组件 class
|
|
975
|
+
* @type string
|
|
976
|
+
*/
|
|
977
|
+
this.thyPopupClass = input();
|
|
978
|
+
/**
|
|
979
|
+
* 是否显示弹出层遮罩
|
|
980
|
+
* @type boolean
|
|
981
|
+
* @default false
|
|
982
|
+
*/
|
|
983
|
+
this.thyBackdrop = input(false, { transform: coerceBooleanProperty });
|
|
984
|
+
/**
|
|
985
|
+
* 禁用
|
|
986
|
+
* @type boolean
|
|
987
|
+
* @default false
|
|
988
|
+
*/
|
|
989
|
+
this.thyDisabled = model(false);
|
|
990
|
+
/**
|
|
991
|
+
* 只读
|
|
992
|
+
* @type boolean
|
|
993
|
+
* @default false
|
|
994
|
+
*/
|
|
995
|
+
this.thyReadonly = input(false, { transform: coerceBooleanProperty });
|
|
963
996
|
/**
|
|
964
997
|
* 展示选择此刻
|
|
965
998
|
* @type boolean
|
|
966
999
|
*/
|
|
967
|
-
this.thyShowSelectNow = true;
|
|
1000
|
+
this.thyShowSelectNow = input(true, { transform: coerceBooleanProperty });
|
|
968
1001
|
/**
|
|
969
1002
|
* 可清空值
|
|
970
1003
|
* @type boolean
|
|
971
1004
|
*/
|
|
972
|
-
this.thyAllowClear = true;
|
|
1005
|
+
this.thyAllowClear = input(true, { transform: coerceBooleanProperty });
|
|
973
1006
|
/**
|
|
974
1007
|
* 打开/关闭弹窗事件
|
|
975
1008
|
* @type EventEmitter<boolean>
|
|
976
1009
|
*/
|
|
977
|
-
this.thyOpenChange =
|
|
1010
|
+
this.thyOpenChange = output();
|
|
978
1011
|
this.prefixCls = 'thy-time-picker';
|
|
979
|
-
this.overlayPositions = getFlexiblePositions(this.thyPlacement, 4);
|
|
980
|
-
this.
|
|
981
|
-
this.showText = '';
|
|
1012
|
+
this.overlayPositions = getFlexiblePositions(this.thyPlacement(), 4);
|
|
1013
|
+
this.showText = model('');
|
|
982
1014
|
this.value = new TinyDate().setHms(0, 0, 0).nativeDate;
|
|
983
1015
|
this.isDisabledFirstChange = true;
|
|
984
1016
|
this.onValueChangeFn = () => void 0;
|
|
985
1017
|
this.onTouchedFn = () => void 0;
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
*/
|
|
992
|
-
set thyFormat(value) {
|
|
993
|
-
this.format = value || 'HH:mm:ss';
|
|
994
|
-
if (this.value && isValid(this.value)) {
|
|
995
|
-
this.showText = new TinyDate(this.value).format(this.format);
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* 禁用
|
|
1000
|
-
* @type boolean
|
|
1001
|
-
* @default false
|
|
1002
|
-
*/
|
|
1003
|
-
set thyDisabled(value) {
|
|
1004
|
-
this.disabled = value;
|
|
1005
|
-
}
|
|
1006
|
-
get thyDisabled() {
|
|
1007
|
-
return this.disabled;
|
|
1018
|
+
effect(() => {
|
|
1019
|
+
if (this.thyFormat() && this.value && isValid(this.value)) {
|
|
1020
|
+
this.showText.set(new TinyDate(this.value).format(this.thyFormat()));
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1008
1023
|
}
|
|
1009
1024
|
ngOnInit() { }
|
|
1010
1025
|
ngAfterViewInit() {
|
|
1011
|
-
this.overlayPositions = getFlexiblePositions(this.thyPlacement, 4);
|
|
1026
|
+
this.overlayPositions = getFlexiblePositions(this.thyPlacement(), 4);
|
|
1012
1027
|
}
|
|
1013
1028
|
onInputPickerClick() {
|
|
1014
1029
|
if (this.disabledUserOperation()) {
|
|
@@ -1064,14 +1079,15 @@ class ThyTimePicker {
|
|
|
1064
1079
|
onOutsideClick(event) {
|
|
1065
1080
|
if (this.openState &&
|
|
1066
1081
|
!this.elementRef.nativeElement.contains(event.target) &&
|
|
1067
|
-
!this.overlayContainer.nativeElement.contains(event.target)) {
|
|
1082
|
+
!this.overlayContainer().nativeElement.contains(event.target)) {
|
|
1068
1083
|
this.closeOverlay();
|
|
1069
1084
|
this.cdr.detectChanges();
|
|
1070
1085
|
}
|
|
1071
1086
|
}
|
|
1072
1087
|
onOverlayAttach() {
|
|
1073
|
-
|
|
1074
|
-
|
|
1088
|
+
const cdkConnectedOverlay = this.cdkConnectedOverlay();
|
|
1089
|
+
if (cdkConnectedOverlay && cdkConnectedOverlay.overlayRef) {
|
|
1090
|
+
cdkConnectedOverlay.overlayRef.updatePosition();
|
|
1075
1091
|
}
|
|
1076
1092
|
}
|
|
1077
1093
|
openOverlay() {
|
|
@@ -1087,16 +1103,16 @@ class ThyTimePicker {
|
|
|
1087
1103
|
this.keepFocus = false;
|
|
1088
1104
|
this.openState = false;
|
|
1089
1105
|
this.blur();
|
|
1090
|
-
if (this.showText?.length) {
|
|
1091
|
-
if (!this.validateCustomizeInput(this.showText)) {
|
|
1106
|
+
if (this.showText()?.length) {
|
|
1107
|
+
if (!this.validateCustomizeInput(this.showText())) {
|
|
1092
1108
|
this.setValue(this.originValue);
|
|
1093
1109
|
}
|
|
1094
1110
|
else {
|
|
1095
|
-
this.showText
|
|
1111
|
+
this.showText.set(new TinyDate(this.value).format(this.thyFormat()));
|
|
1096
1112
|
}
|
|
1097
1113
|
}
|
|
1098
1114
|
else {
|
|
1099
|
-
if (!this.thyAllowClear) {
|
|
1115
|
+
if (!this.thyAllowClear()) {
|
|
1100
1116
|
this.setValue(this.originValue);
|
|
1101
1117
|
}
|
|
1102
1118
|
}
|
|
@@ -1104,13 +1120,15 @@ class ThyTimePicker {
|
|
|
1104
1120
|
}
|
|
1105
1121
|
}
|
|
1106
1122
|
focus() {
|
|
1107
|
-
|
|
1108
|
-
|
|
1123
|
+
const inputRef = this.inputRef();
|
|
1124
|
+
if (inputRef) {
|
|
1125
|
+
inputRef.nativeElement.focus();
|
|
1109
1126
|
}
|
|
1110
1127
|
}
|
|
1111
1128
|
blur() {
|
|
1112
|
-
|
|
1113
|
-
|
|
1129
|
+
const inputRef = this.inputRef();
|
|
1130
|
+
if (inputRef) {
|
|
1131
|
+
inputRef.nativeElement.blur();
|
|
1114
1132
|
}
|
|
1115
1133
|
}
|
|
1116
1134
|
writeValue(value) {
|
|
@@ -1129,19 +1147,19 @@ class ThyTimePicker {
|
|
|
1129
1147
|
this.onTouchedFn = fn;
|
|
1130
1148
|
}
|
|
1131
1149
|
setDisabledState(isDisabled) {
|
|
1132
|
-
this.
|
|
1150
|
+
this.thyDisabled.set((this.isDisabledFirstChange && this.thyDisabled()) || isDisabled);
|
|
1133
1151
|
this.isDisabledFirstChange = false;
|
|
1134
1152
|
}
|
|
1135
1153
|
setValue(value, formatText = true) {
|
|
1136
1154
|
if (value && isValid(value)) {
|
|
1137
1155
|
this.value = new TinyDate(value)?.nativeDate;
|
|
1138
1156
|
if (formatText) {
|
|
1139
|
-
this.showText
|
|
1157
|
+
this.showText.set(new TinyDate(this.value).format(this.thyFormat()));
|
|
1140
1158
|
}
|
|
1141
1159
|
}
|
|
1142
1160
|
else {
|
|
1143
1161
|
this.value = null;
|
|
1144
|
-
this.showText
|
|
1162
|
+
this.showText.set('');
|
|
1145
1163
|
}
|
|
1146
1164
|
this.cdr.markForCheck();
|
|
1147
1165
|
}
|
|
@@ -1174,24 +1192,24 @@ class ThyTimePicker {
|
|
|
1174
1192
|
}
|
|
1175
1193
|
}
|
|
1176
1194
|
else {
|
|
1177
|
-
if (this.thyAllowClear) {
|
|
1195
|
+
if (this.thyAllowClear()) {
|
|
1178
1196
|
this.originValue = null;
|
|
1179
1197
|
this.setValue(null);
|
|
1180
1198
|
this.emitValue();
|
|
1181
1199
|
}
|
|
1182
1200
|
else {
|
|
1183
1201
|
this.value = new TinyDate(this.originValue)?.nativeDate;
|
|
1184
|
-
this.showText
|
|
1202
|
+
this.showText.set('');
|
|
1185
1203
|
this.cdr.markForCheck();
|
|
1186
1204
|
}
|
|
1187
1205
|
}
|
|
1188
1206
|
}
|
|
1189
1207
|
validateCustomizeInput(value) {
|
|
1190
1208
|
let valid = false;
|
|
1191
|
-
if (value.length > this.
|
|
1209
|
+
if (value.length > this.thyFormat().length) {
|
|
1192
1210
|
return valid;
|
|
1193
1211
|
}
|
|
1194
|
-
const formatRule = this.
|
|
1212
|
+
const formatRule = this.thyFormat().split(':');
|
|
1195
1213
|
const formatter = value.split(':');
|
|
1196
1214
|
valid = !formatRule
|
|
1197
1215
|
.map((m, i) => {
|
|
@@ -1201,16 +1219,16 @@ class ThyTimePicker {
|
|
|
1201
1219
|
return valid;
|
|
1202
1220
|
}
|
|
1203
1221
|
disabledUserOperation() {
|
|
1204
|
-
return this.
|
|
1222
|
+
return this.thyDisabled() || this.thyReadonly();
|
|
1205
1223
|
}
|
|
1206
1224
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1207
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyTimePicker, isStandalone: true, selector: "thy-time-picker", inputs: { thySize: "thySize", thyPlaceholder: "thyPlaceholder", thyPlacement: "thyPlacement", thyFormat: "thyFormat", thyHourStep: "thyHourStep", thyMinuteStep: "thyMinuteStep", thySecondStep: "thySecondStep", thyPopupClass: "thyPopupClass", thyBackdrop:
|
|
1225
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyTimePicker, isStandalone: true, selector: "thy-time-picker", inputs: { thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyPlaceholder: { classPropertyName: "thyPlaceholder", publicName: "thyPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, thyPlacement: { classPropertyName: "thyPlacement", publicName: "thyPlacement", isSignal: true, isRequired: false, transformFunction: null }, thyFormat: { classPropertyName: "thyFormat", publicName: "thyFormat", isSignal: true, isRequired: false, transformFunction: null }, thyHourStep: { classPropertyName: "thyHourStep", publicName: "thyHourStep", isSignal: true, isRequired: false, transformFunction: null }, thyMinuteStep: { classPropertyName: "thyMinuteStep", publicName: "thyMinuteStep", isSignal: true, isRequired: false, transformFunction: null }, thySecondStep: { classPropertyName: "thySecondStep", publicName: "thySecondStep", isSignal: true, isRequired: false, transformFunction: null }, thyPopupClass: { classPropertyName: "thyPopupClass", publicName: "thyPopupClass", isSignal: true, isRequired: false, transformFunction: null }, thyBackdrop: { classPropertyName: "thyBackdrop", publicName: "thyBackdrop", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null }, thyReadonly: { classPropertyName: "thyReadonly", publicName: "thyReadonly", isSignal: true, isRequired: false, transformFunction: null }, thyShowSelectNow: { classPropertyName: "thyShowSelectNow", publicName: "thyShowSelectNow", isSignal: true, isRequired: false, transformFunction: null }, thyAllowClear: { classPropertyName: "thyAllowClear", publicName: "thyAllowClear", isSignal: true, isRequired: false, transformFunction: null }, showText: { classPropertyName: "showText", publicName: "showText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyDisabled: "thyDisabledChange", thyOpenChange: "thyOpenChange", showText: "showTextChange" }, host: { properties: { "class.thy-time-picker-disabled": "thyDisabled()", "class.thy-time-picker-readonly": "thyReadonly()" }, classAttribute: "thy-time-picker" }, providers: [
|
|
1208
1226
|
{
|
|
1209
1227
|
provide: NG_VALUE_ACCESSOR,
|
|
1210
1228
|
multi: true,
|
|
1211
1229
|
useExisting: forwardRef(() => ThyTimePicker)
|
|
1212
1230
|
}
|
|
1213
|
-
], viewQueries: [{ propertyName: "cdkConnectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true,
|
|
1231
|
+
], viewQueries: [{ propertyName: "cdkConnectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }, { propertyName: "origin", first: true, predicate: ["origin"], descendants: true, isSignal: true }, { propertyName: "inputRef", first: true, predicate: ["pickerInput"], descendants: true, isSignal: true }, { propertyName: "overlayContainer", first: true, predicate: ["overlayContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<span cdkOverlayOrigin #origin=\"cdkOverlayOrigin\" (click)=\"onInputPickerClick()\" class=\"{{ prefixCls }}-wrapper\">\n <ng-container>\n <input\n #pickerInput\n thyInput\n class=\"form-control {{ prefixCls }}-input\"\n [class.thy-input-disabled]=\"thyDisabled()\"\n [class.thy-input-readonly]=\"thyReadonly()\"\n [class.thy-time-picker-panel-opened]=\"openState\"\n [(ngModel)]=\"showText\"\n [thySize]=\"thySize()\"\n [disabled]=\"thyDisabled()\"\n [readonly]=\"thyReadonly()\"\n [placeholder]=\"thyPlaceholder()\"\n (blur)=\"onInputPickerBlur()\"\n (keyup.enter)=\"onKeyupEnter()\"\n (keyup.escape)=\"onKeyupEsc()\"\n (ngModelChange)=\"onCustomizeInput($event)\" />\n <ng-container *ngTemplateOutlet=\"rightIcon\"></ng-container>\n </ng-container>\n</span>\n\n<ng-template #rightIcon>\n @if (!thyDisabled() && thyAllowClear() && !thyReadonly() && showText()) {\n <span class=\"{{ prefixCls }}-clear\">\n <thy-icon\n thyIconName=\"close-circle-bold-fill\"\n (click)=\"onClearTime($event)\"\n ngClass=\"remove-link remove-link-{{ thySize() }}\"></thy-icon>\n </span>\n }\n <span class=\"{{ prefixCls }}-icon\">\n <thy-icon [thyIconName]=\"'clock-circle-moment'\" ngClass=\"remove-link-{{ thySize() }}\"></thy-icon>\n </span>\n</ng-template>\n\n<!-- Overlay -->\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"openState\"\n [cdkConnectedOverlayHasBackdrop]=\"thyBackdrop()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n cdkConnectedOverlayTransformOriginOn=\".thy-time-picker-container\"\n (positionChange)=\"onPositionChange($event)\"\n (backdropClick)=\"onClickBackdrop()\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (detach)=\"onOverlayDetach()\"\n (attach)=\"onOverlayAttach()\">\n <div\n #overlayContainer\n style=\"position: relative\"\n [@scaleXMotion]=\"thyPlacement() === 'left' || thyPlacement() === 'right' ? 'enter' : 'void'\"\n [@scaleYMotion]=\"thyPlacement() === 'top' || thyPlacement() === 'bottom' ? 'enter' : 'void'\"\n [@scaleMotion]=\"\n thyPlacement() !== 'left' && thyPlacement() !== 'right' && thyPlacement() !== 'top' && thyPlacement() !== 'bottom' ? 'enter' : 'void'\n \"\n class=\"thy-time-picker-container\">\n <!-- Compatible for overlay that not support offset dynamically and immediately -->\n <thy-time-picker-panel\n [ngClass]=\"thyPopupClass()\"\n [(ngModel)]=\"value\"\n [thyFormat]=\"thyFormat()\"\n [thyHourStep]=\"thyHourStep()\"\n [thyMinuteStep]=\"thyMinuteStep()\"\n [thySecondStep]=\"thySecondStep()\"\n [thyShowSelectNow]=\"thyShowSelectNow()\"\n (ngModelChange)=\"onPickTimeConfirm($event)\"\n (thyPickChange)=\"onPickTime($event)\"\n (thyClosePanel)=\"closeOverlay()\"></thy-time-picker-panel>\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: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { 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: 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"] }, { kind: "component", type: ThyTimePanel, selector: "thy-time-picker-panel", inputs: ["thyFormat", "thyHourStep", "thyMinuteStep", "thySecondStep", "thyShowSelectNow", "thyShowOperations"], outputs: ["thyPickChange", "thyClosePanel"] }], animations: [scaleXMotion, scaleYMotion, scaleMotion], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1214
1232
|
}
|
|
1215
1233
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimePicker, decorators: [{
|
|
1216
1234
|
type: Component,
|
|
@@ -1222,55 +1240,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
1222
1240
|
}
|
|
1223
1241
|
], host: {
|
|
1224
1242
|
class: 'thy-time-picker',
|
|
1225
|
-
'[class.thy-time-picker-disabled]': `
|
|
1226
|
-
'[class.thy-time-picker-readonly]': `thyReadonly`
|
|
1227
|
-
}, imports: [CdkOverlayOrigin, ThyInputDirective, FormsModule, NgTemplateOutlet, ThyIcon, NgClass, CdkConnectedOverlay, ThyTimePanel], animations: [scaleXMotion, scaleYMotion, scaleMotion], template: "<span cdkOverlayOrigin #origin=\"cdkOverlayOrigin\" (click)=\"onInputPickerClick()\" class=\"{{ prefixCls }}-wrapper\">\n <ng-container>\n <input\n #pickerInput\n thyInput\n class=\"form-control {{ prefixCls }}-input\"\n [class.thy-input-disabled]=\"
|
|
1228
|
-
}],
|
|
1229
|
-
type: ViewChild,
|
|
1230
|
-
args: [CdkConnectedOverlay, { static: true }]
|
|
1231
|
-
}], origin: [{
|
|
1232
|
-
type: ViewChild,
|
|
1233
|
-
args: ['origin', { static: true }]
|
|
1234
|
-
}], inputRef: [{
|
|
1235
|
-
type: ViewChild,
|
|
1236
|
-
args: ['pickerInput', { static: true }]
|
|
1237
|
-
}], overlayContainer: [{
|
|
1238
|
-
type: ViewChild,
|
|
1239
|
-
args: ['overlayContainer', { static: false }]
|
|
1240
|
-
}], thySize: [{
|
|
1241
|
-
type: Input
|
|
1242
|
-
}], thyPlaceholder: [{
|
|
1243
|
-
type: Input
|
|
1244
|
-
}], thyPlacement: [{
|
|
1245
|
-
type: Input
|
|
1246
|
-
}], thyFormat: [{
|
|
1247
|
-
type: Input
|
|
1248
|
-
}], thyHourStep: [{
|
|
1249
|
-
type: Input
|
|
1250
|
-
}], thyMinuteStep: [{
|
|
1251
|
-
type: Input
|
|
1252
|
-
}], thySecondStep: [{
|
|
1253
|
-
type: Input
|
|
1254
|
-
}], thyPopupClass: [{
|
|
1255
|
-
type: Input
|
|
1256
|
-
}], thyBackdrop: [{
|
|
1257
|
-
type: Input,
|
|
1258
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1259
|
-
}], thyDisabled: [{
|
|
1260
|
-
type: Input,
|
|
1261
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1262
|
-
}], thyReadonly: [{
|
|
1263
|
-
type: Input,
|
|
1264
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1265
|
-
}], thyShowSelectNow: [{
|
|
1266
|
-
type: Input,
|
|
1267
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1268
|
-
}], thyAllowClear: [{
|
|
1269
|
-
type: Input,
|
|
1270
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1271
|
-
}], thyOpenChange: [{
|
|
1272
|
-
type: Output
|
|
1273
|
-
}] } });
|
|
1243
|
+
'[class.thy-time-picker-disabled]': `thyDisabled()`,
|
|
1244
|
+
'[class.thy-time-picker-readonly]': `thyReadonly()`
|
|
1245
|
+
}, imports: [CdkOverlayOrigin, ThyInputDirective, FormsModule, NgTemplateOutlet, ThyIcon, NgClass, CdkConnectedOverlay, ThyTimePanel], animations: [scaleXMotion, scaleYMotion, scaleMotion], template: "<span cdkOverlayOrigin #origin=\"cdkOverlayOrigin\" (click)=\"onInputPickerClick()\" class=\"{{ prefixCls }}-wrapper\">\n <ng-container>\n <input\n #pickerInput\n thyInput\n class=\"form-control {{ prefixCls }}-input\"\n [class.thy-input-disabled]=\"thyDisabled()\"\n [class.thy-input-readonly]=\"thyReadonly()\"\n [class.thy-time-picker-panel-opened]=\"openState\"\n [(ngModel)]=\"showText\"\n [thySize]=\"thySize()\"\n [disabled]=\"thyDisabled()\"\n [readonly]=\"thyReadonly()\"\n [placeholder]=\"thyPlaceholder()\"\n (blur)=\"onInputPickerBlur()\"\n (keyup.enter)=\"onKeyupEnter()\"\n (keyup.escape)=\"onKeyupEsc()\"\n (ngModelChange)=\"onCustomizeInput($event)\" />\n <ng-container *ngTemplateOutlet=\"rightIcon\"></ng-container>\n </ng-container>\n</span>\n\n<ng-template #rightIcon>\n @if (!thyDisabled() && thyAllowClear() && !thyReadonly() && showText()) {\n <span class=\"{{ prefixCls }}-clear\">\n <thy-icon\n thyIconName=\"close-circle-bold-fill\"\n (click)=\"onClearTime($event)\"\n ngClass=\"remove-link remove-link-{{ thySize() }}\"></thy-icon>\n </span>\n }\n <span class=\"{{ prefixCls }}-icon\">\n <thy-icon [thyIconName]=\"'clock-circle-moment'\" ngClass=\"remove-link-{{ thySize() }}\"></thy-icon>\n </span>\n</ng-template>\n\n<!-- Overlay -->\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"openState\"\n [cdkConnectedOverlayHasBackdrop]=\"thyBackdrop()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n cdkConnectedOverlayTransformOriginOn=\".thy-time-picker-container\"\n (positionChange)=\"onPositionChange($event)\"\n (backdropClick)=\"onClickBackdrop()\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (detach)=\"onOverlayDetach()\"\n (attach)=\"onOverlayAttach()\">\n <div\n #overlayContainer\n style=\"position: relative\"\n [@scaleXMotion]=\"thyPlacement() === 'left' || thyPlacement() === 'right' ? 'enter' : 'void'\"\n [@scaleYMotion]=\"thyPlacement() === 'top' || thyPlacement() === 'bottom' ? 'enter' : 'void'\"\n [@scaleMotion]=\"\n thyPlacement() !== 'left' && thyPlacement() !== 'right' && thyPlacement() !== 'top' && thyPlacement() !== 'bottom' ? 'enter' : 'void'\n \"\n class=\"thy-time-picker-container\">\n <!-- Compatible for overlay that not support offset dynamically and immediately -->\n <thy-time-picker-panel\n [ngClass]=\"thyPopupClass()\"\n [(ngModel)]=\"value\"\n [thyFormat]=\"thyFormat()\"\n [thyHourStep]=\"thyHourStep()\"\n [thyMinuteStep]=\"thyMinuteStep()\"\n [thySecondStep]=\"thySecondStep()\"\n [thyShowSelectNow]=\"thyShowSelectNow()\"\n (ngModelChange)=\"onPickTimeConfirm($event)\"\n (thyPickChange)=\"onPickTime($event)\"\n (thyClosePanel)=\"closeOverlay()\"></thy-time-picker-panel>\n </div>\n</ng-template>\n" }]
|
|
1246
|
+
}], ctorParameters: () => [] });
|
|
1274
1247
|
|
|
1275
1248
|
const COMPONENTS = [ThyInnerTimePicker, ThyTimePicker, ThyTimePanel];
|
|
1276
1249
|
class ThyTimePickerModule {
|