@exhaustive-ui/core 22.0.0-alpha.9 → 22.0.0-rc.2

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 (250) hide show
  1. package/fesm2022/exhaustive-ui-core-accordion.mjs +5 -5
  2. package/fesm2022/exhaustive-ui-core-accordion.mjs.map +1 -1
  3. package/fesm2022/exhaustive-ui-core-api.mjs +3 -3
  4. package/fesm2022/exhaustive-ui-core-api.mjs.map +1 -1
  5. package/fesm2022/exhaustive-ui-core-autocomplete.mjs +25 -14
  6. package/fesm2022/exhaustive-ui-core-autocomplete.mjs.map +1 -1
  7. package/fesm2022/exhaustive-ui-core-avatar.mjs +2 -2
  8. package/fesm2022/exhaustive-ui-core-avatar.mjs.map +1 -1
  9. package/fesm2022/exhaustive-ui-core-avatargroup.mjs +2 -2
  10. package/fesm2022/exhaustive-ui-core-avatargroup.mjs.map +1 -1
  11. package/fesm2022/exhaustive-ui-core-badge.mjs +12 -3
  12. package/fesm2022/exhaustive-ui-core-badge.mjs.map +1 -1
  13. package/fesm2022/exhaustive-ui-core-basecomponent.mjs +34 -4
  14. package/fesm2022/exhaustive-ui-core-basecomponent.mjs.map +1 -1
  15. package/fesm2022/exhaustive-ui-core-baseeditableholder.mjs +4 -2
  16. package/fesm2022/exhaustive-ui-core-baseeditableholder.mjs.map +1 -1
  17. package/fesm2022/exhaustive-ui-core-blockui.mjs +9 -2
  18. package/fesm2022/exhaustive-ui-core-blockui.mjs.map +1 -1
  19. package/fesm2022/exhaustive-ui-core-breadcrumb.mjs +13 -6
  20. package/fesm2022/exhaustive-ui-core-breadcrumb.mjs.map +1 -1
  21. package/fesm2022/exhaustive-ui-core-button.mjs +35 -13
  22. package/fesm2022/exhaustive-ui-core-button.mjs.map +1 -1
  23. package/fesm2022/exhaustive-ui-core-card.mjs +2 -6
  24. package/fesm2022/exhaustive-ui-core-card.mjs.map +1 -1
  25. package/fesm2022/exhaustive-ui-core-carousel.mjs +9 -4
  26. package/fesm2022/exhaustive-ui-core-carousel.mjs.map +1 -1
  27. package/fesm2022/exhaustive-ui-core-cascadeselect.mjs +12 -11
  28. package/fesm2022/exhaustive-ui-core-cascadeselect.mjs.map +1 -1
  29. package/fesm2022/exhaustive-ui-core-chart.mjs +2 -2
  30. package/fesm2022/exhaustive-ui-core-chart.mjs.map +1 -1
  31. package/fesm2022/exhaustive-ui-core-checkbox.mjs +2 -2
  32. package/fesm2022/exhaustive-ui-core-checkbox.mjs.map +1 -1
  33. package/fesm2022/exhaustive-ui-core-chip.mjs +2 -2
  34. package/fesm2022/exhaustive-ui-core-chip.mjs.map +1 -1
  35. package/fesm2022/exhaustive-ui-core-colorpicker.mjs +2 -2
  36. package/fesm2022/exhaustive-ui-core-colorpicker.mjs.map +1 -1
  37. package/fesm2022/exhaustive-ui-core-config.mjs +3 -1
  38. package/fesm2022/exhaustive-ui-core-config.mjs.map +1 -1
  39. package/fesm2022/exhaustive-ui-core-confirmdialog.mjs +65 -26
  40. package/fesm2022/exhaustive-ui-core-confirmdialog.mjs.map +1 -1
  41. package/fesm2022/exhaustive-ui-core-confirmpopup.mjs +28 -5
  42. package/fesm2022/exhaustive-ui-core-confirmpopup.mjs.map +1 -1
  43. package/fesm2022/exhaustive-ui-core-contextmenu.mjs +15 -8
  44. package/fesm2022/exhaustive-ui-core-contextmenu.mjs.map +1 -1
  45. package/fesm2022/exhaustive-ui-core-dataview.mjs +2 -2
  46. package/fesm2022/exhaustive-ui-core-dataview.mjs.map +1 -1
  47. package/fesm2022/exhaustive-ui-core-datepicker.mjs +188 -95
  48. package/fesm2022/exhaustive-ui-core-datepicker.mjs.map +1 -1
  49. package/fesm2022/exhaustive-ui-core-dialog.mjs +31 -13
  50. package/fesm2022/exhaustive-ui-core-dialog.mjs.map +1 -1
  51. package/fesm2022/exhaustive-ui-core-divider.mjs +2 -2
  52. package/fesm2022/exhaustive-ui-core-divider.mjs.map +1 -1
  53. package/fesm2022/exhaustive-ui-core-dock.mjs +2 -2
  54. package/fesm2022/exhaustive-ui-core-dock.mjs.map +1 -1
  55. package/fesm2022/exhaustive-ui-core-dom.mjs +3 -1
  56. package/fesm2022/exhaustive-ui-core-dom.mjs.map +1 -1
  57. package/fesm2022/exhaustive-ui-core-drawer.mjs +24 -6
  58. package/fesm2022/exhaustive-ui-core-drawer.mjs.map +1 -1
  59. package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs +9 -5
  60. package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs.map +1 -1
  61. package/fesm2022/exhaustive-ui-core-editor.mjs +2 -2
  62. package/fesm2022/exhaustive-ui-core-editor.mjs.map +1 -1
  63. package/fesm2022/exhaustive-ui-core-fieldset.mjs +4 -4
  64. package/fesm2022/exhaustive-ui-core-fieldset.mjs.map +1 -1
  65. package/fesm2022/exhaustive-ui-core-fileupload.mjs +25 -14
  66. package/fesm2022/exhaustive-ui-core-fileupload.mjs.map +1 -1
  67. package/fesm2022/exhaustive-ui-core-floatlabel.mjs +2 -2
  68. package/fesm2022/exhaustive-ui-core-floatlabel.mjs.map +1 -1
  69. package/fesm2022/exhaustive-ui-core-focustrap.mjs +0 -2
  70. package/fesm2022/exhaustive-ui-core-focustrap.mjs.map +1 -1
  71. package/fesm2022/exhaustive-ui-core-galleria.mjs +5 -5
  72. package/fesm2022/exhaustive-ui-core-galleria.mjs.map +1 -1
  73. package/fesm2022/exhaustive-ui-core-iconfield.mjs +18 -3
  74. package/fesm2022/exhaustive-ui-core-iconfield.mjs.map +1 -1
  75. package/fesm2022/exhaustive-ui-core-image.mjs +12 -4
  76. package/fesm2022/exhaustive-ui-core-image.mjs.map +1 -1
  77. package/fesm2022/exhaustive-ui-core-imagecompare.mjs +2 -2
  78. package/fesm2022/exhaustive-ui-core-imagecompare.mjs.map +1 -1
  79. package/fesm2022/exhaustive-ui-core-inplace.mjs +3 -3
  80. package/fesm2022/exhaustive-ui-core-inplace.mjs.map +1 -1
  81. package/fesm2022/exhaustive-ui-core-inputgroup.mjs +11 -2
  82. package/fesm2022/exhaustive-ui-core-inputgroup.mjs.map +1 -1
  83. package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs +2 -2
  84. package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs.map +1 -1
  85. package/fesm2022/exhaustive-ui-core-inputicon.mjs +2 -2
  86. package/fesm2022/exhaustive-ui-core-inputicon.mjs.map +1 -1
  87. package/fesm2022/exhaustive-ui-core-inputmask.mjs +31 -7
  88. package/fesm2022/exhaustive-ui-core-inputmask.mjs.map +1 -1
  89. package/fesm2022/exhaustive-ui-core-inputnumber.mjs +85 -25
  90. package/fesm2022/exhaustive-ui-core-inputnumber.mjs.map +1 -1
  91. package/fesm2022/exhaustive-ui-core-inputotp.mjs +9 -3
  92. package/fesm2022/exhaustive-ui-core-inputotp.mjs.map +1 -1
  93. package/fesm2022/exhaustive-ui-core-inputtext.mjs +8 -9
  94. package/fesm2022/exhaustive-ui-core-inputtext.mjs.map +1 -1
  95. package/fesm2022/exhaustive-ui-core-keyfilter.mjs +27 -17
  96. package/fesm2022/exhaustive-ui-core-keyfilter.mjs.map +1 -1
  97. package/fesm2022/exhaustive-ui-core-knob.mjs +2 -2
  98. package/fesm2022/exhaustive-ui-core-knob.mjs.map +1 -1
  99. package/fesm2022/exhaustive-ui-core-listbox.mjs +17 -6
  100. package/fesm2022/exhaustive-ui-core-listbox.mjs.map +1 -1
  101. package/fesm2022/exhaustive-ui-core-megamenu.mjs +4 -3
  102. package/fesm2022/exhaustive-ui-core-megamenu.mjs.map +1 -1
  103. package/fesm2022/exhaustive-ui-core-menu.mjs +15 -4
  104. package/fesm2022/exhaustive-ui-core-menu.mjs.map +1 -1
  105. package/fesm2022/exhaustive-ui-core-menubar.mjs +64 -15
  106. package/fesm2022/exhaustive-ui-core-menubar.mjs.map +1 -1
  107. package/fesm2022/exhaustive-ui-core-message.mjs +2 -4
  108. package/fesm2022/exhaustive-ui-core-message.mjs.map +1 -1
  109. package/fesm2022/exhaustive-ui-core-metergroup.mjs +7 -7
  110. package/fesm2022/exhaustive-ui-core-metergroup.mjs.map +1 -1
  111. package/fesm2022/exhaustive-ui-core-multiselect.mjs +38 -27
  112. package/fesm2022/exhaustive-ui-core-multiselect.mjs.map +1 -1
  113. package/fesm2022/exhaustive-ui-core-orderlist.mjs +19 -6
  114. package/fesm2022/exhaustive-ui-core-orderlist.mjs.map +1 -1
  115. package/fesm2022/exhaustive-ui-core-organizationchart.mjs +2 -2
  116. package/fesm2022/exhaustive-ui-core-organizationchart.mjs.map +1 -1
  117. package/fesm2022/exhaustive-ui-core-overlay.mjs +6 -4
  118. package/fesm2022/exhaustive-ui-core-overlay.mjs.map +1 -1
  119. package/fesm2022/exhaustive-ui-core-overlaybadge.mjs +4 -4
  120. package/fesm2022/exhaustive-ui-core-overlaybadge.mjs.map +1 -1
  121. package/fesm2022/exhaustive-ui-core-paginator.mjs +12 -5
  122. package/fesm2022/exhaustive-ui-core-paginator.mjs.map +1 -1
  123. package/fesm2022/exhaustive-ui-core-panel.mjs +9 -11
  124. package/fesm2022/exhaustive-ui-core-panel.mjs.map +1 -1
  125. package/fesm2022/exhaustive-ui-core-panelmenu.mjs +43 -15
  126. package/fesm2022/exhaustive-ui-core-panelmenu.mjs.map +1 -1
  127. package/fesm2022/exhaustive-ui-core-password.mjs +93 -25
  128. package/fesm2022/exhaustive-ui-core-password.mjs.map +1 -1
  129. package/fesm2022/exhaustive-ui-core-picklist.mjs +33 -12
  130. package/fesm2022/exhaustive-ui-core-picklist.mjs.map +1 -1
  131. package/fesm2022/exhaustive-ui-core-popover.mjs +27 -8
  132. package/fesm2022/exhaustive-ui-core-popover.mjs.map +1 -1
  133. package/fesm2022/exhaustive-ui-core-progressbar.mjs +5 -5
  134. package/fesm2022/exhaustive-ui-core-progressbar.mjs.map +1 -1
  135. package/fesm2022/exhaustive-ui-core-progressspinner.mjs +2 -2
  136. package/fesm2022/exhaustive-ui-core-progressspinner.mjs.map +1 -1
  137. package/fesm2022/exhaustive-ui-core-radiobutton.mjs +8 -3
  138. package/fesm2022/exhaustive-ui-core-radiobutton.mjs.map +1 -1
  139. package/fesm2022/exhaustive-ui-core-rating.mjs +2 -2
  140. package/fesm2022/exhaustive-ui-core-rating.mjs.map +1 -1
  141. package/fesm2022/exhaustive-ui-core-scroller.mjs +14 -4
  142. package/fesm2022/exhaustive-ui-core-scroller.mjs.map +1 -1
  143. package/fesm2022/exhaustive-ui-core-scrollpanel.mjs +2 -2
  144. package/fesm2022/exhaustive-ui-core-scrollpanel.mjs.map +1 -1
  145. package/fesm2022/exhaustive-ui-core-scrolltop.mjs +11 -3
  146. package/fesm2022/exhaustive-ui-core-scrolltop.mjs.map +1 -1
  147. package/fesm2022/exhaustive-ui-core-select.mjs +102 -29
  148. package/fesm2022/exhaustive-ui-core-select.mjs.map +1 -1
  149. package/fesm2022/exhaustive-ui-core-selectbutton.mjs +13 -7
  150. package/fesm2022/exhaustive-ui-core-selectbutton.mjs.map +1 -1
  151. package/fesm2022/exhaustive-ui-core-skeleton.mjs +2 -2
  152. package/fesm2022/exhaustive-ui-core-skeleton.mjs.map +1 -1
  153. package/fesm2022/exhaustive-ui-core-slider.mjs +18 -5
  154. package/fesm2022/exhaustive-ui-core-slider.mjs.map +1 -1
  155. package/fesm2022/exhaustive-ui-core-speeddial.mjs +2 -2
  156. package/fesm2022/exhaustive-ui-core-speeddial.mjs.map +1 -1
  157. package/fesm2022/exhaustive-ui-core-splitbutton.mjs +9 -5
  158. package/fesm2022/exhaustive-ui-core-splitbutton.mjs.map +1 -1
  159. package/fesm2022/exhaustive-ui-core-splitter.mjs +29 -8
  160. package/fesm2022/exhaustive-ui-core-splitter.mjs.map +1 -1
  161. package/fesm2022/exhaustive-ui-core-stepper.mjs +8 -4
  162. package/fesm2022/exhaustive-ui-core-stepper.mjs.map +1 -1
  163. package/fesm2022/exhaustive-ui-core-steps.mjs +2 -2
  164. package/fesm2022/exhaustive-ui-core-steps.mjs.map +1 -1
  165. package/fesm2022/exhaustive-ui-core-table.mjs +535 -203
  166. package/fesm2022/exhaustive-ui-core-table.mjs.map +1 -1
  167. package/fesm2022/exhaustive-ui-core-tabs.mjs +44 -8
  168. package/fesm2022/exhaustive-ui-core-tabs.mjs.map +1 -1
  169. package/fesm2022/exhaustive-ui-core-tag.mjs +2 -2
  170. package/fesm2022/exhaustive-ui-core-tag.mjs.map +1 -1
  171. package/fesm2022/exhaustive-ui-core-terminal.mjs +1 -1
  172. package/fesm2022/exhaustive-ui-core-terminal.mjs.map +1 -1
  173. package/fesm2022/exhaustive-ui-core-textarea.mjs +9 -4
  174. package/fesm2022/exhaustive-ui-core-textarea.mjs.map +1 -1
  175. package/fesm2022/exhaustive-ui-core-tieredmenu.mjs +31 -16
  176. package/fesm2022/exhaustive-ui-core-tieredmenu.mjs.map +1 -1
  177. package/fesm2022/exhaustive-ui-core-timeline.mjs +2 -2
  178. package/fesm2022/exhaustive-ui-core-timeline.mjs.map +1 -1
  179. package/fesm2022/exhaustive-ui-core-toast.mjs +17 -5
  180. package/fesm2022/exhaustive-ui-core-toast.mjs.map +1 -1
  181. package/fesm2022/exhaustive-ui-core-togglebutton.mjs +11 -4
  182. package/fesm2022/exhaustive-ui-core-togglebutton.mjs.map +1 -1
  183. package/fesm2022/exhaustive-ui-core-toggleswitch.mjs +2 -4
  184. package/fesm2022/exhaustive-ui-core-toggleswitch.mjs.map +1 -1
  185. package/fesm2022/exhaustive-ui-core-toolbar.mjs +2 -2
  186. package/fesm2022/exhaustive-ui-core-toolbar.mjs.map +1 -1
  187. package/fesm2022/exhaustive-ui-core-tooltip.mjs +5 -1
  188. package/fesm2022/exhaustive-ui-core-tooltip.mjs.map +1 -1
  189. package/fesm2022/exhaustive-ui-core-tree.mjs +30 -11
  190. package/fesm2022/exhaustive-ui-core-tree.mjs.map +1 -1
  191. package/fesm2022/exhaustive-ui-core-treeselect.mjs +53 -6
  192. package/fesm2022/exhaustive-ui-core-treeselect.mjs.map +1 -1
  193. package/fesm2022/exhaustive-ui-core-treetable.mjs +93 -21
  194. package/fesm2022/exhaustive-ui-core-treetable.mjs.map +1 -1
  195. package/fesm2022/exhaustive-ui-core-usestyle.mjs +49 -0
  196. package/fesm2022/exhaustive-ui-core-usestyle.mjs.map +1 -1
  197. package/fesm2022/exhaustive-ui-core-utils.mjs +2 -1
  198. package/fesm2022/exhaustive-ui-core-utils.mjs.map +1 -1
  199. package/package.json +5 -5
  200. package/schematics/migrate-from-primeflex/index.js +4 -2
  201. package/schematics/migrate-from-primeflex/schema.json +5 -0
  202. package/schematics/utils/package-json.js +17 -0
  203. package/schematics/utils/primeflex.js +45 -10
  204. package/schematics/utils/versions.json +8 -8
  205. package/types/exhaustive-ui-core-api.d.ts +6 -0
  206. package/types/exhaustive-ui-core-autocomplete.d.ts +2 -0
  207. package/types/exhaustive-ui-core-badge.d.ts +1 -0
  208. package/types/exhaustive-ui-core-basecomponent.d.ts +16 -0
  209. package/types/exhaustive-ui-core-breadcrumb.d.ts +7 -1
  210. package/types/exhaustive-ui-core-button.d.ts +12 -1
  211. package/types/exhaustive-ui-core-cascadeselect.d.ts +2 -1
  212. package/types/exhaustive-ui-core-chart.d.ts +2 -2
  213. package/types/exhaustive-ui-core-confirmdialog.d.ts +17 -5
  214. package/types/exhaustive-ui-core-confirmpopup.d.ts +4 -0
  215. package/types/exhaustive-ui-core-datepicker.d.ts +10 -2
  216. package/types/exhaustive-ui-core-dialog.d.ts +2 -0
  217. package/types/exhaustive-ui-core-drawer.d.ts +1 -0
  218. package/types/exhaustive-ui-core-fileupload.d.ts +4 -0
  219. package/types/exhaustive-ui-core-iconfield.d.ts +1 -2
  220. package/types/exhaustive-ui-core-image.d.ts +6 -1
  221. package/types/exhaustive-ui-core-inputnumber.d.ts +8 -0
  222. package/types/exhaustive-ui-core-keyfilter.d.ts +1 -0
  223. package/types/exhaustive-ui-core-megamenu.d.ts +1 -0
  224. package/types/exhaustive-ui-core-menu.d.ts +2 -0
  225. package/types/exhaustive-ui-core-menubar.d.ts +6 -0
  226. package/types/exhaustive-ui-core-metergroup.d.ts +1 -1
  227. package/types/exhaustive-ui-core-multiselect.d.ts +1 -1
  228. package/types/exhaustive-ui-core-orderlist.d.ts +11 -1
  229. package/types/exhaustive-ui-core-paginator.d.ts +1 -0
  230. package/types/exhaustive-ui-core-panelmenu.d.ts +7 -0
  231. package/types/exhaustive-ui-core-password.d.ts +9 -1
  232. package/types/exhaustive-ui-core-picklist.d.ts +8 -3
  233. package/types/exhaustive-ui-core-popover.d.ts +3 -0
  234. package/types/exhaustive-ui-core-select.d.ts +13 -1
  235. package/types/exhaustive-ui-core-selectbutton.d.ts +3 -0
  236. package/types/exhaustive-ui-core-splitbutton.d.ts +2 -1
  237. package/types/exhaustive-ui-core-splitter.d.ts +7 -1
  238. package/types/exhaustive-ui-core-stepper.d.ts +3 -2
  239. package/types/exhaustive-ui-core-table.d.ts +34 -4
  240. package/types/exhaustive-ui-core-tabs.d.ts +4 -0
  241. package/types/exhaustive-ui-core-tieredmenu.d.ts +2 -0
  242. package/types/exhaustive-ui-core-togglebutton.d.ts +1 -0
  243. package/types/exhaustive-ui-core-tree.d.ts +2 -0
  244. package/types/exhaustive-ui-core-treeselect.d.ts +12 -1
  245. package/types/exhaustive-ui-core-treetable.d.ts +22 -2
  246. package/types/exhaustive-ui-core-types-chart.d.ts +21 -1
  247. package/types/exhaustive-ui-core-types-confirmdialog.d.ts +1 -3
  248. package/types/exhaustive-ui-core-types-table.d.ts +1 -1
  249. package/types/exhaustive-ui-core-types-treetable.d.ts +2 -2
  250. package/types/exhaustive-ui-core-usestyle.d.ts +17 -0
