@kayord/ui 2.1.2 → 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,7 +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",
|
|
128
|
-
rowCount:
|
|
131
|
+
rowCount: getRowCount(),
|
|
129
132
|
enableColumnResizing: true,
|
|
130
133
|
defaultColumn: {
|
|
131
134
|
minSize: 0,
|
|
@@ -168,10 +171,12 @@ export function createGrid(options) {
|
|
|
168
171
|
globalFilter,
|
|
169
172
|
};
|
|
170
173
|
const currentData = getData();
|
|
174
|
+
const currentRowCount = getRowCount();
|
|
171
175
|
// Update table with current state
|
|
172
176
|
table.setOptions((prev) => ({
|
|
173
177
|
...prev,
|
|
174
178
|
data: currentData,
|
|
179
|
+
rowCount: currentRowCount,
|
|
175
180
|
state: {
|
|
176
181
|
...prev.state,
|
|
177
182
|
...currentState,
|
|
@@ -244,6 +249,10 @@ export function createGrid(options) {
|
|
|
244
249
|
subscribeToTable();
|
|
245
250
|
return table.getLeftLeafColumns();
|
|
246
251
|
},
|
|
252
|
+
getRowCount: () => {
|
|
253
|
+
subscribeToTable();
|
|
254
|
+
return table.getRowCount();
|
|
255
|
+
},
|
|
247
256
|
getRightLeafColumns: () => {
|
|
248
257
|
subscribeToTable();
|
|
249
258
|
return table.getRightLeafColumns();
|
|
@@ -16,7 +16,7 @@ export interface DataGridOptions<TData extends RowData> {
|
|
|
16
16
|
dataGridProps?: DataGridProps;
|
|
17
17
|
}
|
|
18
18
|
export interface DataGridProps {
|
|
19
|
-
rowCount?: number;
|
|
19
|
+
rowCount?: () => number;
|
|
20
20
|
isPaginationEnabled?: boolean;
|
|
21
21
|
manualPagination?: boolean;
|
|
22
22
|
enableRowSelectionUI?: boolean;
|