@gridkitjs/core 0.0.0-dev-20261107203826 → 0.0.0-dev-20261107212842
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.
- package/dist/index.d.ts +4 -2
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -217,8 +217,10 @@ interface GridController<Row, Node = string> {
|
|
|
217
217
|
/** Collapses every group currently shown — see `collapseAllGroups`. */
|
|
218
218
|
readonly collapseAllGroups: () => void;
|
|
219
219
|
/**
|
|
220
|
-
* Replaces the page and page size
|
|
221
|
-
* the
|
|
220
|
+
* Replaces the page and page size. A controlled pagination asks for them
|
|
221
|
+
* as given and the view clamps a page past the last one; an uncontrolled
|
|
222
|
+
* one stores and reports that page clamped. An equal pagination reports
|
|
223
|
+
* nothing.
|
|
222
224
|
*/
|
|
223
225
|
readonly setPagination: (pagination: PaginationState) => void;
|
|
224
226
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1861,6 +1861,21 @@ function createGridController(initial) {
|
|
|
1861
1861
|
}
|
|
1862
1862
|
}
|
|
1863
1863
|
state = SLICE_KEYS.every((key) => next[key] === state[key]) ? state : next;
|
|
1864
|
+
storeShownPage();
|
|
1865
|
+
}
|
|
1866
|
+
function storeShownPage() {
|
|
1867
|
+
const stored = storedPagination(state.pagination);
|
|
1868
|
+
if (stored !== state.pagination) {
|
|
1869
|
+
own.pagination = stored;
|
|
1870
|
+
state = { ...state, pagination: stored };
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
function storedPagination(pagination) {
|
|
1874
|
+
if (options.paginated !== true || isControlled("pagination")) {
|
|
1875
|
+
return pagination;
|
|
1876
|
+
}
|
|
1877
|
+
const { pageCount, pageIndex } = pageOf(pagination);
|
|
1878
|
+
return pageCount === 0 || pageIndex === pagination.pageIndex ? pagination : { ...pagination, pageIndex };
|
|
1864
1879
|
}
|
|
1865
1880
|
function notify() {
|
|
1866
1881
|
for (const listener of [...listeners]) {
|
|
@@ -1951,14 +1966,16 @@ function createGridController(initial) {
|
|
|
1951
1966
|
options.onGroupExpansionChange?.({ groupId, expansion: next });
|
|
1952
1967
|
});
|
|
1953
1968
|
}
|
|
1954
|
-
function commitPagination(
|
|
1969
|
+
function commitPagination(asked) {
|
|
1970
|
+
const next = heldReports === void 0 ? storedPagination(asked) : asked;
|
|
1955
1971
|
if (samePagination(state.pagination, next)) {
|
|
1956
1972
|
return;
|
|
1957
1973
|
}
|
|
1958
1974
|
commit("pagination", next, () => {
|
|
1975
|
+
const pagination = isControlled("pagination") ? next : own.pagination;
|
|
1959
1976
|
options.onPaginationChange?.({
|
|
1960
|
-
pagination
|
|
1961
|
-
pageCount: pageOf(
|
|
1977
|
+
pagination,
|
|
1978
|
+
pageCount: pageOf(pagination).pageCount
|
|
1962
1979
|
});
|
|
1963
1980
|
});
|
|
1964
1981
|
}
|