New Changes with table Classes and Modification

This commit is contained in:
2025-11-06 14:17:44 +05:30
parent 5905ef32f3
commit 61cb97e4da
3 changed files with 38 additions and 35 deletions
+36 -35
View File
@@ -14,6 +14,7 @@ const {
columnsRendererKey, columnsRendererKey,
classInfos = "", classInfos = "",
tableClassNames = "", tableClassNames = "",
hideHeader = false,
} = Astro.props as TableProps<any>; } = Astro.props as TableProps<any>;
const id = `table-${Math.random().toString(36).slice(2, 9)}`; const id = `table-${Math.random().toString(36).slice(2, 9)}`;
@@ -46,42 +47,42 @@ const id = `table-${Math.random().toString(36).slice(2, 9)}`;
tableClassNames, tableClassNames,
)} )}
> >
<thead {
class="wr:bg-gray-100 wr:dark:bg-neutral-700 wr:text-gray-600 wr:dark:text-gray-300" !hideHeader && (
> <thead class="wr:bg-gray-100 wr:dark:bg-neutral-700 wr:text-gray-600 wr:dark:text-gray-300">
<tr> <tr>
{ {selectable && (
selectable && ( <th class="wr:p-3 wr:text-left wr:w-12">
<th class="wr:p-3 wr:text-left wr:w-12"> <input type="checkbox" data-select-all />
<input type="checkbox" data-select-all /> </th>
</th> )}
) {columns.map((col) => (
} <th
{ class={cn(
columns.map((col) => ( `wr:py-3 wr:px-4 ${col.align ? `wr:text-${col.align}` : "wr:text-left"} ${col.sortable ? "wr:cursor-pointer" : ""}`,
<th
class={cn(
`wr:py-3 wr:px-4 ${col.align ? `wr:text-${col.align}` : "wr:text-left"} ${col.sortable ? "wr:cursor-pointer" : ""}`,
)}
style={col.width ? `width:${col.width}` : ""}
data-sort-key={
col.sortable ? col.key : undefined
}
>
<div class="wr:flex wr:items-center wr:gap-1">
<span>{col.label}</span>
{col.sortable && (
<iconify-icon
icon="solar:sort-vertical-bold-duotone"
class="wr:text-lg wr:text-gray-400 sort-indicator"
/>
)} )}
</div> style={
</th> col.width ? `width:${col.width}` : ""
)) }
} data-sort-key={
</tr> col.sortable ? col.key : undefined
</thead> }
>
<div class="wr:flex wr:items-center wr:gap-1">
<span>{col.label}</span>
{col.sortable && (
<iconify-icon
icon="solar:sort-vertical-bold-duotone"
class="wr:text-lg wr:text-gray-400 sort-indicator"
/>
)}
</div>
</th>
))}
</tr>
</thead>
)
}
<tbody data-body> </tbody> <tbody data-body> </tbody>
</table> </table>
</div> </div>
+1
View File
@@ -259,6 +259,7 @@ const studentColumns = [
columns={columns} columns={columns}
data={data} data={data}
columnsRendererKey="columnsRenderer" columnsRendererKey="columnsRenderer"
hideHeader={true}
/> />
<br /> <br />
+1
View File
@@ -33,4 +33,5 @@ export interface TableProps<T> {
columnsRendererKey?: string columnsRendererKey?: string
classInfos?: string; classInfos?: string;
tableClassNames?: string; tableClassNames?: string;
hideHeader?: boolean;
} }