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

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 (188) 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 +24 -13
  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 +12 -2
  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 +13 -6
  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-card.mjs +0 -4
  19. package/fesm2022/exhaustive-ui-core-card.mjs.map +1 -1
  20. package/fesm2022/exhaustive-ui-core-carousel.mjs +7 -2
  21. package/fesm2022/exhaustive-ui-core-carousel.mjs.map +1 -1
  22. package/fesm2022/exhaustive-ui-core-cascadeselect.mjs +7 -7
  23. package/fesm2022/exhaustive-ui-core-cascadeselect.mjs.map +1 -1
  24. package/fesm2022/exhaustive-ui-core-chart.mjs.map +1 -1
  25. package/fesm2022/exhaustive-ui-core-confirmdialog.mjs +64 -25
  26. package/fesm2022/exhaustive-ui-core-confirmdialog.mjs.map +1 -1
  27. package/fesm2022/exhaustive-ui-core-confirmpopup.mjs +26 -3
  28. package/fesm2022/exhaustive-ui-core-confirmpopup.mjs.map +1 -1
  29. package/fesm2022/exhaustive-ui-core-contextmenu.mjs +14 -7
  30. package/fesm2022/exhaustive-ui-core-contextmenu.mjs.map +1 -1
  31. package/fesm2022/exhaustive-ui-core-datepicker.mjs +172 -93
  32. package/fesm2022/exhaustive-ui-core-datepicker.mjs.map +1 -1
  33. package/fesm2022/exhaustive-ui-core-dialog.mjs +29 -11
  34. package/fesm2022/exhaustive-ui-core-dialog.mjs.map +1 -1
  35. package/fesm2022/exhaustive-ui-core-dom.mjs +3 -1
  36. package/fesm2022/exhaustive-ui-core-dom.mjs.map +1 -1
  37. package/fesm2022/exhaustive-ui-core-drawer.mjs +22 -4
  38. package/fesm2022/exhaustive-ui-core-drawer.mjs.map +1 -1
  39. package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs +9 -5
  40. package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs.map +1 -1
  41. package/fesm2022/exhaustive-ui-core-fieldset.mjs +2 -2
  42. package/fesm2022/exhaustive-ui-core-fieldset.mjs.map +1 -1
  43. package/fesm2022/exhaustive-ui-core-fileupload.mjs +24 -13
  44. package/fesm2022/exhaustive-ui-core-fileupload.mjs.map +1 -1
  45. package/fesm2022/exhaustive-ui-core-focustrap.mjs +0 -2
  46. package/fesm2022/exhaustive-ui-core-focustrap.mjs.map +1 -1
  47. package/fesm2022/exhaustive-ui-core-iconfield.mjs +16 -1
  48. package/fesm2022/exhaustive-ui-core-iconfield.mjs.map +1 -1
  49. package/fesm2022/exhaustive-ui-core-image.mjs +10 -2
  50. package/fesm2022/exhaustive-ui-core-image.mjs.map +1 -1
  51. package/fesm2022/exhaustive-ui-core-inplace.mjs +1 -1
  52. package/fesm2022/exhaustive-ui-core-inplace.mjs.map +1 -1
  53. package/fesm2022/exhaustive-ui-core-inputgroup.mjs +9 -0
  54. package/fesm2022/exhaustive-ui-core-inputgroup.mjs.map +1 -1
  55. package/fesm2022/exhaustive-ui-core-inputmask.mjs +29 -5
  56. package/fesm2022/exhaustive-ui-core-inputmask.mjs.map +1 -1
  57. package/fesm2022/exhaustive-ui-core-inputnumber.mjs +83 -23
  58. package/fesm2022/exhaustive-ui-core-inputnumber.mjs.map +1 -1
  59. package/fesm2022/exhaustive-ui-core-inputotp.mjs +15 -3
  60. package/fesm2022/exhaustive-ui-core-inputotp.mjs.map +1 -1
  61. package/fesm2022/exhaustive-ui-core-inputtext.mjs +6 -5
  62. package/fesm2022/exhaustive-ui-core-inputtext.mjs.map +1 -1
  63. package/fesm2022/exhaustive-ui-core-keyfilter.mjs +27 -17
  64. package/fesm2022/exhaustive-ui-core-keyfilter.mjs.map +1 -1
  65. package/fesm2022/exhaustive-ui-core-listbox.mjs +15 -4
  66. package/fesm2022/exhaustive-ui-core-listbox.mjs.map +1 -1
  67. package/fesm2022/exhaustive-ui-core-megamenu.mjs +1 -0
  68. package/fesm2022/exhaustive-ui-core-megamenu.mjs.map +1 -1
  69. package/fesm2022/exhaustive-ui-core-menu.mjs +19 -8
  70. package/fesm2022/exhaustive-ui-core-menu.mjs.map +1 -1
  71. package/fesm2022/exhaustive-ui-core-menubar.mjs +57 -13
  72. package/fesm2022/exhaustive-ui-core-menubar.mjs.map +1 -1
  73. package/fesm2022/exhaustive-ui-core-metergroup.mjs +5 -5
  74. package/fesm2022/exhaustive-ui-core-metergroup.mjs.map +1 -1
  75. package/fesm2022/exhaustive-ui-core-multiselect.mjs +38 -25
  76. package/fesm2022/exhaustive-ui-core-multiselect.mjs.map +1 -1
  77. package/fesm2022/exhaustive-ui-core-orderlist.mjs +17 -4
  78. package/fesm2022/exhaustive-ui-core-orderlist.mjs.map +1 -1
  79. package/fesm2022/exhaustive-ui-core-overlay.mjs +4 -0
  80. package/fesm2022/exhaustive-ui-core-overlay.mjs.map +1 -1
  81. package/fesm2022/exhaustive-ui-core-overlaybadge.mjs +2 -2
  82. package/fesm2022/exhaustive-ui-core-overlaybadge.mjs.map +1 -1
  83. package/fesm2022/exhaustive-ui-core-paginator.mjs +12 -5
  84. package/fesm2022/exhaustive-ui-core-paginator.mjs.map +1 -1
  85. package/fesm2022/exhaustive-ui-core-panel.mjs +7 -9
  86. package/fesm2022/exhaustive-ui-core-panel.mjs.map +1 -1
  87. package/fesm2022/exhaustive-ui-core-panelmenu.mjs +38 -12
  88. package/fesm2022/exhaustive-ui-core-panelmenu.mjs.map +1 -1
  89. package/fesm2022/exhaustive-ui-core-password.mjs +90 -22
  90. package/fesm2022/exhaustive-ui-core-password.mjs.map +1 -1
  91. package/fesm2022/exhaustive-ui-core-picklist.mjs +17 -10
  92. package/fesm2022/exhaustive-ui-core-picklist.mjs.map +1 -1
  93. package/fesm2022/exhaustive-ui-core-popover.mjs +26 -7
  94. package/fesm2022/exhaustive-ui-core-popover.mjs.map +1 -1
  95. package/fesm2022/exhaustive-ui-core-progressbar.mjs +3 -3
  96. package/fesm2022/exhaustive-ui-core-progressbar.mjs.map +1 -1
  97. package/fesm2022/exhaustive-ui-core-radiobutton.mjs +6 -1
  98. package/fesm2022/exhaustive-ui-core-radiobutton.mjs.map +1 -1
  99. package/fesm2022/exhaustive-ui-core-scroller.mjs +13 -3
  100. package/fesm2022/exhaustive-ui-core-scroller.mjs.map +1 -1
  101. package/fesm2022/exhaustive-ui-core-scrolltop.mjs +10 -2
  102. package/fesm2022/exhaustive-ui-core-scrolltop.mjs.map +1 -1
  103. package/fesm2022/exhaustive-ui-core-select.mjs +66 -27
  104. package/fesm2022/exhaustive-ui-core-select.mjs.map +1 -1
  105. package/fesm2022/exhaustive-ui-core-selectbutton.mjs +12 -6
  106. package/fesm2022/exhaustive-ui-core-selectbutton.mjs.map +1 -1
  107. package/fesm2022/exhaustive-ui-core-slider.mjs +17 -4
  108. package/fesm2022/exhaustive-ui-core-slider.mjs.map +1 -1
  109. package/fesm2022/exhaustive-ui-core-splitbutton.mjs +8 -4
  110. package/fesm2022/exhaustive-ui-core-splitbutton.mjs.map +1 -1
  111. package/fesm2022/exhaustive-ui-core-splitter.mjs +27 -6
  112. package/fesm2022/exhaustive-ui-core-splitter.mjs.map +1 -1
  113. package/fesm2022/exhaustive-ui-core-stepper.mjs +8 -4
  114. package/fesm2022/exhaustive-ui-core-stepper.mjs.map +1 -1
  115. package/fesm2022/exhaustive-ui-core-table.mjs +338 -167
  116. package/fesm2022/exhaustive-ui-core-table.mjs.map +1 -1
  117. package/fesm2022/exhaustive-ui-core-tabs.mjs +44 -8
  118. package/fesm2022/exhaustive-ui-core-tabs.mjs.map +1 -1
  119. package/fesm2022/exhaustive-ui-core-textarea.mjs +9 -1
  120. package/fesm2022/exhaustive-ui-core-textarea.mjs.map +1 -1
  121. package/fesm2022/exhaustive-ui-core-tieredmenu.mjs +28 -13
  122. package/fesm2022/exhaustive-ui-core-tieredmenu.mjs.map +1 -1
  123. package/fesm2022/exhaustive-ui-core-toast.mjs +15 -1
  124. package/fesm2022/exhaustive-ui-core-toast.mjs.map +1 -1
  125. package/fesm2022/exhaustive-ui-core-togglebutton.mjs +9 -2
  126. package/fesm2022/exhaustive-ui-core-togglebutton.mjs.map +1 -1
  127. package/fesm2022/exhaustive-ui-core-toggleswitch.mjs +0 -2
  128. package/fesm2022/exhaustive-ui-core-toggleswitch.mjs.map +1 -1
  129. package/fesm2022/exhaustive-ui-core-tooltip.mjs +5 -1
  130. package/fesm2022/exhaustive-ui-core-tooltip.mjs.map +1 -1
  131. package/fesm2022/exhaustive-ui-core-tree.mjs +28 -9
  132. package/fesm2022/exhaustive-ui-core-tree.mjs.map +1 -1
  133. package/fesm2022/exhaustive-ui-core-treeselect.mjs +51 -4
  134. package/fesm2022/exhaustive-ui-core-treeselect.mjs.map +1 -1
  135. package/fesm2022/exhaustive-ui-core-treetable.mjs +80 -8
  136. package/fesm2022/exhaustive-ui-core-treetable.mjs.map +1 -1
  137. package/fesm2022/exhaustive-ui-core-utils.mjs +2 -1
  138. package/fesm2022/exhaustive-ui-core-utils.mjs.map +1 -1
  139. package/package.json +5 -5
  140. package/schematics/migrations/remove-dead-inputs/migration.js +5 -4
  141. package/schematics/migrations/remove-dead-outputs/migration.js +6 -5
  142. package/schematics/utils/versions.json +8 -8
  143. package/types/exhaustive-ui-core-api.d.ts +4 -0
  144. package/types/exhaustive-ui-core-autocomplete.d.ts +2 -0
  145. package/types/exhaustive-ui-core-autofocus.d.ts +1 -1
  146. package/types/exhaustive-ui-core-basecomponent.d.ts +1 -0
  147. package/types/exhaustive-ui-core-breadcrumb.d.ts +7 -1
  148. package/types/exhaustive-ui-core-button.d.ts +12 -1
  149. package/types/exhaustive-ui-core-cascadeselect.d.ts +1 -1
  150. package/types/exhaustive-ui-core-chart.d.ts +2 -2
  151. package/types/exhaustive-ui-core-confirmdialog.d.ts +17 -5
  152. package/types/exhaustive-ui-core-confirmpopup.d.ts +4 -0
  153. package/types/exhaustive-ui-core-datepicker.d.ts +9 -2
  154. package/types/exhaustive-ui-core-dialog.d.ts +2 -0
  155. package/types/exhaustive-ui-core-drawer.d.ts +1 -0
  156. package/types/exhaustive-ui-core-dynamicdialog.d.ts +2 -2
  157. package/types/exhaustive-ui-core-fileupload.d.ts +4 -0
  158. package/types/exhaustive-ui-core-iconfield.d.ts +1 -2
  159. package/types/exhaustive-ui-core-image.d.ts +6 -1
  160. package/types/exhaustive-ui-core-inputnumber.d.ts +8 -0
  161. package/types/exhaustive-ui-core-keyfilter.d.ts +1 -0
  162. package/types/exhaustive-ui-core-megamenu.d.ts +1 -0
  163. package/types/exhaustive-ui-core-menu.d.ts +2 -0
  164. package/types/exhaustive-ui-core-menubar.d.ts +5 -0
  165. package/types/exhaustive-ui-core-metergroup.d.ts +1 -1
  166. package/types/exhaustive-ui-core-multiselect.d.ts +1 -1
  167. package/types/exhaustive-ui-core-orderlist.d.ts +11 -1
  168. package/types/exhaustive-ui-core-paginator.d.ts +1 -0
  169. package/types/exhaustive-ui-core-panelmenu.d.ts +5 -0
  170. package/types/exhaustive-ui-core-password.d.ts +9 -1
  171. package/types/exhaustive-ui-core-picklist.d.ts +3 -3
  172. package/types/exhaustive-ui-core-popover.d.ts +3 -0
  173. package/types/exhaustive-ui-core-select.d.ts +4 -1
  174. package/types/exhaustive-ui-core-selectbutton.d.ts +3 -0
  175. package/types/exhaustive-ui-core-splitbutton.d.ts +2 -1
  176. package/types/exhaustive-ui-core-splitter.d.ts +7 -1
  177. package/types/exhaustive-ui-core-stepper.d.ts +3 -2
  178. package/types/exhaustive-ui-core-table.d.ts +16 -3
  179. package/types/exhaustive-ui-core-tabs.d.ts +4 -0
  180. package/types/exhaustive-ui-core-tieredmenu.d.ts +2 -0
  181. package/types/exhaustive-ui-core-togglebutton.d.ts +1 -0
  182. package/types/exhaustive-ui-core-tree.d.ts +2 -0
  183. package/types/exhaustive-ui-core-treeselect.d.ts +12 -1
  184. package/types/exhaustive-ui-core-treetable.d.ts +22 -2
  185. package/types/exhaustive-ui-core-types-chart.d.ts +21 -1
  186. package/types/exhaustive-ui-core-types-confirmdialog.d.ts +1 -3
  187. package/types/exhaustive-ui-core-types-table.d.ts +1 -1
  188. package/types/exhaustive-ui-core-types-treetable.d.ts +2 -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',
