@exhaustive-ui/core 22.0.0-alpha.1 → 22.0.0-alpha.10

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.
Files changed (145) hide show
  1. package/README.md +22 -4
  2. package/fesm2022/exhaustive-ui-core-accordion.mjs +6 -0
  3. package/fesm2022/exhaustive-ui-core-accordion.mjs.map +1 -1
  4. package/fesm2022/exhaustive-ui-core-api.mjs +7 -5
  5. package/fesm2022/exhaustive-ui-core-api.mjs.map +1 -1
  6. package/fesm2022/exhaustive-ui-core-autocomplete.mjs +19 -8
  7. package/fesm2022/exhaustive-ui-core-autocomplete.mjs.map +1 -1
  8. package/fesm2022/exhaustive-ui-core-autofocus.mjs +4 -4
  9. package/fesm2022/exhaustive-ui-core-autofocus.mjs.map +1 -1
  10. package/fesm2022/exhaustive-ui-core-basecomponent.mjs +6 -1
  11. package/fesm2022/exhaustive-ui-core-basecomponent.mjs.map +1 -1
  12. package/fesm2022/exhaustive-ui-core-blockui.mjs +7 -0
  13. package/fesm2022/exhaustive-ui-core-blockui.mjs.map +1 -1
  14. package/fesm2022/exhaustive-ui-core-breadcrumb.mjs +2 -2
  15. package/fesm2022/exhaustive-ui-core-breadcrumb.mjs.map +1 -1
  16. package/fesm2022/exhaustive-ui-core-button.mjs +30 -8
  17. package/fesm2022/exhaustive-ui-core-button.mjs.map +1 -1
  18. package/fesm2022/exhaustive-ui-core-carousel.mjs +7 -2
  19. package/fesm2022/exhaustive-ui-core-carousel.mjs.map +1 -1
  20. package/fesm2022/exhaustive-ui-core-cascadeselect.mjs +2 -2
  21. package/fesm2022/exhaustive-ui-core-cascadeselect.mjs.map +1 -1
  22. package/fesm2022/exhaustive-ui-core-confirmdialog.mjs +55 -18
  23. package/fesm2022/exhaustive-ui-core-confirmdialog.mjs.map +1 -1
  24. package/fesm2022/exhaustive-ui-core-confirmpopup.mjs +8 -2
  25. package/fesm2022/exhaustive-ui-core-confirmpopup.mjs.map +1 -1
  26. package/fesm2022/exhaustive-ui-core-contextmenu.mjs +8 -3
  27. package/fesm2022/exhaustive-ui-core-contextmenu.mjs.map +1 -1
  28. package/fesm2022/exhaustive-ui-core-datepicker.mjs +130 -86
  29. package/fesm2022/exhaustive-ui-core-datepicker.mjs.map +1 -1
  30. package/fesm2022/exhaustive-ui-core-dialog.mjs +27 -10
  31. package/fesm2022/exhaustive-ui-core-dialog.mjs.map +1 -1
  32. package/fesm2022/exhaustive-ui-core-dom.mjs +3 -1
  33. package/fesm2022/exhaustive-ui-core-dom.mjs.map +1 -1
  34. package/fesm2022/exhaustive-ui-core-drawer.mjs +11 -2
  35. package/fesm2022/exhaustive-ui-core-drawer.mjs.map +1 -1
  36. package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs +9 -5
  37. package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs.map +1 -1
  38. package/fesm2022/exhaustive-ui-core-fileupload.mjs +2 -2
  39. package/fesm2022/exhaustive-ui-core-fileupload.mjs.map +1 -1
  40. package/fesm2022/exhaustive-ui-core-focustrap.mjs +0 -2
  41. package/fesm2022/exhaustive-ui-core-focustrap.mjs.map +1 -1
  42. package/fesm2022/exhaustive-ui-core-image.mjs +10 -2
  43. package/fesm2022/exhaustive-ui-core-image.mjs.map +1 -1
  44. package/fesm2022/exhaustive-ui-core-inplace.mjs +1 -1
  45. package/fesm2022/exhaustive-ui-core-inplace.mjs.map +1 -1
  46. package/fesm2022/exhaustive-ui-core-inputmask.mjs +29 -5
  47. package/fesm2022/exhaustive-ui-core-inputmask.mjs.map +1 -1
  48. package/fesm2022/exhaustive-ui-core-inputnumber.mjs +29 -2
  49. package/fesm2022/exhaustive-ui-core-inputnumber.mjs.map +1 -1
  50. package/fesm2022/exhaustive-ui-core-inputotp.mjs +15 -3
  51. package/fesm2022/exhaustive-ui-core-inputotp.mjs.map +1 -1
  52. package/fesm2022/exhaustive-ui-core-keyfilter.mjs +27 -17
  53. package/fesm2022/exhaustive-ui-core-keyfilter.mjs.map +1 -1
  54. package/fesm2022/exhaustive-ui-core-listbox.mjs +11 -2
  55. package/fesm2022/exhaustive-ui-core-listbox.mjs.map +1 -1
  56. package/fesm2022/exhaustive-ui-core-menu.mjs +17 -6
  57. package/fesm2022/exhaustive-ui-core-menu.mjs.map +1 -1
  58. package/fesm2022/exhaustive-ui-core-menubar.mjs +57 -13
  59. package/fesm2022/exhaustive-ui-core-menubar.mjs.map +1 -1
  60. package/fesm2022/exhaustive-ui-core-multiselect.mjs +13 -11
  61. package/fesm2022/exhaustive-ui-core-multiselect.mjs.map +1 -1
  62. package/fesm2022/exhaustive-ui-core-orderlist.mjs +10 -4
  63. package/fesm2022/exhaustive-ui-core-orderlist.mjs.map +1 -1
  64. package/fesm2022/exhaustive-ui-core-overlay.mjs +4 -0
  65. package/fesm2022/exhaustive-ui-core-overlay.mjs.map +1 -1
  66. package/fesm2022/exhaustive-ui-core-paginator.mjs +8 -4
  67. package/fesm2022/exhaustive-ui-core-paginator.mjs.map +1 -1
  68. package/fesm2022/exhaustive-ui-core-panel.mjs +7 -9
  69. package/fesm2022/exhaustive-ui-core-panel.mjs.map +1 -1
  70. package/fesm2022/exhaustive-ui-core-panelmenu.mjs +32 -12
  71. package/fesm2022/exhaustive-ui-core-panelmenu.mjs.map +1 -1
  72. package/fesm2022/exhaustive-ui-core-password.mjs +56 -8
  73. package/fesm2022/exhaustive-ui-core-password.mjs.map +1 -1
  74. package/fesm2022/exhaustive-ui-core-picklist.mjs +13 -6
  75. package/fesm2022/exhaustive-ui-core-picklist.mjs.map +1 -1
  76. package/fesm2022/exhaustive-ui-core-progressbar.mjs +3 -3
  77. package/fesm2022/exhaustive-ui-core-progressbar.mjs.map +1 -1
  78. package/fesm2022/exhaustive-ui-core-radiobutton.mjs +6 -1
  79. package/fesm2022/exhaustive-ui-core-radiobutton.mjs.map +1 -1
  80. package/fesm2022/exhaustive-ui-core-scroller.mjs +13 -3
  81. package/fesm2022/exhaustive-ui-core-scroller.mjs.map +1 -1
  82. package/fesm2022/exhaustive-ui-core-scrolltop.mjs +10 -2
  83. package/fesm2022/exhaustive-ui-core-scrolltop.mjs.map +1 -1
  84. package/fesm2022/exhaustive-ui-core-select.mjs +46 -13
  85. package/fesm2022/exhaustive-ui-core-select.mjs.map +1 -1
  86. package/fesm2022/exhaustive-ui-core-selectbutton.mjs +2 -0
  87. package/fesm2022/exhaustive-ui-core-selectbutton.mjs.map +1 -1
  88. package/fesm2022/exhaustive-ui-core-slider.mjs +10 -1
  89. package/fesm2022/exhaustive-ui-core-slider.mjs.map +1 -1
  90. package/fesm2022/exhaustive-ui-core-splitbutton.mjs +8 -4
  91. package/fesm2022/exhaustive-ui-core-splitbutton.mjs.map +1 -1
  92. package/fesm2022/exhaustive-ui-core-splitter.mjs +22 -6
  93. package/fesm2022/exhaustive-ui-core-splitter.mjs.map +1 -1
  94. package/fesm2022/exhaustive-ui-core-stepper.mjs +5 -4
  95. package/fesm2022/exhaustive-ui-core-stepper.mjs.map +1 -1
  96. package/fesm2022/exhaustive-ui-core-table.mjs +241 -102
  97. package/fesm2022/exhaustive-ui-core-table.mjs.map +1 -1
  98. package/fesm2022/exhaustive-ui-core-tabs.mjs +11 -5
  99. package/fesm2022/exhaustive-ui-core-tabs.mjs.map +1 -1
  100. package/fesm2022/exhaustive-ui-core-textarea.mjs +9 -1
  101. package/fesm2022/exhaustive-ui-core-textarea.mjs.map +1 -1
  102. package/fesm2022/exhaustive-ui-core-tieredmenu.mjs +27 -13
  103. package/fesm2022/exhaustive-ui-core-tieredmenu.mjs.map +1 -1
  104. package/fesm2022/exhaustive-ui-core-toast.mjs +3 -0
  105. package/fesm2022/exhaustive-ui-core-toast.mjs.map +1 -1
  106. package/fesm2022/exhaustive-ui-core-tooltip.mjs +5 -1
  107. package/fesm2022/exhaustive-ui-core-tooltip.mjs.map +1 -1
  108. package/fesm2022/exhaustive-ui-core-tree.mjs +24 -5
  109. package/fesm2022/exhaustive-ui-core-tree.mjs.map +1 -1
  110. package/fesm2022/exhaustive-ui-core-treeselect.mjs +36 -1
  111. package/fesm2022/exhaustive-ui-core-treeselect.mjs.map +1 -1
  112. package/fesm2022/exhaustive-ui-core-treetable.mjs +76 -8
  113. package/fesm2022/exhaustive-ui-core-treetable.mjs.map +1 -1
  114. package/fesm2022/exhaustive-ui-core-utils.mjs +2 -1
  115. package/fesm2022/exhaustive-ui-core-utils.mjs.map +1 -1
  116. package/package.json +5 -5
  117. package/schematics/migrations/remove-dead-inputs/migration.js +5 -4
  118. package/schematics/migrations/remove-dead-outputs/migration.js +6 -5
  119. package/schematics/utils/versions.json +8 -8
  120. package/types/exhaustive-ui-core-autocomplete.d.ts +2 -0
  121. package/types/exhaustive-ui-core-autofocus.d.ts +1 -1
  122. package/types/exhaustive-ui-core-button.d.ts +12 -1
  123. package/types/exhaustive-ui-core-confirmdialog.d.ts +14 -3
  124. package/types/exhaustive-ui-core-datepicker.d.ts +7 -1
  125. package/types/exhaustive-ui-core-dialog.d.ts +2 -0
  126. package/types/exhaustive-ui-core-dynamicdialog.d.ts +2 -2
  127. package/types/exhaustive-ui-core-image.d.ts +6 -1
  128. package/types/exhaustive-ui-core-keyfilter.d.ts +1 -0
  129. package/types/exhaustive-ui-core-menu.d.ts +2 -0
  130. package/types/exhaustive-ui-core-menubar.d.ts +5 -0
  131. package/types/exhaustive-ui-core-multiselect.d.ts +1 -1
  132. package/types/exhaustive-ui-core-orderlist.d.ts +6 -1
  133. package/types/exhaustive-ui-core-paginator.d.ts +1 -0
  134. package/types/exhaustive-ui-core-panelmenu.d.ts +5 -0
  135. package/types/exhaustive-ui-core-password.d.ts +2 -0
  136. package/types/exhaustive-ui-core-picklist.d.ts +3 -3
  137. package/types/exhaustive-ui-core-select.d.ts +3 -1
  138. package/types/exhaustive-ui-core-splitbutton.d.ts +2 -1
  139. package/types/exhaustive-ui-core-splitter.d.ts +6 -1
  140. package/types/exhaustive-ui-core-table.d.ts +8 -2
  141. package/types/exhaustive-ui-core-tabs.d.ts +1 -0
  142. package/types/exhaustive-ui-core-tieredmenu.d.ts +2 -0
  143. package/types/exhaustive-ui-core-tree.d.ts +2 -0
  144. package/types/exhaustive-ui-core-treeselect.d.ts +6 -0
  145. package/types/exhaustive-ui-core-treetable.d.ts +22 -2
