primeng 15.4.18-lts → 15.4.20-lts
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/button/button.d.ts +1 -0
- package/calendar/calendar.d.ts +5 -2
- package/esm2020/button/button.mjs +3 -2
- package/esm2020/calendar/calendar.mjs +98 -17
- package/esm2020/inputnumber/inputnumber.mjs +1 -1
- package/esm2020/table/table.mjs +6 -3
- package/esm2020/tooltip/tooltip.mjs +15 -7
- package/fesm2015/primeng-button.mjs +2 -1
- package/fesm2015/primeng-button.mjs.map +1 -1
- package/fesm2015/primeng-calendar.mjs +97 -16
- package/fesm2015/primeng-calendar.mjs.map +1 -1
- package/fesm2015/primeng-inputnumber.mjs.map +1 -1
- package/fesm2015/primeng-table.mjs +5 -2
- package/fesm2015/primeng-table.mjs.map +1 -1
- package/fesm2015/primeng-tooltip.mjs +14 -6
- package/fesm2015/primeng-tooltip.mjs.map +1 -1
- package/fesm2020/primeng-button.mjs +2 -1
- package/fesm2020/primeng-button.mjs.map +1 -1
- package/fesm2020/primeng-calendar.mjs +97 -16
- package/fesm2020/primeng-calendar.mjs.map +1 -1
- package/fesm2020/primeng-inputnumber.mjs.map +1 -1
- package/fesm2020/primeng-table.mjs +5 -2
- package/fesm2020/primeng-table.mjs.map +1 -1
- package/fesm2020/primeng-tooltip.mjs +14 -6
- package/fesm2020/primeng-tooltip.mjs.map +1 -1
- package/package.json +1 -1
@@ -76,6 +76,7 @@ class Calendar {
|
|
76
76
|
this.navigationState = null;
|
77
77
|
this._numberOfMonths = 1;
|
78
78
|
this._view = 'date';
|
79
|
+
this._focusKey = null;
|
79
80
|
this.convertTo24Hour = function (hours, pm) {
|
80
81
|
if (this.hourFormat == '12') {
|
81
82
|
if (hours === 12) {
|
@@ -597,6 +598,12 @@ class Calendar {
|
|
597
598
|
}
|
598
599
|
return formattedValue;
|
599
600
|
}
|
601
|
+
formatDateMetaToDate(dateMeta) {
|
602
|
+
return new Date(dateMeta.year, dateMeta.month, dateMeta.day);
|
603
|
+
}
|
604
|
+
formatDateKey(date) {
|
605
|
+
return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
|
606
|
+
}
|
600
607
|
setCurrentHourPM(hours) {
|
601
608
|
if (this.hourFormat == '12') {
|
602
609
|
this.pm = hours > 11;
|
@@ -617,7 +624,7 @@ class Calendar {
|
|
617
624
|
this.alignOverlay();
|
618
625
|
}
|
619
626
|
selectDate(dateMeta) {
|
620
|
-
let date =
|
627
|
+
let date = this.formatDateMetaToDate(dateMeta);
|
621
628
|
if (this.showTime) {
|
622
629
|
if (this.hourFormat == '12') {
|
623
630
|
if (this.currentHour === 12)
|
@@ -793,7 +800,7 @@ class Calendar {
|
|
793
800
|
isDateBetween(start, end, dateMeta) {
|
794
801
|
let between = false;
|
795
802
|
if (start && end) {
|
796
|
-
let date =
|
803
|
+
let date = this.formatDateMetaToDate(dateMeta);
|
797
804
|
return start.getTime() <= date.getTime() && end.getTime() >= date.getTime();
|
798
805
|
}
|
799
806
|
return between;
|
@@ -974,9 +981,10 @@ class Calendar {
|
|
974
981
|
}
|
975
982
|
}
|
976
983
|
}
|
977
|
-
onDateCellKeydown(event,
|
984
|
+
onDateCellKeydown(event, dateMeta, groupIndex) {
|
978
985
|
const cellContent = event.currentTarget;
|
979
986
|
const cell = cellContent.parentElement;
|
987
|
+
const currentDate = this.formatDateMetaToDate(dateMeta);
|
980
988
|
switch (event.which) {
|
981
989
|
//down arrow
|
982
990
|
case 40: {
|
@@ -1068,10 +1076,52 @@ class Calendar {
|
|
1068
1076
|
//space
|
1069
1077
|
case 13:
|
1070
1078
|
case 32: {
|
1071
|
-
this.onDateSelect(event,
|
1079
|
+
this.onDateSelect(event, dateMeta);
|
1080
|
+
event.preventDefault();
|
1081
|
+
break;
|
1082
|
+
}
|
1083
|
+
// page up
|
1084
|
+
case 33: {
|
1085
|
+
cellContent.tabIndex = '-1';
|
1086
|
+
const dateToFocus = new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, currentDate.getDate());
|
1087
|
+
const focusKey = this.formatDateKey(dateToFocus);
|
1088
|
+
this.navigateToMonth(true, groupIndex, `span[data-date='${focusKey}']:not(.p-disabled):not(.p-ink)`);
|
1072
1089
|
event.preventDefault();
|
1073
1090
|
break;
|
1074
1091
|
}
|
1092
|
+
// page down
|
1093
|
+
case 34: {
|
1094
|
+
cellContent.tabIndex = '-1';
|
1095
|
+
const dateToFocus = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, currentDate.getDate());
|
1096
|
+
const focusKey = this.formatDateKey(dateToFocus);
|
1097
|
+
this.navigateToMonth(false, groupIndex, `span[data-date='${focusKey}']:not(.p-disabled):not(.p-ink)`);
|
1098
|
+
event.preventDefault();
|
1099
|
+
break;
|
1100
|
+
}
|
1101
|
+
//home
|
1102
|
+
case 36:
|
1103
|
+
cellContent.tabIndex = '-1';
|
1104
|
+
const firstDayDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1);
|
1105
|
+
const firstDayDateKey = this.formatDateKey(firstDayDate);
|
1106
|
+
const firstDayCell = DomHandler.findSingle(cellContent.offsetParent, `span[data-date='${firstDayDateKey}']:not(.p-disabled):not(.p-ink)`);
|
1107
|
+
if (firstDayCell) {
|
1108
|
+
firstDayCell.tabIndex = '0';
|
1109
|
+
firstDayCell.focus();
|
1110
|
+
}
|
1111
|
+
event.preventDefault();
|
1112
|
+
break;
|
1113
|
+
//end
|
1114
|
+
case 35:
|
1115
|
+
cellContent.tabIndex = '-1';
|
1116
|
+
const lastDayDate = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0);
|
1117
|
+
const lastDayDateKey = this.formatDateKey(lastDayDate);
|
1118
|
+
const lastDayCell = DomHandler.findSingle(cellContent.offsetParent, `span[data-date='${lastDayDateKey}']:not(.p-disabled):not(.p-ink)`);
|
1119
|
+
if (lastDayDate) {
|
1120
|
+
lastDayCell.tabIndex = '0';
|
1121
|
+
lastDayCell.focus();
|
1122
|
+
}
|
1123
|
+
event.preventDefault();
|
1124
|
+
break;
|
1075
1125
|
//escape
|
1076
1126
|
case 27: {
|
1077
1127
|
this.overlayVisible = false;
|
@@ -1240,30 +1290,46 @@ class Calendar {
|
|
1240
1290
|
break;
|
1241
1291
|
}
|
1242
1292
|
}
|
1243
|
-
navigateToMonth(prev, groupIndex) {
|
1293
|
+
navigateToMonth(prev, groupIndex, focusKey) {
|
1244
1294
|
if (prev) {
|
1245
1295
|
if (this.numberOfMonths === 1 || groupIndex === 0) {
|
1246
1296
|
this.navigationState = { backward: true };
|
1297
|
+
this._focusKey = focusKey;
|
1247
1298
|
this.navBackward(event);
|
1248
1299
|
}
|
1249
1300
|
else {
|
1250
1301
|
let prevMonthContainer = this.contentViewChild.nativeElement.children[groupIndex - 1];
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1302
|
+
if (focusKey) {
|
1303
|
+
const firstDayCell = DomHandler.findSingle(prevMonthContainer, focusKey);
|
1304
|
+
firstDayCell.tabIndex = '0';
|
1305
|
+
firstDayCell.focus();
|
1306
|
+
}
|
1307
|
+
else {
|
1308
|
+
let cells = DomHandler.find(prevMonthContainer, '.p-datepicker-calendar td span:not(.p-disabled):not(.p-ink)');
|
1309
|
+
let focusCell = cells[cells.length - 1];
|
1310
|
+
focusCell.tabIndex = '0';
|
1311
|
+
focusCell.focus();
|
1312
|
+
}
|
1255
1313
|
}
|
1256
1314
|
}
|
1257
1315
|
else {
|
1258
1316
|
if (this.numberOfMonths === 1 || groupIndex === this.numberOfMonths - 1) {
|
1259
1317
|
this.navigationState = { backward: false };
|
1318
|
+
this._focusKey = focusKey;
|
1260
1319
|
this.navForward(event);
|
1261
1320
|
}
|
1262
1321
|
else {
|
1263
1322
|
let nextMonthContainer = this.contentViewChild.nativeElement.children[groupIndex + 1];
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1323
|
+
if (focusKey) {
|
1324
|
+
const firstDayCell = DomHandler.findSingle(nextMonthContainer, focusKey);
|
1325
|
+
firstDayCell.tabIndex = '0';
|
1326
|
+
firstDayCell.focus();
|
1327
|
+
}
|
1328
|
+
else {
|
1329
|
+
let focusCell = DomHandler.findSingle(nextMonthContainer, '.p-datepicker-calendar td span:not(.p-disabled):not(.p-ink)');
|
1330
|
+
focusCell.tabIndex = '0';
|
1331
|
+
focusCell.focus();
|
1332
|
+
}
|
1267
1333
|
}
|
1268
1334
|
}
|
1269
1335
|
}
|
@@ -1287,7 +1353,7 @@ class Calendar {
|
|
1287
1353
|
cells = DomHandler.find(this.contentViewChild.nativeElement, '.p-yearpicker .p-yearpicker-year:not(.p-disabled)');
|
1288
1354
|
}
|
1289
1355
|
else {
|
1290
|
-
cells = DomHandler.find(this.contentViewChild.nativeElement, '.p-datepicker-calendar td span:not(.p-disabled):not(.p-ink)');
|
1356
|
+
cells = DomHandler.find(this.contentViewChild.nativeElement, this._focusKey || '.p-datepicker-calendar td span:not(.p-disabled):not(.p-ink)');
|
1291
1357
|
}
|
1292
1358
|
if (cells && cells.length > 0) {
|
1293
1359
|
cell = cells[cells.length - 1];
|
@@ -1301,7 +1367,7 @@ class Calendar {
|
|
1301
1367
|
cell = DomHandler.findSingle(this.contentViewChild.nativeElement, '.p-yearpicker .p-yearpicker-year:not(.p-disabled)');
|
1302
1368
|
}
|
1303
1369
|
else {
|
1304
|
-
cell = DomHandler.findSingle(this.contentViewChild.nativeElement, '.p-datepicker-calendar td span:not(.p-disabled):not(.p-ink)');
|
1370
|
+
cell = DomHandler.findSingle(this.contentViewChild.nativeElement, this._focusKey || '.p-datepicker-calendar td span:not(.p-disabled):not(.p-ink)');
|
1305
1371
|
}
|
1306
1372
|
}
|
1307
1373
|
if (cell) {
|
@@ -1310,6 +1376,7 @@ class Calendar {
|
|
1310
1376
|
}
|
1311
1377
|
}
|
1312
1378
|
this.navigationState = null;
|
1379
|
+
this._focusKey = null;
|
1313
1380
|
}
|
1314
1381
|
else {
|
1315
1382
|
this.initFocusableCell();
|
@@ -2461,7 +2528,14 @@ Calendar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.
|
|
2461
2528
|
</td>
|
2462
2529
|
<td *ngFor="let date of week" [ngClass]="{ 'p-datepicker-other-month': date.otherMonth, 'p-datepicker-today': date.today }">
|
2463
2530
|
<ng-container *ngIf="date.otherMonth ? showOtherMonths : true">
|
2464
|
-
<span
|
2531
|
+
<span
|
2532
|
+
[ngClass]="{ 'p-highlight': isSelected(date), 'p-disabled': !date.selectable }"
|
2533
|
+
(click)="onDateSelect($event, date)"
|
2534
|
+
draggable="false"
|
2535
|
+
[attr.data-date]="formatDateKey(formatDateMetaToDate(date))"
|
2536
|
+
(keydown)="onDateCellKeydown($event, date, i)"
|
2537
|
+
pRipple
|
2538
|
+
>
|
2465
2539
|
<ng-container *ngIf="!dateTemplate">{{ date.day }}</ng-container>
|
2466
2540
|
<ng-container *ngTemplateOutlet="dateTemplate; context: { $implicit: date }"></ng-container>
|
2467
2541
|
</span>
|
@@ -2773,7 +2847,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2773
2847
|
</td>
|
2774
2848
|
<td *ngFor="let date of week" [ngClass]="{ 'p-datepicker-other-month': date.otherMonth, 'p-datepicker-today': date.today }">
|
2775
2849
|
<ng-container *ngIf="date.otherMonth ? showOtherMonths : true">
|
2776
|
-
<span
|
2850
|
+
<span
|
2851
|
+
[ngClass]="{ 'p-highlight': isSelected(date), 'p-disabled': !date.selectable }"
|
2852
|
+
(click)="onDateSelect($event, date)"
|
2853
|
+
draggable="false"
|
2854
|
+
[attr.data-date]="formatDateKey(formatDateMetaToDate(date))"
|
2855
|
+
(keydown)="onDateCellKeydown($event, date, i)"
|
2856
|
+
pRipple
|
2857
|
+
>
|
2777
2858
|
<ng-container *ngIf="!dateTemplate">{{ date.day }}</ng-container>
|
2778
2859
|
<ng-container *ngTemplateOutlet="dateTemplate; context: { $implicit: date }"></ng-container>
|
2779
2860
|
</span>
|