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
+13 -12
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,24 +47,23 @@ 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"
>
<tr>
{ {
selectable && ( !hideHeader && (
<thead class="wr:bg-gray-100 wr:dark:bg-neutral-700 wr:text-gray-600 wr:dark:text-gray-300">
<tr>
{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) => (
{
columns.map((col) => (
<th <th
class={cn( class={cn(
`wr:py-3 wr:px-4 ${col.align ? `wr:text-${col.align}` : "wr:text-left"} ${col.sortable ? "wr:cursor-pointer" : ""}`, `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}` : ""} style={
col.width ? `width:${col.width}` : ""
}
data-sort-key={ data-sort-key={
col.sortable ? col.key : undefined col.sortable ? col.key : undefined
} }
@@ -78,10 +78,11 @@ const id = `table-${Math.random().toString(36).slice(2, 9)}`;
)} )}
</div> </div>
</th> </th>
)) ))}
}
</tr> </tr>
</thead> </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;
} }