@@ -265,11 +265,13 @@ const classes = {
265
265
  'p-datatable-row-selected': instance.selected()
266
266
  }),
267
267
  resizableColumn: 'p-datatable-resizable-column',
268
- reorderableColumn: 'p-datatable-reorderable-column',
268
+ reorderableColumn: ({ instance }) => ({
269
+ 'p-datatable-reorderable-column': instance.isEnabled()
270
+ }),
269
271
  rowEditorCancel: 'p-datatable-row-editor-cancel',
270
272
  frozenColumn: ({ instance }) => ({
271
273
  'p-datatable-frozen-column': instance.frozen(),
272
- 'p-datatable-frozen-column-left': instance.alignFrozenLeft === 'left'
274
+ 'p-datatable-frozen-column-left': instance.alignFrozen() === 'left'
273
275
  }),
274
276
  contextMenuRowSelected: ({ instance }) => ({
275
277
  'p-datatable-contextmenu-row-selected': instance.selected()
@@ -1359,6 +1361,9 @@ class Table extends BaseComponent {
1359
1361
  ...(ngDevMode ? [{ debugName: "editingCellField" }] : /* istanbul ignore next */ []));
1360
1362
  editingCellRowIndex = signal(undefined, /* @ts-ignore */
1361
1363
  ...(ngDevMode ? [{ debugName: "editingCellRowIndex" }] : /* istanbul ignore next */ []));
1364
+ /** Value of the edited field when the cell editor opened, restored when the edit is cancelled. */
1365
+ editingCellOriginalValue = signal(undefined, /* @ts-ignore */
1366
+ ...(ngDevMode ? [{ debugName: "editingCellOriginalValue" }] : /* istanbul ignore next */ []));
1362
1367
  selfClick = signal(undefined, /* @ts-ignore */
1363
1368
  ...(ngDevMode ? [{ debugName: "selfClick" }] : /* istanbul ignore next */ []));
1364
1369
  documentEditListener = signal(undefined, /* @ts-ignore */
@@ -1429,6 +1434,8 @@ class Table extends BaseComponent {
1429
1434
  this.restoreState();
1430
1435
  }
1431
1436
  if (!this.lazy()) {
1437
+ // re-applying the filters to a new value must not move back to the first page
1438
+ const first = this.first();
1432
1439
  if (this.sortMode() == 'single' && (this._sortField() || this.groupRowsBy()))
1433
1440
  this.sortSingle();
1434
1441
  else if (this.sortMode() == 'multiple' && (this._multiSortMeta() || this.groupRowsBy()))
@@ -1436,6 +1443,15 @@ class Table extends BaseComponent {
1436
1443
  else if (this.hasFilter())
1437
1444
  //sort already filters
1438
1445
  this._filter();
1446
+ if (this.hasFilter()) {
1447
+ this.first.set(first);
1448
+ }
1449
+ // a shorter value can leave the current page empty: move back to the last page
1450
+ const rows = this.rows();
1451
+ const totalRecords = this._totalRecords();
1452
+ if (this.paginator() && rows && totalRecords > 0 && (this.first() ?? 0) >= totalRecords) {
1453
+ this.first.set(Math.floor((totalRecords - 1) / rows) * rows);
1454
+ }
1439
1455
  }
1440
1456
  this.tableService.onValueChange(value);
1441
1457
  });
@@ -1474,13 +1490,19 @@ class Table extends BaseComponent {
1474
1490
  }
1475
1491
  });
