@kayord/ui 2.1.1 → 2.1.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.
@@ -10,6 +10,9 @@ export function createGrid(options) {
10
10
  // Support both direct data array and getter function for reactivity
11
11
  // Using a getter function () => data allows Svelte 5 to track changes
12
12
  const getData = typeof dataProp === "function" ? dataProp : () => dataProp;
13
+ const getRowCount = typeof dataGridProps.rowCount === "function"
14
+ ? dataGridProps.rowCount
15
+ : () => dataGridProps.rowCount;
13
16
  // ========================================
14
17
  // Reactive State using Svelte 5 runes
15
18
  // ========================================
@@ -125,6 +128,7 @@ export function createGrid(options) {
125
128
  manualPagination: (dataGridProps?.isPaginationEnabled ?? true) == false ? true : dataGridProps?.manualPagination,
126
129
  manualSorting: dataGridProps.manualSorting,
127
130
  columnResizeMode: "onChange",
131
+ rowCount: getRowCount(),
128
132
  enableColumnResizing: true,
129
133
  defaultColumn: {
130
134
  minSize: 0,
@@ -167,10 +171,12 @@ export function createGrid(options) {
167
171
  globalFilter,
168
172
  };
169
173
  const currentData = getData();
174
+ const currentRowCount = getRowCount();
170
175
  // Update table with current state
171
176
  table.setOptions((prev) => ({
172
177
  ...prev,
173
178
  data: currentData,
179
+ rowCount: currentRowCount,
174
180
  state: {
175
181
  ...prev.state,
176
182
  ...currentState,
@@ -211,6 +217,10 @@ export function createGrid(options) {
211
217
  subscribeToTable();
212
218
  return table.getState();
213
219
  },
220
+ getPageCount: () => {
221
+ subscribeToTable();
222
+ return table.getPageCount();
223
+ },
214
224
  getColumn: (columnId) => {
215
225
  subscribeToTable();
216
226
  return table.getColumn(columnId);
@@ -239,6 +249,10 @@ export function createGrid(options) {
239
249
  subscribeToTable();
240
250
  return table.getLeftLeafColumns();
241
251
  },
252
+ getRowCount: () => {
253
+ subscribeToTable();
254
+ return table.getRowCount();
255
+ },
242
256
  getRightLeafColumns: () => {
243
257
  subscribeToTable();
244
258
  return table.getRightLeafColumns();
@@ -16,6 +16,7 @@ export interface DataGridOptions<TData extends RowData> {
16
16
  dataGridProps?: DataGridProps;
17
17
  }
18
18
  export interface DataGridProps {
19
+ rowCount?: () => number;
19
20
  isPaginationEnabled?: boolean;
20
21
  manualPagination?: boolean;
21
22
  enableRowSelectionUI?: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kayord/ui",
3
3
  "private": false,
4
- "version": "2.1.1",
4
+ "version": "2.1.3",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",