primevue 4.3.2 → 4.3.3

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 (133) hide show
  1. package/autocomplete/AutoComplete.vue +56 -10
  2. package/autocomplete/index.mjs +67 -33
  3. package/autocomplete/index.mjs.map +1 -1
  4. package/cascadeselect/CascadeSelect.vue +1 -1
  5. package/cascadeselect/index.mjs +1 -2
  6. package/cascadeselect/index.mjs.map +1 -1
  7. package/checkbox/Checkbox.vue +1 -1
  8. package/checkbox/index.mjs +2 -1
  9. package/checkbox/index.mjs.map +1 -1
  10. package/chip/BaseChip.vue +1 -1
  11. package/chip/index.d.ts +1 -1
  12. package/chip/index.mjs +1 -1
  13. package/chip/index.mjs.map +1 -1
  14. package/colorpicker/ColorPicker.vue +1 -1
  15. package/colorpicker/index.mjs +1 -1
  16. package/colorpicker/index.mjs.map +1 -1
  17. package/datatable/BodyCell.vue +1 -0
  18. package/datatable/ColumnFilter.vue +1 -1
  19. package/datatable/DataTable.vue +103 -44
  20. package/datatable/HeaderCheckbox.vue +2 -2
  21. package/datatable/RowCheckbox.vue +1 -1
  22. package/datatable/TableBody.vue +12 -1
  23. package/datatable/TableFooter.vue +9 -1
  24. package/datatable/TableHeader.vue +9 -2
  25. package/datatable/index.d.ts +35 -27
  26. package/datatable/index.mjs +163 -99
  27. package/datatable/index.mjs.map +1 -1
  28. package/dataview/DataView.vue +4 -0
  29. package/dataview/index.d.ts +58 -1
  30. package/dataview/index.mjs +6 -2
  31. package/dataview/index.mjs.map +1 -1
  32. package/datepicker/DatePicker.vue +369 -233
  33. package/datepicker/index.d.ts +156 -0
  34. package/datepicker/index.mjs +643 -383
  35. package/datepicker/index.mjs.map +1 -1
  36. package/drawer/Drawer.vue +30 -20
  37. package/drawer/index.d.ts +10 -0
  38. package/drawer/index.mjs +42 -25
  39. package/drawer/index.mjs.map +1 -1
  40. package/fileupload/FileUpload.vue +1 -1
  41. package/fileupload/index.mjs +2 -2
  42. package/fileupload/index.mjs.map +1 -1
  43. package/galleria/Galleria.vue +39 -3
  44. package/galleria/index.mjs +40 -3
  45. package/galleria/index.mjs.map +1 -1
  46. package/inplace/Inplace.vue +1 -1
  47. package/inplace/index.mjs +3 -2
  48. package/inplace/index.mjs.map +1 -1
  49. package/inputnumber/BaseInputNumber.vue +4 -0
  50. package/inputnumber/InputNumber.vue +2 -9
  51. package/inputnumber/index.mjs +7 -8
  52. package/inputnumber/index.mjs.map +1 -1
  53. package/inputtext/index.d.ts +1 -2
  54. package/keyfilter/index.mjs +12 -19
  55. package/keyfilter/index.mjs.map +1 -1
  56. package/listbox/Listbox.vue +9 -2
  57. package/listbox/index.mjs +11 -3
  58. package/listbox/index.mjs.map +1 -1
  59. package/menu/Menu.vue +8 -2
  60. package/menu/Menuitem.vue +14 -4
  61. package/menu/index.mjs +36 -16
  62. package/menu/index.mjs.map +1 -1
  63. package/metergroup/MeterGroup.vue +9 -3
  64. package/metergroup/MeterGroupLabel.vue +10 -1
  65. package/metergroup/index.mjs +32 -7
  66. package/metergroup/index.mjs.map +1 -1
  67. package/multiselect/MultiSelect.vue +36 -5
  68. package/multiselect/index.mjs +49 -20
  69. package/multiselect/index.mjs.map +1 -1
  70. package/package.json +3 -3
  71. package/paginator/Paginator.vue +2 -0
  72. package/paginator/index.d.ts +8 -0
  73. package/paginator/index.mjs +3 -1
  74. package/paginator/index.mjs.map +1 -1
  75. package/panelmenu/PanelMenuList.vue +1 -1
  76. package/panelmenu/index.mjs +1 -1
  77. package/panelmenu/index.mjs.map +1 -1
  78. package/password/Password.vue +21 -3
  79. package/password/index.d.ts +1 -1
  80. package/password/index.mjs +32 -10
  81. package/password/index.mjs.map +1 -1
  82. package/popover/Popover.vue +1 -1
  83. package/popover/index.mjs +1 -2
  84. package/popover/index.mjs.map +1 -1
  85. package/progressbar/ProgressBar.vue +4 -4
  86. package/progressbar/index.mjs +8 -12
  87. package/progressbar/index.mjs.map +1 -1
  88. package/scrolltop/ScrollTop.vue +2 -2
  89. package/scrolltop/index.mjs +4 -2
  90. package/scrolltop/index.mjs.map +1 -1
  91. package/select/Select.vue +48 -12
  92. package/select/index.mjs +104 -71
  93. package/select/index.mjs.map +1 -1
  94. package/splitter/Splitter.vue +10 -2
  95. package/splitter/index.mjs +19 -6
  96. package/splitter/index.mjs.map +1 -1
  97. package/step/Step.vue +25 -7
  98. package/step/index.mjs +44 -14
  99. package/step/index.mjs.map +1 -1
  100. package/steppanel/StepPanel.vue +9 -3
  101. package/steppanel/index.d.ts +8 -0
  102. package/steppanel/index.mjs +23 -8
  103. package/steppanel/index.mjs.map +1 -1
  104. package/stepper/StepperSeparator.vue +5 -2
  105. package/tab/Tab.vue +4 -4
  106. package/tab/index.mjs +4 -4
  107. package/tab/index.mjs.map +1 -1
  108. package/tablist/TabList.vue +3 -0
  109. package/tablist/index.mjs +1 -0
  110. package/tablist/index.mjs.map +1 -1
  111. package/tabpanel/TabPanel.vue +2 -2
  112. package/tabpanel/index.mjs +2 -2
  113. package/tabpanel/index.mjs.map +1 -1
  114. package/textarea/index.d.ts +1 -2
  115. package/tieredmenu/TieredMenu.vue +1 -1
  116. package/tieredmenu/index.mjs +1 -2
  117. package/tieredmenu/index.mjs.map +1 -1
  118. package/tooltip/index.mjs +22 -16
  119. package/tooltip/index.mjs.map +1 -1
  120. package/tree/Tree.vue +14 -2
  121. package/tree/TreeNode.vue +2 -2
  122. package/tree/index.mjs +28 -10
  123. package/tree/index.mjs.map +1 -1
  124. package/treeselect/TreeSelect.vue +1 -1
  125. package/treeselect/index.mjs +1 -2
  126. package/treeselect/index.mjs.map +1 -1
  127. package/umd/primevue.min.js +1 -1
  128. package/virtualscroller/VirtualScroller.vue +13 -2
  129. package/virtualscroller/index.mjs +14 -4
  130. package/virtualscroller/index.mjs.map +1 -1
  131. package/virtualscroller/style/index.mjs +1 -1
  132. package/virtualscroller/style/index.mjs.map +1 -1
  133. package/web-types.json +1 -1
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="cx('root')" data-scrollselectors=".p-datatable-wrapper" v-bind="ptmi('root')">
2
+ <div :class="cx('root')" data-scrollselectors=".p-datatable-wrapper" :data-p="dataP" v-bind="ptmi('root')">
3
3
  <slot></slot>
