@exhaustive-ui/core 22.0.0-alpha.8 → 22.0.0-rc.1

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 (252) hide show
  1. package/fesm2022/exhaustive-ui-core-accordion.mjs +11 -5
  2. package/fesm2022/exhaustive-ui-core-accordion.mjs.map +1 -1
  3. package/fesm2022/exhaustive-ui-core-api.mjs +7 -5
  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-autofocus.mjs +4 -4
  8. package/fesm2022/exhaustive-ui-core-autofocus.mjs.map +1 -1
  9. package/fesm2022/exhaustive-ui-core-avatar.mjs +2 -2
  10. package/fesm2022/exhaustive-ui-core-avatar.mjs.map +1 -1
  11. package/fesm2022/exhaustive-ui-core-avatargroup.mjs +2 -2
  12. package/fesm2022/exhaustive-ui-core-avatargroup.mjs.map +1 -1
  13. package/fesm2022/exhaustive-ui-core-badge.mjs +2 -2
  14. package/fesm2022/exhaustive-ui-core-badge.mjs.map +1 -1
  15. package/fesm2022/exhaustive-ui-core-basecomponent.mjs +34 -4
  16. package/fesm2022/exhaustive-ui-core-basecomponent.mjs.map +1 -1
  17. package/fesm2022/exhaustive-ui-core-baseeditableholder.mjs +4 -2
  18. package/fesm2022/exhaustive-ui-core-baseeditableholder.mjs.map +1 -1
  19. package/fesm2022/exhaustive-ui-core-blockui.mjs +9 -2
  20. package/fesm2022/exhaustive-ui-core-blockui.mjs.map +1 -1
  21. package/fesm2022/exhaustive-ui-core-breadcrumb.mjs +13 -6
  22. package/fesm2022/exhaustive-ui-core-breadcrumb.mjs.map +1 -1
  23. package/fesm2022/exhaustive-ui-core-button.mjs +35 -13
  24. package/fesm2022/exhaustive-ui-core-button.mjs.map +1 -1
  25. package/fesm2022/exhaustive-ui-core-card.mjs +2 -6
  26. package/fesm2022/exhaustive-ui-core-card.mjs.map +1 -1
  27. package/fesm2022/exhaustive-ui-core-carousel.mjs +9 -4
  28. package/fesm2022/exhaustive-ui-core-carousel.mjs.map +1 -1
  29. package/fesm2022/exhaustive-ui-core-cascadeselect.mjs +12 -11
  30. package/fesm2022/exhaustive-ui-core-cascadeselect.mjs.map +1 -1
  31. package/fesm2022/exhaustive-ui-core-chart.mjs +2 -2
  32. package/fesm2022/exhaustive-ui-core-chart.mjs.map +1 -1
  33. package/fesm2022/exhaustive-ui-core-checkbox.mjs +2 -2
  34. package/fesm2022/exhaustive-ui-core-checkbox.mjs.map +1 -1
  35. package/fesm2022/exhaustive-ui-core-chip.mjs +2 -2
  36. package/fesm2022/exhaustive-ui-core-chip.mjs.map +1 -1
  37. package/fesm2022/exhaustive-ui-core-colorpicker.mjs +2 -2
  38. package/fesm2022/exhaustive-ui-core-colorpicker.mjs.map +1 -1
  39. package/fesm2022/exhaustive-ui-core-config.mjs +3 -1
  40. package/fesm2022/exhaustive-ui-core-config.mjs.map +1 -1
  41. package/fesm2022/exhaustive-ui-core-confirmdialog.mjs +65 -26
  42. package/fesm2022/exhaustive-ui-core-confirmdialog.mjs.map +1 -1
  43. package/fesm2022/exhaustive-ui-core-confirmpopup.mjs +28 -5
  44. package/fesm2022/exhaustive-ui-core-confirmpopup.mjs.map +1 -1
  45. package/fesm2022/exhaustive-ui-core-contextmenu.mjs +15 -8
  46. package/fesm2022/exhaustive-ui-core-contextmenu.mjs.map +1 -1
  47. package/fesm2022/exhaustive-ui-core-dataview.mjs +2 -2
  48. package/fesm2022/exhaustive-ui-core-dataview.mjs.map +1 -1
  49. package/fesm2022/exhaustive-ui-core-datepicker.mjs +188 -95
  50. package/fesm2022/exhaustive-ui-core-datepicker.mjs.map +1 -1
  51. package/fesm2022/exhaustive-ui-core-dialog.mjs +31 -13
  52. package/fesm2022/exhaustive-ui-core-dialog.mjs.map +1 -1
  53. package/fesm2022/exhaustive-ui-core-divider.mjs +2 -2
  54. package/fesm2022/exhaustive-ui-core-divider.mjs.map +1 -1
  55. package/fesm2022/exhaustive-ui-core-dock.mjs +2 -2
  56. package/fesm2022/exhaustive-ui-core-dock.mjs.map +1 -1
  57. package/fesm2022/exhaustive-ui-core-dom.mjs +3 -1
  58. package/fesm2022/exhaustive-ui-core-dom.mjs.map +1 -1
  59. package/fesm2022/exhaustive-ui-core-drawer.mjs +24 -6
  60. package/fesm2022/exhaustive-ui-core-drawer.mjs.map +1 -1
  61. package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs +9 -5
  62. package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs.map +1 -1
  63. package/fesm2022/exhaustive-ui-core-editor.mjs +2 -2
  64. package/fesm2022/exhaustive-ui-core-editor.mjs.map +1 -1
  65. package/fesm2022/exhaustive-ui-core-fieldset.mjs +4 -4
  66. package/fesm2022/exhaustive-ui-core-fieldset.mjs.map +1 -1
  67. package/fesm2022/exhaustive-ui-core-fileupload.mjs +25 -14
  68. package/fesm2022/exhaustive-ui-core-fileupload.mjs.map +1 -1
  69. package/fesm2022/exhaustive-ui-core-floatlabel.mjs +2 -2
  70. package/fesm2022/exhaustive-ui-core-floatlabel.mjs.map +1 -1
  71. package/fesm2022/exhaustive-ui-core-focustrap.mjs +0 -2
  72. package/fesm2022/exhaustive-ui-core-focustrap.mjs.map +1 -1
  73. package/fesm2022/exhaustive-ui-core-galleria.mjs +5 -5
  74. package/fesm2022/exhaustive-ui-core-galleria.mjs.map +1 -1
  75. package/fesm2022/exhaustive-ui-core-iconfield.mjs +18 -3
  76. package/fesm2022/exhaustive-ui-core-iconfield.mjs.map +1 -1
  77. package/fesm2022/exhaustive-ui-core-image.mjs +12 -4
  78. package/fesm2022/exhaustive-ui-core-image.mjs.map +1 -1
  79. package/fesm2022/exhaustive-ui-core-imagecompare.mjs +2 -2
  80. package/fesm2022/exhaustive-ui-core-imagecompare.mjs.map +1 -1
  81. package/fesm2022/exhaustive-ui-core-inplace.mjs +3 -3
  82. package/fesm2022/exhaustive-ui-core-inplace.mjs.map +1 -1
  83. package/fesm2022/exhaustive-ui-core-inputgroup.mjs +11 -2
  84. package/fesm2022/exhaustive-ui-core-inputgroup.mjs.map +1 -1
  85. package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs +2 -2
  86. package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs.map +1 -1
  87. package/fesm2022/exhaustive-ui-core-inputicon.mjs +2 -2
  88. package/fesm2022/exhaustive-ui-core-inputicon.mjs.map +1 -1
  89. package/fesm2022/exhaustive-ui-core-inputmask.mjs +31 -7
  90. package/fesm2022/exhaustive-ui-core-inputmask.mjs.map +1 -1
  91. package/fesm2022/exhaustive-ui-core-inputnumber.mjs +85 -25
  92. package/fesm2022/exhaustive-ui-core-inputnumber.mjs.map +1 -1
  93. package/fesm2022/exhaustive-ui-core-inputotp.mjs +17 -5
  94. package/fesm2022/exhaustive-ui-core-inputotp.mjs.map +1 -1
  95. package/fesm2022/exhaustive-ui-core-inputtext.mjs +8 -9
  96. package/fesm2022/exhaustive-ui-core-inputtext.mjs.map +1 -1
  97. package/fesm2022/exhaustive-ui-core-keyfilter.mjs +27 -17
  98. package/fesm2022/exhaustive-ui-core-keyfilter.mjs.map +1 -1
  99. package/fesm2022/exhaustive-ui-core-knob.mjs +2 -2
  100. package/fesm2022/exhaustive-ui-core-knob.mjs.map +1 -1
  101. package/fesm2022/exhaustive-ui-core-listbox.mjs +17 -6
  102. package/fesm2022/exhaustive-ui-core-listbox.mjs.map +1 -1
  103. package/fesm2022/exhaustive-ui-core-megamenu.mjs +4 -3
  104. package/fesm2022/exhaustive-ui-core-megamenu.mjs.map +1 -1
  105. package/fesm2022/exhaustive-ui-core-menu.mjs +15 -4
  106. package/fesm2022/exhaustive-ui-core-menu.mjs.map +1 -1
  107. package/fesm2022/exhaustive-ui-core-menubar.mjs +58 -14
  108. package/fesm2022/exhaustive-ui-core-menubar.mjs.map +1 -1
  109. package/fesm2022/exhaustive-ui-core-message.mjs +2 -4
  110. package/fesm2022/exhaustive-ui-core-message.mjs.map +1 -1
  111. package/fesm2022/exhaustive-ui-core-metergroup.mjs +7 -7
  112. package/fesm2022/exhaustive-ui-core-metergroup.mjs.map +1 -1
  113. package/fesm2022/exhaustive-ui-core-multiselect.mjs +38 -27
  114. package/fesm2022/exhaustive-ui-core-multiselect.mjs.map +1 -1
  115. package/fesm2022/exhaustive-ui-core-orderlist.mjs +19 -6
  116. package/fesm2022/exhaustive-ui-core-orderlist.mjs.map +1 -1
  117. package/fesm2022/exhaustive-ui-core-organizationchart.mjs +2 -2
  118. package/fesm2022/exhaustive-ui-core-organizationchart.mjs.map +1 -1
  119. package/fesm2022/exhaustive-ui-core-overlay.mjs +6 -4
  120. package/fesm2022/exhaustive-ui-core-overlay.mjs.map +1 -1
  121. package/fesm2022/exhaustive-ui-core-overlaybadge.mjs +4 -4
  122. package/fesm2022/exhaustive-ui-core-overlaybadge.mjs.map +1 -1
  123. package/fesm2022/exhaustive-ui-core-paginator.mjs +12 -5
  124. package/fesm2022/exhaustive-ui-core-paginator.mjs.map +1 -1
  125. package/fesm2022/exhaustive-ui-core-panel.mjs +9 -11
  126. package/fesm2022/exhaustive-ui-core-panel.mjs.map +1 -1
  127. package/fesm2022/exhaustive-ui-core-panelmenu.mjs +43 -15
  128. package/fesm2022/exhaustive-ui-core-panelmenu.mjs.map +1 -1
  129. package/fesm2022/exhaustive-ui-core-password.mjs +93 -25
  130. package/fesm2022/exhaustive-ui-core-password.mjs.map +1 -1
  131. package/fesm2022/exhaustive-ui-core-picklist.mjs +33 -12
  132. package/fesm2022/exhaustive-ui-core-picklist.mjs.map +1 -1
  133. package/fesm2022/exhaustive-ui-core-popover.mjs +27 -8
  134. package/fesm2022/exhaustive-ui-core-popover.mjs.map +1 -1
  135. package/fesm2022/exhaustive-ui-core-progressbar.mjs +5 -5
  136. package/fesm2022/exhaustive-ui-core-progressbar.mjs.map +1 -1
  137. package/fesm2022/exhaustive-ui-core-progressspinner.mjs +2 -2
  138. package/fesm2022/exhaustive-ui-core-progressspinner.mjs.map +1 -1
  139. package/fesm2022/exhaustive-ui-core-radiobutton.mjs +8 -3
  140. package/fesm2022/exhaustive-ui-core-radiobutton.mjs.map +1 -1
  141. package/fesm2022/exhaustive-ui-core-rating.mjs +2 -2
  142. package/fesm2022/exhaustive-ui-core-rating.mjs.map +1 -1
  143. package/fesm2022/exhaustive-ui-core-scroller.mjs +14 -4
  144. package/fesm2022/exhaustive-ui-core-scroller.mjs.map +1 -1
  145. package/fesm2022/exhaustive-ui-core-scrollpanel.mjs +2 -2
  146. package/fesm2022/exhaustive-ui-core-scrollpanel.mjs.map +1 -1
  147. package/fesm2022/exhaustive-ui-core-scrolltop.mjs +11 -3
  148. package/fesm2022/exhaustive-ui-core-scrolltop.mjs.map +1 -1
  149. package/fesm2022/exhaustive-ui-core-select.mjs +102 -29
  150. package/fesm2022/exhaustive-ui-core-select.mjs.map +1 -1
  151. package/fesm2022/exhaustive-ui-core-selectbutton.mjs +13 -7
  152. package/fesm2022/exhaustive-ui-core-selectbutton.mjs.map +1 -1
  153. package/fesm2022/exhaustive-ui-core-skeleton.mjs +2 -2
  154. package/fesm2022/exhaustive-ui-core-skeleton.mjs.map +1 -1
  155. package/fesm2022/exhaustive-ui-core-slider.mjs +18 -5
  156. package/fesm2022/exhaustive-ui-core-slider.mjs.map +1 -1
  157. package/fesm2022/exhaustive-ui-core-speeddial.mjs +2 -2
  158. package/fesm2022/exhaustive-ui-core-speeddial.mjs.map +1 -1
  159. package/fesm2022/exhaustive-ui-core-splitbutton.mjs +9 -5
  160. package/fesm2022/exhaustive-ui-core-splitbutton.mjs.map +1 -1
  161. package/fesm2022/exhaustive-ui-core-splitter.mjs +29 -8
  162. package/fesm2022/exhaustive-ui-core-splitter.mjs.map +1 -1
  163. package/fesm2022/exhaustive-ui-core-stepper.mjs +8 -4
  164. package/fesm2022/exhaustive-ui-core-stepper.mjs.map +1 -1
  165. package/fesm2022/exhaustive-ui-core-steps.mjs +2 -2
  166. package/fesm2022/exhaustive-ui-core-steps.mjs.map +1 -1
  167. package/fesm2022/exhaustive-ui-core-table.mjs +546 -208
  168. package/fesm2022/exhaustive-ui-core-table.mjs.map +1 -1
  169. package/fesm2022/exhaustive-ui-core-tabs.mjs +44 -8
  170. package/fesm2022/exhaustive-ui-core-tabs.mjs.map +1 -1
  171. package/fesm2022/exhaustive-ui-core-tag.mjs +2 -2
  172. package/fesm2022/exhaustive-ui-core-tag.mjs.map +1 -1
  173. package/fesm2022/exhaustive-ui-core-terminal.mjs +1 -1
  174. package/fesm2022/exhaustive-ui-core-terminal.mjs.map +1 -1
  175. package/fesm2022/exhaustive-ui-core-textarea.mjs +11 -5
  176. package/fesm2022/exhaustive-ui-core-textarea.mjs.map +1 -1
  177. package/fesm2022/exhaustive-ui-core-tieredmenu.mjs +31 -16
  178. package/fesm2022/exhaustive-ui-core-tieredmenu.mjs.map +1 -1
  179. package/fesm2022/exhaustive-ui-core-timeline.mjs +2 -2
  180. package/fesm2022/exhaustive-ui-core-timeline.mjs.map +1 -1
  181. package/fesm2022/exhaustive-ui-core-toast.mjs +17 -5
  182. package/fesm2022/exhaustive-ui-core-toast.mjs.map +1 -1
  183. package/fesm2022/exhaustive-ui-core-togglebutton.mjs +11 -4
  184. package/fesm2022/exhaustive-ui-core-togglebutton.mjs.map +1 -1
  185. package/fesm2022/exhaustive-ui-core-toggleswitch.mjs +2 -4
  186. package/fesm2022/exhaustive-ui-core-toggleswitch.mjs.map +1 -1
  187. package/fesm2022/exhaustive-ui-core-toolbar.mjs +2 -2
  188. package/fesm2022/exhaustive-ui-core-toolbar.mjs.map +1 -1
  189. package/fesm2022/exhaustive-ui-core-tooltip.mjs +5 -1
  190. package/fesm2022/exhaustive-ui-core-tooltip.mjs.map +1 -1
  191. package/fesm2022/exhaustive-ui-core-tree.mjs +30 -11
  192. package/fesm2022/exhaustive-ui-core-tree.mjs.map +1 -1
  193. package/fesm2022/exhaustive-ui-core-treeselect.mjs +53 -6
  194. package/fesm2022/exhaustive-ui-core-treeselect.mjs.map +1 -1
  195. package/fesm2022/exhaustive-ui-core-treetable.mjs +93 -21
  196. package/fesm2022/exhaustive-ui-core-treetable.mjs.map +1 -1
  197. package/fesm2022/exhaustive-ui-core-usestyle.mjs +49 -0
  198. package/fesm2022/exhaustive-ui-core-usestyle.mjs.map +1 -1
  199. package/fesm2022/exhaustive-ui-core-utils.mjs +2 -1
  200. package/fesm2022/exhaustive-ui-core-utils.mjs.map +1 -1
  201. package/package.json +5 -5
  202. package/schematics/migrate-from-primeflex/index.js +4 -2
  203. package/schematics/migrate-from-primeflex/schema.json +5 -0
  204. package/schematics/utils/package-json.js +17 -0
  205. package/schematics/utils/primeflex.js +45 -10
  206. package/schematics/utils/versions.json +8 -8
  207. package/types/exhaustive-ui-core-api.d.ts +6 -0
  208. package/types/exhaustive-ui-core-autocomplete.d.ts +2 -0
  209. package/types/exhaustive-ui-core-autofocus.d.ts +1 -1
  210. package/types/exhaustive-ui-core-basecomponent.d.ts +16 -0
  211. package/types/exhaustive-ui-core-breadcrumb.d.ts +7 -1
  212. package/types/exhaustive-ui-core-button.d.ts +12 -1
  213. package/types/exhaustive-ui-core-cascadeselect.d.ts +2 -1
  214. package/types/exhaustive-ui-core-chart.d.ts +2 -2
  215. package/types/exhaustive-ui-core-confirmdialog.d.ts +17 -5
  216. package/types/exhaustive-ui-core-confirmpopup.d.ts +4 -0
  217. package/types/exhaustive-ui-core-datepicker.d.ts +10 -2
  218. package/types/exhaustive-ui-core-dialog.d.ts +2 -0
  219. package/types/exhaustive-ui-core-drawer.d.ts +1 -0
  220. package/types/exhaustive-ui-core-fileupload.d.ts +4 -0
  221. package/types/exhaustive-ui-core-iconfield.d.ts +1 -2
  222. package/types/exhaustive-ui-core-image.d.ts +6 -1
  223. package/types/exhaustive-ui-core-inputnumber.d.ts +8 -0
  224. package/types/exhaustive-ui-core-keyfilter.d.ts +1 -0
  225. package/types/exhaustive-ui-core-megamenu.d.ts +1 -0
  226. package/types/exhaustive-ui-core-menu.d.ts +2 -0
  227. package/types/exhaustive-ui-core-menubar.d.ts +5 -0
  228. package/types/exhaustive-ui-core-metergroup.d.ts +1 -1
  229. package/types/exhaustive-ui-core-multiselect.d.ts +1 -1
  230. package/types/exhaustive-ui-core-orderlist.d.ts +11 -1
  231. package/types/exhaustive-ui-core-paginator.d.ts +1 -0
  232. package/types/exhaustive-ui-core-panelmenu.d.ts +7 -0
  233. package/types/exhaustive-ui-core-password.d.ts +9 -1
  234. package/types/exhaustive-ui-core-picklist.d.ts +8 -3
  235. package/types/exhaustive-ui-core-popover.d.ts +3 -0
  236. package/types/exhaustive-ui-core-select.d.ts +13 -1
  237. package/types/exhaustive-ui-core-selectbutton.d.ts +3 -0
  238. package/types/exhaustive-ui-core-splitbutton.d.ts +2 -1
  239. package/types/exhaustive-ui-core-splitter.d.ts +7 -1
  240. package/types/exhaustive-ui-core-stepper.d.ts +3 -2
  241. package/types/exhaustive-ui-core-table.d.ts +34 -4
  242. package/types/exhaustive-ui-core-tabs.d.ts +4 -0
  243. package/types/exhaustive-ui-core-tieredmenu.d.ts +2 -0
  244. package/types/exhaustive-ui-core-togglebutton.d.ts +1 -0
  245. package/types/exhaustive-ui-core-tree.d.ts +2 -0
  246. package/types/exhaustive-ui-core-treeselect.d.ts +12 -1
  247. package/types/exhaustive-ui-core-treetable.d.ts +22 -2
  248. package/types/exhaustive-ui-core-types-chart.d.ts +21 -1
  249. package/types/exhaustive-ui-core-types-confirmdialog.d.ts +1 -3
  250. package/types/exhaustive-ui-core-types-table.d.ts +1 -1
  251. package/types/exhaustive-ui-core-types-treetable.d.ts +2 -2
  252. 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;
