default to first *filterable* column
Gitea/subman-nextjs/pipeline/head There was a failure building this commit
Details
Gitea/subman-nextjs/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
59a8f8bc41
commit
e2b21601ea
|
@ -715,6 +715,11 @@ body {
|
||||||
margin-right: -0.25rem;
|
margin-right: -0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx-0 {
|
||||||
|
margin-left: 0px;
|
||||||
|
margin-right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.mx-1 {
|
.mx-1 {
|
||||||
margin-left: 0.25rem;
|
margin-left: 0.25rem;
|
||||||
margin-right: 0.25rem;
|
margin-right: 0.25rem;
|
||||||
|
@ -745,11 +750,6 @@ body {
|
||||||
margin-bottom: auto;
|
margin-bottom: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx-0 {
|
|
||||||
margin-left: 0px;
|
|
||||||
margin-right: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mb-6 {
|
.mb-6 {
|
||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
@ -1118,10 +1118,6 @@ body {
|
||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.justify-start {
|
|
||||||
justify-content: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.justify-end {
|
.justify-end {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
@ -1138,18 +1134,6 @@ body {
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gap-1 {
|
|
||||||
gap: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gap-2 {
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gap-4 {
|
|
||||||
gap: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.gap-0 {
|
.gap-0 {
|
||||||
gap: 0px;
|
gap: 0px;
|
||||||
}
|
}
|
||||||
|
@ -1158,6 +1142,18 @@ body {
|
||||||
gap: 0.125rem;
|
gap: 0.125rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gap-1 {
|
||||||
|
gap: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gap-4 {
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gap-2 {
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
.gap-x-16 {
|
.gap-x-16 {
|
||||||
-moz-column-gap: 4rem;
|
-moz-column-gap: 4rem;
|
||||||
column-gap: 4rem;
|
column-gap: 4rem;
|
||||||
|
|
|
@ -129,11 +129,11 @@ export function DataTable<TData, TValue>({
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const [filterBy, setFilterBy] = useState(table.getAllColumns()[0])
|
const [filterBy, setFilterBy] = useState(table.getAllColumns().filter(e => e.getCanFilter())[0])
|
||||||
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false)
|
const [isContextMenuOpen, setIsContextMenuOpen] = useState(false)
|
||||||
return (<>
|
return (<>
|
||||||
<div className="flex gap-1 justify-between items-center py-1 md:py-4">
|
<div className="flex gap-2 justify-between items-center py-1 md:py-4">
|
||||||
<div className="flex gap-0.5">
|
<div className="flex gap-1">
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button variant="outline" className="mx-0"> <p className="hidden md:block">Filter by</p><CircleHelp className="block md:hidden" /> </Button>
|
<Button variant="outline" className="mx-0"> <p className="hidden md:block">Filter by</p><CircleHelp className="block md:hidden" /> </Button>
|
||||||
|
@ -155,7 +155,6 @@ export function DataTable<TData, TValue>({
|
||||||
onChange={(event) =>
|
onChange={(event) =>
|
||||||
table.getColumn(filterBy.id)?.setFilterValue(event.target.value)
|
table.getColumn(filterBy.id)?.setFilterValue(event.target.value)
|
||||||
}
|
}
|
||||||
disabled={filterBy.id === "select"}
|
|
||||||
className="max-w-sm"
|
className="max-w-sm"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Checkbox } from "@/components/ui/checkbox";
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
import { CellContext, Column, ColumnDef, ColumnMeta, Header, HeaderContext, RowSelectionTableState, Table, TableState } from "@tanstack/react-table";
|
import { CellContext, Column, ColumnDef, ColumnMeta, Header, HeaderContext, RowSelectionTableState, Table, TableState } from "@tanstack/react-table";
|
||||||
|
|
||||||
export const selectCol = {
|
export const selectCol: ColumnDef<any, any> = {
|
||||||
id: "select",
|
id: "select",
|
||||||
header: (props: HeaderContext<any, any>) => {
|
header: (props: HeaderContext<any, any>) => {
|
||||||
return (
|
return (
|
||||||
|
@ -16,7 +16,7 @@ export const selectCol = {
|
||||||
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
enableColumnFilter: false,
|
||||||
cell: (props: CellContext<any, any>) => {
|
cell: (props: CellContext<any, any>) => {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-start justify-left">
|
<div className="flex items-start justify-left">
|
||||||
|
|
Loading…
Reference in New Issue