4
4
  <div v-if="loading" :class="cx('mask')" v-bind="ptm('mask')">
5
5
  <slot v-if="$slots.loading" name="loading"></slot>
@@ -25,9 +25,10 @@
25
25
  @page="onPage($event)"
26
26
  :alwaysShow="alwaysShowPaginator"
27
27
  :unstyled="unstyled"
28
+ :data-p-top="true"
28
29
  :pt="ptm('pcPaginator')"
29
30
  >
30
- <template v-if="$slots.paginatorcontainer" #container>
31
+ <template v-if="$slots.paginatorcontainer" #container="slotProps">
31
32
  <slot
32
33
  name="paginatorcontainer"
33
34
  :first="slotProps.first"
@@ -35,12 +36,14 @@
35
36
  :rows="slotProps.rows"
36
37
  :page="slotProps.page"
37
38
  :pageCount="slotProps.pageCount"
39
+ :pageLinks="slotProps.pageLinks"
38
40
  :totalRecords="slotProps.totalRecords"
39
41
  :firstPageCallback="slotProps.firstPageCallback"
40
42
  :lastPageCallback="slotProps.lastPageCallback"
41
43
  :prevPageCallback="slotProps.prevPageCallback"
42
44
  :nextPageCallback="slotProps.nextPageCallback"
43
45
  :rowChangeCallback="slotProps.rowChangeCallback"
46
+ :changePageCallback="slotProps.changePageCallback"
44
47
  ></slot>
45
48
  </template>
46
49
  <template v-if="$slots.paginatorstart" #start>
@@ -68,7 +71,7 @@
68
71
  <slot name="paginatorrowsperpagedropdownicon" :class="slotProps.class"></slot>
69
72
  </template>
70
73
  </DTPaginator>
