@gravionlabs/helix-ui 22.2.4 → 22.2.6
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/README.md +3 -0
- package/fesm2022/gravionlabs-helix-ui.mjs +3825 -358
- package/fesm2022/gravionlabs-helix-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/styles.css +487 -0
- package/types/gravionlabs-helix-ui.d.ts +843 -24
|
@@ -7543,6 +7543,14 @@ function isSameDay(a, b) {
|
|
|
7543
7543
|
function compareDays(a, b) {
|
|
7544
7544
|
return startOfDay(a).getTime() - startOfDay(b).getTime();
|
|
7545
7545
|
}
|
|
7546
|
+
function withTime(date, hours, minutes, seconds = 0) {
|
|
7547
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), hours, minutes, seconds);
|
|
7548
|
+
}
|
|
7549
|
+
function clampTime(date, min, max) {
|
|
7550
|
+
if (isValidDate(min) && date.getTime() < min.getTime()) return new Date(min);
|
|
7551
|
+
if (isValidDate(max) && date.getTime() > max.getTime()) return new Date(max);
|
|
7552
|
+
return date;
|
|
7553
|
+
}
|
|
7546
7554
|
function isValidDate(value) {
|
|
7547
7555
|
return value instanceof Date && !Number.isNaN(value.getTime());
|
|
7548
7556
|
}
|
|
@@ -7555,43 +7563,3405 @@ function monthCells(year, month, firstDayOfWeek) {
|
|
|
7555
7563
|
for (let i = 0; i < cells.length; i += 7) rows.push(cells.slice(i, i + 7));
|
|
7556
7564
|
return rows;
|
|
7557
7565
|
}
|
|
7558
|
-
|
|
7566
|
+
function dateKey(date) {
|
|
7567
|
+
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
|
|
7568
|
+
}
|
|
7569
|
+
function isDateDisabled(date, rules) {
|
|
7570
|
+
const { min, max, disabledDates = [] } = rules;
|
|
7571
|
+
return !!min && compareDays(date, min) < 0 || !!max && compareDays(date, max) > 0 || disabledDates.some((d) => isSameDay(d, date));
|
|
7572
|
+
}
|
|
7573
|
+
function isInRange(date, selected, mode) {
|
|
7574
|
+
const [from, to] = selected;
|
|
7575
|
+
return mode === "range" && !!from && !!to && compareDays(date, from) > 0 && compareDays(date, to) < 0;
|
|
7576
|
+
}
|
|
7577
|
+
function stepFocus(view, current, direction) {
|
|
7578
|
+
return addMonths(current, (view === "day" ? 1 : view === "month" ? 12 : 144) * direction);
|
|
7579
|
+
}
|
|
7580
|
+
function focusMonth(current, month) {
|
|
7581
|
+
return addMonths(new Date(current.getFullYear(), 0, current.getDate()), month);
|
|
7582
|
+
}
|
|
7583
|
+
function focusYear(current, year) {
|
|
7584
|
+
return addMonths(new Date(year, current.getMonth(), 1), 0);
|
|
7585
|
+
}
|
|
7586
|
+
function decadeOf(year) {
|
|
7587
|
+
const start = Math.floor(year / 12) * 12;
|
|
7588
|
+
return Array.from({ length: 12 }, (_, i) => start + i);
|
|
7589
|
+
}
|
|
7590
|
+
function dayKeyTarget(key, date, firstDayOfWeek, shift = false) {
|
|
7591
|
+
const weekday = (date.getDay() - firstDayOfWeek + 7) % 7;
|
|
7592
|
+
switch (key) {
|
|
7593
|
+
case "ArrowLeft": return addDays(date, -1);
|
|
7594
|
+
case "ArrowRight": return addDays(date, 1);
|
|
7595
|
+
case "ArrowUp": return addDays(date, -7);
|
|
7596
|
+
case "ArrowDown": return addDays(date, 7);
|
|
7597
|
+
case "Home": return addDays(date, -weekday);
|
|
7598
|
+
case "End": return addDays(date, 6 - weekday);
|
|
7599
|
+
case "PageUp": return addMonths(date, shift ? -12 : -1);
|
|
7600
|
+
case "PageDown": return addMonths(date, shift ? 12 : 1);
|
|
7601
|
+
default: return null;
|
|
7602
|
+
}
|
|
7603
|
+
}
|
|
7604
|
+
var HxCalendar = class HxCalendar {
|
|
7559
7605
|
#host = inject(ElementRef);
|
|
7560
7606
|
#injector = inject(Injector);
|
|
7607
|
+
focusedDate = model.required(...ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []);
|
|
7608
|
+
view = model("day", ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
|
|
7609
|
+
selectedDates = input([], ...ngDevMode ? [{ debugName: "selectedDates" }] : /* istanbul ignore next */ []);
|
|
7610
|
+
selectionMode = input("single", ...ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []);
|
|
7611
|
+
minDate = input(null, ...ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []);
|
|
7612
|
+
maxDate = input(null, ...ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []);
|
|
7613
|
+
disabledDates = input([], ...ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []);
|
|
7614
|
+
firstDayOfWeek = input(0, ...ngDevMode ? [{ debugName: "firstDayOfWeek" }] : /* istanbul ignore next */ []);
|
|
7615
|
+
locale = input(...ngDevMode ? [void 0, { debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
7616
|
+
disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
7617
|
+
titleId = input.required(...ngDevMode ? [{ debugName: "titleId" }] : /* istanbul ignore next */ []);
|
|
7618
|
+
today = input.required(...ngDevMode ? [{ debugName: "today" }] : /* istanbul ignore next */ []);
|
|
7619
|
+
picked = output();
|
|
7620
|
+
viewYear = computed(() => this.focusedDate().getFullYear(), ...ngDevMode ? [{ debugName: "viewYear" }] : /* istanbul ignore next */ []);
|
|
7621
|
+
#formats = computed(() => {
|
|
7622
|
+
const locale = this.locale();
|
|
7623
|
+
return {
|
|
7624
|
+
month: new Intl.DateTimeFormat(locale, { month: "long" }),
|
|
7625
|
+
monthShort: new Intl.DateTimeFormat(locale, { month: "short" }),
|
|
7626
|
+
weekdayShort: new Intl.DateTimeFormat(locale, { weekday: "short" }),
|
|
7627
|
+
weekdayLong: new Intl.DateTimeFormat(locale, { weekday: "long" }),
|
|
7628
|
+
full: new Intl.DateTimeFormat(locale, { dateStyle: "full" })
|
|
7629
|
+
};
|
|
7630
|
+
}, ...ngDevMode ? [{ debugName: "#formats" }] : /* istanbul ignore next */ []);
|
|
7631
|
+
monthName = computed(() => this.#formats().month.format(this.focusedDate()), ...ngDevMode ? [{ debugName: "monthName" }] : /* istanbul ignore next */ []);
|
|
7632
|
+
monthNames = computed(() => Array.from({ length: 12 }, (_, m) => this.#formats().monthShort.format(new Date(2026, m, 1))), ...ngDevMode ? [{ debugName: "monthNames" }] : /* istanbul ignore next */ []);
|
|
7633
|
+
weekdays = computed(() => {
|
|
7634
|
+
const first = this.firstDayOfWeek();
|
|
7635
|
+
return Array.from({ length: 7 }, (_, i) => {
|
|
7636
|
+
const day = new Date(2026, 0, 4 + (first + i) % 7);
|
|
7637
|
+
return {
|
|
7638
|
+
short: this.#formats().weekdayShort.format(day),
|
|
7639
|
+
long: this.#formats().weekdayLong.format(day)
|
|
7640
|
+
};
|
|
7641
|
+
});
|
|
7642
|
+
}, ...ngDevMode ? [{ debugName: "weekdays" }] : /* istanbul ignore next */ []);
|
|
7643
|
+
weeks = computed(() => monthCells(this.focusedDate().getFullYear(), this.focusedDate().getMonth(), this.firstDayOfWeek()), ...ngDevMode ? [{ debugName: "weeks" }] : /* istanbul ignore next */ []);
|
|
7644
|
+
decade = computed(() => decadeOf(this.focusedDate().getFullYear()), ...ngDevMode ? [{ debugName: "decade" }] : /* istanbul ignore next */ []);
|
|
7645
|
+
dateKey = dateKey;
|
|
7646
|
+
dayLabel(date) {
|
|
7647
|
+
return this.#formats().full.format(date);
|
|
7648
|
+
}
|
|
7649
|
+
isToday(date) {
|
|
7650
|
+
return isSameDay(date, this.today());
|
|
7651
|
+
}
|
|
7652
|
+
isSelected(date) {
|
|
7653
|
+
return this.selectedDates().some((d) => isSameDay(d, date));
|
|
7654
|
+
}
|
|
7655
|
+
isInRange(date) {
|
|
7656
|
+
return isInRange(date, this.selectedDates(), this.selectionMode());
|
|
7657
|
+
}
|
|
7658
|
+
isDateDisabled(date) {
|
|
7659
|
+
return isDateDisabled(date, {
|
|
7660
|
+
min: this.minDate(),
|
|
7661
|
+
max: this.maxDate(),
|
|
7662
|
+
disabledDates: this.disabledDates()
|
|
7663
|
+
});
|
|
7664
|
+
}
|
|
7665
|
+
isFocusTarget(date) {
|
|
7666
|
+
return isSameDay(date, this.focusedDate());
|
|
7667
|
+
}
|
|
7668
|
+
step(direction) {
|
|
7669
|
+
this.focusedDate.set(stepFocus(this.view(), this.focusedDate(), direction));
|
|
7670
|
+
}
|
|
7671
|
+
chooseMonth(month) {
|
|
7672
|
+
this.focusedDate.set(focusMonth(this.focusedDate(), month));
|
|
7673
|
+
this.view.set("day");
|
|
7674
|
+
}
|
|
7675
|
+
chooseYear(year) {
|
|
7676
|
+
this.focusedDate.set(focusYear(this.focusedDate(), year));
|
|
7677
|
+
this.view.set("month");
|
|
7678
|
+
}
|
|
7679
|
+
onDayKeydown(event, date) {
|
|
7680
|
+
const target = dayKeyTarget(event.key, date, this.firstDayOfWeek(), event.shiftKey);
|
|
7681
|
+
if (!target) return;
|
|
7682
|
+
event.preventDefault();
|
|
7683
|
+
this.focusedDate.set(target);
|
|
7684
|
+
afterNextRender(() => this.focusDay(), { injector: this.#injector });
|
|
7685
|
+
}
|
|
7686
|
+
focusDay() {
|
|
7687
|
+
this.#host.nativeElement.querySelector(`.hx-date-picker-date[data-date="${dateKey(this.focusedDate())}"]`)?.focus();
|
|
7688
|
+
}
|
|
7689
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
7690
|
+
minVersion: "12.0.0",
|
|
7691
|
+
version: "22.2.1",
|
|
7692
|
+
ngImport: i0,
|
|
7693
|
+
type: HxCalendar,
|
|
7694
|
+
deps: [],
|
|
7695
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
7696
|
+
});
|
|
7697
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
7698
|
+
minVersion: "17.0.0",
|
|
7699
|
+
version: "22.2.1",
|
|
7700
|
+
type: HxCalendar,
|
|
7701
|
+
isStandalone: true,
|
|
7702
|
+
selector: "hx-calendar",
|
|
7703
|
+
inputs: {
|
|
7704
|
+
focusedDate: {
|
|
7705
|
+
classPropertyName: "focusedDate",
|
|
7706
|
+
publicName: "focusedDate",
|
|
7707
|
+
isSignal: true,
|
|
7708
|
+
isRequired: true,
|
|
7709
|
+
transformFunction: null
|
|
7710
|
+
},
|
|
7711
|
+
view: {
|
|
7712
|
+
classPropertyName: "view",
|
|
7713
|
+
publicName: "view",
|
|
7714
|
+
isSignal: true,
|
|
7715
|
+
isRequired: false,
|
|
7716
|
+
transformFunction: null
|
|
7717
|
+
},
|
|
7718
|
+
selectedDates: {
|
|
7719
|
+
classPropertyName: "selectedDates",
|
|
7720
|
+
publicName: "selectedDates",
|
|
7721
|
+
isSignal: true,
|
|
7722
|
+
isRequired: false,
|
|
7723
|
+
transformFunction: null
|
|
7724
|
+
},
|
|
7725
|
+
selectionMode: {
|
|
7726
|
+
classPropertyName: "selectionMode",
|
|
7727
|
+
publicName: "selectionMode",
|
|
7728
|
+
isSignal: true,
|
|
7729
|
+
isRequired: false,
|
|
7730
|
+
transformFunction: null
|
|
7731
|
+
},
|
|
7732
|
+
minDate: {
|
|
7733
|
+
classPropertyName: "minDate",
|
|
7734
|
+
publicName: "minDate",
|
|
7735
|
+
isSignal: true,
|
|
7736
|
+
isRequired: false,
|
|
7737
|
+
transformFunction: null
|
|
7738
|
+
},
|
|
7739
|
+
maxDate: {
|
|
7740
|
+
classPropertyName: "maxDate",
|
|
7741
|
+
publicName: "maxDate",
|
|
7742
|
+
isSignal: true,
|
|
7743
|
+
isRequired: false,
|
|
7744
|
+
transformFunction: null
|
|
7745
|
+
},
|
|
7746
|
+
disabledDates: {
|
|
7747
|
+
classPropertyName: "disabledDates",
|
|
7748
|
+
publicName: "disabledDates",
|
|
7749
|
+
isSignal: true,
|
|
7750
|
+
isRequired: false,
|
|
7751
|
+
transformFunction: null
|
|
7752
|
+
},
|
|
7753
|
+
firstDayOfWeek: {
|
|
7754
|
+
classPropertyName: "firstDayOfWeek",
|
|
7755
|
+
publicName: "firstDayOfWeek",
|
|
7756
|
+
isSignal: true,
|
|
7757
|
+
isRequired: false,
|
|
7758
|
+
transformFunction: null
|
|
7759
|
+
},
|
|
7760
|
+
locale: {
|
|
7761
|
+
classPropertyName: "locale",
|
|
7762
|
+
publicName: "locale",
|
|
7763
|
+
isSignal: true,
|
|
7764
|
+
isRequired: false,
|
|
7765
|
+
transformFunction: null
|
|
7766
|
+
},
|
|
7767
|
+
disabled: {
|
|
7768
|
+
classPropertyName: "disabled",
|
|
7769
|
+
publicName: "disabled",
|
|
7770
|
+
isSignal: true,
|
|
7771
|
+
isRequired: false,
|
|
7772
|
+
transformFunction: null
|
|
7773
|
+
},
|
|
7774
|
+
titleId: {
|
|
7775
|
+
classPropertyName: "titleId",
|
|
7776
|
+
publicName: "titleId",
|
|
7777
|
+
isSignal: true,
|
|
7778
|
+
isRequired: true,
|
|
7779
|
+
transformFunction: null
|
|
7780
|
+
},
|
|
7781
|
+
today: {
|
|
7782
|
+
classPropertyName: "today",
|
|
7783
|
+
publicName: "today",
|
|
7784
|
+
isSignal: true,
|
|
7785
|
+
isRequired: true,
|
|
7786
|
+
transformFunction: null
|
|
7787
|
+
}
|
|
7788
|
+
},
|
|
7789
|
+
outputs: {
|
|
7790
|
+
focusedDate: "focusedDateChange",
|
|
7791
|
+
view: "viewChange",
|
|
7792
|
+
picked: "picked"
|
|
7793
|
+
},
|
|
7794
|
+
host: { styleAttribute: "display: contents" },
|
|
7795
|
+
ngImport: i0,
|
|
7796
|
+
template: "<div class=\"hx-date-picker-header\">\n <button\n type=\"button\"\n class=\"hx-date-picker-nav hx-date-picker-prev\"\n [attr.aria-label]=\"view() === 'day' ? 'Previous month' : view() === 'month' ? 'Previous year' : 'Previous years'\"\n [disabled]=\"disabled()\"\n (click)=\"step(-1)\"\n >\n <span class=\"hx-date-picker-prev-icon\" aria-hidden=\"true\"></span>\n </button>\n <div class=\"hx-date-picker-title\" [id]=\"titleId()\" aria-live=\"polite\">\n @switch (view()) {\n @case ('day') {\n <button type=\"button\" class=\"hx-date-picker-title-button\" [disabled]=\"disabled()\" (click)=\"view.set('month')\">{{ monthName() }}</button>\n <button type=\"button\" class=\"hx-date-picker-title-button\" [disabled]=\"disabled()\" (click)=\"view.set('year')\">{{ viewYear() }}</button>\n }\n @case ('month') {\n <button type=\"button\" class=\"hx-date-picker-title-button\" [disabled]=\"disabled()\" (click)=\"view.set('year')\">{{ viewYear() }}</button>\n }\n @default {\n <span class=\"hx-date-picker-title-text\">{{ decade()[0] }} – {{ decade()[11] }}</span>\n }\n }\n </div>\n <button\n type=\"button\"\n class=\"hx-date-picker-nav hx-date-picker-next\"\n [attr.aria-label]=\"view() === 'day' ? 'Next month' : view() === 'month' ? 'Next year' : 'Next years'\"\n [disabled]=\"disabled()\"\n (click)=\"step(1)\"\n >\n <span class=\"hx-date-picker-next-icon\" aria-hidden=\"true\"></span>\n </button>\n</div>\n\n@switch (view()) {\n @case ('day') {\n <table class=\"hx-date-picker-grid\" role=\"grid\" [attr.aria-labelledby]=\"titleId()\" [attr.aria-multiselectable]=\"selectionMode() !== 'single' ? 'true' : null\">\n <thead>\n <tr>\n @for (day of weekdays(); track $index) {\n <th scope=\"col\" class=\"hx-date-picker-weekday\" [attr.abbr]=\"day.long\">{{ day.short }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of weeks(); track $index) {\n <tr>\n @for (cell of row; track $index) {\n @if (cell) {\n <td\n role=\"gridcell\"\n class=\"hx-date-picker-cell\"\n [attr.aria-selected]=\"isSelected(cell)\"\n >\n <button\n type=\"button\"\n class=\"hx-date-picker-date\"\n [class.hx-date-picker-date-selected]=\"isSelected(cell)\"\n [class.hx-date-picker-date-in-range]=\"isInRange(cell)\"\n [class.hx-date-picker-date-today]=\"isToday(cell)\"\n [attr.data-date]=\"dateKey(cell)\"\n [attr.tabindex]=\"isFocusTarget(cell) ? 0 : -1\"\n [attr.aria-label]=\"dayLabel(cell)\"\n [attr.aria-current]=\"isToday(cell) ? 'date' : null\"\n [attr.aria-disabled]=\"isDateDisabled(cell) ? 'true' : null\"\n [disabled]=\"disabled()\"\n (click)=\"picked.emit(cell)\"\n (keydown)=\"onDayKeydown($event, cell)\"\n >\n {{ cell.getDate() }}\n </button>\n </td>\n } @else {\n <td class=\"hx-date-picker-cell hx-date-picker-cell-empty\" role=\"gridcell\"></td>\n }\n }\n </tr>\n }\n </tbody>\n </table>\n }\n @case ('month') {\n <div class=\"hx-date-picker-months\">\n @for (name of monthNames(); track $index) {\n <button\n type=\"button\"\n class=\"hx-date-picker-month\"\n [class.hx-date-picker-month-selected]=\"$index === focusedDate().getMonth() && viewYear() === focusedDate().getFullYear()\"\n [disabled]=\"disabled()\"\n (click)=\"chooseMonth($index)\"\n >\n {{ name }}\n </button>\n }\n </div>\n }\n @default {\n <div class=\"hx-date-picker-years\">\n @for (year of decade(); track year) {\n <button\n type=\"button\"\n class=\"hx-date-picker-year\"\n [class.hx-date-picker-year-selected]=\"year === focusedDate().getFullYear()\"\n [disabled]=\"disabled()\"\n (click)=\"chooseYear(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n }\n}\n",
|
|
7797
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
7798
|
+
});
|
|
7799
|
+
};
|
|
7800
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
7801
|
+
minVersion: "12.0.0",
|
|
7802
|
+
version: "22.2.1",
|
|
7803
|
+
ngImport: i0,
|
|
7804
|
+
type: HxCalendar,
|
|
7805
|
+
decorators: [{
|
|
7806
|
+
type: Component,
|
|
7807
|
+
args: [{
|
|
7808
|
+
selector: "hx-calendar",
|
|
7809
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
7810
|
+
host: { style: "display: contents" },
|
|
7811
|
+
template: "<div class=\"hx-date-picker-header\">\n <button\n type=\"button\"\n class=\"hx-date-picker-nav hx-date-picker-prev\"\n [attr.aria-label]=\"view() === 'day' ? 'Previous month' : view() === 'month' ? 'Previous year' : 'Previous years'\"\n [disabled]=\"disabled()\"\n (click)=\"step(-1)\"\n >\n <span class=\"hx-date-picker-prev-icon\" aria-hidden=\"true\"></span>\n </button>\n <div class=\"hx-date-picker-title\" [id]=\"titleId()\" aria-live=\"polite\">\n @switch (view()) {\n @case ('day') {\n <button type=\"button\" class=\"hx-date-picker-title-button\" [disabled]=\"disabled()\" (click)=\"view.set('month')\">{{ monthName() }}</button>\n <button type=\"button\" class=\"hx-date-picker-title-button\" [disabled]=\"disabled()\" (click)=\"view.set('year')\">{{ viewYear() }}</button>\n }\n @case ('month') {\n <button type=\"button\" class=\"hx-date-picker-title-button\" [disabled]=\"disabled()\" (click)=\"view.set('year')\">{{ viewYear() }}</button>\n }\n @default {\n <span class=\"hx-date-picker-title-text\">{{ decade()[0] }} – {{ decade()[11] }}</span>\n }\n }\n </div>\n <button\n type=\"button\"\n class=\"hx-date-picker-nav hx-date-picker-next\"\n [attr.aria-label]=\"view() === 'day' ? 'Next month' : view() === 'month' ? 'Next year' : 'Next years'\"\n [disabled]=\"disabled()\"\n (click)=\"step(1)\"\n >\n <span class=\"hx-date-picker-next-icon\" aria-hidden=\"true\"></span>\n </button>\n</div>\n\n@switch (view()) {\n @case ('day') {\n <table class=\"hx-date-picker-grid\" role=\"grid\" [attr.aria-labelledby]=\"titleId()\" [attr.aria-multiselectable]=\"selectionMode() !== 'single' ? 'true' : null\">\n <thead>\n <tr>\n @for (day of weekdays(); track $index) {\n <th scope=\"col\" class=\"hx-date-picker-weekday\" [attr.abbr]=\"day.long\">{{ day.short }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of weeks(); track $index) {\n <tr>\n @for (cell of row; track $index) {\n @if (cell) {\n <td\n role=\"gridcell\"\n class=\"hx-date-picker-cell\"\n [attr.aria-selected]=\"isSelected(cell)\"\n >\n <button\n type=\"button\"\n class=\"hx-date-picker-date\"\n [class.hx-date-picker-date-selected]=\"isSelected(cell)\"\n [class.hx-date-picker-date-in-range]=\"isInRange(cell)\"\n [class.hx-date-picker-date-today]=\"isToday(cell)\"\n [attr.data-date]=\"dateKey(cell)\"\n [attr.tabindex]=\"isFocusTarget(cell) ? 0 : -1\"\n [attr.aria-label]=\"dayLabel(cell)\"\n [attr.aria-current]=\"isToday(cell) ? 'date' : null\"\n [attr.aria-disabled]=\"isDateDisabled(cell) ? 'true' : null\"\n [disabled]=\"disabled()\"\n (click)=\"picked.emit(cell)\"\n (keydown)=\"onDayKeydown($event, cell)\"\n >\n {{ cell.getDate() }}\n </button>\n </td>\n } @else {\n <td class=\"hx-date-picker-cell hx-date-picker-cell-empty\" role=\"gridcell\"></td>\n }\n }\n </tr>\n }\n </tbody>\n </table>\n }\n @case ('month') {\n <div class=\"hx-date-picker-months\">\n @for (name of monthNames(); track $index) {\n <button\n type=\"button\"\n class=\"hx-date-picker-month\"\n [class.hx-date-picker-month-selected]=\"$index === focusedDate().getMonth() && viewYear() === focusedDate().getFullYear()\"\n [disabled]=\"disabled()\"\n (click)=\"chooseMonth($index)\"\n >\n {{ name }}\n </button>\n }\n </div>\n }\n @default {\n <div class=\"hx-date-picker-years\">\n @for (year of decade(); track year) {\n <button\n type=\"button\"\n class=\"hx-date-picker-year\"\n [class.hx-date-picker-year-selected]=\"year === focusedDate().getFullYear()\"\n [disabled]=\"disabled()\"\n (click)=\"chooseYear(year)\"\n >\n {{ year }}\n </button>\n }\n </div>\n }\n}\n"
|
|
7812
|
+
}]
|
|
7813
|
+
}],
|
|
7814
|
+
propDecorators: {
|
|
7815
|
+
focusedDate: [{
|
|
7816
|
+
type: i0.Input,
|
|
7817
|
+
args: [{
|
|
7818
|
+
isSignal: true,
|
|
7819
|
+
alias: "focusedDate",
|
|
7820
|
+
required: true
|
|
7821
|
+
}]
|
|
7822
|
+
}, {
|
|
7823
|
+
type: i0.Output,
|
|
7824
|
+
args: ["focusedDateChange"]
|
|
7825
|
+
}],
|
|
7826
|
+
view: [{
|
|
7827
|
+
type: i0.Input,
|
|
7828
|
+
args: [{
|
|
7829
|
+
isSignal: true,
|
|
7830
|
+
alias: "view",
|
|
7831
|
+
required: false
|
|
7832
|
+
}]
|
|
7833
|
+
}, {
|
|
7834
|
+
type: i0.Output,
|
|
7835
|
+
args: ["viewChange"]
|
|
7836
|
+
}],
|
|
7837
|
+
selectedDates: [{
|
|
7838
|
+
type: i0.Input,
|
|
7839
|
+
args: [{
|
|
7840
|
+
isSignal: true,
|
|
7841
|
+
alias: "selectedDates",
|
|
7842
|
+
required: false
|
|
7843
|
+
}]
|
|
7844
|
+
}],
|
|
7845
|
+
selectionMode: [{
|
|
7846
|
+
type: i0.Input,
|
|
7847
|
+
args: [{
|
|
7848
|
+
isSignal: true,
|
|
7849
|
+
alias: "selectionMode",
|
|
7850
|
+
required: false
|
|
7851
|
+
}]
|
|
7852
|
+
}],
|
|
7853
|
+
minDate: [{
|
|
7854
|
+
type: i0.Input,
|
|
7855
|
+
args: [{
|
|
7856
|
+
isSignal: true,
|
|
7857
|
+
alias: "minDate",
|
|
7858
|
+
required: false
|
|
7859
|
+
}]
|
|
7860
|
+
}],
|
|
7861
|
+
maxDate: [{
|
|
7862
|
+
type: i0.Input,
|
|
7863
|
+
args: [{
|
|
7864
|
+
isSignal: true,
|
|
7865
|
+
alias: "maxDate",
|
|
7866
|
+
required: false
|
|
7867
|
+
}]
|
|
7868
|
+
}],
|
|
7869
|
+
disabledDates: [{
|
|
7870
|
+
type: i0.Input,
|
|
7871
|
+
args: [{
|
|
7872
|
+
isSignal: true,
|
|
7873
|
+
alias: "disabledDates",
|
|
7874
|
+
required: false
|
|
7875
|
+
}]
|
|
7876
|
+
}],
|
|
7877
|
+
firstDayOfWeek: [{
|
|
7878
|
+
type: i0.Input,
|
|
7879
|
+
args: [{
|
|
7880
|
+
isSignal: true,
|
|
7881
|
+
alias: "firstDayOfWeek",
|
|
7882
|
+
required: false
|
|
7883
|
+
}]
|
|
7884
|
+
}],
|
|
7885
|
+
locale: [{
|
|
7886
|
+
type: i0.Input,
|
|
7887
|
+
args: [{
|
|
7888
|
+
isSignal: true,
|
|
7889
|
+
alias: "locale",
|
|
7890
|
+
required: false
|
|
7891
|
+
}]
|
|
7892
|
+
}],
|
|
7893
|
+
disabled: [{
|
|
7894
|
+
type: i0.Input,
|
|
7895
|
+
args: [{
|
|
7896
|
+
isSignal: true,
|
|
7897
|
+
alias: "disabled",
|
|
7898
|
+
required: false
|
|
7899
|
+
}]
|
|
7900
|
+
}],
|
|
7901
|
+
titleId: [{
|
|
7902
|
+
type: i0.Input,
|
|
7903
|
+
args: [{
|
|
7904
|
+
isSignal: true,
|
|
7905
|
+
alias: "titleId",
|
|
7906
|
+
required: true
|
|
7907
|
+
}]
|
|
7908
|
+
}],
|
|
7909
|
+
today: [{
|
|
7910
|
+
type: i0.Input,
|
|
7911
|
+
args: [{
|
|
7912
|
+
isSignal: true,
|
|
7913
|
+
alias: "today",
|
|
7914
|
+
required: true
|
|
7915
|
+
}]
|
|
7916
|
+
}],
|
|
7917
|
+
picked: [{
|
|
7918
|
+
type: i0.Output,
|
|
7919
|
+
args: ["picked"]
|
|
7920
|
+
}]
|
|
7921
|
+
}
|
|
7922
|
+
});
|
|
7923
|
+
function parseDateText(text, locale) {
|
|
7924
|
+
const numbers = text.match(/\d+/g)?.map(Number);
|
|
7925
|
+
if (!numbers || numbers.length !== 3) return null;
|
|
7926
|
+
let [year, month, day] = [
|
|
7927
|
+
0,
|
|
7928
|
+
0,
|
|
7929
|
+
0
|
|
7930
|
+
];
|
|
7931
|
+
if (/^\d{4}\D/.test(text.trim())) [year, month, day] = numbers;
|
|
7932
|
+
else {
|
|
7933
|
+
const order = new Intl.DateTimeFormat(locale, {
|
|
7934
|
+
day: "numeric",
|
|
7935
|
+
month: "numeric",
|
|
7936
|
+
year: "numeric"
|
|
7937
|
+
}).formatToParts(new Date(2e3, 10, 22)).filter((p) => [
|
|
7938
|
+
"day",
|
|
7939
|
+
"month",
|
|
7940
|
+
"year"
|
|
7941
|
+
].includes(p.type)).map((p) => p.type);
|
|
7942
|
+
const byType = Object.fromEntries(order.map((type, i) => [type, numbers[i]]));
|
|
7943
|
+
[year, month, day] = [
|
|
7944
|
+
byType["year"],
|
|
7945
|
+
byType["month"],
|
|
7946
|
+
byType["day"]
|
|
7947
|
+
];
|
|
7948
|
+
}
|
|
7949
|
+
if (year < 100) year += 2e3;
|
|
7950
|
+
const date = new Date(year, month - 1, day);
|
|
7951
|
+
return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day ? date : null;
|
|
7952
|
+
}
|
|
7953
|
+
function parseDateTimeText(text, options) {
|
|
7954
|
+
const period12 = "(?:\\s*([ap])\\.?\\s*m\\.?)?";
|
|
7955
|
+
const match = options.showMinutes ? new RegExp(`(\\d{1,2}):(\\d{2})(?::(\\d{2}))?${period12}`, "i").exec(text) : new RegExp(`(?:^|[\\s,;T])(\\d{1,2})(?::00(?::00)?)?${period12}\\s*$`, "i").exec(text);
|
|
7956
|
+
if (!match) return null;
|
|
7957
|
+
let hours = Number(match[1]);
|
|
7958
|
+
const hourOnly = !options.showMinutes;
|
|
7959
|
+
const [minutes, seconds] = hourOnly ? [0, 0] : [Number(match[2]), Number(match[3] ?? 0)];
|
|
7960
|
+
const period = (hourOnly ? match[2] : match[4])?.toLowerCase();
|
|
7961
|
+
if (period) {
|
|
7962
|
+
if (hours < 1 || hours > 12) return null;
|
|
7963
|
+
hours = hours % 12 + (period === "p" ? 12 : 0);
|
|
7964
|
+
}
|
|
7965
|
+
if (hours > 23 || minutes > 59 || seconds > 59) return null;
|
|
7966
|
+
const rest = text.replace(match[0], hourOnly ? " " : "").replace(/^[\s,;T]+|[\s,;T]+$/g, "");
|
|
7967
|
+
if (/\p{L}/u.test(rest)) return null;
|
|
7968
|
+
const day = options.timeOnly && rest === "" ? startOfDay(options.fallbackDay) : parseDateText(rest, options.locale);
|
|
7969
|
+
return day && withTime(day, hours, minutes, seconds);
|
|
7970
|
+
}
|
|
7971
|
+
const startOfDayOrNull$1 = (date) => isValidDate(date) ? startOfDay(date) : null;
|
|
7972
|
+
var HxDatePicker = class HxDatePicker {
|
|
7973
|
+
#host = inject(ElementRef);
|
|
7974
|
+
#injector = inject(Injector);
|
|
7975
|
+
placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
7976
|
+
showIcon = input(false, {
|
|
7977
|
+
...ngDevMode ? { debugName: "showIcon" } : /* istanbul ignore next */ {},
|
|
7978
|
+
transform: booleanAttribute
|
|
7979
|
+
});
|
|
7980
|
+
showButtonBar = input(false, {
|
|
7981
|
+
...ngDevMode ? { debugName: "showButtonBar" } : /* istanbul ignore next */ {},
|
|
7982
|
+
transform: booleanAttribute
|
|
7983
|
+
});
|
|
7984
|
+
dateFormat = input(...ngDevMode ? [void 0, { debugName: "dateFormat" }] : /* istanbul ignore next */ []);
|
|
7985
|
+
todayLabel = input("Today", ...ngDevMode ? [{ debugName: "todayLabel" }] : /* istanbul ignore next */ []);
|
|
7986
|
+
clearLabel = input("Clear", ...ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []);
|
|
7987
|
+
chooseLabel = input("Choose date", ...ngDevMode ? [{ debugName: "chooseLabel" }] : /* istanbul ignore next */ []);
|
|
7988
|
+
inputId = input(...ngDevMode ? [void 0, { debugName: "inputId" }] : /* istanbul ignore next */ []);
|
|
7989
|
+
inline = input(false, {
|
|
7990
|
+
...ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {},
|
|
7991
|
+
transform: booleanAttribute
|
|
7992
|
+
});
|
|
7993
|
+
selectionMode = input("single", ...ngDevMode ? [{ debugName: "selectionMode" }] : /* istanbul ignore next */ []);
|
|
7994
|
+
minDate = input(null, ...ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []);
|
|
7995
|
+
maxDate = input(null, ...ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []);
|
|
7996
|
+
disabledDates = input([], ...ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []);
|
|
7997
|
+
firstDayOfWeek = input(0, {
|
|
7998
|
+
...ngDevMode ? { debugName: "firstDayOfWeek" } : /* istanbul ignore next */ {},
|
|
7999
|
+
transform: numberAttribute
|
|
8000
|
+
});
|
|
8001
|
+
locale = input(...ngDevMode ? [void 0, { debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
8002
|
+
ariaLabel = input(...ngDevMode ? [void 0, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
8003
|
+
ariaLabelledby = input(...ngDevMode ? [void 0, { debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []);
|
|
8004
|
+
value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
8005
|
+
disabled = input(false, {
|
|
8006
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
8007
|
+
transform: booleanAttribute
|
|
8008
|
+
});
|
|
8009
|
+
invalid = input(false, {
|
|
8010
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
8011
|
+
transform: booleanAttribute
|
|
8012
|
+
});
|
|
8013
|
+
touch = output();
|
|
8014
|
+
open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
8015
|
+
titleId = nextId("hx-date-picker-title");
|
|
8016
|
+
popupId = nextId("hx-date-picker-popup");
|
|
8017
|
+
positions = [{
|
|
8018
|
+
originX: "start",
|
|
8019
|
+
originY: "bottom",
|
|
8020
|
+
overlayX: "start",
|
|
8021
|
+
overlayY: "top",
|
|
8022
|
+
offsetY: 2
|
|
8023
|
+
}, {
|
|
8024
|
+
originX: "start",
|
|
8025
|
+
originY: "top",
|
|
8026
|
+
overlayX: "start",
|
|
8027
|
+
overlayY: "bottom",
|
|
8028
|
+
offsetY: -2
|
|
8029
|
+
}];
|
|
8030
|
+
field = viewChild("field", ...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
|
|
8031
|
+
calendar = viewChild(HxCalendar, ...ngDevMode ? [{ debugName: "calendar" }] : /* istanbul ignore next */ []);
|
|
8032
|
+
#typed = signal(null, ...ngDevMode ? [{ debugName: "#typed" }] : /* istanbul ignore next */ []);
|
|
8033
|
+
view = signal("day", ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
|
|
8034
|
+
#cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "#cvaDisabled" }] : /* istanbul ignore next */ []);
|
|
8035
|
+
isDisabled = computed(() => this.disabled() || this.#cvaDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
8036
|
+
focusedDate = signal(startOfDay(/* @__PURE__ */ new Date()), ...ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []);
|
|
8037
|
+
today = startOfDay(/* @__PURE__ */ new Date());
|
|
8038
|
+
selectedDates = computed(() => {
|
|
8039
|
+
const value = this.value();
|
|
8040
|
+
if (Array.isArray(value)) return value.filter(isValidDate);
|
|
8041
|
+
return isValidDate(value) ? [value] : [];
|
|
8042
|
+
}, ...ngDevMode ? [{ debugName: "selectedDates" }] : /* istanbul ignore next */ []);
|
|
8043
|
+
#format = computed(() => new Intl.DateTimeFormat(this.locale(), this.dateFormat() ?? {
|
|
8044
|
+
day: "2-digit",
|
|
8045
|
+
month: "2-digit",
|
|
8046
|
+
year: "numeric"
|
|
8047
|
+
}), ...ngDevMode ? [{ debugName: "#format" }] : /* istanbul ignore next */ []);
|
|
8048
|
+
text = computed(() => {
|
|
8049
|
+
const typed = this.#typed();
|
|
8050
|
+
if (typed !== null) return typed;
|
|
8051
|
+
const dates = this.selectedDates();
|
|
8052
|
+
const fmt = this.#format();
|
|
8053
|
+
if (this.selectionMode() === "range") return dates.map((d) => fmt.format(d)).join(" – ");
|
|
8054
|
+
return dates.map((d) => fmt.format(d)).join(", ");
|
|
8055
|
+
}, ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
8056
|
+
constructor() {
|
|
8057
|
+
effect(() => {
|
|
8058
|
+
const first = this.selectedDates()[0] ?? clampTime(this.today, startOfDayOrNull$1(this.minDate()), this.maxDate());
|
|
8059
|
+
const shown = untracked(() => this.focusedDate());
|
|
8060
|
+
if (first && (first.getFullYear() !== shown.getFullYear() || first.getMonth() !== shown.getMonth())) this.focusedDate.set(startOfDay(first));
|
|
8061
|
+
});
|
|
8062
|
+
}
|
|
8063
|
+
#onChange = () => {};
|
|
8064
|
+
#onTouched = () => {};
|
|
8065
|
+
writeValue(value) {
|
|
8066
|
+
this.#typed.set(null);
|
|
8067
|
+
this.value.set(value ?? null);
|
|
8068
|
+
}
|
|
8069
|
+
registerOnChange(fn) {
|
|
8070
|
+
this.#onChange = fn;
|
|
8071
|
+
}
|
|
8072
|
+
registerOnTouched(fn) {
|
|
8073
|
+
this.#onTouched = fn;
|
|
8074
|
+
}
|
|
8075
|
+
setDisabledState(disabled) {
|
|
8076
|
+
this.#cvaDisabled.set(disabled);
|
|
8077
|
+
}
|
|
8078
|
+
focus() {
|
|
8079
|
+
const field = this.field();
|
|
8080
|
+
if (field) field.nativeElement.focus();
|
|
8081
|
+
else this.#focusDay();
|
|
8082
|
+
}
|
|
8083
|
+
isDateDisabled(date) {
|
|
8084
|
+
return isDateDisabled(date, {
|
|
8085
|
+
min: this.minDate(),
|
|
8086
|
+
max: this.maxDate(),
|
|
8087
|
+
disabledDates: this.disabledDates()
|
|
8088
|
+
});
|
|
8089
|
+
}
|
|
8090
|
+
isSelected(date) {
|
|
8091
|
+
return this.selectedDates().some((d) => isSameDay(d, date));
|
|
8092
|
+
}
|
|
8093
|
+
pick(date) {
|
|
8094
|
+
if (this.isDisabled() || this.isDateDisabled(date)) return;
|
|
8095
|
+
const day = startOfDay(date);
|
|
8096
|
+
this.focusedDate.set(day);
|
|
8097
|
+
const selected = this.selectedDates();
|
|
8098
|
+
let next;
|
|
8099
|
+
const mode = this.selectionMode();
|
|
8100
|
+
switch (mode) {
|
|
8101
|
+
case "multiple":
|
|
8102
|
+
next = this.isSelected(day) ? selected.filter((d) => !isSameDay(d, day)) : [...selected, day];
|
|
8103
|
+
break;
|
|
8104
|
+
case "range":
|
|
8105
|
+
if (selected.length !== 1) next = [day];
|
|
8106
|
+
else next = compareDays(day, selected[0]) < 0 ? [day, selected[0]] : [selected[0], day];
|
|
8107
|
+
break;
|
|
8108
|
+
default: next = day;
|
|
8109
|
+
}
|
|
8110
|
+
this.#typed.set(null);
|
|
8111
|
+
this.#commit(next);
|
|
8112
|
+
if (!this.inline()) {
|
|
8113
|
+
if (mode === "single" || mode === "range" && Array.isArray(next) && next.length === 2) this.close(true);
|
|
8114
|
+
}
|
|
8115
|
+
}
|
|
8116
|
+
#commit(next) {
|
|
8117
|
+
this.value.set(next);
|
|
8118
|
+
this.#onChange(next);
|
|
8119
|
+
}
|
|
8120
|
+
#focusDay() {
|
|
8121
|
+
afterNextRender(() => {
|
|
8122
|
+
this.calendar()?.focusDay();
|
|
8123
|
+
}, { injector: this.#injector });
|
|
8124
|
+
}
|
|
8125
|
+
show() {
|
|
8126
|
+
if (this.isDisabled() || this.inline() || this.open()) return;
|
|
8127
|
+
this.open.set(true);
|
|
8128
|
+
}
|
|
8129
|
+
toggle() {
|
|
8130
|
+
if (this.open()) this.close(true);
|
|
8131
|
+
else this.show();
|
|
8132
|
+
}
|
|
8133
|
+
close(refocus = false) {
|
|
8134
|
+
if (!this.open()) return;
|
|
8135
|
+
this.open.set(false);
|
|
8136
|
+
if (refocus) this.field()?.nativeElement.focus();
|
|
8137
|
+
}
|
|
8138
|
+
onAttach() {
|
|
8139
|
+
const first = this.selectedDates()[0];
|
|
8140
|
+
this.view.set("day");
|
|
8141
|
+
this.focusedDate.set(startOfDay(first ?? clampTime(this.today, startOfDayOrNull$1(this.minDate()), this.maxDate())));
|
|
8142
|
+
this.#focusDay();
|
|
8143
|
+
}
|
|
8144
|
+
onOverlayKeydown(event) {
|
|
8145
|
+
if (event.key === "Escape") {
|
|
8146
|
+
event.preventDefault();
|
|
8147
|
+
this.close(true);
|
|
8148
|
+
}
|
|
8149
|
+
}
|
|
8150
|
+
onOutsideClick(event) {
|
|
8151
|
+
if (!this.#host.nativeElement.contains(event.target)) this.close();
|
|
8152
|
+
}
|
|
8153
|
+
onFieldKeydown(event) {
|
|
8154
|
+
if (event.key === "ArrowDown" || event.altKey && event.key === "ArrowUp") {
|
|
8155
|
+
event.preventDefault();
|
|
8156
|
+
this.show();
|
|
8157
|
+
} else if (event.key === "Enter") this.commitTyping();
|
|
8158
|
+
}
|
|
8159
|
+
onTyping(event) {
|
|
8160
|
+
this.#typed.set(event.target.value);
|
|
8161
|
+
}
|
|
8162
|
+
commitTyping() {
|
|
8163
|
+
const typed = this.#typed();
|
|
8164
|
+
if (typed === null) return;
|
|
8165
|
+
this.#typed.set(null);
|
|
8166
|
+
this.#parseAndCommit(typed);
|
|
8167
|
+
const field = this.field();
|
|
8168
|
+
if (field) field.nativeElement.value = this.text();
|
|
8169
|
+
}
|
|
8170
|
+
#parseAndCommit(typed) {
|
|
8171
|
+
const text = typed.trim();
|
|
8172
|
+
if (text === "") {
|
|
8173
|
+
this.#commit(this.selectionMode() === "single" ? null : []);
|
|
8174
|
+
return;
|
|
8175
|
+
}
|
|
8176
|
+
const dates = (this.selectionMode() === "single" ? [text] : text.split(/\s*(?:,|–)\s*/)).map((part) => this.#parse(part));
|
|
8177
|
+
if (dates.some((d) => d === null || this.isDateDisabled(d))) return;
|
|
8178
|
+
const valid = dates;
|
|
8179
|
+
if (this.selectionMode() === "range" && valid.length > 2) return;
|
|
8180
|
+
this.#commit(this.selectionMode() === "single" ? valid[0] : valid);
|
|
8181
|
+
if (valid[0]) this.focusedDate.set(startOfDay(valid[0]));
|
|
8182
|
+
}
|
|
8183
|
+
#parse(text) {
|
|
8184
|
+
return parseDateText(text, this.locale());
|
|
8185
|
+
}
|
|
8186
|
+
selectToday() {
|
|
8187
|
+
this.pick(this.today);
|
|
8188
|
+
}
|
|
8189
|
+
clear() {
|
|
8190
|
+
this.#typed.set(null);
|
|
8191
|
+
this.#commit(this.selectionMode() === "single" ? null : []);
|
|
8192
|
+
this.close(true);
|
|
8193
|
+
}
|
|
8194
|
+
onHostFocusOut(event) {
|
|
8195
|
+
if (this.inline()) return;
|
|
8196
|
+
const next = event.relatedTarget;
|
|
8197
|
+
if (next?.closest(".hx-date-picker-popup") || this.#host.nativeElement.contains(next)) return;
|
|
8198
|
+
if (this.open()) return;
|
|
8199
|
+
this.close();
|
|
8200
|
+
this.commitTyping();
|
|
8201
|
+
this.#onTouched();
|
|
8202
|
+
this.touch.emit();
|
|
8203
|
+
}
|
|
8204
|
+
onFocusOut(event) {
|
|
8205
|
+
if (!this.inline()) return;
|
|
8206
|
+
if (this.#host.nativeElement.contains(event.relatedTarget)) return;
|
|
8207
|
+
this.#onTouched();
|
|
8208
|
+
this.touch.emit();
|
|
8209
|
+
}
|
|
8210
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
8211
|
+
minVersion: "12.0.0",
|
|
8212
|
+
version: "22.2.1",
|
|
8213
|
+
ngImport: i0,
|
|
8214
|
+
type: HxDatePicker,
|
|
8215
|
+
deps: [],
|
|
8216
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
8217
|
+
});
|
|
8218
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
8219
|
+
minVersion: "17.0.0",
|
|
8220
|
+
version: "22.2.1",
|
|
8221
|
+
type: HxDatePicker,
|
|
8222
|
+
isStandalone: true,
|
|
8223
|
+
selector: "hx-date-picker",
|
|
8224
|
+
inputs: {
|
|
8225
|
+
placeholder: {
|
|
8226
|
+
classPropertyName: "placeholder",
|
|
8227
|
+
publicName: "placeholder",
|
|
8228
|
+
isSignal: true,
|
|
8229
|
+
isRequired: false,
|
|
8230
|
+
transformFunction: null
|
|
8231
|
+
},
|
|
8232
|
+
showIcon: {
|
|
8233
|
+
classPropertyName: "showIcon",
|
|
8234
|
+
publicName: "showIcon",
|
|
8235
|
+
isSignal: true,
|
|
8236
|
+
isRequired: false,
|
|
8237
|
+
transformFunction: null
|
|
8238
|
+
},
|
|
8239
|
+
showButtonBar: {
|
|
8240
|
+
classPropertyName: "showButtonBar",
|
|
8241
|
+
publicName: "showButtonBar",
|
|
8242
|
+
isSignal: true,
|
|
8243
|
+
isRequired: false,
|
|
8244
|
+
transformFunction: null
|
|
8245
|
+
},
|
|
8246
|
+
dateFormat: {
|
|
8247
|
+
classPropertyName: "dateFormat",
|
|
8248
|
+
publicName: "dateFormat",
|
|
8249
|
+
isSignal: true,
|
|
8250
|
+
isRequired: false,
|
|
8251
|
+
transformFunction: null
|
|
8252
|
+
},
|
|
8253
|
+
todayLabel: {
|
|
8254
|
+
classPropertyName: "todayLabel",
|
|
8255
|
+
publicName: "todayLabel",
|
|
8256
|
+
isSignal: true,
|
|
8257
|
+
isRequired: false,
|
|
8258
|
+
transformFunction: null
|
|
8259
|
+
},
|
|
8260
|
+
clearLabel: {
|
|
8261
|
+
classPropertyName: "clearLabel",
|
|
8262
|
+
publicName: "clearLabel",
|
|
8263
|
+
isSignal: true,
|
|
8264
|
+
isRequired: false,
|
|
8265
|
+
transformFunction: null
|
|
8266
|
+
},
|
|
8267
|
+
chooseLabel: {
|
|
8268
|
+
classPropertyName: "chooseLabel",
|
|
8269
|
+
publicName: "chooseLabel",
|
|
8270
|
+
isSignal: true,
|
|
8271
|
+
isRequired: false,
|
|
8272
|
+
transformFunction: null
|
|
8273
|
+
},
|
|
8274
|
+
inputId: {
|
|
8275
|
+
classPropertyName: "inputId",
|
|
8276
|
+
publicName: "inputId",
|
|
8277
|
+
isSignal: true,
|
|
8278
|
+
isRequired: false,
|
|
8279
|
+
transformFunction: null
|
|
8280
|
+
},
|
|
8281
|
+
inline: {
|
|
8282
|
+
classPropertyName: "inline",
|
|
8283
|
+
publicName: "inline",
|
|
8284
|
+
isSignal: true,
|
|
8285
|
+
isRequired: false,
|
|
8286
|
+
transformFunction: null
|
|
8287
|
+
},
|
|
8288
|
+
selectionMode: {
|
|
8289
|
+
classPropertyName: "selectionMode",
|
|
8290
|
+
publicName: "selectionMode",
|
|
8291
|
+
isSignal: true,
|
|
8292
|
+
isRequired: false,
|
|
8293
|
+
transformFunction: null
|
|
8294
|
+
},
|
|
8295
|
+
minDate: {
|
|
8296
|
+
classPropertyName: "minDate",
|
|
8297
|
+
publicName: "minDate",
|
|
8298
|
+
isSignal: true,
|
|
8299
|
+
isRequired: false,
|
|
8300
|
+
transformFunction: null
|
|
8301
|
+
},
|
|
8302
|
+
maxDate: {
|
|
8303
|
+
classPropertyName: "maxDate",
|
|
8304
|
+
publicName: "maxDate",
|
|
8305
|
+
isSignal: true,
|
|
8306
|
+
isRequired: false,
|
|
8307
|
+
transformFunction: null
|
|
8308
|
+
},
|
|
8309
|
+
disabledDates: {
|
|
8310
|
+
classPropertyName: "disabledDates",
|
|
8311
|
+
publicName: "disabledDates",
|
|
8312
|
+
isSignal: true,
|
|
8313
|
+
isRequired: false,
|
|
8314
|
+
transformFunction: null
|
|
8315
|
+
},
|
|
8316
|
+
firstDayOfWeek: {
|
|
8317
|
+
classPropertyName: "firstDayOfWeek",
|
|
8318
|
+
publicName: "firstDayOfWeek",
|
|
8319
|
+
isSignal: true,
|
|
8320
|
+
isRequired: false,
|
|
8321
|
+
transformFunction: null
|
|
8322
|
+
},
|
|
8323
|
+
locale: {
|
|
8324
|
+
classPropertyName: "locale",
|
|
8325
|
+
publicName: "locale",
|
|
8326
|
+
isSignal: true,
|
|
8327
|
+
isRequired: false,
|
|
8328
|
+
transformFunction: null
|
|
8329
|
+
},
|
|
8330
|
+
ariaLabel: {
|
|
8331
|
+
classPropertyName: "ariaLabel",
|
|
8332
|
+
publicName: "ariaLabel",
|
|
8333
|
+
isSignal: true,
|
|
8334
|
+
isRequired: false,
|
|
8335
|
+
transformFunction: null
|
|
8336
|
+
},
|
|
8337
|
+
ariaLabelledby: {
|
|
8338
|
+
classPropertyName: "ariaLabelledby",
|
|
8339
|
+
publicName: "ariaLabelledby",
|
|
8340
|
+
isSignal: true,
|
|
8341
|
+
isRequired: false,
|
|
8342
|
+
transformFunction: null
|
|
8343
|
+
},
|
|
8344
|
+
value: {
|
|
8345
|
+
classPropertyName: "value",
|
|
8346
|
+
publicName: "value",
|
|
8347
|
+
isSignal: true,
|
|
8348
|
+
isRequired: false,
|
|
8349
|
+
transformFunction: null
|
|
8350
|
+
},
|
|
8351
|
+
disabled: {
|
|
8352
|
+
classPropertyName: "disabled",
|
|
8353
|
+
publicName: "disabled",
|
|
8354
|
+
isSignal: true,
|
|
8355
|
+
isRequired: false,
|
|
8356
|
+
transformFunction: null
|
|
8357
|
+
},
|
|
8358
|
+
invalid: {
|
|
8359
|
+
classPropertyName: "invalid",
|
|
8360
|
+
publicName: "invalid",
|
|
8361
|
+
isSignal: true,
|
|
8362
|
+
isRequired: false,
|
|
8363
|
+
transformFunction: null
|
|
8364
|
+
}
|
|
8365
|
+
},
|
|
8366
|
+
outputs: {
|
|
8367
|
+
value: "valueChange",
|
|
8368
|
+
touch: "touch"
|
|
8369
|
+
},
|
|
8370
|
+
host: {
|
|
8371
|
+
listeners: { "focusout": "onHostFocusOut($event)" },
|
|
8372
|
+
properties: {
|
|
8373
|
+
"class.hx-date-picker-inline": "inline()",
|
|
8374
|
+
"class.hx-date-picker-disabled": "isDisabled()",
|
|
8375
|
+
"class.hx-date-picker-invalid": "invalid()",
|
|
8376
|
+
"class.hx-date-picker-open": "open()",
|
|
8377
|
+
"class.hx-date-picker-has-icon": "showIcon() && !inline()",
|
|
8378
|
+
"class.hx-filled": "!inline() && text() !== \"\""
|
|
8379
|
+
},
|
|
8380
|
+
classAttribute: "hx-date-picker"
|
|
8381
|
+
},
|
|
8382
|
+
providers: [{
|
|
8383
|
+
provide: NG_VALUE_ACCESSOR,
|
|
8384
|
+
useExisting: forwardRef(() => HxDatePicker),
|
|
8385
|
+
multi: true
|
|
8386
|
+
}],
|
|
8387
|
+
viewQueries: [{
|
|
8388
|
+
propertyName: "field",
|
|
8389
|
+
first: true,
|
|
8390
|
+
predicate: ["field"],
|
|
8391
|
+
descendants: true,
|
|
8392
|
+
isSignal: true
|
|
8393
|
+
}, {
|
|
8394
|
+
propertyName: "calendar",
|
|
8395
|
+
first: true,
|
|
8396
|
+
predicate: HxCalendar,
|
|
8397
|
+
descendants: true,
|
|
8398
|
+
isSignal: true
|
|
8399
|
+
}],
|
|
8400
|
+
ngImport: i0,
|
|
8401
|
+
template: "@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"calendar\" />\n} @else {\n <div class=\"hx-date-picker-field\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #field\n type=\"text\"\n class=\"hx-date-picker-input\"\n autocomplete=\"off\"\n aria-haspopup=\"dialog\"\n [attr.id]=\"inputId() ?? null\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"text()\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? popupId : null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n (input)=\"onTyping($event)\"\n (change)=\"commitTyping()\"\n (click)=\"show()\"\n (keydown)=\"onFieldKeydown($event)\"\n />\n @if (showIcon()) {\n <button\n type=\"button\"\n class=\"hx-date-picker-trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"chooseLabel()\"\n [attr.aria-expanded]=\"open()\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"hx-date-picker-trigger-icon\" aria-hidden=\"true\"></span>\n </button>\n }\n </div>\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayPanelClass=\"hx-date-picker-overlay\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPush]=\"true\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n (attach)=\"onAttach()\"\n (detach)=\"open.set(false)\"\n >\n <div\n class=\"hx-date-picker-popup\"\n role=\"dialog\"\n aria-modal=\"false\"\n [id]=\"popupId\"\n [attr.aria-label]=\"ariaLabel() ?? 'Choose date'\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n >\n <ng-container [ngTemplateOutlet]=\"calendar\" />\n @if (showButtonBar()) {\n <div class=\"hx-date-picker-buttonbar\">\n <button type=\"button\" class=\"hx-date-picker-button\" (click)=\"selectToday()\">{{ todayLabel() }}</button>\n <button type=\"button\" class=\"hx-date-picker-button\" (click)=\"clear()\">{{ clearLabel() }}</button>\n </div>\n }\n </div>\n </ng-template>\n}\n\n<ng-template #calendar>\n<div\n class=\"hx-date-picker-panel\"\n role=\"group\"\n [attr.aria-label]=\"ariaLabel() ?? 'Calendar'\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (focusout)=\"onFocusOut($event)\"\n>\n <hx-calendar\n [(focusedDate)]=\"focusedDate\"\n [(view)]=\"view\"\n [selectedDates]=\"selectedDates()\"\n [selectionMode]=\"selectionMode()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n [titleId]=\"titleId\"\n [today]=\"today\"\n (picked)=\"pick($event)\"\n />\n</div>\n</ng-template>\n",
|
|
8402
|
+
dependencies: [
|
|
8403
|
+
{
|
|
8404
|
+
kind: "directive",
|
|
8405
|
+
type: CdkConnectedOverlay,
|
|
8406
|
+
selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
|
|
8407
|
+
inputs: [
|
|
8408
|
+
"cdkConnectedOverlayOrigin",
|
|
8409
|
+
"cdkConnectedOverlayPositions",
|
|
8410
|
+
"cdkConnectedOverlayPositionStrategy",
|
|
8411
|
+
"cdkConnectedOverlayOffsetX",
|
|
8412
|
+
"cdkConnectedOverlayOffsetY",
|
|
8413
|
+
"cdkConnectedOverlayWidth",
|
|
8414
|
+
"cdkConnectedOverlayHeight",
|
|
8415
|
+
"cdkConnectedOverlayMinWidth",
|
|
8416
|
+
"cdkConnectedOverlayMinHeight",
|
|
8417
|
+
"cdkConnectedOverlayBackdropClass",
|
|
8418
|
+
"cdkConnectedOverlayPanelClass",
|
|
8419
|
+
"cdkConnectedOverlayViewportMargin",
|
|
8420
|
+
"cdkConnectedOverlayScrollStrategy",
|
|
8421
|
+
"cdkConnectedOverlayOpen",
|
|
8422
|
+
"cdkConnectedOverlayDisableClose",
|
|
8423
|
+
"cdkConnectedOverlayTransformOriginOn",
|
|
8424
|
+
"cdkConnectedOverlayHasBackdrop",
|
|
8425
|
+
"cdkConnectedOverlayLockPosition",
|
|
8426
|
+
"cdkConnectedOverlayFlexibleDimensions",
|
|
8427
|
+
"cdkConnectedOverlayGrowAfterOpen",
|
|
8428
|
+
"cdkConnectedOverlayPush",
|
|
8429
|
+
"cdkConnectedOverlayDisposeOnNavigation",
|
|
8430
|
+
"cdkConnectedOverlayUsePopover",
|
|
8431
|
+
"cdkConnectedOverlayMatchWidth",
|
|
8432
|
+
"cdkConnectedOverlay"
|
|
8433
|
+
],
|
|
8434
|
+
outputs: [
|
|
8435
|
+
"backdropClick",
|
|
8436
|
+
"positionChange",
|
|
8437
|
+
"attach",
|
|
8438
|
+
"detach",
|
|
8439
|
+
"overlayKeydown",
|
|
8440
|
+
"overlayOutsideClick"
|
|
8441
|
+
],
|
|
8442
|
+
exportAs: ["cdkConnectedOverlay"]
|
|
8443
|
+
},
|
|
8444
|
+
{
|
|
8445
|
+
kind: "directive",
|
|
8446
|
+
type: CdkOverlayOrigin,
|
|
8447
|
+
selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
|
|
8448
|
+
exportAs: ["cdkOverlayOrigin"]
|
|
8449
|
+
},
|
|
8450
|
+
{
|
|
8451
|
+
kind: "directive",
|
|
8452
|
+
type: NgTemplateOutlet,
|
|
8453
|
+
selector: "[ngTemplateOutlet]",
|
|
8454
|
+
inputs: [
|
|
8455
|
+
"ngTemplateOutletContext",
|
|
8456
|
+
"ngTemplateOutlet",
|
|
8457
|
+
"ngTemplateOutletInjector"
|
|
8458
|
+
]
|
|
8459
|
+
},
|
|
8460
|
+
{
|
|
8461
|
+
kind: "component",
|
|
8462
|
+
type: HxCalendar,
|
|
8463
|
+
selector: "hx-calendar",
|
|
8464
|
+
inputs: [
|
|
8465
|
+
"focusedDate",
|
|
8466
|
+
"view",
|
|
8467
|
+
"selectedDates",
|
|
8468
|
+
"selectionMode",
|
|
8469
|
+
"minDate",
|
|
8470
|
+
"maxDate",
|
|
8471
|
+
"disabledDates",
|
|
8472
|
+
"firstDayOfWeek",
|
|
8473
|
+
"locale",
|
|
8474
|
+
"disabled",
|
|
8475
|
+
"titleId",
|
|
8476
|
+
"today"
|
|
8477
|
+
],
|
|
8478
|
+
outputs: [
|
|
8479
|
+
"focusedDateChange",
|
|
8480
|
+
"viewChange",
|
|
8481
|
+
"picked"
|
|
8482
|
+
]
|
|
8483
|
+
}
|
|
8484
|
+
],
|
|
8485
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
8486
|
+
});
|
|
8487
|
+
};
|
|
8488
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
8489
|
+
minVersion: "12.0.0",
|
|
8490
|
+
version: "22.2.1",
|
|
8491
|
+
ngImport: i0,
|
|
8492
|
+
type: HxDatePicker,
|
|
8493
|
+
decorators: [{
|
|
8494
|
+
type: Component,
|
|
8495
|
+
args: [{
|
|
8496
|
+
selector: "hx-date-picker",
|
|
8497
|
+
imports: [
|
|
8498
|
+
CdkConnectedOverlay,
|
|
8499
|
+
CdkOverlayOrigin,
|
|
8500
|
+
NgTemplateOutlet,
|
|
8501
|
+
HxCalendar
|
|
8502
|
+
],
|
|
8503
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8504
|
+
providers: [{
|
|
8505
|
+
provide: NG_VALUE_ACCESSOR,
|
|
8506
|
+
useExisting: forwardRef(() => HxDatePicker),
|
|
8507
|
+
multi: true
|
|
8508
|
+
}],
|
|
8509
|
+
host: {
|
|
8510
|
+
class: "hx-date-picker",
|
|
8511
|
+
"[class.hx-date-picker-inline]": "inline()",
|
|
8512
|
+
"[class.hx-date-picker-disabled]": "isDisabled()",
|
|
8513
|
+
"[class.hx-date-picker-invalid]": "invalid()",
|
|
8514
|
+
"[class.hx-date-picker-open]": "open()",
|
|
8515
|
+
"[class.hx-date-picker-has-icon]": "showIcon() && !inline()",
|
|
8516
|
+
"[class.hx-filled]": "!inline() && text() !== \"\"",
|
|
8517
|
+
"(focusout)": "onHostFocusOut($event)"
|
|
8518
|
+
},
|
|
8519
|
+
template: "@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"calendar\" />\n} @else {\n <div class=\"hx-date-picker-field\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #field\n type=\"text\"\n class=\"hx-date-picker-input\"\n autocomplete=\"off\"\n aria-haspopup=\"dialog\"\n [attr.id]=\"inputId() ?? null\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"text()\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? popupId : null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n (input)=\"onTyping($event)\"\n (change)=\"commitTyping()\"\n (click)=\"show()\"\n (keydown)=\"onFieldKeydown($event)\"\n />\n @if (showIcon()) {\n <button\n type=\"button\"\n class=\"hx-date-picker-trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"chooseLabel()\"\n [attr.aria-expanded]=\"open()\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"hx-date-picker-trigger-icon\" aria-hidden=\"true\"></span>\n </button>\n }\n </div>\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayPanelClass=\"hx-date-picker-overlay\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPush]=\"true\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n (attach)=\"onAttach()\"\n (detach)=\"open.set(false)\"\n >\n <div\n class=\"hx-date-picker-popup\"\n role=\"dialog\"\n aria-modal=\"false\"\n [id]=\"popupId\"\n [attr.aria-label]=\"ariaLabel() ?? 'Choose date'\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n >\n <ng-container [ngTemplateOutlet]=\"calendar\" />\n @if (showButtonBar()) {\n <div class=\"hx-date-picker-buttonbar\">\n <button type=\"button\" class=\"hx-date-picker-button\" (click)=\"selectToday()\">{{ todayLabel() }}</button>\n <button type=\"button\" class=\"hx-date-picker-button\" (click)=\"clear()\">{{ clearLabel() }}</button>\n </div>\n }\n </div>\n </ng-template>\n}\n\n<ng-template #calendar>\n<div\n class=\"hx-date-picker-panel\"\n role=\"group\"\n [attr.aria-label]=\"ariaLabel() ?? 'Calendar'\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (focusout)=\"onFocusOut($event)\"\n>\n <hx-calendar\n [(focusedDate)]=\"focusedDate\"\n [(view)]=\"view\"\n [selectedDates]=\"selectedDates()\"\n [selectionMode]=\"selectionMode()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n [titleId]=\"titleId\"\n [today]=\"today\"\n (picked)=\"pick($event)\"\n />\n</div>\n</ng-template>\n"
|
|
8520
|
+
}]
|
|
8521
|
+
}],
|
|
8522
|
+
ctorParameters: () => [],
|
|
8523
|
+
propDecorators: {
|
|
8524
|
+
placeholder: [{
|
|
8525
|
+
type: i0.Input,
|
|
8526
|
+
args: [{
|
|
8527
|
+
isSignal: true,
|
|
8528
|
+
alias: "placeholder",
|
|
8529
|
+
required: false
|
|
8530
|
+
}]
|
|
8531
|
+
}],
|
|
8532
|
+
showIcon: [{
|
|
8533
|
+
type: i0.Input,
|
|
8534
|
+
args: [{
|
|
8535
|
+
isSignal: true,
|
|
8536
|
+
alias: "showIcon",
|
|
8537
|
+
required: false
|
|
8538
|
+
}]
|
|
8539
|
+
}],
|
|
8540
|
+
showButtonBar: [{
|
|
8541
|
+
type: i0.Input,
|
|
8542
|
+
args: [{
|
|
8543
|
+
isSignal: true,
|
|
8544
|
+
alias: "showButtonBar",
|
|
8545
|
+
required: false
|
|
8546
|
+
}]
|
|
8547
|
+
}],
|
|
8548
|
+
dateFormat: [{
|
|
8549
|
+
type: i0.Input,
|
|
8550
|
+
args: [{
|
|
8551
|
+
isSignal: true,
|
|
8552
|
+
alias: "dateFormat",
|
|
8553
|
+
required: false
|
|
8554
|
+
}]
|
|
8555
|
+
}],
|
|
8556
|
+
todayLabel: [{
|
|
8557
|
+
type: i0.Input,
|
|
8558
|
+
args: [{
|
|
8559
|
+
isSignal: true,
|
|
8560
|
+
alias: "todayLabel",
|
|
8561
|
+
required: false
|
|
8562
|
+
}]
|
|
8563
|
+
}],
|
|
8564
|
+
clearLabel: [{
|
|
8565
|
+
type: i0.Input,
|
|
8566
|
+
args: [{
|
|
8567
|
+
isSignal: true,
|
|
8568
|
+
alias: "clearLabel",
|
|
8569
|
+
required: false
|
|
8570
|
+
}]
|
|
8571
|
+
}],
|
|
8572
|
+
chooseLabel: [{
|
|
8573
|
+
type: i0.Input,
|
|
8574
|
+
args: [{
|
|
8575
|
+
isSignal: true,
|
|
8576
|
+
alias: "chooseLabel",
|
|
8577
|
+
required: false
|
|
8578
|
+
}]
|
|
8579
|
+
}],
|
|
8580
|
+
inputId: [{
|
|
8581
|
+
type: i0.Input,
|
|
8582
|
+
args: [{
|
|
8583
|
+
isSignal: true,
|
|
8584
|
+
alias: "inputId",
|
|
8585
|
+
required: false
|
|
8586
|
+
}]
|
|
8587
|
+
}],
|
|
8588
|
+
inline: [{
|
|
8589
|
+
type: i0.Input,
|
|
8590
|
+
args: [{
|
|
8591
|
+
isSignal: true,
|
|
8592
|
+
alias: "inline",
|
|
8593
|
+
required: false
|
|
8594
|
+
}]
|
|
8595
|
+
}],
|
|
8596
|
+
selectionMode: [{
|
|
8597
|
+
type: i0.Input,
|
|
8598
|
+
args: [{
|
|
8599
|
+
isSignal: true,
|
|
8600
|
+
alias: "selectionMode",
|
|
8601
|
+
required: false
|
|
8602
|
+
}]
|
|
8603
|
+
}],
|
|
8604
|
+
minDate: [{
|
|
8605
|
+
type: i0.Input,
|
|
8606
|
+
args: [{
|
|
8607
|
+
isSignal: true,
|
|
8608
|
+
alias: "minDate",
|
|
8609
|
+
required: false
|
|
8610
|
+
}]
|
|
8611
|
+
}],
|
|
8612
|
+
maxDate: [{
|
|
8613
|
+
type: i0.Input,
|
|
8614
|
+
args: [{
|
|
8615
|
+
isSignal: true,
|
|
8616
|
+
alias: "maxDate",
|
|
8617
|
+
required: false
|
|
8618
|
+
}]
|
|
8619
|
+
}],
|
|
8620
|
+
disabledDates: [{
|
|
8621
|
+
type: i0.Input,
|
|
8622
|
+
args: [{
|
|
8623
|
+
isSignal: true,
|
|
8624
|
+
alias: "disabledDates",
|
|
8625
|
+
required: false
|
|
8626
|
+
}]
|
|
8627
|
+
}],
|
|
8628
|
+
firstDayOfWeek: [{
|
|
8629
|
+
type: i0.Input,
|
|
8630
|
+
args: [{
|
|
8631
|
+
isSignal: true,
|
|
8632
|
+
alias: "firstDayOfWeek",
|
|
8633
|
+
required: false
|
|
8634
|
+
}]
|
|
8635
|
+
}],
|
|
8636
|
+
locale: [{
|
|
8637
|
+
type: i0.Input,
|
|
8638
|
+
args: [{
|
|
8639
|
+
isSignal: true,
|
|
8640
|
+
alias: "locale",
|
|
8641
|
+
required: false
|
|
8642
|
+
}]
|
|
8643
|
+
}],
|
|
8644
|
+
ariaLabel: [{
|
|
8645
|
+
type: i0.Input,
|
|
8646
|
+
args: [{
|
|
8647
|
+
isSignal: true,
|
|
8648
|
+
alias: "ariaLabel",
|
|
8649
|
+
required: false
|
|
8650
|
+
}]
|
|
8651
|
+
}],
|
|
8652
|
+
ariaLabelledby: [{
|
|
8653
|
+
type: i0.Input,
|
|
8654
|
+
args: [{
|
|
8655
|
+
isSignal: true,
|
|
8656
|
+
alias: "ariaLabelledby",
|
|
8657
|
+
required: false
|
|
8658
|
+
}]
|
|
8659
|
+
}],
|
|
8660
|
+
value: [{
|
|
8661
|
+
type: i0.Input,
|
|
8662
|
+
args: [{
|
|
8663
|
+
isSignal: true,
|
|
8664
|
+
alias: "value",
|
|
8665
|
+
required: false
|
|
8666
|
+
}]
|
|
8667
|
+
}, {
|
|
8668
|
+
type: i0.Output,
|
|
8669
|
+
args: ["valueChange"]
|
|
8670
|
+
}],
|
|
8671
|
+
disabled: [{
|
|
8672
|
+
type: i0.Input,
|
|
8673
|
+
args: [{
|
|
8674
|
+
isSignal: true,
|
|
8675
|
+
alias: "disabled",
|
|
8676
|
+
required: false
|
|
8677
|
+
}]
|
|
8678
|
+
}],
|
|
8679
|
+
invalid: [{
|
|
8680
|
+
type: i0.Input,
|
|
8681
|
+
args: [{
|
|
8682
|
+
isSignal: true,
|
|
8683
|
+
alias: "invalid",
|
|
8684
|
+
required: false
|
|
8685
|
+
}]
|
|
8686
|
+
}],
|
|
8687
|
+
touch: [{
|
|
8688
|
+
type: i0.Output,
|
|
8689
|
+
args: ["touch"]
|
|
8690
|
+
}],
|
|
8691
|
+
field: [{
|
|
8692
|
+
type: i0.ViewChild,
|
|
8693
|
+
args: ["field", { isSignal: true }]
|
|
8694
|
+
}],
|
|
8695
|
+
calendar: [{
|
|
8696
|
+
type: i0.ViewChild,
|
|
8697
|
+
args: [i0.forwardRef(() => HxCalendar), { isSignal: true }]
|
|
8698
|
+
}]
|
|
8699
|
+
}
|
|
8700
|
+
});
|
|
8701
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
8702
|
+
function buildTimeColumns(time, options) {
|
|
8703
|
+
const { hours, minutes, seconds } = time;
|
|
8704
|
+
const { hour12: twelve, labels } = options;
|
|
8705
|
+
const hourNow = twelve ? hours % 12 || 12 : hours;
|
|
8706
|
+
const columns = [{
|
|
8707
|
+
unit: "hour",
|
|
8708
|
+
label: labels.hour,
|
|
8709
|
+
now: hourNow,
|
|
8710
|
+
min: twelve ? 1 : 0,
|
|
8711
|
+
max: twelve ? 12 : 23,
|
|
8712
|
+
text: pad(hourNow),
|
|
8713
|
+
valueText: String(hourNow)
|
|
8714
|
+
}];
|
|
8715
|
+
if (options.showMinutes) columns.push({
|
|
8716
|
+
unit: "minute",
|
|
8717
|
+
label: labels.minute,
|
|
8718
|
+
now: minutes,
|
|
8719
|
+
min: 0,
|
|
8720
|
+
max: 59,
|
|
8721
|
+
text: pad(minutes),
|
|
8722
|
+
valueText: String(minutes)
|
|
8723
|
+
});
|
|
8724
|
+
if (options.showMinutes && options.showSeconds) columns.push({
|
|
8725
|
+
unit: "second",
|
|
8726
|
+
label: labels.second,
|
|
8727
|
+
now: seconds,
|
|
8728
|
+
min: 0,
|
|
8729
|
+
max: 59,
|
|
8730
|
+
text: pad(seconds),
|
|
8731
|
+
valueText: String(seconds)
|
|
8732
|
+
});
|
|
8733
|
+
if (twelve) {
|
|
8734
|
+
const parts = new Intl.DateTimeFormat(options.locale, {
|
|
8735
|
+
hour: "numeric",
|
|
8736
|
+
hourCycle: "h12"
|
|
8737
|
+
});
|
|
8738
|
+
const period = (h) => parts.formatToParts(new Date(2026, 0, 1, h)).find((p) => p.type === "dayPeriod")?.value ?? (h < 12 ? "AM" : "PM");
|
|
8739
|
+
const pm = hours >= 12 ? 1 : 0;
|
|
8740
|
+
columns.push({
|
|
8741
|
+
unit: "period",
|
|
8742
|
+
label: labels.period,
|
|
8743
|
+
now: pm,
|
|
8744
|
+
min: 0,
|
|
8745
|
+
max: 1,
|
|
8746
|
+
text: period(pm ? 12 : 0),
|
|
8747
|
+
valueText: period(pm ? 12 : 0)
|
|
8748
|
+
});
|
|
8749
|
+
}
|
|
8750
|
+
return columns;
|
|
8751
|
+
}
|
|
8752
|
+
function unitValues(column, steps) {
|
|
8753
|
+
const step = column.unit === "hour" ? steps.hour : column.unit === "minute" ? steps.minute : column.unit === "second" ? steps.second : 1;
|
|
8754
|
+
const values = [];
|
|
8755
|
+
for (let v = column.min; v <= column.max; v += Math.max(1, step || 1)) values.push(v);
|
|
8756
|
+
return values;
|
|
8757
|
+
}
|
|
8758
|
+
function nextUnitValue(column, steps, direction) {
|
|
8759
|
+
const values = unitValues(column, steps);
|
|
8760
|
+
return direction > 0 ? values.find((v) => v > column.now) ?? values[0] : values.filter((v) => v < column.now).pop() ?? values[values.length - 1];
|
|
8761
|
+
}
|
|
8762
|
+
function applyUnit(time, unit, value, hour12) {
|
|
8763
|
+
const { hours } = time;
|
|
8764
|
+
switch (unit) {
|
|
8765
|
+
case "hour": return {
|
|
8766
|
+
...time,
|
|
8767
|
+
hours: hour12 ? value % 12 + (hours >= 12 ? 12 : 0) : value
|
|
8768
|
+
};
|
|
8769
|
+
case "minute": return {
|
|
8770
|
+
...time,
|
|
8771
|
+
minutes: value
|
|
8772
|
+
};
|
|
8773
|
+
case "second": return {
|
|
8774
|
+
...time,
|
|
8775
|
+
seconds: value
|
|
8776
|
+
};
|
|
8777
|
+
default: return {
|
|
8778
|
+
...time,
|
|
8779
|
+
hours: hours % 12 + (value ? 12 : 0)
|
|
8780
|
+
};
|
|
8781
|
+
}
|
|
8782
|
+
}
|
|
8783
|
+
function jumpKeyTarget(key, column, steps) {
|
|
8784
|
+
const values = unitValues(column, steps);
|
|
8785
|
+
const page = column.unit === "hour" ? 6 : 10;
|
|
8786
|
+
const nearest = (target) => values.reduce((best, v) => Math.abs(v - target) < Math.abs(best - target) ? v : best);
|
|
8787
|
+
switch (key) {
|
|
8788
|
+
case "PageUp": return nearest(Math.min(column.max, column.now + page));
|
|
8789
|
+
case "PageDown": return nearest(Math.max(column.min, column.now - page));
|
|
8790
|
+
case "Home": return values[0];
|
|
8791
|
+
case "End": return values[values.length - 1];
|
|
8792
|
+
default: return null;
|
|
8793
|
+
}
|
|
8794
|
+
}
|
|
8795
|
+
var HxTimeRow = class HxTimeRow {
|
|
8796
|
+
#host = inject(ElementRef);
|
|
8797
|
+
time = input.required(...ngDevMode ? [{ debugName: "time" }] : /* istanbul ignore next */ []);
|
|
8798
|
+
hour12 = input(false, ...ngDevMode ? [{ debugName: "hour12" }] : /* istanbul ignore next */ []);
|
|
8799
|
+
showMinutes = input(true, ...ngDevMode ? [{ debugName: "showMinutes" }] : /* istanbul ignore next */ []);
|
|
8800
|
+
showSeconds = input(false, ...ngDevMode ? [{ debugName: "showSeconds" }] : /* istanbul ignore next */ []);
|
|
8801
|
+
stepHour = input(1, ...ngDevMode ? [{ debugName: "stepHour" }] : /* istanbul ignore next */ []);
|
|
8802
|
+
stepMinute = input(1, ...ngDevMode ? [{ debugName: "stepMinute" }] : /* istanbul ignore next */ []);
|
|
8803
|
+
stepSecond = input(1, ...ngDevMode ? [{ debugName: "stepSecond" }] : /* istanbul ignore next */ []);
|
|
8804
|
+
locale = input(...ngDevMode ? [void 0, { debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
8805
|
+
disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
8806
|
+
timeLabel = input("Time", ...ngDevMode ? [{ debugName: "timeLabel" }] : /* istanbul ignore next */ []);
|
|
8807
|
+
hourLabel = input("Hour", ...ngDevMode ? [{ debugName: "hourLabel" }] : /* istanbul ignore next */ []);
|
|
8808
|
+
minuteLabel = input("Minute", ...ngDevMode ? [{ debugName: "minuteLabel" }] : /* istanbul ignore next */ []);
|
|
8809
|
+
secondLabel = input("Second", ...ngDevMode ? [{ debugName: "secondLabel" }] : /* istanbul ignore next */ []);
|
|
8810
|
+
periodLabel = input("AM/PM", ...ngDevMode ? [{ debugName: "periodLabel" }] : /* istanbul ignore next */ []);
|
|
8811
|
+
timeChange = output();
|
|
8812
|
+
#steps = computed(() => ({
|
|
8813
|
+
hour: this.stepHour(),
|
|
8814
|
+
minute: this.stepMinute(),
|
|
8815
|
+
second: this.stepSecond()
|
|
8816
|
+
}), ...ngDevMode ? [{ debugName: "#steps" }] : /* istanbul ignore next */ []);
|
|
8817
|
+
columns = computed(() => buildTimeColumns(this.time(), {
|
|
8818
|
+
hour12: this.hour12(),
|
|
8819
|
+
showMinutes: this.showMinutes(),
|
|
8820
|
+
showSeconds: this.showSeconds(),
|
|
8821
|
+
locale: this.locale(),
|
|
8822
|
+
labels: {
|
|
8823
|
+
hour: this.hourLabel(),
|
|
8824
|
+
minute: this.minuteLabel(),
|
|
8825
|
+
second: this.secondLabel(),
|
|
8826
|
+
period: this.periodLabel()
|
|
8827
|
+
}
|
|
8828
|
+
}), ...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
|
|
8829
|
+
focus() {
|
|
8830
|
+
this.#host.nativeElement.querySelector(".hx-date-picker-time-spin")?.focus();
|
|
8831
|
+
}
|
|
8832
|
+
#set(column, value) {
|
|
8833
|
+
if (this.disabled()) return;
|
|
8834
|
+
this.timeChange.emit(applyUnit(this.time(), column.unit, value, this.hour12()));
|
|
8835
|
+
}
|
|
8836
|
+
stepTime(column, direction) {
|
|
8837
|
+
this.#set(column, nextUnitValue(column, this.#steps(), direction));
|
|
8838
|
+
}
|
|
8839
|
+
onTimeKeydown(event, column) {
|
|
8840
|
+
if (this.disabled()) return;
|
|
8841
|
+
if (event.key === "ArrowUp") this.stepTime(column, 1);
|
|
8842
|
+
else if (event.key === "ArrowDown") this.stepTime(column, -1);
|
|
8843
|
+
else {
|
|
8844
|
+
const target = jumpKeyTarget(event.key, column, this.#steps());
|
|
8845
|
+
if (target === null) return;
|
|
8846
|
+
this.#set(column, target);
|
|
8847
|
+
}
|
|
8848
|
+
event.preventDefault();
|
|
8849
|
+
}
|
|
8850
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
8851
|
+
minVersion: "12.0.0",
|
|
8852
|
+
version: "22.2.1",
|
|
8853
|
+
ngImport: i0,
|
|
8854
|
+
type: HxTimeRow,
|
|
8855
|
+
deps: [],
|
|
8856
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
8857
|
+
});
|
|
8858
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
8859
|
+
minVersion: "17.0.0",
|
|
8860
|
+
version: "22.2.1",
|
|
8861
|
+
type: HxTimeRow,
|
|
8862
|
+
isStandalone: true,
|
|
8863
|
+
selector: "hx-time-row",
|
|
8864
|
+
inputs: {
|
|
8865
|
+
time: {
|
|
8866
|
+
classPropertyName: "time",
|
|
8867
|
+
publicName: "time",
|
|
8868
|
+
isSignal: true,
|
|
8869
|
+
isRequired: true,
|
|
8870
|
+
transformFunction: null
|
|
8871
|
+
},
|
|
8872
|
+
hour12: {
|
|
8873
|
+
classPropertyName: "hour12",
|
|
8874
|
+
publicName: "hour12",
|
|
8875
|
+
isSignal: true,
|
|
8876
|
+
isRequired: false,
|
|
8877
|
+
transformFunction: null
|
|
8878
|
+
},
|
|
8879
|
+
showMinutes: {
|
|
8880
|
+
classPropertyName: "showMinutes",
|
|
8881
|
+
publicName: "showMinutes",
|
|
8882
|
+
isSignal: true,
|
|
8883
|
+
isRequired: false,
|
|
8884
|
+
transformFunction: null
|
|
8885
|
+
},
|
|
8886
|
+
showSeconds: {
|
|
8887
|
+
classPropertyName: "showSeconds",
|
|
8888
|
+
publicName: "showSeconds",
|
|
8889
|
+
isSignal: true,
|
|
8890
|
+
isRequired: false,
|
|
8891
|
+
transformFunction: null
|
|
8892
|
+
},
|
|
8893
|
+
stepHour: {
|
|
8894
|
+
classPropertyName: "stepHour",
|
|
8895
|
+
publicName: "stepHour",
|
|
8896
|
+
isSignal: true,
|
|
8897
|
+
isRequired: false,
|
|
8898
|
+
transformFunction: null
|
|
8899
|
+
},
|
|
8900
|
+
stepMinute: {
|
|
8901
|
+
classPropertyName: "stepMinute",
|
|
8902
|
+
publicName: "stepMinute",
|
|
8903
|
+
isSignal: true,
|
|
8904
|
+
isRequired: false,
|
|
8905
|
+
transformFunction: null
|
|
8906
|
+
},
|
|
8907
|
+
stepSecond: {
|
|
8908
|
+
classPropertyName: "stepSecond",
|
|
8909
|
+
publicName: "stepSecond",
|
|
8910
|
+
isSignal: true,
|
|
8911
|
+
isRequired: false,
|
|
8912
|
+
transformFunction: null
|
|
8913
|
+
},
|
|
8914
|
+
locale: {
|
|
8915
|
+
classPropertyName: "locale",
|
|
8916
|
+
publicName: "locale",
|
|
8917
|
+
isSignal: true,
|
|
8918
|
+
isRequired: false,
|
|
8919
|
+
transformFunction: null
|
|
8920
|
+
},
|
|
8921
|
+
disabled: {
|
|
8922
|
+
classPropertyName: "disabled",
|
|
8923
|
+
publicName: "disabled",
|
|
8924
|
+
isSignal: true,
|
|
8925
|
+
isRequired: false,
|
|
8926
|
+
transformFunction: null
|
|
8927
|
+
},
|
|
8928
|
+
timeLabel: {
|
|
8929
|
+
classPropertyName: "timeLabel",
|
|
8930
|
+
publicName: "timeLabel",
|
|
8931
|
+
isSignal: true,
|
|
8932
|
+
isRequired: false,
|
|
8933
|
+
transformFunction: null
|
|
8934
|
+
},
|
|
8935
|
+
hourLabel: {
|
|
8936
|
+
classPropertyName: "hourLabel",
|
|
8937
|
+
publicName: "hourLabel",
|
|
8938
|
+
isSignal: true,
|
|
8939
|
+
isRequired: false,
|
|
8940
|
+
transformFunction: null
|
|
8941
|
+
},
|
|
8942
|
+
minuteLabel: {
|
|
8943
|
+
classPropertyName: "minuteLabel",
|
|
8944
|
+
publicName: "minuteLabel",
|
|
8945
|
+
isSignal: true,
|
|
8946
|
+
isRequired: false,
|
|
8947
|
+
transformFunction: null
|
|
8948
|
+
},
|
|
8949
|
+
secondLabel: {
|
|
8950
|
+
classPropertyName: "secondLabel",
|
|
8951
|
+
publicName: "secondLabel",
|
|
8952
|
+
isSignal: true,
|
|
8953
|
+
isRequired: false,
|
|
8954
|
+
transformFunction: null
|
|
8955
|
+
},
|
|
8956
|
+
periodLabel: {
|
|
8957
|
+
classPropertyName: "periodLabel",
|
|
8958
|
+
publicName: "periodLabel",
|
|
8959
|
+
isSignal: true,
|
|
8960
|
+
isRequired: false,
|
|
8961
|
+
transformFunction: null
|
|
8962
|
+
}
|
|
8963
|
+
},
|
|
8964
|
+
outputs: { timeChange: "timeChange" },
|
|
8965
|
+
host: { styleAttribute: "display: contents" },
|
|
8966
|
+
ngImport: i0,
|
|
8967
|
+
template: "<div class=\"hx-date-picker-time\" role=\"group\" [attr.aria-label]=\"timeLabel()\">\n @for (column of columns(); track column.unit) {\n @if (column.unit !== 'hour' && column.unit !== 'period') {\n <span class=\"hx-date-picker-time-separator\" aria-hidden=\"true\">:</span>\n }\n <div class=\"hx-date-picker-time-column\">\n <button type=\"button\" class=\"hx-date-picker-time-button\" tabindex=\"-1\" aria-hidden=\"true\" [disabled]=\"disabled()\" (mousedown)=\"$event.preventDefault()\" (click)=\"stepTime(column, 1)\">\n <span class=\"hx-date-picker-time-up-icon\" aria-hidden=\"true\"></span>\n </button>\n <div\n class=\"hx-date-picker-time-spin\"\n role=\"spinbutton\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.aria-label]=\"column.label\"\n [attr.aria-valuenow]=\"column.now\"\n [attr.aria-valuemin]=\"column.min\"\n [attr.aria-valuemax]=\"column.max\"\n [attr.aria-valuetext]=\"column.valueText\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n (keydown)=\"onTimeKeydown($event, column)\"\n >\n {{ column.text }}\n </div>\n <button type=\"button\" class=\"hx-date-picker-time-button\" tabindex=\"-1\" aria-hidden=\"true\" [disabled]=\"disabled()\" (mousedown)=\"$event.preventDefault()\" (click)=\"stepTime(column, -1)\">\n <span class=\"hx-date-picker-time-down-icon\" aria-hidden=\"true\"></span>\n </button>\n </div>\n }\n</div>\n",
|
|
8968
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
8969
|
+
});
|
|
8970
|
+
};
|
|
8971
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
8972
|
+
minVersion: "12.0.0",
|
|
8973
|
+
version: "22.2.1",
|
|
8974
|
+
ngImport: i0,
|
|
8975
|
+
type: HxTimeRow,
|
|
8976
|
+
decorators: [{
|
|
8977
|
+
type: Component,
|
|
8978
|
+
args: [{
|
|
8979
|
+
selector: "hx-time-row",
|
|
8980
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8981
|
+
host: { style: "display: contents" },
|
|
8982
|
+
template: "<div class=\"hx-date-picker-time\" role=\"group\" [attr.aria-label]=\"timeLabel()\">\n @for (column of columns(); track column.unit) {\n @if (column.unit !== 'hour' && column.unit !== 'period') {\n <span class=\"hx-date-picker-time-separator\" aria-hidden=\"true\">:</span>\n }\n <div class=\"hx-date-picker-time-column\">\n <button type=\"button\" class=\"hx-date-picker-time-button\" tabindex=\"-1\" aria-hidden=\"true\" [disabled]=\"disabled()\" (mousedown)=\"$event.preventDefault()\" (click)=\"stepTime(column, 1)\">\n <span class=\"hx-date-picker-time-up-icon\" aria-hidden=\"true\"></span>\n </button>\n <div\n class=\"hx-date-picker-time-spin\"\n role=\"spinbutton\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n [attr.aria-label]=\"column.label\"\n [attr.aria-valuenow]=\"column.now\"\n [attr.aria-valuemin]=\"column.min\"\n [attr.aria-valuemax]=\"column.max\"\n [attr.aria-valuetext]=\"column.valueText\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n (keydown)=\"onTimeKeydown($event, column)\"\n >\n {{ column.text }}\n </div>\n <button type=\"button\" class=\"hx-date-picker-time-button\" tabindex=\"-1\" aria-hidden=\"true\" [disabled]=\"disabled()\" (mousedown)=\"$event.preventDefault()\" (click)=\"stepTime(column, -1)\">\n <span class=\"hx-date-picker-time-down-icon\" aria-hidden=\"true\"></span>\n </button>\n </div>\n }\n</div>\n"
|
|
8983
|
+
}]
|
|
8984
|
+
}],
|
|
8985
|
+
propDecorators: {
|
|
8986
|
+
time: [{
|
|
8987
|
+
type: i0.Input,
|
|
8988
|
+
args: [{
|
|
8989
|
+
isSignal: true,
|
|
8990
|
+
alias: "time",
|
|
8991
|
+
required: true
|
|
8992
|
+
}]
|
|
8993
|
+
}],
|
|
8994
|
+
hour12: [{
|
|
8995
|
+
type: i0.Input,
|
|
8996
|
+
args: [{
|
|
8997
|
+
isSignal: true,
|
|
8998
|
+
alias: "hour12",
|
|
8999
|
+
required: false
|
|
9000
|
+
}]
|
|
9001
|
+
}],
|
|
9002
|
+
showMinutes: [{
|
|
9003
|
+
type: i0.Input,
|
|
9004
|
+
args: [{
|
|
9005
|
+
isSignal: true,
|
|
9006
|
+
alias: "showMinutes",
|
|
9007
|
+
required: false
|
|
9008
|
+
}]
|
|
9009
|
+
}],
|
|
9010
|
+
showSeconds: [{
|
|
9011
|
+
type: i0.Input,
|
|
9012
|
+
args: [{
|
|
9013
|
+
isSignal: true,
|
|
9014
|
+
alias: "showSeconds",
|
|
9015
|
+
required: false
|
|
9016
|
+
}]
|
|
9017
|
+
}],
|
|
9018
|
+
stepHour: [{
|
|
9019
|
+
type: i0.Input,
|
|
9020
|
+
args: [{
|
|
9021
|
+
isSignal: true,
|
|
9022
|
+
alias: "stepHour",
|
|
9023
|
+
required: false
|
|
9024
|
+
}]
|
|
9025
|
+
}],
|
|
9026
|
+
stepMinute: [{
|
|
9027
|
+
type: i0.Input,
|
|
9028
|
+
args: [{
|
|
9029
|
+
isSignal: true,
|
|
9030
|
+
alias: "stepMinute",
|
|
9031
|
+
required: false
|
|
9032
|
+
}]
|
|
9033
|
+
}],
|
|
9034
|
+
stepSecond: [{
|
|
9035
|
+
type: i0.Input,
|
|
9036
|
+
args: [{
|
|
9037
|
+
isSignal: true,
|
|
9038
|
+
alias: "stepSecond",
|
|
9039
|
+
required: false
|
|
9040
|
+
}]
|
|
9041
|
+
}],
|
|
9042
|
+
locale: [{
|
|
9043
|
+
type: i0.Input,
|
|
9044
|
+
args: [{
|
|
9045
|
+
isSignal: true,
|
|
9046
|
+
alias: "locale",
|
|
9047
|
+
required: false
|
|
9048
|
+
}]
|
|
9049
|
+
}],
|
|
9050
|
+
disabled: [{
|
|
9051
|
+
type: i0.Input,
|
|
9052
|
+
args: [{
|
|
9053
|
+
isSignal: true,
|
|
9054
|
+
alias: "disabled",
|
|
9055
|
+
required: false
|
|
9056
|
+
}]
|
|
9057
|
+
}],
|
|
9058
|
+
timeLabel: [{
|
|
9059
|
+
type: i0.Input,
|
|
9060
|
+
args: [{
|
|
9061
|
+
isSignal: true,
|
|
9062
|
+
alias: "timeLabel",
|
|
9063
|
+
required: false
|
|
9064
|
+
}]
|
|
9065
|
+
}],
|
|
9066
|
+
hourLabel: [{
|
|
9067
|
+
type: i0.Input,
|
|
9068
|
+
args: [{
|
|
9069
|
+
isSignal: true,
|
|
9070
|
+
alias: "hourLabel",
|
|
9071
|
+
required: false
|
|
9072
|
+
}]
|
|
9073
|
+
}],
|
|
9074
|
+
minuteLabel: [{
|
|
9075
|
+
type: i0.Input,
|
|
9076
|
+
args: [{
|
|
9077
|
+
isSignal: true,
|
|
9078
|
+
alias: "minuteLabel",
|
|
9079
|
+
required: false
|
|
9080
|
+
}]
|
|
9081
|
+
}],
|
|
9082
|
+
secondLabel: [{
|
|
9083
|
+
type: i0.Input,
|
|
9084
|
+
args: [{
|
|
9085
|
+
isSignal: true,
|
|
9086
|
+
alias: "secondLabel",
|
|
9087
|
+
required: false
|
|
9088
|
+
}]
|
|
9089
|
+
}],
|
|
9090
|
+
periodLabel: [{
|
|
9091
|
+
type: i0.Input,
|
|
9092
|
+
args: [{
|
|
9093
|
+
isSignal: true,
|
|
9094
|
+
alias: "periodLabel",
|
|
9095
|
+
required: false
|
|
9096
|
+
}]
|
|
9097
|
+
}],
|
|
9098
|
+
timeChange: [{
|
|
9099
|
+
type: i0.Output,
|
|
9100
|
+
args: ["timeChange"]
|
|
9101
|
+
}]
|
|
9102
|
+
}
|
|
9103
|
+
});
|
|
9104
|
+
const startOfDayOrNull = (date) => isValidDate(date) ? startOfDay(date) : null;
|
|
9105
|
+
var HxDateTimePicker = class HxDateTimePicker {
|
|
9106
|
+
#host = inject(ElementRef);
|
|
9107
|
+
#injector = inject(Injector);
|
|
9108
|
+
placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
9109
|
+
showIcon = input(false, {
|
|
9110
|
+
...ngDevMode ? { debugName: "showIcon" } : /* istanbul ignore next */ {},
|
|
9111
|
+
transform: booleanAttribute
|
|
9112
|
+
});
|
|
9113
|
+
showButtonBar = input(false, {
|
|
9114
|
+
...ngDevMode ? { debugName: "showButtonBar" } : /* istanbul ignore next */ {},
|
|
9115
|
+
transform: booleanAttribute
|
|
9116
|
+
});
|
|
9117
|
+
dateFormat = input(...ngDevMode ? [void 0, { debugName: "dateFormat" }] : /* istanbul ignore next */ []);
|
|
9118
|
+
todayLabel = input("Today", ...ngDevMode ? [{ debugName: "todayLabel" }] : /* istanbul ignore next */ []);
|
|
9119
|
+
clearLabel = input("Clear", ...ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []);
|
|
9120
|
+
chooseLabel = input("Choose date and time", ...ngDevMode ? [{ debugName: "chooseLabel" }] : /* istanbul ignore next */ []);
|
|
9121
|
+
timeLabel = input("Time", ...ngDevMode ? [{ debugName: "timeLabel" }] : /* istanbul ignore next */ []);
|
|
9122
|
+
hourLabel = input("Hour", ...ngDevMode ? [{ debugName: "hourLabel" }] : /* istanbul ignore next */ []);
|
|
9123
|
+
minuteLabel = input("Minute", ...ngDevMode ? [{ debugName: "minuteLabel" }] : /* istanbul ignore next */ []);
|
|
9124
|
+
secondLabel = input("Second", ...ngDevMode ? [{ debugName: "secondLabel" }] : /* istanbul ignore next */ []);
|
|
9125
|
+
periodLabel = input("AM/PM", ...ngDevMode ? [{ debugName: "periodLabel" }] : /* istanbul ignore next */ []);
|
|
9126
|
+
inputId = input(...ngDevMode ? [void 0, { debugName: "inputId" }] : /* istanbul ignore next */ []);
|
|
9127
|
+
hourFormat = input("24", ...ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []);
|
|
9128
|
+
showMinutes = input(true, {
|
|
9129
|
+
...ngDevMode ? { debugName: "showMinutes" } : /* istanbul ignore next */ {},
|
|
9130
|
+
transform: booleanAttribute
|
|
9131
|
+
});
|
|
9132
|
+
showSeconds = input(false, {
|
|
9133
|
+
...ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {},
|
|
9134
|
+
transform: booleanAttribute
|
|
9135
|
+
});
|
|
9136
|
+
stepHour = input(1, {
|
|
9137
|
+
...ngDevMode ? { debugName: "stepHour" } : /* istanbul ignore next */ {},
|
|
9138
|
+
transform: numberAttribute
|
|
9139
|
+
});
|
|
9140
|
+
stepMinute = input(1, {
|
|
9141
|
+
...ngDevMode ? { debugName: "stepMinute" } : /* istanbul ignore next */ {},
|
|
9142
|
+
transform: numberAttribute
|
|
9143
|
+
});
|
|
9144
|
+
stepSecond = input(1, {
|
|
9145
|
+
...ngDevMode ? { debugName: "stepSecond" } : /* istanbul ignore next */ {},
|
|
9146
|
+
transform: numberAttribute
|
|
9147
|
+
});
|
|
9148
|
+
inline = input(false, {
|
|
9149
|
+
...ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {},
|
|
9150
|
+
transform: booleanAttribute
|
|
9151
|
+
});
|
|
9152
|
+
minDate = input(null, ...ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []);
|
|
9153
|
+
maxDate = input(null, ...ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []);
|
|
9154
|
+
disabledDates = input([], ...ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []);
|
|
9155
|
+
firstDayOfWeek = input(0, {
|
|
9156
|
+
...ngDevMode ? { debugName: "firstDayOfWeek" } : /* istanbul ignore next */ {},
|
|
9157
|
+
transform: numberAttribute
|
|
9158
|
+
});
|
|
9159
|
+
locale = input(...ngDevMode ? [void 0, { debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
9160
|
+
ariaLabel = input(...ngDevMode ? [void 0, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
9161
|
+
ariaLabelledby = input(...ngDevMode ? [void 0, { debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []);
|
|
9162
|
+
value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
9163
|
+
disabled = input(false, {
|
|
9164
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
9165
|
+
transform: booleanAttribute
|
|
9166
|
+
});
|
|
9167
|
+
invalid = input(false, {
|
|
9168
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
9169
|
+
transform: booleanAttribute
|
|
9170
|
+
});
|
|
9171
|
+
touch = output();
|
|
9172
|
+
open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
9173
|
+
titleId = nextId("hx-date-time-picker-title");
|
|
9174
|
+
popupId = nextId("hx-date-time-picker-popup");
|
|
9175
|
+
positions = [{
|
|
9176
|
+
originX: "start",
|
|
9177
|
+
originY: "bottom",
|
|
9178
|
+
overlayX: "start",
|
|
9179
|
+
overlayY: "top",
|
|
9180
|
+
offsetY: 2
|
|
9181
|
+
}, {
|
|
9182
|
+
originX: "start",
|
|
9183
|
+
originY: "top",
|
|
9184
|
+
overlayX: "start",
|
|
9185
|
+
overlayY: "bottom",
|
|
9186
|
+
offsetY: -2
|
|
9187
|
+
}];
|
|
9188
|
+
field = viewChild("field", ...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
|
|
9189
|
+
calendar = viewChild(HxCalendar, ...ngDevMode ? [{ debugName: "calendar" }] : /* istanbul ignore next */ []);
|
|
9190
|
+
#typed = signal(null, ...ngDevMode ? [{ debugName: "#typed" }] : /* istanbul ignore next */ []);
|
|
9191
|
+
view = signal("day", ...ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []);
|
|
9192
|
+
#cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "#cvaDisabled" }] : /* istanbul ignore next */ []);
|
|
9193
|
+
isDisabled = computed(() => this.disabled() || this.#cvaDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
9194
|
+
focusedDate = signal(startOfDay(/* @__PURE__ */ new Date()), ...ngDevMode ? [{ debugName: "focusedDate" }] : /* istanbul ignore next */ []);
|
|
9195
|
+
today = startOfDay(/* @__PURE__ */ new Date());
|
|
9196
|
+
selectedDate = computed(() => {
|
|
9197
|
+
const value = this.value();
|
|
9198
|
+
return isValidDate(value) ? value : null;
|
|
9199
|
+
}, ...ngDevMode ? [{ debugName: "selectedDate" }] : /* istanbul ignore next */ []);
|
|
9200
|
+
selectedDates = computed(() => {
|
|
9201
|
+
const date = this.selectedDate();
|
|
9202
|
+
return date ? [date] : [];
|
|
9203
|
+
}, ...ngDevMode ? [{ debugName: "selectedDates" }] : /* istanbul ignore next */ []);
|
|
9204
|
+
hour12 = computed(() => this.hourFormat() === "12", ...ngDevMode ? [{ debugName: "hour12" }] : /* istanbul ignore next */ []);
|
|
9205
|
+
#format = computed(() => {
|
|
9206
|
+
const custom = this.dateFormat();
|
|
9207
|
+
if (custom) return new Intl.DateTimeFormat(this.locale(), custom);
|
|
9208
|
+
const options = {
|
|
9209
|
+
day: "2-digit",
|
|
9210
|
+
month: "2-digit",
|
|
9211
|
+
year: "numeric",
|
|
9212
|
+
hour: "2-digit",
|
|
9213
|
+
hourCycle: this.hour12() ? "h12" : "h23"
|
|
9214
|
+
};
|
|
9215
|
+
if (this.showMinutes()) options.minute = "2-digit";
|
|
9216
|
+
if (this.showMinutes() && this.showSeconds()) options.second = "2-digit";
|
|
9217
|
+
return new Intl.DateTimeFormat(this.locale(), options);
|
|
9218
|
+
}, ...ngDevMode ? [{ debugName: "#format" }] : /* istanbul ignore next */ []);
|
|
9219
|
+
time = computed(() => {
|
|
9220
|
+
const date = this.selectedDate();
|
|
9221
|
+
const minutes = this.showMinutes();
|
|
9222
|
+
return {
|
|
9223
|
+
hours: date?.getHours() ?? 0,
|
|
9224
|
+
minutes: minutes ? date?.getMinutes() ?? 0 : 0,
|
|
9225
|
+
seconds: minutes ? date?.getSeconds() ?? 0 : 0
|
|
9226
|
+
};
|
|
9227
|
+
}, ...ngDevMode ? [{ debugName: "time" }] : /* istanbul ignore next */ []);
|
|
9228
|
+
text = computed(() => {
|
|
9229
|
+
const typed = this.#typed();
|
|
9230
|
+
if (typed !== null) return typed;
|
|
9231
|
+
const date = this.selectedDate();
|
|
9232
|
+
return date ? this.#format().format(date) : "";
|
|
9233
|
+
}, ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
9234
|
+
constructor() {
|
|
9235
|
+
effect(() => {
|
|
9236
|
+
this.value();
|
|
9237
|
+
untracked(() => this.#typed.set(null));
|
|
9238
|
+
});
|
|
9239
|
+
effect(() => {
|
|
9240
|
+
if (this.isDisabled()) untracked(() => this.open.set(false));
|
|
9241
|
+
});
|
|
9242
|
+
effect(() => {
|
|
9243
|
+
const first = this.selectedDate() ?? clampTime(this.today, startOfDayOrNull(this.minDate()), this.maxDate());
|
|
9244
|
+
const shown = untracked(() => this.focusedDate());
|
|
9245
|
+
if (first && (first.getFullYear() !== shown.getFullYear() || first.getMonth() !== shown.getMonth())) this.focusedDate.set(startOfDay(first));
|
|
9246
|
+
});
|
|
9247
|
+
}
|
|
9248
|
+
#onChange = () => {};
|
|
9249
|
+
#onTouched = () => {};
|
|
9250
|
+
writeValue(value) {
|
|
9251
|
+
this.#typed.set(null);
|
|
9252
|
+
this.value.set(value ?? null);
|
|
9253
|
+
}
|
|
9254
|
+
registerOnChange(fn) {
|
|
9255
|
+
this.#onChange = fn;
|
|
9256
|
+
}
|
|
9257
|
+
registerOnTouched(fn) {
|
|
9258
|
+
this.#onTouched = fn;
|
|
9259
|
+
}
|
|
9260
|
+
setDisabledState(disabled) {
|
|
9261
|
+
this.#cvaDisabled.set(disabled);
|
|
9262
|
+
}
|
|
9263
|
+
focus() {
|
|
9264
|
+
const field = this.field();
|
|
9265
|
+
if (field) field.nativeElement.focus();
|
|
9266
|
+
else this.#focusDay();
|
|
9267
|
+
}
|
|
9268
|
+
isDateDisabled(date) {
|
|
9269
|
+
return isDateDisabled(date, {
|
|
9270
|
+
min: this.minDate(),
|
|
9271
|
+
max: this.maxDate(),
|
|
9272
|
+
disabledDates: this.disabledDates()
|
|
9273
|
+
});
|
|
9274
|
+
}
|
|
9275
|
+
#outsideTimeRange(date) {
|
|
9276
|
+
return clampTime(date, this.minDate(), this.maxDate()).getTime() !== date.getTime();
|
|
9277
|
+
}
|
|
9278
|
+
pick(date) {
|
|
9279
|
+
if (this.isDisabled() || this.isDateDisabled(date)) return false;
|
|
9280
|
+
const day = startOfDay(date);
|
|
9281
|
+
this.focusedDate.set(day);
|
|
9282
|
+
this.#typed.set(null);
|
|
9283
|
+
this.#commit(this.#atTime(day, this.time()));
|
|
9284
|
+
return true;
|
|
9285
|
+
}
|
|
9286
|
+
#atTime(day, time) {
|
|
9287
|
+
return clampTime(withTime(day, time.hours, time.minutes, time.seconds), this.minDate(), this.maxDate());
|
|
9288
|
+
}
|
|
9289
|
+
setTime(time) {
|
|
9290
|
+
if (this.isDisabled()) return;
|
|
9291
|
+
const day = this.selectedDate() ?? this.today;
|
|
9292
|
+
if (this.isDateDisabled(day)) return;
|
|
9293
|
+
this.#typed.set(null);
|
|
9294
|
+
this.#commit(this.#atTime(day, time));
|
|
9295
|
+
}
|
|
9296
|
+
#commit(next) {
|
|
9297
|
+
this.value.set(next);
|
|
9298
|
+
this.#onChange(next);
|
|
9299
|
+
}
|
|
9300
|
+
#focusDay() {
|
|
9301
|
+
afterNextRender(() => this.calendar()?.focusDay(), { injector: this.#injector });
|
|
9302
|
+
}
|
|
9303
|
+
show() {
|
|
9304
|
+
if (this.isDisabled() || this.inline() || this.open()) return;
|
|
9305
|
+
this.open.set(true);
|
|
9306
|
+
}
|
|
9307
|
+
toggle() {
|
|
9308
|
+
if (this.open()) this.close(true);
|
|
9309
|
+
else this.show();
|
|
9310
|
+
}
|
|
9311
|
+
close(refocus = false) {
|
|
9312
|
+
if (!this.open()) return;
|
|
9313
|
+
this.open.set(false);
|
|
9314
|
+
if (refocus) this.field()?.nativeElement.focus();
|
|
9315
|
+
}
|
|
9316
|
+
onAttach() {
|
|
9317
|
+
this.view.set("day");
|
|
9318
|
+
this.focusedDate.set(startOfDay(this.selectedDate() ?? clampTime(this.today, startOfDayOrNull(this.minDate()), this.maxDate())));
|
|
9319
|
+
this.#focusDay();
|
|
9320
|
+
}
|
|
9321
|
+
onOverlayKeydown(event) {
|
|
9322
|
+
if (event.key === "Escape") {
|
|
9323
|
+
event.preventDefault();
|
|
9324
|
+
this.close(true);
|
|
9325
|
+
}
|
|
9326
|
+
}
|
|
9327
|
+
onOutsideClick(event) {
|
|
9328
|
+
if (!this.#host.nativeElement.contains(event.target)) this.close();
|
|
9329
|
+
}
|
|
9330
|
+
onFieldKeydown(event) {
|
|
9331
|
+
if (event.key === "ArrowDown" || event.altKey && event.key === "ArrowUp") {
|
|
9332
|
+
event.preventDefault();
|
|
9333
|
+
this.show();
|
|
9334
|
+
} else if (event.key === "Enter") this.commitTyping();
|
|
9335
|
+
}
|
|
9336
|
+
onTyping(event) {
|
|
9337
|
+
if (this.isDisabled()) return;
|
|
9338
|
+
this.#typed.set(event.target.value);
|
|
9339
|
+
}
|
|
9340
|
+
commitTyping() {
|
|
9341
|
+
const typed = this.#typed();
|
|
9342
|
+
if (typed === null || this.isDisabled()) return;
|
|
9343
|
+
this.#typed.set(null);
|
|
9344
|
+
const text = typed.trim();
|
|
9345
|
+
if (text === "") {
|
|
9346
|
+
if (this.value() !== null) this.#commit(null);
|
|
9347
|
+
} else {
|
|
9348
|
+
const parsed = parseDateTimeText(text, {
|
|
9349
|
+
locale: this.locale(),
|
|
9350
|
+
showMinutes: this.showMinutes(),
|
|
9351
|
+
timeOnly: false,
|
|
9352
|
+
fallbackDay: this.selectedDate() ?? this.today
|
|
9353
|
+
});
|
|
9354
|
+
if (parsed && !this.isDateDisabled(parsed) && !this.#outsideTimeRange(parsed)) {
|
|
9355
|
+
this.#commit(parsed);
|
|
9356
|
+
this.focusedDate.set(startOfDay(parsed));
|
|
9357
|
+
}
|
|
9358
|
+
}
|
|
9359
|
+
const field = this.field();
|
|
9360
|
+
if (field) field.nativeElement.value = this.text();
|
|
9361
|
+
}
|
|
9362
|
+
selectToday() {
|
|
9363
|
+
if (this.pick(this.today)) this.close(true);
|
|
9364
|
+
}
|
|
9365
|
+
clear() {
|
|
9366
|
+
if (this.isDisabled()) return;
|
|
9367
|
+
this.#typed.set(null);
|
|
9368
|
+
this.#commit(null);
|
|
9369
|
+
this.close(true);
|
|
9370
|
+
}
|
|
9371
|
+
#leave() {
|
|
9372
|
+
this.close();
|
|
9373
|
+
this.commitTyping();
|
|
9374
|
+
this.#onTouched();
|
|
9375
|
+
this.touch.emit();
|
|
9376
|
+
}
|
|
9377
|
+
onHostFocusOut(event) {
|
|
9378
|
+
if (this.inline()) return;
|
|
9379
|
+
const next = event.relatedTarget;
|
|
9380
|
+
if (next?.closest(".hx-date-time-picker-popup") || this.#host.nativeElement.contains(next)) return;
|
|
9381
|
+
if (this.open() && !next) return;
|
|
9382
|
+
this.#leave();
|
|
9383
|
+
}
|
|
9384
|
+
onPopupFocusOut(event) {
|
|
9385
|
+
const next = event.relatedTarget;
|
|
9386
|
+
if (!next || next.closest(".hx-date-time-picker-popup") || this.#host.nativeElement.contains(next)) return;
|
|
9387
|
+
this.#leave();
|
|
9388
|
+
}
|
|
9389
|
+
onInlineFocusOut(event) {
|
|
9390
|
+
if (!this.inline() || this.#host.nativeElement.contains(event.relatedTarget)) return;
|
|
9391
|
+
this.#onTouched();
|
|
9392
|
+
this.touch.emit();
|
|
9393
|
+
}
|
|
9394
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
9395
|
+
minVersion: "12.0.0",
|
|
9396
|
+
version: "22.2.1",
|
|
9397
|
+
ngImport: i0,
|
|
9398
|
+
type: HxDateTimePicker,
|
|
9399
|
+
deps: [],
|
|
9400
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
9401
|
+
});
|
|
9402
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
9403
|
+
minVersion: "17.0.0",
|
|
9404
|
+
version: "22.2.1",
|
|
9405
|
+
type: HxDateTimePicker,
|
|
9406
|
+
isStandalone: true,
|
|
9407
|
+
selector: "hx-date-time-picker",
|
|
9408
|
+
inputs: {
|
|
9409
|
+
placeholder: {
|
|
9410
|
+
classPropertyName: "placeholder",
|
|
9411
|
+
publicName: "placeholder",
|
|
9412
|
+
isSignal: true,
|
|
9413
|
+
isRequired: false,
|
|
9414
|
+
transformFunction: null
|
|
9415
|
+
},
|
|
9416
|
+
showIcon: {
|
|
9417
|
+
classPropertyName: "showIcon",
|
|
9418
|
+
publicName: "showIcon",
|
|
9419
|
+
isSignal: true,
|
|
9420
|
+
isRequired: false,
|
|
9421
|
+
transformFunction: null
|
|
9422
|
+
},
|
|
9423
|
+
showButtonBar: {
|
|
9424
|
+
classPropertyName: "showButtonBar",
|
|
9425
|
+
publicName: "showButtonBar",
|
|
9426
|
+
isSignal: true,
|
|
9427
|
+
isRequired: false,
|
|
9428
|
+
transformFunction: null
|
|
9429
|
+
},
|
|
9430
|
+
dateFormat: {
|
|
9431
|
+
classPropertyName: "dateFormat",
|
|
9432
|
+
publicName: "dateFormat",
|
|
9433
|
+
isSignal: true,
|
|
9434
|
+
isRequired: false,
|
|
9435
|
+
transformFunction: null
|
|
9436
|
+
},
|
|
9437
|
+
todayLabel: {
|
|
9438
|
+
classPropertyName: "todayLabel",
|
|
9439
|
+
publicName: "todayLabel",
|
|
9440
|
+
isSignal: true,
|
|
9441
|
+
isRequired: false,
|
|
9442
|
+
transformFunction: null
|
|
9443
|
+
},
|
|
9444
|
+
clearLabel: {
|
|
9445
|
+
classPropertyName: "clearLabel",
|
|
9446
|
+
publicName: "clearLabel",
|
|
9447
|
+
isSignal: true,
|
|
9448
|
+
isRequired: false,
|
|
9449
|
+
transformFunction: null
|
|
9450
|
+
},
|
|
9451
|
+
chooseLabel: {
|
|
9452
|
+
classPropertyName: "chooseLabel",
|
|
9453
|
+
publicName: "chooseLabel",
|
|
9454
|
+
isSignal: true,
|
|
9455
|
+
isRequired: false,
|
|
9456
|
+
transformFunction: null
|
|
9457
|
+
},
|
|
9458
|
+
timeLabel: {
|
|
9459
|
+
classPropertyName: "timeLabel",
|
|
9460
|
+
publicName: "timeLabel",
|
|
9461
|
+
isSignal: true,
|
|
9462
|
+
isRequired: false,
|
|
9463
|
+
transformFunction: null
|
|
9464
|
+
},
|
|
9465
|
+
hourLabel: {
|
|
9466
|
+
classPropertyName: "hourLabel",
|
|
9467
|
+
publicName: "hourLabel",
|
|
9468
|
+
isSignal: true,
|
|
9469
|
+
isRequired: false,
|
|
9470
|
+
transformFunction: null
|
|
9471
|
+
},
|
|
9472
|
+
minuteLabel: {
|
|
9473
|
+
classPropertyName: "minuteLabel",
|
|
9474
|
+
publicName: "minuteLabel",
|
|
9475
|
+
isSignal: true,
|
|
9476
|
+
isRequired: false,
|
|
9477
|
+
transformFunction: null
|
|
9478
|
+
},
|
|
9479
|
+
secondLabel: {
|
|
9480
|
+
classPropertyName: "secondLabel",
|
|
9481
|
+
publicName: "secondLabel",
|
|
9482
|
+
isSignal: true,
|
|
9483
|
+
isRequired: false,
|
|
9484
|
+
transformFunction: null
|
|
9485
|
+
},
|
|
9486
|
+
periodLabel: {
|
|
9487
|
+
classPropertyName: "periodLabel",
|
|
9488
|
+
publicName: "periodLabel",
|
|
9489
|
+
isSignal: true,
|
|
9490
|
+
isRequired: false,
|
|
9491
|
+
transformFunction: null
|
|
9492
|
+
},
|
|
9493
|
+
inputId: {
|
|
9494
|
+
classPropertyName: "inputId",
|
|
9495
|
+
publicName: "inputId",
|
|
9496
|
+
isSignal: true,
|
|
9497
|
+
isRequired: false,
|
|
9498
|
+
transformFunction: null
|
|
9499
|
+
},
|
|
9500
|
+
hourFormat: {
|
|
9501
|
+
classPropertyName: "hourFormat",
|
|
9502
|
+
publicName: "hourFormat",
|
|
9503
|
+
isSignal: true,
|
|
9504
|
+
isRequired: false,
|
|
9505
|
+
transformFunction: null
|
|
9506
|
+
},
|
|
9507
|
+
showMinutes: {
|
|
9508
|
+
classPropertyName: "showMinutes",
|
|
9509
|
+
publicName: "showMinutes",
|
|
9510
|
+
isSignal: true,
|
|
9511
|
+
isRequired: false,
|
|
9512
|
+
transformFunction: null
|
|
9513
|
+
},
|
|
9514
|
+
showSeconds: {
|
|
9515
|
+
classPropertyName: "showSeconds",
|
|
9516
|
+
publicName: "showSeconds",
|
|
9517
|
+
isSignal: true,
|
|
9518
|
+
isRequired: false,
|
|
9519
|
+
transformFunction: null
|
|
9520
|
+
},
|
|
9521
|
+
stepHour: {
|
|
9522
|
+
classPropertyName: "stepHour",
|
|
9523
|
+
publicName: "stepHour",
|
|
9524
|
+
isSignal: true,
|
|
9525
|
+
isRequired: false,
|
|
9526
|
+
transformFunction: null
|
|
9527
|
+
},
|
|
9528
|
+
stepMinute: {
|
|
9529
|
+
classPropertyName: "stepMinute",
|
|
9530
|
+
publicName: "stepMinute",
|
|
9531
|
+
isSignal: true,
|
|
9532
|
+
isRequired: false,
|
|
9533
|
+
transformFunction: null
|
|
9534
|
+
},
|
|
9535
|
+
stepSecond: {
|
|
9536
|
+
classPropertyName: "stepSecond",
|
|
9537
|
+
publicName: "stepSecond",
|
|
9538
|
+
isSignal: true,
|
|
9539
|
+
isRequired: false,
|
|
9540
|
+
transformFunction: null
|
|
9541
|
+
},
|
|
9542
|
+
inline: {
|
|
9543
|
+
classPropertyName: "inline",
|
|
9544
|
+
publicName: "inline",
|
|
9545
|
+
isSignal: true,
|
|
9546
|
+
isRequired: false,
|
|
9547
|
+
transformFunction: null
|
|
9548
|
+
},
|
|
9549
|
+
minDate: {
|
|
9550
|
+
classPropertyName: "minDate",
|
|
9551
|
+
publicName: "minDate",
|
|
9552
|
+
isSignal: true,
|
|
9553
|
+
isRequired: false,
|
|
9554
|
+
transformFunction: null
|
|
9555
|
+
},
|
|
9556
|
+
maxDate: {
|
|
9557
|
+
classPropertyName: "maxDate",
|
|
9558
|
+
publicName: "maxDate",
|
|
9559
|
+
isSignal: true,
|
|
9560
|
+
isRequired: false,
|
|
9561
|
+
transformFunction: null
|
|
9562
|
+
},
|
|
9563
|
+
disabledDates: {
|
|
9564
|
+
classPropertyName: "disabledDates",
|
|
9565
|
+
publicName: "disabledDates",
|
|
9566
|
+
isSignal: true,
|
|
9567
|
+
isRequired: false,
|
|
9568
|
+
transformFunction: null
|
|
9569
|
+
},
|
|
9570
|
+
firstDayOfWeek: {
|
|
9571
|
+
classPropertyName: "firstDayOfWeek",
|
|
9572
|
+
publicName: "firstDayOfWeek",
|
|
9573
|
+
isSignal: true,
|
|
9574
|
+
isRequired: false,
|
|
9575
|
+
transformFunction: null
|
|
9576
|
+
},
|
|
9577
|
+
locale: {
|
|
9578
|
+
classPropertyName: "locale",
|
|
9579
|
+
publicName: "locale",
|
|
9580
|
+
isSignal: true,
|
|
9581
|
+
isRequired: false,
|
|
9582
|
+
transformFunction: null
|
|
9583
|
+
},
|
|
9584
|
+
ariaLabel: {
|
|
9585
|
+
classPropertyName: "ariaLabel",
|
|
9586
|
+
publicName: "ariaLabel",
|
|
9587
|
+
isSignal: true,
|
|
9588
|
+
isRequired: false,
|
|
9589
|
+
transformFunction: null
|
|
9590
|
+
},
|
|
9591
|
+
ariaLabelledby: {
|
|
9592
|
+
classPropertyName: "ariaLabelledby",
|
|
9593
|
+
publicName: "ariaLabelledby",
|
|
9594
|
+
isSignal: true,
|
|
9595
|
+
isRequired: false,
|
|
9596
|
+
transformFunction: null
|
|
9597
|
+
},
|
|
9598
|
+
value: {
|
|
9599
|
+
classPropertyName: "value",
|
|
9600
|
+
publicName: "value",
|
|
9601
|
+
isSignal: true,
|
|
9602
|
+
isRequired: false,
|
|
9603
|
+
transformFunction: null
|
|
9604
|
+
},
|
|
9605
|
+
disabled: {
|
|
9606
|
+
classPropertyName: "disabled",
|
|
9607
|
+
publicName: "disabled",
|
|
9608
|
+
isSignal: true,
|
|
9609
|
+
isRequired: false,
|
|
9610
|
+
transformFunction: null
|
|
9611
|
+
},
|
|
9612
|
+
invalid: {
|
|
9613
|
+
classPropertyName: "invalid",
|
|
9614
|
+
publicName: "invalid",
|
|
9615
|
+
isSignal: true,
|
|
9616
|
+
isRequired: false,
|
|
9617
|
+
transformFunction: null
|
|
9618
|
+
}
|
|
9619
|
+
},
|
|
9620
|
+
outputs: {
|
|
9621
|
+
value: "valueChange",
|
|
9622
|
+
touch: "touch"
|
|
9623
|
+
},
|
|
9624
|
+
host: {
|
|
9625
|
+
listeners: { "focusout": "onHostFocusOut($event)" },
|
|
9626
|
+
properties: {
|
|
9627
|
+
"class.hx-date-time-picker-inline": "inline()",
|
|
9628
|
+
"class.hx-date-time-picker-disabled": "isDisabled()",
|
|
9629
|
+
"class.hx-date-time-picker-invalid": "invalid()",
|
|
9630
|
+
"class.hx-date-time-picker-open": "open()",
|
|
9631
|
+
"class.hx-date-time-picker-has-icon": "showIcon() && !inline()",
|
|
9632
|
+
"class.hx-filled": "!inline() && text() !== \"\""
|
|
9633
|
+
},
|
|
9634
|
+
classAttribute: "hx-date-time-picker"
|
|
9635
|
+
},
|
|
9636
|
+
providers: [{
|
|
9637
|
+
provide: NG_VALUE_ACCESSOR,
|
|
9638
|
+
useExisting: forwardRef(() => HxDateTimePicker),
|
|
9639
|
+
multi: true
|
|
9640
|
+
}],
|
|
9641
|
+
viewQueries: [{
|
|
9642
|
+
propertyName: "field",
|
|
9643
|
+
first: true,
|
|
9644
|
+
predicate: ["field"],
|
|
9645
|
+
descendants: true,
|
|
9646
|
+
isSignal: true
|
|
9647
|
+
}, {
|
|
9648
|
+
propertyName: "calendar",
|
|
9649
|
+
first: true,
|
|
9650
|
+
predicate: HxCalendar,
|
|
9651
|
+
descendants: true,
|
|
9652
|
+
isSignal: true
|
|
9653
|
+
}],
|
|
9654
|
+
ngImport: i0,
|
|
9655
|
+
template: "@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"panel\" />\n} @else {\n <div class=\"hx-date-time-picker-field\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #field\n type=\"text\"\n class=\"hx-date-time-picker-input\"\n autocomplete=\"off\"\n aria-haspopup=\"dialog\"\n [attr.id]=\"inputId() ?? null\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"text()\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? popupId : null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n (input)=\"onTyping($event)\"\n (change)=\"commitTyping()\"\n (click)=\"show()\"\n (keydown)=\"onFieldKeydown($event)\"\n />\n @if (showIcon()) {\n <button\n type=\"button\"\n class=\"hx-date-time-picker-trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"chooseLabel()\"\n [attr.aria-expanded]=\"open()\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"hx-date-time-picker-trigger-icon\" aria-hidden=\"true\"></span>\n </button>\n }\n </div>\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayPanelClass=\"hx-date-time-picker-overlay\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPush]=\"true\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n (attach)=\"onAttach()\"\n (detach)=\"open.set(false)\"\n >\n <div\n class=\"hx-date-time-picker-popup\"\n role=\"dialog\"\n aria-modal=\"false\"\n [id]=\"popupId\"\n [attr.aria-label]=\"ariaLabel() ?? chooseLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (focusout)=\"onPopupFocusOut($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"panel\" />\n @if (showButtonBar()) {\n <div class=\"hx-date-time-picker-buttonbar\">\n <button type=\"button\" class=\"hx-date-time-picker-button\" (click)=\"selectToday()\">{{ todayLabel() }}</button>\n <button type=\"button\" class=\"hx-date-time-picker-button\" (click)=\"clear()\">{{ clearLabel() }}</button>\n </div>\n }\n </div>\n </ng-template>\n}\n\n<ng-template #panel>\n <div\n class=\"hx-date-time-picker-panel\"\n role=\"group\"\n [attr.aria-label]=\"inline() ? (ariaLabel() ?? chooseLabel()) : null\"\n [attr.aria-labelledby]=\"inline() ? (ariaLabelledby() ?? null) : null\"\n (focusout)=\"onInlineFocusOut($event)\"\n >\n <hx-calendar\n [(focusedDate)]=\"focusedDate\"\n [(view)]=\"view\"\n [selectedDates]=\"selectedDates()\"\n selectionMode=\"single\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n [titleId]=\"titleId\"\n [today]=\"today\"\n (picked)=\"pick($event)\"\n />\n <hx-time-row\n [time]=\"time()\"\n [hour12]=\"hour12()\"\n [showMinutes]=\"showMinutes()\"\n [showSeconds]=\"showSeconds()\"\n [stepHour]=\"stepHour()\"\n [stepMinute]=\"stepMinute()\"\n [stepSecond]=\"stepSecond()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n [timeLabel]=\"timeLabel()\"\n [hourLabel]=\"hourLabel()\"\n [minuteLabel]=\"minuteLabel()\"\n [secondLabel]=\"secondLabel()\"\n [periodLabel]=\"periodLabel()\"\n (timeChange)=\"setTime($event)\"\n />\n </div>\n</ng-template>\n",
|
|
9656
|
+
dependencies: [
|
|
9657
|
+
{
|
|
9658
|
+
kind: "directive",
|
|
9659
|
+
type: CdkConnectedOverlay,
|
|
9660
|
+
selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
|
|
9661
|
+
inputs: [
|
|
9662
|
+
"cdkConnectedOverlayOrigin",
|
|
9663
|
+
"cdkConnectedOverlayPositions",
|
|
9664
|
+
"cdkConnectedOverlayPositionStrategy",
|
|
9665
|
+
"cdkConnectedOverlayOffsetX",
|
|
9666
|
+
"cdkConnectedOverlayOffsetY",
|
|
9667
|
+
"cdkConnectedOverlayWidth",
|
|
9668
|
+
"cdkConnectedOverlayHeight",
|
|
9669
|
+
"cdkConnectedOverlayMinWidth",
|
|
9670
|
+
"cdkConnectedOverlayMinHeight",
|
|
9671
|
+
"cdkConnectedOverlayBackdropClass",
|
|
9672
|
+
"cdkConnectedOverlayPanelClass",
|
|
9673
|
+
"cdkConnectedOverlayViewportMargin",
|
|
9674
|
+
"cdkConnectedOverlayScrollStrategy",
|
|
9675
|
+
"cdkConnectedOverlayOpen",
|
|
9676
|
+
"cdkConnectedOverlayDisableClose",
|
|
9677
|
+
"cdkConnectedOverlayTransformOriginOn",
|
|
9678
|
+
"cdkConnectedOverlayHasBackdrop",
|
|
9679
|
+
"cdkConnectedOverlayLockPosition",
|
|
9680
|
+
"cdkConnectedOverlayFlexibleDimensions",
|
|
9681
|
+
"cdkConnectedOverlayGrowAfterOpen",
|
|
9682
|
+
"cdkConnectedOverlayPush",
|
|
9683
|
+
"cdkConnectedOverlayDisposeOnNavigation",
|
|
9684
|
+
"cdkConnectedOverlayUsePopover",
|
|
9685
|
+
"cdkConnectedOverlayMatchWidth",
|
|
9686
|
+
"cdkConnectedOverlay"
|
|
9687
|
+
],
|
|
9688
|
+
outputs: [
|
|
9689
|
+
"backdropClick",
|
|
9690
|
+
"positionChange",
|
|
9691
|
+
"attach",
|
|
9692
|
+
"detach",
|
|
9693
|
+
"overlayKeydown",
|
|
9694
|
+
"overlayOutsideClick"
|
|
9695
|
+
],
|
|
9696
|
+
exportAs: ["cdkConnectedOverlay"]
|
|
9697
|
+
},
|
|
9698
|
+
{
|
|
9699
|
+
kind: "directive",
|
|
9700
|
+
type: CdkOverlayOrigin,
|
|
9701
|
+
selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
|
|
9702
|
+
exportAs: ["cdkOverlayOrigin"]
|
|
9703
|
+
},
|
|
9704
|
+
{
|
|
9705
|
+
kind: "directive",
|
|
9706
|
+
type: NgTemplateOutlet,
|
|
9707
|
+
selector: "[ngTemplateOutlet]",
|
|
9708
|
+
inputs: [
|
|
9709
|
+
"ngTemplateOutletContext",
|
|
9710
|
+
"ngTemplateOutlet",
|
|
9711
|
+
"ngTemplateOutletInjector"
|
|
9712
|
+
]
|
|
9713
|
+
},
|
|
9714
|
+
{
|
|
9715
|
+
kind: "component",
|
|
9716
|
+
type: HxCalendar,
|
|
9717
|
+
selector: "hx-calendar",
|
|
9718
|
+
inputs: [
|
|
9719
|
+
"focusedDate",
|
|
9720
|
+
"view",
|
|
9721
|
+
"selectedDates",
|
|
9722
|
+
"selectionMode",
|
|
9723
|
+
"minDate",
|
|
9724
|
+
"maxDate",
|
|
9725
|
+
"disabledDates",
|
|
9726
|
+
"firstDayOfWeek",
|
|
9727
|
+
"locale",
|
|
9728
|
+
"disabled",
|
|
9729
|
+
"titleId",
|
|
9730
|
+
"today"
|
|
9731
|
+
],
|
|
9732
|
+
outputs: [
|
|
9733
|
+
"focusedDateChange",
|
|
9734
|
+
"viewChange",
|
|
9735
|
+
"picked"
|
|
9736
|
+
]
|
|
9737
|
+
},
|
|
9738
|
+
{
|
|
9739
|
+
kind: "component",
|
|
9740
|
+
type: HxTimeRow,
|
|
9741
|
+
selector: "hx-time-row",
|
|
9742
|
+
inputs: [
|
|
9743
|
+
"time",
|
|
9744
|
+
"hour12",
|
|
9745
|
+
"showMinutes",
|
|
9746
|
+
"showSeconds",
|
|
9747
|
+
"stepHour",
|
|
9748
|
+
"stepMinute",
|
|
9749
|
+
"stepSecond",
|
|
9750
|
+
"locale",
|
|
9751
|
+
"disabled",
|
|
9752
|
+
"timeLabel",
|
|
9753
|
+
"hourLabel",
|
|
9754
|
+
"minuteLabel",
|
|
9755
|
+
"secondLabel",
|
|
9756
|
+
"periodLabel"
|
|
9757
|
+
],
|
|
9758
|
+
outputs: ["timeChange"]
|
|
9759
|
+
}
|
|
9760
|
+
],
|
|
9761
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
9762
|
+
});
|
|
9763
|
+
};
|
|
9764
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
9765
|
+
minVersion: "12.0.0",
|
|
9766
|
+
version: "22.2.1",
|
|
9767
|
+
ngImport: i0,
|
|
9768
|
+
type: HxDateTimePicker,
|
|
9769
|
+
decorators: [{
|
|
9770
|
+
type: Component,
|
|
9771
|
+
args: [{
|
|
9772
|
+
selector: "hx-date-time-picker",
|
|
9773
|
+
imports: [
|
|
9774
|
+
CdkConnectedOverlay,
|
|
9775
|
+
CdkOverlayOrigin,
|
|
9776
|
+
NgTemplateOutlet,
|
|
9777
|
+
HxCalendar,
|
|
9778
|
+
HxTimeRow
|
|
9779
|
+
],
|
|
9780
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9781
|
+
providers: [{
|
|
9782
|
+
provide: NG_VALUE_ACCESSOR,
|
|
9783
|
+
useExisting: forwardRef(() => HxDateTimePicker),
|
|
9784
|
+
multi: true
|
|
9785
|
+
}],
|
|
9786
|
+
host: {
|
|
9787
|
+
class: "hx-date-time-picker",
|
|
9788
|
+
"[class.hx-date-time-picker-inline]": "inline()",
|
|
9789
|
+
"[class.hx-date-time-picker-disabled]": "isDisabled()",
|
|
9790
|
+
"[class.hx-date-time-picker-invalid]": "invalid()",
|
|
9791
|
+
"[class.hx-date-time-picker-open]": "open()",
|
|
9792
|
+
"[class.hx-date-time-picker-has-icon]": "showIcon() && !inline()",
|
|
9793
|
+
"[class.hx-filled]": "!inline() && text() !== \"\"",
|
|
9794
|
+
"(focusout)": "onHostFocusOut($event)"
|
|
9795
|
+
},
|
|
9796
|
+
template: "@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"panel\" />\n} @else {\n <div class=\"hx-date-time-picker-field\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #field\n type=\"text\"\n class=\"hx-date-time-picker-input\"\n autocomplete=\"off\"\n aria-haspopup=\"dialog\"\n [attr.id]=\"inputId() ?? null\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"text()\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? popupId : null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n (input)=\"onTyping($event)\"\n (change)=\"commitTyping()\"\n (click)=\"show()\"\n (keydown)=\"onFieldKeydown($event)\"\n />\n @if (showIcon()) {\n <button\n type=\"button\"\n class=\"hx-date-time-picker-trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"chooseLabel()\"\n [attr.aria-expanded]=\"open()\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"hx-date-time-picker-trigger-icon\" aria-hidden=\"true\"></span>\n </button>\n }\n </div>\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayPanelClass=\"hx-date-time-picker-overlay\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPush]=\"true\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n (attach)=\"onAttach()\"\n (detach)=\"open.set(false)\"\n >\n <div\n class=\"hx-date-time-picker-popup\"\n role=\"dialog\"\n aria-modal=\"false\"\n [id]=\"popupId\"\n [attr.aria-label]=\"ariaLabel() ?? chooseLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (focusout)=\"onPopupFocusOut($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"panel\" />\n @if (showButtonBar()) {\n <div class=\"hx-date-time-picker-buttonbar\">\n <button type=\"button\" class=\"hx-date-time-picker-button\" (click)=\"selectToday()\">{{ todayLabel() }}</button>\n <button type=\"button\" class=\"hx-date-time-picker-button\" (click)=\"clear()\">{{ clearLabel() }}</button>\n </div>\n }\n </div>\n </ng-template>\n}\n\n<ng-template #panel>\n <div\n class=\"hx-date-time-picker-panel\"\n role=\"group\"\n [attr.aria-label]=\"inline() ? (ariaLabel() ?? chooseLabel()) : null\"\n [attr.aria-labelledby]=\"inline() ? (ariaLabelledby() ?? null) : null\"\n (focusout)=\"onInlineFocusOut($event)\"\n >\n <hx-calendar\n [(focusedDate)]=\"focusedDate\"\n [(view)]=\"view\"\n [selectedDates]=\"selectedDates()\"\n selectionMode=\"single\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [disabledDates]=\"disabledDates()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n [titleId]=\"titleId\"\n [today]=\"today\"\n (picked)=\"pick($event)\"\n />\n <hx-time-row\n [time]=\"time()\"\n [hour12]=\"hour12()\"\n [showMinutes]=\"showMinutes()\"\n [showSeconds]=\"showSeconds()\"\n [stepHour]=\"stepHour()\"\n [stepMinute]=\"stepMinute()\"\n [stepSecond]=\"stepSecond()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n [timeLabel]=\"timeLabel()\"\n [hourLabel]=\"hourLabel()\"\n [minuteLabel]=\"minuteLabel()\"\n [secondLabel]=\"secondLabel()\"\n [periodLabel]=\"periodLabel()\"\n (timeChange)=\"setTime($event)\"\n />\n </div>\n</ng-template>\n"
|
|
9797
|
+
}]
|
|
9798
|
+
}],
|
|
9799
|
+
ctorParameters: () => [],
|
|
9800
|
+
propDecorators: {
|
|
9801
|
+
placeholder: [{
|
|
9802
|
+
type: i0.Input,
|
|
9803
|
+
args: [{
|
|
9804
|
+
isSignal: true,
|
|
9805
|
+
alias: "placeholder",
|
|
9806
|
+
required: false
|
|
9807
|
+
}]
|
|
9808
|
+
}],
|
|
9809
|
+
showIcon: [{
|
|
9810
|
+
type: i0.Input,
|
|
9811
|
+
args: [{
|
|
9812
|
+
isSignal: true,
|
|
9813
|
+
alias: "showIcon",
|
|
9814
|
+
required: false
|
|
9815
|
+
}]
|
|
9816
|
+
}],
|
|
9817
|
+
showButtonBar: [{
|
|
9818
|
+
type: i0.Input,
|
|
9819
|
+
args: [{
|
|
9820
|
+
isSignal: true,
|
|
9821
|
+
alias: "showButtonBar",
|
|
9822
|
+
required: false
|
|
9823
|
+
}]
|
|
9824
|
+
}],
|
|
9825
|
+
dateFormat: [{
|
|
9826
|
+
type: i0.Input,
|
|
9827
|
+
args: [{
|
|
9828
|
+
isSignal: true,
|
|
9829
|
+
alias: "dateFormat",
|
|
9830
|
+
required: false
|
|
9831
|
+
}]
|
|
9832
|
+
}],
|
|
9833
|
+
todayLabel: [{
|
|
9834
|
+
type: i0.Input,
|
|
9835
|
+
args: [{
|
|
9836
|
+
isSignal: true,
|
|
9837
|
+
alias: "todayLabel",
|
|
9838
|
+
required: false
|
|
9839
|
+
}]
|
|
9840
|
+
}],
|
|
9841
|
+
clearLabel: [{
|
|
9842
|
+
type: i0.Input,
|
|
9843
|
+
args: [{
|
|
9844
|
+
isSignal: true,
|
|
9845
|
+
alias: "clearLabel",
|
|
9846
|
+
required: false
|
|
9847
|
+
}]
|
|
9848
|
+
}],
|
|
9849
|
+
chooseLabel: [{
|
|
9850
|
+
type: i0.Input,
|
|
9851
|
+
args: [{
|
|
9852
|
+
isSignal: true,
|
|
9853
|
+
alias: "chooseLabel",
|
|
9854
|
+
required: false
|
|
9855
|
+
}]
|
|
9856
|
+
}],
|
|
9857
|
+
timeLabel: [{
|
|
9858
|
+
type: i0.Input,
|
|
9859
|
+
args: [{
|
|
9860
|
+
isSignal: true,
|
|
9861
|
+
alias: "timeLabel",
|
|
9862
|
+
required: false
|
|
9863
|
+
}]
|
|
9864
|
+
}],
|
|
9865
|
+
hourLabel: [{
|
|
9866
|
+
type: i0.Input,
|
|
9867
|
+
args: [{
|
|
9868
|
+
isSignal: true,
|
|
9869
|
+
alias: "hourLabel",
|
|
9870
|
+
required: false
|
|
9871
|
+
}]
|
|
9872
|
+
}],
|
|
9873
|
+
minuteLabel: [{
|
|
9874
|
+
type: i0.Input,
|
|
9875
|
+
args: [{
|
|
9876
|
+
isSignal: true,
|
|
9877
|
+
alias: "minuteLabel",
|
|
9878
|
+
required: false
|
|
9879
|
+
}]
|
|
9880
|
+
}],
|
|
9881
|
+
secondLabel: [{
|
|
9882
|
+
type: i0.Input,
|
|
9883
|
+
args: [{
|
|
9884
|
+
isSignal: true,
|
|
9885
|
+
alias: "secondLabel",
|
|
9886
|
+
required: false
|
|
9887
|
+
}]
|
|
9888
|
+
}],
|
|
9889
|
+
periodLabel: [{
|
|
9890
|
+
type: i0.Input,
|
|
9891
|
+
args: [{
|
|
9892
|
+
isSignal: true,
|
|
9893
|
+
alias: "periodLabel",
|
|
9894
|
+
required: false
|
|
9895
|
+
}]
|
|
9896
|
+
}],
|
|
9897
|
+
inputId: [{
|
|
9898
|
+
type: i0.Input,
|
|
9899
|
+
args: [{
|
|
9900
|
+
isSignal: true,
|
|
9901
|
+
alias: "inputId",
|
|
9902
|
+
required: false
|
|
9903
|
+
}]
|
|
9904
|
+
}],
|
|
9905
|
+
hourFormat: [{
|
|
9906
|
+
type: i0.Input,
|
|
9907
|
+
args: [{
|
|
9908
|
+
isSignal: true,
|
|
9909
|
+
alias: "hourFormat",
|
|
9910
|
+
required: false
|
|
9911
|
+
}]
|
|
9912
|
+
}],
|
|
9913
|
+
showMinutes: [{
|
|
9914
|
+
type: i0.Input,
|
|
9915
|
+
args: [{
|
|
9916
|
+
isSignal: true,
|
|
9917
|
+
alias: "showMinutes",
|
|
9918
|
+
required: false
|
|
9919
|
+
}]
|
|
9920
|
+
}],
|
|
9921
|
+
showSeconds: [{
|
|
9922
|
+
type: i0.Input,
|
|
9923
|
+
args: [{
|
|
9924
|
+
isSignal: true,
|
|
9925
|
+
alias: "showSeconds",
|
|
9926
|
+
required: false
|
|
9927
|
+
}]
|
|
9928
|
+
}],
|
|
9929
|
+
stepHour: [{
|
|
9930
|
+
type: i0.Input,
|
|
9931
|
+
args: [{
|
|
9932
|
+
isSignal: true,
|
|
9933
|
+
alias: "stepHour",
|
|
9934
|
+
required: false
|
|
9935
|
+
}]
|
|
9936
|
+
}],
|
|
9937
|
+
stepMinute: [{
|
|
9938
|
+
type: i0.Input,
|
|
9939
|
+
args: [{
|
|
9940
|
+
isSignal: true,
|
|
9941
|
+
alias: "stepMinute",
|
|
9942
|
+
required: false
|
|
9943
|
+
}]
|
|
9944
|
+
}],
|
|
9945
|
+
stepSecond: [{
|
|
9946
|
+
type: i0.Input,
|
|
9947
|
+
args: [{
|
|
9948
|
+
isSignal: true,
|
|
9949
|
+
alias: "stepSecond",
|
|
9950
|
+
required: false
|
|
9951
|
+
}]
|
|
9952
|
+
}],
|
|
9953
|
+
inline: [{
|
|
9954
|
+
type: i0.Input,
|
|
9955
|
+
args: [{
|
|
9956
|
+
isSignal: true,
|
|
9957
|
+
alias: "inline",
|
|
9958
|
+
required: false
|
|
9959
|
+
}]
|
|
9960
|
+
}],
|
|
9961
|
+
minDate: [{
|
|
9962
|
+
type: i0.Input,
|
|
9963
|
+
args: [{
|
|
9964
|
+
isSignal: true,
|
|
9965
|
+
alias: "minDate",
|
|
9966
|
+
required: false
|
|
9967
|
+
}]
|
|
9968
|
+
}],
|
|
9969
|
+
maxDate: [{
|
|
9970
|
+
type: i0.Input,
|
|
9971
|
+
args: [{
|
|
9972
|
+
isSignal: true,
|
|
9973
|
+
alias: "maxDate",
|
|
9974
|
+
required: false
|
|
9975
|
+
}]
|
|
9976
|
+
}],
|
|
9977
|
+
disabledDates: [{
|
|
9978
|
+
type: i0.Input,
|
|
9979
|
+
args: [{
|
|
9980
|
+
isSignal: true,
|
|
9981
|
+
alias: "disabledDates",
|
|
9982
|
+
required: false
|
|
9983
|
+
}]
|
|
9984
|
+
}],
|
|
9985
|
+
firstDayOfWeek: [{
|
|
9986
|
+
type: i0.Input,
|
|
9987
|
+
args: [{
|
|
9988
|
+
isSignal: true,
|
|
9989
|
+
alias: "firstDayOfWeek",
|
|
9990
|
+
required: false
|
|
9991
|
+
}]
|
|
9992
|
+
}],
|
|
9993
|
+
locale: [{
|
|
9994
|
+
type: i0.Input,
|
|
9995
|
+
args: [{
|
|
9996
|
+
isSignal: true,
|
|
9997
|
+
alias: "locale",
|
|
9998
|
+
required: false
|
|
9999
|
+
}]
|
|
10000
|
+
}],
|
|
10001
|
+
ariaLabel: [{
|
|
10002
|
+
type: i0.Input,
|
|
10003
|
+
args: [{
|
|
10004
|
+
isSignal: true,
|
|
10005
|
+
alias: "ariaLabel",
|
|
10006
|
+
required: false
|
|
10007
|
+
}]
|
|
10008
|
+
}],
|
|
10009
|
+
ariaLabelledby: [{
|
|
10010
|
+
type: i0.Input,
|
|
10011
|
+
args: [{
|
|
10012
|
+
isSignal: true,
|
|
10013
|
+
alias: "ariaLabelledby",
|
|
10014
|
+
required: false
|
|
10015
|
+
}]
|
|
10016
|
+
}],
|
|
10017
|
+
value: [{
|
|
10018
|
+
type: i0.Input,
|
|
10019
|
+
args: [{
|
|
10020
|
+
isSignal: true,
|
|
10021
|
+
alias: "value",
|
|
10022
|
+
required: false
|
|
10023
|
+
}]
|
|
10024
|
+
}, {
|
|
10025
|
+
type: i0.Output,
|
|
10026
|
+
args: ["valueChange"]
|
|
10027
|
+
}],
|
|
10028
|
+
disabled: [{
|
|
10029
|
+
type: i0.Input,
|
|
10030
|
+
args: [{
|
|
10031
|
+
isSignal: true,
|
|
10032
|
+
alias: "disabled",
|
|
10033
|
+
required: false
|
|
10034
|
+
}]
|
|
10035
|
+
}],
|
|
10036
|
+
invalid: [{
|
|
10037
|
+
type: i0.Input,
|
|
10038
|
+
args: [{
|
|
10039
|
+
isSignal: true,
|
|
10040
|
+
alias: "invalid",
|
|
10041
|
+
required: false
|
|
10042
|
+
}]
|
|
10043
|
+
}],
|
|
10044
|
+
touch: [{
|
|
10045
|
+
type: i0.Output,
|
|
10046
|
+
args: ["touch"]
|
|
10047
|
+
}],
|
|
10048
|
+
field: [{
|
|
10049
|
+
type: i0.ViewChild,
|
|
10050
|
+
args: ["field", { isSignal: true }]
|
|
10051
|
+
}],
|
|
10052
|
+
calendar: [{
|
|
10053
|
+
type: i0.ViewChild,
|
|
10054
|
+
args: [i0.forwardRef(() => HxCalendar), { isSignal: true }]
|
|
10055
|
+
}]
|
|
10056
|
+
}
|
|
10057
|
+
});
|
|
10058
|
+
var HxTimePicker = class HxTimePicker {
|
|
10059
|
+
#host = inject(ElementRef);
|
|
10060
|
+
#injector = inject(Injector);
|
|
10061
|
+
placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
10062
|
+
showIcon = input(false, {
|
|
10063
|
+
...ngDevMode ? { debugName: "showIcon" } : /* istanbul ignore next */ {},
|
|
10064
|
+
transform: booleanAttribute
|
|
10065
|
+
});
|
|
10066
|
+
showButtonBar = input(false, {
|
|
10067
|
+
...ngDevMode ? { debugName: "showButtonBar" } : /* istanbul ignore next */ {},
|
|
10068
|
+
transform: booleanAttribute
|
|
10069
|
+
});
|
|
10070
|
+
dateFormat = input(...ngDevMode ? [void 0, { debugName: "dateFormat" }] : /* istanbul ignore next */ []);
|
|
10071
|
+
nowLabel = input("Now", ...ngDevMode ? [{ debugName: "nowLabel" }] : /* istanbul ignore next */ []);
|
|
10072
|
+
clearLabel = input("Clear", ...ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []);
|
|
10073
|
+
chooseLabel = input("Choose time", ...ngDevMode ? [{ debugName: "chooseLabel" }] : /* istanbul ignore next */ []);
|
|
10074
|
+
timeLabel = input("Time", ...ngDevMode ? [{ debugName: "timeLabel" }] : /* istanbul ignore next */ []);
|
|
10075
|
+
hourLabel = input("Hour", ...ngDevMode ? [{ debugName: "hourLabel" }] : /* istanbul ignore next */ []);
|
|
10076
|
+
minuteLabel = input("Minute", ...ngDevMode ? [{ debugName: "minuteLabel" }] : /* istanbul ignore next */ []);
|
|
10077
|
+
secondLabel = input("Second", ...ngDevMode ? [{ debugName: "secondLabel" }] : /* istanbul ignore next */ []);
|
|
10078
|
+
periodLabel = input("AM/PM", ...ngDevMode ? [{ debugName: "periodLabel" }] : /* istanbul ignore next */ []);
|
|
10079
|
+
inputId = input(...ngDevMode ? [void 0, { debugName: "inputId" }] : /* istanbul ignore next */ []);
|
|
10080
|
+
hourFormat = input("24", ...ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []);
|
|
10081
|
+
showMinutes = input(true, {
|
|
10082
|
+
...ngDevMode ? { debugName: "showMinutes" } : /* istanbul ignore next */ {},
|
|
10083
|
+
transform: booleanAttribute
|
|
10084
|
+
});
|
|
10085
|
+
showSeconds = input(false, {
|
|
10086
|
+
...ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {},
|
|
10087
|
+
transform: booleanAttribute
|
|
10088
|
+
});
|
|
10089
|
+
stepHour = input(1, {
|
|
10090
|
+
...ngDevMode ? { debugName: "stepHour" } : /* istanbul ignore next */ {},
|
|
10091
|
+
transform: numberAttribute
|
|
10092
|
+
});
|
|
10093
|
+
stepMinute = input(1, {
|
|
10094
|
+
...ngDevMode ? { debugName: "stepMinute" } : /* istanbul ignore next */ {},
|
|
10095
|
+
transform: numberAttribute
|
|
10096
|
+
});
|
|
10097
|
+
stepSecond = input(1, {
|
|
10098
|
+
...ngDevMode ? { debugName: "stepSecond" } : /* istanbul ignore next */ {},
|
|
10099
|
+
transform: numberAttribute
|
|
10100
|
+
});
|
|
10101
|
+
minTime = input(null, ...ngDevMode ? [{ debugName: "minTime" }] : /* istanbul ignore next */ []);
|
|
10102
|
+
maxTime = input(null, ...ngDevMode ? [{ debugName: "maxTime" }] : /* istanbul ignore next */ []);
|
|
10103
|
+
inline = input(false, {
|
|
10104
|
+
...ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {},
|
|
10105
|
+
transform: booleanAttribute
|
|
10106
|
+
});
|
|
10107
|
+
locale = input(...ngDevMode ? [void 0, { debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
10108
|
+
ariaLabel = input(...ngDevMode ? [void 0, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
10109
|
+
ariaLabelledby = input(...ngDevMode ? [void 0, { debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []);
|
|
10110
|
+
value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
10111
|
+
disabled = input(false, {
|
|
10112
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
10113
|
+
transform: booleanAttribute
|
|
10114
|
+
});
|
|
10115
|
+
invalid = input(false, {
|
|
10116
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
10117
|
+
transform: booleanAttribute
|
|
10118
|
+
});
|
|
10119
|
+
touch = output();
|
|
10120
|
+
open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
10121
|
+
popupId = nextId("hx-time-picker-popup");
|
|
10122
|
+
positions = [{
|
|
10123
|
+
originX: "start",
|
|
10124
|
+
originY: "bottom",
|
|
10125
|
+
overlayX: "start",
|
|
10126
|
+
overlayY: "top",
|
|
10127
|
+
offsetY: 2
|
|
10128
|
+
}, {
|
|
10129
|
+
originX: "start",
|
|
10130
|
+
originY: "top",
|
|
10131
|
+
overlayX: "start",
|
|
10132
|
+
overlayY: "bottom",
|
|
10133
|
+
offsetY: -2
|
|
10134
|
+
}];
|
|
10135
|
+
field = viewChild("field", ...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
|
|
10136
|
+
timeRow = viewChild(HxTimeRow, ...ngDevMode ? [{ debugName: "timeRow" }] : /* istanbul ignore next */ []);
|
|
10137
|
+
#typed = signal(null, ...ngDevMode ? [{ debugName: "#typed" }] : /* istanbul ignore next */ []);
|
|
10138
|
+
#cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "#cvaDisabled" }] : /* istanbul ignore next */ []);
|
|
10139
|
+
isDisabled = computed(() => this.disabled() || this.#cvaDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
10140
|
+
hour12 = computed(() => this.hourFormat() === "12", ...ngDevMode ? [{ debugName: "hour12" }] : /* istanbul ignore next */ []);
|
|
10141
|
+
#format = computed(() => {
|
|
10142
|
+
const custom = this.dateFormat();
|
|
10143
|
+
if (custom) return new Intl.DateTimeFormat(this.locale(), custom);
|
|
10144
|
+
const options = {
|
|
10145
|
+
hour: "2-digit",
|
|
10146
|
+
hourCycle: this.hour12() ? "h12" : "h23"
|
|
10147
|
+
};
|
|
10148
|
+
if (this.showMinutes()) options.minute = "2-digit";
|
|
10149
|
+
if (this.showMinutes() && this.showSeconds()) options.second = "2-digit";
|
|
10150
|
+
return new Intl.DateTimeFormat(this.locale(), options);
|
|
10151
|
+
}, ...ngDevMode ? [{ debugName: "#format" }] : /* istanbul ignore next */ []);
|
|
10152
|
+
time = computed(() => {
|
|
10153
|
+
const value = this.value();
|
|
10154
|
+
const date = isValidDate(value) ? value : null;
|
|
10155
|
+
const minutes = this.showMinutes();
|
|
10156
|
+
return {
|
|
10157
|
+
hours: date?.getHours() ?? 0,
|
|
10158
|
+
minutes: minutes ? date?.getMinutes() ?? 0 : 0,
|
|
10159
|
+
seconds: minutes ? date?.getSeconds() ?? 0 : 0
|
|
10160
|
+
};
|
|
10161
|
+
}, ...ngDevMode ? [{ debugName: "time" }] : /* istanbul ignore next */ []);
|
|
10162
|
+
text = computed(() => {
|
|
10163
|
+
const typed = this.#typed();
|
|
10164
|
+
if (typed !== null) return typed;
|
|
10165
|
+
const value = this.value();
|
|
10166
|
+
return isValidDate(value) ? this.#format().format(value) : "";
|
|
10167
|
+
}, ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
10168
|
+
#onChange = () => {};
|
|
10169
|
+
#onTouched = () => {};
|
|
10170
|
+
writeValue(value) {
|
|
10171
|
+
this.#typed.set(null);
|
|
10172
|
+
this.value.set(value ?? null);
|
|
10173
|
+
}
|
|
10174
|
+
registerOnChange(fn) {
|
|
10175
|
+
this.#onChange = fn;
|
|
10176
|
+
}
|
|
10177
|
+
registerOnTouched(fn) {
|
|
10178
|
+
this.#onTouched = fn;
|
|
10179
|
+
}
|
|
10180
|
+
setDisabledState(disabled) {
|
|
10181
|
+
this.#cvaDisabled.set(disabled);
|
|
10182
|
+
}
|
|
10183
|
+
focus() {
|
|
10184
|
+
const field = this.field();
|
|
10185
|
+
if (field) field.nativeElement.focus();
|
|
10186
|
+
else this.#focusRow();
|
|
10187
|
+
}
|
|
10188
|
+
#clamp(date) {
|
|
10189
|
+
const onDay = (limit) => isValidDate(limit) ? withTime(date, limit.getHours(), limit.getMinutes(), limit.getSeconds()) : null;
|
|
10190
|
+
return clampTime(date, onDay(this.minTime()), onDay(this.maxTime()));
|
|
10191
|
+
}
|
|
10192
|
+
#outsideRange(date) {
|
|
10193
|
+
return this.#clamp(date).getTime() !== date.getTime();
|
|
10194
|
+
}
|
|
10195
|
+
setTime(time) {
|
|
10196
|
+
if (this.isDisabled()) return;
|
|
10197
|
+
this.#typed.set(null);
|
|
10198
|
+
this.#commit(this.#clamp(withTime(/* @__PURE__ */ new Date(), time.hours, time.minutes, time.seconds)));
|
|
10199
|
+
}
|
|
10200
|
+
#commit(next) {
|
|
10201
|
+
this.value.set(next);
|
|
10202
|
+
this.#onChange(next);
|
|
10203
|
+
}
|
|
10204
|
+
#focusRow() {
|
|
10205
|
+
afterNextRender(() => this.timeRow()?.focus(), { injector: this.#injector });
|
|
10206
|
+
}
|
|
10207
|
+
show() {
|
|
10208
|
+
if (this.isDisabled() || this.inline() || this.open()) return;
|
|
10209
|
+
this.open.set(true);
|
|
10210
|
+
}
|
|
10211
|
+
toggle() {
|
|
10212
|
+
if (this.open()) this.close(true);
|
|
10213
|
+
else this.show();
|
|
10214
|
+
}
|
|
10215
|
+
close(refocus = false) {
|
|
10216
|
+
if (!this.open()) return;
|
|
10217
|
+
this.open.set(false);
|
|
10218
|
+
if (refocus) this.field()?.nativeElement.focus();
|
|
10219
|
+
}
|
|
10220
|
+
onAttach() {
|
|
10221
|
+
this.#focusRow();
|
|
10222
|
+
}
|
|
10223
|
+
onOverlayKeydown(event) {
|
|
10224
|
+
if (event.key === "Escape") {
|
|
10225
|
+
event.preventDefault();
|
|
10226
|
+
this.close(true);
|
|
10227
|
+
}
|
|
10228
|
+
}
|
|
10229
|
+
onOutsideClick(event) {
|
|
10230
|
+
if (!this.#host.nativeElement.contains(event.target)) this.close();
|
|
10231
|
+
}
|
|
10232
|
+
onFieldKeydown(event) {
|
|
10233
|
+
if (event.key === "ArrowDown" || event.altKey && event.key === "ArrowUp") {
|
|
10234
|
+
event.preventDefault();
|
|
10235
|
+
this.show();
|
|
10236
|
+
} else if (event.key === "Enter") this.commitTyping();
|
|
10237
|
+
}
|
|
10238
|
+
onTyping(event) {
|
|
10239
|
+
this.#typed.set(event.target.value);
|
|
10240
|
+
}
|
|
10241
|
+
commitTyping() {
|
|
10242
|
+
const typed = this.#typed();
|
|
10243
|
+
if (typed === null) return;
|
|
10244
|
+
this.#typed.set(null);
|
|
10245
|
+
const text = typed.trim();
|
|
10246
|
+
if (text === "") this.#commit(null);
|
|
10247
|
+
else {
|
|
10248
|
+
const parsed = parseDateTimeText(text, {
|
|
10249
|
+
locale: this.locale(),
|
|
10250
|
+
showMinutes: this.showMinutes(),
|
|
10251
|
+
timeOnly: true,
|
|
10252
|
+
fallbackDay: /* @__PURE__ */ new Date()
|
|
10253
|
+
});
|
|
10254
|
+
if (parsed && !this.#outsideRange(parsed)) this.#commit(parsed);
|
|
10255
|
+
}
|
|
10256
|
+
const field = this.field();
|
|
10257
|
+
if (field) field.nativeElement.value = this.text();
|
|
10258
|
+
}
|
|
10259
|
+
selectNow() {
|
|
10260
|
+
const now = /* @__PURE__ */ new Date();
|
|
10261
|
+
this.setTime({
|
|
10262
|
+
hours: now.getHours(),
|
|
10263
|
+
minutes: this.showMinutes() ? now.getMinutes() : 0,
|
|
10264
|
+
seconds: this.showMinutes() ? now.getSeconds() : 0
|
|
10265
|
+
});
|
|
10266
|
+
this.close(true);
|
|
10267
|
+
}
|
|
10268
|
+
clear() {
|
|
10269
|
+
this.#typed.set(null);
|
|
10270
|
+
this.#commit(null);
|
|
10271
|
+
this.close(true);
|
|
10272
|
+
}
|
|
10273
|
+
#leave() {
|
|
10274
|
+
this.close();
|
|
10275
|
+
this.commitTyping();
|
|
10276
|
+
this.#onTouched();
|
|
10277
|
+
this.touch.emit();
|
|
10278
|
+
}
|
|
10279
|
+
onHostFocusOut(event) {
|
|
10280
|
+
if (this.inline()) return;
|
|
10281
|
+
const next = event.relatedTarget;
|
|
10282
|
+
if (next?.closest(".hx-time-picker-popup") || this.#host.nativeElement.contains(next)) return;
|
|
10283
|
+
if (this.open() && !next) return;
|
|
10284
|
+
this.#leave();
|
|
10285
|
+
}
|
|
10286
|
+
onInlineFocusOut(event) {
|
|
10287
|
+
if (!this.inline() || this.#host.nativeElement.contains(event.relatedTarget)) return;
|
|
10288
|
+
this.#onTouched();
|
|
10289
|
+
this.touch.emit();
|
|
10290
|
+
}
|
|
10291
|
+
onPopupFocusOut(event) {
|
|
10292
|
+
const next = event.relatedTarget;
|
|
10293
|
+
if (!next || next.closest(".hx-time-picker-popup") || this.#host.nativeElement.contains(next)) return;
|
|
10294
|
+
this.#leave();
|
|
10295
|
+
}
|
|
10296
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
10297
|
+
minVersion: "12.0.0",
|
|
10298
|
+
version: "22.2.1",
|
|
10299
|
+
ngImport: i0,
|
|
10300
|
+
type: HxTimePicker,
|
|
10301
|
+
deps: [],
|
|
10302
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
10303
|
+
});
|
|
10304
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
10305
|
+
minVersion: "17.0.0",
|
|
10306
|
+
version: "22.2.1",
|
|
10307
|
+
type: HxTimePicker,
|
|
10308
|
+
isStandalone: true,
|
|
10309
|
+
selector: "hx-time-picker",
|
|
10310
|
+
inputs: {
|
|
10311
|
+
placeholder: {
|
|
10312
|
+
classPropertyName: "placeholder",
|
|
10313
|
+
publicName: "placeholder",
|
|
10314
|
+
isSignal: true,
|
|
10315
|
+
isRequired: false,
|
|
10316
|
+
transformFunction: null
|
|
10317
|
+
},
|
|
10318
|
+
showIcon: {
|
|
10319
|
+
classPropertyName: "showIcon",
|
|
10320
|
+
publicName: "showIcon",
|
|
10321
|
+
isSignal: true,
|
|
10322
|
+
isRequired: false,
|
|
10323
|
+
transformFunction: null
|
|
10324
|
+
},
|
|
10325
|
+
showButtonBar: {
|
|
10326
|
+
classPropertyName: "showButtonBar",
|
|
10327
|
+
publicName: "showButtonBar",
|
|
10328
|
+
isSignal: true,
|
|
10329
|
+
isRequired: false,
|
|
10330
|
+
transformFunction: null
|
|
10331
|
+
},
|
|
10332
|
+
dateFormat: {
|
|
10333
|
+
classPropertyName: "dateFormat",
|
|
10334
|
+
publicName: "dateFormat",
|
|
10335
|
+
isSignal: true,
|
|
10336
|
+
isRequired: false,
|
|
10337
|
+
transformFunction: null
|
|
10338
|
+
},
|
|
10339
|
+
nowLabel: {
|
|
10340
|
+
classPropertyName: "nowLabel",
|
|
10341
|
+
publicName: "nowLabel",
|
|
10342
|
+
isSignal: true,
|
|
10343
|
+
isRequired: false,
|
|
10344
|
+
transformFunction: null
|
|
10345
|
+
},
|
|
10346
|
+
clearLabel: {
|
|
10347
|
+
classPropertyName: "clearLabel",
|
|
10348
|
+
publicName: "clearLabel",
|
|
10349
|
+
isSignal: true,
|
|
10350
|
+
isRequired: false,
|
|
10351
|
+
transformFunction: null
|
|
10352
|
+
},
|
|
10353
|
+
chooseLabel: {
|
|
10354
|
+
classPropertyName: "chooseLabel",
|
|
10355
|
+
publicName: "chooseLabel",
|
|
10356
|
+
isSignal: true,
|
|
10357
|
+
isRequired: false,
|
|
10358
|
+
transformFunction: null
|
|
10359
|
+
},
|
|
10360
|
+
timeLabel: {
|
|
10361
|
+
classPropertyName: "timeLabel",
|
|
10362
|
+
publicName: "timeLabel",
|
|
10363
|
+
isSignal: true,
|
|
10364
|
+
isRequired: false,
|
|
10365
|
+
transformFunction: null
|
|
10366
|
+
},
|
|
10367
|
+
hourLabel: {
|
|
10368
|
+
classPropertyName: "hourLabel",
|
|
10369
|
+
publicName: "hourLabel",
|
|
10370
|
+
isSignal: true,
|
|
10371
|
+
isRequired: false,
|
|
10372
|
+
transformFunction: null
|
|
10373
|
+
},
|
|
10374
|
+
minuteLabel: {
|
|
10375
|
+
classPropertyName: "minuteLabel",
|
|
10376
|
+
publicName: "minuteLabel",
|
|
10377
|
+
isSignal: true,
|
|
10378
|
+
isRequired: false,
|
|
10379
|
+
transformFunction: null
|
|
10380
|
+
},
|
|
10381
|
+
secondLabel: {
|
|
10382
|
+
classPropertyName: "secondLabel",
|
|
10383
|
+
publicName: "secondLabel",
|
|
10384
|
+
isSignal: true,
|
|
10385
|
+
isRequired: false,
|
|
10386
|
+
transformFunction: null
|
|
10387
|
+
},
|
|
10388
|
+
periodLabel: {
|
|
10389
|
+
classPropertyName: "periodLabel",
|
|
10390
|
+
publicName: "periodLabel",
|
|
10391
|
+
isSignal: true,
|
|
10392
|
+
isRequired: false,
|
|
10393
|
+
transformFunction: null
|
|
10394
|
+
},
|
|
10395
|
+
inputId: {
|
|
10396
|
+
classPropertyName: "inputId",
|
|
10397
|
+
publicName: "inputId",
|
|
10398
|
+
isSignal: true,
|
|
10399
|
+
isRequired: false,
|
|
10400
|
+
transformFunction: null
|
|
10401
|
+
},
|
|
10402
|
+
hourFormat: {
|
|
10403
|
+
classPropertyName: "hourFormat",
|
|
10404
|
+
publicName: "hourFormat",
|
|
10405
|
+
isSignal: true,
|
|
10406
|
+
isRequired: false,
|
|
10407
|
+
transformFunction: null
|
|
10408
|
+
},
|
|
10409
|
+
showMinutes: {
|
|
10410
|
+
classPropertyName: "showMinutes",
|
|
10411
|
+
publicName: "showMinutes",
|
|
10412
|
+
isSignal: true,
|
|
10413
|
+
isRequired: false,
|
|
10414
|
+
transformFunction: null
|
|
10415
|
+
},
|
|
10416
|
+
showSeconds: {
|
|
10417
|
+
classPropertyName: "showSeconds",
|
|
10418
|
+
publicName: "showSeconds",
|
|
10419
|
+
isSignal: true,
|
|
10420
|
+
isRequired: false,
|
|
10421
|
+
transformFunction: null
|
|
10422
|
+
},
|
|
10423
|
+
stepHour: {
|
|
10424
|
+
classPropertyName: "stepHour",
|
|
10425
|
+
publicName: "stepHour",
|
|
10426
|
+
isSignal: true,
|
|
10427
|
+
isRequired: false,
|
|
10428
|
+
transformFunction: null
|
|
10429
|
+
},
|
|
10430
|
+
stepMinute: {
|
|
10431
|
+
classPropertyName: "stepMinute",
|
|
10432
|
+
publicName: "stepMinute",
|
|
10433
|
+
isSignal: true,
|
|
10434
|
+
isRequired: false,
|
|
10435
|
+
transformFunction: null
|
|
10436
|
+
},
|
|
10437
|
+
stepSecond: {
|
|
10438
|
+
classPropertyName: "stepSecond",
|
|
10439
|
+
publicName: "stepSecond",
|
|
10440
|
+
isSignal: true,
|
|
10441
|
+
isRequired: false,
|
|
10442
|
+
transformFunction: null
|
|
10443
|
+
},
|
|
10444
|
+
minTime: {
|
|
10445
|
+
classPropertyName: "minTime",
|
|
10446
|
+
publicName: "minTime",
|
|
10447
|
+
isSignal: true,
|
|
10448
|
+
isRequired: false,
|
|
10449
|
+
transformFunction: null
|
|
10450
|
+
},
|
|
10451
|
+
maxTime: {
|
|
10452
|
+
classPropertyName: "maxTime",
|
|
10453
|
+
publicName: "maxTime",
|
|
10454
|
+
isSignal: true,
|
|
10455
|
+
isRequired: false,
|
|
10456
|
+
transformFunction: null
|
|
10457
|
+
},
|
|
10458
|
+
inline: {
|
|
10459
|
+
classPropertyName: "inline",
|
|
10460
|
+
publicName: "inline",
|
|
10461
|
+
isSignal: true,
|
|
10462
|
+
isRequired: false,
|
|
10463
|
+
transformFunction: null
|
|
10464
|
+
},
|
|
10465
|
+
locale: {
|
|
10466
|
+
classPropertyName: "locale",
|
|
10467
|
+
publicName: "locale",
|
|
10468
|
+
isSignal: true,
|
|
10469
|
+
isRequired: false,
|
|
10470
|
+
transformFunction: null
|
|
10471
|
+
},
|
|
10472
|
+
ariaLabel: {
|
|
10473
|
+
classPropertyName: "ariaLabel",
|
|
10474
|
+
publicName: "ariaLabel",
|
|
10475
|
+
isSignal: true,
|
|
10476
|
+
isRequired: false,
|
|
10477
|
+
transformFunction: null
|
|
10478
|
+
},
|
|
10479
|
+
ariaLabelledby: {
|
|
10480
|
+
classPropertyName: "ariaLabelledby",
|
|
10481
|
+
publicName: "ariaLabelledby",
|
|
10482
|
+
isSignal: true,
|
|
10483
|
+
isRequired: false,
|
|
10484
|
+
transformFunction: null
|
|
10485
|
+
},
|
|
10486
|
+
value: {
|
|
10487
|
+
classPropertyName: "value",
|
|
10488
|
+
publicName: "value",
|
|
10489
|
+
isSignal: true,
|
|
10490
|
+
isRequired: false,
|
|
10491
|
+
transformFunction: null
|
|
10492
|
+
},
|
|
10493
|
+
disabled: {
|
|
10494
|
+
classPropertyName: "disabled",
|
|
10495
|
+
publicName: "disabled",
|
|
10496
|
+
isSignal: true,
|
|
10497
|
+
isRequired: false,
|
|
10498
|
+
transformFunction: null
|
|
10499
|
+
},
|
|
10500
|
+
invalid: {
|
|
10501
|
+
classPropertyName: "invalid",
|
|
10502
|
+
publicName: "invalid",
|
|
10503
|
+
isSignal: true,
|
|
10504
|
+
isRequired: false,
|
|
10505
|
+
transformFunction: null
|
|
10506
|
+
}
|
|
10507
|
+
},
|
|
10508
|
+
outputs: {
|
|
10509
|
+
value: "valueChange",
|
|
10510
|
+
touch: "touch"
|
|
10511
|
+
},
|
|
10512
|
+
host: {
|
|
10513
|
+
listeners: { "focusout": "onHostFocusOut($event)" },
|
|
10514
|
+
properties: {
|
|
10515
|
+
"class.hx-time-picker-inline": "inline()",
|
|
10516
|
+
"class.hx-time-picker-disabled": "isDisabled()",
|
|
10517
|
+
"class.hx-time-picker-invalid": "invalid()",
|
|
10518
|
+
"class.hx-time-picker-open": "open()",
|
|
10519
|
+
"class.hx-time-picker-has-icon": "showIcon() && !inline()",
|
|
10520
|
+
"class.hx-filled": "!inline() && text() !== \"\""
|
|
10521
|
+
},
|
|
10522
|
+
classAttribute: "hx-time-picker"
|
|
10523
|
+
},
|
|
10524
|
+
providers: [{
|
|
10525
|
+
provide: NG_VALUE_ACCESSOR,
|
|
10526
|
+
useExisting: forwardRef(() => HxTimePicker),
|
|
10527
|
+
multi: true
|
|
10528
|
+
}],
|
|
10529
|
+
viewQueries: [{
|
|
10530
|
+
propertyName: "field",
|
|
10531
|
+
first: true,
|
|
10532
|
+
predicate: ["field"],
|
|
10533
|
+
descendants: true,
|
|
10534
|
+
isSignal: true
|
|
10535
|
+
}, {
|
|
10536
|
+
propertyName: "timeRow",
|
|
10537
|
+
first: true,
|
|
10538
|
+
predicate: HxTimeRow,
|
|
10539
|
+
descendants: true,
|
|
10540
|
+
isSignal: true
|
|
10541
|
+
}],
|
|
10542
|
+
ngImport: i0,
|
|
10543
|
+
template: "@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"row\" />\n} @else {\n <div class=\"hx-time-picker-field\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #field\n type=\"text\"\n class=\"hx-time-picker-input\"\n autocomplete=\"off\"\n aria-haspopup=\"dialog\"\n [attr.id]=\"inputId() ?? null\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"text()\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? popupId : null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n (input)=\"onTyping($event)\"\n (change)=\"commitTyping()\"\n (click)=\"show()\"\n (keydown)=\"onFieldKeydown($event)\"\n />\n @if (showIcon()) {\n <button\n type=\"button\"\n class=\"hx-time-picker-trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"chooseLabel()\"\n [attr.aria-expanded]=\"open()\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"hx-time-picker-trigger-icon\" aria-hidden=\"true\"></span>\n </button>\n }\n </div>\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayPanelClass=\"hx-time-picker-overlay\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPush]=\"true\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n (attach)=\"onAttach()\"\n (detach)=\"open.set(false)\"\n >\n <div\n class=\"hx-time-picker-popup\"\n role=\"dialog\"\n aria-modal=\"false\"\n [id]=\"popupId\"\n [attr.aria-label]=\"ariaLabel() ?? chooseLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (focusout)=\"onPopupFocusOut($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" />\n @if (showButtonBar()) {\n <div class=\"hx-time-picker-buttonbar\">\n <button type=\"button\" class=\"hx-time-picker-button\" (click)=\"selectNow()\">{{ nowLabel() }}</button>\n <button type=\"button\" class=\"hx-time-picker-button\" (click)=\"clear()\">{{ clearLabel() }}</button>\n </div>\n }\n </div>\n </ng-template>\n}\n\n<ng-template #row>\n <div\n class=\"hx-time-picker-panel\"\n [attr.role]=\"inline() ? 'group' : null\"\n [attr.aria-label]=\"inline() ? (ariaLabel() ?? timeLabel()) : null\"\n [attr.aria-labelledby]=\"inline() ? (ariaLabelledby() ?? null) : null\"\n (focusout)=\"onInlineFocusOut($event)\"\n >\n <hx-time-row\n [time]=\"time()\"\n [hour12]=\"hour12()\"\n [showMinutes]=\"showMinutes()\"\n [showSeconds]=\"showSeconds()\"\n [stepHour]=\"stepHour()\"\n [stepMinute]=\"stepMinute()\"\n [stepSecond]=\"stepSecond()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n [timeLabel]=\"timeLabel()\"\n [hourLabel]=\"hourLabel()\"\n [minuteLabel]=\"minuteLabel()\"\n [secondLabel]=\"secondLabel()\"\n [periodLabel]=\"periodLabel()\"\n (timeChange)=\"setTime($event)\"\n />\n </div>\n</ng-template>\n",
|
|
10544
|
+
dependencies: [
|
|
10545
|
+
{
|
|
10546
|
+
kind: "directive",
|
|
10547
|
+
type: CdkConnectedOverlay,
|
|
10548
|
+
selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
|
|
10549
|
+
inputs: [
|
|
10550
|
+
"cdkConnectedOverlayOrigin",
|
|
10551
|
+
"cdkConnectedOverlayPositions",
|
|
10552
|
+
"cdkConnectedOverlayPositionStrategy",
|
|
10553
|
+
"cdkConnectedOverlayOffsetX",
|
|
10554
|
+
"cdkConnectedOverlayOffsetY",
|
|
10555
|
+
"cdkConnectedOverlayWidth",
|
|
10556
|
+
"cdkConnectedOverlayHeight",
|
|
10557
|
+
"cdkConnectedOverlayMinWidth",
|
|
10558
|
+
"cdkConnectedOverlayMinHeight",
|
|
10559
|
+
"cdkConnectedOverlayBackdropClass",
|
|
10560
|
+
"cdkConnectedOverlayPanelClass",
|
|
10561
|
+
"cdkConnectedOverlayViewportMargin",
|
|
10562
|
+
"cdkConnectedOverlayScrollStrategy",
|
|
10563
|
+
"cdkConnectedOverlayOpen",
|
|
10564
|
+
"cdkConnectedOverlayDisableClose",
|
|
10565
|
+
"cdkConnectedOverlayTransformOriginOn",
|
|
10566
|
+
"cdkConnectedOverlayHasBackdrop",
|
|
10567
|
+
"cdkConnectedOverlayLockPosition",
|
|
10568
|
+
"cdkConnectedOverlayFlexibleDimensions",
|
|
10569
|
+
"cdkConnectedOverlayGrowAfterOpen",
|
|
10570
|
+
"cdkConnectedOverlayPush",
|
|
10571
|
+
"cdkConnectedOverlayDisposeOnNavigation",
|
|
10572
|
+
"cdkConnectedOverlayUsePopover",
|
|
10573
|
+
"cdkConnectedOverlayMatchWidth",
|
|
10574
|
+
"cdkConnectedOverlay"
|
|
10575
|
+
],
|
|
10576
|
+
outputs: [
|
|
10577
|
+
"backdropClick",
|
|
10578
|
+
"positionChange",
|
|
10579
|
+
"attach",
|
|
10580
|
+
"detach",
|
|
10581
|
+
"overlayKeydown",
|
|
10582
|
+
"overlayOutsideClick"
|
|
10583
|
+
],
|
|
10584
|
+
exportAs: ["cdkConnectedOverlay"]
|
|
10585
|
+
},
|
|
10586
|
+
{
|
|
10587
|
+
kind: "directive",
|
|
10588
|
+
type: CdkOverlayOrigin,
|
|
10589
|
+
selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]",
|
|
10590
|
+
exportAs: ["cdkOverlayOrigin"]
|
|
10591
|
+
},
|
|
10592
|
+
{
|
|
10593
|
+
kind: "directive",
|
|
10594
|
+
type: NgTemplateOutlet,
|
|
10595
|
+
selector: "[ngTemplateOutlet]",
|
|
10596
|
+
inputs: [
|
|
10597
|
+
"ngTemplateOutletContext",
|
|
10598
|
+
"ngTemplateOutlet",
|
|
10599
|
+
"ngTemplateOutletInjector"
|
|
10600
|
+
]
|
|
10601
|
+
},
|
|
10602
|
+
{
|
|
10603
|
+
kind: "component",
|
|
10604
|
+
type: HxTimeRow,
|
|
10605
|
+
selector: "hx-time-row",
|
|
10606
|
+
inputs: [
|
|
10607
|
+
"time",
|
|
10608
|
+
"hour12",
|
|
10609
|
+
"showMinutes",
|
|
10610
|
+
"showSeconds",
|
|
10611
|
+
"stepHour",
|
|
10612
|
+
"stepMinute",
|
|
10613
|
+
"stepSecond",
|
|
10614
|
+
"locale",
|
|
10615
|
+
"disabled",
|
|
10616
|
+
"timeLabel",
|
|
10617
|
+
"hourLabel",
|
|
10618
|
+
"minuteLabel",
|
|
10619
|
+
"secondLabel",
|
|
10620
|
+
"periodLabel"
|
|
10621
|
+
],
|
|
10622
|
+
outputs: ["timeChange"]
|
|
10623
|
+
}
|
|
10624
|
+
],
|
|
10625
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
10626
|
+
});
|
|
10627
|
+
};
|
|
10628
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
10629
|
+
minVersion: "12.0.0",
|
|
10630
|
+
version: "22.2.1",
|
|
10631
|
+
ngImport: i0,
|
|
10632
|
+
type: HxTimePicker,
|
|
10633
|
+
decorators: [{
|
|
10634
|
+
type: Component,
|
|
10635
|
+
args: [{
|
|
10636
|
+
selector: "hx-time-picker",
|
|
10637
|
+
imports: [
|
|
10638
|
+
CdkConnectedOverlay,
|
|
10639
|
+
CdkOverlayOrigin,
|
|
10640
|
+
NgTemplateOutlet,
|
|
10641
|
+
HxTimeRow
|
|
10642
|
+
],
|
|
10643
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10644
|
+
providers: [{
|
|
10645
|
+
provide: NG_VALUE_ACCESSOR,
|
|
10646
|
+
useExisting: forwardRef(() => HxTimePicker),
|
|
10647
|
+
multi: true
|
|
10648
|
+
}],
|
|
10649
|
+
host: {
|
|
10650
|
+
class: "hx-time-picker",
|
|
10651
|
+
"[class.hx-time-picker-inline]": "inline()",
|
|
10652
|
+
"[class.hx-time-picker-disabled]": "isDisabled()",
|
|
10653
|
+
"[class.hx-time-picker-invalid]": "invalid()",
|
|
10654
|
+
"[class.hx-time-picker-open]": "open()",
|
|
10655
|
+
"[class.hx-time-picker-has-icon]": "showIcon() && !inline()",
|
|
10656
|
+
"[class.hx-filled]": "!inline() && text() !== \"\"",
|
|
10657
|
+
"(focusout)": "onHostFocusOut($event)"
|
|
10658
|
+
},
|
|
10659
|
+
template: "@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"row\" />\n} @else {\n <div class=\"hx-time-picker-field\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #field\n type=\"text\"\n class=\"hx-time-picker-input\"\n autocomplete=\"off\"\n aria-haspopup=\"dialog\"\n [attr.id]=\"inputId() ?? null\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"text()\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? popupId : null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n (input)=\"onTyping($event)\"\n (change)=\"commitTyping()\"\n (click)=\"show()\"\n (keydown)=\"onFieldKeydown($event)\"\n />\n @if (showIcon()) {\n <button\n type=\"button\"\n class=\"hx-time-picker-trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"chooseLabel()\"\n [attr.aria-expanded]=\"open()\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"hx-time-picker-trigger-icon\" aria-hidden=\"true\"></span>\n </button>\n }\n </div>\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayPanelClass=\"hx-time-picker-overlay\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPush]=\"true\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n (attach)=\"onAttach()\"\n (detach)=\"open.set(false)\"\n >\n <div\n class=\"hx-time-picker-popup\"\n role=\"dialog\"\n aria-modal=\"false\"\n [id]=\"popupId\"\n [attr.aria-label]=\"ariaLabel() ?? chooseLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (focusout)=\"onPopupFocusOut($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"row\" />\n @if (showButtonBar()) {\n <div class=\"hx-time-picker-buttonbar\">\n <button type=\"button\" class=\"hx-time-picker-button\" (click)=\"selectNow()\">{{ nowLabel() }}</button>\n <button type=\"button\" class=\"hx-time-picker-button\" (click)=\"clear()\">{{ clearLabel() }}</button>\n </div>\n }\n </div>\n </ng-template>\n}\n\n<ng-template #row>\n <div\n class=\"hx-time-picker-panel\"\n [attr.role]=\"inline() ? 'group' : null\"\n [attr.aria-label]=\"inline() ? (ariaLabel() ?? timeLabel()) : null\"\n [attr.aria-labelledby]=\"inline() ? (ariaLabelledby() ?? null) : null\"\n (focusout)=\"onInlineFocusOut($event)\"\n >\n <hx-time-row\n [time]=\"time()\"\n [hour12]=\"hour12()\"\n [showMinutes]=\"showMinutes()\"\n [showSeconds]=\"showSeconds()\"\n [stepHour]=\"stepHour()\"\n [stepMinute]=\"stepMinute()\"\n [stepSecond]=\"stepSecond()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n [timeLabel]=\"timeLabel()\"\n [hourLabel]=\"hourLabel()\"\n [minuteLabel]=\"minuteLabel()\"\n [secondLabel]=\"secondLabel()\"\n [periodLabel]=\"periodLabel()\"\n (timeChange)=\"setTime($event)\"\n />\n </div>\n</ng-template>\n"
|
|
10660
|
+
}]
|
|
10661
|
+
}],
|
|
10662
|
+
propDecorators: {
|
|
10663
|
+
placeholder: [{
|
|
10664
|
+
type: i0.Input,
|
|
10665
|
+
args: [{
|
|
10666
|
+
isSignal: true,
|
|
10667
|
+
alias: "placeholder",
|
|
10668
|
+
required: false
|
|
10669
|
+
}]
|
|
10670
|
+
}],
|
|
10671
|
+
showIcon: [{
|
|
10672
|
+
type: i0.Input,
|
|
10673
|
+
args: [{
|
|
10674
|
+
isSignal: true,
|
|
10675
|
+
alias: "showIcon",
|
|
10676
|
+
required: false
|
|
10677
|
+
}]
|
|
10678
|
+
}],
|
|
10679
|
+
showButtonBar: [{
|
|
10680
|
+
type: i0.Input,
|
|
10681
|
+
args: [{
|
|
10682
|
+
isSignal: true,
|
|
10683
|
+
alias: "showButtonBar",
|
|
10684
|
+
required: false
|
|
10685
|
+
}]
|
|
10686
|
+
}],
|
|
10687
|
+
dateFormat: [{
|
|
10688
|
+
type: i0.Input,
|
|
10689
|
+
args: [{
|
|
10690
|
+
isSignal: true,
|
|
10691
|
+
alias: "dateFormat",
|
|
10692
|
+
required: false
|
|
10693
|
+
}]
|
|
10694
|
+
}],
|
|
10695
|
+
nowLabel: [{
|
|
10696
|
+
type: i0.Input,
|
|
10697
|
+
args: [{
|
|
10698
|
+
isSignal: true,
|
|
10699
|
+
alias: "nowLabel",
|
|
10700
|
+
required: false
|
|
10701
|
+
}]
|
|
10702
|
+
}],
|
|
10703
|
+
clearLabel: [{
|
|
10704
|
+
type: i0.Input,
|
|
10705
|
+
args: [{
|
|
10706
|
+
isSignal: true,
|
|
10707
|
+
alias: "clearLabel",
|
|
10708
|
+
required: false
|
|
10709
|
+
}]
|
|
10710
|
+
}],
|
|
10711
|
+
chooseLabel: [{
|
|
10712
|
+
type: i0.Input,
|
|
10713
|
+
args: [{
|
|
10714
|
+
isSignal: true,
|
|
10715
|
+
alias: "chooseLabel",
|
|
10716
|
+
required: false
|
|
10717
|
+
}]
|
|
10718
|
+
}],
|
|
10719
|
+
timeLabel: [{
|
|
10720
|
+
type: i0.Input,
|
|
10721
|
+
args: [{
|
|
10722
|
+
isSignal: true,
|
|
10723
|
+
alias: "timeLabel",
|
|
10724
|
+
required: false
|
|
10725
|
+
}]
|
|
10726
|
+
}],
|
|
10727
|
+
hourLabel: [{
|
|
10728
|
+
type: i0.Input,
|
|
10729
|
+
args: [{
|
|
10730
|
+
isSignal: true,
|
|
10731
|
+
alias: "hourLabel",
|
|
10732
|
+
required: false
|
|
10733
|
+
}]
|
|
10734
|
+
}],
|
|
10735
|
+
minuteLabel: [{
|
|
10736
|
+
type: i0.Input,
|
|
10737
|
+
args: [{
|
|
10738
|
+
isSignal: true,
|
|
10739
|
+
alias: "minuteLabel",
|
|
10740
|
+
required: false
|
|
10741
|
+
}]
|
|
10742
|
+
}],
|
|
10743
|
+
secondLabel: [{
|
|
10744
|
+
type: i0.Input,
|
|
10745
|
+
args: [{
|
|
10746
|
+
isSignal: true,
|
|
10747
|
+
alias: "secondLabel",
|
|
10748
|
+
required: false
|
|
10749
|
+
}]
|
|
10750
|
+
}],
|
|
10751
|
+
periodLabel: [{
|
|
10752
|
+
type: i0.Input,
|
|
10753
|
+
args: [{
|
|
10754
|
+
isSignal: true,
|
|
10755
|
+
alias: "periodLabel",
|
|
10756
|
+
required: false
|
|
10757
|
+
}]
|
|
10758
|
+
}],
|
|
10759
|
+
inputId: [{
|
|
10760
|
+
type: i0.Input,
|
|
10761
|
+
args: [{
|
|
10762
|
+
isSignal: true,
|
|
10763
|
+
alias: "inputId",
|
|
10764
|
+
required: false
|
|
10765
|
+
}]
|
|
10766
|
+
}],
|
|
10767
|
+
hourFormat: [{
|
|
10768
|
+
type: i0.Input,
|
|
10769
|
+
args: [{
|
|
10770
|
+
isSignal: true,
|
|
10771
|
+
alias: "hourFormat",
|
|
10772
|
+
required: false
|
|
10773
|
+
}]
|
|
10774
|
+
}],
|
|
10775
|
+
showMinutes: [{
|
|
10776
|
+
type: i0.Input,
|
|
10777
|
+
args: [{
|
|
10778
|
+
isSignal: true,
|
|
10779
|
+
alias: "showMinutes",
|
|
10780
|
+
required: false
|
|
10781
|
+
}]
|
|
10782
|
+
}],
|
|
10783
|
+
showSeconds: [{
|
|
10784
|
+
type: i0.Input,
|
|
10785
|
+
args: [{
|
|
10786
|
+
isSignal: true,
|
|
10787
|
+
alias: "showSeconds",
|
|
10788
|
+
required: false
|
|
10789
|
+
}]
|
|
10790
|
+
}],
|
|
10791
|
+
stepHour: [{
|
|
10792
|
+
type: i0.Input,
|
|
10793
|
+
args: [{
|
|
10794
|
+
isSignal: true,
|
|
10795
|
+
alias: "stepHour",
|
|
10796
|
+
required: false
|
|
10797
|
+
}]
|
|
10798
|
+
}],
|
|
10799
|
+
stepMinute: [{
|
|
10800
|
+
type: i0.Input,
|
|
10801
|
+
args: [{
|
|
10802
|
+
isSignal: true,
|
|
10803
|
+
alias: "stepMinute",
|
|
10804
|
+
required: false
|
|
10805
|
+
}]
|
|
10806
|
+
}],
|
|
10807
|
+
stepSecond: [{
|
|
10808
|
+
type: i0.Input,
|
|
10809
|
+
args: [{
|
|
10810
|
+
isSignal: true,
|
|
10811
|
+
alias: "stepSecond",
|
|
10812
|
+
required: false
|
|
10813
|
+
}]
|
|
10814
|
+
}],
|
|
10815
|
+
minTime: [{
|
|
10816
|
+
type: i0.Input,
|
|
10817
|
+
args: [{
|
|
10818
|
+
isSignal: true,
|
|
10819
|
+
alias: "minTime",
|
|
10820
|
+
required: false
|
|
10821
|
+
}]
|
|
10822
|
+
}],
|
|
10823
|
+
maxTime: [{
|
|
10824
|
+
type: i0.Input,
|
|
10825
|
+
args: [{
|
|
10826
|
+
isSignal: true,
|
|
10827
|
+
alias: "maxTime",
|
|
10828
|
+
required: false
|
|
10829
|
+
}]
|
|
10830
|
+
}],
|
|
10831
|
+
inline: [{
|
|
10832
|
+
type: i0.Input,
|
|
10833
|
+
args: [{
|
|
10834
|
+
isSignal: true,
|
|
10835
|
+
alias: "inline",
|
|
10836
|
+
required: false
|
|
10837
|
+
}]
|
|
10838
|
+
}],
|
|
10839
|
+
locale: [{
|
|
10840
|
+
type: i0.Input,
|
|
10841
|
+
args: [{
|
|
10842
|
+
isSignal: true,
|
|
10843
|
+
alias: "locale",
|
|
10844
|
+
required: false
|
|
10845
|
+
}]
|
|
10846
|
+
}],
|
|
10847
|
+
ariaLabel: [{
|
|
10848
|
+
type: i0.Input,
|
|
10849
|
+
args: [{
|
|
10850
|
+
isSignal: true,
|
|
10851
|
+
alias: "ariaLabel",
|
|
10852
|
+
required: false
|
|
10853
|
+
}]
|
|
10854
|
+
}],
|
|
10855
|
+
ariaLabelledby: [{
|
|
10856
|
+
type: i0.Input,
|
|
10857
|
+
args: [{
|
|
10858
|
+
isSignal: true,
|
|
10859
|
+
alias: "ariaLabelledby",
|
|
10860
|
+
required: false
|
|
10861
|
+
}]
|
|
10862
|
+
}],
|
|
10863
|
+
value: [{
|
|
10864
|
+
type: i0.Input,
|
|
10865
|
+
args: [{
|
|
10866
|
+
isSignal: true,
|
|
10867
|
+
alias: "value",
|
|
10868
|
+
required: false
|
|
10869
|
+
}]
|
|
10870
|
+
}, {
|
|
10871
|
+
type: i0.Output,
|
|
10872
|
+
args: ["valueChange"]
|
|
10873
|
+
}],
|
|
10874
|
+
disabled: [{
|
|
10875
|
+
type: i0.Input,
|
|
10876
|
+
args: [{
|
|
10877
|
+
isSignal: true,
|
|
10878
|
+
alias: "disabled",
|
|
10879
|
+
required: false
|
|
10880
|
+
}]
|
|
10881
|
+
}],
|
|
10882
|
+
invalid: [{
|
|
10883
|
+
type: i0.Input,
|
|
10884
|
+
args: [{
|
|
10885
|
+
isSignal: true,
|
|
10886
|
+
alias: "invalid",
|
|
10887
|
+
required: false
|
|
10888
|
+
}]
|
|
10889
|
+
}],
|
|
10890
|
+
touch: [{
|
|
10891
|
+
type: i0.Output,
|
|
10892
|
+
args: ["touch"]
|
|
10893
|
+
}],
|
|
10894
|
+
field: [{
|
|
10895
|
+
type: i0.ViewChild,
|
|
10896
|
+
args: ["field", { isSignal: true }]
|
|
10897
|
+
}],
|
|
10898
|
+
timeRow: [{
|
|
10899
|
+
type: i0.ViewChild,
|
|
10900
|
+
args: [i0.forwardRef(() => HxTimeRow), { isSignal: true }]
|
|
10901
|
+
}]
|
|
10902
|
+
}
|
|
10903
|
+
});
|
|
10904
|
+
const EMPTY = {
|
|
10905
|
+
from: null,
|
|
10906
|
+
to: null
|
|
10907
|
+
};
|
|
10908
|
+
const earlier = (a, b) => a && b ? a <= b ? a : b : a ?? b;
|
|
10909
|
+
const later = (a, b) => a && b ? a >= b ? a : b : a ?? b;
|
|
10910
|
+
var HxDateTimeRangePicker = class HxDateTimeRangePicker {
|
|
10911
|
+
fromLabel = input("From", ...ngDevMode ? [{ debugName: "fromLabel" }] : /* istanbul ignore next */ []);
|
|
10912
|
+
toLabel = input("To", ...ngDevMode ? [{ debugName: "toLabel" }] : /* istanbul ignore next */ []);
|
|
10913
|
+
separator = input("-", ...ngDevMode ? [{ debugName: "separator" }] : /* istanbul ignore next */ []);
|
|
7561
10914
|
placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
7562
|
-
|
|
7563
|
-
|
|
10915
|
+
clearLabel = input("Clear", ...ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []);
|
|
10916
|
+
cancelLabel = input("Cancel", ...ngDevMode ? [{ debugName: "cancelLabel" }] : /* istanbul ignore next */ []);
|
|
10917
|
+
submitLabel = input("Submit", ...ngDevMode ? [{ debugName: "submitLabel" }] : /* istanbul ignore next */ []);
|
|
10918
|
+
chooseLabel = input("Choose date range", ...ngDevMode ? [{ debugName: "chooseLabel" }] : /* istanbul ignore next */ []);
|
|
10919
|
+
inputId = input(...ngDevMode ? [void 0, { debugName: "inputId" }] : /* istanbul ignore next */ []);
|
|
10920
|
+
showTime = input(true, {
|
|
10921
|
+
...ngDevMode ? { debugName: "showTime" } : /* istanbul ignore next */ {},
|
|
7564
10922
|
transform: booleanAttribute
|
|
7565
10923
|
});
|
|
7566
|
-
|
|
7567
|
-
...ngDevMode ? { debugName: "
|
|
10924
|
+
timeOnly = input(false, {
|
|
10925
|
+
...ngDevMode ? { debugName: "timeOnly" } : /* istanbul ignore next */ {},
|
|
7568
10926
|
transform: booleanAttribute
|
|
7569
10927
|
});
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
year: "numeric"
|
|
7574
|
-
}, ...ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []);
|
|
7575
|
-
todayLabel = input("Today", ...ngDevMode ? [{ debugName: "todayLabel" }] : /* istanbul ignore next */ []);
|
|
7576
|
-
clearLabel = input("Clear", ...ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []);
|
|
7577
|
-
chooseLabel = input("Choose date", ...ngDevMode ? [{ debugName: "chooseLabel" }] : /* istanbul ignore next */ []);
|
|
7578
|
-
inputId = input(...ngDevMode ? [void 0, { debugName: "inputId" }] : /* istanbul ignore next */ []);
|
|
7579
|
-
inline = input(false, {
|
|
7580
|
-
...ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {},
|
|
10928
|
+
hourFormat = input("24", ...ngDevMode ? [{ debugName: "hourFormat" }] : /* istanbul ignore next */ []);
|
|
10929
|
+
showMinutes = input(true, {
|
|
10930
|
+
...ngDevMode ? { debugName: "showMinutes" } : /* istanbul ignore next */ {},
|
|
7581
10931
|
transform: booleanAttribute
|
|
7582
10932
|
});
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
10933
|
+
showSeconds = input(false, {
|
|
10934
|
+
...ngDevMode ? { debugName: "showSeconds" } : /* istanbul ignore next */ {},
|
|
10935
|
+
transform: booleanAttribute
|
|
10936
|
+
});
|
|
10937
|
+
stepHour = input(1, {
|
|
10938
|
+
...ngDevMode ? { debugName: "stepHour" } : /* istanbul ignore next */ {},
|
|
10939
|
+
transform: numberAttribute
|
|
10940
|
+
});
|
|
10941
|
+
stepMinute = input(1, {
|
|
10942
|
+
...ngDevMode ? { debugName: "stepMinute" } : /* istanbul ignore next */ {},
|
|
10943
|
+
transform: numberAttribute
|
|
10944
|
+
});
|
|
10945
|
+
stepSecond = input(1, {
|
|
10946
|
+
...ngDevMode ? { debugName: "stepSecond" } : /* istanbul ignore next */ {},
|
|
10947
|
+
transform: numberAttribute
|
|
10948
|
+
});
|
|
10949
|
+
dateFormat = input(...ngDevMode ? [void 0, { debugName: "dateFormat" }] : /* istanbul ignore next */ []);
|
|
10950
|
+
locale = input(...ngDevMode ? [void 0, { debugName: "locale" }] : /* istanbul ignore next */ []);
|
|
7587
10951
|
firstDayOfWeek = input(0, {
|
|
7588
10952
|
...ngDevMode ? { debugName: "firstDayOfWeek" } : /* istanbul ignore next */ {},
|
|
7589
10953
|
transform: numberAttribute
|
|
7590
10954
|
});
|
|
7591
|
-
|
|
10955
|
+
minDate = input(null, ...ngDevMode ? [{ debugName: "minDate" }] : /* istanbul ignore next */ []);
|
|
10956
|
+
maxDate = input(null, ...ngDevMode ? [{ debugName: "maxDate" }] : /* istanbul ignore next */ []);
|
|
10957
|
+
disabledDates = input([], ...ngDevMode ? [{ debugName: "disabledDates" }] : /* istanbul ignore next */ []);
|
|
10958
|
+
showButtonBar = input(false, {
|
|
10959
|
+
...ngDevMode ? { debugName: "showButtonBar" } : /* istanbul ignore next */ {},
|
|
10960
|
+
transform: booleanAttribute
|
|
10961
|
+
});
|
|
7592
10962
|
ariaLabel = input(...ngDevMode ? [void 0, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
7593
10963
|
ariaLabelledby = input(...ngDevMode ? [void 0, { debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []);
|
|
7594
|
-
value = model(
|
|
10964
|
+
value = model(EMPTY, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
7595
10965
|
disabled = input(false, {
|
|
7596
10966
|
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
7597
10967
|
transform: booleanAttribute
|
|
@@ -7601,9 +10971,11 @@ var HxDatePicker = class HxDatePicker {
|
|
|
7601
10971
|
transform: booleanAttribute
|
|
7602
10972
|
});
|
|
7603
10973
|
touch = output();
|
|
10974
|
+
#host = inject(ElementRef);
|
|
10975
|
+
#injector = inject(Injector);
|
|
7604
10976
|
open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
7605
|
-
|
|
7606
|
-
popupId = nextId("hx-date-picker-popup");
|
|
10977
|
+
draft = signal(EMPTY, ...ngDevMode ? [{ debugName: "draft" }] : /* istanbul ignore next */ []);
|
|
10978
|
+
popupId = nextId("hx-date-time-range-picker-popup");
|
|
7607
10979
|
positions = [{
|
|
7608
10980
|
originX: "start",
|
|
7609
10981
|
originY: "bottom",
|
|
@@ -7618,66 +10990,47 @@ var HxDatePicker = class HxDatePicker {
|
|
|
7618
10990
|
offsetY: -2
|
|
7619
10991
|
}];
|
|
7620
10992
|
field = viewChild("field", ...ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []);
|
|
7621
|
-
|
|
7622
|
-
|
|
10993
|
+
daysPicker = viewChild(HxDatePicker, ...ngDevMode ? [{ debugName: "daysPicker" }] : /* istanbul ignore next */ []);
|
|
10994
|
+
timePicker = viewChild(HxTimePicker, ...ngDevMode ? [{ debugName: "timePicker" }] : /* istanbul ignore next */ []);
|
|
10995
|
+
#lastFrom = null;
|
|
10996
|
+
#lastTo = null;
|
|
7623
10997
|
#cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "#cvaDisabled" }] : /* istanbul ignore next */ []);
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
return isValidDate(value) ? [value] : [];
|
|
7632
|
-
}, ...ngDevMode ? [{ debugName: "selectedDates" }] : /* istanbul ignore next */ []);
|
|
7633
|
-
#formats = computed(() => {
|
|
7634
|
-
const locale = this.locale();
|
|
7635
|
-
return {
|
|
7636
|
-
month: new Intl.DateTimeFormat(locale, { month: "long" }),
|
|
7637
|
-
monthShort: new Intl.DateTimeFormat(locale, { month: "short" }),
|
|
7638
|
-
weekdayShort: new Intl.DateTimeFormat(locale, { weekday: "short" }),
|
|
7639
|
-
weekdayLong: new Intl.DateTimeFormat(locale, { weekday: "long" }),
|
|
7640
|
-
full: new Intl.DateTimeFormat(locale, { dateStyle: "full" })
|
|
10998
|
+
#format = computed(() => {
|
|
10999
|
+
const custom = this.dateFormat();
|
|
11000
|
+
if (custom) return new Intl.DateTimeFormat(this.locale(), custom);
|
|
11001
|
+
const options = this.timeOnly() ? {} : {
|
|
11002
|
+
day: "numeric",
|
|
11003
|
+
month: "numeric",
|
|
11004
|
+
year: "numeric"
|
|
7641
11005
|
};
|
|
7642
|
-
|
|
7643
|
-
|
|
11006
|
+
if (this.showTime() || this.timeOnly()) {
|
|
11007
|
+
options.hour = "numeric";
|
|
11008
|
+
if (this.showMinutes()) options.minute = "2-digit";
|
|
11009
|
+
if (this.showMinutes() && this.showSeconds()) options.second = "2-digit";
|
|
11010
|
+
options.hourCycle = this.hourFormat() === "12" ? "h12" : "h23";
|
|
11011
|
+
}
|
|
11012
|
+
return new Intl.DateTimeFormat(this.locale(), options);
|
|
11013
|
+
}, ...ngDevMode ? [{ debugName: "#format" }] : /* istanbul ignore next */ []);
|
|
7644
11014
|
text = computed(() => {
|
|
7645
|
-
const
|
|
7646
|
-
if (
|
|
7647
|
-
const dates = this.selectedDates();
|
|
11015
|
+
const { from, to } = this.value();
|
|
11016
|
+
if (!from && !to) return "";
|
|
7648
11017
|
const fmt = this.#format();
|
|
7649
|
-
|
|
7650
|
-
return
|
|
11018
|
+
const one = (d) => d ? fmt.format(d).replace(/,\s*/, " ") : "";
|
|
11019
|
+
return `${one(from)} ${this.separator()} ${one(to)}`.trim();
|
|
7651
11020
|
}, ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
return {
|
|
7659
|
-
short: this.#formats().weekdayShort.format(day),
|
|
7660
|
-
long: this.#formats().weekdayLong.format(day)
|
|
7661
|
-
};
|
|
7662
|
-
});
|
|
7663
|
-
}, ...ngDevMode ? [{ debugName: "weekdays" }] : /* istanbul ignore next */ []);
|
|
7664
|
-
weeks = computed(() => monthCells(this.focusedDate().getFullYear(), this.focusedDate().getMonth(), this.firstDayOfWeek()), ...ngDevMode ? [{ debugName: "weeks" }] : /* istanbul ignore next */ []);
|
|
7665
|
-
decade = computed(() => {
|
|
7666
|
-
const start = Math.floor(this.focusedDate().getFullYear() / 12) * 12;
|
|
7667
|
-
return Array.from({ length: 12 }, (_, i) => start + i);
|
|
7668
|
-
}, ...ngDevMode ? [{ debugName: "decade" }] : /* istanbul ignore next */ []);
|
|
7669
|
-
constructor() {
|
|
7670
|
-
effect(() => {
|
|
7671
|
-
const first = this.selectedDates()[0];
|
|
7672
|
-
const shown = untracked(() => this.focusedDate());
|
|
7673
|
-
if (first && (first.getFullYear() !== shown.getFullYear() || first.getMonth() !== shown.getMonth())) this.focusedDate.set(startOfDay(first));
|
|
7674
|
-
});
|
|
7675
|
-
}
|
|
11021
|
+
isDisabled = computed(() => this.disabled() || this.#cvaDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
11022
|
+
fromMax = computed(() => earlier(this.draft().to, this.maxDate()), ...ngDevMode ? [{ debugName: "fromMax" }] : /* istanbul ignore next */ []);
|
|
11023
|
+
toMin = computed(() => later(this.draft().from, this.minDate()), ...ngDevMode ? [{ debugName: "toMin" }] : /* istanbul ignore next */ []);
|
|
11024
|
+
#refused = signal(0, ...ngDevMode ? [{ debugName: "#refused" }] : /* istanbul ignore next */ []);
|
|
11025
|
+
fromValue = computed(() => this.#pickerValue(this.draft().from), ...ngDevMode ? [{ debugName: "fromValue" }] : /* istanbul ignore next */ []);
|
|
11026
|
+
toValue = computed(() => this.#pickerValue(this.draft().to), ...ngDevMode ? [{ debugName: "toValue" }] : /* istanbul ignore next */ []);
|
|
7676
11027
|
#onChange = () => {};
|
|
7677
11028
|
#onTouched = () => {};
|
|
7678
11029
|
writeValue(value) {
|
|
7679
|
-
this
|
|
7680
|
-
|
|
11030
|
+
this.value.set({
|
|
11031
|
+
from: value?.from ?? null,
|
|
11032
|
+
to: value?.to ?? null
|
|
11033
|
+
});
|
|
7681
11034
|
}
|
|
7682
11035
|
registerOnChange(fn) {
|
|
7683
11036
|
this.#onChange = fn;
|
|
@@ -7689,118 +11042,11 @@ var HxDatePicker = class HxDatePicker {
|
|
|
7689
11042
|
this.#cvaDisabled.set(disabled);
|
|
7690
11043
|
}
|
|
7691
11044
|
focus() {
|
|
7692
|
-
|
|
7693
|
-
if (field) field.nativeElement.focus();
|
|
7694
|
-
else this.#focusDay();
|
|
7695
|
-
}
|
|
7696
|
-
dateKey(date) {
|
|
7697
|
-
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;
|
|
7698
|
-
}
|
|
7699
|
-
dayLabel(date) {
|
|
7700
|
-
return this.#formats().full.format(date);
|
|
7701
|
-
}
|
|
7702
|
-
isToday(date) {
|
|
7703
|
-
return isSameDay(date, this.#today);
|
|
7704
|
-
}
|
|
7705
|
-
isSelected(date) {
|
|
7706
|
-
return this.selectedDates().some((d) => isSameDay(d, date));
|
|
7707
|
-
}
|
|
7708
|
-
isInRange(date) {
|
|
7709
|
-
const [from, to] = this.selectedDates();
|
|
7710
|
-
return this.selectionMode() === "range" && !!from && !!to && compareDays(date, from) > 0 && compareDays(date, to) < 0;
|
|
7711
|
-
}
|
|
7712
|
-
isDateDisabled(date) {
|
|
7713
|
-
const [min, max] = [this.minDate(), this.maxDate()];
|
|
7714
|
-
return !!min && compareDays(date, min) < 0 || !!max && compareDays(date, max) > 0 || this.disabledDates().some((d) => isSameDay(d, date));
|
|
7715
|
-
}
|
|
7716
|
-
isFocusTarget(date) {
|
|
7717
|
-
return isSameDay(date, this.focusedDate());
|
|
7718
|
-
}
|
|
7719
|
-
step(direction) {
|
|
7720
|
-
const current = this.focusedDate();
|
|
7721
|
-
const next = this.view() === "day" ? addMonths(current, direction) : this.view() === "month" ? addMonths(current, 12 * direction) : addMonths(current, 144 * direction);
|
|
7722
|
-
this.focusedDate.set(next);
|
|
7723
|
-
}
|
|
7724
|
-
chooseMonth(month) {
|
|
7725
|
-
const current = this.focusedDate();
|
|
7726
|
-
this.focusedDate.set(addMonths(new Date(current.getFullYear(), 0, current.getDate()), month));
|
|
7727
|
-
this.view.set("day");
|
|
7728
|
-
}
|
|
7729
|
-
chooseYear(year) {
|
|
7730
|
-
const current = this.focusedDate();
|
|
7731
|
-
this.focusedDate.set(addMonths(new Date(year, current.getMonth(), 1), 0));
|
|
7732
|
-
this.view.set("month");
|
|
7733
|
-
}
|
|
7734
|
-
pick(date) {
|
|
7735
|
-
if (this.isDisabled() || this.isDateDisabled(date)) return;
|
|
7736
|
-
const day = startOfDay(date);
|
|
7737
|
-
this.focusedDate.set(day);
|
|
7738
|
-
const selected = this.selectedDates();
|
|
7739
|
-
let next;
|
|
7740
|
-
const mode = this.selectionMode();
|
|
7741
|
-
switch (mode) {
|
|
7742
|
-
case "multiple":
|
|
7743
|
-
next = this.isSelected(day) ? selected.filter((d) => !isSameDay(d, day)) : [...selected, day];
|
|
7744
|
-
break;
|
|
7745
|
-
case "range":
|
|
7746
|
-
if (selected.length !== 1) next = [day];
|
|
7747
|
-
else next = compareDays(day, selected[0]) < 0 ? [day, selected[0]] : [selected[0], day];
|
|
7748
|
-
break;
|
|
7749
|
-
default: next = day;
|
|
7750
|
-
}
|
|
7751
|
-
this.#typed.set(null);
|
|
7752
|
-
this.#commit(next);
|
|
7753
|
-
if (!this.inline()) {
|
|
7754
|
-
if (mode === "single" || mode === "range" && Array.isArray(next) && next.length === 2) this.close(true);
|
|
7755
|
-
}
|
|
7756
|
-
}
|
|
7757
|
-
#commit(next) {
|
|
7758
|
-
this.value.set(next);
|
|
7759
|
-
this.#onChange(next);
|
|
7760
|
-
}
|
|
7761
|
-
onDayKeydown(event, date) {
|
|
7762
|
-
const first = this.firstDayOfWeek();
|
|
7763
|
-
const weekday = (date.getDay() - first + 7) % 7;
|
|
7764
|
-
let target = null;
|
|
7765
|
-
switch (event.key) {
|
|
7766
|
-
case "ArrowLeft":
|
|
7767
|
-
target = addDays(date, -1);
|
|
7768
|
-
break;
|
|
7769
|
-
case "ArrowRight":
|
|
7770
|
-
target = addDays(date, 1);
|
|
7771
|
-
break;
|
|
7772
|
-
case "ArrowUp":
|
|
7773
|
-
target = addDays(date, -7);
|
|
7774
|
-
break;
|
|
7775
|
-
case "ArrowDown":
|
|
7776
|
-
target = addDays(date, 7);
|
|
7777
|
-
break;
|
|
7778
|
-
case "Home":
|
|
7779
|
-
target = addDays(date, -weekday);
|
|
7780
|
-
break;
|
|
7781
|
-
case "End":
|
|
7782
|
-
target = addDays(date, 6 - weekday);
|
|
7783
|
-
break;
|
|
7784
|
-
case "PageUp":
|
|
7785
|
-
target = addMonths(date, event.shiftKey ? -12 : -1);
|
|
7786
|
-
break;
|
|
7787
|
-
case "PageDown":
|
|
7788
|
-
target = addMonths(date, event.shiftKey ? 12 : 1);
|
|
7789
|
-
break;
|
|
7790
|
-
default: return;
|
|
7791
|
-
}
|
|
7792
|
-
event.preventDefault();
|
|
7793
|
-
this.focusedDate.set(target);
|
|
7794
|
-
this.#focusDay();
|
|
7795
|
-
}
|
|
7796
|
-
#focusDay() {
|
|
7797
|
-
afterNextRender(() => {
|
|
7798
|
-
const key = this.dateKey(this.focusedDate());
|
|
7799
|
-
(this.inline() ? this.#host.nativeElement : document.getElementById(this.popupId))?.querySelector(`.hx-date-picker-date[data-date="${key}"]`)?.focus();
|
|
7800
|
-
}, { injector: this.#injector });
|
|
11045
|
+
this.field()?.nativeElement.focus();
|
|
7801
11046
|
}
|
|
7802
11047
|
show() {
|
|
7803
|
-
if (this.isDisabled() || this.
|
|
11048
|
+
if (this.isDisabled() || this.open()) return;
|
|
11049
|
+
this.#stage(this.value());
|
|
7804
11050
|
this.open.set(true);
|
|
7805
11051
|
}
|
|
7806
11052
|
toggle() {
|
|
@@ -7813,10 +11059,13 @@ var HxDatePicker = class HxDatePicker {
|
|
|
7813
11059
|
if (refocus) this.field()?.nativeElement.focus();
|
|
7814
11060
|
}
|
|
7815
11061
|
onAttach() {
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
11062
|
+
afterNextRender(() => (this.daysPicker() ?? this.timePicker())?.focus(), { injector: this.#injector });
|
|
11063
|
+
}
|
|
11064
|
+
onFieldKeydown(event) {
|
|
11065
|
+
if (event.key === "ArrowDown" || event.key === "Enter" || event.key === " " || event.altKey && event.key === "ArrowUp") {
|
|
11066
|
+
event.preventDefault();
|
|
11067
|
+
this.show();
|
|
11068
|
+
}
|
|
7820
11069
|
}
|
|
7821
11070
|
onOverlayKeydown(event) {
|
|
7822
11071
|
if (event.key === "Escape") {
|
|
@@ -7827,141 +11076,167 @@ var HxDatePicker = class HxDatePicker {
|
|
|
7827
11076
|
onOutsideClick(event) {
|
|
7828
11077
|
if (!this.#host.nativeElement.contains(event.target)) this.close();
|
|
7829
11078
|
}
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
event.preventDefault();
|
|
7833
|
-
this.show();
|
|
7834
|
-
} else if (event.key === "Enter") this.commitTyping();
|
|
11079
|
+
clear() {
|
|
11080
|
+
this.#stage(EMPTY);
|
|
7835
11081
|
}
|
|
7836
|
-
|
|
7837
|
-
this.#
|
|
11082
|
+
submit() {
|
|
11083
|
+
this.#commit(this.draft());
|
|
11084
|
+
this.close(true);
|
|
7838
11085
|
}
|
|
7839
|
-
|
|
7840
|
-
const
|
|
7841
|
-
if (
|
|
7842
|
-
this
|
|
7843
|
-
this
|
|
7844
|
-
|
|
7845
|
-
if (field) field.nativeElement.value = this.text();
|
|
11086
|
+
onHostFocusOut(event) {
|
|
11087
|
+
const next = event.relatedTarget;
|
|
11088
|
+
if (next?.closest(".hx-date-time-range-picker-popup") || this.#host.nativeElement.contains(next)) return;
|
|
11089
|
+
if (this.open() && !next) return;
|
|
11090
|
+
this.close();
|
|
11091
|
+
this.markTouched();
|
|
7846
11092
|
}
|
|
7847
|
-
|
|
7848
|
-
const
|
|
7849
|
-
if (
|
|
7850
|
-
|
|
11093
|
+
onPopupFocusOut(event) {
|
|
11094
|
+
const next = event.relatedTarget;
|
|
11095
|
+
if (!next || next.closest(".hx-date-time-range-picker-popup") || this.#host.nativeElement.contains(next)) return;
|
|
11096
|
+
this.close();
|
|
11097
|
+
this.markTouched();
|
|
11098
|
+
}
|
|
11099
|
+
days = computed(() => {
|
|
11100
|
+
const { from, to } = this.draft();
|
|
11101
|
+
return [from, to].filter((d) => d !== null);
|
|
11102
|
+
}, ...ngDevMode ? [{ debugName: "days" }] : /* istanbul ignore next */ []);
|
|
11103
|
+
setDays(picked) {
|
|
11104
|
+
const [first, second] = (Array.isArray(picked) ? [...picked] : [picked]).filter(isValidDate).sort((a, b) => a.getTime() - b.getTime());
|
|
11105
|
+
const old = this.draft();
|
|
11106
|
+
const [fromTime, toTime] = [old.from ?? this.#lastFrom, old.to ?? this.#lastTo ?? old.from];
|
|
11107
|
+
const at = (day, time) => day ? withTime(startOfDay(day), time?.getHours() ?? 0, time?.getMinutes() ?? 0, time?.getSeconds() ?? 0) : null;
|
|
11108
|
+
const from = at(first, fromTime);
|
|
11109
|
+
const to = at(second, toTime);
|
|
11110
|
+
this.#stage({
|
|
11111
|
+
from,
|
|
11112
|
+
to: from && to && to < from ? from : to
|
|
11113
|
+
});
|
|
11114
|
+
}
|
|
11115
|
+
setFromTime(picked) {
|
|
11116
|
+
if (!picked) {
|
|
11117
|
+
this.#restage();
|
|
7851
11118
|
return;
|
|
7852
11119
|
}
|
|
7853
|
-
const
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
11120
|
+
const { from, to } = this.draft();
|
|
11121
|
+
const day = from ?? to ?? /* @__PURE__ */ new Date();
|
|
11122
|
+
if (this.#isBlocked(day)) {
|
|
11123
|
+
this.#restage();
|
|
11124
|
+
return;
|
|
11125
|
+
}
|
|
11126
|
+
const next = clampTime(this.#atTime(day, picked), this.minDate(), this.fromMax());
|
|
11127
|
+
this.#stage({
|
|
11128
|
+
from: next,
|
|
11129
|
+
to
|
|
11130
|
+
});
|
|
7859
11131
|
}
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
const order = new Intl.DateTimeFormat(this.locale(), {
|
|
7871
|
-
day: "numeric",
|
|
7872
|
-
month: "numeric",
|
|
7873
|
-
year: "numeric"
|
|
7874
|
-
}).formatToParts(new Date(2e3, 10, 22)).filter((p) => [
|
|
7875
|
-
"day",
|
|
7876
|
-
"month",
|
|
7877
|
-
"year"
|
|
7878
|
-
].includes(p.type)).map((p) => p.type);
|
|
7879
|
-
const byType = Object.fromEntries(order.map((type, i) => [type, numbers[i]]));
|
|
7880
|
-
[year, month, day] = [
|
|
7881
|
-
byType["year"],
|
|
7882
|
-
byType["month"],
|
|
7883
|
-
byType["day"]
|
|
7884
|
-
];
|
|
11132
|
+
setToTime(picked) {
|
|
11133
|
+
if (!picked) {
|
|
11134
|
+
this.#restage();
|
|
11135
|
+
return;
|
|
11136
|
+
}
|
|
11137
|
+
const { from, to } = this.draft();
|
|
11138
|
+
const day = to ?? from ?? /* @__PURE__ */ new Date();
|
|
11139
|
+
if (this.#isBlocked(day)) {
|
|
11140
|
+
this.#restage();
|
|
11141
|
+
return;
|
|
7885
11142
|
}
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
11143
|
+
const next = clampTime(this.#atTime(day, picked), this.toMin(), this.maxDate());
|
|
11144
|
+
this.#stage({
|
|
11145
|
+
from: from ?? startOfDay(next),
|
|
11146
|
+
to: next
|
|
11147
|
+
});
|
|
7889
11148
|
}
|
|
7890
|
-
|
|
7891
|
-
this
|
|
11149
|
+
#pickerValue(side) {
|
|
11150
|
+
this.#refused();
|
|
11151
|
+
return side ? new Date(side) : startOfDay(/* @__PURE__ */ new Date());
|
|
7892
11152
|
}
|
|
7893
|
-
|
|
7894
|
-
this.#
|
|
7895
|
-
this.#commit(this.selectionMode() === "single" ? null : []);
|
|
7896
|
-
this.close(true);
|
|
11153
|
+
#restage() {
|
|
11154
|
+
this.#refused.update((n) => n + 1);
|
|
7897
11155
|
}
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
const next = event.relatedTarget;
|
|
7901
|
-
if (this.open() || next?.closest(".hx-date-picker-popup") || this.#host.nativeElement.contains(next)) return;
|
|
7902
|
-
this.commitTyping();
|
|
7903
|
-
this.#onTouched();
|
|
7904
|
-
this.touch.emit();
|
|
11156
|
+
#isBlocked(day) {
|
|
11157
|
+
return this.disabledDates().some((d) => isSameDay(d, day));
|
|
7905
11158
|
}
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
11159
|
+
#atTime(day, time) {
|
|
11160
|
+
return withTime(startOfDay(day), time.getHours(), time.getMinutes(), time.getSeconds());
|
|
11161
|
+
}
|
|
11162
|
+
markTouched() {
|
|
7909
11163
|
this.#onTouched();
|
|
7910
11164
|
this.touch.emit();
|
|
7911
11165
|
}
|
|
11166
|
+
#stage(next) {
|
|
11167
|
+
const inside = (d) => isValidDate(d) ? clampTime(d, this.minDate(), this.maxDate()) : null;
|
|
11168
|
+
const clean = {
|
|
11169
|
+
from: inside(next.from),
|
|
11170
|
+
to: inside(next.to)
|
|
11171
|
+
};
|
|
11172
|
+
if (clean.from) this.#lastFrom = clean.from;
|
|
11173
|
+
if (clean.to) this.#lastTo = clean.to;
|
|
11174
|
+
this.draft.set(clean);
|
|
11175
|
+
}
|
|
11176
|
+
#commit(next) {
|
|
11177
|
+
this.value.set(next);
|
|
11178
|
+
this.#onChange(next);
|
|
11179
|
+
}
|
|
7912
11180
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
7913
11181
|
minVersion: "12.0.0",
|
|
7914
11182
|
version: "22.2.1",
|
|
7915
11183
|
ngImport: i0,
|
|
7916
|
-
type:
|
|
11184
|
+
type: HxDateTimeRangePicker,
|
|
7917
11185
|
deps: [],
|
|
7918
11186
|
target: i0.ɵɵFactoryTarget.Component
|
|
7919
11187
|
});
|
|
7920
11188
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
7921
11189
|
minVersion: "17.0.0",
|
|
7922
11190
|
version: "22.2.1",
|
|
7923
|
-
type:
|
|
11191
|
+
type: HxDateTimeRangePicker,
|
|
7924
11192
|
isStandalone: true,
|
|
7925
|
-
selector: "hx-date-picker",
|
|
11193
|
+
selector: "hx-date-time-range-picker",
|
|
7926
11194
|
inputs: {
|
|
7927
|
-
|
|
7928
|
-
classPropertyName: "
|
|
7929
|
-
publicName: "
|
|
11195
|
+
fromLabel: {
|
|
11196
|
+
classPropertyName: "fromLabel",
|
|
11197
|
+
publicName: "fromLabel",
|
|
7930
11198
|
isSignal: true,
|
|
7931
11199
|
isRequired: false,
|
|
7932
11200
|
transformFunction: null
|
|
7933
11201
|
},
|
|
7934
|
-
|
|
7935
|
-
classPropertyName: "
|
|
7936
|
-
publicName: "
|
|
11202
|
+
toLabel: {
|
|
11203
|
+
classPropertyName: "toLabel",
|
|
11204
|
+
publicName: "toLabel",
|
|
7937
11205
|
isSignal: true,
|
|
7938
11206
|
isRequired: false,
|
|
7939
11207
|
transformFunction: null
|
|
7940
11208
|
},
|
|
7941
|
-
|
|
7942
|
-
classPropertyName: "
|
|
7943
|
-
publicName: "
|
|
11209
|
+
separator: {
|
|
11210
|
+
classPropertyName: "separator",
|
|
11211
|
+
publicName: "separator",
|
|
7944
11212
|
isSignal: true,
|
|
7945
11213
|
isRequired: false,
|
|
7946
11214
|
transformFunction: null
|
|
7947
11215
|
},
|
|
7948
|
-
|
|
7949
|
-
classPropertyName: "
|
|
7950
|
-
publicName: "
|
|
11216
|
+
placeholder: {
|
|
11217
|
+
classPropertyName: "placeholder",
|
|
11218
|
+
publicName: "placeholder",
|
|
7951
11219
|
isSignal: true,
|
|
7952
11220
|
isRequired: false,
|
|
7953
11221
|
transformFunction: null
|
|
7954
11222
|
},
|
|
7955
|
-
|
|
7956
|
-
classPropertyName: "
|
|
7957
|
-
publicName: "
|
|
11223
|
+
clearLabel: {
|
|
11224
|
+
classPropertyName: "clearLabel",
|
|
11225
|
+
publicName: "clearLabel",
|
|
7958
11226
|
isSignal: true,
|
|
7959
11227
|
isRequired: false,
|
|
7960
11228
|
transformFunction: null
|
|
7961
11229
|
},
|
|
7962
|
-
|
|
7963
|
-
classPropertyName: "
|
|
7964
|
-
publicName: "
|
|
11230
|
+
cancelLabel: {
|
|
11231
|
+
classPropertyName: "cancelLabel",
|
|
11232
|
+
publicName: "cancelLabel",
|
|
11233
|
+
isSignal: true,
|
|
11234
|
+
isRequired: false,
|
|
11235
|
+
transformFunction: null
|
|
11236
|
+
},
|
|
11237
|
+
submitLabel: {
|
|
11238
|
+
classPropertyName: "submitLabel",
|
|
11239
|
+
publicName: "submitLabel",
|
|
7965
11240
|
isSignal: true,
|
|
7966
11241
|
isRequired: false,
|
|
7967
11242
|
transformFunction: null
|
|
@@ -7980,16 +11255,79 @@ var HxDatePicker = class HxDatePicker {
|
|
|
7980
11255
|
isRequired: false,
|
|
7981
11256
|
transformFunction: null
|
|
7982
11257
|
},
|
|
7983
|
-
|
|
7984
|
-
classPropertyName: "
|
|
7985
|
-
publicName: "
|
|
11258
|
+
showTime: {
|
|
11259
|
+
classPropertyName: "showTime",
|
|
11260
|
+
publicName: "showTime",
|
|
7986
11261
|
isSignal: true,
|
|
7987
11262
|
isRequired: false,
|
|
7988
11263
|
transformFunction: null
|
|
7989
11264
|
},
|
|
7990
|
-
|
|
7991
|
-
classPropertyName: "
|
|
7992
|
-
publicName: "
|
|
11265
|
+
timeOnly: {
|
|
11266
|
+
classPropertyName: "timeOnly",
|
|
11267
|
+
publicName: "timeOnly",
|
|
11268
|
+
isSignal: true,
|
|
11269
|
+
isRequired: false,
|
|
11270
|
+
transformFunction: null
|
|
11271
|
+
},
|
|
11272
|
+
hourFormat: {
|
|
11273
|
+
classPropertyName: "hourFormat",
|
|
11274
|
+
publicName: "hourFormat",
|
|
11275
|
+
isSignal: true,
|
|
11276
|
+
isRequired: false,
|
|
11277
|
+
transformFunction: null
|
|
11278
|
+
},
|
|
11279
|
+
showMinutes: {
|
|
11280
|
+
classPropertyName: "showMinutes",
|
|
11281
|
+
publicName: "showMinutes",
|
|
11282
|
+
isSignal: true,
|
|
11283
|
+
isRequired: false,
|
|
11284
|
+
transformFunction: null
|
|
11285
|
+
},
|
|
11286
|
+
showSeconds: {
|
|
11287
|
+
classPropertyName: "showSeconds",
|
|
11288
|
+
publicName: "showSeconds",
|
|
11289
|
+
isSignal: true,
|
|
11290
|
+
isRequired: false,
|
|
11291
|
+
transformFunction: null
|
|
11292
|
+
},
|
|
11293
|
+
stepHour: {
|
|
11294
|
+
classPropertyName: "stepHour",
|
|
11295
|
+
publicName: "stepHour",
|
|
11296
|
+
isSignal: true,
|
|
11297
|
+
isRequired: false,
|
|
11298
|
+
transformFunction: null
|
|
11299
|
+
},
|
|
11300
|
+
stepMinute: {
|
|
11301
|
+
classPropertyName: "stepMinute",
|
|
11302
|
+
publicName: "stepMinute",
|
|
11303
|
+
isSignal: true,
|
|
11304
|
+
isRequired: false,
|
|
11305
|
+
transformFunction: null
|
|
11306
|
+
},
|
|
11307
|
+
stepSecond: {
|
|
11308
|
+
classPropertyName: "stepSecond",
|
|
11309
|
+
publicName: "stepSecond",
|
|
11310
|
+
isSignal: true,
|
|
11311
|
+
isRequired: false,
|
|
11312
|
+
transformFunction: null
|
|
11313
|
+
},
|
|
11314
|
+
dateFormat: {
|
|
11315
|
+
classPropertyName: "dateFormat",
|
|
11316
|
+
publicName: "dateFormat",
|
|
11317
|
+
isSignal: true,
|
|
11318
|
+
isRequired: false,
|
|
11319
|
+
transformFunction: null
|
|
11320
|
+
},
|
|
11321
|
+
locale: {
|
|
11322
|
+
classPropertyName: "locale",
|
|
11323
|
+
publicName: "locale",
|
|
11324
|
+
isSignal: true,
|
|
11325
|
+
isRequired: false,
|
|
11326
|
+
transformFunction: null
|
|
11327
|
+
},
|
|
11328
|
+
firstDayOfWeek: {
|
|
11329
|
+
classPropertyName: "firstDayOfWeek",
|
|
11330
|
+
publicName: "firstDayOfWeek",
|
|
7993
11331
|
isSignal: true,
|
|
7994
11332
|
isRequired: false,
|
|
7995
11333
|
transformFunction: null
|
|
@@ -8015,16 +11353,9 @@ var HxDatePicker = class HxDatePicker {
|
|
|
8015
11353
|
isRequired: false,
|
|
8016
11354
|
transformFunction: null
|
|
8017
11355
|
},
|
|
8018
|
-
|
|
8019
|
-
classPropertyName: "
|
|
8020
|
-
publicName: "
|
|
8021
|
-
isSignal: true,
|
|
8022
|
-
isRequired: false,
|
|
8023
|
-
transformFunction: null
|
|
8024
|
-
},
|
|
8025
|
-
locale: {
|
|
8026
|
-
classPropertyName: "locale",
|
|
8027
|
-
publicName: "locale",
|
|
11356
|
+
showButtonBar: {
|
|
11357
|
+
classPropertyName: "showButtonBar",
|
|
11358
|
+
publicName: "showButtonBar",
|
|
8028
11359
|
isSignal: true,
|
|
8029
11360
|
isRequired: false,
|
|
8030
11361
|
transformFunction: null
|
|
@@ -8071,30 +11402,38 @@ var HxDatePicker = class HxDatePicker {
|
|
|
8071
11402
|
},
|
|
8072
11403
|
host: {
|
|
8073
11404
|
listeners: { "focusout": "onHostFocusOut($event)" },
|
|
8074
|
-
|
|
8075
|
-
"class.hx-date-picker-inline": "inline()",
|
|
8076
|
-
"class.hx-date-picker-disabled": "isDisabled()",
|
|
8077
|
-
"class.hx-date-picker-invalid": "invalid()",
|
|
8078
|
-
"class.hx-date-picker-open": "open()",
|
|
8079
|
-
"class.hx-date-picker-has-icon": "showIcon() && !inline()",
|
|
8080
|
-
"class.hx-filled": "!inline() && text() !== \"\""
|
|
8081
|
-
},
|
|
8082
|
-
classAttribute: "hx-date-picker"
|
|
11405
|
+
classAttribute: "hx-date-time-range-picker"
|
|
8083
11406
|
},
|
|
8084
11407
|
providers: [{
|
|
8085
11408
|
provide: NG_VALUE_ACCESSOR,
|
|
8086
|
-
useExisting: forwardRef(() =>
|
|
11409
|
+
useExisting: forwardRef(() => HxDateTimeRangePicker),
|
|
8087
11410
|
multi: true
|
|
8088
11411
|
}],
|
|
8089
|
-
viewQueries: [
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
11412
|
+
viewQueries: [
|
|
11413
|
+
{
|
|
11414
|
+
propertyName: "field",
|
|
11415
|
+
first: true,
|
|
11416
|
+
predicate: ["field"],
|
|
11417
|
+
descendants: true,
|
|
11418
|
+
isSignal: true
|
|
11419
|
+
},
|
|
11420
|
+
{
|
|
11421
|
+
propertyName: "daysPicker",
|
|
11422
|
+
first: true,
|
|
11423
|
+
predicate: HxDatePicker,
|
|
11424
|
+
descendants: true,
|
|
11425
|
+
isSignal: true
|
|
11426
|
+
},
|
|
11427
|
+
{
|
|
11428
|
+
propertyName: "timePicker",
|
|
11429
|
+
first: true,
|
|
11430
|
+
predicate: HxTimePicker,
|
|
11431
|
+
descendants: true,
|
|
11432
|
+
isSignal: true
|
|
11433
|
+
}
|
|
11434
|
+
],
|
|
8096
11435
|
ngImport: i0,
|
|
8097
|
-
template: "
|
|
11436
|
+
template: "<div\n class=\"hx-date-picker hx-date-picker-has-icon hx-date-time-range-picker-control\"\n [class.hx-date-picker-open]=\"open()\"\n [class.hx-date-picker-disabled]=\"isDisabled()\"\n [class.hx-date-picker-invalid]=\"invalid()\"\n>\n <div class=\"hx-date-picker-field\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #field\n type=\"text\"\n readonly\n class=\"hx-date-picker-input\"\n autocomplete=\"off\"\n aria-haspopup=\"dialog\"\n [attr.id]=\"inputId() ?? null\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"text()\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? popupId : null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n (click)=\"show()\"\n (keydown)=\"onFieldKeydown($event)\"\n />\n <button\n type=\"button\"\n class=\"hx-date-picker-trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"chooseLabel()\"\n [attr.aria-expanded]=\"open()\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"hx-date-picker-trigger-icon\" aria-hidden=\"true\"></span>\n </button>\n </div>\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayPanelClass=\"hx-date-picker-overlay\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPush]=\"true\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n (attach)=\"onAttach()\"\n (detach)=\"open.set(false)\"\n >\n <div\n class=\"hx-date-picker-popup hx-date-time-range-picker-popup\"\n role=\"dialog\"\n aria-modal=\"false\"\n [id]=\"popupId\"\n [attr.aria-label]=\"ariaLabel() ?? chooseLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (focusout)=\"onPopupFocusOut($event)\"\n >\n <div class=\"hx-date-time-range-picker-body\">\n @if (!timeOnly()) {\n <hx-date-picker\n class=\"hx-date-time-range-picker-days\"\n inline\n selectionMode=\"range\"\n [ariaLabel]=\"chooseLabel()\"\n [value]=\"days()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [locale]=\"locale()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [disabledDates]=\"disabledDates()\"\n (valueChange)=\"setDays($event)\"\n />\n }\n @if (showTime() || timeOnly()) {\n <div class=\"hx-date-time-range-picker-times\">\n <div class=\"hx-date-time-range-picker-time\">\n <span class=\"hx-date-time-range-picker-caption\" aria-hidden=\"true\">{{ fromLabel() }}</span>\n <hx-time-picker\n inline\n class=\"hx-date-time-range-picker-from\"\n [ariaLabel]=\"fromLabel()\"\n [value]=\"fromValue()\"\n [hourFormat]=\"hourFormat()\"\n [showMinutes]=\"showMinutes()\"\n [showSeconds]=\"showSeconds()\"\n [stepHour]=\"stepHour()\"\n [stepMinute]=\"stepMinute()\"\n [stepSecond]=\"stepSecond()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n (valueChange)=\"setFromTime($event)\"\n />\n </div>\n <div class=\"hx-date-time-range-picker-time\">\n <span class=\"hx-date-time-range-picker-caption\" aria-hidden=\"true\">{{ toLabel() }}</span>\n <hx-time-picker\n inline\n class=\"hx-date-time-range-picker-to\"\n [ariaLabel]=\"toLabel()\"\n [value]=\"toValue()\"\n [hourFormat]=\"hourFormat()\"\n [showMinutes]=\"showMinutes()\"\n [showSeconds]=\"showSeconds()\"\n [stepHour]=\"stepHour()\"\n [stepMinute]=\"stepMinute()\"\n [stepSecond]=\"stepSecond()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n (valueChange)=\"setToTime($event)\"\n />\n </div>\n </div>\n }\n </div>\n <div class=\"hx-date-picker-buttonbar hx-date-time-range-picker-footer\">\n @if (showButtonBar()) {\n <button type=\"button\" class=\"hx-date-picker-button\" (click)=\"clear()\">{{ clearLabel() }}</button>\n }\n <span class=\"hx-date-time-range-picker-spacer\"></span>\n <button type=\"button\" class=\"hx-date-picker-button hx-date-time-range-picker-cancel\" (click)=\"close(true)\">{{ cancelLabel() }}</button>\n <button type=\"button\" class=\"hx-date-picker-button hx-date-time-range-picker-submit\" (click)=\"submit()\">{{ submitLabel() }}</button>\n </div>\n </div>\n </ng-template>\n</div>\n",
|
|
8098
11437
|
dependencies: [
|
|
8099
11438
|
{
|
|
8100
11439
|
kind: "directive",
|
|
@@ -8144,14 +11483,68 @@ var HxDatePicker = class HxDatePicker {
|
|
|
8144
11483
|
exportAs: ["cdkOverlayOrigin"]
|
|
8145
11484
|
},
|
|
8146
11485
|
{
|
|
8147
|
-
kind: "
|
|
8148
|
-
type:
|
|
8149
|
-
selector: "
|
|
11486
|
+
kind: "component",
|
|
11487
|
+
type: HxDatePicker,
|
|
11488
|
+
selector: "hx-date-picker",
|
|
8150
11489
|
inputs: [
|
|
8151
|
-
"
|
|
8152
|
-
"
|
|
8153
|
-
"
|
|
8154
|
-
|
|
11490
|
+
"placeholder",
|
|
11491
|
+
"showIcon",
|
|
11492
|
+
"showButtonBar",
|
|
11493
|
+
"dateFormat",
|
|
11494
|
+
"todayLabel",
|
|
11495
|
+
"clearLabel",
|
|
11496
|
+
"chooseLabel",
|
|
11497
|
+
"inputId",
|
|
11498
|
+
"inline",
|
|
11499
|
+
"selectionMode",
|
|
11500
|
+
"minDate",
|
|
11501
|
+
"maxDate",
|
|
11502
|
+
"disabledDates",
|
|
11503
|
+
"firstDayOfWeek",
|
|
11504
|
+
"locale",
|
|
11505
|
+
"ariaLabel",
|
|
11506
|
+
"ariaLabelledby",
|
|
11507
|
+
"value",
|
|
11508
|
+
"disabled",
|
|
11509
|
+
"invalid"
|
|
11510
|
+
],
|
|
11511
|
+
outputs: ["valueChange", "touch"]
|
|
11512
|
+
},
|
|
11513
|
+
{
|
|
11514
|
+
kind: "component",
|
|
11515
|
+
type: HxTimePicker,
|
|
11516
|
+
selector: "hx-time-picker",
|
|
11517
|
+
inputs: [
|
|
11518
|
+
"placeholder",
|
|
11519
|
+
"showIcon",
|
|
11520
|
+
"showButtonBar",
|
|
11521
|
+
"dateFormat",
|
|
11522
|
+
"nowLabel",
|
|
11523
|
+
"clearLabel",
|
|
11524
|
+
"chooseLabel",
|
|
11525
|
+
"timeLabel",
|
|
11526
|
+
"hourLabel",
|
|
11527
|
+
"minuteLabel",
|
|
11528
|
+
"secondLabel",
|
|
11529
|
+
"periodLabel",
|
|
11530
|
+
"inputId",
|
|
11531
|
+
"hourFormat",
|
|
11532
|
+
"showMinutes",
|
|
11533
|
+
"showSeconds",
|
|
11534
|
+
"stepHour",
|
|
11535
|
+
"stepMinute",
|
|
11536
|
+
"stepSecond",
|
|
11537
|
+
"minTime",
|
|
11538
|
+
"maxTime",
|
|
11539
|
+
"inline",
|
|
11540
|
+
"locale",
|
|
11541
|
+
"ariaLabel",
|
|
11542
|
+
"ariaLabelledby",
|
|
11543
|
+
"value",
|
|
11544
|
+
"disabled",
|
|
11545
|
+
"invalid"
|
|
11546
|
+
],
|
|
11547
|
+
outputs: ["valueChange", "touch"]
|
|
8155
11548
|
}
|
|
8156
11549
|
],
|
|
8157
11550
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
@@ -8161,82 +11554,84 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
8161
11554
|
minVersion: "12.0.0",
|
|
8162
11555
|
version: "22.2.1",
|
|
8163
11556
|
ngImport: i0,
|
|
8164
|
-
type:
|
|
11557
|
+
type: HxDateTimeRangePicker,
|
|
8165
11558
|
decorators: [{
|
|
8166
11559
|
type: Component,
|
|
8167
11560
|
args: [{
|
|
8168
|
-
selector: "hx-date-picker",
|
|
11561
|
+
selector: "hx-date-time-range-picker",
|
|
8169
11562
|
imports: [
|
|
8170
11563
|
CdkConnectedOverlay,
|
|
8171
11564
|
CdkOverlayOrigin,
|
|
8172
|
-
|
|
11565
|
+
HxDatePicker,
|
|
11566
|
+
HxTimePicker
|
|
8173
11567
|
],
|
|
8174
11568
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8175
11569
|
providers: [{
|
|
8176
11570
|
provide: NG_VALUE_ACCESSOR,
|
|
8177
|
-
useExisting: forwardRef(() =>
|
|
11571
|
+
useExisting: forwardRef(() => HxDateTimeRangePicker),
|
|
8178
11572
|
multi: true
|
|
8179
11573
|
}],
|
|
8180
11574
|
host: {
|
|
8181
|
-
class: "hx-date-picker",
|
|
8182
|
-
"[class.hx-date-picker-inline]": "inline()",
|
|
8183
|
-
"[class.hx-date-picker-disabled]": "isDisabled()",
|
|
8184
|
-
"[class.hx-date-picker-invalid]": "invalid()",
|
|
8185
|
-
"[class.hx-date-picker-open]": "open()",
|
|
8186
|
-
"[class.hx-date-picker-has-icon]": "showIcon() && !inline()",
|
|
8187
|
-
"[class.hx-filled]": "!inline() && text() !== \"\"",
|
|
11575
|
+
class: "hx-date-time-range-picker",
|
|
8188
11576
|
"(focusout)": "onHostFocusOut($event)"
|
|
8189
11577
|
},
|
|
8190
|
-
template: "
|
|
11578
|
+
template: "<div\n class=\"hx-date-picker hx-date-picker-has-icon hx-date-time-range-picker-control\"\n [class.hx-date-picker-open]=\"open()\"\n [class.hx-date-picker-disabled]=\"isDisabled()\"\n [class.hx-date-picker-invalid]=\"invalid()\"\n>\n <div class=\"hx-date-picker-field\" cdkOverlayOrigin #origin=\"cdkOverlayOrigin\">\n <input\n #field\n type=\"text\"\n readonly\n class=\"hx-date-picker-input\"\n autocomplete=\"off\"\n aria-haspopup=\"dialog\"\n [attr.id]=\"inputId() ?? null\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"isDisabled()\"\n [value]=\"text()\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"open() ? popupId : null\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n (click)=\"show()\"\n (keydown)=\"onFieldKeydown($event)\"\n />\n <button\n type=\"button\"\n class=\"hx-date-picker-trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-label]=\"chooseLabel()\"\n [attr.aria-expanded]=\"open()\"\n [disabled]=\"isDisabled()\"\n (click)=\"toggle()\"\n >\n <span class=\"hx-date-picker-trigger-icon\" aria-hidden=\"true\"></span>\n </button>\n </div>\n <ng-template\n cdkConnectedOverlay\n cdkConnectedOverlayPanelClass=\"hx-date-picker-overlay\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayOpen]=\"open()\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayPush]=\"true\"\n (overlayOutsideClick)=\"onOutsideClick($event)\"\n (overlayKeydown)=\"onOverlayKeydown($event)\"\n (attach)=\"onAttach()\"\n (detach)=\"open.set(false)\"\n >\n <div\n class=\"hx-date-picker-popup hx-date-time-range-picker-popup\"\n role=\"dialog\"\n aria-modal=\"false\"\n [id]=\"popupId\"\n [attr.aria-label]=\"ariaLabel() ?? chooseLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n (focusout)=\"onPopupFocusOut($event)\"\n >\n <div class=\"hx-date-time-range-picker-body\">\n @if (!timeOnly()) {\n <hx-date-picker\n class=\"hx-date-time-range-picker-days\"\n inline\n selectionMode=\"range\"\n [ariaLabel]=\"chooseLabel()\"\n [value]=\"days()\"\n [minDate]=\"minDate()\"\n [maxDate]=\"maxDate()\"\n [locale]=\"locale()\"\n [firstDayOfWeek]=\"firstDayOfWeek()\"\n [disabledDates]=\"disabledDates()\"\n (valueChange)=\"setDays($event)\"\n />\n }\n @if (showTime() || timeOnly()) {\n <div class=\"hx-date-time-range-picker-times\">\n <div class=\"hx-date-time-range-picker-time\">\n <span class=\"hx-date-time-range-picker-caption\" aria-hidden=\"true\">{{ fromLabel() }}</span>\n <hx-time-picker\n inline\n class=\"hx-date-time-range-picker-from\"\n [ariaLabel]=\"fromLabel()\"\n [value]=\"fromValue()\"\n [hourFormat]=\"hourFormat()\"\n [showMinutes]=\"showMinutes()\"\n [showSeconds]=\"showSeconds()\"\n [stepHour]=\"stepHour()\"\n [stepMinute]=\"stepMinute()\"\n [stepSecond]=\"stepSecond()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n (valueChange)=\"setFromTime($event)\"\n />\n </div>\n <div class=\"hx-date-time-range-picker-time\">\n <span class=\"hx-date-time-range-picker-caption\" aria-hidden=\"true\">{{ toLabel() }}</span>\n <hx-time-picker\n inline\n class=\"hx-date-time-range-picker-to\"\n [ariaLabel]=\"toLabel()\"\n [value]=\"toValue()\"\n [hourFormat]=\"hourFormat()\"\n [showMinutes]=\"showMinutes()\"\n [showSeconds]=\"showSeconds()\"\n [stepHour]=\"stepHour()\"\n [stepMinute]=\"stepMinute()\"\n [stepSecond]=\"stepSecond()\"\n [locale]=\"locale()\"\n [disabled]=\"isDisabled()\"\n (valueChange)=\"setToTime($event)\"\n />\n </div>\n </div>\n }\n </div>\n <div class=\"hx-date-picker-buttonbar hx-date-time-range-picker-footer\">\n @if (showButtonBar()) {\n <button type=\"button\" class=\"hx-date-picker-button\" (click)=\"clear()\">{{ clearLabel() }}</button>\n }\n <span class=\"hx-date-time-range-picker-spacer\"></span>\n <button type=\"button\" class=\"hx-date-picker-button hx-date-time-range-picker-cancel\" (click)=\"close(true)\">{{ cancelLabel() }}</button>\n <button type=\"button\" class=\"hx-date-picker-button hx-date-time-range-picker-submit\" (click)=\"submit()\">{{ submitLabel() }}</button>\n </div>\n </div>\n </ng-template>\n</div>\n"
|
|
8191
11579
|
}]
|
|
8192
11580
|
}],
|
|
8193
|
-
ctorParameters: () => [],
|
|
8194
11581
|
propDecorators: {
|
|
8195
|
-
|
|
11582
|
+
fromLabel: [{
|
|
8196
11583
|
type: i0.Input,
|
|
8197
11584
|
args: [{
|
|
8198
11585
|
isSignal: true,
|
|
8199
|
-
alias: "
|
|
11586
|
+
alias: "fromLabel",
|
|
8200
11587
|
required: false
|
|
8201
11588
|
}]
|
|
8202
11589
|
}],
|
|
8203
|
-
|
|
11590
|
+
toLabel: [{
|
|
8204
11591
|
type: i0.Input,
|
|
8205
11592
|
args: [{
|
|
8206
11593
|
isSignal: true,
|
|
8207
|
-
alias: "
|
|
11594
|
+
alias: "toLabel",
|
|
8208
11595
|
required: false
|
|
8209
11596
|
}]
|
|
8210
11597
|
}],
|
|
8211
|
-
|
|
11598
|
+
separator: [{
|
|
8212
11599
|
type: i0.Input,
|
|
8213
11600
|
args: [{
|
|
8214
11601
|
isSignal: true,
|
|
8215
|
-
alias: "
|
|
11602
|
+
alias: "separator",
|
|
8216
11603
|
required: false
|
|
8217
11604
|
}]
|
|
8218
11605
|
}],
|
|
8219
|
-
|
|
11606
|
+
placeholder: [{
|
|
8220
11607
|
type: i0.Input,
|
|
8221
11608
|
args: [{
|
|
8222
11609
|
isSignal: true,
|
|
8223
|
-
alias: "
|
|
11610
|
+
alias: "placeholder",
|
|
8224
11611
|
required: false
|
|
8225
11612
|
}]
|
|
8226
11613
|
}],
|
|
8227
|
-
|
|
11614
|
+
clearLabel: [{
|
|
8228
11615
|
type: i0.Input,
|
|
8229
11616
|
args: [{
|
|
8230
11617
|
isSignal: true,
|
|
8231
|
-
alias: "
|
|
11618
|
+
alias: "clearLabel",
|
|
8232
11619
|
required: false
|
|
8233
11620
|
}]
|
|
8234
11621
|
}],
|
|
8235
|
-
|
|
11622
|
+
cancelLabel: [{
|
|
8236
11623
|
type: i0.Input,
|
|
8237
11624
|
args: [{
|
|
8238
11625
|
isSignal: true,
|
|
8239
|
-
alias: "
|
|
11626
|
+
alias: "cancelLabel",
|
|
11627
|
+
required: false
|
|
11628
|
+
}]
|
|
11629
|
+
}],
|
|
11630
|
+
submitLabel: [{
|
|
11631
|
+
type: i0.Input,
|
|
11632
|
+
args: [{
|
|
11633
|
+
isSignal: true,
|
|
11634
|
+
alias: "submitLabel",
|
|
8240
11635
|
required: false
|
|
8241
11636
|
}]
|
|
8242
11637
|
}],
|
|
@@ -8256,51 +11651,75 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
8256
11651
|
required: false
|
|
8257
11652
|
}]
|
|
8258
11653
|
}],
|
|
8259
|
-
|
|
11654
|
+
showTime: [{
|
|
8260
11655
|
type: i0.Input,
|
|
8261
11656
|
args: [{
|
|
8262
11657
|
isSignal: true,
|
|
8263
|
-
alias: "
|
|
11658
|
+
alias: "showTime",
|
|
8264
11659
|
required: false
|
|
8265
11660
|
}]
|
|
8266
11661
|
}],
|
|
8267
|
-
|
|
11662
|
+
timeOnly: [{
|
|
8268
11663
|
type: i0.Input,
|
|
8269
11664
|
args: [{
|
|
8270
11665
|
isSignal: true,
|
|
8271
|
-
alias: "
|
|
11666
|
+
alias: "timeOnly",
|
|
8272
11667
|
required: false
|
|
8273
11668
|
}]
|
|
8274
11669
|
}],
|
|
8275
|
-
|
|
11670
|
+
hourFormat: [{
|
|
8276
11671
|
type: i0.Input,
|
|
8277
11672
|
args: [{
|
|
8278
11673
|
isSignal: true,
|
|
8279
|
-
alias: "
|
|
11674
|
+
alias: "hourFormat",
|
|
8280
11675
|
required: false
|
|
8281
11676
|
}]
|
|
8282
11677
|
}],
|
|
8283
|
-
|
|
11678
|
+
showMinutes: [{
|
|
8284
11679
|
type: i0.Input,
|
|
8285
11680
|
args: [{
|
|
8286
11681
|
isSignal: true,
|
|
8287
|
-
alias: "
|
|
11682
|
+
alias: "showMinutes",
|
|
8288
11683
|
required: false
|
|
8289
11684
|
}]
|
|
8290
11685
|
}],
|
|
8291
|
-
|
|
11686
|
+
showSeconds: [{
|
|
8292
11687
|
type: i0.Input,
|
|
8293
11688
|
args: [{
|
|
8294
11689
|
isSignal: true,
|
|
8295
|
-
alias: "
|
|
11690
|
+
alias: "showSeconds",
|
|
8296
11691
|
required: false
|
|
8297
11692
|
}]
|
|
8298
11693
|
}],
|
|
8299
|
-
|
|
11694
|
+
stepHour: [{
|
|
8300
11695
|
type: i0.Input,
|
|
8301
11696
|
args: [{
|
|
8302
11697
|
isSignal: true,
|
|
8303
|
-
alias: "
|
|
11698
|
+
alias: "stepHour",
|
|
11699
|
+
required: false
|
|
11700
|
+
}]
|
|
11701
|
+
}],
|
|
11702
|
+
stepMinute: [{
|
|
11703
|
+
type: i0.Input,
|
|
11704
|
+
args: [{
|
|
11705
|
+
isSignal: true,
|
|
11706
|
+
alias: "stepMinute",
|
|
11707
|
+
required: false
|
|
11708
|
+
}]
|
|
11709
|
+
}],
|
|
11710
|
+
stepSecond: [{
|
|
11711
|
+
type: i0.Input,
|
|
11712
|
+
args: [{
|
|
11713
|
+
isSignal: true,
|
|
11714
|
+
alias: "stepSecond",
|
|
11715
|
+
required: false
|
|
11716
|
+
}]
|
|
11717
|
+
}],
|
|
11718
|
+
dateFormat: [{
|
|
11719
|
+
type: i0.Input,
|
|
11720
|
+
args: [{
|
|
11721
|
+
isSignal: true,
|
|
11722
|
+
alias: "dateFormat",
|
|
8304
11723
|
required: false
|
|
8305
11724
|
}]
|
|
8306
11725
|
}],
|
|
@@ -8312,6 +11731,46 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
8312
11731
|
required: false
|
|
8313
11732
|
}]
|
|
8314
11733
|
}],
|
|
11734
|
+
firstDayOfWeek: [{
|
|
11735
|
+
type: i0.Input,
|
|
11736
|
+
args: [{
|
|
11737
|
+
isSignal: true,
|
|
11738
|
+
alias: "firstDayOfWeek",
|
|
11739
|
+
required: false
|
|
11740
|
+
}]
|
|
11741
|
+
}],
|
|
11742
|
+
minDate: [{
|
|
11743
|
+
type: i0.Input,
|
|
11744
|
+
args: [{
|
|
11745
|
+
isSignal: true,
|
|
11746
|
+
alias: "minDate",
|
|
11747
|
+
required: false
|
|
11748
|
+
}]
|
|
11749
|
+
}],
|
|
11750
|
+
maxDate: [{
|
|
11751
|
+
type: i0.Input,
|
|
11752
|
+
args: [{
|
|
11753
|
+
isSignal: true,
|
|
11754
|
+
alias: "maxDate",
|
|
11755
|
+
required: false
|
|
11756
|
+
}]
|
|
11757
|
+
}],
|
|
11758
|
+
disabledDates: [{
|
|
11759
|
+
type: i0.Input,
|
|
11760
|
+
args: [{
|
|
11761
|
+
isSignal: true,
|
|
11762
|
+
alias: "disabledDates",
|
|
11763
|
+
required: false
|
|
11764
|
+
}]
|
|
11765
|
+
}],
|
|
11766
|
+
showButtonBar: [{
|
|
11767
|
+
type: i0.Input,
|
|
11768
|
+
args: [{
|
|
11769
|
+
isSignal: true,
|
|
11770
|
+
alias: "showButtonBar",
|
|
11771
|
+
required: false
|
|
11772
|
+
}]
|
|
11773
|
+
}],
|
|
8315
11774
|
ariaLabel: [{
|
|
8316
11775
|
type: i0.Input,
|
|
8317
11776
|
args: [{
|
|
@@ -8362,6 +11821,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
8362
11821
|
field: [{
|
|
8363
11822
|
type: i0.ViewChild,
|
|
8364
11823
|
args: ["field", { isSignal: true }]
|
|
11824
|
+
}],
|
|
11825
|
+
daysPicker: [{
|
|
11826
|
+
type: i0.ViewChild,
|
|
11827
|
+
args: [i0.forwardRef(() => HxDatePicker), { isSignal: true }]
|
|
11828
|
+
}],
|
|
11829
|
+
timePicker: [{
|
|
11830
|
+
type: i0.ViewChild,
|
|
11831
|
+
args: [i0.forwardRef(() => HxTimePicker), { isSignal: true }]
|
|
8365
11832
|
}]
|
|
8366
11833
|
}
|
|
8367
11834
|
});
|
|
@@ -20381,6 +23848,6 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
20381
23848
|
}]
|
|
20382
23849
|
}
|
|
20383
23850
|
});
|
|
20384
|
-
export { HX_CHART_LOADER, HX_DIALOG_DATA, HX_PRIMARY_COLORS, HX_SURFACES, HX_SURFACE_NAMES, HX_THEME_OPTIONS, HxAccordion, HxAccordionContent, HxAccordionHeader, HxAccordionPanel, HxAutoComplete, HxAvatar, HxAvatarGroup, HxBadge, HxBreadcrumb, HxButton, HxButtonGroup, HxCard, HxCarousel, HxCarouselItem, HxCell, HxChart, HxCheckbox, HxChip, HxConfirmDialog, HxConfirmPopup, HxConfirmationService, HxDataTable, HxDatePicker, HxDialog, HxDialogRef, HxDialogService, HxDivider, HxDrawer, HxFieldset, HxFileUpload, HxFloatLabel, HxGalleria, HxGalleriaCaption, HxGalleriaItemTemplate, HxGalleriaThumbnail, HxIconField, HxImage, HxImageIndicator, HxInput, HxInputGroup, HxInputGroupAddon, HxInputIcon, HxInputNumber, HxListbox, HxMenu, HxMenubar, HxMessage, HxMessageService, HxMultiSelect, HxOverlayBadge, HxPaginator, HxPanel, HxPassword, HxPopover, HxProgressBar, HxProgressSpinner, HxRadio, HxRating, HxRowExpansion, HxSelect, HxSelectButton, HxSkeleton, HxSlider, HxSplitButton, HxStep, HxStepContent, HxStepList, HxStepPanel, HxStepPanels, HxStepper, HxSwitch, HxTab, HxTabContent, HxTabList, HxTabPanel, HxTabPanels, HxTable, HxTableBody, HxTableCaption, HxTableEmpty, HxTableFooter, HxTableHeader, HxTabs, HxTag, HxTheme, HxTimeline, HxTimelineContent, HxTimelineMarker, HxTimelineOpposite, HxToast, HxToastItem, HxToggleButton, HxToolbar, HxTooltip, HxTree, HxTreeNodeTemplate, compareValues, formatFileSize, matchesAccept, provideHxTheme, resolveField };
|
|
23851
|
+
export { HX_CHART_LOADER, HX_DIALOG_DATA, HX_PRIMARY_COLORS, HX_SURFACES, HX_SURFACE_NAMES, HX_THEME_OPTIONS, HxAccordion, HxAccordionContent, HxAccordionHeader, HxAccordionPanel, HxAutoComplete, HxAvatar, HxAvatarGroup, HxBadge, HxBreadcrumb, HxButton, HxButtonGroup, HxCard, HxCarousel, HxCarouselItem, HxCell, HxChart, HxCheckbox, HxChip, HxConfirmDialog, HxConfirmPopup, HxConfirmationService, HxDataTable, HxDatePicker, HxDateTimePicker, HxDateTimeRangePicker, HxDialog, HxDialogRef, HxDialogService, HxDivider, HxDrawer, HxFieldset, HxFileUpload, HxFloatLabel, HxGalleria, HxGalleriaCaption, HxGalleriaItemTemplate, HxGalleriaThumbnail, HxIconField, HxImage, HxImageIndicator, HxInput, HxInputGroup, HxInputGroupAddon, HxInputIcon, HxInputNumber, HxListbox, HxMenu, HxMenubar, HxMessage, HxMessageService, HxMultiSelect, HxOverlayBadge, HxPaginator, HxPanel, HxPassword, HxPopover, HxProgressBar, HxProgressSpinner, HxRadio, HxRating, HxRowExpansion, HxSelect, HxSelectButton, HxSkeleton, HxSlider, HxSplitButton, HxStep, HxStepContent, HxStepList, HxStepPanel, HxStepPanels, HxStepper, HxSwitch, HxTab, HxTabContent, HxTabList, HxTabPanel, HxTabPanels, HxTable, HxTableBody, HxTableCaption, HxTableEmpty, HxTableFooter, HxTableHeader, HxTabs, HxTag, HxTheme, HxTimePicker, HxTimeline, HxTimelineContent, HxTimelineMarker, HxTimelineOpposite, HxToast, HxToastItem, HxToggleButton, HxToolbar, HxTooltip, HxTree, HxTreeNodeTemplate, compareValues, formatFileSize, matchesAccept, provideHxTheme, resolveField };
|
|
20385
23852
|
|
|
20386
23853
|
//# sourceMappingURL=gravionlabs-helix-ui.mjs.map
|