fix(ui): 统一表格筛选分页和用量明细,升级 ESLint

This commit is contained in:
zhanjunhao
2026-11-19 23:09:58 +08:00
parent e70e0d2224
commit e80d719c30
76 changed files with 2556 additions and 2410 deletions
+22 -15
View File
@@ -24,6 +24,27 @@ import { useIsMobile } from '../../hooks/common/useIsMobile';
import { ConsoleCard, ConsoleSearchBar } from './ConsolePrimitives';
import { TableTitle } from '../common/table/TableToolbar';
export function ConsoleCollectionSearch({ children, className }) {
const { t } = useTranslation();
const isMobile = useIsMobile();
const [expanded, setExpanded] = useState(false);
return (
<>
{isMobile && (
<Button
onClick={() => setExpanded((value) => !value)}
aria-expanded={expanded}
>
{t(expanded ? '隐藏操作项' : '显示操作项')}
</Button>
)}
<ConsoleSearchBar className={className} hidden={isMobile && !expanded}>
{children}
</ConsoleSearchBar>
</>
);
}
export default function ConsoleCollection({
children,
statsArea,
@@ -36,27 +57,13 @@ export default function ConsoleCollection({
tableActionsOffset = false,
paginationArea,
}) {
const { t } = useTranslation();
const isMobile = useIsMobile();
const [expanded, setExpanded] = useState(false);
const showSearch = !isMobile || expanded;
return (
<div className='console-collection'>
{statsArea && (
<ConsoleCard className='console-stats'>{statsArea}</ConsoleCard>
)}
{searchArea && (
<>
{isMobile && (
<Button
onClick={() => setExpanded(!expanded)}
aria-expanded={expanded}
>
{t(expanded ? '隐藏操作项' : '显示操作项')}
</Button>
)}
<ConsoleSearchBar hidden={!showSearch}>{searchArea}</ConsoleSearchBar>
</>
<ConsoleCollectionSearch>{searchArea}</ConsoleCollectionSearch>
)}
<ConsoleCard>
{tabsArea && <div className='console-list-tabs'>{tabsArea}</div>}
+18 -22
View File
@@ -32,6 +32,8 @@ import {
} from 'antd';
import { useTranslation } from 'react-i18next';
import TableEmpty from '../common/table/TableEmpty';
import FilterSearchButton from '../common/table/FilterSearchButton';
import './console.css';
import {
ConsoleSearchContext,
useConsolePage,
@@ -96,38 +98,32 @@ export function ConsoleSearchBar({ children, className, formProps, ...props }) {
);
}
export function ConsoleSearchActions({
onReset,
onSearch,
loading,
searchLabel = '搜索',
}) {
export function ConsoleSearchActions({ onReset, loading }) {
const { t } = useTranslation();
return (
<div className='console-search-actions'>
{onReset && <Button onClick={onReset}>{t('重置')}</Button>}
<Button
type='primary'
htmlType={onSearch ? 'button' : 'submit'}
onClick={onSearch}
loading={loading}
>
{t(searchLabel)}
</Button>
{onReset && (
<Button htmlType='button' onClick={onReset}>
{t('重置')}
</Button>
)}
<FilterSearchButton loading={loading} />
</div>
);
}
export function ConsoleFilterGrid({ children, onReset, onSearch, loading }) {
return (
<div className='console-filter-panel'>
<form
className='console-filter-panel'
onSubmit={(event) => {
event.preventDefault();
onSearch();
}}
>
<div className='console-filter-grid'>{children}</div>
<ConsoleSearchActions
onReset={onReset}
onSearch={onSearch}
loading={loading}
/>
</div>
<ConsoleSearchActions onReset={onReset} loading={loading} />
</form>
);
}
+2 -2
View File
@@ -230,7 +230,7 @@
justify-content: flex-end;
flex: 0 0 auto;
flex-wrap: wrap;
gap: var(--console-space-1);
gap: var(--console-space-1, 8px);
margin-inline-start: auto;
}
.console-filter-panel {
@@ -253,7 +253,7 @@
}
.console-filter-field > label,
.console-page .console-filter-grid .ant-form-item-label > label {
color: var(--console-muted);
color: var(--console-muted, var(--ui-color-text-2));
font-size: 13px;
}
.console-filter-field > :is(.ant-input-number, .ant-picker) {