najm-kit 2.2.5 → 2.2.7
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.mjs +16 -6
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -12738,7 +12738,7 @@ function useTable(effectiveViewModeOverride) {
|
|
|
12738
12738
|
const dynamicPageSizeTarget = renderedMode === "cards" ? calculatedCardPageSize : calculatedPageSize;
|
|
12739
12739
|
const geometryKey = `${Math.round(measuredBodyWidth / GEOMETRY_BUCKET_PX)}x${Math.round(measuredBodyHeight / GEOMETRY_BUCKET_PX)}`;
|
|
12740
12740
|
const reportedGeometryRef = useRef(null);
|
|
12741
|
-
|
|
12741
|
+
useLayoutEffect(() => {
|
|
12742
12742
|
if (!manualPagination || !dynamicHeight) return;
|
|
12743
12743
|
if (cardPagination.mode !== "paged") return;
|
|
12744
12744
|
if (!hasMeasuredLayout || measuredBodyHeight <= 0) return;
|
|
@@ -12746,12 +12746,16 @@ function useTable(effectiveViewModeOverride) {
|
|
|
12746
12746
|
if (dynamicPageSizeTarget === storePagination.pageSize) return;
|
|
12747
12747
|
const reported = reportedGeometryRef.current;
|
|
12748
12748
|
if (reported?.key === geometryKey && reported.count >= MAX_PAGE_SIZE_REPORTS_PER_GEOMETRY) return;
|
|
12749
|
-
const
|
|
12750
|
-
const timer = setTimeout(() => {
|
|
12749
|
+
const commit = () => {
|
|
12751
12750
|
const current = reportedGeometryRef.current;
|
|
12752
12751
|
reportedGeometryRef.current = current?.key === geometryKey ? { key: geometryKey, count: current.count + 1 } : { key: geometryKey, count: 1 };
|
|
12753
12752
|
setPagination({ pageIndex: storePagination.pageIndex, pageSize: dynamicPageSizeTarget });
|
|
12754
|
-
}
|
|
12753
|
+
};
|
|
12754
|
+
if (!reported) {
|
|
12755
|
+
commit();
|
|
12756
|
+
return;
|
|
12757
|
+
}
|
|
12758
|
+
const timer = setTimeout(commit, DYNAMIC_PAGE_SIZE_DEBOUNCE_MS);
|
|
12755
12759
|
return () => clearTimeout(timer);
|
|
12756
12760
|
}, [
|
|
12757
12761
|
manualPagination,
|
|
@@ -13228,7 +13232,13 @@ function NDataCardShell({ row, onClick, onContextMenu, actions, children, classN
|
|
|
13228
13232
|
);
|
|
13229
13233
|
}
|
|
13230
13234
|
var DEFAULT_ROWS2 = 6;
|
|
13231
|
-
var
|
|
13235
|
+
var UNMEASURED_ROW_HEIGHT = 56;
|
|
13236
|
+
var UNMEASURED_CHROME_HEIGHT = 300;
|
|
13237
|
+
function estimateUnmeasuredRows() {
|
|
13238
|
+
if (typeof window === "undefined") return DEFAULT_ROWS2;
|
|
13239
|
+
const available = window.innerHeight - UNMEASURED_CHROME_HEIGHT;
|
|
13240
|
+
return Math.max(DEFAULT_ROWS2, Math.floor(available / UNMEASURED_ROW_HEIGHT));
|
|
13241
|
+
}
|
|
13232
13242
|
var DEFAULT_CARD_COUNT = 48;
|
|
13233
13243
|
function NTableCardSkeleton({ surface }) {
|
|
13234
13244
|
return /* @__PURE__ */ jsx(
|
|
@@ -13375,7 +13385,7 @@ function NTableLoadingSkeleton({ rows }) {
|
|
|
13375
13385
|
const userGetRowCanExpand = useTableStore.use.getRowCanExpand();
|
|
13376
13386
|
const hasExpansion = Boolean(renderSubRow || userGetRowCanExpand);
|
|
13377
13387
|
const loadingText = useTableStore.use.loadingText();
|
|
13378
|
-
const rowCount = rows ?? (dynamicHeight ? bodyHeight > 0 ? skeletonRowCount :
|
|
13388
|
+
const rowCount = rows ?? (dynamicHeight ? bodyHeight > 0 ? skeletonRowCount : estimateUnmeasuredRows() : DEFAULT_ROWS2);
|
|
13379
13389
|
const renderHeaderLabel = (header) => typeof header === "string" ? header : null;
|
|
13380
13390
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-2", children: [
|
|
13381
13391
|
/* @__PURE__ */ jsx(NTableHeaderSkeleton, {}),
|