+
+
+
+
+ {headers.map((header) => {
+ const canSort =
+ header.sortable === true &&
+ typeof onSortChange === 'function' &&
+ typeof header.sortField === 'string' &&
+ header.sortField.length > 0;
+ const isActiveSort = canSort && sorting?.field === header.sortField;
+ const sortDirection = isActiveSort ? sorting?.direction : null;
- return (
- |
- {canSort ? (
-
- ) : (
- header.label
- )}
- |
- );
- })}
-
-
-
- {isLoading ? (
-
- |
-
- |
-
+ return (
+
+ {canSort ? (
+
+ ) : (
+ header.label
+ )}
+ |
+ );
+ })}
+
+
+
+ {isLoading ? (
+
+ |
+
+ |
+
+ ) : null}
+ {!isLoading && data.length === 0 ? (
+
+ |
+
+ |
+
+ ) : null}
+ {!isLoading &&
+ data.map((row, index) => (
+
+ {headers.map((header) => {
+ const content =
+ typeof header.value === 'function'
+ ? (header.value as (item: T) => ReactNode)(row)
+ : header.value;
+ return (
+ |
+ {content}
+ |
+ );
+ })}
+
+ ))}
+
+
+
+ {pagination ? (
+
+
+
+ {pagination.onPageSizeChange ? (
+ ({
+ id: String(size),
+ label: String(size),
+ }))}
+ size="sm"
+ layout="inline"
+ className="max-w-none"
+ selectClassName="rounded-lg px-2"
+ disabled={isLoading}
+ onChange={(value) => pagination.onPageSizeChange?.(Number(value))}
+ />
+ ) : null}
+
+
) : null}
- {!isLoading && data.length === 0 ? (
-
- |
-
- |
-
- ) : null}
- {!isLoading &&
- data.map((row, index) => (
-
- {headers.map((header) => {
- const content =
- typeof header.value === 'function'
- ? (header.value as (item: T) => ReactNode)(row)
- : header.value;
- return (
- |
- {content}
- |
- );
- })}
-
- ))}
-
-