"use client" import { Badge, Group, Paper, Stack, Text, type GroupProps, type PaperProps, type StackProps, } from "@mantine/core" import type { PropsWithChildren, ReactNode } from "react" import { DataTable, type DataTableDefaultColumnProps, type DataTableProps, } from "mantine-datatable" import classes from "./PageSurface.module.css" function mergeClassName(...classNames: Array) { return classNames.filter(Boolean).join(" ") } export function SettingPage({ className, ...props }: PropsWithChildren) { return ( ) } export function SettingPanel({ className, withBorder = true, radius = "lg", p = "md", shadow = "xs", ...props }: PropsWithChildren) { return ( ) } export function SettingFilterPanel({ className, ...props }: PropsWithChildren) { return ( ) } export function SettingContentPanel({ className, ...props }: PropsWithChildren) { return ( ) } type SettingSectionHeaderProps = GroupProps & { eyebrow?: string title: ReactNode description?: ReactNode actions?: ReactNode } export function SettingSectionHeader({ eyebrow, title, description, actions, className, ...props }: SettingSectionHeaderProps) { return ( {eyebrow ? ( {eyebrow} ) : null} {title} {description ? ( {description} ) : null} {actions} ) } type SettingListHeaderProps = { title: ReactNode count?: ReactNode actions?: ReactNode className?: string } export function SettingListHeader({ title, count, actions, className, }: SettingListHeaderProps) { return ( {title} {count !== undefined ? ( {count} ) : null} {actions} ) } export function SettingHeaderActions({ className, gap = "sm", ...props }: PropsWithChildren) { return ( ) } export function SettingFilterActions({ className, gap = "sm", justify = "flex-end", mt = "md", ...props }: PropsWithChildren) { return ( ) } const settingDataTableStyles = { header: { backgroundColor: "#F8F9FB", borderBottom: "1px solid #EEF2F6", color: "#56606A", fontSize: "14px", }, root: { height: "100%", fontSize: "14px", color: "#31373D", borderBottom: "1px solid #E8EDF3", borderRadius: 10, overflow: "hidden", backgroundColor: "#FFFFFF", }, pagination: { padding: "14px 16px 18px", }, } as const const settingDataTableDefaultColumnProps: DataTableDefaultColumnProps< Record > = { titleStyle: { whiteSpace: "nowrap", fontWeight: 600, }, } export function SettingDataTable>( props: DataTableProps ) { const { styles, defaultColumnProps, withTableBorder, withRowBorders, striped, highlightOnHover, loaderBackgroundBlur, loadingText, noRecordsText, minHeight, page, onPageChange, totalRecords, recordsPerPage, recordsPerPageLabel, paginationText, ...rest } = props const paginationProps = page !== undefined && onPageChange !== undefined && recordsPerPage !== undefined ? { page, onPageChange, totalRecords, recordsPerPage, loadingText: loadingText ?? "正在加载数据...", recordsPerPageLabel: recordsPerPageLabel ?? "每页条数", paginationText: paginationText ?? (({ from, to, totalRecords, }: { from: number to: number totalRecords: number }) => `${from}-${to} / ${totalRecords}`), } : {} const tableProps = { withTableBorder: withTableBorder ?? true, withRowBorders: withRowBorders ?? true, striped: striped ?? true, highlightOnHover: highlightOnHover ?? true, defaultColumnProps: defaultColumnProps ?? (settingDataTableDefaultColumnProps as DataTableDefaultColumnProps), loaderBackgroundBlur: loaderBackgroundBlur ?? 1, noRecordsText: noRecordsText ?? "暂无数据", minHeight: minHeight ?? 360, styles: styles ? { ...settingDataTableStyles, ...styles } : settingDataTableStyles, ...paginationProps, ...rest, } as DataTableProps return } export const settingTabsStyles = { list: { padding: 4, backgroundColor: "#F8F9FB", border: "1px solid #EEF2F6", borderRadius: 10, gap: 8, }, tab: { minHeight: 36, borderRadius: 8, color: "#56606A", fontWeight: 600, "&[data-active]": { backgroundColor: "#FFFFFF", color: "#1F2329", boxShadow: "0 6px 18px rgba(15, 23, 42, 0.08)", }, }, panel: { flex: 1, minHeight: 0, paddingTop: 16, }, } as const