@@ -2684,10 +2730,16 @@ class Table extends BaseComponent {
2684
2730
  });
2685
2731
  }
2686
2732
  }
2687
- if (this.resizableColumns() && this.resizeColumnElement()) {
2688
- let width = this.columnResizeMode() === 'expand' ? this._initialColWidths() : this._totalTableWidth();
2689
- ObjectUtils.reorderArray(width, dragIndex + 1, dropIndex + 1);
2690
- this.updateStyleElement(width, dragIndex, 0, 0);
2733
+ if (allowDrop && this.resizableColumns() && this.resizeColumnElement()) {
2734
+ // The widths are indexed by header cell, the drag/drop indexes by reorderable column only.
2735
+ const offset = DomHandler.index(this.draggedColumn()) - dragIndex;
2736
+ const width = [...((this.columnResizeMode() === 'expand' ? this._initialColWidths() : undefined) ?? this._totalTableWidth())];
2737
+ ObjectUtils.reorderArray(width, dragIndex + offset, dropIndex + offset);
2738
+ if (this.columnResizeMode() === 'expand') {
2739
+ this._initialColWidths.set(width);
2740
+ }
2741
+ // Keep every width as measured: no column is resized by a reorder.
2742
+ this.updateStyleElement(width, -1, 0, null);
2691
2743
  }
2692
2744
  this.reorderIndicatorUpViewChild().nativeElement.style.display = 'none';
2693
2745
  this.reorderIndicatorDownViewChild().nativeElement.style.display = 'none';
@@ -2696,6 +2748,46 @@ class Table extends BaseComponent {
2696
2748
  this.dropPosition.set(null);
2697
2749
  }
2698
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
+ }
2699
2791
  resizeTableCells(newColumnWidth, nextColumnWidth) {
2700
2792
  let colIndex = DomHandler.index(this.resizeColumnElement());
2701
2793
  let width = this.columnResizeMode() === 'expand' ? this._initialColWidths() : this._totalTableWidth();
@@ -2716,7 +2808,7 @@ class Table extends BaseComponent {
2716
2808
  }
2717
2809
  `;
2718
2810
  });
2719
- this.renderer.setProperty(this.styleElement(), 'innerHTML', innerHTML);
2811
+ this.renderer.setProperty(this.styleElement(), 'textContent', innerHTML);
2720
2812
  }
2721
2813
  onRowDragStart(event, index) {
2722
2814
  this.rowDragging.set(true);
@@ -2778,6 +2870,23 @@ class Table extends BaseComponent {
2778
2870
  this.onRowDragLeave(event, rowElement);
2779
2871
  this.onRowDragEnd(event);
2780
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
+ }
2781
2890
  isEmpty = computed(() => {
2782
2891
  let data = this.filteredValue() || this._value();
2783
2892
  return data == null || data.length == 0;
@@ -2855,10 +2964,10 @@ class Table extends BaseComponent {
2855
2964
  if (stateString) {
2856
2965
  let state = JSON.parse(stateString, reviver);
2857
2966
  if (this.paginator()) {
2858
- if (this.first() !== undefined) {
2967
+ if (this.first() !== undefined && state.first !== undefined) {
2859
2968
  this.first.set(state.first);
2860
2969
  }
2861
- if (this.rows() !== undefined) {
2970
+ if (this.rows() !== undefined && state.rows !== undefined) {
2862
2971
  this.rows.set(state.rows);
2863
2972
  }
2864
2973
  }
@@ -2926,7 +3035,7 @@ class Table extends BaseComponent {
2926
3035
  }
2927
3036
  `;
2928
3037
  });