@@ -1,6 +1,6 @@
1
1
  export * from '@exhaustive-ui/core/types/table';
2
2
  import * as i0 from '@angular/core';
3
- import { Injectable, InjectionToken, input, booleanAttribute, numberAttribute, model, computed, output, viewChild, contentChildren, linkedSignal, signal, contentChild, inject, NgZone, afterEveryRender, afterNextRender, effect, untracked, ViewEncapsulation, ChangeDetectionStrategy, Component, Directive, HostListener, ElementRef, NgModule } from '@angular/core';
3
+ import { Injectable, InjectionToken, input, booleanAttribute, numberAttribute, model, computed, output, viewChild, contentChildren, linkedSignal, signal, contentChild, inject, NgZone, afterNextRender, effect, untracked, ViewEncapsulation, ChangeDetectionStrategy, Component, Directive, HostListener, ElementRef, afterEveryRender, NgModule } from '@angular/core';
4
4
  import { style as style$1 } from '@exhaustive-ui/styles/datatable';
5
5
  import { BaseStyle } from '@exhaustive-ui/core/base';
6
6
  import * as i2 from '@angular/common';
@@ -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 */
@@ -1413,7 +1418,7 @@ class Table extends BaseComponent {
1413
1418
  bindDirectiveInstance = inject(Bind, { self: true });
1414
1419
  constructor() {
1415
1420
  super();
1416
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptms(['host', 'root'])));
1421
+ this.bindHostAttrs(this.bindDirectiveInstance, () => this.ptms(['host', 'root']));
1417
1422
  afterNextRender(() => {
1418
1423
  if (isPlatformBrowser(this.platformId)) {
1419
1424
  if (this.isStateful() && this.resizableColumns()) {
@@ -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;
@@ -2702,6 +2748,46 @@ class Table extends BaseComponent {
2702
2748
  this.dropPosition.set(null);
2703
2749
  }
2704
2750
  }
2751
+ // keyboard alternative to the drag and drop: move the column one place towards the given direction
2752
+ onColumnKeyboardReorder(event, columnElement) {
2753
+ const isRTL = getComputedStyle(this.el?.nativeElement ?? document.documentElement).direction === 'rtl';
2754
+ const forward = (event.code === 'ArrowRight') !== isRTL;
2755
+ const dropColumn = forward ? columnElement.nextElementSibling : columnElement.previousElementSibling;
2756
+ if (this.reorderableColumns() && dropColumn?.hasAttribute('preorderablecolumn')) {
2757
+ this.draggedColumn.set(columnElement);
2758
+ this.dropPosition.set(forward ? 1 : -1);
2759
+ this.onColumnDrop(event, dropColumn);
2760
+ // re-rendering the header can move the focused cell: keep the focus on it and announce its new place
2761
+ setTimeout(() => {
2762
+ if (columnElement.isConnected) {
2763
+ columnElement.focus();
2764
+ const cells = Array.from(columnElement.parentElement?.children ?? []);
2765
+ this.announceReorder('columnMoved', cells.indexOf(columnElement) + 1, cells.length);
2766
+ }
2767
+ });
2768
+ }
2769
+ }
2770
+ /**
2771
+ * Text of the live region that tells screen readers where a column or a row moved with the keyboard.
2772
+ * @group Interface
2773
+ */
2774
+ reorderAnnouncement = signal('', /* @ts-ignore */
2775
+ ...(ngDevMode ? [{ debugName: "reorderAnnouncement" }] : /* istanbul ignore next */ []));
2776
+ announceReorder(key, position, total) {
2777
+ const fallback = key === 'columnMoved' ? 'Column moved to position {position} of {total}' : 'Row moved to position {position} of {total}';
2778
+ const template = this.config.translation?.aria?.[key] ?? fallback;
2779
+ this.reorderAnnouncement.set(template.replace('{position}', String(position)).replace('{total}', String(total)));
2780
+ }
2781
+ onColumnDragEnd() {
2782
+ // a drop outside a header fires no drop event: clear the drag state here
2783
+ if (this.draggedColumn()) {
2784
+ this.reorderIndicatorUpViewChild().nativeElement.style.display = 'none';
2785
+ this.reorderIndicatorDownViewChild().nativeElement.style.display = 'none';
2786
+ this.draggedColumn().draggable = false;
2787
+ this.draggedColumn.set(null);
2788
+ this.dropPosition.set(null);
2789
+ }
2790
+ }
2705
2791
  resizeTableCells(newColumnWidth, nextColumnWidth) {
2706
2792
  let colIndex = DomHandler.index(this.resizeColumnElement());
2707
2793
  let width = this.columnResizeMode() === 'expand' ? this._initialColWidths() : this._totalTableWidth();
@@ -2722,7 +2808,7 @@ class Table extends BaseComponent {
2722
2808
  }
2723
2809
  `;
2724
2810
  });
2725
- this.renderer.setProperty(this.styleElement(), 'innerHTML', innerHTML);
2811
+ this.renderer.setProperty(this.styleElement(), 'textContent', innerHTML);
2726
2812
  }
2727
2813
  onRowDragStart(event, index) {
2728
2814
  this.rowDragging.set(true);
@@ -2784,6 +2870,23 @@ class Table extends BaseComponent {
2784
2870
  this.onRowDragLeave(event, rowElement);
2785
2871
  this.onRowDragEnd(event);
2786
2872
  }
2873
+ // keyboard alternative to the drag and drop: move the row one place up (-1) or down (1)
2874
+ onRowKeyboardReorder(event, index, offset) {
2875
+ const value = this._value();
2876
+ const dropIndex = index + offset;
2877
+ if (value && dropIndex >= 0 && dropIndex < value.length) {
2878
+ event.preventDefault();
2879
+ ObjectUtils.reorderArray(value, index, dropIndex);
2880
+ if (this.virtualScroll()) {
2881
+ this._value.set([...value]);
2882
+ }
2883
+ this.onRowReorder.emit({
2884
+ dragIndex: index,
2885
+ dropIndex: dropIndex
2886
+ });
2887
+ this.announceReorder('rowMoved', dropIndex + 1, value.length);
2888
+ }
2889
+ }
2787
2890
  isEmpty = computed(() => {
2788
2891
  let data = this.filteredValue() || this._value();
2789
2892
  return data == null || data.length == 0;
@@ -2861,10 +2964,10 @@ class Table extends BaseComponent {
2861
2964
  if (stateString) {
2862
2965
  let state = JSON.parse(stateString, reviver);
2863
2966
  if (this.paginator()) {
2864
- if (this.first() !== undefined) {
2967
+ if (this.first() !== undefined && state.first !== undefined) {
2865
2968
  this.first.set(state.first);
2866
2969
  }
2867
- if (this.rows() !== undefined) {
2970
+ if (this.rows() !== undefined && state.rows !== undefined) {
2868
2971
  this.rows.set(state.rows);
2869
2972
  }
2870
2973
  }
@@ -2932,7 +3035,7 @@ class Table extends BaseComponent {
2932
3035
  }
2933
3036
  `;
2934
3037
  });
2935
- this.styleElement().innerHTML = innerHTML;
3038
+ this.styleElement().textContent = innerHTML;
2936
3039
  }
2937
3040
  }