@@ -182,7 +182,7 @@ const classes = {
182
182
  mask: 'p-datatable-mask p-overlay-mask',
183
183
  loadingIcon: 'p-datatable-loading-icon',
184
184
  header: 'p-datatable-header',
185
- pcPaginator: ({ instance }) => 'p-datatable-paginator-' + instance.paginatorPosition(),
185
+ pcPaginator: ({ position }) => 'p-datatable-paginator-' + position,
186
186
  tableContainer: 'p-datatable-table-container',
187
187
  table: ({ instance }) => [
188
188
  'p-datatable-table',
@@ -269,7 +269,7 @@ const classes = {
269
269
  rowEditorCancel: 'p-datatable-row-editor-cancel',
270
270
  frozenColumn: ({ instance }) => ({
271
271
  'p-datatable-frozen-column': instance.frozen(),
272
- 'p-datatable-frozen-column-left': instance.alignFrozenLeft === 'left'
272
+ 'p-datatable-frozen-column-left': instance.alignFrozen() === 'left'
273
273
  }),
274
274
  contextMenuRowSelected: ({ instance }) => ({
275
275
  'p-datatable-contextmenu-row-selected': instance.selected()
@@ -1359,6 +1359,9 @@ class Table extends BaseComponent {
1359
1359
  ...(ngDevMode ? [{ debugName: "editingCellField" }] : /* istanbul ignore next */ []));
1360
1360
  editingCellRowIndex = signal(undefined, /* @ts-ignore */
1361
1361
  ...(ngDevMode ? [{ debugName: "editingCellRowIndex" }] : /* istanbul ignore next */ []));
1362
+ /** Value of the edited field when the cell editor opened, restored when the edit is cancelled. */
1363
+ editingCellOriginalValue = signal(undefined, /* @ts-ignore */
1364
+ ...(ngDevMode ? [{ debugName: "editingCellOriginalValue" }] : /* istanbul ignore next */ []));
1362
1365
  selfClick = signal(undefined, /* @ts-ignore */
1363
1366
  ...(ngDevMode ? [{ debugName: "selfClick" }] : /* istanbul ignore next */ []));
1364
1367
  documentEditListener = signal(undefined, /* @ts-ignore */
@@ -1429,6 +1432,8 @@ class Table extends BaseComponent {
1429
1432
  this.restoreState();
1430
1433
  }
1431
1434
  if (!this.lazy()) {
1435
+ // re-applying the filters to a new value must not move back to the first page
1436
+ const first = this.first();
1432
1437
  if (this.sortMode() == 'single' && (this._sortField() || this.groupRowsBy()))
1433
1438
  this.sortSingle();
1434
1439
  else if (this.sortMode() == 'multiple' && (this._multiSortMeta() || this.groupRowsBy()))
@@ -1436,6 +1441,15 @@ class Table extends BaseComponent {
1436
1441
  else if (this.hasFilter())
1437
1442
  //sort already filters
1438
1443
  this._filter();
1444
+ if (this.hasFilter()) {
1445
+ this.first.set(first);
1446
+ }
1447
+ // a shorter value can leave the current page empty: move back to the last page
1448
+ const rows = this.rows();
1449
+ const totalRecords = this._totalRecords();
1450
+ if (this.paginator() && rows && totalRecords > 0 && (this.first() ?? 0) >= totalRecords) {
1451
+ this.first.set(Math.floor((totalRecords - 1) / rows) * rows);
1452
+ }
1439
1453
  }
1440
1454
  this.tableService.onValueChange(value);
1441
1455
  });
@@ -1644,7 +1658,7 @@ class Table extends BaseComponent {
1644
1658
  });
1645
1659
  }
1646
1660
  else {
1647
- this._value().sort((data1, data2) => {
1661
+ const sortedValue = [...this._value()].sort((data1, data2) => {
1648
1662
  let value1 = ObjectUtils.resolveFieldData(data1, field);
1649
1663
  let value2 = ObjectUtils.resolveFieldData(data2, field);
1650
1664
  let result = null;
@@ -1660,7 +1674,7 @@ class Table extends BaseComponent {
1660
1674
  result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
1661
1675
  return order * (result || 0);
1662
1676
  });
1663
- this._value.set([...this._value()]);
1677
+ this._value.set(sortedValue);
1664
1678
  }
1665
1679
  if (this.hasFilter()) {
1666
1680
  this._filter();
@@ -1695,10 +1709,9 @@ class Table extends BaseComponent {
1695
1709
  });
1696
1710
  }
1697
1711
  else {
1698
- this._value().sort((data1, data2) => {
1712
+ this._value.set([...this._value()].sort((data1, data2) => {
1699
1713
  return this.multisortField(data1, data2, this._multiSortMeta(), 0);
1700
- });
1701
- this._value.set([...this._value()]);
1714
+ }));
1702
1715
  }
1703
1716
  if (this.hasFilter()) {
1704
1717
  this._filter();
@@ -2156,10 +2169,15 @@ class Table extends BaseComponent {
2156
2169
  if (this.filterTimeout()) {
2157
2170
  clearTimeout(this.filterTimeout());
2158
2171
  }
2159
- if (!this.isFilterBlank(value)) {
2172
+ const fieldFilter = this._filters()[field];
2173
+ if (Array.isArray(fieldFilter)) {
2174
+ // a menu p-columnFilter owns this field and reads its filter as a list of constraints
2175
+ this._filters()[field] = [{ value: this.isFilterBlank(value) ? null : value, matchMode: matchMode, operator: fieldFilter[0]?.operator ?? FilterOperator.AND }];
2176
+ }
2177
+ else if (!this.isFilterBlank(value)) {
2160
2178
  this._filters()[field] = { value: value, matchMode: matchMode };
2161
2179
  }
2162
- else if (this._filters()[field]) {
2180
+ else if (fieldFilter) {
2163
2181
  delete this._filters()[field];
2164
2182
  }
2165
2183
  this.filterTimeout.set(setTimeout(() => {
@@ -2232,10 +2250,13 @@ class Table extends BaseComponent {
2232
2250
  }
2233
2251
  }
2234
2252
  if (this._filters()['global'] && !globalMatch && globalFilterFieldsArray) {
2253
+ // a negated match mode only matches when no field contains the term
2254
+ const globalMatchMode = this._filters()['global'].matchMode;
2255
+ const negated = globalMatchMode === FilterMatchMode.NOT_CONTAINS || globalMatchMode === FilterMatchMode.NOT_EQUALS;
2235
2256
  for (let j = 0; j < globalFilterFieldsArray.length; j++) {
2236
2257
  let globalFilterField = globalFilterFieldsArray[j].field || globalFilterFieldsArray[j];
2237
2258
  globalMatch = this.filterService.filters[this._filters()['global'].matchMode](ObjectUtils.resolveFieldData(this._value()[i], globalFilterField), this._filters()['global'].value, this.filterLocale());
2238
- if (globalMatch) {
2259
+ if (negated ? !globalMatch : globalMatch) {
2239
2260
  break;
2240
2261
  }
2241
2262
  }
@@ -2517,7 +2538,17 @@ class Table extends BaseComponent {
2517
2538
  }
2518
2539
  else {
2519
2540
  if (this.rowExpandMode() === 'single') {
2541
+ const expandedKeys = Object.keys(this._expandedRowKeys());
2520
2542
  this._expandedRowKeys.set({});
2543
+ for (const expandedKey of expandedKeys) {
2544
+ const collapsedRowData = (this._value() || []).find((data) => String(ObjectUtils.resolveFieldData(data, this.groupRowsBy() ? this.groupRowsBy() : this.dataKey())) === expandedKey);
2545
+ if (collapsedRowData) {
2546
+ this.onRowCollapse.emit({
2547
+ originalEvent: event,
2548
+ data: collapsedRowData
2549
+ });
2550
+ }
2551
+ }
2521
2552
  }
2522
2553
  this._expandedRowKeys()[dataKeyValue] = true;
2523
2554
  this.onRowExpand.emit({
@@ -2608,7 +2639,8 @@ class Table extends BaseComponent {
2608
2639
  _totalTableWidth() {
2609
2640
  let widths = [];
2610
2641
  const tableHead = DomHandler.findSingle(this.el.nativeElement, '[data-pc-section="thead"]');
2611
- let headers = DomHandler.find(tableHead, 'tr > th');
2642
+ // only the last header row holds one cell per column: the rows above it may group columns (colspan)
2643
+ let headers = DomHandler.find(tableHead, 'tr:last-child > th');
2612
2644
  headers.forEach((header) => widths.push(DomHandler.getOuterWidth(header)));
2613
2645
  return widths;
2614
2646
  }
@@ -2629,17 +2661,19 @@ class Table extends BaseComponent {
2629
2661
  let targetLeft = dropHeaderOffset.left - containerOffset.left;
2630
2662
  let targetTop = containerOffset.top - dropHeaderOffset.top;
2631
2663
  let columnCenter = dropHeaderOffset.left + dropHeader.offsetWidth / 2;
2664
+ // in RTL the next column is on the left: the left half drops after, the right half before
2665
+ const isRTL = getComputedStyle(this.el?.nativeElement ?? document.documentElement).direction === 'rtl';
2632
2666
  this.reorderIndicatorUpViewChild().nativeElement.style.top = dropHeaderOffset.top - containerOffset.top - (this.reorderIconHeight() - 1) + 'px';
2633
2667
  this.reorderIndicatorDownViewChild().nativeElement.style.top = dropHeaderOffset.top - containerOffset.top + dropHeader.offsetHeight + 'px';
2634
2668
  if (event.pageX > columnCenter) {
2635
2669
  this.reorderIndicatorUpViewChild().nativeElement.style.left = targetLeft + dropHeader.offsetWidth - Math.ceil(this.reorderIconWidth() / 2) + 'px';
2636
2670
  this.reorderIndicatorDownViewChild().nativeElement.style.left = targetLeft + dropHeader.offsetWidth - Math.ceil(this.reorderIconWidth() / 2) + 'px';
2637
- this.dropPosition.set(1);
2671
+ this.dropPosition.set(isRTL ? -1 : 1);
2638
2672
  }
2639
2673
  else {
2640
2674
  this.reorderIndicatorUpViewChild().nativeElement.style.left = targetLeft - Math.ceil(this.reorderIconWidth() / 2) + 'px';
2641
2675
  this.reorderIndicatorDownViewChild().nativeElement.style.left = targetLeft - Math.ceil(this.reorderIconWidth() / 2) + 'px';
2642
- this.dropPosition.set(-1);
2676
+ this.dropPosition.set(isRTL ? 1 : -1);
2643
2677
  }
2644
2678
  this.reorderIndicatorUpViewChild().nativeElement.style.display = 'block';
2645
2679
  this.reorderIndicatorDownViewChild().nativeElement.style.display = 'block';
@@ -2657,8 +2691,12 @@ class Table extends BaseComponent {
2657
2691
  onColumnDrop(event, dropColumn) {
2658
2692
  event.preventDefault();
2659
2693
  if (this.draggedColumn()) {
2660
- let dragIndex = DomHandler.indexWithinGroup(this.draggedColumn(), 'preorderablecolumn');
2661
- let dropIndex = DomHandler.indexWithinGroup(dropColumn, 'preorderablecolumn');
2694
+ // when the header row has one cell per column, index the cells themselves so that the
2695
+ // non-reorderable columns (e.g. frozen ones) keep their place in _columns
2696
+ const headerCells = this.draggedColumn().parentElement ? DomHandler.find(this.draggedColumn().parentElement, ':scope > th') : [];
2697
+ const indexByCell = !!this._columns() && this._columns().length === headerCells.length;
2698
+ let dragIndex = indexByCell ? DomHandler.index(this.draggedColumn()) : DomHandler.indexWithinGroup(this.draggedColumn(), 'preorderablecolumn');
2699
+ let dropIndex = indexByCell ? DomHandler.index(dropColumn) : DomHandler.indexWithinGroup(dropColumn, 'preorderablecolumn');
2662
2700
  let allowDrop = dragIndex != dropIndex;
2663
2701
  if (allowDrop && ((dropIndex - dragIndex == 1 && this.dropPosition() === -1) || (dragIndex - dropIndex == 1 && this.dropPosition() === 1))) {
2664
2702
  allowDrop = false;
@@ -2684,10 +2722,16 @@ class Table extends BaseComponent {
2684
2722
  });
2685
2723
  }
2686
2724
  }
2687
- if (this.resizableColumns() && this.resizeColumnElement()) {
2688
- let width = this.columnResizeMode() === 'expand' ? this._initialColWidths() : this._totalTableWidth();
2689
- ObjectUtils.reorderArray(width, dragIndex + 1, dropIndex + 1);
2690
- this.updateStyleElement(width, dragIndex, 0, 0);
2725
+ if (allowDrop && this.resizableColumns() && this.resizeColumnElement()) {
2726
+ // The widths are indexed by header cell, the drag/drop indexes by reorderable column only.
2727
+ const offset = DomHandler.index(this.draggedColumn()) - dragIndex;
2728
+ const width = [...((this.columnResizeMode() === 'expand' ? this._initialColWidths() : undefined) ?? this._totalTableWidth())];
2729
+ ObjectUtils.reorderArray(width, dragIndex + offset, dropIndex + offset);
2730
+ if (this.columnResizeMode() === 'expand') {
2731
+ this._initialColWidths.set(width);
2732
+ }
2733
+ // Keep every width as measured: no column is resized by a reorder.
2734
+ this.updateStyleElement(width, -1, 0, null);
2691
2735
  }
2692
2736
  this.reorderIndicatorUpViewChild().nativeElement.style.display = 'none';
2693
2737
  this.reorderIndicatorDownViewChild().nativeElement.style.display = 'none';
@@ -2855,10 +2899,10 @@ class Table extends BaseComponent {
2855
2899
  if (stateString) {
2856
2900
  let state = JSON.parse(stateString, reviver);
2857
2901
  if (this.paginator()) {
2858
- if (this.first() !== undefined) {
2902
+ if (this.first() !== undefined && state.first !== undefined) {
2859
2903
  this.first.set(state.first);
2860
2904
  }
2861
- if (this.rows() !== undefined) {
2905
+ if (this.rows() !== undefined && state.rows !== undefined) {
2862
2906
  this.rows.set(state.rows);
2863
2907
  }
2864
2908
  }
@@ -3095,7 +3139,7 @@ class Table extends BaseComponent {
3095
3139
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3096
3140
  [showJumpToPageInput]="showJumpToPageInput()"
3097
3141
  [showPageLinks]="showPageLinks()"
3098
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3142
+ [class]="cn(cx('pcPaginator', { position: 'top' }), paginatorStyleClass())"
3099
3143
  [locale]="paginatorLocale()"
3100
3144
  [pt]="ptm('pcPaginator')"
3101
3145
  [unstyled]="unstyled()"
@@ -3259,7 +3303,7 @@ class Table extends BaseComponent {
3259
3303
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3260
3304
  [showJumpToPageInput]="showJumpToPageInput()"
3261
3305
  [showPageLinks]="showPageLinks()"
3262
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3306
+ [class]="cn(cx('pcPaginator', { position: 'bottom' }), paginatorStyleClass())"
3263
3307
  [locale]="paginatorLocale()"
3264
3308
  [pt]="ptm('pcPaginator')"
3265
3309
  [unstyled]="unstyled()"
@@ -3367,7 +3411,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3367
3411
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3368
3412
  [showJumpToPageInput]="showJumpToPageInput()"
3369
3413
  [showPageLinks]="showPageLinks()"
3370
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3414
+ [class]="cn(cx('pcPaginator', { position: 'top' }), paginatorStyleClass())"
3371
3415
  [locale]="paginatorLocale()"
3372
3416
  [pt]="ptm('pcPaginator')"
3373
3417
  [unstyled]="unstyled()"
@@ -3531,7 +3575,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3531
3575
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3532
3576
  [showJumpToPageInput]="showJumpToPageInput()"
3533
3577
  [showPageLinks]="showPageLinks()"
3534
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3578
+ [class]="cn(cx('pcPaginator', { position: 'bottom' }), paginatorStyleClass())"
3535
3579
  [locale]="paginatorLocale()"
3536
3580
  [pt]="ptm('pcPaginator')"
3537
3581
  [unstyled]="unstyled()"
@@ -3715,6 +3759,11 @@ class TableBody extends BaseComponent {
3715
3759
  const getItemOptions = this.getScrollerOption('getItemOptions');
3716
3760
  return getItemOptions ? getItemOptions(index).index : index;
3717
3761
  }
3762
+ // the group header/footer checks compare a row with its neighbours in value(); with virtual scroll
3763
+ // value() only holds the rendered slice, so the index must stay relative to that slice
3764
+ getGroupRowIndex(rowIndex) {
3765
+ return this.dataTable.virtualScroll() ? rowIndex + (this.dataTable.first() || 0) : this.getRowIndex(rowIndex);
3766
+ }
3718
3767
  dataP = computed(() => {
3719
3768
  return this.cn({
3720
3769
  hoverable: this.dataTable.rowHover() || this.dataTable.selectionMode(),
@@ -3726,7 +3775,7 @@ class TableBody extends BaseComponent {
3726
3775
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: TableBody, isStandalone: false, selector: "[pTableBody]", inputs: { columns: { classPropertyName: "columns", publicName: "pTableBody", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "pTableBodyTemplate", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, frozen: { classPropertyName: "frozen", publicName: "frozen", isSignal: true, isRequired: false, transformFunction: null }, frozenRows: { classPropertyName: "frozenRows", publicName: "frozenRows", isSignal: true, isRequired: false, transformFunction: null }, scrollerOptions: { classPropertyName: "scrollerOptions", publicName: "scrollerOptions", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-p": "dataP()" } }, usesInheritance: true, ngImport: i0, template: `
3727
3776
  @if (!dataTable.expandedRowTemplate() && !dataTable._expandedRowTemplate()) {
3728
3777
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3729
- @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3778
+ @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getGroupRowIndex(rowIndex))) {
3730
3779
  <ng-container role="row">
3731
3780
  <ng-container
3732
3781
  *ngTemplateOutlet="
@@ -3772,7 +3821,7 @@ class TableBody extends BaseComponent {
3772
3821
  "
3773
3822
  ></ng-container>
3774
3823
  }
3775
- @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getRowIndex(rowIndex))) {
3824
+ @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getGroupRowIndex(rowIndex))) {
3776
3825
  <ng-container role="row">
3777
3826
  <ng-container
3778
3827
  *ngTemplateOutlet="
@@ -3792,21 +3841,6 @@ class TableBody extends BaseComponent {
3792
3841
  }
3793
3842
  @if ((dataTable.expandedRowTemplate() || dataTable._expandedRowTemplate()) && !(frozen() && (dataTable.frozenExpandedRowTemplate() || dataTable._frozenExpandedRowTemplate()))) {
3794
3843
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3795
- @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
3796
- <ng-container
3797
- *ngTemplateOutlet="
3798
- template();
3799
- context: {
3800
- $implicit: rowData,
3801
- rowIndex: getRowIndex(rowIndex),
3802
- columns: columns(),
3803
- expanded: dataTable.isRowExpanded(rowData),
3804
- editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
3805
- frozen: frozen()
3806
- }
3807
- "
3808
- ></ng-container>
3809
- }
3810
3844
  @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3811
3845
  <ng-container role="row">
3812
3846
  <ng-container
@@ -3824,6 +3858,21 @@ class TableBody extends BaseComponent {
3824
3858
  ></ng-container>
3825
3859
  </ng-container>
3826
3860
  }
3861
+ @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
3862
+ <ng-container
3863
+ *ngTemplateOutlet="
3864
+ rowData ? template() : dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate();
3865
+ context: {
3866
+ $implicit: rowData,
3867
+ rowIndex: getRowIndex(rowIndex),
3868
+ columns: columns(),
3869
+ expanded: dataTable.isRowExpanded(rowData),
3870
+ editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
3871
+ frozen: frozen()
3872
+ }
3873
+ "
3874
+ ></ng-container>
3875
+ }
3827
3876
  @if (dataTable.isRowExpanded(rowData)) {
3828
3877
  <ng-container
3829
3878
  *ngTemplateOutlet="
@@ -3902,7 +3951,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3902
3951
  template: `
3903
3952
  @if (!dataTable.expandedRowTemplate() && !dataTable._expandedRowTemplate()) {
3904
3953
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3905
- @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3954
+ @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getGroupRowIndex(rowIndex))) {
3906
3955
  <ng-container role="row">
3907
3956
  <ng-container
3908
3957
  *ngTemplateOutlet="
@@ -3948,7 +3997,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3948
3997
  "
3949
3998
  ></ng-container>
3950
3999
  }
3951
- @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getRowIndex(rowIndex))) {
4000
+ @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getGroupRowIndex(rowIndex))) {
3952
4001
  <ng-container role="row">
3953
4002
  <ng-container
3954
4003
  *ngTemplateOutlet="
@@ -3968,21 +4017,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3968
4017
  }
3969
4018
  @if ((dataTable.expandedRowTemplate() || dataTable._expandedRowTemplate()) && !(frozen() && (dataTable.frozenExpandedRowTemplate() || dataTable._frozenExpandedRowTemplate()))) {
3970
4019
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3971
- @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
3972
- <ng-container
3973
- *ngTemplateOutlet="
3974
- template();
3975
- context: {
3976
- $implicit: rowData,
3977
- rowIndex: getRowIndex(rowIndex),
3978
- columns: columns(),
3979
- expanded: dataTable.isRowExpanded(rowData),
3980
- editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
3981
- frozen: frozen()
3982
- }
3983
- "
3984
- ></ng-container>
3985
- }
3986
4020
  @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3987
4021
  <ng-container role="row">
3988
4022
  <ng-container
@@ -4000,6 +4034,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4000
4034
  ></ng-container>
4001
4035
  </ng-container>
4002
4036
  }
4037
+ @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
4038
+ <ng-container
4039
+ *ngTemplateOutlet="
4040
+ rowData ? template() : dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate();
4041
+ context: {
4042
+ $implicit: rowData,
4043
+ rowIndex: getRowIndex(rowIndex),
4044
+ columns: columns(),
4045
+ expanded: dataTable.isRowExpanded(rowData),
4046
+ editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
4047
+ frozen: frozen()
4048
+ }
4049
+ "
4050
+ ></ng-container>
4051
+ }
4003
4052
  @if (dataTable.isRowExpanded(rowData)) {
4004
4053
  <ng-container
4005
4054
  *ngTemplateOutlet="
@@ -4159,24 +4208,30 @@ class FrozenColumn extends BaseComponent {
4159
4208
  }, time);
4160
4209
  }
4161
4210
  updateStickyPosition() {
4162
- if (this.frozen()) {
4211
+ if (this.frozen() && isPlatformBrowser(this.platformId)) {
4212
+ // alignFrozen is logical: in RTL the start (left alignment) is the physical right side
4213
+ const isRTL = this.document.defaultView?.getComputedStyle(this.el.nativeElement).direction === 'rtl';
4214
+ const startSide = isRTL ? 'right' : 'left';
4215
+ const endSide = isRTL ? 'left' : 'right';
4163
4216
  if (this.alignFrozen() === 'right') {
4164
- let right = 0;
4217
+ let end = 0;
4165
4218
  let sibling = this.el.nativeElement.nextElementSibling;
4166
4219
  while (sibling) {
4167
- right += DomHandler.getOuterWidth(sibling);
4220
+ end += this.getFrozenWidth(sibling);
4168
4221
  sibling = sibling.nextElementSibling;
4169
4222
  }
4170
- this.el.nativeElement.style.right = right + 'px';
4223
+ this.el.nativeElement.style[endSide] = end + 'px';
4224
+ this.el.nativeElement.style[startSide] = '';
4171
4225
  }
4172
4226
  else {
4173
- let left = 0;
4227
+ let start = 0;
4174
4228
  let sibling = this.el.nativeElement.previousElementSibling;
4175
4229
  while (sibling) {
4176
- left += DomHandler.getOuterWidth(sibling);
4230
+ start += this.getFrozenWidth(sibling);
4177
4231
  sibling = sibling.previousElementSibling;
4178
4232
  }
4179
- this.el.nativeElement.style.left = left + 'px';
4233
+ this.el.nativeElement.style[startSide] = start + 'px';
4234
+ this.el.nativeElement.style[endSide] = '';
4180
4235
  }
4181
4236
  const filterRow = this.el.nativeElement?.parentElement?.nextElementSibling;
4182
4237
  if (filterRow) {
@@ -4188,12 +4243,16 @@ class FrozenColumn extends BaseComponent {
4188
4243
  }
4189
4244
  }
4190
4245
  }
4246
+ // only the frozen (sticky) cells stay between a frozen cell and the edge: the others scroll away
4247
+ getFrozenWidth(cell) {
4248
+ return cell.getAttribute('data-p-frozen-column') === 'true' ? DomHandler.getOuterWidth(cell) : 0;
4249
+ }
4191
4250
  onDestroy() {
4192
4251
  this.unbindResizeListener();
4193
4252
  this.resizeObserver()?.disconnect();
4194
4253
  }
4195
4254
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FrozenColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4196
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: FrozenColumn, isStandalone: false, selector: "[pFrozenColumn]", inputs: { frozen: { classPropertyName: "frozen", publicName: "frozen", isSignal: true, isRequired: false, transformFunction: null }, alignFrozen: { classPropertyName: "alignFrozen", publicName: "alignFrozen", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "cx(\"frozenColumn\")" } }, providers: [TableStyle], usesInheritance: true, ngImport: i0 });
4255
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: FrozenColumn, isStandalone: false, selector: "[pFrozenColumn]", inputs: { frozen: { classPropertyName: "frozen", publicName: "frozen", isSignal: true, isRequired: false, transformFunction: null }, alignFrozen: { classPropertyName: "alignFrozen", publicName: "alignFrozen", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "cx(\"frozenColumn\")", "attr.data-p-frozen-column": "frozen()" } }, providers: [TableStyle], usesInheritance: true, ngImport: i0 });
4197
4256
  }
4198
4257
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FrozenColumn, decorators: [{
4199
4258
  type: Directive,
@@ -4201,7 +4260,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4201
4260
  selector: '[pFrozenColumn]',
4202
4261
  standalone: false,
4203
4262
  host: {
4204
- '[class]': 'cx("frozenColumn")'
4263
+ '[class]': 'cx("frozenColumn")',
4264
+ '[attr.data-p-frozen-column]': 'frozen()'
4205
4265
  },
4206
4266
  providers: [TableStyle]
4207
4267
  }]
@@ -4274,7 +4334,7 @@ class SortableColumn extends BaseComponent {
4274
4334
  }
4275
4335
  }
4276
4336
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: SortableColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4277
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: SortableColumn, isStandalone: false, selector: "[pSortableColumn]", inputs: { field: { classPropertyName: "field", publicName: "pSortableColumn", isSignal: true, isRequired: false, transformFunction: null }, pSortableColumnDisabled: { classPropertyName: "pSortableColumnDisabled", publicName: "pSortableColumnDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "columnheader" }, listeners: { "click": "onClick($event)", "keydown.space": "onEnterKey($event)", "keydown.enter": "onEnterKey($event)" }, properties: { "class": "cx('sortableColumn')", "tabindex": "isEnabled() ? \"0\" : null", "attr.aria-sort": "sortOrder()" } }, providers: [TableStyle], usesInheritance: true, ngImport: i0 });
4337
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: SortableColumn, isStandalone: false, selector: "[pSortableColumn]", inputs: { field: { classPropertyName: "field", publicName: "pSortableColumn", isSignal: true, isRequired: false, transformFunction: null }, pSortableColumnDisabled: { classPropertyName: "pSortableColumnDisabled", publicName: "pSortableColumnDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)", "keydown.space": "onEnterKey($event)", "keydown.enter": "onEnterKey($event)", "keydown.meta.space": "onEnterKey($event)", "keydown.meta.enter": "onEnterKey($event)", "keydown.control.space": "onEnterKey($event)", "keydown.control.enter": "onEnterKey($event)" }, properties: { "class": "cx('sortableColumn')", "tabindex": "isEnabled() ? \"0\" : null", "attr.role": "role", "attr.aria-sort": "sortOrder()" } }, providers: [TableStyle], usesInheritance: true, ngImport: i0 });
4278
4338
  }
4279
4339
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: SortableColumn, decorators: [{
4280
4340
  type: Directive,
@@ -4284,7 +4344,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4284
4344
  host: {
4285
4345
  '[class]': "cx('sortableColumn')",
4286
4346
  '[tabindex]': 'isEnabled() ? "0" : null',
4287
- role: 'columnheader',
4347
+ '[attr.role]': 'role',
4288
4348
  '[attr.aria-sort]': 'sortOrder()'
4289
4349
  },
4290
4350
  providers: [TableStyle]
@@ -4298,6 +4358,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4298
4358
  }, {
4299
4359
  type: HostListener,
4300
4360
  args: ['keydown.enter', ['$event']]
4361
+ }, {
4362
+ type: HostListener,
4363
+ args: ['keydown.meta.space', ['$event']]
4364
+ }, {
4365
+ type: HostListener,
4366
+ args: ['keydown.meta.enter', ['$event']]
4367
+ }, {
4368
+ type: HostListener,
4369
+ args: ['keydown.control.space', ['$event']]
4370
+ }, {
4371
+ type: HostListener,
4372
+ args: ['keydown.control.enter', ['$event']]
4301
4373
  }] } });
4302
4374
  class SortIcon extends BaseComponent {
4303
4375
  dataTable = inject(Table);
@@ -4358,13 +4430,13 @@ class SortIcon extends BaseComponent {
4358
4430
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: SortIcon, isStandalone: false, selector: "p-sortIcon", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: false, transformFunction: null } }, providers: [TableStyle], usesInheritance: true, ngImport: i0, template: `
4359
4431
  @if (!(dataTable.sortIconTemplate() || dataTable._sortIconTemplate())) {
4360
4432
  @if (sortOrder() === 0) {
4361
- <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" />
4433
+ <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4362
4434
  }
4363
4435
  @if (sortOrder() === 1) {
4364
- <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" />
4436
+ <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4365
4437
  }
4366
4438
  @if (sortOrder() === -1) {
4367
- <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" />
4439
+ <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4368
4440
  }
4369
4441
  }
4370
4442
  @if (dataTable.sortIconTemplate() || dataTable._sortIconTemplate()) {
@@ -4385,13 +4457,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4385
4457
  template: `
4386
4458
  @if (!(dataTable.sortIconTemplate() || dataTable._sortIconTemplate())) {
4387
4459
  @if (sortOrder() === 0) {
4388
- <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" />
4460
+ <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4389
4461
  }
4390
4462
  @if (sortOrder() === 1) {
4391
- <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" />
4463
+ <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4392
4464
  }
4393
4465
  @if (sortOrder() === -1) {
4394
- <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" />
4466
+ <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4395
4467
  }
4396
4468
  }
4397
4469
  @if (dataTable.sortIconTemplate() || dataTable._sortIconTemplate()) {
@@ -4428,7 +4500,8 @@ class SelectableRow extends BaseComponent {
4428
4500
  }
4429
4501
  setRowTabIndex() {
4430
4502
  if (this.dataTable.selectionMode() === 'single' || this.dataTable.selectionMode() === 'multiple') {
4431
- return !this.dataTable.selection() ? 0 : this.dataTable.anchorRowIndex() === this.index() ? 0 : -1;
4503
+ // sort, filter and page changes reset the anchor row to null: keep the rows reachable by Tab
4504
+ return !this.dataTable.selection() || this.dataTable.anchorRowIndex() == null ? 0 : this.dataTable.anchorRowIndex() === this.index() ? 0 : -1;
4432
4505
  }
4433
4506
  }
4434
4507
  onInit() {
@@ -4937,7 +5010,7 @@ class ReorderableColumn extends BaseComponent {
4937
5010
  }
4938
5011
  }
4939
5012
  onMouseDown(event) {
4940
- if (event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA' || findSingle(event.target, '[data-pc-column-resizer="true"]'))
5013
+ if (event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA' || event.target.closest?.('[data-pc-column-resizer="true"]'))
4941
5014
  this.el.nativeElement.draggable = false;
4942
5015
  else
4943
5016
  this.el.nativeElement.draggable = true;
@@ -5035,6 +5108,7 @@ class EditableColumn extends BaseComponent {
5035
5108
  }
5036
5109
  openCell() {
5037
5110
  this.dataTable.updateEditingCell(this.el.nativeElement, this.data(), this.field(), this.rowIndex());
5111
+ this.dataTable.editingCellOriginalValue.set(ObjectUtils.resolveFieldData(this.data(), this.field()));
5038
5112
  !this.$unstyled() && DomHandler.addClass(this.el.nativeElement, 'p-cell-editing');
5039
5113
  setAttribute(this.el.nativeElement, 'data-p-cell-editing', 'true');
5040
5114
  this.dataTable.onEditInit.emit({
@@ -5059,6 +5133,9 @@ class EditableColumn extends BaseComponent {
5059
5133
  this.dataTable.overlaySubscription.set(this.dataTable.overlayService.clickObservable.subscribe(this.overlayEventListener()));
5060
5134
  }
5061
5135
  closeEditingCell(completed, event) {
5136
+ if (!completed && this.dataTable.editingCellData() && this.dataTable.editingCellField()) {
5137
+ this.dataTable.editingCellData()[this.dataTable.editingCellField()] = this.dataTable.editingCellOriginalValue();
5138
+ }
5062
5139
  const eventData = {
5063
5140
  field: this.dataTable.editingCellField(),
5064
5141
  data: this.dataTable.editingCellData(),
@@ -5070,11 +5147,6 @@ class EditableColumn extends BaseComponent {
5070
5147
  }
5071
5148
  else {
5072
5149
  this.dataTable.onEditCancel.emit(eventData);
5073
- this.dataTable._value().forEach((element) => {
5074
- if (element[this.dataTable.editingCellField()] === this.data()) {
5075
- element[this.dataTable.editingCellField()] = this.dataTable.editingCellData();
5076
- }
5077
- });
5078
5150
  }
5079
5151
  !this.$unstyled() && DomHandler.removeClass(this.dataTable.editingCell(), 'p-cell-editing');
5080
5152
  setAttribute(this.el.nativeElement, 'data-p-cell-editing', 'false');
@@ -5088,8 +5160,13 @@ class EditableColumn extends BaseComponent {
5088
5160
  }
5089
5161
  onEnterKeyDown(event) {
5090
5162
  if (this.isEnabled() && !event.shiftKey) {
5091
- if (this.dataTable.isEditingCellValid()) {
5163
+ if (!this.dataTable.editingCell()) {
5164
+ // keyboard alternative to the click that opens the editor of a focused cell
5165
+ this.openCell();
5166
+ }
5167
+ else if (this.dataTable.isEditingCellValid()) {
5092
5168
  this.closeEditingCell(true, event);
5169
+ this.el.nativeElement.focus();
5093
5170
  }
5094
5171
  event.preventDefault();
5095
5172
  }
@@ -5106,6 +5183,7 @@ class EditableColumn extends BaseComponent {
5106
5183
  if (this.isEnabled()) {
5107
5184
  if (this.dataTable.isEditingCellValid()) {
5108
5185
  this.closeEditingCell(false, event);
5186
+ this.el.nativeElement.focus();
5109
5187
  }
5110
5188
  event.preventDefault();
5111
5189
  }
@@ -5279,7 +5357,7 @@ class EditableColumn extends BaseComponent {
5279
5357
  }
5280
5358
  }
5281
5359
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: EditableColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
5282
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: EditableColumn, isStandalone: false, selector: "[pEditableColumn]", inputs: { data: { classPropertyName: "data", publicName: "pEditableColumn", isSignal: true, isRequired: false, transformFunction: null }, field: { classPropertyName: "field", publicName: "pEditableColumnField", isSignal: true, isRequired: false, transformFunction: null }, rowIndex: { classPropertyName: "rowIndex", publicName: "pEditableColumnRowIndex", isSignal: true, isRequired: false, transformFunction: null }, pEditableColumnDisabled: { classPropertyName: "pEditableColumnDisabled", publicName: "pEditableColumnDisabled", isSignal: true, isRequired: false, transformFunction: null }, pFocusCellSelector: { classPropertyName: "pFocusCellSelector", publicName: "pFocusCellSelector", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)", "keydown.enter": "onEnterKeyDown($event)", "keydown.tab": "onShiftKeyDown($event)", "keydown.escape": "onEscapeKeyDown($event)", "keydown.shift.tab": "onShiftKeyDown($event)", "keydown.meta.tab": "onShiftKeyDown($event)", "keydown.arrowdown": "onArrowDown($event)", "keydown.arrowup": "onArrowUp($event)", "keydown.arrowleft": "onArrowLeft($event)", "keydown.arrowright": "onArrowRight($event)" }, properties: { "attr.data-p-editable-column": "true" } }, usesInheritance: true, ngImport: i0 });
5360
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: EditableColumn, isStandalone: false, selector: "[pEditableColumn]", inputs: { data: { classPropertyName: "data", publicName: "pEditableColumn", isSignal: true, isRequired: false, transformFunction: null }, field: { classPropertyName: "field", publicName: "pEditableColumnField", isSignal: true, isRequired: false, transformFunction: null }, rowIndex: { classPropertyName: "rowIndex", publicName: "pEditableColumnRowIndex", isSignal: true, isRequired: false, transformFunction: null }, pEditableColumnDisabled: { classPropertyName: "pEditableColumnDisabled", publicName: "pEditableColumnDisabled", isSignal: true, isRequired: false, transformFunction: null }, pFocusCellSelector: { classPropertyName: "pFocusCellSelector", publicName: "pFocusCellSelector", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)", "keydown.enter": "onEnterKeyDown($event)", "keydown.tab": "onShiftKeyDown($event)", "keydown.escape": "onEscapeKeyDown($event)", "keydown.shift.tab": "onShiftKeyDown($event)", "keydown.meta.tab": "onShiftKeyDown($event)", "keydown.arrowdown": "onArrowDown($event)", "keydown.arrowup": "onArrowUp($event)", "keydown.arrowleft": "onArrowLeft($event)", "keydown.arrowright": "onArrowRight($event)" }, properties: { "attr.data-p-editable-column": "true", "attr.tabindex": "isEnabled() ? \"0\" : null" } }, usesInheritance: true, ngImport: i0 });
5283
5361
  }
5284
5362
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: EditableColumn, decorators: [{
5285
5363
  type: Directive,
@@ -5287,7 +5365,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
5287
5365
  selector: '[pEditableColumn]',
5288
5366
  standalone: false,
5289
5367
  host: {
5290
- '[attr.data-p-editable-column]': 'true'
5368
+ '[attr.data-p-editable-column]': 'true',
5369
+ '[attr.tabindex]': 'isEnabled() ? "0" : null'
5291
5370
  }
5292
5371
  }]
5293
5372
  }], ctorParameters: () => [], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "pEditableColumn", required: false }] }], field: [{ type: i0.Input, args: [{ isSignal: true, alias: "pEditableColumnField", required: false }] }], rowIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "pEditableColumnRowIndex", required: false }] }], pEditableColumnDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "pEditableColumnDisabled", required: false }] }], pFocusCellSelector: [{ type: i0.Input, args: [{ isSignal: true, alias: "pFocusCellSelector", required: false }] }], onClick: [{
@@ -5898,7 +5977,33 @@ class ColumnFilter extends BaseComponent {
5898
5977
  _componentStyle = inject(TableStyle);
5899
5978
  constructor() {
5900
5979
  super();
5901
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptm('columnFilter')));
5980
+ afterEveryRender(() => {
5981
+ this.bindDirectiveInstance.setAttrs(this.ptm('columnFilter'));
5982
+ this.updateMenuButtonAria();
5983
+ });
5984
+ // the table filters can be replaced at any time (e.g. reset to {}): recreate the default constraint
5985
+ effect(() => {
5986
+ const filters = this.dataTable._filters();
5987
+ untracked(() => {
5988
+ if (filters && !filters[this.field()]) {
5989
+ this.initFieldFilterConstraint();
5990
+ }
5991
+ });
5992
+ });
5993
+ }
5994
+ // the popup state belongs to the focusable <button>, not to the p-button host (which has no role)
5995
+ updateMenuButtonAria() {
5996
+ const button = this.showMenuButton() ? this.icon()?.nativeElement?.querySelector('button') : null;
5997
+ if (button) {
5998
+ button.setAttribute('aria-haspopup', 'true');
5999
+ button.setAttribute('aria-expanded', String(this.overlayVisible() ?? false));
6000
+ if (this.overlayVisible()) {
6001
+ button.setAttribute('aria-controls', this.overlayId());
6002
+ }
6003
+ else {
6004
+ button.removeAttribute('aria-controls');
6005
+ }
6006
+ }
5902
6007
  }
5903
6008
  ptmFilterConstraintOptions(matchMode) {
5904
6009
  return {
@@ -6401,6 +6506,23 @@ class ColumnFilter extends BaseComponent {
6401
6506
  this.hide();
6402
6507
  this.icon()?.nativeElement.focus();
6403
6508
  }
6509
+ // the menu is a modal dialog (aria-modal): Tab and Shift+Tab cycle through its own controls
6510
+ onOverlayTabKeyDown(event) {
6511
+ const focusable = DomHandler.getFocusableElements(this.overlay());
6512
+ if (focusable && focusable.length) {
6513
+ const first = focusable[0];
6514
+ const last = focusable[focusable.length - 1];
6515
+ const active = this.document.activeElement;
6516
+ if (event.shiftKey && active === first) {
6517
+ last.focus();
6518
+ event.preventDefault();
6519
+ }
6520
+ else if (!event.shiftKey && active === last) {
6521
+ first.focus();
6522
+ event.preventDefault();
6523
+ }
6524
+ }
6525
+ }
6404
6526
  findNextItem(item) {
6405
6527
  let nextItem = item.nextElementSibling;
6406
6528
  if (nextItem)
@@ -6510,10 +6632,11 @@ class ColumnFilter extends BaseComponent {
6510
6632
  bindDocumentClickListener() {
6511
6633
  if (!this.documentClickListener()) {
6512
6634
  const documentTarget = this.el ? this.el.nativeElement.ownerDocument : 'document';
6513
- this.documentClickListener.set(this.renderer.listen(documentTarget, 'mousedown', (event) => {
6514
- const dialogElements = document.querySelectorAll('[role="dialog"]');
6515
- const targetIsColumnFilterMenuButton = event.target.closest('[data-pc-name="pccolumnfilterbutton"]');
6516
- if (this.overlayVisible() && this.isOutsideClicked(event) && (targetIsColumnFilterMenuButton || dialogElements?.length <= 1)) {
6635
+ this.documentClickListener.set(
6636
+ // a click, not a mousedown: the overlays of the menu (select, datepicker), even appended to body,
6637
+ // report their clicks through OverlayService before the click reaches the document (selfClick)
6638
+ this.renderer.listen(documentTarget, 'click', (event) => {
6639
+ if (this.overlayVisible() && !this.selfClick() && this.isOutsideClicked(event)) {
6517
6640
  this.hide();
6518
6641
  }
6519
6642
  this.selfClick.set(false);
@@ -6615,7 +6738,6 @@ class ColumnFilter extends BaseComponent {
6615
6738
  [currency]="currency()"
6616
6739
  [currencyDisplay]="currencyDisplay()"
6617
6740
  [useGrouping]="useGrouping()"
6618
- [showButtons]="showButtons()"
6619
6741
  [filterOn]="filterOn()"
6620
6742
  [pt]="pt()"
6621
6743
  [unstyled]="unstyled()"
@@ -6625,10 +6747,7 @@ class ColumnFilter extends BaseComponent {
6625
6747
  <p-button
6626
6748
  [styleClass]="cx('pcColumnFilterButton')"
6627
6749
  [pt]="ptm('pcColumnFilterButton')"
6628
- [attr.aria-haspopup]="true"
6629
6750
  [ariaLabel]="filterMenuButtonAriaLabel"
6630
- [attr.aria-controls]="overlayVisible() ? overlayId() : null"
6631
- [attr.aria-expanded]="overlayVisible() ?? false"
6632
6751
  (click)="toggleMenu($event)"
6633
6752
  (keydown)="onToggleButtonKeyDown($event)"
6634
6753
  [buttonProps]="filterButtonProps()?.filter"
@@ -6652,6 +6771,13 @@ class ColumnFilter extends BaseComponent {
6652
6771
  </ng-template>
6653
6772
  </p-button>
6654
6773
  }
6774
+ @if (showClearButton() && display() === 'row' && type() === 'boolean' && hasFilter) {
6775
+ <p-button [styleClass]="cx('pcColumnFilterClearButton')" [ariaLabel]="clearButtonLabel" (click)="clearFilter()" [buttonProps]="filterButtonProps()?.inline?.clear" [unstyled]="unstyled()">
6776
+ <ng-template #icon>
6777
+ <svg data-p-icon="filter-slash" />
6778
+ </ng-template>
6779
+ </p-button>
6780
+ }
6655
6781
  @if (renderOverlay()) {
6656
6782
  <div
6657
6783
  [pMotion]="showMenu() && overlayVisible()"
@@ -6667,6 +6793,8 @@ class ColumnFilter extends BaseComponent {
6667
6793
  role="dialog"
6668
6794
  (click)="onContentClick()"
6669
6795
  (keydown.escape)="onEscape()"
6796
+ (keydown.tab)="onOverlayTabKeyDown($event)"
6797
+ (keydown.shift.tab)="onOverlayTabKeyDown($event)"
6670
6798
  >
6671
6799
  <ng-container *ngTemplateOutlet="headerTemplate() || _headerTemplate(); context: { $implicit: field() }"></ng-container>
6672
6800
  @if (display() === 'row') {
@@ -6720,6 +6848,7 @@ class ColumnFilter extends BaseComponent {
6720
6848
  <p-columnFilterFormElement
6721
6849
  [type]="type()"
6722
6850
  [field]="field()"
6851
+ [ariaLabel]="ariaLabel()"
6723
6852
  [filterConstraint]="fieldConstraint"
6724
6853
  [filterTemplate]="filterTemplate() || _filterTemplate()"
6725
6854
  [placeholder]="placeholder()"
@@ -6813,7 +6942,7 @@ class ColumnFilter extends BaseComponent {
6813
6942
  </div>
6814
6943
  }
6815
6944
  </div>
6816
- `, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => i2.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i0.forwardRef(() => i10.Select), selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "directive", type: i0.forwardRef(() => i7.NgControlStatus), selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i0.forwardRef(() => i7.NgModel), selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i0.forwardRef(() => i11.Button), selector: "p-button", inputs: ["hostName", "type", "badge", "disabled", "raised", "rounded", "text", "plain", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeSeverity", "ariaLabel", "autofocus", "iconPos", "icon", "label", "loading", "loadingIcon", "severity", "buttonProps", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i0.forwardRef(() => FilterIcon), selector: "[data-p-icon=\"filter\"]" }, { kind: "component", type: i0.forwardRef(() => FilterFillIcon), selector: "[data-p-icon=\"filter-fill\"]" }, { kind: "component", type: i0.forwardRef(() => PlusIcon), selector: "[data-p-icon=\"plus\"]" }, { kind: "component", type: i0.forwardRef(() => TrashIcon), selector: "[data-p-icon=\"trash\"]" }, { kind: "directive", type: i0.forwardRef(() => i1.Bind), selector: "[pBind]", inputs: ["pBind"] }, { kind: "directive", type: i0.forwardRef(() => i12.MotionDirective), selector: "[pMotion]", inputs: ["pMotion", "pMotionName", "pMotionType", "pMotionSafe", "pMotionDisabled", "pMotionAppear", "pMotionEnter", "pMotionLeave", "pMotionDuration", "pMotionHideStrategy", "pMotionEnterFromClass", "pMotionEnterToClass", "pMotionEnterActiveClass", "pMotionLeaveFromClass", "pMotionLeaveToClass", "pMotionLeaveActiveClass", "pMotionOptions"], outputs: ["pMotionOnBeforeEnter", "pMotionOnEnter", "pMotionOnAfterEnter", "pMotionOnEnterCancelled", "pMotionOnBeforeLeave", "pMotionOnLeave", "pMotionOnAfterLeave", "pMotionOnLeaveCancelled"] }, { kind: "component", type: i0.forwardRef(() => ColumnFilterFormElement), selector: "p-columnFilterFormElement", inputs: ["field", "type", "filterConstraint", "filterTemplate", "placeholder", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping", "ariaLabel", "filterOn"] }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None });
6945
+ `, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => i2.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i0.forwardRef(() => i10.Select), selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "directive", type: i0.forwardRef(() => i7.NgControlStatus), selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i0.forwardRef(() => i7.NgModel), selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i0.forwardRef(() => i11.Button), selector: "p-button", inputs: ["hostName", "type", "badge", "disabled", "raised", "rounded", "text", "plain", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeSeverity", "ariaLabel", "ariaExpanded", "ariaControls", "autofocus", "iconPos", "icon", "label", "loading", "loadingIcon", "severity", "buttonProps", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i0.forwardRef(() => FilterIcon), selector: "[data-p-icon=\"filter\"]" }, { kind: "component", type: i0.forwardRef(() => FilterFillIcon), selector: "[data-p-icon=\"filter-fill\"]" }, { kind: "component", type: i0.forwardRef(() => FilterSlashIcon), selector: "[data-p-icon=\"filter-slash\"]" }, { kind: "component", type: i0.forwardRef(() => PlusIcon), selector: "[data-p-icon=\"plus\"]" }, { kind: "component", type: i0.forwardRef(() => TrashIcon), selector: "[data-p-icon=\"trash\"]" }, { kind: "directive", type: i0.forwardRef(() => i1.Bind), selector: "[pBind]", inputs: ["pBind"] }, { kind: "directive", type: i0.forwardRef(() => i12.MotionDirective), selector: "[pMotion]", inputs: ["pMotion", "pMotionName", "pMotionType", "pMotionSafe", "pMotionDisabled", "pMotionAppear", "pMotionEnter", "pMotionLeave", "pMotionDuration", "pMotionHideStrategy", "pMotionEnterFromClass", "pMotionEnterToClass", "pMotionEnterActiveClass", "pMotionLeaveFromClass", "pMotionLeaveToClass", "pMotionLeaveActiveClass", "pMotionOptions"], outputs: ["pMotionOnBeforeEnter", "pMotionOnEnter", "pMotionOnAfterEnter", "pMotionOnEnterCancelled", "pMotionOnBeforeLeave", "pMotionOnLeave", "pMotionOnAfterLeave", "pMotionOnLeaveCancelled"] }, { kind: "component", type: i0.forwardRef(() => ColumnFilterFormElement), selector: "p-columnFilterFormElement", inputs: ["field", "type", "filterConstraint", "filterTemplate", "placeholder", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping", "ariaLabel", "filterOn"] }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None });
6817
6946
  }
6818
6947
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ColumnFilter, decorators: [{
6819
6948
  type: Component,
@@ -6841,7 +6970,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6841
6970
  [currency]="currency()"
6842
6971
  [currencyDisplay]="currencyDisplay()"
6843
6972
  [useGrouping]="useGrouping()"
6844
- [showButtons]="showButtons()"
6845
6973
  [filterOn]="filterOn()"
6846
6974
  [pt]="pt()"
6847
6975
  [unstyled]="unstyled()"
@@ -6851,10 +6979,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6851
6979
  <p-button
6852
6980
  [styleClass]="cx('pcColumnFilterButton')"
6853
6981
  [pt]="ptm('pcColumnFilterButton')"
6854
- [attr.aria-haspopup]="true"
6855
6982
  [ariaLabel]="filterMenuButtonAriaLabel"
6856
- [attr.aria-controls]="overlayVisible() ? overlayId() : null"
6857
- [attr.aria-expanded]="overlayVisible() ?? false"
6858
6983
  (click)="toggleMenu($event)"
6859
6984
  (keydown)="onToggleButtonKeyDown($event)"
6860
6985
  [buttonProps]="filterButtonProps()?.filter"
@@ -6878,6 +7003,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6878
7003
  </ng-template>
6879
7004
  </p-button>
6880
7005
  }
7006
+ @if (showClearButton() && display() === 'row' && type() === 'boolean' && hasFilter) {
7007
+ <p-button [styleClass]="cx('pcColumnFilterClearButton')" [ariaLabel]="clearButtonLabel" (click)="clearFilter()" [buttonProps]="filterButtonProps()?.inline?.clear" [unstyled]="unstyled()">
7008
+ <ng-template #icon>
7009
+ <svg data-p-icon="filter-slash" />
7010
+ </ng-template>
7011
+ </p-button>
7012
+ }
6881
7013
  @if (renderOverlay()) {
6882
7014
  <div
6883
7015
  [pMotion]="showMenu() && overlayVisible()"
@@ -6893,6 +7025,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6893
7025
  role="dialog"
6894
7026
  (click)="onContentClick()"
6895
7027
  (keydown.escape)="onEscape()"
7028
+ (keydown.tab)="onOverlayTabKeyDown($event)"
7029
+ (keydown.shift.tab)="onOverlayTabKeyDown($event)"
6896
7030
  >
6897
7031
  <ng-container *ngTemplateOutlet="headerTemplate() || _headerTemplate(); context: { $implicit: field() }"></ng-container>
6898
7032
  @if (display() === 'row') {
@@ -6946,6 +7080,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6946
7080
  <p-columnFilterFormElement
6947
7081
  [type]="type()"
6948
7082
  [field]="field()"
7083
+ [ariaLabel]="ariaLabel()"
6949
7084
  [filterConstraint]="fieldConstraint"
6950
7085
  [filterTemplate]="filterTemplate() || _filterTemplate()"
6951
7086
  [placeholder]="placeholder()"
@@ -7092,7 +7227,9 @@ class ColumnFilterFormElement extends BaseComponent {
7092
7227
  };
7093
7228
  onModelChange(value) {
7094
7229
  this.filterConstraint().value = value;
7095
- if (this.type() === 'date' || this.type() === 'boolean' || ((this.type() === 'text' || this.type() === 'numeric') && this.filterOn() === 'input') || !value) {
7230
+ // a menu with an Apply button only filters on Apply (or Enter)
7231
+ const applyOnButton = this.colFilter.display() === 'menu' && this.colFilter.showApplyButton();
7232
+ if (((this.type() === 'date' || this.type() === 'boolean' || !value) && !applyOnButton) || ((this.type() === 'text' || this.type() === 'numeric') && this.filterOn() === 'input')) {
7096
7233
  this.dataTable._filter();
7097
7234
  }
7098
7235
  }
@@ -7175,6 +7312,7 @@ class ColumnFilterFormElement extends BaseComponent {
7175
7312
  [pt]="ptm('pcFilterCheckbox')"
7176
7313
  [indeterminate]="filterConstraint()?.value === null"
7177
7314
  [binary]="true"
7315
+ [ariaLabel]="ariaLabel()"
7178
7316
  [ngModel]="filterConstraint()?.value"
7179
7317
  [ngModelOptions]="{ standalone: true }"
7180
7318
  (ngModelChange)="onModelChange($event)"
@@ -7195,7 +7333,7 @@ class ColumnFilterFormElement extends BaseComponent {
7195
7333
  }
7196
7334
  }
7197
7335
  }
7198
- `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i13.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i14.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo", "motionOptions"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "component", type: i15.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: i9.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["hostName", "value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None });
7336
+ `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i13.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i14.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "ariaDescribedBy", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo", "motionOptions"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "component", type: i15.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: i9.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["hostName", "value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None });
7199
7337
  }
7200
7338
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ColumnFilterFormElement, decorators: [{
7201
7339
  type: Component,
@@ -7271,6 +7409,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
7271
7409
  [pt]="ptm('pcFilterCheckbox')"
7272
7410
  [indeterminate]="filterConstraint()?.value === null"
7273
7411
  [binary]="true"
7412
+ [ariaLabel]="ariaLabel()"
7274
7413
  [ngModel]="filterConstraint()?.value"
7275
7414
  [ngModelOptions]="{ standalone: true }"
7276
7415
  (ngModelChange)="onModelChange($event)"