71
- <div :class="cx('tableContainer')" :style="[sx('tableContainer'), { maxHeight: virtualScrollerDisabled ? scrollHeight : '' }]" v-bind="ptm('tableContainer')">
74
+ <div :class="cx('tableContainer')" :style="[sx('tableContainer'), { maxHeight: virtualScrollerDisabled ? scrollHeight : '' }]" :data-p="dataP" v-bind="ptm('tableContainer')">
72
75
  <DTVirtualScroller
73
76
  ref="virtualScroller"
74
77
  v-bind="virtualScrollerOptions"
@@ -130,6 +133,7 @@
130
133
  :selection="selection"
131
134
  :selectionKeys="d_selectionKeys"
132
135
  :selectionMode="selectionMode"
136
+ :rowHover="rowHover"
133
137
  :contextMenu="contextMenu"
134
138
  :contextMenuSelection="contextMenuSelection"
135
139
  :rowGroupMode="rowGroupMode"
@@ -186,6 +190,7 @@
186
190
  :selection="selection"
187
191
  :selectionKeys="d_selectionKeys"
188
192
  :selectionMode="selectionMode"
193
+ :rowHover="rowHover"
189
194
  :contextMenu="contextMenu"
190
195
  :contextMenuSelection="contextMenuSelection"
191
196
  :rowGroupMode="rowGroupMode"
@@ -256,6 +261,7 @@
256
261
  @page="onPage($event)"
257
262
  :alwaysShow="alwaysShowPaginator"
258
263
  :unstyled="unstyled"
264
+ :data-p-bottom="true"
259
265
  :pt="ptm('pcPaginator')"
260
266
  >
261
267
  <template v-if="$slots.paginatorcontainer" #container="slotProps">
@@ -266,12 +272,14 @@
266
272
  :rows="slotProps.rows"
267
273
  :page="slotProps.page"
268
274
  :pageCount="slotProps.pageCount"
275
+ :pageLinks="slotProps.pageLinks"
269
276
  :totalRecords="slotProps.totalRecords"
270
277
  :firstPageCallback="slotProps.firstPageCallback"
271
278
  :lastPageCallback="slotProps.lastPageCallback"
272
279
  :prevPageCallback="slotProps.prevPageCallback"
273
280
  :nextPageCallback="slotProps.nextPageCallback"
274
281
  :rowChangeCallback="slotProps.rowChangeCallback"
282
+ :changePageCallback="slotProps.changePageCallback"
275
283
  ></slot>
276
284
  </template>
277
285
  <template v-if="$slots.paginatorstart" #start>
@@ -313,6 +321,7 @@
313
321
  </template>
314
322
 
315
323
  <script>