2938
3041
  }
@@ -3023,7 +3126,7 @@ class Table extends BaseComponent {
3023
3126
  }
3024
3127
  }
3025
3128
  `;
3026
- this.renderer.setProperty(this.responsiveStyleElement(), 'innerHTML', innerHTML);
3129
+ this.renderer.setProperty(this.responsiveStyleElement(), 'textContent', innerHTML);
3027
3130
  DomHandler.setAttribute(this.responsiveStyleElement(), 'nonce', this.config?.csp()?.nonce);
3028
3131
  }
3029
3132
  }
@@ -3077,7 +3180,7 @@ class Table extends BaseComponent {
3077
3180
  </div>
3078
3181
  }
3079
3182
  @if (captionTemplate() || _captionTemplate()) {
3080
- <div [class]="cx('header')" [pBind]="ptm('header')">
3183
+ <div [class]="cx('header')" [pBind]="ptm('header')" [attr.id]="id + '-caption'">
3081
3184
  <ng-container *ngTemplateOutlet="captionTemplate() || _captionTemplate()"></ng-container>
3082
3185
  </div>
3083
3186
  }
@@ -3101,7 +3204,7 @@ class Table extends BaseComponent {
3101
3204
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3102
3205
  [showJumpToPageInput]="showJumpToPageInput()"
3103
3206
  [showPageLinks]="showPageLinks()"
3104
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3207
+ [class]="cn(cx('pcPaginator', { position: 'top' }), paginatorStyleClass())"
3105
3208
  [locale]="paginatorLocale()"
3106
3209
  [pt]="ptm('pcPaginator')"
3107
3210
  [unstyled]="unstyled()"
@@ -3183,7 +3286,7 @@ class Table extends BaseComponent {
3183
3286
  }
3184
3287
 
3185
3288
  <ng-template #buildInTable let-items let-scrollerOptions="options">
3186
- <table #table role="table" [class]="cn(cx('table'), tableStyleClass())" [pBind]="ptm('table')" [style]="tableStyle()" [attr.id]="id + '-table'">
3289
+ <table #table role="table" [class]="cn(cx('table'), tableStyleClass())" [pBind]="ptm('table')" [style]="tableStyle()" [attr.id]="id + '-table'" [attr.aria-labelledby]="captionTemplate() || _captionTemplate() ? id + '-caption' : null">
3187
3290
  <ng-container *ngTemplateOutlet="colGroupTemplate() || _colGroupTemplate(); context: { $implicit: scrollerOptions.columns }"></ng-container>
3188
3291
  <thead role="rowgroup" #thead [class]="cx('thead')" [ngStyle]="sx('thead')" [pBind]="ptm('thead')">
3189
3292
  <ng-container
@@ -3265,7 +3368,7 @@ class Table extends BaseComponent {
3265
3368
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3266
3369
  [showJumpToPageInput]="showJumpToPageInput()"
3267
3370
  [showPageLinks]="showPageLinks()"
3268
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3371
+ [class]="cn(cx('pcPaginator', { position: 'bottom' }), paginatorStyleClass())"
3269
3372
  [locale]="paginatorLocale()"
3270
3373
  [pt]="ptm('pcPaginator')"
3271
3374
  [unstyled]="unstyled()"
@@ -3307,6 +3410,7 @@ class Table extends BaseComponent {
3307
3410
  @if (resizableColumns()) {
3308
3411
  <div #resizeHelper [ngClass]="cx('columnResizeIndicator')" [pBind]="ptm('columnResizeIndicator')" [style.display]="'none'"></div>
3309
3412
  }
3413
+ <span class="p-hidden-accessible" aria-live="polite" aria-atomic="true" [attr.data-pc-section]="'reorderannouncement'">{{ reorderAnnouncement() }}</span>
3310
3414
  @if (reorderableColumns()) {
3311
3415
  <span #reorderIndicatorUp [ngClass]="cx('rowReorderIndicatorUp')" [pBind]="ptm('rowReorderIndicatorUp')" [style.display]="'none'">
3312
3416
  @if (!reorderIndicatorUpIconTemplate() && !_reorderIndicatorUpIconTemplate()) {
@@ -3349,7 +3453,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3349
3453
  </div>
3350
3454
  }
3351
3455
  @if (captionTemplate() || _captionTemplate()) {
3352
- <div [class]="cx('header')" [pBind]="ptm('header')">
3456
+ <div [class]="cx('header')" [pBind]="ptm('header')" [attr.id]="id + '-caption'">
3353
3457
  <ng-container *ngTemplateOutlet="captionTemplate() || _captionTemplate()"></ng-container>
3354
3458
  </div>
3355
3459
  }
@@ -3373,7 +3477,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3373
3477
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3374
3478
  [showJumpToPageInput]="showJumpToPageInput()"
3375
3479
  [showPageLinks]="showPageLinks()"
3376
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3480
+ [class]="cn(cx('pcPaginator', { position: 'top' }), paginatorStyleClass())"
3377
3481
  [locale]="paginatorLocale()"
3378
3482
  [pt]="ptm('pcPaginator')"
3379
3483
  [unstyled]="unstyled()"
@@ -3455,7 +3559,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3455
3559
  }
3456
3560
 
3457
3561
  <ng-template #buildInTable let-items let-scrollerOptions="options">
3458
- <table #table role="table" [class]="cn(cx('table'), tableStyleClass())" [pBind]="ptm('table')" [style]="tableStyle()" [attr.id]="id + '-table'">
3562
+ <table #table role="table" [class]="cn(cx('table'), tableStyleClass())" [pBind]="ptm('table')" [style]="tableStyle()" [attr.id]="id + '-table'" [attr.aria-labelledby]="captionTemplate() || _captionTemplate() ? id + '-caption' : null">
3459
3563
  <ng-container *ngTemplateOutlet="colGroupTemplate() || _colGroupTemplate(); context: { $implicit: scrollerOptions.columns }"></ng-container>
3460
3564
  <thead role="rowgroup" #thead [class]="cx('thead')" [ngStyle]="sx('thead')" [pBind]="ptm('thead')">
3461
3565
  <ng-container
@@ -3537,7 +3641,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3537
3641
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3538
3642
  [showJumpToPageInput]="showJumpToPageInput()"
3539
3643
  [showPageLinks]="showPageLinks()"
3540
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3644
+ [class]="cn(cx('pcPaginator', { position: 'bottom' }), paginatorStyleClass())"
3541
3645
  [locale]="paginatorLocale()"
3542
3646
  [pt]="ptm('pcPaginator')"
3543
3647
  [unstyled]="unstyled()"
@@ -3579,6 +3683,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3579
3683
  @if (resizableColumns()) {
3580
3684
  <div #resizeHelper [ngClass]="cx('columnResizeIndicator')" [pBind]="ptm('columnResizeIndicator')" [style.display]="'none'"></div>
3581
3685
  }
3686
+ <span class="p-hidden-accessible" aria-live="polite" aria-atomic="true" [attr.data-pc-section]="'reorderannouncement'">{{ reorderAnnouncement() }}</span>
3582
3687
  @if (reorderableColumns()) {
3583
3688
  <span #reorderIndicatorUp [ngClass]="cx('rowReorderIndicatorUp')" [pBind]="ptm('rowReorderIndicatorUp')" [style.display]="'none'">
3584
3689
  @if (!reorderIndicatorUpIconTemplate() && !_reorderIndicatorUpIconTemplate()) {
@@ -3721,6 +3826,11 @@ class TableBody extends BaseComponent {
3721
3826
  const getItemOptions = this.getScrollerOption('getItemOptions');
3722
3827
  return getItemOptions ? getItemOptions(index).index : index;
3723
3828
  }
3829
+ // the group header/footer checks compare a row with its neighbours in value(); with virtual scroll
3830
+ // value() only holds the rendered slice, so the index must stay relative to that slice
3831
+ getGroupRowIndex(rowIndex) {
3832
+ return this.dataTable.virtualScroll() ? rowIndex + (this.dataTable.first() || 0) : this.getRowIndex(rowIndex);
3833
+ }
3724
3834
  dataP = computed(() => {
3725
3835
  return this.cn({
3726
3836
  hoverable: this.dataTable.rowHover() || this.dataTable.selectionMode(),
@@ -3732,7 +3842,7 @@ class TableBody extends BaseComponent {
3732
3842
  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: `
