najm-kit 2.11.3 → 2.11.4
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/CHANGELOG.md +4 -1
- package/dist/index.mjs +11 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 2.11.
|
|
3
|
+
## 2.11.4 - 2026-08-12
|
|
4
4
|
|
|
5
5
|
- Fixed server-paginated card grids briefly rendering at a placeholder-derived
|
|
6
6
|
page size before correcting to the real card height. Card mode now waits for
|
|
7
7
|
real rows and publishes the measured fit before their first paint; fixed-row
|
|
8
8
|
table sizing remains immediate during loading.
|
|
9
|
+
|
|
10
|
+
## 2.11.3 - 2026-08-12
|
|
11
|
+
|
|
9
12
|
- Fixed `NTable` replacing or clipping an explicit Rows/page choice when
|
|
10
13
|
`dynamicHeight` was enabled. Automatic fit sizing still owns the initial page
|
|
11
14
|
size; after the reader chooses a value, the table preserves it and scrolls
|
package/dist/index.mjs
CHANGED
|
@@ -11887,6 +11887,9 @@ function calculateCardPageSize(input) {
|
|
|
11887
11887
|
function shouldDeferCardPageSizeUntilRows(renderedMode, hasDataRows) {
|
|
11888
11888
|
return renderedMode === "cards" && !hasDataRows;
|
|
11889
11889
|
}
|
|
11890
|
+
function shouldCommitDynamicPageSizeImmediately(reportedMode, renderedMode) {
|
|
11891
|
+
return reportedMode === null || reportedMode !== renderedMode;
|
|
11892
|
+
}
|
|
11890
11893
|
function fallbackCardColumns(width) {
|
|
11891
11894
|
if (width >= 1280) return 4;
|
|
11892
11895
|
if (width >= 1024) return 3;
|
|
@@ -11900,6 +11903,7 @@ function useDynamicPageSize(containerRef, effectiveViewMode) {
|
|
|
11900
11903
|
const isLoading = useTableStore.use.isLoading();
|
|
11901
11904
|
const error = useTableStore.use.error();
|
|
11902
11905
|
const hasNoData = useTableStore.use.hasNoData();
|
|
11906
|
+
const hasDataRows = useTableStore.use.hasData();
|
|
11903
11907
|
const isFilteredEmpty = useTableStore.use.isFilteredEmpty();
|
|
11904
11908
|
const syncWithProps = useTableStore.use.syncWithProps();
|
|
11905
11909
|
const lastMeasurementRef = useRef("");
|
|
@@ -11936,7 +11940,8 @@ function useDynamicPageSize(containerRef, effectiveViewMode) {
|
|
|
11936
11940
|
const cardGap = Number.parseFloat(gridStyles?.rowGap || gridStyles?.gap || "") || DEFAULT_CARD_GAP;
|
|
11937
11941
|
const firstCard = cardsGridEl?.querySelector("[data-ntable-loading-card], [data-row]");
|
|
11938
11942
|
const cardRowHeight = firstCard?.offsetHeight || firstCard?.getBoundingClientRect().height || DEFAULT_CARD_HEIGHT;
|
|
11939
|
-
const
|
|
11943
|
+
const measuredMode = effectiveViewMode ?? viewMode;
|
|
11944
|
+
const cardPageSize = shouldDeferCardPageSizeUntilRows(measuredMode, hasDataRows) ? 0 : calculateCardPageSize({
|
|
11940
11945
|
bodyHeight,
|
|
11941
11946
|
columnCount: cardColumnCount,
|
|
11942
11947
|
cardHeight: cardRowHeight,
|
|
@@ -11978,7 +11983,7 @@ function useDynamicPageSize(containerRef, effectiveViewMode) {
|
|
|
11978
11983
|
).forEach((el) => resizeObserver.observe(el));
|
|
11979
11984
|
if (container.parentElement) resizeObserver.observe(container.parentElement);
|
|
11980
11985
|
return () => resizeObserver.disconnect();
|
|
11981
|
-
}, [dynamicHeight, effectiveViewMode, viewMode, containerRef, syncWithProps, manualPagination, isLoading, error, hasNoData, isFilteredEmpty]);
|
|
11986
|
+
}, [dynamicHeight, effectiveViewMode, viewMode, containerRef, syncWithProps, manualPagination, isLoading, error, hasNoData, hasDataRows, isFilteredEmpty]);
|
|
11982
11987
|
}
|
|
11983
11988
|
function useTable(effectiveViewModeOverride) {
|
|
11984
11989
|
const [sorting, setSorting] = useState([]);
|
|
@@ -12149,18 +12154,14 @@ function useTable(effectiveViewModeOverride) {
|
|
|
12149
12154
|
if (dynamicPageSizeTarget === storePagination.pageSize) return;
|
|
12150
12155
|
if (shouldDeferCardPageSizeUntilRows(renderedMode, hasDataRows)) return;
|
|
12151
12156
|
const reported = reportedGeometryRef.current;
|
|
12152
|
-
if (reported?.key === geometryKey && reported.target === dynamicPageSizeTarget) return;
|
|
12153
|
-
if (reported?.key === geometryKey && reported.count >= MAX_PAGE_SIZE_REPORTS_PER_GEOMETRY) return;
|
|
12157
|
+
if (reported?.key === geometryKey && reported.mode === renderedMode && reported.target === dynamicPageSizeTarget) return;
|
|
12158
|
+
if (reported?.key === geometryKey && reported.mode === renderedMode && reported.count >= MAX_PAGE_SIZE_REPORTS_PER_GEOMETRY) return;
|
|
12154
12159
|
const commit = () => {
|
|
12155
12160
|
const current = reportedGeometryRef.current;
|
|
12156
|
-
reportedGeometryRef.current = current?.key === geometryKey ? { key: geometryKey, count: current.count + 1, target: dynamicPageSizeTarget } : { key: geometryKey, count: 1, target: dynamicPageSizeTarget };
|
|
12161
|
+
reportedGeometryRef.current = current?.key === geometryKey && current.mode === renderedMode ? { key: geometryKey, count: current.count + 1, target: dynamicPageSizeTarget, mode: renderedMode } : { key: geometryKey, count: 1, target: dynamicPageSizeTarget, mode: renderedMode };
|
|
12157
12162
|
setPagination({ pageIndex: storePagination.pageIndex, pageSize: dynamicPageSizeTarget });
|
|
12158
12163
|
};
|
|
12159
|
-
if (
|
|
12160
|
-
commit();
|
|
12161
|
-
return;
|
|
12162
|
-
}
|
|
12163
|
-
if (!reported) {
|
|
12164
|
+
if (shouldCommitDynamicPageSizeImmediately(reported?.mode ?? null, renderedMode)) {
|
|
12164
12165
|
commit();
|
|
12165
12166
|
return;
|
|
12166
12167
|
}
|