324
+ import { cn } from '@primeuix/utils';
316
325
  import {
317
326
  addClass,
318
327
  addStyle,
@@ -1371,20 +1380,24 @@ export default {
1371
1380
  },
1372
1381
  bindColumnResizeEvents() {
1373
1382
  if (!this.documentColumnResizeListener) {
1374
- this.documentColumnResizeListener = document.addEventListener('mousemove', () => {
1383
+ this.documentColumnResizeListener = (event) => {
1375
1384
  if (this.columnResizing) {
1376
1385
  this.onColumnResize(event);
1377
1386
  }
1378
- });
1387
+ };
1388
+
1389
+ document.addEventListener('mousemove', this.documentColumnResizeListener);
1379
1390
  }
1380
1391
 
1381
1392
  if (!this.documentColumnResizeEndListener) {
1382
- this.documentColumnResizeEndListener = document.addEventListener('mouseup', () => {
1393
+ this.documentColumnResizeEndListener = () => {
1383
1394
  if (this.columnResizing) {
1384
1395
  this.columnResizing = false;
1385
1396
  this.onColumnResizeEnd();
1386
1397
  }
1387
- });
1398
+ };
1399
+
1400
+ document.addEventListener('mouseup', this.documentColumnResizeEndListener);
1388
1401
  }
1389
1402
  },
1390
1403
  unbindColumnResizeEvents() {
@@ -1706,7 +1719,8 @@ export default {
1706
1719
  }
1707
1720
 
1708
1721
  if (this.d_sortField) {
1709
- state.sortField = this.d_sortField;
1722
+ // Functions can't be serialized, so don't attempt to save them
1723
+ if (typeof this.d_sortField !== 'function') state.sortField = this.d_sortField;
1710
1724
  state.sortOrder = this.d_sortOrder;
1711
1725
  }
1712
1726
 
@@ -1758,51 +1772,90 @@ export default {
1758
1772
  return value;
1759
1773
  };
1760
1774
 
1761
- if (stateString) {
1762
- let restoredState = JSON.parse(stateString, reviver);
1775
+ let parsedState;
1776
+ try {
1777
+ parsedState = JSON.parse(stateString, reviver);
1778
+ } catch (error) {}
1779
+ if (!parsedState || typeof parsedState !== 'object') {
1780
+ storage.removeItem(this.stateKey);
1781
+ return;
1782
+ }
1763
1783
 
1764
- if (this.paginator) {
1765
- this.d_first = restoredState.first;
1766
- this.d_rows = restoredState.rows;
1767
- }
1784
+ const restoredState = {};
1768
1785
 
1769
- if (restoredState.sortField) {
1770
- this.d_sortField = restoredState.sortField;
1771
- this.d_sortOrder = restoredState.sortOrder;
1786
+ if (this.paginator) {
1787
+ if (typeof parsedState.first === 'number') {
1788
+ this.d_first = parsedState.first;
1789
+ this.$emit('update:first', this.d_first);
1790
+ restoredState.first = this.d_first;
1772
1791
  }
1773
-
1774
- if (restoredState.multiSortMeta) {
1775
- this.d_multiSortMeta = restoredState.multiSortMeta;
1792
+ if (typeof parsedState.rows === 'number') {
1793
+ this.d_rows = parsedState.rows;
1794
+ this.$emit('update:rows', this.d_rows);
1795
+ restoredState.rows = this.d_rows;
1776
1796
  }
1797
+ }
1777
1798
 
1778
- if (restoredState.filters) {
1779
- this.$emit('update:filters', restoredState.filters);
1780
- }
1799
+ if (typeof parsedState.sortField === 'string') {
1800
+ this.d_sortField = parsedState.sortField;
1801
+ this.$emit('update:sortField', this.d_sortField);
1802
+ restoredState.sortField = this.d_sortField;
1803
+ }
1781
1804
 
1782
- if (this.resizableColumns) {
1783
- this.columnWidthsState = restoredState.columnWidths;
1784
- this.tableWidthState = restoredState.tableWidth;
1785
- }
1805
+ if (typeof parsedState.sortOrder === 'number') {
1806
+ this.d_sortOrder = parsedState.sortOrder;
1807
+ this.$emit('update:sortOrder', this.d_sortOrder);
1808
+ restoredState.sortOrder = this.d_sortOrder;
1809
+ }
1786
1810
 
1787
- if (this.reorderableColumns) {
1788
- this.d_columnOrder = restoredState.columnOrder;
1789
- }
1811
+ if (Array.isArray(parsedState.multiSortMeta)) {
1812
+ this.d_multiSortMeta = parsedState.multiSortMeta;
1813
+ this.$emit('update:multiSortMeta', this.d_multiSortMeta);
1814
+ restoredState.multiSortMeta = this.d_multiSortMeta;
1815
+ }
1790
1816
 
1791
- if (restoredState.expandedRows) {
1792
- this.$emit('update:expandedRows', restoredState.expandedRows);
1793
- }
1817
+ if (this.hasFilters && typeof parsedState.filters === 'object' && parsedState.filters !== null) {
1818
+ this.d_filters = this.cloneFilters(parsedState.filters);
1819
+ this.$emit('update:filters', this.d_filters);
1820
+ restoredState.filters = this.d_filters;
1821
+ }
1794
1822
 
1795
- if (restoredState.expandedRowGroups) {
1796
- this.$emit('update:expandedRowGroups', restoredState.expandedRowGroups);
1823
+ if (this.resizableColumns) {
1824
+ if (typeof parsedState.columnWidths === 'string') {
1825
+ this.columnWidthsState = parsedState.columnWidths;
1826
+ restoredState.columnWidths = this.columnWidthsState;
1797
1827
  }
1798
-
1799
- if (restoredState.selection) {
1800
- this.d_selectionKeys = restoredState.d_selectionKeys;
1801
- this.$emit('update:selection', restoredState.selection);
1828
+ if (typeof parsedState.tableWidth === 'string') {
1829
+ this.tableWidthState = parsedState.tableWidth;
1830
+ restoredState.tableWidth = this.tableWidthState;
1802
1831
  }
1832
+ }
1833
+
1834
+ if (this.reorderableColumns && Array.isArray(parsedState.columnOrder)) {
1835
+ this.d_columnOrder = parsedState.columnOrder;
1836
+ restoredState.columnOrder = this.d_columnOrder;
1837
+ }
1803
1838
 
1804
- this.$emit('state-restore', restoredState);
1839
+ if (typeof parsedState.expandedRows === 'object' && parsedState.expandedRows !== null) {
1840
+ this.$emit('update:expandedRows', parsedState.expandedRows);
1841
+ restoredState.expandedRows = parsedState.expandedRows;
1805
1842
  }
1843
+
1844
+ if (Array.isArray(parsedState.expandedRowGroups)) {
1845
+ this.$emit('update:expandedRowGroups', parsedState.expandedRowGroups);
1846
+ restoredState.expandedRowGroups = parsedState.expandedRowGroups;
1847
+ }
1848
+
1849
+ if (typeof parsedState.selection === 'object' && parsedState.selection !== null) {
1850
+ if (typeof parsedState.selectionKeys === 'object' && parsedState.selectionKeys !== null) {
1851
+ this.d_selectionKeys = parsedState.selectionKeys;
1852
+ restoredState.selectionKeys = this.d_selectionKeys;
1853
+ }
1854
+ this.$emit('update:selection', parsedState.selection);
1855
+ restoredState.selection = parsedState.selection;
1856
+ }
1857
+
1858
+ this.$emit('state-restore', restoredState);
1806
1859
  },
1807
1860
  saveColumnWidths(state) {
1808
1861
  let widths = [];
@@ -1926,11 +1979,11 @@ export default {
1926
1979
  this.$emit('filter', this.createLazyLoadEvent());
1927
1980
  }
1928
1981
  },
1929
- cloneFilters() {
1982
+ cloneFilters(filters) {
1930
1983
  let cloned = {};
1931
1984
 
1932
- if (this.filters) {
1933
- Object.entries(this.filters).forEach(([prop, value]) => {
1985
+ if (filters) {
1986
+ Object.entries(filters).forEach(([prop, value]) => {
1934
1987
  cloned[prop] = value.operator
1935
1988
  ? {
1936
1989
  operator: value.operator,
@@ -1984,7 +2037,7 @@ export default {
1984
2037
  columns() {
1985
2038
  const cols = this.d_columns.get(this);
1986
2039
 
1987
- if (this.reorderableColumns && this.d_columnOrder) {
2040
+ if (cols && this.reorderableColumns && this.d_columnOrder) {
1988
2041
  let orderedColumns = [];
1989
2042
 
1990
2043
  for (let columnKey of this.d_columnOrder) {
@@ -2094,6 +2147,12 @@ export default {
2094
2147
  },
2095
2148
  virtualScrollerDisabled() {
2096
2149
  return isEmpty(this.virtualScrollerOptions) || !this.scrollable;
2150
+ },
2151
+ dataP() {
2152
+ return cn({
2153
+ scrollable: this.scrollable,
2154
+ 'flex-scrollable': this.scrollable && this.scrollHeight === 'flex'
2155
+ });
2097
2156
  }
2098
2157
  },
2099
2158
  components: {
@@ -1,9 +1,9 @@
1
1
  <template>
2
2
  <Checkbox :modelValue="checked" :binary="true" :disabled="disabled" :aria-label="headerCheckboxAriaLabel" @change="onChange" :unstyled="unstyled" :pt="getColumnPT('pcHeaderCheckbox')">
3
- <template #icon="slotProps">
3
+ <!--<template #icon="slotProps">
4
4
  <component v-if="headerCheckboxIconTemplate" :is="headerCheckboxIconTemplate" :checked="slotProps.checked" :class="slotProps.class" />
5
5
  <CheckIcon v-else-if="!headerCheckboxIconTemplate && slotProps.checked" :class="slotProps.class" v-bind="getColumnPT('pcHeaderCheckbox')['icon']" />
6
- </template>
6
+ </template>-->
7
7
  </Checkbox>
8
8
  </template>
9
9
 
@@ -2,7 +2,7 @@
2
2
  <Checkbox :modelValue="checked" :binary="true" :disabled="$attrs.disabled" :aria-label="checkboxAriaLabel" @change="onChange" :unstyled="unstyled" :pt="getColumnPT('pcRowCheckbox')">
3
3
  <template #icon="slotProps">
4
4
  <component v-if="rowCheckboxIconTemplate" :is="rowCheckboxIconTemplate" :checked="slotProps.checked" :class="slotProps.class" />
5
- <CheckIcon v-else-if="!rowCheckboxIconTemplate && slotProps.checked" :class="slotProps.class" v-bind="getColumnPT('pcRowCheckbox')['icon']" />
5
+ <CheckIcon v-else-if="!rowCheckboxIconTemplate && slotProps.checked" :class="slotProps.class" v-bind="getColumnPT('pcRowCheckbox.icon')" />
6
6
  </template>
7
7
  </Checkbox>
8
8
  </template>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <tbody :ref="bodyRef" :class="cx('tbody')" role="rowgroup" :style="bodyContentStyle" v-bind="ptm('tbody', ptmTBodyOptions)">
2
+ <tbody :ref="bodyRef" :class="cx('tbody')" role="rowgroup" :style="bodyContentStyle" :data-p="dataP" v-bind="ptm('tbody', ptmTBodyOptions)">
3
3
  <template v-if="!empty">
4
4
  <template v-for="(rowData, rowIndex) of value" :key="getRowKey(rowData, rowIndex)">
5
5
  <DTBodyRow
@@ -70,6 +70,7 @@
70
70
  </template>
71
71
 
72
72
  <script>
73
+ import { cn } from '@primeuix/utils';
73
74
  import { getOuterHeight } from '@primeuix/utils/dom';
74
75
  import { resolveFieldData } from '@primeuix/utils/object';
75
76
  import BaseComponent from '@primevue/core/basecomponent';
@@ -168,6 +169,10 @@ export default {
168
169
  type: String,
169
170
  default: null
170
171
  },
172
+ rowHover: {
173
+ type: Boolean,
174
+ default: false
175
+ },
171
176
  contextMenu: {
172
177
  type: Boolean,
173
178
  default: false
@@ -289,6 +294,12 @@ export default {
289
294
  scrollable: this.$parentInstance?.$parentInstance?.scrollable
290
295
  }
291
296
  };
297
+ },
298
+ dataP() {
299
+ return cn({
300
+ hoverable: this.rowHover || this.selectionMode,
301
+ frozen: this.frozenRow
302
+ });
292
303
  }
293
304
  },
294
305
  components: {
@@ -1,5 +1,13 @@
1
1
  <template>
2
- <tfoot v-if="hasFooter" :class="cx('tfoot')" :style="sx('tfoot')" role="rowgroup" v-bind="columnGroup ? { ...ptm('tfoot', ptmTFootOptions), ...getColumnGroupPT('root') } : ptm('tfoot', ptmTFootOptions)" data-pc-section="tfoot">
2
+ <tfoot
3
+ v-if="hasFooter"
4
+ :class="cx('tfoot')"
5
+ :style="sx('tfoot')"
6
+ role="rowgroup"
7
+ v-bind="columnGroup ? { ...ptm('tfoot', ptmTFootOptions), ...getColumnGroupPT('root') } : ptm('tfoot', ptmTFootOptions)"
8
+ :data-p-scrollable="$parentInstance?.$parentInstance?.scrollable"
9
+ data-pc-section="tfoot"
10
+ >
3
11
  <tr v-if="!columnGroup" role="row" v-bind="ptm('footerRow')">
4
12
  <template v-for="(col, i) of columns" :key="columnProp(col, 'columnKey') || columnProp(col, 'field') || i">
5
13
  <DTFooterCell v-if="!columnProp(col, 'hidden')" :column="col" :pt="pt" />
@@ -1,5 +1,12 @@
1
1
  <template>
2
- <thead :class="cx('thead')" :style="sx('thead')" role="rowgroup" v-bind="columnGroup ? { ...ptm('thead', ptmTHeadOptions), ...getColumnGroupPT('root') } : ptm('thead', ptmTHeadOptions)" data-pc-section="thead">
2
+ <thead
3
+ :class="cx('thead')"
4
+ :style="sx('thead')"
5
+ role="rowgroup"
6
+ v-bind="columnGroup ? { ...ptm('thead', ptmTHeadOptions), ...getColumnGroupPT('root') } : ptm('thead', ptmTHeadOptions)"
7
+ :data-p-scrollable="$parentInstance?.$parentInstance?.scrollable"
8
+ data-pc-section="thead"
9
+ >
3
10
  <template v-if="!columnGroup">
4
11
  <tr role="row" v-bind="ptm('headerRow')">
5
12
  <template v-for="(col, i) of columns" :key="columnProp(col, 'columnKey') || columnProp(col, 'field') || i">
@@ -97,7 +104,7 @@
97
104
  @constraint-add="$emit('constraint-add', $event)"
98
105
  @constraint-remove="$emit('constraint-remove', $event)"
99
106
  @apply-click="$emit('apply-click', $event)"
100
- @change="$emit('checkbox-change', $event)"
107
+ @checkbox-change="$emit('checkbox-change', $event)"
101
108
  :unstyled="unstyled"
102
109
  :pt="pt"
103
110
  />
@@ -7,7 +7,7 @@
7
7
  * @module datatable
8
8
  *
9
9
  */
10
- import type { DefineComponent, DesignToken, EmitFn, HintedString, Nullable, PassThrough } from '@primevue/core';
10
+ import type { DefineComponent, DesignToken, EmitFn, HintedString, NoInfer, Nullable, PassThrough } from '@primevue/core';
11
11
  import type { ComponentHooks } from '@primevue/core/basecomponent';
12
12
  import type { ButtonProps } from 'primevue/button';
13
13
  import type { ColumnPassThroughOptionType } from 'primevue/column';
@@ -593,19 +593,19 @@ export interface DataTableRowEditCancelEvent<T = any> extends DataTableRowEditIn
593
593
  * Custom state event.
594
594
  * @see {@link DataTableEmitsOptions['state-save']}
595
595
  */
596
- export interface DataTableStateEvent {
596
+ export interface DataTableStateEvent<T = any> {
597
597
  /**
598
598
  * Index of first record
599
599
  */
600
- first: number;
600
+ first?: number | undefined;
601
601
  /**
602
602
  * Number of rows to display in new page
603
603
  */
604
- rows: number;
604
+ rows?: number | undefined;
605
605
  /**
606
606
  * Field to sort against
607
607
  */
608
- sortField: string;
608
+ sortField: keyof T;
609
609
  /**
610
610
  * Sort order as integer
611
611
  */
@@ -613,19 +613,19 @@ export interface DataTableStateEvent {
613
613
  /**
614
614
  * MultiSort metadata
615
615
  */
616
- multiSortMeta: DataTableSortMeta[] | undefined;
616
+ multiSortMeta?: DataTableSortMeta[] | undefined | null;
617
617
  /**
618
618
  * Collection of active filters
619
619
  */
620
- filters: DataTableFilterMeta;
620
+ filters?: DataTableFilterMeta;
621
621
  /**
622
622
  * Comma separated list of column widths
623
623
  */
624
- columnWidths: string[];
624
+ columnWidths?: string[] | null;
625
625
  /**
626
626
  * Order of the columns
627
627
  */
628
- columnOrder: string[];
628
+ columnOrder?: string[] | null;
629
629
  /**
630
630
  * Instances of rows in expanded state
631
631
  */
@@ -637,15 +637,15 @@ export interface DataTableStateEvent {
637
637
  /**
638
638
  * Instances of rows in expanded state
639
639
  */
640
- expandedRowGroups: any[] | DataTableExpandedRows;
640
+ expandedRowGroups?: any[] | DataTableExpandedRows;
641
641
  /**
642
642
  * Selected rows
643
643
  */
644
- selection: any[] | any;
644
+ selection?: T[] | T | undefined | null;
645
645
  /**
646
646
  * Keys of selected rows
647
647
  */
648
- selectionKeys: any[];
648
+ selectionKeys: any[] | null;
649
649
  }
650
650
 
651
651
  /**
@@ -884,11 +884,11 @@ export interface DataTableProps<T = any> {
884
884
  /**
885
885
  * An array of objects to display.
886
886
  */
887
- value?: any[] | undefined | null;
887
+ value?: T[] | undefined | null;
888
888
  /**
889
889
  * Name of the field that uniquely identifies the a record in the data.
890
890
  */
891
- dataKey?: string | ((item: any) => string) | undefined;
891
+ dataKey?: keyof T | ((item: NoInfer<T>) => string) | undefined;
892
892
  /**
893
893
  * Number of rows to display per page.
894
894
  * @defaultValue 0
@@ -972,7 +972,7 @@ export interface DataTableProps<T = any> {
972
972
  /**
973
973
  * Property name or a getter function of a row data used for sorting by default
974
974
  */
975
- sortField?: string | ((item: any) => string) | undefined;
975
+ sortField?: keyof T | ((item: NoInfer<T>) => string) | undefined;
976
976
  /**
977
977
  * Order to sort the data by default.
978
978
  */
@@ -1013,7 +1013,7 @@ export interface DataTableProps<T = any> {
1013
1013
  /**
1014
1014
  * An array of fields as string or function to use in global filtering.
1015
1015
  */
1016
- globalFilterFields?: (string | ((data: T) => string))[] | undefined;
1016
+ globalFilterFields?: (keyof T | ((data: NoInfer<T>) => string))[] | undefined;
1017
1017
  /**
1018
1018
  * Locale to use in filtering. The default locale is the host environment's current locale.
1019
1019
  */
@@ -1021,7 +1021,7 @@ export interface DataTableProps<T = any> {
1021
1021
  /**
1022
1022
  * Selected row in single mode or an array of values in multiple mode.
1023
1023
  */
1024
- selection?: T[] | T | undefined;
1024
+ selection?: NoInfer<T>[] | NoInfer<T> | undefined;
1025
1025
  /**
1026
1026
  * Specifies the selection mode.
1027
1027
  */
@@ -1045,7 +1045,7 @@ export interface DataTableProps<T = any> {
1045
1045
  /**
1046
1046
  * Selected row instance with the ContextMenu.
1047
1047
  */
1048
- contextMenuSelection?: any | any[] | undefined;
1048
+ contextMenuSelection?: NoInfer<T> | NoInfer<T>[] | undefined;
1049
1049
  /**
1050
1050
  * Whether all data is selected.
1051
1051
  */
@@ -1087,7 +1087,7 @@ export interface DataTableProps<T = any> {
1087
1087
  /**
1088
1088
  * A collection of row data display as expanded.
1089
1089
  */
1090
- expandedRows?: any[] | DataTableExpandedRows | null;
1090
+ expandedRows?: NoInfer<T>[] | DataTableExpandedRows | null;
1091
1091
  /**
1092
1092
  * Icon of the row toggler to display the row as expanded.
1093
1093
  */
@@ -1103,7 +1103,7 @@ export interface DataTableProps<T = any> {
1103
1103
  /**
1104
1104
  * One or more field names to use in row grouping.
1105
1105
  */
1106
- groupRowsBy?: ((field: string) => object) | string[] | string | undefined;
1106
+ groupRowsBy?: ((field: NoInfer<T>) => object) | keyof T[] | keyof T | undefined;
1107
1107
  /**
1108
1108
  * Whether the row groups can be expandable.
1109
1109
  * @defaultValue false
@@ -1112,7 +1112,7 @@ export interface DataTableProps<T = any> {
1112
1112
  /**
1113
1113
  * An array of group field values whose groups would be rendered as expanded.
1114
1114
  */
1115
- expandedRowGroups?: any[] | DataTableExpandedRows;
1115
+ expandedRowGroups?: NoInfer<T>[] | DataTableExpandedRows;
1116
1116
  /**
1117
1117
  * Defines where a stateful table keeps its state.
1118
1118
  * @defaultValue session
@@ -1129,18 +1129,18 @@ export interface DataTableProps<T = any> {
1129
1129
  /**
1130
1130
  * A collection of rows to represent the current editing data in row edit mode.
1131
1131
  */
1132
- editingRows?: T[] | DataTableEditingRows;
1132
+ editingRows?: NoInfer<T>[] | DataTableEditingRows;
1133
1133
  /**
1134
1134
  * A function that takes the row data as a parameter and returns a string to apply a particular class for the row.
1135
1135
  * The return value is added to the row's :classes array (see Vue.js class bindings).
1136
1136
  */
1137
- rowClass?: (data: T) => string | object | undefined;
1137
+ rowClass?: (data: NoInfer<T>) => string | object | undefined;
1138
1138
  /**
1139
1139
  * A function that takes the row data as a parameter and returns the inline style object for the corresponding row.
1140
1140
  * The function may also return an array of style objects which will be merged.
1141
1141
  * The return value of this function is directly applied as a Vue.js style-binding on the table row.
1142
1142
  */
1143
- rowStyle?: (data: T) => object | object[] | undefined;
1143
+ rowStyle?: (data: NoInfer<T>) => object | object[] | undefined;
1144
1144
  /**
1145
1145
  * When specified, enables horizontal and/or vertical scrolling.
1146
1146
  * @defaultValue false
@@ -1158,7 +1158,7 @@ export interface DataTableProps<T = any> {
1158
1158
  /**
1159
1159
  * Items of the frozen part in scrollable DataTable.
1160
1160
  */
1161
- frozenValue?: any[] | undefined | null;
1161
+ frozenValue?: NoInfer<T>[] | undefined | null;
1162
1162
  /**
1163
1163
  * The breakpoint to define the maximum width boundary when using stack responsive layout.
1164
1164
  * @defaultValue 960px
@@ -1370,6 +1370,10 @@ export interface DataTableSlots<T = any> {
1370
1370
  * Total number of pages
1371
1371
  */
1372
1372
  pageCount?: number;
1373
+ /**
1374
+ * Direct page links
1375
+ */
1376
+ pageLinks?: number;
1373
1377
  /**
1374
1378
  * Total records
1375
1379
  */
@@ -1398,6 +1402,10 @@ export interface DataTableSlots<T = any> {
1398
1402
  * Row change function.
1399
1403
  */
1400
1404
  rowChangeCallback: (value: number) => void;
1405
+ /**
1406
+ * Page change function.
1407
+ */
1408
+ changePageCallback: (value: number) => void;
1401
1409
  }): VNode[];
1402
1410
  /**
1403
1411
  * Custom paginator start template.
@@ -1656,12 +1664,12 @@ export interface DataTableEmitsOptions<T = any> {
1656
1664
  * Invoked when a stateful table saves the state.
1657
1665
  * @param {DataTableStateEvent} event - Custom state event.
1658
1666
  */
1659
- 'state-restore'(event: DataTableStateEvent): void;
1667
+ 'state-restore'(event: DataTableStateEvent<T>): void;
1660
1668
  /**
1661
1669
  * Invoked when a stateful table restores the state.
1662
1670
  * @param {DataTableStateEvent} event - Custom state event.
1663
1671
  */
1664
- 'state-save'(event: DataTableStateEvent): void;
1672
+ 'state-save'(event: DataTableStateEvent<T>): void;
1665
1673
  }
1666
1674
 
1667
1675
  export declare type DataTableEmits = EmitFn<DataTableEmitsOptions>;