mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-02 16:19:08 +00:00
dont auto close hide col popover on click
This commit is contained in:
@@ -568,6 +568,12 @@ export default function ClientsTable({
|
||||
.getAllColumns()
|
||||
.filter((column) => column.getCanHide())
|
||||
.map((column) => {
|
||||
const columnDef = column.columnDef as any;
|
||||
const friendlyName = columnDef.friendlyName;
|
||||
const displayName = friendlyName ||
|
||||
(typeof columnDef.header === "string"
|
||||
? columnDef.header
|
||||
: column.id);
|
||||
return (
|
||||
<DropdownMenuCheckboxItem
|
||||
key={column.id}
|
||||
@@ -576,11 +582,9 @@ export default function ClientsTable({
|
||||
onCheckedChange={(value) =>
|
||||
column.toggleVisibility(!!value)
|
||||
}
|
||||
onSelect={(e) => e.preventDefault()}
|
||||
>
|
||||
{typeof column.columnDef.header ===
|
||||
"string"
|
||||
? column.columnDef.header
|
||||
: column.id}
|
||||
{displayName}
|
||||
</DropdownMenuCheckboxItem>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -785,6 +785,12 @@ export default function ResourcesTable({
|
||||
.getAllColumns()
|
||||
.filter((column) => column.getCanHide())
|
||||
.map((column) => {
|
||||
const columnDef = column.columnDef as any;
|
||||
const friendlyName = columnDef.friendlyName;
|
||||
const displayName = friendlyName ||
|
||||
(typeof columnDef.header === "string"
|
||||
? columnDef.header
|
||||
: column.id);
|
||||
return (
|
||||
<DropdownMenuCheckboxItem
|
||||
key={column.id}
|
||||
@@ -793,11 +799,9 @@ export default function ResourcesTable({
|
||||
onCheckedChange={(value) =>
|
||||
column.toggleVisibility(!!value)
|
||||
}
|
||||
onSelect={(e) => e.preventDefault()}
|
||||
>
|
||||
{typeof column.columnDef.header ===
|
||||
"string"
|
||||
? column.columnDef.header
|
||||
: column.id}
|
||||
{displayName}
|
||||
</DropdownMenuCheckboxItem>
|
||||
);
|
||||
})}
|
||||
@@ -992,6 +996,12 @@ export default function ResourcesTable({
|
||||
.getAllColumns()
|
||||
.filter((column) => column.getCanHide())
|
||||
.map((column) => {
|
||||
const columnDef = column.columnDef as any;
|
||||
const friendlyName = columnDef.friendlyName;
|
||||
const displayName = friendlyName ||
|
||||
(typeof columnDef.header === "string"
|
||||
? columnDef.header
|
||||
: column.id);
|
||||
return (
|
||||
<DropdownMenuCheckboxItem
|
||||
key={column.id}
|
||||
@@ -1000,11 +1010,9 @@ export default function ResourcesTable({
|
||||
onCheckedChange={(value) =>
|
||||
column.toggleVisibility(!!value)
|
||||
}
|
||||
onSelect={(e) => e.preventDefault()}
|
||||
>
|
||||
{typeof column.columnDef.header ===
|
||||
"string"
|
||||
? column.columnDef.header
|
||||
: column.id}
|
||||
{displayName}
|
||||
</DropdownMenuCheckboxItem>
|
||||
);
|
||||
})}
|
||||
|
||||
@@ -193,9 +193,16 @@ export function DataTable<TData, TValue>({
|
||||
? persistColumnVisibility
|
||||
: undefined;
|
||||
|
||||
// Auto-enable persistence if column visibility is enabled
|
||||
// Use explicit persistColumnVisibility if provided, otherwise auto-enable when enableColumnVisibility is true and we have a tableId
|
||||
const shouldPersistColumnVisibility =
|
||||
persistColumnVisibility === true ||
|
||||
typeof persistColumnVisibility === "string" ||
|
||||
(enableColumnVisibility && tableId !== undefined);
|
||||
|
||||
// Compute initial column visibility (from localStorage if enabled, otherwise from prop/default)
|
||||
const initialColumnVisibility = (() => {
|
||||
if (persistColumnVisibility) {
|
||||
if (shouldPersistColumnVisibility) {
|
||||
return getStoredColumnVisibility(
|
||||
tableId,
|
||||
defaultColumnVisibility
|
||||
@@ -277,10 +284,10 @@ export function DataTable<TData, TValue>({
|
||||
|
||||
useEffect(() => {
|
||||
// Persist column visibility to localStorage when it changes
|
||||
if (persistColumnVisibility) {
|
||||
if (shouldPersistColumnVisibility) {
|
||||
setStoredColumnVisibility(columnVisibility, tableId);
|
||||
}
|
||||
}, [columnVisibility, persistColumnVisibility, tableId]);
|
||||
}, [columnVisibility, shouldPersistColumnVisibility, tableId]);
|
||||
|
||||
const handleTabChange = (value: string) => {
|
||||
setActiveTab(value);
|
||||
@@ -440,6 +447,7 @@ export function DataTable<TData, TValue>({
|
||||
onCheckedChange={(value) =>
|
||||
column.toggleVisibility(!!value)
|
||||
}
|
||||
onSelect={(e) => e.preventDefault()}
|
||||
>
|
||||
{displayName}
|
||||
</DropdownMenuCheckboxItem>
|
||||
|
||||
Reference in New Issue
Block a user