2929
- this.styleElement().innerHTML = innerHTML;
3038
+ this.styleElement().textContent = innerHTML;
2930
3039
  }
2931
3040
  }
2932
3041
  }
@@ -3017,7 +3126,7 @@ class Table extends BaseComponent {
3017
3126
  }
3018
3127
  }
3019
3128
  `;
3020
- this.renderer.setProperty(this.responsiveStyleElement(), 'innerHTML', innerHTML);
3129
+ this.renderer.setProperty(this.responsiveStyleElement(), 'textContent', innerHTML);
3021
3130
  DomHandler.setAttribute(this.responsiveStyleElement(), 'nonce', this.config?.csp()?.nonce);
3022
3131
  }
3023
3132
  }
@@ -3071,7 +3180,7 @@ class Table extends BaseComponent {
3071
3180
  </div>
3072
3181
  }
3073
3182
  @if (captionTemplate() || _captionTemplate()) {
3074
- <div [class]="cx('header')" [pBind]="ptm('header')">
3183
+ <div [class]="cx('header')" [pBind]="ptm('header')" [attr.id]="id + '-caption'">
3075
3184
  <ng-container *ngTemplateOutlet="captionTemplate() || _captionTemplate()"></ng-container>
3076
3185
  </div>
3077
3186
  }
@@ -3095,7 +3204,7 @@ class Table extends BaseComponent {
3095
3204
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3096
3205
  [showJumpToPageInput]="showJumpToPageInput()"
3097
3206
  [showPageLinks]="showPageLinks()"
3098
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3207
+ [class]="cn(cx('pcPaginator', { position: 'top' }), paginatorStyleClass())"
3099
3208
  [locale]="paginatorLocale()"
3100
3209
  [pt]="ptm('pcPaginator')"
3101
3210
  [unstyled]="unstyled()"
@@ -3177,7 +3286,7 @@ class Table extends BaseComponent {
3177
3286
  }
3178
3287
 
3179
3288
  <ng-template #buildInTable let-items let-scrollerOptions="options">
3180
- <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">
3181
3290
  <ng-container *ngTemplateOutlet="colGroupTemplate() || _colGroupTemplate(); context: { $implicit: scrollerOptions.columns }"></ng-container>
3182
3291
  <thead role="rowgroup" #thead [class]="cx('thead')" [ngStyle]="sx('thead')" [pBind]="ptm('thead')">
3183
3292
  <ng-container
@@ -3259,7 +3368,7 @@ class Table extends BaseComponent {
3259
3368
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3260
3369
  [showJumpToPageInput]="showJumpToPageInput()"
3261
3370
  [showPageLinks]="showPageLinks()"
3262
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3371
+ [class]="cn(cx('pcPaginator', { position: 'bottom' }), paginatorStyleClass())"
3263
3372
  [locale]="paginatorLocale()"
3264
3373
  [pt]="ptm('pcPaginator')"
3265
3374
  [unstyled]="unstyled()"
@@ -3301,6 +3410,7 @@ class Table extends BaseComponent {
3301
3410
  @if (resizableColumns()) {
3302
3411
  <div #resizeHelper [ngClass]="cx('columnResizeIndicator')" [pBind]="ptm('columnResizeIndicator')" [style.display]="'none'"></div>
3303
3412
  }
3413
+ <span class="p-hidden-accessible" aria-live="polite" aria-atomic="true" [attr.data-pc-section]="'reorderannouncement'">{{ reorderAnnouncement() }}</span>
3304
3414
  @if (reorderableColumns()) {
3305
3415
  <span #reorderIndicatorUp [ngClass]="cx('rowReorderIndicatorUp')" [pBind]="ptm('rowReorderIndicatorUp')" [style.display]="'none'">
3306
3416
  @if (!reorderIndicatorUpIconTemplate() && !_reorderIndicatorUpIconTemplate()) {
@@ -3343,7 +3453,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3343
3453
  </div>
3344
3454
  }
3345
3455
  @if (captionTemplate() || _captionTemplate()) {
3346
- <div [class]="cx('header')" [pBind]="ptm('header')">
3456
+ <div [class]="cx('header')" [pBind]="ptm('header')" [attr.id]="id + '-caption'">
3347
3457
  <ng-container *ngTemplateOutlet="captionTemplate() || _captionTemplate()"></ng-container>
3348
3458
  </div>
3349
3459
  }
@@ -3367,7 +3477,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3367
3477
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3368
3478
  [showJumpToPageInput]="showJumpToPageInput()"
3369
3479
  [showPageLinks]="showPageLinks()"
3370
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3480
+ [class]="cn(cx('pcPaginator', { position: 'top' }), paginatorStyleClass())"
3371
3481
  [locale]="paginatorLocale()"
3372
3482
  [pt]="ptm('pcPaginator')"
3373
3483
  [unstyled]="unstyled()"
@@ -3449,7 +3559,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3449
3559
  }
3450
3560
 
3451
3561
  <ng-template #buildInTable let-items let-scrollerOptions="options">
3452
- <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">
3453
3563
  <ng-container *ngTemplateOutlet="colGroupTemplate() || _colGroupTemplate(); context: { $implicit: scrollerOptions.columns }"></ng-container>
3454
3564
  <thead role="rowgroup" #thead [class]="cx('thead')" [ngStyle]="sx('thead')" [pBind]="ptm('thead')">
3455
3565
  <ng-container
@@ -3531,7 +3641,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3531
3641
  [showJumpToPageDropdown]="showJumpToPageDropdown()"
3532
3642
  [showJumpToPageInput]="showJumpToPageInput()"
3533
3643
  [showPageLinks]="showPageLinks()"
3534
- [class]="cx('pcPaginator') + ' ' + paginatorStyleClass() && paginatorStyleClass()"
3644
+ [class]="cn(cx('pcPaginator', { position: 'bottom' }), paginatorStyleClass())"
3535
3645
  [locale]="paginatorLocale()"
3536
3646
  [pt]="ptm('pcPaginator')"
3537
3647
  [unstyled]="unstyled()"
@@ -3573,6 +3683,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3573
3683
  @if (resizableColumns()) {
3574
3684
  <div #resizeHelper [ngClass]="cx('columnResizeIndicator')" [pBind]="ptm('columnResizeIndicator')" [style.display]="'none'"></div>
3575
3685
  }
3686
+ <span class="p-hidden-accessible" aria-live="polite" aria-atomic="true" [attr.data-pc-section]="'reorderannouncement'">{{ reorderAnnouncement() }}</span>
3576
3687
  @if (reorderableColumns()) {
3577
3688
  <span #reorderIndicatorUp [ngClass]="cx('rowReorderIndicatorUp')" [pBind]="ptm('rowReorderIndicatorUp')" [style.display]="'none'">
3578
3689
  @if (!reorderIndicatorUpIconTemplate() && !_reorderIndicatorUpIconTemplate()) {
@@ -3715,6 +3826,11 @@ class TableBody extends BaseComponent {
3715
3826
  const getItemOptions = this.getScrollerOption('getItemOptions');
3716
3827
  return getItemOptions ? getItemOptions(index).index : index;
3717
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
+ }
3718
3834
  dataP = computed(() => {
3719
3835
  return this.cn({
3720
3836
  hoverable: this.dataTable.rowHover() || this.dataTable.selectionMode(),
@@ -3726,7 +3842,7 @@ class TableBody extends BaseComponent {
3726
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: `
3727
3843
  @if (!dataTable.expandedRowTemplate() && !dataTable._expandedRowTemplate()) {
3728
3844
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3729
- @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3845
+ @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getGroupRowIndex(rowIndex))) {
3730
3846
  <ng-container role="row">
3731
3847
  <ng-container
3732
3848
  *ngTemplateOutlet="
@@ -3772,7 +3888,7 @@ class TableBody extends BaseComponent {
3772
3888
  "
3773
3889
  ></ng-container>
3774
3890
  }
3775
- @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))) {
3776
3892
  <ng-container role="row">
3777
3893
  <ng-container
3778
3894
  *ngTemplateOutlet="
@@ -3792,21 +3908,6 @@ class TableBody extends BaseComponent {
3792
3908
  }
3793
3909
  @if ((dataTable.expandedRowTemplate() || dataTable._expandedRowTemplate()) && !(frozen() && (dataTable.frozenExpandedRowTemplate() || dataTable._frozenExpandedRowTemplate()))) {
3794
3910
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3795
- @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
3796
- <ng-container
3797
- *ngTemplateOutlet="
3798
- template();
3799
- context: {
3800
- $implicit: rowData,
3801
- rowIndex: getRowIndex(rowIndex),
3802
- columns: columns(),
3803
- expanded: dataTable.isRowExpanded(rowData),
3804
- editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
3805
- frozen: frozen()
3806
- }
3807
- "
3808
- ></ng-container>
3809
- }
3810
3911
  @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3811
3912
  <ng-container role="row">
3812
3913
  <ng-container
@@ -3824,6 +3925,21 @@ class TableBody extends BaseComponent {
3824
3925
  ></ng-container>
3825
3926
  </ng-container>
3826
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
+ }
3827
3943
  @if (dataTable.isRowExpanded(rowData)) {
3828
3944
  <ng-container
3829
3945
  *ngTemplateOutlet="
@@ -3889,7 +4005,7 @@ class TableBody extends BaseComponent {
3889
4005
  @if (dataTable.loading()) {
3890
4006
  <ng-container *ngTemplateOutlet="dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
3891
4007
  }
3892
- @if (dataTable.isEmpty() && !dataTable.loading()) {
4008
+ @if (dataTable.isEmpty() && !dataTable.loading() && !frozenRows()) {
3893
4009
  <ng-container *ngTemplateOutlet="dataTable.emptyMessageTemplate() || dataTable._emptyMessageTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
3894
4010
  }
3895
4011
  `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None });
@@ -3902,7 +4018,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3902
4018
  template: `
3903
4019
  @if (!dataTable.expandedRowTemplate() && !dataTable._expandedRowTemplate()) {
3904
4020
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3905
- @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && !dataTable.virtualScroll() && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
4021
+ @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && rowData && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getGroupRowIndex(rowIndex))) {
3906
4022
  <ng-container role="row">
3907
4023
  <ng-container
3908
4024
  *ngTemplateOutlet="
@@ -3948,7 +4064,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3948
4064
  "
3949
4065
  ></ng-container>
3950
4066
  }
3951
- @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))) {
3952
4068
  <ng-container role="row">
3953
4069
  <ng-container
3954
4070
  *ngTemplateOutlet="
@@ -3968,21 +4084,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
3968
4084
  }
