@ai-matrx/design-system 0.17.1 → 0.17.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.
package/dist/data-table/index.js
CHANGED
|
@@ -415,6 +415,7 @@ import {
|
|
|
415
415
|
isValidElement,
|
|
416
416
|
useCallback as useCallback3,
|
|
417
417
|
useEffect as useEffect9,
|
|
418
|
+
useLayoutEffect,
|
|
418
419
|
useMemo as useMemo4,
|
|
419
420
|
useRef as useRef4,
|
|
420
421
|
useState as useState14
|
|
@@ -5450,6 +5451,16 @@ function MatrxDataTableCore({
|
|
|
5450
5451
|
]);
|
|
5451
5452
|
const scrollRef = useRef4(null);
|
|
5452
5453
|
const cardsScrollRef = useRef4(null);
|
|
5454
|
+
const previousAppendKeyForScrollReset = useRef4(appendQueryKey);
|
|
5455
|
+
useLayoutEffect(() => {
|
|
5456
|
+
const previous = previousAppendKeyForScrollReset.current;
|
|
5457
|
+
previousAppendKeyForScrollReset.current = appendQueryKey;
|
|
5458
|
+
if (previous === null || appendQueryKey === null || previous === appendQueryKey) {
|
|
5459
|
+
return;
|
|
5460
|
+
}
|
|
5461
|
+
if (scrollRef.current) scrollRef.current.scrollTop = 0;
|
|
5462
|
+
if (cardsScrollRef.current) cardsScrollRef.current.scrollTop = 0;
|
|
5463
|
+
}, [appendQueryKey]);
|
|
5453
5464
|
const scrollPagination = useScrollPagination({
|
|
5454
5465
|
containers: [scrollRef, cardsScrollRef],
|
|
5455
5466
|
queryKey: appendQuery?.pagination.queryKey ?? "",
|
|
@@ -6487,7 +6498,7 @@ function MatrxDataTableCore({
|
|
|
6487
6498
|
mobileCardsClass
|
|
6488
6499
|
),
|
|
6489
6500
|
children: [
|
|
6490
|
-
isFetching && !isLoading ? /* @__PURE__ */ jsxs24(
|
|
6501
|
+
isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ jsxs24(
|
|
6491
6502
|
"div",
|
|
6492
6503
|
{
|
|
6493
6504
|
role: "status",
|
|
@@ -6582,7 +6593,7 @@ function MatrxDataTableCore({
|
|
|
6582
6593
|
resolve: resolveHierarchyMove
|
|
6583
6594
|
}
|
|
6584
6595
|
) : null,
|
|
6585
|
-
isFetching && !isLoading ? /* @__PURE__ */ jsxs24(
|
|
6596
|
+
isFetching && !isLoading && appendQuery === null ? /* @__PURE__ */ jsxs24(
|
|
6586
6597
|
"div",
|
|
6587
6598
|
{
|
|
6588
6599
|
role: "status",
|
|
@@ -6943,13 +6954,56 @@ function MatrxDataTableCore({
|
|
|
6943
6954
|
}
|
|
6944
6955
|
) : null
|
|
6945
6956
|
] }),
|
|
6946
|
-
appendQuery ? /* @__PURE__ */ jsxs24(
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6957
|
+
appendQuery ? /* @__PURE__ */ jsxs24(
|
|
6958
|
+
"div",
|
|
6959
|
+
{
|
|
6960
|
+
"data-matrx-table-footer": true,
|
|
6961
|
+
className: "flex min-h-16 shrink-0 items-center justify-between gap-3 border-t border-border px-3 py-2",
|
|
6962
|
+
"aria-busy": isLoading || isFetching,
|
|
6963
|
+
children: [
|
|
6964
|
+
/* @__PURE__ */ jsxs24(
|
|
6965
|
+
"div",
|
|
6966
|
+
{
|
|
6967
|
+
role: "status",
|
|
6968
|
+
"aria-live": "polite",
|
|
6969
|
+
className: "flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground",
|
|
6970
|
+
children: [
|
|
6971
|
+
isLoading || isFetching ? /* @__PURE__ */ jsx32(
|
|
6972
|
+
Loader2,
|
|
6973
|
+
{
|
|
6974
|
+
"data-matrx-table-append-loader": true,
|
|
6975
|
+
"aria-hidden": "true",
|
|
6976
|
+
className: "h-5 w-5 shrink-0 animate-spin text-primary motion-reduce:animate-none"
|
|
6977
|
+
}
|
|
6978
|
+
) : null,
|
|
6979
|
+
/* @__PURE__ */ jsxs24("div", { className: "min-w-0", children: [
|
|
6980
|
+
/* @__PURE__ */ jsx32("p", { className: "break-words font-medium text-foreground", children: isFetching ? "Loading more rows\u2026" : isLoading ? "Loading rows\u2026" : `${data.length.toLocaleString()} loaded${appendQuery.pagination.totalItems === void 0 ? "" : ` of ${appendQuery.pagination.totalItems.toLocaleString()}`}` }),
|
|
6981
|
+
scrollPagination.error ? /* @__PURE__ */ jsx32("p", { role: "alert", className: "break-words text-destructive", children: scrollPagination.error.message }) : null
|
|
6982
|
+
] })
|
|
6983
|
+
]
|
|
6984
|
+
}
|
|
6985
|
+
),
|
|
6986
|
+
scrollPagination.error && !appendQuery.pagination.hasNextPage ? /* @__PURE__ */ jsx32(
|
|
6987
|
+
Button,
|
|
6988
|
+
{
|
|
6989
|
+
type: "button",
|
|
6990
|
+
variant: "outline",
|
|
6991
|
+
onClick: appendQuery.pagination.refresh,
|
|
6992
|
+
children: "Reload rows"
|
|
6993
|
+
}
|
|
6994
|
+
) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ jsx32(
|
|
6995
|
+
Button,
|
|
6996
|
+
{
|
|
6997
|
+
type: "button",
|
|
6998
|
+
variant: "outline",
|
|
6999
|
+
disabled: isLoading || isFetching,
|
|
7000
|
+
onClick: () => void scrollPagination.requestNextPage(),
|
|
7001
|
+
children: scrollPagination.error ? "Retry" : "Load more"
|
|
7002
|
+
}
|
|
7003
|
+
) : !isLoading ? /* @__PURE__ */ jsx32("span", { className: "text-xs text-muted-foreground", children: "All rows loaded" }) : null
|
|
7004
|
+
]
|
|
7005
|
+
}
|
|
7006
|
+
) : !hidePagination && totalItems > 0 ? /* @__PURE__ */ jsx32("div", { className: "shrink-0", children: /* @__PURE__ */ jsx32(
|
|
6953
7007
|
GenericTablePagination,
|
|
6954
7008
|
{
|
|
6955
7009
|
totalItems,
|