3733
3843
  @if (!dataTable.expandedRowTemplate() && !dataTable._expandedRowTemplate()) {
3734
3844
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3735
- @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3845
+ @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getGroupRowIndex(rowIndex))) {
3736
3846
  <ng-container role="row">
3737
3847
  <ng-container
3738
3848
  *ngTemplateOutlet="
@@ -3778,7 +3888,7 @@ class TableBody extends BaseComponent {
3778
3888
  "
3779
3889
  ></ng-container>
3780
3890
  }
3781
- @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getRowIndex(rowIndex))) {
3891
+ @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getGroupRowIndex(rowIndex))) {
3782
3892
  <ng-container role="row">
3783
3893
  <ng-container
3784
3894
  *ngTemplateOutlet="
@@ -3798,21 +3908,6 @@ class TableBody extends BaseComponent {
3798
3908
  }
3799
3909
  @if ((dataTable.expandedRowTemplate() || dataTable._expandedRowTemplate()) && !(frozen() && (dataTable.frozenExpandedRowTemplate() || dataTable._frozenExpandedRowTemplate()))) {
3800
3910
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3801
- @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
3802
- <ng-container
3803
- *ngTemplateOutlet="
3804
- template();
3805
- context: {
3806
- $implicit: rowData,
3807
- rowIndex: getRowIndex(rowIndex),
3808
- columns: columns(),
3809
- expanded: dataTable.isRowExpanded(rowData),
3810
- editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
3811
- frozen: frozen()
3812
- }
3813
- "
3814
- ></ng-container>
3815
- }
3816
3911
  @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3817
3912
  <ng-container role="row">
3818
3913
  <ng-container
@@ -3830,6 +3925,21 @@ class TableBody extends BaseComponent {
3830
3925
  ></ng-container>
3831
3926
  </ng-container>
3832
3927
  }
3928
+ @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
3929
+ <ng-container
3930
+ *ngTemplateOutlet="
3931
+ rowData ? template() : dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate();
3932
+ context: {
3933
+ $implicit: rowData,
3934
+ rowIndex: getRowIndex(rowIndex),
3935
+ columns: columns(),
3936
+ expanded: dataTable.isRowExpanded(rowData),
3937
+ editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
3938
+ frozen: frozen()
3939
+ }
3940
+ "
3941
+ ></ng-container>
3942
+ }
3833
3943
  @if (dataTable.isRowExpanded(rowData)) {
3834
3944
  <ng-container
3835
3945
  *ngTemplateOutlet="
@@ -3895,7 +4005,7 @@ class TableBody extends BaseComponent {
3895
4005
  @if (dataTable.loading()) {
3896
4006
  <ng-container *ngTemplateOutlet="dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
3897
4007
  }
3898
- @if (dataTable.isEmpty() && !dataTable.loading()) {
4008
+ @if (dataTable.isEmpty() && !dataTable.loading() && !frozenRows()) {
3899
4009
  <ng-container *ngTemplateOutlet="dataTable.emptyMessageTemplate() || dataTable._emptyMessageTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
3900
4010
  }
3901
4011
  `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None });
@@ -3908,7 +4018,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3908
4018
  template: `
3909
4019
  @if (!dataTable.expandedRowTemplate() && !dataTable._expandedRowTemplate()) {
3910
4020
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3911
- @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
4021
+ @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getGroupRowIndex(rowIndex))) {
3912
4022
  <ng-container role="row">
3913
4023
  <ng-container
3914
4024
  *ngTemplateOutlet="
@@ -3954,7 +4064,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3954
4064
  "
3955
4065
  ></ng-container>
3956
4066
  }
3957
- @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getRowIndex(rowIndex))) {
4067
+ @if ((dataTable.groupFooterTemplate() || dataTable._groupFooterTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupFooter(value(), rowData, getGroupRowIndex(rowIndex))) {
3958
4068
  <ng-container role="row">
3959
4069
  <ng-container
3960
4070
  *ngTemplateOutlet="
@@ -3974,21 +4084,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3974
4084
  }
3975
4085
  @if ((dataTable.expandedRowTemplate() || dataTable._expandedRowTemplate()) && !(frozen() && (dataTable.frozenExpandedRowTemplate() || dataTable._frozenExpandedRowTemplate()))) {
3976
4086
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3977
- @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
3978
- <ng-container
3979
- *ngTemplateOutlet="
3980
- template();
3981
- context: {
3982
- $implicit: rowData,
3983
- rowIndex: getRowIndex(rowIndex),
3984
- columns: columns(),
3985
- expanded: dataTable.isRowExpanded(rowData),
3986
- editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
3987
- frozen: frozen()
3988
- }
3989
- "
3990
- ></ng-container>
3991
- }
3992
4087
  @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3993
4088
  <ng-container role="row">
3994
4089
  <ng-container
@@ -4006,6 +4101,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4006
4101
  ></ng-container>
4007
4102
  </ng-container>
4008
4103
  }
4104
+ @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
4105
+ <ng-container
4106
+ *ngTemplateOutlet="
4107
+ rowData ? template() : dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate();
4108
+ context: {
4109
+ $implicit: rowData,
4110
+ rowIndex: getRowIndex(rowIndex),
4111
+ columns: columns(),
4112
+ expanded: dataTable.isRowExpanded(rowData),
4113
+ editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
4114
+ frozen: frozen()
4115
+ }
4116
+ "
4117
+ ></ng-container>
4118
+ }
4009
4119
  @if (dataTable.isRowExpanded(rowData)) {
4010
4120
  <ng-container
4011
4121
  *ngTemplateOutlet="
@@ -4071,7 +4181,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4071
4181
  @if (dataTable.loading()) {
4072
4182
  <ng-container *ngTemplateOutlet="dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
4073
4183
  }
4074
- @if (dataTable.isEmpty() && !dataTable.loading()) {
4184
+ @if (dataTable.isEmpty() && !dataTable.loading() && !frozenRows()) {
4075
4185
  <ng-container *ngTemplateOutlet="dataTable.emptyMessageTemplate() || dataTable._emptyMessageTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
4076
4186
  }
4077
4187
  `,
@@ -4118,8 +4228,6 @@ class FrozenColumn extends BaseComponent {
4118
4228
  ...(ngDevMode ? [{ debugName: "alignFrozen" }] : /* istanbul ignore next */ []));
4119
4229
  resizeListener = signal(undefined, /* @ts-ignore */
4120
4230
  ...(ngDevMode ? [{ debugName: "resizeListener" }] : /* istanbul ignore next */ []));
4121
- resizeObserver = signal(undefined, /* @ts-ignore */
4122
- ...(ngDevMode ? [{ debugName: "resizeObserver" }] : /* istanbul ignore next */ []));
4123
4231
  _componentStyle = inject(TableStyle);
4124
4232
  constructor() {
4125
4233
  super();
@@ -4127,18 +4235,14 @@ class FrozenColumn extends BaseComponent {
4127
4235
  this.frozen();
4128
4236
  untracked(() => Promise.resolve(null).then(() => this.updateStickyPosition()));
4129
4237
  });
4130
- afterNextRender(() => {
4131
- this.bindResizeListener();
4132
- this.observeChanges();
4133
- });
4238
+ afterNextRender(() => this.bindResizeListener());
4134
4239
  }
4240
+ // every frozen cell of the page shares one window resize listener and one ResizeObserver
4135
4241
  bindResizeListener() {
4136
- if (isPlatformBrowser(this.platformId)) {
4137
- if (!this.resizeListener()) {
4138
- this.resizeListener.set(this.renderer.listen(this.document.defaultView, 'resize', () => {
4139
- this.recalculateColumns();
4140
- }));
4141
- }
4242
+ if (isPlatformBrowser(this.platformId) && !this.resizeListener()) {
4243
+ const tracker = FrozenColumnTracker.get(this.document.defaultView);
4244
+ tracker.add(this);
4245
+ this.resizeListener.set(() => tracker.remove(this));
4142
4246
  }
4143
4247
  }
4144
4248
  unbindResizeListener() {
@@ -4148,41 +4252,38 @@ class FrozenColumn extends BaseComponent {
4148
4252
  }
4149
4253
  }
4150
4254
  observeChanges() {
4151
- if (isPlatformBrowser(this.platformId)) {
4152
- const resizeObserver = new ResizeObserver(() => {
4153
- this.recalculateColumns();
4154
- });
4155
- resizeObserver.observe(this.el.nativeElement);
4156
- this.resizeObserver.set(resizeObserver);
4157
- }
4255
+ this.bindResizeListener();
4158
4256
  }
4159
4257
  recalculateColumns() {
4160
- const siblings = DomHandler.siblings(this.el.nativeElement);
4161
- const index = DomHandler.index(this.el.nativeElement);
4162
- const time = (siblings.length - index + 1) * 50;
4163
- setTimeout(() => {
4164
- this.updateStickyPosition();
4165
- }, time);
4258
+ if (isPlatformBrowser(this.platformId)) {
4259
+ FrozenColumnTracker.get(this.document.defaultView).schedule();
4260
+ }
4166
4261
  }
4167
4262
  updateStickyPosition() {
4168
- if (this.frozen()) {
4263
+ if (this.frozen() && isPlatformBrowser(this.platformId)) {
4264
+ // alignFrozen is logical: in RTL the start (left alignment) is the physical right side
4265
+ const isRTL = this.document.defaultView?.getComputedStyle(this.el.nativeElement).direction === 'rtl';
4266
+ const startSide = isRTL ? 'right' : 'left';
4267
+ const endSide = isRTL ? 'left' : 'right';
4169
4268
  if (this.alignFrozen() === 'right') {
4170
- let right = 0;
4269
+ let end = 0;
4171
4270
  let sibling = this.el.nativeElement.nextElementSibling;
4172
4271
  while (sibling) {
4173
- right += DomHandler.getOuterWidth(sibling);
4272
+ end += this.getFrozenWidth(sibling);
4174
4273
  sibling = sibling.nextElementSibling;
4175
4274
  }
4176
- this.el.nativeElement.style.right = right + 'px';
4275
+ this.el.nativeElement.style[endSide] = end + 'px';
4276
+ this.el.nativeElement.style[startSide] = '';
4177
4277
  }
4178
4278
  else {
4179
- let left = 0;
4279
+ let start = 0;
4180
4280
  let sibling = this.el.nativeElement.previousElementSibling;
4181
4281
  while (sibling) {
4182
- left += DomHandler.getOuterWidth(sibling);
4282
+ start += this.getFrozenWidth(sibling);
4183
4283
  sibling = sibling.previousElementSibling;
4184
4284
  }
4185
- this.el.nativeElement.style.left = left + 'px';
4285
+ this.el.nativeElement.style[startSide] = start + 'px';
4286
+ this.el.nativeElement.style[endSide] = '';
4186
4287
  }
4187
4288
  const filterRow = this.el.nativeElement?.parentElement?.nextElementSibling;
4188
4289
  if (filterRow) {
@@ -4194,12 +4295,15 @@ class FrozenColumn extends BaseComponent {
4194
4295
  }
4195
4296
  }
4196
4297
  }
4298
+ // only the frozen (sticky) cells stay between a frozen cell and the edge: the others scroll away
4299
+ getFrozenWidth(cell) {
4300
+ return cell.getAttribute('data-p-frozen-column') === 'true' ? DomHandler.getOuterWidth(cell) : 0;
4301
+ }
4197
4302
  onDestroy() {
4198
4303
  this.unbindResizeListener();
4199
- this.resizeObserver()?.disconnect();
4200
4304
  }
4201
4305
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FrozenColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4202
- 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 });
4306
+ 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 });
4203
4307
  }
4204
4308
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FrozenColumn, decorators: [{
4205
4309
  type: Directive,
@@ -4207,11 +4311,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4207
4311
  selector: '[pFrozenColumn]',
4208
4312
  standalone: false,
4209
4313
  host: {
4210
- '[class]': 'cx("frozenColumn")'
4314
+ '[class]': 'cx("frozenColumn")',
4315
+ '[attr.data-p-frozen-column]': 'frozen()'
4211
4316
  },
4212
4317
  providers: [TableStyle]
4213
4318
  }]
4214
4319
  }], ctorParameters: () => [], propDecorators: { frozen: [{ type: i0.Input, args: [{ isSignal: true, alias: "frozen", required: false }] }], alignFrozen: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignFrozen", required: false }] }] } });
4320
+ /**
4321
+ * Recalculates the sticky positions of all the frozen cells of a window once per frame on a window resize or a size change of
4322
+ * any of them. A listener and an observer per cell made a resize or a page of many frozen cells block the page for seconds.
4323
+ */
4324
+ class FrozenColumnTracker {
4325
+ window;
4326
+ static trackers = new WeakMap();
4327
+ columns = new Set();
4328
+ observer;
4329
+ frame = null;
4330
+ onResize = () => this.schedule();
4331
+ static get(window) {
4332
+ let tracker = this.trackers.get(window);
4333
+ if (!tracker) {
4334
+ tracker = new FrozenColumnTracker(window);
4335
+ this.trackers.set(window, tracker);
4336
+ }
4337
+ return tracker;
4338
+ }
4339
+ constructor(window) {
4340
+ this.window = window;
4341
+ this.observer = new window.ResizeObserver(this.onResize);
4342
+ }
4343
+ add(column) {
4344
+ if (!this.columns.size) {
4345
+ this.window.addEventListener('resize', this.onResize);
4346
+ }
4347
+ this.columns.add(column);
4348
+ this.observer.observe(column.el.nativeElement);
4349
+ }
4350
+ remove(column) {
4351
+ this.columns.delete(column);
4352
+ this.observer.unobserve(column.el.nativeElement);
4353
+ if (!this.columns.size) {
4354
+ this.window.removeEventListener('resize', this.onResize);
4355
+ this.frame !== null && this.window.cancelAnimationFrame(this.frame);
4356
+ this.frame = null;
4357
+ }
4358
+ }
4359
+ schedule() {
4360
+ if (this.frame === null && this.columns.size) {
4361
+ this.frame = this.window.requestAnimationFrame(() => {
4362
+ this.frame = null;
4363
+ this.columns.forEach((column) => column.updateStickyPosition());
4364
+ });
4365
+ }
4366
+ }
4367
+ }
4215
4368
  class SortableColumn extends BaseComponent {
4216
4369
  dataTable = inject(Table);
4217
4370
  field = input(undefined, { ...(ngDevMode ? { debugName: "field" } : /* istanbul ignore next */ {}), alias: 'pSortableColumn' });
@@ -4280,7 +4433,7 @@ class SortableColumn extends BaseComponent {
4280
4433
  }
4281
4434
  }
4282
4435
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: SortableColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4283
- 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 });
4436
+ 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 });
4284
4437
  }
4285
4438
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: SortableColumn, decorators: [{
4286
4439
  type: Directive,
@@ -4290,7 +4443,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4290
4443
  host: {
4291
4444
  '[class]': "cx('sortableColumn')",
4292
4445
  '[tabindex]': 'isEnabled() ? "0" : null',
4293
- role: 'columnheader',
4446
+ '[attr.role]': 'role',
4294
4447
  '[attr.aria-sort]': 'sortOrder()'
4295
4448
  },
4296
4449
  providers: [TableStyle]
@@ -4304,6 +4457,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4304
4457
  }, {
4305
4458
  type: HostListener,
4306
4459
  args: ['keydown.enter', ['$event']]
4460
+ }, {
4461
+ type: HostListener,
4462
+ args: ['keydown.meta.space', ['$event']]
4463
+ }, {
4464
+ type: HostListener,
4465
+ args: ['keydown.meta.enter', ['$event']]
4466
+ }, {
4467
+ type: HostListener,
4468
+ args: ['keydown.control.space', ['$event']]
4469
+ }, {
4470
+ type: HostListener,
4471
+ args: ['keydown.control.enter', ['$event']]
4307
4472
  }] } });
4308
4473
  class SortIcon extends BaseComponent {
4309
4474
  dataTable = inject(Table);
@@ -4364,13 +4529,13 @@ class SortIcon extends BaseComponent {
4364
4529
  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: `
4365
4530
  @if (!(dataTable.sortIconTemplate() || dataTable._sortIconTemplate())) {
4366
4531
  @if (sortOrder() === 0) {
4367
- <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" />
4532
+ <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4368
4533
  }
4369
4534
  @if (sortOrder() === 1) {
4370
- <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" />
4535
+ <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4371
4536
  }
4372
4537
  @if (sortOrder() === -1) {
4373
- <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" />
4538
+ <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4374
4539
  }
4375
4540
  }
4376
4541
  @if (dataTable.sortIconTemplate() || dataTable._sortIconTemplate()) {
@@ -4391,13 +4556,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4391
4556
  template: `
4392
4557
  @if (!(dataTable.sortIconTemplate() || dataTable._sortIconTemplate())) {
4393
4558
  @if (sortOrder() === 0) {
4394
- <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" />
4559
+ <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4395
4560
  }
4396
4561
  @if (sortOrder() === 1) {
4397
- <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" />
4562
+ <svg data-p-icon="sort-amount-up-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4398
4563
  }
4399
4564
  @if (sortOrder() === -1) {
4400
- <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" />
4565
+ <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4401
4566
  }
4402
4567
  }
4403
4568
  @if (dataTable.sortIconTemplate() || dataTable._sortIconTemplate()) {
@@ -4434,7 +4599,8 @@ class SelectableRow extends BaseComponent {
4434
4599
  }
4435
4600
  setRowTabIndex() {
4436
4601
  if (this.dataTable.selectionMode() === 'single' || this.dataTable.selectionMode() === 'multiple') {
4437
- return !this.dataTable.selection() ? 0 : this.dataTable.anchorRowIndex() === this.index() ? 0 : -1;
4602
+ // sort, filter and page changes reset the anchor row to null: keep the rows reachable by Tab
4603
+ return !this.dataTable.selection() || this.dataTable.anchorRowIndex() == null ? 0 : this.dataTable.anchorRowIndex() === this.index() ? 0 : -1;
4438
4604
  }
4439
4605
  }
4440
4606
  onInit() {
@@ -4898,6 +5064,8 @@ class ReorderableColumn extends BaseComponent {
4898
5064
  ...(ngDevMode ? [{ debugName: "dragEnterListener" }] : /* istanbul ignore next */ []));
4899
5065
  dragLeaveListener = signal(undefined, /* @ts-ignore */
4900
5066
  ...(ngDevMode ? [{ debugName: "dragLeaveListener" }] : /* istanbul ignore next */ []));
5067
+ dragEndListener = signal(undefined, /* @ts-ignore */
5068
+ ...(ngDevMode ? [{ debugName: "dragEndListener" }] : /* istanbul ignore next */ []));
4901
5069
  mouseDownListener = signal(undefined, /* @ts-ignore */
4902
5070
  ...(ngDevMode ? [{ debugName: "mouseDownListener" }] : /* istanbul ignore next */ []));
4903
5071
  _componentStyle = inject(TableStyle);
@@ -4917,6 +5085,7 @@ class ReorderableColumn extends BaseComponent {
4917
5085
  this.dragOverListener.set(this.renderer.listen(this.el.nativeElement, 'dragover', this.onDragOver.bind(this)));
4918
5086
  this.dragEnterListener.set(this.renderer.listen(this.el.nativeElement, 'dragenter', this.onDragEnter.bind(this)));
4919
5087
  this.dragLeaveListener.set(this.renderer.listen(this.el.nativeElement, 'dragleave', this.onDragLeave.bind(this)));
5088
+ this.dragEndListener.set(this.renderer.listen(this.el.nativeElement, 'dragend', this.onDragEnd.bind(this)));
4920
5089
  });
4921
5090
  }
4922
5091
  }
@@ -4941,6 +5110,10 @@ class ReorderableColumn extends BaseComponent {
4941
5110
  this.dragLeaveListener()();
4942
5111
  this.dragLeaveListener.set(null);
4943
5112
  }
5113
+ if (this.dragEndListener()) {
5114
+ this.dragEndListener()();
5115
+ this.dragEndListener.set(null);
5116
+ }
4944
5117
  }
4945
5118
  onMouseDown(event) {
4946
5119
  if (event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA' || event.target.closest?.('[data-pc-column-resizer="true"]'))
@@ -4960,11 +5133,21 @@ class ReorderableColumn extends BaseComponent {
4960
5133
  onDragLeave(event) {
4961
5134
  this.dataTable.onColumnDragLeave(event);
4962
5135
  }
5136
+ onDragEnd() {
5137
+ this.dataTable.onColumnDragEnd();
5138
+ }
4963
5139
  onDrop(event) {
4964
5140
  if (this.isEnabled()) {
4965
5141
  this.dataTable.onColumnDrop(event, this.el.nativeElement);
4966
5142
  }
4967
5143
  }
5144
+ onKeyDown(event) {
5145
+ // Ctrl/Cmd + Left/Right on the header cell itself, not on an input or a button inside it
5146
+ if (this.isEnabled() && (event.ctrlKey || event.metaKey) && (event.code === 'ArrowLeft' || event.code === 'ArrowRight') && event.target === this.el.nativeElement) {
5147
+ event.preventDefault();
5148
+ this.dataTable.onColumnKeyboardReorder(event, this.el.nativeElement);
5149
+ }
5150
+ }
4968
5151
  isEnabled() {
4969
5152
  return this.pReorderableColumnDisabled() !== true;
4970
5153
  }
@@ -4972,7 +5155,7 @@ class ReorderableColumn extends BaseComponent {
4972
5155
  this.unbindEvents();
4973
5156
  }
4974
5157
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ReorderableColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4975
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: ReorderableColumn, isStandalone: false, selector: "[pReorderableColumn]", inputs: { pReorderableColumnDisabled: { classPropertyName: "pReorderableColumnDisabled", publicName: "pReorderableColumnDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "drop": "onDrop($event)" }, properties: { "class": "cx('reorderableColumn')" } }, providers: [TableStyle], usesInheritance: true, ngImport: i0 });
5158
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: ReorderableColumn, isStandalone: false, selector: "[pReorderableColumn]", inputs: { pReorderableColumnDisabled: { classPropertyName: "pReorderableColumnDisabled", publicName: "pReorderableColumnDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "drop": "onDrop($event)", "keydown": "onKeyDown($event)" }, properties: { "class": "cx('reorderableColumn')", "attr.tabindex": "isEnabled() && dataTable.reorderableColumns() ? \"0\" : null", "attr.aria-keyshortcuts": "isEnabled() && dataTable.reorderableColumns() ? \"Control+ArrowLeft Control+ArrowRight Meta+ArrowLeft Meta+ArrowRight\" : null" } }, providers: [TableStyle], usesInheritance: true, ngImport: i0 });
4976
5159
  }
4977
5160
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ReorderableColumn, decorators: [{
4978
5161
  type: Directive,
@@ -4980,13 +5163,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4980
5163
  selector: '[pReorderableColumn]',
4981
5164
  standalone: false,
4982
5165
  host: {
4983
- '[class]': "cx('reorderableColumn')"
5166
+ '[class]': "cx('reorderableColumn')",
5167
+ '[attr.tabindex]': 'isEnabled() && dataTable.reorderableColumns() ? "0" : null',
5168
+ '[attr.aria-keyshortcuts]': 'isEnabled() && dataTable.reorderableColumns() ? "Control+ArrowLeft Control+ArrowRight Meta+ArrowLeft Meta+ArrowRight" : null'
4984
5169
  },
4985
5170
  providers: [TableStyle]
4986
5171
  }]
4987
5172
  }], ctorParameters: () => [], propDecorators: { pReorderableColumnDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "pReorderableColumnDisabled", required: false }] }], onDrop: [{
4988
5173
  type: HostListener,
4989
5174
  args: ['drop', ['$event']]
5175
+ }], onKeyDown: [{
5176
+ type: HostListener,
5177
+ args: ['keydown', ['$event']]
4990
5178
  }] } });
4991
5179
  class EditableColumn extends BaseComponent {
4992
5180
  dataTable = inject(Table);
@@ -5041,6 +5229,7 @@ class EditableColumn extends BaseComponent {
5041
5229
  }
5042
5230
  openCell() {
5043
5231
  this.dataTable.updateEditingCell(this.el.nativeElement, this.data(), this.field(), this.rowIndex());
5232
+ this.dataTable.editingCellOriginalValue.set(ObjectUtils.resolveFieldData(this.data(), this.field()));
5044
5233
  !this.$unstyled() && DomHandler.addClass(this.el.nativeElement, 'p-cell-editing');
5045
5234
  setAttribute(this.el.nativeElement, 'data-p-cell-editing', 'true');
5046
5235
  this.dataTable.onEditInit.emit({
@@ -5065,6 +5254,9 @@ class EditableColumn extends BaseComponent {
5065
5254
  this.dataTable.overlaySubscription.set(this.dataTable.overlayService.clickObservable.subscribe(this.overlayEventListener()));
5066
5255
  }
5067
5256
  closeEditingCell(completed, event) {
5257
+ if (!completed && this.dataTable.editingCellData() && this.dataTable.editingCellField()) {
5258
+ this.dataTable.editingCellData()[this.dataTable.editingCellField()] = this.dataTable.editingCellOriginalValue();
5259
+ }
5068
5260
  const eventData = {
5069
5261
  field: this.dataTable.editingCellField(),
5070
5262
  data: this.dataTable.editingCellData(),
@@ -5076,11 +5268,6 @@ class EditableColumn extends BaseComponent {
5076
5268
  }
5077
5269
  else {
5078
5270
  this.dataTable.onEditCancel.emit(eventData);
5079
- this.dataTable._value().forEach((element) => {
5080
- if (element[this.dataTable.editingCellField()] === this.data()) {
5081
- element[this.dataTable.editingCellField()] = this.dataTable.editingCellData();
5082
- }
5083
- });
5084
5271
  }
5085
5272
  !this.$unstyled() && DomHandler.removeClass(this.dataTable.editingCell(), 'p-cell-editing');
5086
5273
  setAttribute(this.el.nativeElement, 'data-p-cell-editing', 'false');
@@ -5094,8 +5281,13 @@ class EditableColumn extends BaseComponent {
5094
5281
  }
5095
5282
  onEnterKeyDown(event) {
5096
5283
  if (this.isEnabled() && !event.shiftKey) {
5097
- if (this.dataTable.isEditingCellValid()) {
5284
+ if (!this.dataTable.editingCell()) {
5285
+ // keyboard alternative to the click that opens the editor of a focused cell
5286
+ this.openCell();
5287
+ }
5288
+ else if (this.dataTable.isEditingCellValid()) {
5098
5289
  this.closeEditingCell(true, event);
5290
+ this.el.nativeElement.focus();
5099
5291
  }
5100
5292
  event.preventDefault();
5101
5293
  }
@@ -5112,6 +5304,7 @@ class EditableColumn extends BaseComponent {
5112
5304
  if (this.isEnabled()) {
5113
5305
  if (this.dataTable.isEditingCellValid()) {
5114
5306
  this.closeEditingCell(false, event);
5307
+ this.el.nativeElement.focus();
5115
5308
  }
5116
5309
  event.preventDefault();
5117
5310
  }
@@ -5285,7 +5478,7 @@ class EditableColumn extends BaseComponent {
5285
5478
  }
5286
5479
  }
5287
5480
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: EditableColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
5288
- 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 });
5481
+ 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 });
5289
5482
  }
5290
5483
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: EditableColumn, decorators: [{
5291
5484
  type: Directive,
@@ -5293,7 +5486,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
5293
5486
  selector: '[pEditableColumn]',
5294
5487
  standalone: false,
5295
5488
  host: {
5296
- '[attr.data-p-editable-column]': 'true'
5489
+ '[attr.data-p-editable-column]': 'true',
5490
+ '[attr.tabindex]': 'isEnabled() ? "0" : null'
5297
5491
  }
5298
5492
  }]
5299
5493
  }], 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: [{
@@ -5662,7 +5856,7 @@ class TableHeaderCheckbox extends BaseComponent {
5662
5856
  valueChangeSubscription;
5663
5857
  constructor() {
5664
5858
  super();
5665
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptm('headerCheckbox')));
5859
+ this.bindHostAttrs(this.bindDirectiveInstance, () => this.ptm('headerCheckbox'));
5666
5860
  this.valueChangeSubscription = this.dataTable.tableService.valueSource$.subscribe(() => {
5667
5861
  this.checked.set(this.updateCheckedState());
5668
5862
  this._ariaLabel.set(this._ariaLabel() || (this.dataTable.config.translation.aria ? (this.checked() ? this.dataTable.config.translation.aria.selectAll : this.dataTable.config.translation.aria.unselectAll) : undefined));
@@ -5758,15 +5952,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
5758
5952
  }], ctorParameters: () => [], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
5759
5953
  class ReorderableRowHandle extends BaseComponent {
5760
5954
  el = inject(ElementRef);
5955
+ row = inject(ReorderableRow, { optional: true });
5761
5956
  hostName = 'Table';
5762
5957
  bindDirectiveInstance = inject(Bind, { self: true });
5763
5958
  _componentStyle = inject(TableStyle);
5764
5959
  constructor() {
5765
5960
  super();
5766
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptm('reorderableRowHandle')));
5961
+ this.bindHostAttrs(this.bindDirectiveInstance, () => this.ptm('reorderableRowHandle'));
5962
+ }
5963
+ onKeyDown(event) {
5964
+ // Ctrl/Cmd + Up/Down moves the row; stop it there so a selectable row does not move the focus too
5965
+ if (this.row?.isEnabled() && (event.ctrlKey || event.metaKey) && (event.code === 'ArrowUp' || event.code === 'ArrowDown')) {
5966
+ event.stopPropagation();
5967
+ this.row.dataTable.onRowKeyboardReorder(event, this.row.index(), event.code === 'ArrowUp' ? -1 : 1);
5968
+ // re-rendering the body moves the row: keep the focus on the handle
5969
+ const handle = this.el.nativeElement;
5970
+ setTimeout(() => handle.isConnected && handle.focus());
5971
+ }
5767
5972
  }
5768
5973
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ReorderableRowHandle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
5769
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.2.1", type: ReorderableRowHandle, isStandalone: false, selector: "[pReorderableRowHandle]", host: { properties: { "class": "cx('reorderableRowHandle')" } }, providers: [TableStyle], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0 });
5974
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.2.1", type: ReorderableRowHandle, isStandalone: false, selector: "[pReorderableRowHandle]", host: { listeners: { "keydown": "onKeyDown($event)" }, properties: { "class": "cx('reorderableRowHandle')", "attr.tabindex": "row?.isEnabled() ? \"0\" : null", "attr.aria-keyshortcuts": "row?.isEnabled() ? \"Control+ArrowUp Control+ArrowDown Meta+ArrowUp Meta+ArrowDown\" : null", "style.touch-action": "row?.isEnabled() ? \"none\" : null" } }, providers: [TableStyle], usesInheritance: true, hostDirectives: [{ directive: i1.Bind }], ngImport: i0 });
5770
5975
  }
5771
5976
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ReorderableRowHandle, decorators: [{
5772
5977
  type: Directive,
@@ -5774,12 +5979,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
5774
5979
  selector: '[pReorderableRowHandle]',
5775
5980
  standalone: false,
5776
5981
  host: {
5777
- '[class]': "cx('reorderableRowHandle')"
5982
+ '[class]': "cx('reorderableRowHandle')",
5983
+ '[attr.tabindex]': 'row?.isEnabled() ? "0" : null',
5984
+ '[attr.aria-keyshortcuts]': 'row?.isEnabled() ? "Control+ArrowUp Control+ArrowDown Meta+ArrowUp Meta+ArrowDown" : null',
5985
+ '[style.touch-action]': 'row?.isEnabled() ? "none" : null'
5778
5986
  },
5779
5987
  providers: [TableStyle],
5780
5988
  hostDirectives: [Bind]
5781
5989
  }]
5782
- }], ctorParameters: () => [] });
5990
+ }], ctorParameters: () => [], propDecorators: { onKeyDown: [{
5991
+ type: HostListener,
5992
+ args: ['keydown', ['$event']]
5993
+ }] } });
5994
+ // the reorderable row directives by row element, to find the row under a touch pointer
5995
+ const reorderableRowElements = new WeakMap();
5783
5996
  class ReorderableRow extends BaseComponent {
5784
5997
  dataTable = inject(Table);
5785
5998
  zone = inject(NgZone);
@@ -5799,9 +6012,14 @@ class ReorderableRow extends BaseComponent {
5799
6012
  ...(ngDevMode ? [{ debugName: "dragLeaveListener" }] : /* istanbul ignore next */ []));
5800
6013
  dropListener = signal(undefined, /* @ts-ignore */
5801
6014
  ...(ngDevMode ? [{ debugName: "dropListener" }] : /* istanbul ignore next */ []));
6015
+ pointerDownListener = signal(undefined, /* @ts-ignore */
6016
+ ...(ngDevMode ? [{ debugName: "pointerDownListener" }] : /* istanbul ignore next */ []));
6017
+ documentPointerListeners = [];
6018
+ pointerDropRow = null;
5802
6019
  constructor() {
5803
6020
  super();
5804
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptm('reorderableRow')));
6021
+ reorderableRowElements.set(this.el.nativeElement, this);
6022
+ this.bindHostAttrs(this.bindDirectiveInstance, () => this.ptm('reorderableRow'));
5805
6023
  afterNextRender(() => {
5806
6024
  if (this.isEnabled()) {
5807
6025
  this.el.nativeElement.droppable = true;
@@ -5816,6 +6034,7 @@ class ReorderableRow extends BaseComponent {
5816
6034
  this.dragEndListener.set(this.renderer.listen(this.el.nativeElement, 'dragend', this.onDragEnd.bind(this)));
5817
6035
  this.dragOverListener.set(this.renderer.listen(this.el.nativeElement, 'dragover', this.onDragOver.bind(this)));
5818
6036
  this.dragLeaveListener.set(this.renderer.listen(this.el.nativeElement, 'dragleave', this.onDragLeave.bind(this)));
6037
+ this.pointerDownListener.set(this.renderer.listen(this.el.nativeElement, 'pointerdown', this.onPointerDown.bind(this)));
5819
6038
  });
5820
6039
  }
5821
6040
  unbindEvents() {
@@ -5839,6 +6058,55 @@ class ReorderableRow extends BaseComponent {
5839
6058
  this.dragLeaveListener()();
5840
6059
  this.dragLeaveListener.set(null);
5841
6060
  }
6061
+ if (this.pointerDownListener()) {
6062
+ this.pointerDownListener()();
6063
+ this.pointerDownListener.set(null);
6064
+ }
6065
+ this.unbindDocumentPointerListeners();
6066
+ }
6067
+ // a touch or a pen on the handle does not start an HTML5 drag on mobile browsers: follow the pointer instead
6068
+ onPointerDown(event) {
6069
+ if (event.pointerType === 'mouse' || !this.isHandleElement(event.target)) {
6070
+ return;
6071
+ }
6072
+ event.preventDefault();
6073
+ this.unbindDocumentPointerListeners();
6074
+ this.dataTable.rowDragging.set(true);
6075
+ this.dataTable.draggedRowIndex.set(this.index());
6076
+ this.pointerDropRow = null;
6077
+ this.documentPointerListeners = [
6078
+ this.renderer.listen(this.document, 'pointermove', this.onPointerMove.bind(this)),
6079
+ this.renderer.listen(this.document, 'pointerup', this.onPointerUp.bind(this)),
6080
+ this.renderer.listen(this.document, 'pointercancel', this.onPointerUp.bind(this))
6081
+ ];
6082
+ }
6083
+ onPointerMove(event) {
6084
+ const rowElement = this.document.elementFromPoint(event.clientX, event.clientY)?.closest('tr');
6085
+ const row = rowElement ? reorderableRowElements.get(rowElement) : undefined;
6086
+ if (row && row.dataTable === this.dataTable && row.isEnabled()) {
6087
+ if (this.pointerDropRow && this.pointerDropRow !== rowElement) {
6088
+ this.dataTable.onRowDragLeave(event, this.pointerDropRow);
6089
+ }
6090
+ this.pointerDropRow = rowElement;
6091
+ this.dataTable.onRowDragOver(event, row.index(), rowElement);
6092
+ }
6093
+ event.preventDefault();
6094
+ }
6095
+ onPointerUp(event) {
6096
+ this.unbindDocumentPointerListeners();
6097
+ if (event.type === 'pointerup' && this.pointerDropRow) {
6098
+ const rowElement = this.pointerDropRow;
6099
+ this.zone.run(() => this.dataTable.onRowDrop(event, rowElement));
6100
+ }
6101
+ else {
6102
+ this.pointerDropRow && this.dataTable.onRowDragLeave(event, this.pointerDropRow);
6103
+ this.dataTable.onRowDragEnd(event);
6104
+ }
6105
+ this.pointerDropRow = null;
6106
+ }
6107
+ unbindDocumentPointerListeners() {
6108
+ this.documentPointerListeners.forEach((unlisten) => unlisten());
6109
+ this.documentPointerListeners = [];
5842
6110
  }
5843
6111
  onMouseDown(event) {
5844
6112
  const targetElement = event.target;
@@ -5904,7 +6172,33 @@ class ColumnFilter extends BaseComponent {
5904
6172
  _componentStyle = inject(TableStyle);
5905
6173
  constructor() {
5906
6174
  super();
5907
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptm('columnFilter')));
6175
+ afterEveryRender(() => {
6176
+ this.bindDirectiveInstance.setAttrs(this.ptm('columnFilter'));
6177
+ this.updateMenuButtonAria();
6178
+ });
6179
+ // the table filters can be replaced at any time (e.g. reset to {}): recreate the default constraint
6180
+ effect(() => {
6181
+ const filters = this.dataTable._filters();
6182
+ untracked(() => {
6183
+ if (filters && !filters[this.field()]) {
6184
+ this.initFieldFilterConstraint();
6185
+ }
6186
+ });
6187
+ });
6188
+ }
6189
+ // the popup state belongs to the focusable <button>, not to the p-button host (which has no role)
6190
+ updateMenuButtonAria() {
6191
+ const button = this.showMenuButton() ? this.icon()?.nativeElement?.querySelector('button') : null;
6192
+ if (button) {
6193
+ button.setAttribute('aria-haspopup', 'true');
6194
+ button.setAttribute('aria-expanded', String(this.overlayVisible() ?? false));
6195
+ if (this.overlayVisible()) {
6196
+ button.setAttribute('aria-controls', this.overlayId());
6197
+ }
6198
+ else {
6199
+ button.removeAttribute('aria-controls');
6200
+ }
6201
+ }
5908
6202
  }
5909
6203
  ptmFilterConstraintOptions(matchMode) {
5910
6204
  return {
@@ -6407,6 +6701,23 @@ class ColumnFilter extends BaseComponent {
6407
6701
  this.hide();
6408
6702
  this.icon()?.nativeElement.focus();
6409
6703
  }
6704
+ // the menu is a modal dialog (aria-modal): Tab and Shift+Tab cycle through its own controls
6705
+ onOverlayTabKeyDown(event) {
6706
+ const focusable = DomHandler.getFocusableElements(this.overlay());
6707
+ if (focusable && focusable.length) {
6708
+ const first = focusable[0];
6709
+ const last = focusable[focusable.length - 1];
6710
+ const active = this.document.activeElement;
6711
+ if (event.shiftKey && active === first) {
6712
+ last.focus();
6713
+ event.preventDefault();
6714
+ }
6715
+ else if (!event.shiftKey && active === last) {
6716
+ first.focus();
6717
+ event.preventDefault();
6718
+ }
6719
+ }
6720
+ }
6410
6721
  findNextItem(item) {
6411
6722
  let nextItem = item.nextElementSibling;
6412
6723
  if (nextItem)
@@ -6494,7 +6805,7 @@ class ColumnFilter extends BaseComponent {
6494
6805
  let fieldFilter = this.dataTable._filters()[this.field()];
6495
6806
  if (fieldFilter) {
6496
6807
  if (Array.isArray(fieldFilter))
6497
- return !this.dataTable.isFilterBlank(fieldFilter[0].value);
6808
+ return fieldFilter.some((meta) => !this.dataTable.isFilterBlank(meta.value));
6498
6809
  else
6499
6810
  return !this.dataTable.isFilterBlank(fieldFilter.value);
6500
6811
  }
@@ -6516,10 +6827,11 @@ class ColumnFilter extends BaseComponent {
6516
6827
  bindDocumentClickListener() {
6517
6828
  if (!this.documentClickListener()) {
6518
6829
  const documentTarget = this.el ? this.el.nativeElement.ownerDocument : 'document';
6519
- this.documentClickListener.set(this.renderer.listen(documentTarget, 'mousedown', (event) => {
6520
- const dialogElements = document.querySelectorAll('[role="dialog"]');
6521
- const targetIsColumnFilterMenuButton = event.target.closest('[data-pc-name="pccolumnfilterbutton"]');
6522
- if (this.overlayVisible() && this.isOutsideClicked(event) && (targetIsColumnFilterMenuButton || dialogElements?.length <= 1)) {
6830
+ this.documentClickListener.set(
6831
+ // a click, not a mousedown: the overlays of the menu (select, datepicker), even appended to body,
6832
+ // report their clicks through OverlayService before the click reaches the document (selfClick)
6833
+ this.renderer.listen(documentTarget, 'click', (event) => {
6834
+ if (this.overlayVisible() && !this.selfClick() && this.isOutsideClicked(event)) {
6523
6835
  this.hide();
6524
6836
  }
6525
6837
  this.selfClick.set(false);
@@ -6621,7 +6933,6 @@ class ColumnFilter extends BaseComponent {
6621
6933
  [currency]="currency()"
6622
6934
  [currencyDisplay]="currencyDisplay()"
6623
6935
  [useGrouping]="useGrouping()"
6624
- [showButtons]="showButtons()"
6625
6936
  [filterOn]="filterOn()"
6626
6937
  [pt]="pt()"
6627
6938
  [unstyled]="unstyled()"
@@ -6631,10 +6942,7 @@ class ColumnFilter extends BaseComponent {
6631
6942
  <p-button
6632
6943
  [styleClass]="cx('pcColumnFilterButton')"
6633
6944
  [pt]="ptm('pcColumnFilterButton')"
6634
- [attr.aria-haspopup]="true"
6635
6945
  [ariaLabel]="filterMenuButtonAriaLabel"
6636
- [attr.aria-controls]="overlayVisible() ? overlayId() : null"
6637
- [attr.aria-expanded]="overlayVisible() ?? false"
6638
6946
  (click)="toggleMenu($event)"
6639
6947
  (keydown)="onToggleButtonKeyDown($event)"
6640
6948
  [buttonProps]="filterButtonProps()?.filter"
@@ -6658,6 +6966,13 @@ class ColumnFilter extends BaseComponent {
6658
6966
  </ng-template>
6659
6967
  </p-button>
6660
6968
  }
6969
+ @if (showClearButton() && display() === 'row' && type() === 'boolean' && hasFilter) {
6970
+ <p-button [styleClass]="cx('pcColumnFilterClearButton')" [ariaLabel]="clearButtonLabel" (click)="clearFilter()" [buttonProps]="filterButtonProps()?.inline?.clear" [unstyled]="unstyled()">
6971
+ <ng-template #icon>
6972
+ <svg data-p-icon="filter-slash" />
6973
+ </ng-template>
6974
+ </p-button>
6975
+ }
6661
6976
  @if (renderOverlay()) {
6662
6977
  <div
6663
6978
  [pMotion]="showMenu() && overlayVisible()"
@@ -6673,6 +6988,8 @@ class ColumnFilter extends BaseComponent {
6673
6988
  role="dialog"
6674
6989
  (click)="onContentClick()"
6675
6990
  (keydown.escape)="onEscape()"
6991
+ (keydown.tab)="onOverlayTabKeyDown($event)"
6992
+ (keydown.shift.tab)="onOverlayTabKeyDown($event)"
6676
6993
  >
6677
6994
  <ng-container *ngTemplateOutlet="headerTemplate() || _headerTemplate(); context: { $implicit: field() }"></ng-container>
6678
6995
  @if (display() === 'row') {
@@ -6726,6 +7043,7 @@ class ColumnFilter extends BaseComponent {
6726
7043
  <p-columnFilterFormElement
6727
7044
  [type]="type()"
6728
7045
  [field]="field()"
7046
+ [ariaLabel]="ariaLabel()"
6729
7047
  [filterConstraint]="fieldConstraint"
6730
7048
  [filterTemplate]="filterTemplate() || _filterTemplate()"
6731
7049
  [placeholder]="placeholder()"
@@ -6742,8 +7060,8 @@ class ColumnFilter extends BaseComponent {
6742
7060
  [pt]="pt()"
6743
7061
  [unstyled]="unstyled()"
6744
7062
  ></p-columnFilterFormElement>
6745
- <div>
6746
- @if (showRemoveIcon) {
7063
+ @if (showRemoveIcon) {
7064
+ <div>
6747
7065
  <p-button
6748
7066
  [styleClass]="cx('pcFilterRemoveRuleButton')"
6749
7067
  [pt]="ptm('pcFilterRemoveRuleButton')"
@@ -6763,8 +7081,8 @@ class ColumnFilter extends BaseComponent {
6763
7081
  <ng-template *ngTemplateOutlet="removeRuleIconTemplate() || _removeRuleIconTemplate()"></ng-template>
6764
7082
  </ng-template>
6765
7083
  </p-button>
6766
- }
6767
- </div>
7084
+ </div>
7085
+ }
6768
7086
  </div>
6769
7087
  }
6770
7088
  </div>
@@ -6789,37 +7107,39 @@ class ColumnFilter extends BaseComponent {
6789
7107
  </ng-template>
6790
7108
  </p-button>
6791
7109
  }
6792
- <div [class]="cx('filterButtonbar')" [pBind]="ptm('filterButtonBar')">
6793
- @if (showClearButton()) {
6794
- <p-button
6795
- #clearBtn
6796
- [outlined]="true"
6797
- (onClick)="clearFilter()"
6798
- [attr.aria-label]="clearButtonLabel"
6799
- [label]="clearButtonLabel"
6800
- [buttonProps]="filterButtonProps()?.popover?.clear"
6801
- [pt]="ptm('pcFilterClearButton')"
6802
- [unstyled]="unstyled()"
6803
- />
6804
- }
6805
- @if (showApplyButton()) {
6806
- <p-button
6807
- (onClick)="applyFilter()"
6808
- size="small"
6809
- [label]="applyButtonLabel"
6810
- [attr.aria-label]="applyButtonLabel"
6811
- [buttonProps]="filterButtonProps()?.popover?.apply"
6812
- [pt]="ptm('pcFilterApplyButton')"
6813
- [unstyled]="unstyled()"
6814
- />
6815
- }
6816
- </div>
7110
+ @if (showClearButton() || showApplyButton()) {
7111
+ <div [class]="cx('filterButtonbar')" [pBind]="ptm('filterButtonBar')">
7112
+ @if (showClearButton()) {
7113
+ <p-button
7114
+ #clearBtn
7115
+ [outlined]="filterButtonProps()?.popover?.clear?.outlined ?? true"
7116
+ (onClick)="clearFilter()"
7117
+ [attr.aria-label]="clearButtonLabel"
7118
+ [label]="clearButtonLabel"
7119
+ [buttonProps]="filterButtonProps()?.popover?.clear"
7120
+ [pt]="ptm('pcFilterClearButton')"
7121
+ [unstyled]="unstyled()"
7122
+ />
7123
+ }
7124
+ @if (showApplyButton()) {
7125
+ <p-button
7126
+ (onClick)="applyFilter()"
7127
+ size="small"
7128
+ [label]="applyButtonLabel"
7129
+ [attr.aria-label]="applyButtonLabel"
7130
+ [buttonProps]="filterButtonProps()?.popover?.apply"
7131
+ [pt]="ptm('pcFilterApplyButton')"
7132
+ [unstyled]="unstyled()"
7133
+ />
7134
+ }
7135
+ </div>
7136
+ }
6817
7137
  }
6818
7138
  <ng-container *ngTemplateOutlet="footerTemplate() || _footerTemplate(); context: { $implicit: field() }"></ng-container>
6819
7139
  </div>
6820
7140
  }
6821
7141
  </div>
6822
- `, 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 });
7142
+ `, 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 });
6823
7143
  }
6824
7144
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ColumnFilter, decorators: [{
6825
7145
  type: Component,
@@ -6847,7 +7167,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6847
7167
  [currency]="currency()"
6848
7168
  [currencyDisplay]="currencyDisplay()"
6849
7169
  [useGrouping]="useGrouping()"
6850
- [showButtons]="showButtons()"
6851
7170
  [filterOn]="filterOn()"
6852
7171
  [pt]="pt()"
6853
7172
  [unstyled]="unstyled()"
@@ -6857,10 +7176,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6857
7176
  <p-button
6858
7177
  [styleClass]="cx('pcColumnFilterButton')"
6859
7178
  [pt]="ptm('pcColumnFilterButton')"
6860
- [attr.aria-haspopup]="true"
6861
7179
  [ariaLabel]="filterMenuButtonAriaLabel"
6862
- [attr.aria-controls]="overlayVisible() ? overlayId() : null"
6863
- [attr.aria-expanded]="overlayVisible() ?? false"
6864
7180
  (click)="toggleMenu($event)"
6865
7181
  (keydown)="onToggleButtonKeyDown($event)"
6866
7182
  [buttonProps]="filterButtonProps()?.filter"
@@ -6884,6 +7200,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6884
7200
  </ng-template>
6885
7201
  </p-button>
6886
7202
  }
7203
+ @if (showClearButton() && display() === 'row' && type() === 'boolean' && hasFilter) {
7204
+ <p-button [styleClass]="cx('pcColumnFilterClearButton')" [ariaLabel]="clearButtonLabel" (click)="clearFilter()" [buttonProps]="filterButtonProps()?.inline?.clear" [unstyled]="unstyled()">
7205
+ <ng-template #icon>
7206
+ <svg data-p-icon="filter-slash" />
7207
+ </ng-template>
7208
+ </p-button>
7209
+ }
6887
7210
  @if (renderOverlay()) {
6888
7211
  <div
6889
7212
  [pMotion]="showMenu() && overlayVisible()"
@@ -6899,6 +7222,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6899
7222
  role="dialog"
6900
7223
  (click)="onContentClick()"
6901
7224
  (keydown.escape)="onEscape()"
7225
+ (keydown.tab)="onOverlayTabKeyDown($event)"
7226
+ (keydown.shift.tab)="onOverlayTabKeyDown($event)"
6902
7227
  >
6903
7228
  <ng-container *ngTemplateOutlet="headerTemplate() || _headerTemplate(); context: { $implicit: field() }"></ng-container>
6904
7229
  @if (display() === 'row') {
@@ -6952,6 +7277,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6952
7277
  <p-columnFilterFormElement
6953
7278
  [type]="type()"
6954
7279
  [field]="field()"
7280
+ [ariaLabel]="ariaLabel()"
6955
7281
  [filterConstraint]="fieldConstraint"
6956
7282
  [filterTemplate]="filterTemplate() || _filterTemplate()"
6957
7283
  [placeholder]="placeholder()"
@@ -6968,8 +7294,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6968
7294
  [pt]="pt()"
6969
7295
  [unstyled]="unstyled()"
6970
7296
  ></p-columnFilterFormElement>
6971
- <div>
6972
- @if (showRemoveIcon) {
7297
+ @if (showRemoveIcon) {
7298
+ <div>
6973
7299
  <p-button
6974
7300
  [styleClass]="cx('pcFilterRemoveRuleButton')"
6975
7301
  [pt]="ptm('pcFilterRemoveRuleButton')"
@@ -6989,8 +7315,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6989
7315
  <ng-template *ngTemplateOutlet="removeRuleIconTemplate() || _removeRuleIconTemplate()"></ng-template>
6990
7316
  </ng-template>
6991
7317
  </p-button>
6992
- }
6993
- </div>
7318
+ </div>
7319
+ }
6994
7320
  </div>
6995
7321
  }
6996
7322
  </div>
@@ -7015,31 +7341,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
7015
7341
  </ng-template>
7016
7342
  </p-button>
7017
7343
  }
7018
- <div [class]="cx('filterButtonbar')" [pBind]="ptm('filterButtonBar')">
7019
- @if (showClearButton()) {
7020
- <p-button
7021
- #clearBtn
7022
- [outlined]="true"
7023
- (onClick)="clearFilter()"
7024
- [attr.aria-label]="clearButtonLabel"
7025
- [label]="clearButtonLabel"
7026
- [buttonProps]="filterButtonProps()?.popover?.clear"
7027
- [pt]="ptm('pcFilterClearButton')"
7028
- [unstyled]="unstyled()"
7029
- />
7030
- }
7031
- @if (showApplyButton()) {
7032
- <p-button
7033
- (onClick)="applyFilter()"
7034
- size="small"
7035
- [label]="applyButtonLabel"
7036
- [attr.aria-label]="applyButtonLabel"
7037
- [buttonProps]="filterButtonProps()?.popover?.apply"
7038
- [pt]="ptm('pcFilterApplyButton')"
7039
- [unstyled]="unstyled()"
7040
- />
7041
- }
7042
- </div>
7344
+ @if (showClearButton() || showApplyButton()) {
7345
+ <div [class]="cx('filterButtonbar')" [pBind]="ptm('filterButtonBar')">
7346
+ @if (showClearButton()) {
7347
+ <p-button
7348
+ #clearBtn
7349
+ [outlined]="filterButtonProps()?.popover?.clear?.outlined ?? true"
7350
+ (onClick)="clearFilter()"
7351
+ [attr.aria-label]="clearButtonLabel"
7352
+ [label]="clearButtonLabel"
7353
+ [buttonProps]="filterButtonProps()?.popover?.clear"
7354
+ [pt]="ptm('pcFilterClearButton')"
7355
+ [unstyled]="unstyled()"
7356
+ />
7357
+ }
7358
+ @if (showApplyButton()) {
7359
+ <p-button
7360
+ (onClick)="applyFilter()"
7361
+ size="small"
7362
+ [label]="applyButtonLabel"
7363
+ [attr.aria-label]="applyButtonLabel"
7364
+ [buttonProps]="filterButtonProps()?.popover?.apply"
7365
+ [pt]="ptm('pcFilterApplyButton')"
7366
+ [unstyled]="unstyled()"
7367
+ />
7368
+ }
7369
+ </div>
7370
+ }
7043
7371
  }
7044
7372
  <ng-container *ngTemplateOutlet="footerTemplate() || _footerTemplate(); context: { $implicit: field() }"></ng-container>
7045
7373
  </div>
@@ -7059,7 +7387,7 @@ class ColumnFilterFormElement extends BaseComponent {
7059
7387
  _componentStyle = inject(TableStyle);
7060
7388
  constructor() {
7061
7389
  super();
7062
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptm('columnFilterFormElement')));
7390
+ this.bindHostAttrs(this.bindDirectiveInstance, () => this.ptm('columnFilterFormElement'));
7063
7391
  }
7064
7392
  field = input(/* @ts-ignore */
7065
7393
  ...(ngDevMode ? [undefined, { debugName: "field" }] : /* istanbul ignore next */ []));
@@ -7098,7 +7426,9 @@ class ColumnFilterFormElement extends BaseComponent {
7098
7426
  };
7099
7427
  onModelChange(value) {
7100
7428
  this.filterConstraint().value = value;
7101
- if (this.type() === 'date' || this.type() === 'boolean' || ((this.type() === 'text' || this.type() === 'numeric') && this.filterOn() === 'input') || !value) {
7429
+ // a menu with an Apply button only filters on Apply (or Enter)
7430
+ const applyOnButton = this.colFilter.display() === 'menu' && this.colFilter.showApplyButton();
7431
+ if (((this.type() === 'date' || this.type() === 'boolean' || !value) && !applyOnButton) || ((this.type() === 'text' || this.type() === 'numeric') && this.filterOn() === 'input')) {
7102
7432
  this.dataTable._filter();
7103
7433
  }
7104
7434
  }
@@ -7181,6 +7511,7 @@ class ColumnFilterFormElement extends BaseComponent {
7181
7511
  [pt]="ptm('pcFilterCheckbox')"
7182
7512
  [indeterminate]="filterConstraint()?.value === null"
7183
7513
  [binary]="true"
7514
+ [ariaLabel]="ariaLabel()"
7184
7515
  [ngModel]="filterConstraint()?.value"
7185
7516
  [ngModelOptions]="{ standalone: true }"
7186
7517
  (ngModelChange)="onModelChange($event)"
@@ -7201,7 +7532,7 @@ class ColumnFilterFormElement extends BaseComponent {
7201
7532
  }
7202
7533
  }
7203
7534
  }
7204
- `, 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 });
7535
+ `, 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 });
7205
7536
  }
7206
7537
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ColumnFilterFormElement, decorators: [{
7207
7538
  type: Component,
@@ -7277,6 +7608,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
7277
7608
  [pt]="ptm('pcFilterCheckbox')"
7278
7609
  [indeterminate]="filterConstraint()?.value === null"
7279
7610
  [binary]="true"
7611
+ [ariaLabel]="ariaLabel()"
7280
7612
  [ngModel]="filterConstraint()?.value"
7281
7613
  [ngModelOptions]="{ standalone: true }"
7282
7614
  (ngModelChange)="onModelChange($event)"