@tolle_/tolle-ui 18.3.2 → 18.3.3
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/fesm2022/tolle-ui.mjs
CHANGED
|
@@ -6657,6 +6657,8 @@ class RangeCalendarComponent {
|
|
|
6657
6657
|
rangeSelect = new EventEmitter(); // Emits whenever selection changes
|
|
6658
6658
|
currentView = 'date';
|
|
6659
6659
|
viewDate = new Date();
|
|
6660
|
+
/** Which visible month the quick pickers are editing; always 0 in the single-month view. */
|
|
6661
|
+
pickerMonthIndex = 0;
|
|
6660
6662
|
// The Range Value
|
|
6661
6663
|
value = { start: null, end: null };
|
|
6662
6664
|
weekDays = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
@@ -6696,19 +6698,27 @@ class RangeCalendarComponent {
|
|
|
6696
6698
|
return {
|
|
6697
6699
|
date: monthDate,
|
|
6698
6700
|
days: eachDayOfInterval({ start: startOfWeek(startOfMonth(monthDate)), end: endOfWeek(endOfMonth(monthDate)) }),
|
|
6699
|
-
label: format(monthDate, 'MMMM yyyy'),
|
|
6700
6701
|
};
|
|
6701
6702
|
});
|
|
6702
6703
|
}
|
|
6703
6704
|
generateYears() {
|
|
6704
|
-
const currentYear = this.
|
|
6705
|
+
const currentYear = this.pickerDate.getFullYear();
|
|
6705
6706
|
this.years = Array.from({ length: 16 }, (_, i) => currentYear - 6 + i);
|
|
6706
6707
|
}
|
|
6707
|
-
|
|
6708
|
+
/** The month the quick pickers act on — `viewDate` shifted to the clicked panel. */
|
|
6709
|
+
get pickerDate() {
|
|
6710
|
+
return addMonths(this.viewDate, this.pickerMonthIndex);
|
|
6711
|
+
}
|
|
6712
|
+
/** `monthIndex` is the index of the visible month whose header was clicked. */
|
|
6713
|
+
setView(view, monthIndex = 0) {
|
|
6714
|
+
this.pickerMonthIndex = view === 'date' ? 0 : monthIndex;
|
|
6708
6715
|
this.currentView = view;
|
|
6709
6716
|
if (view === 'year')
|
|
6710
6717
|
this.generateYears();
|
|
6711
6718
|
}
|
|
6719
|
+
headerBtnClass(view) {
|
|
6720
|
+
return cn('text-sm font-semibold px-2 py-1 rounded transition-colors', this.currentView === view ? 'bg-secondary text-secondary-foreground' : 'hover:bg-accent hover:text-accent-foreground');
|
|
6721
|
+
}
|
|
6712
6722
|
prev() {
|
|
6713
6723
|
if (this.currentView === 'date') {
|
|
6714
6724
|
this.viewDate = subMonths(this.viewDate, 1);
|
|
@@ -6833,12 +6843,19 @@ class RangeCalendarComponent {
|
|
|
6833
6843
|
btn?.focus();
|
|
6834
6844
|
}
|
|
6835
6845
|
selectMonth(monthIndex) {
|
|
6836
|
-
this.
|
|
6837
|
-
this.currentView = 'date';
|
|
6838
|
-
this.generateDays();
|
|
6846
|
+
this.applyPickerDate(setMonth(this.pickerDate, monthIndex));
|
|
6839
6847
|
}
|
|
6840
6848
|
selectYear(year) {
|
|
6841
|
-
this.
|
|
6849
|
+
this.applyPickerDate(setYear(this.pickerDate, year));
|
|
6850
|
+
}
|
|
6851
|
+
/**
|
|
6852
|
+
* Re-anchors the view so the panel the picker was opened from lands on `date`,
|
|
6853
|
+
* then returns to the day grid. In the single-month view the offset is 0, so
|
|
6854
|
+
* this is just "show that month".
|
|
6855
|
+
*/
|
|
6856
|
+
applyPickerDate(date) {
|
|
6857
|
+
this.viewDate = startOfMonth(subMonths(date, this.pickerMonthIndex));
|
|
6858
|
+
this.pickerMonthIndex = 0;
|
|
6842
6859
|
this.currentView = 'date';
|
|
6843
6860
|
this.generateDays();
|
|
6844
6861
|
}
|
|
@@ -6909,8 +6926,40 @@ class RangeCalendarComponent {
|
|
|
6909
6926
|
], usesOnChanges: true, ngImport: i0, template: `
|
|
6910
6927
|
<div [class]="cn('text-popover-foreground inline-block min-w-fit', bordered ? 'p-3 border rounded-md bg-background shadow-sm' : '', class)">
|
|
6911
6928
|
|
|
6929
|
+
<!-- ===== Month / year quick pickers (shared by the single- and multi-month views) ===== -->
|
|
6930
|
+
<ng-container *ngIf="currentView !== 'date'">
|
|
6931
|
+
<div class="flex items-center justify-between pt-1 pb-4 gap-2">
|
|
6932
|
+
<div class="flex items-center gap-1">
|
|
6933
|
+
<button type="button" (click)="setView('month', pickerMonthIndex)" [class]="headerBtnClass('month')">
|
|
6934
|
+
{{ pickerDate | date: 'MMMM' }}
|
|
6935
|
+
</button>
|
|
6936
|
+
<button type="button" (click)="setView('year', pickerMonthIndex)" [class]="headerBtnClass('year')">
|
|
6937
|
+
{{ pickerDate | date: 'yyyy' }}
|
|
6938
|
+
</button>
|
|
6939
|
+
</div>
|
|
6940
|
+
<div class="flex items-center space-x-1">
|
|
6941
|
+
<button type="button" (click)="prev()" [class]="navBtnClass" aria-label="Previous"><i class="ri-arrow-left-s-line text-lg"></i></button>
|
|
6942
|
+
<button type="button" (click)="next()" [class]="navBtnClass" aria-label="Next"><i class="ri-arrow-right-s-line text-lg"></i></button>
|
|
6943
|
+
</div>
|
|
6944
|
+
</div>
|
|
6945
|
+
|
|
6946
|
+
<div *ngIf="currentView === 'month'" class="grid grid-cols-3 gap-2 w-64 animate-in fade-in zoom-in-95 duration-200">
|
|
6947
|
+
<button *ngFor="let month of months; let i = index" type="button" (click)="selectMonth(i)"
|
|
6948
|
+
[class]="cn('text-sm py-2.5 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors', i === pickerDate.getMonth() ? 'bg-primary text-primary-foreground' : '')">
|
|
6949
|
+
{{ month }}
|
|
6950
|
+
</button>
|
|
6951
|
+
</div>
|
|
6952
|
+
|
|
6953
|
+
<div *ngIf="currentView === 'year'" class="grid grid-cols-4 gap-2 w-64 animate-in fade-in zoom-in-95 duration-200">
|
|
6954
|
+
<button *ngFor="let year of years" type="button" (click)="selectYear(year)"
|
|
6955
|
+
[class]="cn('text-sm py-2 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors', year === pickerDate.getFullYear() ? 'bg-primary text-primary-foreground' : '')">
|
|
6956
|
+
{{ year }}
|
|
6957
|
+
</button>
|
|
6958
|
+
</div>
|
|
6959
|
+
</ng-container>
|
|
6960
|
+
|
|
6912
6961
|
<!-- ===== Multi-month view (side-by-side, shared range) ===== -->
|
|
6913
|
-
<div *ngIf="numberOfMonths > 1" class="flex flex-col gap-4 sm:flex-row">
|
|
6962
|
+
<div *ngIf="currentView === 'date' && numberOfMonths > 1" class="flex flex-col gap-4 sm:flex-row">
|
|
6914
6963
|
<div *ngFor="let m of visibleMonths; let idx = index" class="space-y-2">
|
|
6915
6964
|
<div class="flex items-center justify-between pt-1 pb-2">
|
|
6916
6965
|
<button *ngIf="idx === 0" type="button" (click)="prev()" [class]="navBtnClass" aria-label="Previous month">
|
|
@@ -6918,7 +6967,12 @@ class RangeCalendarComponent {
|
|
|
6918
6967
|
</button>
|
|
6919
6968
|
<span *ngIf="idx !== 0" class="h-7 w-7"></span>
|
|
6920
6969
|
|
|
6921
|
-
|
|
6970
|
+
<!-- Each panel's month and year open the quick pickers for that panel,
|
|
6971
|
+
so a two-month view jumps the same way the single-month one does. -->
|
|
6972
|
+
<div class="flex items-center gap-1">
|
|
6973
|
+
<button type="button" (click)="setView('month', idx)" [class]="headerBtnClass('month')">{{ m.date | date: 'MMMM' }}</button>
|
|
6974
|
+
<button type="button" (click)="setView('year', idx)" [class]="headerBtnClass('year')">{{ m.date | date: 'yyyy' }}</button>
|
|
6975
|
+
</div>
|
|
6922
6976
|
|
|
6923
6977
|
<button *ngIf="idx === visibleMonths.length - 1" type="button" (click)="next()" [class]="navBtnClass" aria-label="Next month">
|
|
6924
6978
|
<i class="ri-arrow-right-s-line text-lg"></i>
|
|
@@ -6952,16 +7006,14 @@ class RangeCalendarComponent {
|
|
|
6952
7006
|
</div>
|
|
6953
7007
|
</div>
|
|
6954
7008
|
|
|
6955
|
-
<!-- ===== Single-month view
|
|
6956
|
-
<ng-container *ngIf="numberOfMonths <= 1">
|
|
7009
|
+
<!-- ===== Single-month view ===== -->
|
|
7010
|
+
<ng-container *ngIf="currentView === 'date' && numberOfMonths <= 1">
|
|
6957
7011
|
<div class="flex items-center justify-between pt-1 pb-4 gap-2">
|
|
6958
7012
|
<div class="flex items-center gap-1">
|
|
6959
|
-
<button type="button" (click)="setView('month')"
|
|
6960
|
-
[class]="cn('text-sm font-semibold px-2 py-1 rounded transition-colors', currentView === 'month' ? 'bg-secondary text-secondary-foreground' : 'hover:bg-accent hover:text-accent-foreground')">
|
|
7013
|
+
<button type="button" (click)="setView('month')" [class]="headerBtnClass('month')">
|
|
6961
7014
|
{{ viewDate | date: 'MMMM' }}
|
|
6962
7015
|
</button>
|
|
6963
|
-
<button type="button" (click)="setView('year')"
|
|
6964
|
-
[class]="cn('text-sm font-semibold px-2 py-1 rounded transition-colors', currentView === 'year' ? 'bg-secondary text-secondary-foreground' : 'hover:bg-accent hover:text-accent-foreground')">
|
|
7016
|
+
<button type="button" (click)="setView('year')" [class]="headerBtnClass('year')">
|
|
6965
7017
|
{{ viewDate | date: 'yyyy' }}
|
|
6966
7018
|
</button>
|
|
6967
7019
|
</div>
|
|
@@ -6971,7 +7023,7 @@ class RangeCalendarComponent {
|
|
|
6971
7023
|
</div>
|
|
6972
7024
|
</div>
|
|
6973
7025
|
|
|
6974
|
-
<div
|
|
7026
|
+
<div class="space-y-2 animate-in fade-in zoom-in-95 duration-200">
|
|
6975
7027
|
<div class="grid grid-cols-7 gap-y-1 w-full">
|
|
6976
7028
|
<span *ngFor="let day of weekDays" class="text-[0.8rem] text-muted-foreground font-normal text-center w-9">
|
|
6977
7029
|
{{ day }}
|
|
@@ -6993,20 +7045,6 @@ class RangeCalendarComponent {
|
|
|
6993
7045
|
</button>
|
|
6994
7046
|
</div>
|
|
6995
7047
|
</div>
|
|
6996
|
-
|
|
6997
|
-
<div *ngIf="currentView === 'month'" class="grid grid-cols-3 gap-2 w-64 animate-in fade-in zoom-in-95 duration-200">
|
|
6998
|
-
<button *ngFor="let month of months; let i = index" type="button" (click)="selectMonth(i)"
|
|
6999
|
-
[class]="cn('text-sm py-2.5 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors', i === viewDate.getMonth() ? 'bg-primary text-primary-foreground' : '')">
|
|
7000
|
-
{{ month }}
|
|
7001
|
-
</button>
|
|
7002
|
-
</div>
|
|
7003
|
-
|
|
7004
|
-
<div *ngIf="currentView === 'year'" class="grid grid-cols-4 gap-2 w-64 animate-in fade-in zoom-in-95 duration-200">
|
|
7005
|
-
<button *ngFor="let year of years" type="button" (click)="selectYear(year)"
|
|
7006
|
-
[class]="cn('text-sm py-2 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors', year === viewDate.getFullYear() ? 'bg-primary text-primary-foreground' : '')">
|
|
7007
|
-
{{ year }}
|
|
7008
|
-
</button>
|
|
7009
|
-
</div>
|
|
7010
7048
|
</ng-container>
|
|
7011
7049
|
</div>
|
|
7012
7050
|
`, isInline: true, styles: [":host{display:block}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.DatePipe, name: "date" }] });
|
|
@@ -7022,8 +7060,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
7022
7060
|
], template: `
|
|
7023
7061
|
<div [class]="cn('text-popover-foreground inline-block min-w-fit', bordered ? 'p-3 border rounded-md bg-background shadow-sm' : '', class)">
|
|
7024
7062
|
|
|
7063
|
+
<!-- ===== Month / year quick pickers (shared by the single- and multi-month views) ===== -->
|
|
7064
|
+
<ng-container *ngIf="currentView !== 'date'">
|
|
7065
|
+
<div class="flex items-center justify-between pt-1 pb-4 gap-2">
|
|
7066
|
+
<div class="flex items-center gap-1">
|
|
7067
|
+
<button type="button" (click)="setView('month', pickerMonthIndex)" [class]="headerBtnClass('month')">
|
|
7068
|
+
{{ pickerDate | date: 'MMMM' }}
|
|
7069
|
+
</button>
|
|
7070
|
+
<button type="button" (click)="setView('year', pickerMonthIndex)" [class]="headerBtnClass('year')">
|
|
7071
|
+
{{ pickerDate | date: 'yyyy' }}
|
|
7072
|
+
</button>
|
|
7073
|
+
</div>
|
|
7074
|
+
<div class="flex items-center space-x-1">
|
|
7075
|
+
<button type="button" (click)="prev()" [class]="navBtnClass" aria-label="Previous"><i class="ri-arrow-left-s-line text-lg"></i></button>
|
|
7076
|
+
<button type="button" (click)="next()" [class]="navBtnClass" aria-label="Next"><i class="ri-arrow-right-s-line text-lg"></i></button>
|
|
7077
|
+
</div>
|
|
7078
|
+
</div>
|
|
7079
|
+
|
|
7080
|
+
<div *ngIf="currentView === 'month'" class="grid grid-cols-3 gap-2 w-64 animate-in fade-in zoom-in-95 duration-200">
|
|
7081
|
+
<button *ngFor="let month of months; let i = index" type="button" (click)="selectMonth(i)"
|
|
7082
|
+
[class]="cn('text-sm py-2.5 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors', i === pickerDate.getMonth() ? 'bg-primary text-primary-foreground' : '')">
|
|
7083
|
+
{{ month }}
|
|
7084
|
+
</button>
|
|
7085
|
+
</div>
|
|
7086
|
+
|
|
7087
|
+
<div *ngIf="currentView === 'year'" class="grid grid-cols-4 gap-2 w-64 animate-in fade-in zoom-in-95 duration-200">
|
|
7088
|
+
<button *ngFor="let year of years" type="button" (click)="selectYear(year)"
|
|
7089
|
+
[class]="cn('text-sm py-2 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors', year === pickerDate.getFullYear() ? 'bg-primary text-primary-foreground' : '')">
|
|
7090
|
+
{{ year }}
|
|
7091
|
+
</button>
|
|
7092
|
+
</div>
|
|
7093
|
+
</ng-container>
|
|
7094
|
+
|
|
7025
7095
|
<!-- ===== Multi-month view (side-by-side, shared range) ===== -->
|
|
7026
|
-
<div *ngIf="numberOfMonths > 1" class="flex flex-col gap-4 sm:flex-row">
|
|
7096
|
+
<div *ngIf="currentView === 'date' && numberOfMonths > 1" class="flex flex-col gap-4 sm:flex-row">
|
|
7027
7097
|
<div *ngFor="let m of visibleMonths; let idx = index" class="space-y-2">
|
|
7028
7098
|
<div class="flex items-center justify-between pt-1 pb-2">
|
|
7029
7099
|
<button *ngIf="idx === 0" type="button" (click)="prev()" [class]="navBtnClass" aria-label="Previous month">
|
|
@@ -7031,7 +7101,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
7031
7101
|
</button>
|
|
7032
7102
|
<span *ngIf="idx !== 0" class="h-7 w-7"></span>
|
|
7033
7103
|
|
|
7034
|
-
|
|
7104
|
+
<!-- Each panel's month and year open the quick pickers for that panel,
|
|
7105
|
+
so a two-month view jumps the same way the single-month one does. -->
|
|
7106
|
+
<div class="flex items-center gap-1">
|
|
7107
|
+
<button type="button" (click)="setView('month', idx)" [class]="headerBtnClass('month')">{{ m.date | date: 'MMMM' }}</button>
|
|
7108
|
+
<button type="button" (click)="setView('year', idx)" [class]="headerBtnClass('year')">{{ m.date | date: 'yyyy' }}</button>
|
|
7109
|
+
</div>
|
|
7035
7110
|
|
|
7036
7111
|
<button *ngIf="idx === visibleMonths.length - 1" type="button" (click)="next()" [class]="navBtnClass" aria-label="Next month">
|
|
7037
7112
|
<i class="ri-arrow-right-s-line text-lg"></i>
|
|
@@ -7065,16 +7140,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
7065
7140
|
</div>
|
|
7066
7141
|
</div>
|
|
7067
7142
|
|
|
7068
|
-
<!-- ===== Single-month view
|
|
7069
|
-
<ng-container *ngIf="numberOfMonths <= 1">
|
|
7143
|
+
<!-- ===== Single-month view ===== -->
|
|
7144
|
+
<ng-container *ngIf="currentView === 'date' && numberOfMonths <= 1">
|
|
7070
7145
|
<div class="flex items-center justify-between pt-1 pb-4 gap-2">
|
|
7071
7146
|
<div class="flex items-center gap-1">
|
|
7072
|
-
<button type="button" (click)="setView('month')"
|
|
7073
|
-
[class]="cn('text-sm font-semibold px-2 py-1 rounded transition-colors', currentView === 'month' ? 'bg-secondary text-secondary-foreground' : 'hover:bg-accent hover:text-accent-foreground')">
|
|
7147
|
+
<button type="button" (click)="setView('month')" [class]="headerBtnClass('month')">
|
|
7074
7148
|
{{ viewDate | date: 'MMMM' }}
|
|
7075
7149
|
</button>
|
|
7076
|
-
<button type="button" (click)="setView('year')"
|
|
7077
|
-
[class]="cn('text-sm font-semibold px-2 py-1 rounded transition-colors', currentView === 'year' ? 'bg-secondary text-secondary-foreground' : 'hover:bg-accent hover:text-accent-foreground')">
|
|
7150
|
+
<button type="button" (click)="setView('year')" [class]="headerBtnClass('year')">
|
|
7078
7151
|
{{ viewDate | date: 'yyyy' }}
|
|
7079
7152
|
</button>
|
|
7080
7153
|
</div>
|
|
@@ -7084,7 +7157,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
7084
7157
|
</div>
|
|
7085
7158
|
</div>
|
|
7086
7159
|
|
|
7087
|
-
<div
|
|
7160
|
+
<div class="space-y-2 animate-in fade-in zoom-in-95 duration-200">
|
|
7088
7161
|
<div class="grid grid-cols-7 gap-y-1 w-full">
|
|
7089
7162
|
<span *ngFor="let day of weekDays" class="text-[0.8rem] text-muted-foreground font-normal text-center w-9">
|
|
7090
7163
|
{{ day }}
|
|
@@ -7106,20 +7179,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
7106
7179
|
</button>
|
|
7107
7180
|
</div>
|
|
7108
7181
|
</div>
|
|
7109
|
-
|
|
7110
|
-
<div *ngIf="currentView === 'month'" class="grid grid-cols-3 gap-2 w-64 animate-in fade-in zoom-in-95 duration-200">
|
|
7111
|
-
<button *ngFor="let month of months; let i = index" type="button" (click)="selectMonth(i)"
|
|
7112
|
-
[class]="cn('text-sm py-2.5 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors', i === viewDate.getMonth() ? 'bg-primary text-primary-foreground' : '')">
|
|
7113
|
-
{{ month }}
|
|
7114
|
-
</button>
|
|
7115
|
-
</div>
|
|
7116
|
-
|
|
7117
|
-
<div *ngIf="currentView === 'year'" class="grid grid-cols-4 gap-2 w-64 animate-in fade-in zoom-in-95 duration-200">
|
|
7118
|
-
<button *ngFor="let year of years" type="button" (click)="selectYear(year)"
|
|
7119
|
-
[class]="cn('text-sm py-2 rounded-md hover:bg-accent hover:text-accent-foreground transition-colors', year === viewDate.getFullYear() ? 'bg-primary text-primary-foreground' : '')">
|
|
7120
|
-
{{ year }}
|
|
7121
|
-
</button>
|
|
7122
|
-
</div>
|
|
7123
7182
|
</ng-container>
|
|
7124
7183
|
</div>
|
|
7125
7184
|
`, styles: [":host{display:block}\n"] }]
|