1476
1492
  });
1493
+ let selectionInitialized = false;
1477
1494
  effect(() => {
1478
1495
  this.selection();
1479
1496
  untracked(() => {
1480
1497
  if (!this.preventSelectionSetterPropagation()) {
1481
1498
  this.updateSelectionKeys();
1482
1499
  this.tableService.onSelectionChange();
1500
+ // a selection set from outside is saved like one made by clicking a row
1501
+ if (selectionInitialized && this.isStateful()) {
1502
+ this.saveState();
1503
+ }
1483
1504
  }
1505
+ selectionInitialized = true;
1484
1506
  this.preventSelectionSetterPropagation.set(false);
1485
1507
  });
1486
1508
  });
@@ -1644,7 +1666,7 @@ class Table extends BaseComponent {
1644
1666
  });
1645
1667
  }
1646
1668
  else {
1647
- this._value().sort((data1, data2) => {
1669
+ const sortedValue = [...this._value()].sort((data1, data2) => {
1648
1670
  let value1 = ObjectUtils.resolveFieldData(data1, field);
1649
1671
  let value2 = ObjectUtils.resolveFieldData(data2, field);
1650
1672
  let result = null;
@@ -1660,7 +1682,7 @@ class Table extends BaseComponent {
1660
1682
  result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0;
1661
1683
  return order * (result || 0);
1662
1684
  });
1663
- this._value.set([...this._value()]);
1685
+ this._value.set(sortedValue);
1664
1686
  }
1665
1687
  if (this.hasFilter()) {
1666
1688
  this._filter();
@@ -1695,10 +1717,9 @@ class Table extends BaseComponent {
1695
1717
  });
1696
1718
  }
1697
1719
  else {
1698
- this._value().sort((data1, data2) => {
1720
+ this._value.set([...this._value()].sort((data1, data2) => {
1699
1721
  return this.multisortField(data1, data2, this._multiSortMeta(), 0);
1700
- });
1701
- this._value.set([...this._value()]);
1722
+ }));
1702
1723
  }
1703
1724
  if (this.hasFilter()) {
1704
1725
  this._filter();
@@ -2156,10 +2177,15 @@ class Table extends BaseComponent {
2156
2177
  if (this.filterTimeout()) {
2157
2178
  clearTimeout(this.filterTimeout());
2158
2179
  }
2159
- if (!this.isFilterBlank(value)) {
2180
+ const fieldFilter = this._filters()[field];
2181
+ if (Array.isArray(fieldFilter)) {
2182
+ // a menu p-columnFilter owns this field and reads its filter as a list of constraints
2183
+ this._filters()[field] = [{ value: this.isFilterBlank(value) ? null : value, matchMode: matchMode, operator: fieldFilter[0]?.operator ?? FilterOperator.AND }];
2184
+ }
2185
+ else if (!this.isFilterBlank(value)) {
2160
2186
  this._filters()[field] = { value: value, matchMode: matchMode };
2161
2187
  }
2162
- else if (this._filters()[field]) {
2188
+ else if (fieldFilter) {
2163
2189
  delete this._filters()[field];
2164
2190
  }
2165
2191
  this.filterTimeout.set(setTimeout(() => {
@@ -2232,10 +2258,13 @@ class Table extends BaseComponent {
2232
2258
  }
2233
2259
  }
2234
2260
  if (this._filters()['global'] && !globalMatch && globalFilterFieldsArray) {
2261
+ // a negated match mode only matches when no field contains the term
2262
+ const globalMatchMode = this._filters()['global'].matchMode;
2263
+ const negated = globalMatchMode === FilterMatchMode.NOT_CONTAINS || globalMatchMode === FilterMatchMode.NOT_EQUALS;
2235
2264
  for (let j = 0; j < globalFilterFieldsArray.length; j++) {
2236
2265
  let globalFilterField = globalFilterFieldsArray[j].field || globalFilterFieldsArray[j];
2237
2266
  globalMatch = this.filterService.filters[this._filters()['global'].matchMode](ObjectUtils.resolveFieldData(this._value()[i], globalFilterField), this._filters()['global'].value, this.filterLocale());
2238
- if (globalMatch) {
2267
+ if (negated ? !globalMatch : globalMatch) {
2239
2268
  break;
2240
2269
  }
2241
2270
  }
@@ -2517,7 +2546,17 @@ class Table extends BaseComponent {
2517
2546
  }
2518
2547
  else {
2519
2548
  if (this.rowExpandMode() === 'single') {
2549
+ const expandedKeys = Object.keys(this._expandedRowKeys());
2520
2550
  this._expandedRowKeys.set({});
2551
+ for (const expandedKey of expandedKeys) {
2552
+ const collapsedRowData = (this._value() || []).find((data) => String(ObjectUtils.resolveFieldData(data, this.groupRowsBy() ? this.groupRowsBy() : this.dataKey())) === expandedKey);
2553
+ if (collapsedRowData) {
2554
+ this.onRowCollapse.emit({
2555
+ originalEvent: event,
2556
+ data: collapsedRowData
2557
+ });
2558
+ }
2559
+ }
2521
2560
  }
2522
2561
  this._expandedRowKeys()[dataKeyValue] = true;
2523
2562
  this.onRowExpand.emit({
@@ -2608,7 +2647,8 @@ class Table extends BaseComponent {
2608
2647
  _totalTableWidth() {
2609
2648
  let widths = [];
2610
2649
  const tableHead = DomHandler.findSingle(this.el.nativeElement, '[data-pc-section="thead"]');
2611
- let headers = DomHandler.find(tableHead, 'tr > th');
2650
+ // only the last header row holds one cell per column: the rows above it may group columns (colspan)
2651
+ let headers = DomHandler.find(tableHead, 'tr:last-child > th');
2612
2652
  headers.forEach((header) => widths.push(DomHandler.getOuterWidth(header)));
2613
2653
  return widths;
2614
2654
  }
@@ -2629,17 +2669,19 @@ class Table extends BaseComponent {
2629
2669
  let targetLeft = dropHeaderOffset.left - containerOffset.left;
2630
2670
  let targetTop = containerOffset.top - dropHeaderOffset.top;
2631
2671
  let columnCenter = dropHeaderOffset.left + dropHeader.offsetWidth / 2;
2672
+ // in RTL the next column is on the left: the left half drops after, the right half before
2673
+ const isRTL = getComputedStyle(this.el?.nativeElement ?? document.documentElement).direction === 'rtl';
2632
2674
  this.reorderIndicatorUpViewChild().nativeElement.style.top = dropHeaderOffset.top - containerOffset.top - (this.reorderIconHeight() - 1) + 'px';
2633
2675
  this.reorderIndicatorDownViewChild().nativeElement.style.top = dropHeaderOffset.top - containerOffset.top + dropHeader.offsetHeight + 'px';
2634
2676
  if (event.pageX > columnCenter) {
2635
2677
  this.reorderIndicatorUpViewChild().nativeElement.style.left = targetLeft + dropHeader.offsetWidth - Math.ceil(this.reorderIconWidth() / 2) + 'px';
2636
2678
  this.reorderIndicatorDownViewChild().nativeElement.style.left = targetLeft + dropHeader.offsetWidth - Math.ceil(this.reorderIconWidth() / 2) + 'px';
2637
- this.dropPosition.set(1);
2679
+ this.dropPosition.set(isRTL ? -1 : 1);
2638
2680
  }
2639
2681
  else {
2640
2682
  this.reorderIndicatorUpViewChild().nativeElement.style.left = targetLeft - Math.ceil(this.reorderIconWidth() / 2) + 'px';
2641
2683
  this.reorderIndicatorDownViewChild().nativeElement.style.left = targetLeft - Math.ceil(this.reorderIconWidth() / 2) + 'px';
2642
- this.dropPosition.set(-1);
2684
+ this.dropPosition.set(isRTL ? 1 : -1);
2643
2685
  }
2644
2686
  this.reorderIndicatorUpViewChild().nativeElement.style.display = 'block';
2645
2687
  this.reorderIndicatorDownViewChild().nativeElement.style.display = 'block';
@@ -2657,8 +2699,12 @@ class Table extends BaseComponent {
2657
2699
  onColumnDrop(event, dropColumn) {
2658
2700
  event.preventDefault();
2659
2701
  if (this.draggedColumn()) {
2660
- let dragIndex = DomHandler.indexWithinGroup(this.draggedColumn(), 'preorderablecolumn');
2661
- let dropIndex = DomHandler.indexWithinGroup(dropColumn, 'preorderablecolumn');
2702
+ // when the header row has one cell per column, index the cells themselves so that the
2703
+ // non-reorderable columns (e.g. frozen ones) keep their place in _columns
2704
+ const headerCells = this.draggedColumn().parentElement ? DomHandler.find(this.draggedColumn().parentElement, ':scope > th') : [];
2705
+ const indexByCell = !!this._columns() && this._columns().length === headerCells.length;
2706
+ let dragIndex = indexByCell ? DomHandler.index(this.draggedColumn()) : DomHandler.indexWithinGroup(this.draggedColumn(), 'preorderablecolumn');
2707
+ let dropIndex = indexByCell ? DomHandler.index(dropColumn) : DomHandler.indexWithinGroup(dropColumn, 'preorderablecolumn');
2662
2708
  let allowDrop = dragIndex != dropIndex;
2663
2709
  if (allowDrop && ((dropIndex - dragIndex == 1 && this.dropPosition() === -1) || (dragIndex - dropIndex == 1 && this.dropPosition() === 1))) {
2664
2710
  allowDrop = false;
@@ -2684,10 +2730,16 @@ class Table extends BaseComponent {
2684
2730
  });
2685
2731
  }
2686
2732
  }
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);
2733
+ if (allowDrop && this.resizableColumns() && this.resizeColumnElement()) {
2734
+ // The widths are indexed by header cell, the drag/drop indexes by reorderable column only.
2735
+ const offset = DomHandler.index(this.draggedColumn()) - dragIndex;
2736
+ const width = [...((this.columnResizeMode() === 'expand' ? this._initialColWidths() : undefined) ?? this._totalTableWidth())];
2737
+ ObjectUtils.reorderArray(width, dragIndex + offset, dropIndex + offset);
2738
+ if (this.columnResizeMode() === 'expand') {
2739
+ this._initialColWidths.set(width);
2740
+ }
2741
+ // Keep every width as measured: no column is resized by a reorder.
2742
+ this.updateStyleElement(width, -1, 0, null);
2691
2743
  }
2692
2744
  this.reorderIndicatorUpViewChild().nativeElement.style.display = 'none';
2693
2745
  this.reorderIndicatorDownViewChild().nativeElement.style.display = 'none';
@@ -2696,6 +2748,16 @@ class Table extends BaseComponent {
2696
2748
  this.dropPosition.set(null);
2697
2749
  }
2698
2750
  }
2751
+ onColumnDragEnd() {
2752
+ // a drop outside a header fires no drop event: clear the drag state here
2753
+ if (this.draggedColumn()) {
2754
+ this.reorderIndicatorUpViewChild().nativeElement.style.display = 'none';
2755
+ this.reorderIndicatorDownViewChild().nativeElement.style.display = 'none';
2756
+ this.draggedColumn().draggable = false;
2757
+ this.draggedColumn.set(null);
2758
+ this.dropPosition.set(null);
2759
+ }
2760
+ }
2699
2761
  resizeTableCells(newColumnWidth, nextColumnWidth) {
2700
2762
  let colIndex = DomHandler.index(this.resizeColumnElement());
2701
2763
  let width = this.columnResizeMode() === 'expand' ? this._initialColWidths() : this._totalTableWidth();
@@ -2716,7 +2778,7 @@ class Table extends BaseComponent {
2716
2778
  }
2717
2779
  `;
2718
2780
  });
2719
- this.renderer.setProperty(this.styleElement(), 'innerHTML', innerHTML);
2781
+ this.renderer.setProperty(this.styleElement(), 'textContent', innerHTML);
2720
2782
  }
2721
2783
  onRowDragStart(event, index) {
2722
2784
  this.rowDragging.set(true);
@@ -2855,10 +2917,10 @@ class Table extends BaseComponent {
2855
2917
  if (stateString) {
2856
2918
  let state = JSON.parse(stateString, reviver);
2857
2919
  if (this.paginator()) {
2858
- if (this.first() !== undefined) {
2920
+ if (this.first() !== undefined && state.first !== undefined) {
2859
2921
  this.first.set(state.first);
2860
2922
  }
2861
- if (this.rows() !== undefined) {
2923
+ if (this.rows() !== undefined && state.rows !== undefined) {
2862
2924
  this.rows.set(state.rows);
2863
2925
  }
2864
2926
  }
@@ -2926,7 +2988,7 @@ class Table extends BaseComponent {
2926
2988
  }
2927
2989
  `;
2928
2990
  });
2929
- this.styleElement().innerHTML = innerHTML;
2991
+ this.styleElement().textContent = innerHTML;
2930
2992
  }
2931
2993
  }
2932
2994
  }
@@ -3017,7 +3079,7 @@ class Table extends BaseComponent {
3017
3079
  }
3018
3080
  }
3019
3081
  `;
3020
- this.renderer.setProperty(this.responsiveStyleElement(), 'innerHTML', innerHTML);
3082
+ this.renderer.setProperty(this.responsiveStyleElement(), 'textContent', innerHTML);
3021
3083
  DomHandler.setAttribute(this.responsiveStyleElement(), 'nonce', this.config?.csp()?.nonce);
3022
3084
  }
3023
3085
  }
@@ -3095,7 +3157,7 @@ class Table extends BaseComponent {
3095
3157
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3096
3158
  [showJumpToPageInput]="showJumpToPageInput()"
3097
3159
  [showPageLinks]="showPageLinks()"
3098
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3160
+ [class]="cn(cx('pcPaginator', { position: 'top' }), paginatorStyleClass())"
3099
3161
  [locale]="paginatorLocale()"
3100
3162
  [pt]="ptm('pcPaginator')"
3101
3163
  [unstyled]="unstyled()"
@@ -3259,7 +3321,7 @@ class Table extends BaseComponent {
3259
3321
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3260
3322
  [showJumpToPageInput]="showJumpToPageInput()"
3261
3323
  [showPageLinks]="showPageLinks()"
3262
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3324
+ [class]="cn(cx('pcPaginator', { position: 'bottom' }), paginatorStyleClass())"
3263
3325
  [locale]="paginatorLocale()"
3264
3326
  [pt]="ptm('pcPaginator')"
3265
3327
  [unstyled]="unstyled()"
@@ -3367,7 +3429,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3367
3429
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3368
3430
  [showJumpToPageInput]="showJumpToPageInput()"
3369
3431
  [showPageLinks]="showPageLinks()"
3370
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3432
+ [class]="cn(cx('pcPaginator', { position: 'top' }), paginatorStyleClass())"
3371
3433
  [locale]="paginatorLocale()"
3372
3434
  [pt]="ptm('pcPaginator')"
3373
3435
  [unstyled]="unstyled()"
@@ -3531,7 +3593,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3531
3593
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3532
3594
  [showJumpToPageInput]="showJumpToPageInput()"
3533
3595
  [showPageLinks]="showPageLinks()"
3534
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3596
+ [class]="cn(cx('pcPaginator', { position: 'bottom' }), paginatorStyleClass())"
3535
3597
  [locale]="paginatorLocale()"
3536
3598
  [pt]="ptm('pcPaginator')"
3537
3599
  [unstyled]="unstyled()"
@@ -3715,6 +3777,11 @@ class TableBody extends BaseComponent {
3715
3777
  const getItemOptions = this.getScrollerOption('getItemOptions');
3716
3778
  return getItemOptions ? getItemOptions(index).index : index;
3717
3779
  }
3780
+ // the group header/footer checks compare a row with its neighbours in value(); with virtual scroll
3781
+ // value() only holds the rendered slice, so the index must stay relative to that slice
3782
+ getGroupRowIndex(rowIndex) {
3783
+ return this.dataTable.virtualScroll() ? rowIndex + (this.dataTable.first() || 0) : this.getRowIndex(rowIndex);
3784
+ }
3718
3785
  dataP = computed(() => {
3719
3786
  return this.cn({
3720
3787
  hoverable: this.dataTable.rowHover() || this.dataTable.selectionMode(),
@@ -3726,7 +3793,7 @@ class TableBody extends BaseComponent {
3726
3793
  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
3794
  @if (!dataTable.expandedRowTemplate() && !dataTable._expandedRowTemplate()) {
3728
3795
  @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))) {
3796
+ @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getGroupRowIndex(rowIndex))) {
3730
3797
  <ng-container role="row">
3731
3798
  <ng-container
3732
3799
  *ngTemplateOutlet="
@@ -3772,7 +3839,7 @@ class TableBody extends BaseComponent {
3772
3839
  "
3773
3840
  ></ng-container>
3774
3841
  }
3775
- @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getRowIndex(rowIndex))) {
3842
+ @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getGroupRowIndex(rowIndex))) {
3776
3843
  <ng-container role="row">
3777
3844
  <ng-container
3778
3845
  *ngTemplateOutlet="
@@ -3792,21 +3859,6 @@ class TableBody extends BaseComponent {
3792
3859
  }
3793
3860
  @if ((dataTable.expandedRowTemplate() || dataTable._expandedRowTemplate()) && !(frozen() && (dataTable.frozenExpandedRowTemplate() || dataTable._frozenExpandedRowTemplate()))) {
3794
3861
  @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
3862
  @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3811
3863
  <ng-container role="row">
3812
3864
  <ng-container
@@ -3824,6 +3876,21 @@ class TableBody extends BaseComponent {
3824
3876
  ></ng-container>
3825
3877
  </ng-container>
3826
3878
  }
3879
+ @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
3880
+ <ng-container
3881
+ *ngTemplateOutlet="
3882
+ rowData ? template() : dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate();
3883
+ context: {
3884
+ $implicit: rowData,
3885
+ rowIndex: getRowIndex(rowIndex),
3886
+ columns: columns(),
3887
+ expanded: dataTable.isRowExpanded(rowData),
3888
+ editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
3889
+ frozen: frozen()
3890
+ }
3891
+ "
3892
+ ></ng-container>
3893
+ }
3827
3894
  @if (dataTable.isRowExpanded(rowData)) {
3828
3895
  <ng-container
3829
3896
  *ngTemplateOutlet="
@@ -3889,7 +3956,7 @@ class TableBody extends BaseComponent {
3889
3956
  @if (dataTable.loading()) {
3890
3957
  <ng-container *ngTemplateOutlet="dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
3891
3958
  }
3892
- @if (dataTable.isEmpty() && !dataTable.loading()) {
3959
+ @if (dataTable.isEmpty() && !dataTable.loading() && !frozenRows()) {
3893
3960
  <ng-container *ngTemplateOutlet="dataTable.emptyMessageTemplate() || dataTable._emptyMessageTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
3894
3961
  }
3895
3962
  `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None });
@@ -3902,7 +3969,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3902
3969
  template: `
3903
3970
  @if (!dataTable.expandedRowTemplate() && !dataTable._expandedRowTemplate()) {
3904
3971
  @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))) {
3972
+ @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getGroupRowIndex(rowIndex))) {
3906
3973
  <ng-container role="row">
3907
3974
  <ng-container
3908
3975
  *ngTemplateOutlet="
@@ -3948,7 +4015,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3948
4015
  "
3949
4016
  ></ng-container>
3950
4017
  }
3951
- @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getRowIndex(rowIndex))) {
4018
+ @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getGroupRowIndex(rowIndex))) {
3952
4019
  <ng-container role="row">
3953
4020
  <ng-container
3954
4021
  *ngTemplateOutlet="
@@ -3968,21 +4035,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3968
4035
  }
3969
4036
  @if ((dataTable.expandedRowTemplate() || dataTable._expandedRowTemplate()) && !(frozen() && (dataTable.frozenExpandedRowTemplate() || dataTable._frozenExpandedRowTemplate()))) {
3970
4037
  @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
4038
  @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3987
4039
  <ng-container role="row">
3988
4040
  <ng-container
@@ -4000,6 +4052,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4000
4052
  ></ng-container>
4001
4053
  </ng-container>
4002
4054
  }
4055
+ @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
4056
+ <ng-container
4057
+ *ngTemplateOutlet="
4058
+ rowData ? template() : dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate();
4059
+ context: {
4060
+ $implicit: rowData,
4061
+ rowIndex: getRowIndex(rowIndex),
4062
+ columns: columns(),
4063
+ expanded: dataTable.isRowExpanded(rowData),
4064
+ editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
4065
+ frozen: frozen()
4066
+ }
4067
+ "
4068
+ ></ng-container>
4069
+ }
4003
4070
  @if (dataTable.isRowExpanded(rowData)) {
4004
4071
  <ng-container
4005
4072
  *ngTemplateOutlet="
@@ -4065,7 +4132,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4065
4132
  @if (dataTable.loading()) {
4066
4133
  <ng-container *ngTemplateOutlet="dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
4067
4134
  }
4068
- @if (dataTable.isEmpty() && !dataTable.loading()) {
4135
+ @if (dataTable.isEmpty() && !dataTable.loading() && !frozenRows()) {
4069
4136
  <ng-container *ngTemplateOutlet="dataTable.emptyMessageTemplate() || dataTable._emptyMessageTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
4070
4137
  }
4071
4138
  `,
@@ -4159,24 +4226,30 @@ class FrozenColumn extends BaseComponent {
4159
4226
  }, time);
4160
4227
  }
4161
4228
  updateStickyPosition() {
4162
- if (this.frozen()) {
4229
+ if (this.frozen() && isPlatformBrowser(this.platformId)) {
4230
+ // alignFrozen is logical: in RTL the start (left alignment) is the physical right side
4231
+ const isRTL = this.document.defaultView?.getComputedStyle(this.el.nativeElement).direction === 'rtl';
4232
+ const startSide = isRTL ? 'right' : 'left';
4233
+ const endSide = isRTL ? 'left' : 'right';
4163
4234
  if (this.alignFrozen() === 'right') {
4164
- let right = 0;
4235
+ let end = 0;
4165
4236
  let sibling = this.el.nativeElement.nextElementSibling;
4166
4237
  while (sibling) {
4167
- right += DomHandler.getOuterWidth(sibling);
4238
+ end += this.getFrozenWidth(sibling);
4168
4239
  sibling = sibling.nextElementSibling;
4169
4240
  }
4170
- this.el.nativeElement.style.right = right + 'px';
4241
+ this.el.nativeElement.style[endSide] = end + 'px';
4242
+ this.el.nativeElement.style[startSide] = '';
4171
4243
  }
4172
4244
  else {
4173
- let left = 0;
4245
+ let start = 0;
4174
4246
  let sibling = this.el.nativeElement.previousElementSibling;
4175
4247
  while (sibling) {
4176
- left += DomHandler.getOuterWidth(sibling);
4248
+ start += this.getFrozenWidth(sibling);
4177
4249
  sibling = sibling.previousElementSibling;
4178
4250
  }
4179
- this.el.nativeElement.style.left = left + 'px';
4251
+ this.el.nativeElement.style[startSide] = start + 'px';
4252
+ this.el.nativeElement.style[endSide] = '';
4180
4253
  }
4181
4254
  const filterRow = this.el.nativeElement?.parentElement?.nextElementSibling;
4182
4255
  if (filterRow) {
@@ -4188,12 +4261,16 @@ class FrozenColumn extends BaseComponent {
4188
4261
  }
4189
4262
  }
4190
4263
  }
4264
+ // only the frozen (sticky) cells stay between a frozen cell and the edge: the others scroll away
4265
+ getFrozenWidth(cell) {
4266
+ return cell.getAttribute('data-p-frozen-column') === 'true' ? DomHandler.getOuterWidth(cell) : 0;
4267
+ }
4191
4268
  onDestroy() {
4192
4269
  this.unbindResizeListener();
4193
4270
  this.resizeObserver()?.disconnect();
4194
4271
  }
4195
4272
  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 });
4273
+ 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
4274
  }
4198
4275
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FrozenColumn, decorators: [{
4199
4276
  type: Directive,
@@ -4201,7 +4278,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4201
4278
  selector: '[pFrozenColumn]',
4202
4279
  standalone: false,
4203
4280
  host: {
4204
- '[class]': 'cx("frozenColumn")'
4281
+ '[class]': 'cx("frozenColumn")',
4282
+ '[attr.data-p-frozen-column]': 'frozen()'
4205
4283
  },
4206
4284
  providers: [TableStyle]
4207
4285
  }]
@@ -4274,7 +4352,7 @@ class SortableColumn extends BaseComponent {
4274
4352
  }
4275
4353
  }
4276
4354
  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 });
4355
+ 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
4356
  }