3969
4085
  @if ((dataTable.expandedRowTemplate() || dataTable._expandedRowTemplate()) && !(frozen() && (dataTable.frozenExpandedRowTemplate() || dataTable._frozenExpandedRowTemplate()))) {
3970
4086
  @for (rowData of value(); track dataTable.rowTrackBy()(rowIndex, rowData); let rowIndex = $index) {
3971
- @if (!(dataTable.groupHeaderTemplate() && dataTable._groupHeaderTemplate())) {
3972
- <ng-container
3973
- *ngTemplateOutlet="
3974
- template();
3975
- context: {
3976
- $implicit: rowData,
3977
- rowIndex: getRowIndex(rowIndex),
3978
- columns: columns(),
3979
- expanded: dataTable.isRowExpanded(rowData),
3980
- editing: dataTable.editMode() === 'row' && dataTable.isRowEditing(rowData),
3981
- frozen: frozen()
3982
- }
3983
- "
3984
- ></ng-container>
3985
- }
3986
4087
  @if ((dataTable.groupHeaderTemplate() || dataTable._groupHeaderTemplate()) && dataTable.rowGroupMode() === 'subheader' && shouldRenderRowGroupHeader(value(), rowData, getRowIndex(rowIndex))) {
3987
4088
  <ng-container role="row">
3988
4089
  <ng-container
@@ -4000,6 +4101,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4000
4101
  ></ng-container>
4001
4102
  </ng-container>
4002
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
+ }
4003
4119
  @if (dataTable.isRowExpanded(rowData)) {
4004
4120
  <ng-container
4005
4121
  *ngTemplateOutlet="
@@ -4065,7 +4181,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4065
4181
  @if (dataTable.loading()) {
4066
4182
  <ng-container *ngTemplateOutlet="dataTable.loadingBodyTemplate() || dataTable._loadingBodyTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
4067
4183
  }
4068
- @if (dataTable.isEmpty() && !dataTable.loading()) {
4184
+ @if (dataTable.isEmpty() && !dataTable.loading() && !frozenRows()) {
4069
4185
  <ng-container *ngTemplateOutlet="dataTable.emptyMessageTemplate() || dataTable._emptyMessageTemplate(); context: { $implicit: columns(), frozen: frozen() }"></ng-container>
4070
4186
  }
4071
4187
  `,
@@ -4112,8 +4228,6 @@ class FrozenColumn extends BaseComponent {
4112
4228
  ...(ngDevMode ? [{ debugName: "alignFrozen" }] : /* istanbul ignore next */ []));
4113
4229
  resizeListener = signal(undefined, /* @ts-ignore */
4114
4230
  ...(ngDevMode ? [{ debugName: "resizeListener" }] : /* istanbul ignore next */ []));
4115
- resizeObserver = signal(undefined, /* @ts-ignore */
4116
- ...(ngDevMode ? [{ debugName: "resizeObserver" }] : /* istanbul ignore next */ []));
4117
4231
  _componentStyle = inject(TableStyle);
4118
4232
  constructor() {
4119
4233
  super();
@@ -4121,18 +4235,14 @@ class FrozenColumn extends BaseComponent {
4121
4235
  this.frozen();
4122
4236
  untracked(() => Promise.resolve(null).then(() => this.updateStickyPosition()));
4123
4237
  });
4124
- afterNextRender(() => {
4125
- this.bindResizeListener();
4126
- this.observeChanges();
4127
- });
4238
+ afterNextRender(() => this.bindResizeListener());
4128
4239
  }
4240
+ // every frozen cell of the page shares one window resize listener and one ResizeObserver
4129
4241
  bindResizeListener() {
4130
- if (isPlatformBrowser(this.platformId)) {
4131
- if (!this.resizeListener()) {
4132
- this.resizeListener.set(this.renderer.listen(this.document.defaultView, 'resize', () => {
4133
- this.recalculateColumns();
4134
- }));
4135
- }
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));
4136
4246
  }
4137
4247
  }
4138
4248
  unbindResizeListener() {
@@ -4142,41 +4252,38 @@ class FrozenColumn extends BaseComponent {
4142
4252
  }
4143
4253
  }
4144
4254
  observeChanges() {
4145
- if (isPlatformBrowser(this.platformId)) {
4146
- const resizeObserver = new ResizeObserver(() => {
4147
- this.recalculateColumns();
4148
- });
4149
- resizeObserver.observe(this.el.nativeElement);
4150
- this.resizeObserver.set(resizeObserver);
4151
- }
4255
+ this.bindResizeListener();
4152
4256
  }
4153
4257
  recalculateColumns() {
4154
- const siblings = DomHandler.siblings(this.el.nativeElement);
4155
- const index = DomHandler.index(this.el.nativeElement);
4156
- const time = (siblings.length - index + 1) * 50;
4157
- setTimeout(() => {
4158
- this.updateStickyPosition();
4159
- }, time);
4258
+ if (isPlatformBrowser(this.platformId)) {
4259
+ FrozenColumnTracker.get(this.document.defaultView).schedule();
4260
+ }
4160
4261
  }
4161
4262
  updateStickyPosition() {
4162
- 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';
4163
4268
  if (this.alignFrozen() === 'right') {
4164
- let right = 0;
4269
+ let end = 0;
4165
4270
  let sibling = this.el.nativeElement.nextElementSibling;
4166
4271
  while (sibling) {
4167
- right += DomHandler.getOuterWidth(sibling);
4272
+ end += this.getFrozenWidth(sibling);
4168
4273
  sibling = sibling.nextElementSibling;
4169
4274
  }
4170
- this.el.nativeElement.style.right = right + 'px';
4275
+ this.el.nativeElement.style[endSide] = end + 'px';
4276
+ this.el.nativeElement.style[startSide] = '';
4171
4277
  }
4172
4278
  else {
4173
- let left = 0;
4279
+ let start = 0;
4174
4280
  let sibling = this.el.nativeElement.previousElementSibling;
4175
4281
  while (sibling) {
4176
- left += DomHandler.getOuterWidth(sibling);
4282
+ start += this.getFrozenWidth(sibling);
4177
4283
  sibling = sibling.previousElementSibling;
4178
4284
  }
4179
- this.el.nativeElement.style.left = left + 'px';
4285
+ this.el.nativeElement.style[startSide] = start + 'px';
4286
+ this.el.nativeElement.style[endSide] = '';
4180
4287
  }
4181
4288
  const filterRow = this.el.nativeElement?.parentElement?.nextElementSibling;
4182
4289
  if (filterRow) {
@@ -4188,12 +4295,15 @@ class FrozenColumn extends BaseComponent {
4188
4295
  }
4189
4296
  }
4190
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
+ }
4191
4302
  onDestroy() {
4192
4303
  this.unbindResizeListener();
4193
- this.resizeObserver()?.disconnect();
4194
4304
  }
4195
4305
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FrozenColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4196
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: FrozenColumn, isStandalone: false, selector: "[pFrozenColumn]", inputs: { frozen: { classPropertyName: "frozen", publicName: "frozen", isSignal: true, isRequired: false, transformFunction: null }, alignFrozen: { classPropertyName: "alignFrozen", publicName: "alignFrozen", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "cx(\"frozenColumn\")" } }, providers: [TableStyle], usesInheritance: true, ngImport: i0 });
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 });
4197
4307
  }
4198
4308
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: FrozenColumn, decorators: [{
4199
4309
  type: Directive,
@@ -4201,11 +4311,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4201
4311
  selector: '[pFrozenColumn]',
4202
4312
  standalone: false,
4203
4313
  host: {
4204
- '[class]': 'cx("frozenColumn")'
4314
+ '[class]': 'cx("frozenColumn")',
4315
+ '[attr.data-p-frozen-column]': 'frozen()'
4205
4316
  },
4206
4317
  providers: [TableStyle]
4207
4318
  }]
4208
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
+ }
4209
4368
  class SortableColumn extends BaseComponent {
4210
4369
  dataTable = inject(Table);
4211
4370
  field = input(undefined, { ...(ngDevMode ? { debugName: "field" } : /* istanbul ignore next */ {}), alias: 'pSortableColumn' });
@@ -4274,7 +4433,7 @@ class SortableColumn extends BaseComponent {
4274
4433
  }
4275
4434
  }
4276
4435
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: SortableColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4277
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: SortableColumn, isStandalone: false, selector: "[pSortableColumn]", inputs: { field: { classPropertyName: "field", publicName: "pSortableColumn", isSignal: true, isRequired: false, transformFunction: null }, pSortableColumnDisabled: { classPropertyName: "pSortableColumnDisabled", publicName: "pSortableColumnDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "columnheader" }, listeners: { "click": "onClick($event)", "keydown.space": "onEnterKey($event)", "keydown.enter": "onEnterKey($event)" }, properties: { "class": "cx('sortableColumn')", "tabindex": "isEnabled() ? \"0\" : null", "attr.aria-sort": "sortOrder()" } }, providers: [TableStyle], usesInheritance: true, ngImport: i0 });
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 });
4278
4437
  }
4279
4438
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: SortableColumn, decorators: [{
4280
4439
  type: Directive,
@@ -4284,7 +4443,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4284
4443
  host: {
4285
4444
  '[class]': "cx('sortableColumn')",
4286
4445
  '[tabindex]': 'isEnabled() ? "0" : null',
4287
- role: 'columnheader',
4446
+ '[attr.role]': 'role',
4288
4447
  '[attr.aria-sort]': 'sortOrder()'
4289
4448
  },
4290
4449
  providers: [TableStyle]
@@ -4298,6 +4457,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4298
4457
  }, {
4299
4458
  type: HostListener,
4300
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']]
4301
4472
  }] } });
4302
4473
  class SortIcon extends BaseComponent {
4303
4474
  dataTable = inject(Table);
@@ -4358,13 +4529,13 @@ class SortIcon extends BaseComponent {
4358
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: `
4359
4530
  @if (!(dataTable.sortIconTemplate() || dataTable._sortIconTemplate())) {
4360
4531
  @if (sortOrder() === 0) {
4361
- <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" />
4532
+ <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4362
4533
  }
4363
4534
  @if (sortOrder() === 1) {
4364
- <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" />
4365
4536
  }
4366
4537
  @if (sortOrder() === -1) {
4367
- <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" />
4538
+ <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4368
4539
  }
4369
4540
  }
4370
4541
  @if (dataTable.sortIconTemplate() || dataTable._sortIconTemplate()) {
@@ -4385,13 +4556,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4385
4556
  template: `
4386
4557
  @if (!(dataTable.sortIconTemplate() || dataTable._sortIconTemplate())) {
4387
4558
  @if (sortOrder() === 0) {
4388
- <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" />
4559
+ <svg data-p-icon="sort-alt" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4389
4560
  }
4390
4561
  @if (sortOrder() === 1) {
4391
- <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" />
4392
4563
  }
4393
4564
  @if (sortOrder() === -1) {
4394
- <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" />
4565
+ <svg data-p-icon="sort-amount-down" [class]="cx('sortableColumnIcon')" aria-hidden="true" />
4395
4566
  }
4396
4567
  }
4397
4568
  @if (dataTable.sortIconTemplate() || dataTable._sortIconTemplate()) {
@@ -4428,7 +4599,8 @@ class SelectableRow extends BaseComponent {
4428
4599
  }
4429
4600
  setRowTabIndex() {
4430
4601
  if (this.dataTable.selectionMode() === 'single' || this.dataTable.selectionMode() === 'multiple') {
4431
- 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;
4432
4604
  }
4433
4605
  }
4434
4606
  onInit() {
@@ -4892,6 +5064,8 @@ class ReorderableColumn extends BaseComponent {
4892
5064
  ...(ngDevMode ? [{ debugName: "dragEnterListener" }] : /* istanbul ignore next */ []));
4893
5065
  dragLeaveListener = signal(undefined, /* @ts-ignore */
4894
5066
  ...(ngDevMode ? [{ debugName: "dragLeaveListener" }] : /* istanbul ignore next */ []));
5067
+ dragEndListener = signal(undefined, /* @ts-ignore */
5068
+ ...(ngDevMode ? [{ debugName: "dragEndListener" }] : /* istanbul ignore next */ []));
4895
5069
  mouseDownListener = signal(undefined, /* @ts-ignore */
4896
5070
  ...(ngDevMode ? [{ debugName: "mouseDownListener" }] : /* istanbul ignore next */ []));
4897
5071
  _componentStyle = inject(TableStyle);
@@ -4911,6 +5085,7 @@ class ReorderableColumn extends BaseComponent {
4911
5085
  this.dragOverListener.set(this.renderer.listen(this.el.nativeElement, 'dragover', this.onDragOver.bind(this)));
4912
5086
  this.dragEnterListener.set(this.renderer.listen(this.el.nativeElement, 'dragenter', this.onDragEnter.bind(this)));
4913
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)));
4914
5089
  });
4915
5090
  }
4916
5091
  }
@@ -4935,9 +5110,13 @@ class ReorderableColumn extends BaseComponent {
4935
5110
  this.dragLeaveListener()();
4936
5111
  this.dragLeaveListener.set(null);
4937
5112
  }
5113
+ if (this.dragEndListener()) {
5114
+ this.dragEndListener()();
5115
+ this.dragEndListener.set(null);
5116
+ }
4938
5117
  }
4939
5118
  onMouseDown(event) {
4940
- if (event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA' || findSingle(event.target, '[data-pc-column-resizer="true"]'))
5119
+ if (event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA' || event.target.closest?.('[data-pc-column-resizer="true"]'))
4941
5120
  this.el.nativeElement.draggable = false;
4942
5121
  else
4943
5122
  this.el.nativeElement.draggable = true;
@@ -4954,11 +5133,21 @@ class ReorderableColumn extends BaseComponent {
4954
5133
  onDragLeave(event) {
4955
5134
  this.dataTable.onColumnDragLeave(event);
4956
5135
  }
5136
+ onDragEnd() {
5137
+ this.dataTable.onColumnDragEnd();
5138
+ }
4957
5139
  onDrop(event) {
4958
5140
  if (this.isEnabled()) {
4959
5141
  this.dataTable.onColumnDrop(event, this.el.nativeElement);
4960
5142
  }
4961
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
+ }
4962
5151
  isEnabled() {
4963
5152
  return this.pReorderableColumnDisabled() !== true;
4964
5153
  }
@@ -4966,7 +5155,7 @@ class ReorderableColumn extends BaseComponent {
4966
5155
  this.unbindEvents();
4967
5156
  }
4968
5157
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ReorderableColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
4969
- 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 });
4970
5159
  }
4971
5160
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ReorderableColumn, decorators: [{
4972
5161
  type: Directive,
@@ -4974,13 +5163,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
4974
5163
  selector: '[pReorderableColumn]',
4975
5164
  standalone: false,
4976
5165
  host: {
4977
- '[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'
4978
5169
  },
4979
5170
  providers: [TableStyle]
4980
5171
  }]
4981
5172
  }], ctorParameters: () => [], propDecorators: { pReorderableColumnDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "pReorderableColumnDisabled", required: false }] }], onDrop: [{
4982
5173
  type: HostListener,
4983
5174
  args: ['drop', ['$event']]
5175
+ }], onKeyDown: [{
5176
+ type: HostListener,
5177
+ args: ['keydown', ['$event']]
4984
5178
  }] } });
4985
5179
  class EditableColumn extends BaseComponent {
4986
5180
  dataTable = inject(Table);
@@ -5035,6 +5229,7 @@ class EditableColumn extends BaseComponent {
5035
5229
  }
5036
5230
  openCell() {
5037
5231
  this.dataTable.updateEditingCell(this.el.nativeElement, this.data(), this.field(), this.rowIndex());
5232
+ this.dataTable.editingCellOriginalValue.set(ObjectUtils.resolveFieldData(this.data(), this.field()));
5038
5233
  !this.$unstyled() && DomHandler.addClass(this.el.nativeElement, 'p-cell-editing');
5039
5234
  setAttribute(this.el.nativeElement, 'data-p-cell-editing', 'true');
5040
5235
  this.dataTable.onEditInit.emit({
@@ -5059,6 +5254,9 @@ class EditableColumn extends BaseComponent {
5059
5254
  this.dataTable.overlaySubscription.set(this.dataTable.overlayService.clickObservable.subscribe(this.overlayEventListener()));
5060
5255
  }
5061
5256
  closeEditingCell(completed, event) {
5257
+ if (!completed && this.dataTable.editingCellData() && this.dataTable.editingCellField()) {
5258
+ this.dataTable.editingCellData()[this.dataTable.editingCellField()] = this.dataTable.editingCellOriginalValue();
5259
+ }
5062
5260
  const eventData = {
5063
5261
  field: this.dataTable.editingCellField(),
5064
5262
  data: this.dataTable.editingCellData(),
@@ -5070,11 +5268,6 @@ class EditableColumn extends BaseComponent {
5070
5268
  }
5071
5269
  else {
5072
5270
  this.dataTable.onEditCancel.emit(eventData);
5073
- this.dataTable._value().forEach((element) => {
5074
- if (element[this.dataTable.editingCellField()] === this.data()) {
5075
- element[this.dataTable.editingCellField()] = this.dataTable.editingCellData();
5076
- }
5077
- });
5078
5271
  }
5079
5272
  !this.$unstyled() && DomHandler.removeClass(this.dataTable.editingCell(), 'p-cell-editing');
5080
5273
  setAttribute(this.el.nativeElement, 'data-p-cell-editing', 'false');
@@ -5088,8 +5281,13 @@ class EditableColumn extends BaseComponent {
5088
5281
  }
5089
5282
  onEnterKeyDown(event) {
5090
5283
  if (this.isEnabled() && !event.shiftKey) {
5091
- 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()) {
5092
5289
  this.closeEditingCell(true, event);
5290
+ this.el.nativeElement.focus();
5093
5291
  }
5094
5292
  event.preventDefault();
5095
5293
  }
@@ -5106,6 +5304,7 @@ class EditableColumn extends BaseComponent {
5106
5304
  if (this.isEnabled()) {
5107
5305
  if (this.dataTable.isEditingCellValid()) {
5108
5306
  this.closeEditingCell(false, event);
5307
+ this.el.nativeElement.focus();
5109
5308
  }
5110
5309
  event.preventDefault();
5111
5310
  }
@@ -5279,7 +5478,7 @@ class EditableColumn extends BaseComponent {
5279
5478
  }
5280
5479
  }
5281
5480
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: EditableColumn, deps: [], target: i0.ɵɵFactoryTarget.Directive });
5282
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.2.1", type: EditableColumn, isStandalone: false, selector: "[pEditableColumn]", inputs: { data: { classPropertyName: "data", publicName: "pEditableColumn", isSignal: true, isRequired: false, transformFunction: null }, field: { classPropertyName: "field", publicName: "pEditableColumnField", isSignal: true, isRequired: false, transformFunction: null }, rowIndex: { classPropertyName: "rowIndex", publicName: "pEditableColumnRowIndex", isSignal: true, isRequired: false, transformFunction: null }, pEditableColumnDisabled: { classPropertyName: "pEditableColumnDisabled", publicName: "pEditableColumnDisabled", isSignal: true, isRequired: false, transformFunction: null }, pFocusCellSelector: { classPropertyName: "pFocusCellSelector", publicName: "pFocusCellSelector", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)", "keydown.enter": "onEnterKeyDown($event)", "keydown.tab": "onShiftKeyDown($event)", "keydown.escape": "onEscapeKeyDown($event)", "keydown.shift.tab": "onShiftKeyDown($event)", "keydown.meta.tab": "onShiftKeyDown($event)", "keydown.arrowdown": "onArrowDown($event)", "keydown.arrowup": "onArrowUp($event)", "keydown.arrowleft": "onArrowLeft($event)", "keydown.arrowright": "onArrowRight($event)" }, properties: { "attr.data-p-editable-column": "true" } }, usesInheritance: true, ngImport: i0 });
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 });
5283
5482
  }
5284
5483
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: EditableColumn, decorators: [{
5285
5484
  type: Directive,
@@ -5287,7 +5486,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
5287
5486
  selector: '[pEditableColumn]',
5288
5487
  standalone: false,
5289
5488
  host: {
5290
- '[attr.data-p-editable-column]': 'true'
5489
+ '[attr.data-p-editable-column]': 'true',
5490
+ '[attr.tabindex]': 'isEnabled() ? "0" : null'
5291
5491
  }
5292
5492
  }]
5293
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: [{
@@ -5656,7 +5856,7 @@ class TableHeaderCheckbox extends BaseComponent {
5656
5856
  valueChangeSubscription;
5657
5857
  constructor() {
5658
5858
  super();
5659
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptm('headerCheckbox')));
5859
+ this.bindHostAttrs(this.bindDirectiveInstance, () => this.ptm('headerCheckbox'));
5660
5860
  this.valueChangeSubscription = this.dataTable.tableService.valueSource$.subscribe(() => {
5661
5861
  this.checked.set(this.updateCheckedState());
5662
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));
@@ -5752,15 +5952,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
5752
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 }] }] } });
5753
5953
  class ReorderableRowHandle extends BaseComponent {
5754
5954
  el = inject(ElementRef);
5955
+ row = inject(ReorderableRow, { optional: true });
5755
5956
  hostName = 'Table';
5756
5957
  bindDirectiveInstance = inject(Bind, { self: true });
5757
5958
  _componentStyle = inject(TableStyle);
5758
5959
  constructor() {
5759
5960
  super();
5760
- 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
+ }
5761
5972
  }
5762
5973
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ReorderableRowHandle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
5763
- 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 });
5764
5975
  }
5765
5976
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ReorderableRowHandle, decorators: [{
5766
5977
  type: Directive,
@@ -5768,12 +5979,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
5768
5979
  selector: '[pReorderableRowHandle]',
5769
5980
  standalone: false,
5770
5981
  host: {
5771
- '[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'
5772
5986
  },
5773
5987
  providers: [TableStyle],
5774
5988
  hostDirectives: [Bind]
5775
5989
  }]
5776
- }], 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();
5777
5996
  class ReorderableRow extends BaseComponent {
5778
5997
  dataTable = inject(Table);
5779
5998
  zone = inject(NgZone);
@@ -5793,9 +6012,14 @@ class ReorderableRow extends BaseComponent {
5793
6012
  ...(ngDevMode ? [{ debugName: "dragLeaveListener" }] : /* istanbul ignore next */ []));
5794
6013
  dropListener = signal(undefined, /* @ts-ignore */
5795
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;
5796
6019
  constructor() {
5797
6020
  super();
5798
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptm('reorderableRow')));
6021
+ reorderableRowElements.set(this.el.nativeElement, this);
6022
+ this.bindHostAttrs(this.bindDirectiveInstance, () => this.ptm('reorderableRow'));
5799
6023
  afterNextRender(() => {
5800
6024
  if (this.isEnabled()) {
5801
6025
  this.el.nativeElement.droppable = true;
@@ -5810,6 +6034,7 @@ class ReorderableRow extends BaseComponent {
5810
6034
  this.dragEndListener.set(this.renderer.listen(this.el.nativeElement, 'dragend', this.onDragEnd.bind(this)));
5811
6035
  this.dragOverListener.set(this.renderer.listen(this.el.nativeElement, 'dragover', this.onDragOver.bind(this)));
5812
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)));
5813
6038
  });
5814
6039
  }
5815
6040
  unbindEvents() {
@@ -5833,6 +6058,55 @@ class ReorderableRow extends BaseComponent {
5833
6058
  this.dragLeaveListener()();
5834
6059
  this.dragLeaveListener.set(null);
5835
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 = [];
5836
6110
  }
5837
6111
  onMouseDown(event) {
5838
6112
  const targetElement = event.target;
@@ -5898,7 +6172,33 @@ class ColumnFilter extends BaseComponent {
5898
6172
  _componentStyle = inject(TableStyle);
5899
6173
  constructor() {
5900
6174
  super();
5901
- 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
+ }
5902
6202
  }
5903
6203
  ptmFilterConstraintOptions(matchMode) {
5904
6204
  return {
@@ -6401,6 +6701,23 @@ class ColumnFilter extends BaseComponent {
6401
6701
  this.hide();
6402
6702
  this.icon()?.nativeElement.focus();
6403
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
+ }
6404
6721
  findNextItem(item) {
6405
6722
  let nextItem = item.nextElementSibling;
6406
6723
  if (nextItem)
@@ -6488,7 +6805,7 @@ class ColumnFilter extends BaseComponent {
6488
6805
  let fieldFilter = this.dataTable._filters()[this.field()];
6489
6806
  if (fieldFilter) {
6490
6807
  if (Array.isArray(fieldFilter))
6491
- return !this.dataTable.isFilterBlank(fieldFilter[0].value);
6808
+ return fieldFilter.some((meta) => !this.dataTable.isFilterBlank(meta.value));
6492
6809
  else
6493
6810
  return !this.dataTable.isFilterBlank(fieldFilter.value);
6494
6811
  }
@@ -6510,10 +6827,11 @@ class ColumnFilter extends BaseComponent {
6510
6827
  bindDocumentClickListener() {
6511
6828
  if (!this.documentClickListener()) {
6512
6829
  const documentTarget = this.el ? this.el.nativeElement.ownerDocument : 'document';
6513
- this.documentClickListener.set(this.renderer.listen(documentTarget, 'mousedown', (event) => {
6514
- const dialogElements = document.querySelectorAll('[role="dialog"]');
6515
- const targetIsColumnFilterMenuButton = event.target.closest('[data-pc-name="pccolumnfilterbutton"]');
6516
- if (this.overlayVisible() && this.isOutsideClicked(event) && (targetIsColumnFilterMenuButton || dialogElements?.length <= 1)) {
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)) {
6517
6835
  this.hide();
6518
6836
  }
6519
6837
  this.selfClick.set(false);
@@ -6615,7 +6933,6 @@ class ColumnFilter extends BaseComponent {
6615
6933
  [currency]="currency()"
6616
6934
  [currencyDisplay]="currencyDisplay()"
6617
6935
  [useGrouping]="useGrouping()"
6618
- [showButtons]="showButtons()"
6619
6936
  [filterOn]="filterOn()"
6620
6937
  [pt]="pt()"
6621
6938
  [unstyled]="unstyled()"
@@ -6625,10 +6942,7 @@ class ColumnFilter extends BaseComponent {
6625
6942
  <p-button
6626
6943
  [styleClass]="cx('pcColumnFilterButton')"
6627
6944
  [pt]="ptm('pcColumnFilterButton')"
6628
- [attr.aria-haspopup]="true"
6629
6945
  [ariaLabel]="filterMenuButtonAriaLabel"
6630
- [attr.aria-controls]="overlayVisible() ? overlayId() : null"
6631
- [attr.aria-expanded]="overlayVisible() ?? false"
6632
6946
  (click)="toggleMenu($event)"
6633
6947
  (keydown)="onToggleButtonKeyDown($event)"
6634
6948
  [buttonProps]="filterButtonProps()?.filter"
@@ -6652,6 +6966,13 @@ class ColumnFilter extends BaseComponent {
6652
6966
  </ng-template>
6653
6967
  </p-button>
6654
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
+ }
6655
6976
  @if (renderOverlay()) {
6656
6977
  <div
6657
6978
  [pMotion]="showMenu() && overlayVisible()"
@@ -6667,6 +6988,8 @@ class ColumnFilter extends BaseComponent {
6667
6988
  role="dialog"
6668
6989
  (click)="onContentClick()"
6669
6990
  (keydown.escape)="onEscape()"
6991
+ (keydown.tab)="onOverlayTabKeyDown($event)"
6992
+ (keydown.shift.tab)="onOverlayTabKeyDown($event)"
6670
6993
  >
6671
6994
  <ng-container *ngTemplateOutlet="headerTemplate() || _headerTemplate(); context: { $implicit: field() }"></ng-container>
6672
6995
  @if (display() === 'row') {
@@ -6720,6 +7043,7 @@ class ColumnFilter extends BaseComponent {
6720
7043
  <p-columnFilterFormElement
6721
7044
  [type]="type()"
6722
7045
  [field]="field()"
7046
+ [ariaLabel]="ariaLabel()"
6723
7047
  [filterConstraint]="fieldConstraint"
6724
7048
  [filterTemplate]="filterTemplate() || _filterTemplate()"
6725
7049
  [placeholder]="placeholder()"
@@ -6736,8 +7060,8 @@ class ColumnFilter extends BaseComponent {
6736
7060
  [pt]="pt()"
6737
7061
  [unstyled]="unstyled()"
6738
7062
  ></p-columnFilterFormElement>
6739
- <div>
6740
- @if (showRemoveIcon) {
7063
+ @if (showRemoveIcon) {
7064
+ <div>
6741
7065
  <p-button
6742
7066
  [styleClass]="cx('pcFilterRemoveRuleButton')"
6743
7067
  [pt]="ptm('pcFilterRemoveRuleButton')"
@@ -6757,8 +7081,8 @@ class ColumnFilter extends BaseComponent {
6757
7081
  <ng-template *ngTemplateOutlet="removeRuleIconTemplate() || _removeRuleIconTemplate()"></ng-template>
6758
7082
  </ng-template>
6759
7083
  </p-button>
6760
- }
6761
- </div>
7084
+ </div>
7085
+ }
6762
7086
  </div>
6763
7087
  }
6764
7088
  </div>
@@ -6783,37 +7107,39 @@ class ColumnFilter extends BaseComponent {
6783
7107
  </ng-template>
6784
7108
  </p-button>
6785
7109
  }
6786
- <div [class]="cx('filterButtonbar')" [pBind]="ptm('filterButtonBar')">
6787
- @if (showClearButton()) {
6788
- <p-button
6789
- #clearBtn
6790
- [outlined]="true"
6791
- (onClick)="clearFilter()"
6792
- [attr.aria-label]="clearButtonLabel"
6793
- [label]="clearButtonLabel"
6794
- [buttonProps]="filterButtonProps()?.popover?.clear"
6795
- [pt]="ptm('pcFilterClearButton')"
6796
- [unstyled]="unstyled()"
6797
- />
6798
- }
6799
- @if (showApplyButton()) {
6800
- <p-button
6801
- (onClick)="applyFilter()"
6802
- size="small"
6803
- [label]="applyButtonLabel"
6804
- [attr.aria-label]="applyButtonLabel"
6805
- [buttonProps]="filterButtonProps()?.popover?.apply"
6806
- [pt]="ptm('pcFilterApplyButton')"
6807
- [unstyled]="unstyled()"
6808
- />
6809
- }
6810
- </div>
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
+ }
6811
7137
  }
6812
7138
  <ng-container *ngTemplateOutlet="footerTemplate() || _footerTemplate(); context: { $implicit: field() }"></ng-container>
6813
7139
  </div>
6814
7140
  }
6815
7141
  </div>
6816
- `, isInline: true, dependencies: [{ kind: "directive", type: i0.forwardRef(() => i2.NgClass), selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i0.forwardRef(() => i2.NgTemplateOutlet), selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i0.forwardRef(() => i10.Select), selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo", "motionOptions"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "directive", type: i0.forwardRef(() => i7.NgControlStatus), selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i0.forwardRef(() => i7.NgModel), selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i0.forwardRef(() => i11.Button), selector: "p-button", inputs: ["hostName", "type", "badge", "disabled", "raised", "rounded", "text", "plain", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeSeverity", "ariaLabel", "autofocus", "iconPos", "icon", "label", "loading", "loadingIcon", "severity", "buttonProps", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i0.forwardRef(() => FilterIcon), selector: "[data-p-icon=\"filter\"]" }, { kind: "component", type: i0.forwardRef(() => FilterFillIcon), selector: "[data-p-icon=\"filter-fill\"]" }, { kind: "component", type: i0.forwardRef(() => PlusIcon), selector: "[data-p-icon=\"plus\"]" }, { kind: "component", type: i0.forwardRef(() => TrashIcon), selector: "[data-p-icon=\"trash\"]" }, { kind: "directive", type: i0.forwardRef(() => i1.Bind), selector: "[pBind]", inputs: ["pBind"] }, { kind: "directive", type: i0.forwardRef(() => i12.MotionDirective), selector: "[pMotion]", inputs: ["pMotion", "pMotionName", "pMotionType", "pMotionSafe", "pMotionDisabled", "pMotionAppear", "pMotionEnter", "pMotionLeave", "pMotionDuration", "pMotionHideStrategy", "pMotionEnterFromClass", "pMotionEnterToClass", "pMotionEnterActiveClass", "pMotionLeaveFromClass", "pMotionLeaveToClass", "pMotionLeaveActiveClass", "pMotionOptions"], outputs: ["pMotionOnBeforeEnter", "pMotionOnEnter", "pMotionOnAfterEnter", "pMotionOnEnterCancelled", "pMotionOnBeforeLeave", "pMotionOnLeave", "pMotionOnAfterLeave", "pMotionOnLeaveCancelled"] }, { kind: "component", type: i0.forwardRef(() => ColumnFilterFormElement), selector: "p-columnFilterFormElement", inputs: ["field", "type", "filterConstraint", "filterTemplate", "placeholder", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping", "ariaLabel", "filterOn"] }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None });
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 });
6817
7143
  }
6818
7144
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ColumnFilter, decorators: [{
6819
7145
  type: Component,
@@ -6841,7 +7167,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6841
7167
  [currency]="currency()"
6842
7168
  [currencyDisplay]="currencyDisplay()"
6843
7169
  [useGrouping]="useGrouping()"
6844
- [showButtons]="showButtons()"
6845
7170
  [filterOn]="filterOn()"
6846
7171
  [pt]="pt()"
6847
7172
  [unstyled]="unstyled()"
@@ -6851,10 +7176,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6851
7176
  <p-button
6852
7177
  [styleClass]="cx('pcColumnFilterButton')"
6853
7178
  [pt]="ptm('pcColumnFilterButton')"
6854
- [attr.aria-haspopup]="true"
6855
7179
  [ariaLabel]="filterMenuButtonAriaLabel"
6856
- [attr.aria-controls]="overlayVisible() ? overlayId() : null"
6857
- [attr.aria-expanded]="overlayVisible() ?? false"
6858
7180
  (click)="toggleMenu($event)"
6859
7181
  (keydown)="onToggleButtonKeyDown($event)"
6860
7182
  [buttonProps]="filterButtonProps()?.filter"
@@ -6878,6 +7200,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6878
7200
  </ng-template>
6879
7201
  </p-button>
6880
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
+ }
6881
7210
  @if (renderOverlay()) {
6882
7211
  <div
6883
7212
  [pMotion]="showMenu() && overlayVisible()"
@@ -6893,6 +7222,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6893
7222
  role="dialog"
6894
7223
  (click)="onContentClick()"
6895
7224
  (keydown.escape)="onEscape()"
7225
+ (keydown.tab)="onOverlayTabKeyDown($event)"
7226
+ (keydown.shift.tab)="onOverlayTabKeyDown($event)"
6896
7227
  >
6897
7228
  <ng-container *ngTemplateOutlet="headerTemplate() || _headerTemplate(); context: { $implicit: field() }"></ng-container>
6898
7229
  @if (display() === 'row') {
@@ -6946,6 +7277,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6946
7277
  <p-columnFilterFormElement
6947
7278
  [type]="type()"
6948
7279
  [field]="field()"
7280
+ [ariaLabel]="ariaLabel()"
6949
7281
  [filterConstraint]="fieldConstraint"
6950
7282
  [filterTemplate]="filterTemplate() || _filterTemplate()"
6951
7283
  [placeholder]="placeholder()"
@@ -6962,8 +7294,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6962
7294
  [pt]="pt()"
6963
7295
  [unstyled]="unstyled()"
6964
7296
  ></p-columnFilterFormElement>
6965
- <div>
6966
- @if (showRemoveIcon) {
7297
+ @if (showRemoveIcon) {
7298
+ <div>
6967
7299
  <p-button
6968
7300
  [styleClass]="cx('pcFilterRemoveRuleButton')"
6969
7301
  [pt]="ptm('pcFilterRemoveRuleButton')"
@@ -6983,8 +7315,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
6983
7315
  <ng-template *ngTemplateOutlet="removeRuleIconTemplate() || _removeRuleIconTemplate()"></ng-template>
6984
7316
  </ng-template>
6985
7317
  </p-button>
6986
- }
6987
- </div>
7318
+ </div>
7319
+ }
6988
7320
  </div>
6989
7321
  }
6990
7322
  </div>
@@ -7009,31 +7341,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
7009
7341
  </ng-template>
7010
7342
  </p-button>
7011
7343
  }
7012
- <div [class]="cx('filterButtonbar')" [pBind]="ptm('filterButtonBar')">
7013
- @if (showClearButton()) {
7014
- <p-button
7015
- #clearBtn
7016
- [outlined]="true"
7017
- (onClick)="clearFilter()"
7018
- [attr.aria-label]="clearButtonLabel"
7019
- [label]="clearButtonLabel"
7020
- [buttonProps]="filterButtonProps()?.popover?.clear"
7021
- [pt]="ptm('pcFilterClearButton')"
7022
- [unstyled]="unstyled()"
7023
- />
7024
- }
7025
- @if (showApplyButton()) {
7026
- <p-button
7027
- (onClick)="applyFilter()"
7028
- size="small"
7029
- [label]="applyButtonLabel"
7030
- [attr.aria-label]="applyButtonLabel"
7031
- [buttonProps]="filterButtonProps()?.popover?.apply"
7032
- [pt]="ptm('pcFilterApplyButton')"
7033
- [unstyled]="unstyled()"
7034
- />
7035
- }
7036
- </div>
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
+ }
7037
7371
  }
7038
7372
  <ng-container *ngTemplateOutlet="footerTemplate() || _footerTemplate(); context: { $implicit: field() }"></ng-container>
7039
7373
  </div>
@@ -7053,7 +7387,7 @@ class ColumnFilterFormElement extends BaseComponent {
7053
7387
  _componentStyle = inject(TableStyle);
7054
7388
  constructor() {
7055
7389
  super();
7056
- afterEveryRender(() => this.bindDirectiveInstance.setAttrs(this.ptm('columnFilterFormElement')));
7390
+ this.bindHostAttrs(this.bindDirectiveInstance, () => this.ptm('columnFilterFormElement'));
7057
7391
  }
7058
7392
  field = input(/* @ts-ignore */
7059
7393
  ...(ngDevMode ? [undefined, { debugName: "field" }] : /* istanbul ignore next */ []));
@@ -7092,7 +7426,9 @@ class ColumnFilterFormElement extends BaseComponent {
7092
7426
  };
7093
7427
  onModelChange(value) {
7094
7428
  this.filterConstraint().value = value;
7095
- 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')) {
7096
7432
  this.dataTable._filter();
7097
7433
  }
7098
7434
  }
@@ -7175,6 +7511,7 @@ class ColumnFilterFormElement extends BaseComponent {
7175
7511
  [pt]="ptm('pcFilterCheckbox')"
7176
7512
  [indeterminate]="filterConstraint()?.value === null"
7177
7513
  [binary]="true"
7514
+ [ariaLabel]="ariaLabel()"
7178
7515
  [ngModel]="filterConstraint()?.value"
7179
7516
  [ngModelOptions]="{ standalone: true }"
7180
7517
  (ngModelChange)="onModelChange($event)"
@@ -7195,7 +7532,7 @@ class ColumnFilterFormElement extends BaseComponent {
7195
7532
  }
7196
7533
  }
7197
7534
  }
7198
- `, isInline: true, dependencies: [{ kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i13.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "directive", type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i14.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo", "motionOptions"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "component", type: i15.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: i9.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["hostName", "value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None });
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 });
7199
7536
  }
7200
7537
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: ColumnFilterFormElement, decorators: [{
7201
7538
  type: Component,
@@ -7271,6 +7608,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
7271
7608
  [pt]="ptm('pcFilterCheckbox')"
7272
7609
  [indeterminate]="filterConstraint()?.value === null"
7273
7610
  [binary]="true"
7611
+ [ariaLabel]="ariaLabel()"
7274
7612
  [ngModel]="filterConstraint()?.value"
7275
7613
  [ngModelOptions]="{ standalone: true }"
7276
7614
  (ngModelChange)="onModelChange($event)"