File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
import type {CheckableTableModel, RowActionsModel} from "../../../../type/viewModel.ts";
import type {ContentListItem} from "../type/content.types.ts";
import type {SearchParams} from "../../../../type/searchParams.ts";
import {ContentListTableHeader} from "./ContentListTableHeader.tsx";
import {EmptyRow} from "../../../component/EmptyRow.tsx";
import {ContentListTableRow} from "./ContentListTableRow.tsx";
type ContentListTableProps = CheckableTableModel<ContentListItem, SearchParams> & RowActionsModel<{
onDetail: (cntId: string, cntDtId: string) => void
onPreview: (cntId: string, cntDtId: string) => void
}>;
export const ContentListTable = ({
items,
params,
onChange,
pagination,
check,
rowActions
}: ContentListTableProps) => {
return (
<div className={"table table_type_cols"}>
<table>
<ContentListTableHeader
params={params}
onChange={onChange}
checked={check.isAllChecked}
indeterminate={check.isPartiallyChecked}
onCheckAll={check.onCheckAll}
/>
<tbody>
{items.length > 0 ?
items.map((item, index) => (
<ContentListTableRow
key={index}
item={item}
index={index}
searchParams={params}
{...pagination}
checked={check.isChecked(item.cntId)}
onCheck={check.onCheck}
{...rowActions}
/>
)
) : (
<EmptyRow colSpan={7}/>
)
}
</tbody>
</table>
</div>
)
}