4279
4357
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: SortableColumn, decorators: [{
4280
4358
  type: Directive,
@@ -4284,7 +4362,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4284
4362
  host: {
4285
4363
  '[class]': "cx('sortableColumn')",
4286
4364
  '[tabindex]': 'isEnabled() ? "0" : null',
4287
- role: 'columnheader',
4365
+ '[attr.role]': 'role',
4288
4366
  '[attr.aria-sort]': 'sortOrder()'
4289
4367
  },
4290
4368
  providers: [TableStyle]
@@ -4298,6 +4376,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4298
4376
  }, {
4299
4377
  type: HostListener,
4300
4378
  args: ['keydown.enter', ['$event']]
4379
+ }, {
4380
+ type: HostListener,
4381
+ args: ['keydown.meta.space', ['$event']]
4382
+ }, {
4383
+ type: HostListener,
4384
+ args: ['keydown.meta.enter', ['$event']]
4385
+ }, {
4386
+ type: HostListener,
4387
+ args: ['keydown.control.space', ['$event']]
4388
+ }, {
4389
+ type: HostListener,
4390
+ args: ['keydown.control.enter', ['$event']]
4301
4391
  }] } });
4302
4392
  class SortIcon extends BaseComponent {
4303
4393
  dataTable = inject(Table);
@@ -4358,13 +4448,13 @@ class SortIcon extends BaseComponent {
4358
4448
  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
4449
  @if (!(dataTable.sortIconTemplate() || dataTable._sortIconTemplate())) {
4360
4450
  @if (sortOrder() === 0) {
4361
- <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" />
4451
+ <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4362
4452
  }
4363
4453
  @if (sortOrder() === 1) {
4364
- <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" />
4454
+ <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4365
4455
  }
4366
4456
  @if (sortOrder() === -1) {
4367
- <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" />
4457
+ <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4368
4458
  }
4369
4459
  }
4370
4460
  @if (dataTable.sortIconTemplate() || dataTable._sortIconTemplate()) {
@@ -4385,13 +4475,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4385
4475
  template: `
4386
4476
  @if (!(dataTable.sortIconTemplate() || dataTable._sortIconTemplate())) {
4387
4477
  @if (sortOrder() === 0) {
4388
- <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" />
4478
+ <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4389
4479
  }
4390
4480
  @if (sortOrder() === 1) {
4391
- <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" />
4481
+ <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4392
4482
  }
4393
4483
  @if (sortOrder() === -1) {
4394
- <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" />
4484
+ <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4395
4485
  }
4396
4486
  }
4397
4487
  @if (dataTable.sortIconTemplate() || dataTable._sortIconTemplate()) {
@@ -4428,7 +4518,8 @@ class SelectableRow extends BaseComponent {
4428
4518
  }
4429
4519
  setRowTabIndex() {
4430
4520
  if (this.dataTable.selectionMode() === 'single' || this.dataTable.selectionMode() === 'multiple') {
4431
- return !this.dataTable.selection() ? 0 : this.dataTable.anchorRowIndex() === this.index() ? 0 : -1;
4521
+ // sort, filter and page changes reset the anchor row to null: keep the rows reachable by Tab
4522
+ return !this.dataTable.selection() || this.dataTable.anchorRowIndex() == null ? 0 : this.dataTable.anchorRowIndex() === this.index() ? 0 : -1;
4432
4523
  }
4433
4524
  }
4434
4525
  onInit() {
@@ -4892,6 +4983,8 @@ class ReorderableColumn extends BaseComponent {
4892
4983
  ...(ngDevMode ? [{ debugName: "dragEnterListener" }] : /* istanbul ignore next */ []));
4893
4984
  dragLeaveListener = signal(undefined, /* @ts-ignore */
4894
4985
  ...(ngDevMode ? [{ debugName: "dragLeaveListener" }] : /* istanbul ignore next */ []));
4986
+ dragEndListener = signal(undefined, /* @ts-ignore */
4987
+ ...(ngDevMode ? [{ debugName: "dragEndListener" }] : /* istanbul ignore next */ []));
4895
4988
  mouseDownListener = signal(undefined, /* @ts-ignore */
4896
4989
  ...(ngDevMode ? [{ debugName: "mouseDownListener" }] : /* istanbul ignore next */ []));
4897
4990
  _componentStyle = inject(TableStyle);
@@ -4911,6 +5004,7 @@ class ReorderableColumn extends BaseComponent {
4911
5004
  this.dragOverListener.set(this.renderer.listen(this.el.nativeElement, 'dragover', this.onDragOver.bind(this)));
4912
5005
  this.dragEnterListener.set(this.renderer.listen(this.el.nativeElement, 'dragenter', this.onDragEnter.bind(this)));
4913
5006
  this.dragLeaveListener.set(this.renderer.listen(this.el.nativeElement, 'dragleave', this.onDragLeave.bind(this)));
5007
+ this.dragEndListener.set(this.renderer.listen(this.el.nativeElement, 'dragend', this.onDragEnd.bind(this)));
4914
5008
  });
4915
5009
  }
4916
5010
  }
@@ -4935,9 +5029,13 @@ class ReorderableColumn extends BaseComponent {
4935
5029
  this.dragLeaveListener()();
4936
5030
  this.dragLeaveListener.set(null);
4937
5031
  }
5032
+ if (this.dragEndListener()) {
5033
+ this.dragEndListener()();
5034
+ this.dragEndListener.set(null);
5035
+ }
4938
5036
  }
4939
5037
  onMouseDown(event) {
4940
- if (event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA' || findSingle(event.target, '[data-pc-column-resizer="true"]'))
5038
+ if (event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA' || event.target.closest?.('[data-pc-column-resizer="true"]'))
4941
5039
  this.el.nativeElement.draggable = false;
4942
5040
  else
4943
5041
  this.el.nativeElement.draggable = true;
@@ -4954,6 +5052,9 @@ class ReorderableColumn extends BaseComponent {
4954
5052
  onDragLeave(event) {
4955
5053
  this.dataTable.onColumnDragLeave(event);
4956
5054
  }
5055
+ onDragEnd() {
5056
+ this.dataTable.onColumnDragEnd();
5057
+ }
4957
5058
  onDrop(event) {
4958
5059
  if (this.isEnabled()) {
4959
5060
  this.dataTable.onColumnDrop(event, this.el.nativeElement);
@@ -5035,6 +5136,7 @@ class EditableColumn extends BaseComponent {
5035
5136
  }
5036
5137
  openCell() {
5037
5138
  this.dataTable.updateEditingCell(this.el.nativeElement, this.data(), this.field(), this.rowIndex());
5139
+ this.dataTable.editingCellOriginalValue.set(ObjectUtils.resolveFieldData(this.data(), this.field()));
5038
5140
  !this.$unstyled() && DomHandler.addClass(this.el.nativeElement, 'p-cell-editing');
5039
5141
  setAttribute(this.el.nativeElement, 'data-p-cell-editing', 'true');
5040
5142
  this.dataTable.onEditInit.emit({
@@ -5059,6 +5161,9 @@ class EditableColumn extends BaseComponent {
5059
5161
  this.dataTable.overlaySubscription.set(this.dataTable.overlayService.clickObservable.subscribe(this.overlayEventListener()));
5060
5162
  }
5061
5163
  closeEditingCell(completed, event) {
5164
+ if (!completed && this.dataTable.editingCellData() && this.dataTable.editingCellField()) {
5165
+ this.dataTable.editingCellData()[this.dataTable.editingCellField()] = this.dataTable.editingCellOriginalValue();
5166
+ }
5062
5167
  const eventData = {
5063
5168
  field: this.dataTable.editingCellField(),
5064
5169
  data: this.dataTable.editingCellData(),
@@ -5070,11 +5175,6 @@ class EditableColumn extends BaseComponent {
5070
5175
  }
5071
5176
  else {
5072
5177
  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
5178
  }
5079
5179
  !this.$unstyled() && DomHandler.removeClass(this.dataTable.editingCell(), 'p-cell-editing');
5080
5180
  setAttribute(this.el.nativeElement, 'data-p-cell-editing', 'false');
@@ -5088,8 +5188,13 @@ class EditableColumn extends BaseComponent {
5088
5188
  }
5089
5189
  onEnterKeyDown(event) {
5090
5190
  if (this.isEnabled() && !event.shiftKey) {
5091
- if (this.dataTable.isEditingCellValid()) {
5191
+ if (!this.dataTable.editingCell()) {
5192
+ // keyboard alternative to the click that opens the editor of a focused cell
5193
+ this.openCell();
5194
+ }
5195
+ else if (this.dataTable.isEditingCellValid()) {
5092
5196
  this.closeEditingCell(true, event);
5197
+ this.el.nativeElement.focus();
5093
5198
  }
5094
5199
  event.preventDefault();
5095
5200
  }
@@ -5106,6 +5211,7 @@ class EditableColumn extends BaseComponent {
5106
5211
  if (this.isEnabled()) {
5107
5212
  if (this.dataTable.isEditingCellValid()) {
5108
5213
  this.closeEditingCell(false, event);
5214
+ this.el.nativeElement.focus();
5109
5215
  }
5110
5216
  event.preventDefault();
5111
5217
  }
@@ -5279,7 +5385,7 @@ class EditableColumn extends BaseComponent {
5279
5385
  }
5280
5386
  }
5281
5387
  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 });
5388
+ 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
5389
  }
5284
5390
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: EditableColumn, decorators: [{
5285
5391
  type: Directive,
@@ -5287,7 +5393,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
5287
5393
  selector: '[pEditableColumn]',
5288
5394
  standalone: false,
5289
5395
  host: {
5290
- '[attr.data-p-editable-column]': 'true'
5396
+ '[attr.data-p-editable-column]': 'true',
5397
+ '[attr.tabindex]': 'isEnabled() ? "0" : null'
5291
5398
  }
5292
5399
  }]
5293
5400
  }], 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 +6005,33 @@ class ColumnFilter extends BaseComponent {
5898
6005
  _componentStyle = inject(TableStyle);
5899
6006
  constructor() {
5900
6007
  super();
5901
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptm('columnFilter')));
6008
+ afterEveryRender(() => {
6009
+ this.bindDirectiveInstance.setAttrs(this.ptm('columnFilter'));
6010
+ this.updateMenuButtonAria();
6011
+ });
6012
+ // the table filters can be replaced at any time (e.g. reset to {}): recreate the default constraint
6013
+ effect(() => {
6014
+ const filters = this.dataTable._filters();
6015
+ untracked(() => {
6016
+ if (filters && !filters[this.field()]) {
6017
+ this.initFieldFilterConstraint();
6018
+ }
6019
+ });
6020
+ });
6021
+ }
6022
+ // the popup state belongs to the focusable <button>, not to the p-button host (which has no role)
6023
+ updateMenuButtonAria() {
6024
+ const button = this.showMenuButton() ? this.icon()?.nativeElement?.querySelector('button') : null;
6025
+ if (button) {
6026
+ button.setAttribute('aria-haspopup', 'true');
6027
+ button.setAttribute('aria-expanded', String(this.overlayVisible() ?? false));
6028
+ if (this.overlayVisible()) {
6029
+ button.setAttribute('aria-controls', this.overlayId());
6030
+ }
6031
+ else {
6032
+ button.removeAttribute('aria-controls');
6033
+ }
6034
+ }
5902
6035
  }
5903
6036
  ptmFilterConstraintOptions(matchMode) {
5904
6037
  return {
@@ -6401,6 +6534,23 @@ class ColumnFilter extends BaseComponent {
6401
6534
  this.hide();
6402
6535
  this.icon()?.nativeElement.focus();
6403
6536
  }
6537
+ // the menu is a modal dialog (aria-modal): Tab and Shift+Tab cycle through its own controls
6538
+ onOverlayTabKeyDown(event) {
6539
+ const focusable = DomHandler.getFocusableElements(this.overlay());
6540
+ if (focusable && focusable.length) {
6541
+ const first = focusable[0];
6542
+ const last = focusable[focusable.length - 1];
6543
+ const active = this.document.activeElement;
6544
+ if (event.shiftKey && active === first) {
6545
+ last.focus();
6546
+ event.preventDefault();
6547
+ }
6548
+ else if (!event.shiftKey && active === last) {
6549
+ first.focus();
6550
+ event.preventDefault();
6551
+ }
6552
+ }
6553
+ }
6404
6554
  findNextItem(item) {
6405
6555
  let nextItem = item.nextElementSibling;
6406
6556
  if (nextItem)
@@ -6488,7 +6638,7 @@ class ColumnFilter extends BaseComponent {
6488
6638
  let fieldFilter = this.dataTable._filters()[this.field()];
6489
6639
  if (fieldFilter) {
6490
6640
  if (Array.isArray(fieldFilter))
6491
- return !this.dataTable.isFilterBlank(fieldFilter[0].value);
6641
+ return fieldFilter.some((meta) => !this.dataTable.isFilterBlank(meta.value));
6492
6642
  else
6493
6643
  return !this.dataTable.isFilterBlank(fieldFilter.value);
6494
6644
  }
@@ -6510,10 +6660,11 @@ class ColumnFilter extends BaseComponent {
6510
6660
  bindDocumentClickListener() {
6511
6661
  if (!this.documentClickListener()) {
6512
6662
  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)) {
6663
+ this.documentClickListener.set(
6664
+ // a click, not a mousedown: the overlays of the menu (select, datepicker), even appended to body,
6665
+ // report their clicks through OverlayService before the click reaches the document (selfClick)
6666
+ this.renderer.listen(documentTarget, 'click', (event) => {
6667
+ if (this.overlayVisible() && !this.selfClick() && this.isOutsideClicked(event)) {
6517
6668
  this.hide();
6518
6669
  }
6519
6670
  this.selfClick.set(false);
@@ -6615,7 +6766,6 @@ class ColumnFilter extends BaseComponent {
6615
6766
  [currency]="currency()"
6616
6767
  [currencyDisplay]="currencyDisplay()"
6617
6768
  [useGrouping]="useGrouping()"
6618
- [showButtons]="showButtons()"
6619
6769
  [filterOn]="filterOn()"
6620
6770
  [pt]="pt()"
6621
6771
  [unstyled]="unstyled()"
@@ -6625,10 +6775,7 @@ class ColumnFilter extends BaseComponent {
6625
6775
  <p-button
6626
6776
  [styleClass]="cx('pcColumnFilterButton')"
6627
6777
  [pt]="ptm('pcColumnFilterButton')"
6628
- [attr.aria-haspopup]="true"
6629
6778
  [ariaLabel]="filterMenuButtonAriaLabel"
6630
- [attr.aria-controls]="overlayVisible() ? overlayId() : null"
6631
- [attr.aria-expanded]="overlayVisible() ?? false"
6632
6779
  (click)="toggleMenu($event)"
6633
6780
  (keydown)="onToggleButtonKeyDown($event)"
6634
6781
  [buttonProps]="filterButtonProps()?.filter"
@@ -6652,6 +6799,13 @@ class ColumnFilter extends BaseComponent {
6652
6799
  </ng-template>
6653
6800
  </p-button>
6654
6801
  }
6802
+ @if (showClearButton() && display() === 'row' && type() === 'boolean' && hasFilter) {
6803
+ <p-button [styleClass]="cx('pcColumnFilterClearButton')" [ariaLabel]="clearButtonLabel" (click)="clearFilter()" [buttonProps]="filterButtonProps()?.inline?.clear" [unstyled]="unstyled()">
6804
+ <ng-template #icon>
6805
+ <svg data-p-icon="filter-slash" />
6806
+ </ng-template>
6807
+ </p-button>
6808
+ }
6655
6809
  @if (renderOverlay()) {
6656
6810
  <div
6657
6811
  [pMotion]="showMenu() && overlayVisible()"
@@ -6667,6 +6821,8 @@ class ColumnFilter extends BaseComponent {
6667
6821
  role="dialog"
6668
6822
  (click)="onContentClick()"
6669
6823
  (keydown.escape)="onEscape()"
6824
+ (keydown.tab)="onOverlayTabKeyDown($event)"
6825
+ (keydown.shift.tab)="onOverlayTabKeyDown($event)"
6670
6826
  >
6671
6827
  <ng-container *ngTemplateOutlet="headerTemplate() || _headerTemplate(); context: { $implicit: field() }"></ng-container>
6672
6828
  @if (display() === 'row') {
@@ -6720,6 +6876,7 @@ class ColumnFilter extends BaseComponent {
6720
6876
  <p-columnFilterFormElement
6721
6877
  [type]="type()"
6722
6878
  [field]="field()"
6879
+ [ariaLabel]="ariaLabel()"
6723
6880
  [filterConstraint]="fieldConstraint"
6724
6881
  [filterTemplate]="filterTemplate() || _filterTemplate()"
6725
6882
  [placeholder]="placeholder()"
@@ -6736,8 +6893,8 @@ class ColumnFilter extends BaseComponent {
6736
6893
  [pt]="pt()"
6737
6894
  [unstyled]="unstyled()"
6738
6895
  ></p-columnFilterFormElement>
6739
- <div>
6740
- @if (showRemoveIcon) {
6896
+ @if (showRemoveIcon) {
6897
+ <div>
6741
6898
  <p-button
6742
6899
  [styleClass]="cx('pcFilterRemoveRuleButton')"
6743
6900
  [pt]="ptm('pcFilterRemoveRuleButton')"
@@ -6757,8 +6914,8 @@ class ColumnFilter extends BaseComponent {
6757
6914
  <ng-template *ngTemplateOutlet="removeRuleIconTemplate() || _removeRuleIconTemplate()"></ng-template>
6758
6915
  </ng-template>
6759
6916
  </p-button>
6760
- }
6761
- </div>
6917
+ </div>
6918
+ }
6762
6919
  </div>
6763
6920
  }
6764
6921
  </div>
@@ -6783,37 +6940,39 @@ class ColumnFilter extends BaseComponent {
6783
6940
  </ng-template>
6784
6941
  </p-button>
6785
6942
  }
6786
- <div [class]="cx('filterButtonbar')" [pBind]="ptm('filterButtonBar')">
6787
- @if (showClearButton()) {
6788
- <p-button
6789
- #clearBtn
6790
- [outlined]="true"
6791
- (onClick)="clearFilter()"
6792
- [attr.aria-label]="clearButtonLabel"
6793
- [label]="clearButtonLabel"
6794
- [buttonProps]="filterButtonProps()?.popover?.clear"
6795
- [pt]="ptm('pcFilterClearButton')"
6796
- [unstyled]="unstyled()"
6797
- />
6798
- }
6799
- @if (showApplyButton()) {
6800
- <p-button
6801
- (onClick)="applyFilter()"
6802
- size="small"
6803
- [label]="applyButtonLabel"
6804
- [attr.aria-label]="applyButtonLabel"
6805
- [buttonProps]="filterButtonProps()?.popover?.apply"
6806
- [pt]="ptm('pcFilterApplyButton')"
6807
- [unstyled]="unstyled()"
6808
- />
6809
- }
6810
- </div>
6943
+ @if (showClearButton() || showApplyButton()) {
6944
+ <div [class]="cx('filterButtonbar')" [pBind]="ptm('filterButtonBar')">
6945
+ @if (showClearButton()) {
6946
+ <p-button
6947
+ #clearBtn
6948
+ [outlined]="filterButtonProps()?.popover?.clear?.outlined ?? true"
6949
+ (onClick)="clearFilter()"
6950
+ [attr.aria-label]="clearButtonLabel"
6951
+ [label]="clearButtonLabel"
6952
+ [buttonProps]="filterButtonProps()?.popover?.clear"
6953
+ [pt]="ptm('pcFilterClearButton')"
6954
+ [unstyled]="unstyled()"
6955
+ />
6956
+ }
6957
+ @if (showApplyButton()) {
6958
+ <p-button
6959
+ (onClick)="applyFilter()"
6960
+ size="small"
6961
+ [label]="applyButtonLabel"
6962
+ [attr.aria-label]="applyButtonLabel"
6963
+ [buttonProps]="filterButtonProps()?.popover?.apply"
6964
+ [pt]="ptm('pcFilterApplyButton')"
6965
+ [unstyled]="unstyled()"
6966
+ />
6967
+ }
6968
+ </div>
6969
+ }
6811
6970
  }
6812
6971
  <ng-container *ngTemplateOutlet="footerTemplate() || _footerTemplate(); context: { $implicit: field() }"></ng-container>
6813
6972
  </div>
6814
6973
  }
6815
6974
  </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 });
6975
+ `, 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
6976
  }
6818
6977
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ColumnFilter, decorators: [{
6819
6978
  type: Component,
@@ -6841,7 +7000,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6841
7000
  [currency]="currency()"
6842
7001
  [currencyDisplay]="currencyDisplay()"
6843
7002
  [useGrouping]="useGrouping()"
6844
- [showButtons]="showButtons()"
6845
7003
  [filterOn]="filterOn()"
6846
7004
  [pt]="pt()"
6847
7005
  [unstyled]="unstyled()"
@@ -6851,10 +7009,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6851
7009
  <p-button
6852
7010
  [styleClass]="cx('pcColumnFilterButton')"
6853
7011
  [pt]="ptm('pcColumnFilterButton')"
6854
- [attr.aria-haspopup]="true"
6855
7012
  [ariaLabel]="filterMenuButtonAriaLabel"
6856
- [attr.aria-controls]="overlayVisible() ? overlayId() : null"
6857
- [attr.aria-expanded]="overlayVisible() ?? false"
6858
7013
  (click)="toggleMenu($event)"
6859
7014
  (keydown)="onToggleButtonKeyDown($event)"
6860
7015
  [buttonProps]="filterButtonProps()?.filter"
@@ -6878,6 +7033,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6878
7033
  </ng-template>
6879
7034
  </p-button>
6880
7035
  }
7036
+ @if (showClearButton() && display() === 'row' && type() === 'boolean' && hasFilter) {
7037
+ <p-button [styleClass]="cx('pcColumnFilterClearButton')" [ariaLabel]="clearButtonLabel" (click)="clearFilter()" [buttonProps]="filterButtonProps()?.inline?.clear" [unstyled]="unstyled()">
7038
+ <ng-template #icon>
7039
+ <svg data-p-icon="filter-slash" />
7040
+ </ng-template>
7041
+ </p-button>
7042
+ }
6881
7043
  @if (renderOverlay()) {
6882
7044
  <div
6883
7045
  [pMotion]="showMenu() && overlayVisible()"
@@ -6893,6 +7055,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6893
7055
  role="dialog"
6894
7056
  (click)="onContentClick()"
6895
7057
  (keydown.escape)="onEscape()"
7058
+ (keydown.tab)="onOverlayTabKeyDown($event)"
7059
+ (keydown.shift.tab)="onOverlayTabKeyDown($event)"
6896
7060
  >
6897
7061
  <ng-container *ngTemplateOutlet="headerTemplate() || _headerTemplate(); context: { $implicit: field() }"></ng-container>
6898
7062
  @if (display() === 'row') {
@@ -6946,6 +7110,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6946
7110
  <p-columnFilterFormElement
6947
7111
  [type]="type()"
6948
7112
  [field]="field()"
7113
+ [ariaLabel]="ariaLabel()"
6949
7114
  [filterConstraint]="fieldConstraint"
6950
7115
  [filterTemplate]="filterTemplate() || _filterTemplate()"
6951
7116
  [placeholder]="placeholder()"
@@ -6962,8 +7127,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6962
7127
  [pt]="pt()"
6963
7128
  [unstyled]="unstyled()"
6964
7129
  ></p-columnFilterFormElement>
6965
- <div>
6966
- @if (showRemoveIcon) {
7130
+ @if (showRemoveIcon) {
7131
+ <div>
6967
7132
  <p-button
6968
7133
  [styleClass]="cx('pcFilterRemoveRuleButton')"
6969
7134
  [pt]="ptm('pcFilterRemoveRuleButton')"
@@ -6983,8 +7148,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6983
7148
  <ng-template *ngTemplateOutlet="removeRuleIconTemplate() || _removeRuleIconTemplate()"></ng-template>
6984
7149
  </ng-template>
6985
7150
  </p-button>
6986
- }
6987
- </div>
7151
+ </div>
7152
+ }
6988
7153
  </div>
6989
7154
  }
6990
7155
  </div>
@@ -7009,31 +7174,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
7009
7174
  </ng-template>
7010
7175
  </p-button>
7011
7176
  }
7012
- <div [class]="cx('filterButtonbar')" [pBind]="ptm('filterButtonBar')">
7013
- @if (showClearButton()) {
7014
- <p-button
7015
- #clearBtn
7016
- [outlined]="true"
7017
- (onClick)="clearFilter()"
7018
- [attr.aria-label]="clearButtonLabel"
7019
- [label]="clearButtonLabel"
7020
- [buttonProps]="filterButtonProps()?.popover?.clear"
7021
- [pt]="ptm('pcFilterClearButton')"
7022
- [unstyled]="unstyled()"
7023
- />
7024
- }
7025
- @if (showApplyButton()) {
7026
- <p-button
7027
- (onClick)="applyFilter()"
7028
- size="small"
7029
- [label]="applyButtonLabel"
7030
- [attr.aria-label]="applyButtonLabel"
7031
- [buttonProps]="filterButtonProps()?.popover?.apply"
7032
- [pt]="ptm('pcFilterApplyButton')"
7033
- [unstyled]="unstyled()"
7034
- />
7035
- }
7036
- </div>
7177
+ @if (showClearButton() || showApplyButton()) {
7178
+ <div [class]="cx('filterButtonbar')" [pBind]="ptm('filterButtonBar')">
7179
+ @if (showClearButton()) {
7180
+ <p-button
7181
+ #clearBtn
7182
+ [outlined]="filterButtonProps()?.popover?.clear?.outlined ?? true"
7183
+ (onClick)="clearFilter()"
7184
+ [attr.aria-label]="clearButtonLabel"
7185
+ [label]="clearButtonLabel"
7186
+ [buttonProps]="filterButtonProps()?.popover?.clear"
7187
+ [pt]="ptm('pcFilterClearButton')"
7188
+ [unstyled]="unstyled()"
7189
+ />
7190
+ }
7191
+ @if (showApplyButton()) {
7192
+ <p-button
7193
+ (onClick)="applyFilter()"
7194
+ size="small"
7195
+ [label]="applyButtonLabel"
7196
+ [attr.aria-label]="applyButtonLabel"
7197
+ [buttonProps]="filterButtonProps()?.popover?.apply"
7198
+ [pt]="ptm('pcFilterApplyButton')"
7199
+ [unstyled]="unstyled()"
7200
+ />
7201
+ }
7202
+ </div>
7203
+ }
7037
7204
  }
7038
7205
  <ng-container *ngTemplateOutlet="footerTemplate() || _footerTemplate(); context: { $implicit: field() }"></ng-container>
7039
7206
  </div>
@@ -7092,7 +7259,9 @@ class ColumnFilterFormElement extends BaseComponent {
7092
7259
  };
7093
7260
  onModelChange(value) {
7094
7261
  this.filterConstraint().value = value;
7095
- if (this.type() === 'date' || this.type() === 'boolean' || ((this.type() === 'text' || this.type() === 'numeric') && this.filterOn() === 'input') || !value) {
7262
+ // a menu with an Apply button only filters on Apply (or Enter)
7263
+ const applyOnButton = this.colFilter.display() === 'menu' && this.colFilter.showApplyButton();
7264
+ if (((this.type() === 'date' || this.type() === 'boolean' || !value) && !applyOnButton) || ((this.type() === 'text' || this.type() === 'numeric') && this.filterOn() === 'input')) {
7096
7265
  this.dataTable._filter();
7097
7266
  }
7098
7267
  }
@@ -7175,6 +7344,7 @@ class ColumnFilterFormElement extends BaseComponent {
7175
7344
  [pt]="ptm('pcFilterCheckbox')"
7176
7345
  [indeterminate]="filterConstraint()?.value === null"
7177
7346
  [binary]="true"
7347
+ [ariaLabel]="ariaLabel()"
7178
7348
  [ngModel]="filterConstraint()?.value"
7179
7349
  [ngModelOptions]="{ standalone: true }"
7180
7350
  (ngModelChange)="onModelChange($event)"
@@ -7195,7 +7365,7 @@ class ColumnFilterFormElement extends BaseComponent {
7195
7365
  }
7196
7366
  }
7197
7367
  }
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 });
7368
+ `, 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
7369
  }
7200
7370
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ColumnFilterFormElement, decorators: [{
7201
7371
  type: Component,
@@ -7271,6 +7441,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
7271
7441
  [pt]="ptm('pcFilterCheckbox')"
7272
7442
  [indeterminate]="filterConstraint()?.value === null"
7273
7443
  [binary]="true"
7444
+ [ariaLabel]="ariaLabel()"
7274
7445
  [ngModel]="filterConstraint()?.value"
7275
7446
  [ngModelOptions]="{ standalone: true }"
7276
7447
  (ngModelChange)="onModelChange($event)"