feat: 自行开发设计 ui样式优化 超管端-控制台 相关的页面
This commit is contained in:
@@ -17,6 +17,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { writeClipboardText } from '../../../helpers/clipboard';
|
||||
import React, { useEffect, useState, useCallback, useRef } from 'react';
|
||||
import { API, showError } from '../../../helpers';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -361,14 +362,14 @@ const DocumentRenderer = ({
|
||||
a.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
const url = `${window.location.origin}${window.location.pathname}#${id}`;
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(url).catch(() => {});
|
||||
}
|
||||
writeClipboardText(url).catch(() => {
|
||||
showError(t('复制失败,请手动复制'));
|
||||
});
|
||||
history.replaceState(null, '', `#${id}`);
|
||||
});
|
||||
h.prepend(a);
|
||||
});
|
||||
}, [isEmbedded, loading, content, processedHtmlContent]);
|
||||
}, [isEmbedded, loading, content, processedHtmlContent, t]);
|
||||
|
||||
// 文档内容样式(prose)—— 同时兼顾浅色与深色
|
||||
const proseClass = `prose prose-base dark:prose-invert max-w-none
|
||||
|
||||
@@ -90,7 +90,11 @@ export default function LobeHubIcon({ iconName, size = 14 }) {
|
||||
if (typeof iconName === 'string') iconName = iconName.trim();
|
||||
// 如果没有图标名称,返回 Avatar
|
||||
if (!iconName) {
|
||||
return <Avatar size='extra-extra-small'>?</Avatar>;
|
||||
return (
|
||||
<Avatar size={size} gap={0} style={{ fontSize: size * 0.65 }}>
|
||||
?
|
||||
</Avatar>
|
||||
);
|
||||
}
|
||||
|
||||
// 解析组件路径与点号链式属性
|
||||
@@ -115,7 +119,11 @@ export default function LobeHubIcon({ iconName, size = 14 }) {
|
||||
(typeof IconComponent !== 'function' && typeof IconComponent !== 'object')
|
||||
) {
|
||||
const firstLetter = String(iconName).charAt(0).toUpperCase();
|
||||
return <Avatar size='extra-extra-small'>{firstLetter}</Avatar>;
|
||||
return (
|
||||
<Avatar size={size} gap={0} style={{ fontSize: size * 0.65 }}>
|
||||
{firstLetter}
|
||||
</Avatar>
|
||||
);
|
||||
}
|
||||
|
||||
// 解析点号链式属性,形如:key={...}、key='...'、key="..."、key=123、key、key=true/false
|
||||
|
||||
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { Alert, Button, Checkbox, Modal, Tooltip, theme } from 'antd';
|
||||
import { Settings } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import './column-settings.css';
|
||||
|
||||
const titleText = (title) =>
|
||||
React.Children.toArray(title)
|
||||
.map((child) =>
|
||||
React.isValidElement(child) ? titleText(child.props.children) : child,
|
||||
)
|
||||
.join('');
|
||||
|
||||
const columnOptions = (columns) =>
|
||||
columns.map((column) => ({
|
||||
value: column.key,
|
||||
label: column.label ?? titleText(column.title),
|
||||
disabled: column.disabled,
|
||||
}));
|
||||
|
||||
const selectedKeys = (options, value) =>
|
||||
options
|
||||
.filter((option) => value.includes(option.value))
|
||||
.map((option) => option.value);
|
||||
|
||||
export function ColumnSettingsButton({ onClick, open = false }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Tooltip title={t('列设置')}>
|
||||
<Button
|
||||
className='table-column-settings-trigger'
|
||||
type='text'
|
||||
size='middle'
|
||||
aria-label={t('列设置')}
|
||||
aria-haspopup='dialog'
|
||||
aria-expanded={open}
|
||||
icon={<Settings size={16} />}
|
||||
onClick={onClick}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
export function ColumnSettingsModal({
|
||||
open,
|
||||
onCancel,
|
||||
columns,
|
||||
value,
|
||||
defaultValue,
|
||||
onConfirm,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const { token } = theme.useToken();
|
||||
const options = columnOptions(columns);
|
||||
const [session, setSession] = useState({
|
||||
open: false,
|
||||
draft: [],
|
||||
error: false,
|
||||
});
|
||||
|
||||
// Snapshot on opening only: background table refreshes must not reset the draft.
|
||||
if (session.open !== open) {
|
||||
setSession({ open, draft: selectedKeys(options, value), error: false });
|
||||
}
|
||||
const draft = selectedKeys(options, session.draft);
|
||||
const selectable = options.filter((option) => !option.disabled);
|
||||
const checkedCount = selectable.filter((option) =>
|
||||
draft.includes(option.value),
|
||||
).length;
|
||||
const changeDraft = (keys) => setSession({ open, draft: keys, error: false });
|
||||
const confirm = () => {
|
||||
if (!draft.length) {
|
||||
setSession({ ...session, error: true });
|
||||
return;
|
||||
}
|
||||
onConfirm(draft);
|
||||
onCancel();
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
open={open}
|
||||
title={t('列设置')}
|
||||
width={520}
|
||||
rootClassName='table-column-settings'
|
||||
className='table-column-settings-dialog'
|
||||
style={{
|
||||
'--cs-theme-text': token.colorText,
|
||||
'--cs-theme-border': token.colorBorderSecondary,
|
||||
}}
|
||||
onCancel={onCancel}
|
||||
maskClosable
|
||||
keyboard
|
||||
footer={
|
||||
<div className='table-column-settings-footer'>
|
||||
<Button
|
||||
onClick={() => changeDraft(selectedKeys(options, defaultValue))}
|
||||
>
|
||||
{t('重置')}
|
||||
</Button>
|
||||
<Button onClick={onCancel}>{t('取消')}</Button>
|
||||
<Button type='primary' onClick={confirm}>
|
||||
{t('确定')}
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className='table-column-settings-all'>
|
||||
<Checkbox
|
||||
checked={selectable.length > 0 && checkedCount === selectable.length}
|
||||
indeterminate={checkedCount > 0 && checkedCount < selectable.length}
|
||||
disabled={!selectable.length}
|
||||
onChange={(event) =>
|
||||
changeDraft(
|
||||
options
|
||||
.filter((option) =>
|
||||
option.disabled
|
||||
? draft.includes(option.value)
|
||||
: event.target.checked,
|
||||
)
|
||||
.map((option) => option.value),
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('全选')}
|
||||
</Checkbox>
|
||||
</div>
|
||||
<Checkbox.Group
|
||||
className='table-column-settings-grid'
|
||||
options={options}
|
||||
value={draft}
|
||||
onChange={changeDraft}
|
||||
/>
|
||||
{session.error && (
|
||||
<Alert
|
||||
className='table-column-settings-error'
|
||||
type='error'
|
||||
showIcon
|
||||
message={t('请至少保留一列')}
|
||||
/>
|
||||
)}
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
export function ColumnVisibilitySettings({
|
||||
showColumnSelector,
|
||||
setShowColumnSelector,
|
||||
columns,
|
||||
visibleColumns,
|
||||
setVisibleColumns,
|
||||
getDefaultColumnVisibility,
|
||||
}) {
|
||||
const defaults = getDefaultColumnVisibility();
|
||||
return (
|
||||
<ColumnSettingsModal
|
||||
open={showColumnSelector}
|
||||
onCancel={() => setShowColumnSelector(false)}
|
||||
columns={columns}
|
||||
value={columns
|
||||
.filter((column) => visibleColumns[column.key])
|
||||
.map((column) => column.key)}
|
||||
defaultValue={columns
|
||||
.filter((column) => defaults[column.key])
|
||||
.map((column) => column.key)}
|
||||
onConfirm={(keys) =>
|
||||
setVisibleColumns((current) => ({
|
||||
...current,
|
||||
...Object.fromEntries(
|
||||
columns.map((column) => [column.key, keys.includes(column.key)]),
|
||||
),
|
||||
}))
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default function TableColumnSettings({
|
||||
columns,
|
||||
value,
|
||||
defaultValue,
|
||||
onChange,
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
return (
|
||||
<>
|
||||
<ColumnSettingsButton open={open} onClick={() => setOpen(true)} />
|
||||
<ColumnSettingsModal
|
||||
open={open}
|
||||
onCancel={() => setOpen(false)}
|
||||
columns={columns}
|
||||
value={value}
|
||||
defaultValue={defaultValue}
|
||||
onConfirm={onChange}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Button } from 'antd';
|
||||
import { Search } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import './filter-search-button.css';
|
||||
|
||||
export default function FilterSearchButton({
|
||||
loading,
|
||||
htmlType = 'submit',
|
||||
onClick,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Button
|
||||
className='filter-search-button'
|
||||
type='primary'
|
||||
htmlType={htmlType}
|
||||
onClick={onClick}
|
||||
size='middle'
|
||||
loading={loading}
|
||||
icon={<Search size={14} />}
|
||||
>
|
||||
{t('搜索')}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useLayoutEffect, useRef, useState } from 'react';
|
||||
import { Empty } from 'antd';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import './table-empty.css';
|
||||
|
||||
export default function TableEmpty() {
|
||||
const { t } = useTranslation();
|
||||
const ref = useRef(null);
|
||||
const [width, setWidth] = useState(undefined);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const viewport = ref.current?.closest('.ant-table-container');
|
||||
if (!viewport) return;
|
||||
// Keep the empty state centered in the visible area of a wide, scrollable table.
|
||||
const resize = () => setWidth(viewport.clientWidth || undefined);
|
||||
resize();
|
||||
const observer = new ResizeObserver(resize);
|
||||
observer.observe(viewport);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div ref={ref} className='table-empty-state' style={{ width }}>
|
||||
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description={t('暂无数据')} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Copyright (C) 2025 QuantumNous
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import './table-toolbar.css';
|
||||
|
||||
export function TableTitle({ children }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<h2 className='table-toolbar-title'>
|
||||
{typeof children === 'string' ? t(children) : children}
|
||||
</h2>
|
||||
);
|
||||
}
|
||||
|
||||
export default function TableToolbar({ title, children }) {
|
||||
return (
|
||||
<div className='table-toolbar'>
|
||||
<TableTitle>{title}</TableTitle>
|
||||
{children && <div className='table-toolbar-actions'>{children}</div>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
.table-column-settings {
|
||||
--cs-mask: rgba(0, 0, 0, 0.3);
|
||||
--cs-text: rgba(0, 0, 0, 0.88);
|
||||
--cs-border: #e9edf2;
|
||||
--cs-space: 8px;
|
||||
--cs-column-gap: 20px;
|
||||
--cs-row-gap: 16px;
|
||||
}
|
||||
|
||||
html.dark .table-column-settings-dialog {
|
||||
--cs-text: var(--cs-theme-text);
|
||||
--cs-border: var(--cs-theme-border);
|
||||
}
|
||||
|
||||
.table-column-settings .ant-modal-mask {
|
||||
background: var(--cs-mask);
|
||||
backdrop-filter: blur(4px);
|
||||
}
|
||||
|
||||
.table-column-settings-dialog.ant-modal {
|
||||
max-width: calc(100vw - 32px);
|
||||
}
|
||||
|
||||
.table-column-settings-dialog .ant-modal-content {
|
||||
padding: 20px 24px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.table-column-settings-dialog .ant-modal-header {
|
||||
margin-bottom: var(--cs-space);
|
||||
}
|
||||
|
||||
.table-column-settings-dialog .ant-modal-title {
|
||||
color: var(--cs-text);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.table-column-settings-dialog .ant-modal-body {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.table-column-settings-all {
|
||||
padding: 14px 0;
|
||||
margin-bottom: 18px;
|
||||
border-bottom: 1px solid var(--cs-border);
|
||||
}
|
||||
|
||||
.table-column-settings-grid.ant-checkbox-group {
|
||||
display: grid;
|
||||
width: 100%;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: var(--cs-row-gap) var(--cs-column-gap);
|
||||
padding: 4px 0 12px;
|
||||
}
|
||||
|
||||
.table-column-settings-dialog .ant-checkbox-wrapper {
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
color: var(--cs-text);
|
||||
font-size: 14px;
|
||||
line-height: 22px;
|
||||
}
|
||||
|
||||
.table-column-settings-dialog .ant-checkbox-inner {
|
||||
width: 17px;
|
||||
height: 17px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.table-column-settings-dialog .ant-modal-footer {
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.table-column-settings-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--cs-space);
|
||||
}
|
||||
|
||||
.table-column-settings-footer .ant-btn {
|
||||
height: 34px;
|
||||
margin: 0;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.table-column-settings-footer .ant-btn-default {
|
||||
color: var(--cs-text);
|
||||
}
|
||||
|
||||
.table-column-settings-error {
|
||||
margin-top: var(--cs-row-gap);
|
||||
}
|
||||
|
||||
.table-column-settings-trigger.ant-btn {
|
||||
flex: 0 0 auto;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
|
||||
.table-column-toolbar {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
@media (max-width: 575px) {
|
||||
.table-column-settings-grid.ant-checkbox-group {
|
||||
gap: 14px 10px;
|
||||
}
|
||||
|
||||
.table-column-settings-dialog .ant-checkbox-wrapper {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
.console-page .filter-search-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.console-page .filter-search-button > .ant-btn-icon {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.console-page .filter-search-button .lucide {
|
||||
display: block;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/* Match the consumption record's labels, grid and action placement. */
|
||||
.log-filter-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
}
|
||||
.log-filter-wide {
|
||||
grid-column: span 2;
|
||||
}
|
||||
.log-filter-form .ant-form-item {
|
||||
min-width: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.log-filter-form .ant-form-item-label {
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.log-filter-form .ant-form-item-label > label {
|
||||
height: 21px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
.log-filter-form :is(.ant-picker, .ant-select) {
|
||||
width: 100%;
|
||||
}
|
||||
.log-filter-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
.log-filter-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
}
|
||||
.console-page .console-search-card .log-filter-form {
|
||||
display: block;
|
||||
}
|
||||
.console-page .log-filter-form .ant-form-item-label > label {
|
||||
height: 21px;
|
||||
font-size: 13px;
|
||||
line-height: 21px;
|
||||
}
|
||||
@media (max-width: 1200px) {
|
||||
.log-filter-grid {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.log-filter-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
.log-filter-wide {
|
||||
grid-column: auto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
.ant-table-wrapper
|
||||
.ant-table
|
||||
.ant-table-tbody
|
||||
> .ant-table-placeholder:has(.table-empty-state)
|
||||
> td.ant-table-cell {
|
||||
padding: 0;
|
||||
height: 172px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ant-table-wrapper .ant-table-expanded-row-fixed:has(> .table-empty-state) {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.table-empty-state {
|
||||
position: sticky;
|
||||
left: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
height: 172px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.table-empty-state > .ant-empty,
|
||||
.ant-table-wrapper .ant-table-placeholder .table-empty-state > .ant-empty {
|
||||
margin: 0;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
.table-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
min-height: 34px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
h2.table-toolbar-title {
|
||||
flex-shrink: 0;
|
||||
margin: 0;
|
||||
color: var(--console-heading, var(--uc-heading, var(--ui-color-text-0)));
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 1.5714;
|
||||
}
|
||||
|
||||
.table-toolbar-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-inline-start: auto;
|
||||
}
|
||||
|
||||
.console-page .table-toolbar .ant-btn:not(.ant-btn-link):not(.ant-btn-text) {
|
||||
min-height: var(--console-control-height);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.console-list-toolbar .console-list-actions-offset {
|
||||
margin-inline-start: 20px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.console-list-toolbar .console-list-actions-offset {
|
||||
flex-basis: calc(100% - 20px);
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,9 @@ import { Card, Divider, Button } from '@/components/ui';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { IconEyeOpened, IconEyeClosed } from '@/components/ui/icons';
|
||||
import { useConsolePage } from '../../console/ConsoleContext';
|
||||
import ConsoleCollection from '../../console/ConsoleCollection';
|
||||
import TableToolbar from '../table/TableToolbar';
|
||||
|
||||
/**
|
||||
* CardPro 高级卡片组件
|
||||
@@ -49,6 +52,9 @@ const CardPro = ({
|
||||
tabsArea,
|
||||
actionsArea,
|
||||
searchArea,
|
||||
tableActions,
|
||||
tableTitle,
|
||||
tableActionsOffset = false,
|
||||
paginationArea, // 新增分页区域
|
||||
// 卡片属性
|
||||
shadows,
|
||||
@@ -59,6 +65,7 @@ const CardPro = ({
|
||||
t = (key) => key,
|
||||
...props
|
||||
}) => {
|
||||
const consolePage = useConsolePage();
|
||||
const isMobile = useIsMobile();
|
||||
const [showMobileActions, setShowMobileActions] = useState(false);
|
||||
|
||||
@@ -156,6 +163,24 @@ const CardPro = ({
|
||||
|
||||
const footerContent = renderFooter();
|
||||
|
||||
if (consolePage) {
|
||||
return (
|
||||
<ConsoleCollection
|
||||
statsArea={statsArea}
|
||||
descriptionArea={descriptionArea}
|
||||
tabsArea={tabsArea}
|
||||
actionsArea={actionsArea}
|
||||
searchArea={searchArea}
|
||||
tableActions={tableActions}
|
||||
tableTitle={tableTitle}
|
||||
tableActionsOffset={tableActionsOffset}
|
||||
paginationArea={paginationArea}
|
||||
>
|
||||
{children}
|
||||
</ConsoleCollection>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
className={`table-scroll-card !rounded-2xl ${className}`}
|
||||
@@ -166,6 +191,11 @@ const CardPro = ({
|
||||
style={style}
|
||||
{...props}
|
||||
>
|
||||
{tableTitle ? (
|
||||
<TableToolbar title={tableTitle}>{tableActions}</TableToolbar>
|
||||
) : tableActions ? (
|
||||
<div className='table-column-toolbar'>{tableActions}</div>
|
||||
) : null}
|
||||
{children}
|
||||
</Card>
|
||||
);
|
||||
@@ -188,6 +218,9 @@ CardPro.propTypes = {
|
||||
PropTypes.arrayOf(PropTypes.node),
|
||||
]),
|
||||
searchArea: PropTypes.node,
|
||||
tableActions: PropTypes.node,
|
||||
tableTitle: PropTypes.node,
|
||||
tableActionsOffset: PropTypes.bool,
|
||||
paginationArea: PropTypes.node,
|
||||
// 表格内容
|
||||
children: PropTypes.node,
|
||||
|
||||
@@ -33,6 +33,7 @@ import { IconChevronDown, IconChevronUp } from '@/components/ui/icons';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { useMinimumLoadingTime } from '../../../hooks/common/useMinimumLoadingTime';
|
||||
import { useConsolePage } from '../../console/ConsoleContext';
|
||||
|
||||
/**
|
||||
* CardTable 响应式表格组件
|
||||
@@ -48,6 +49,7 @@ const CardTable = ({
|
||||
hidePagination = false,
|
||||
...tableProps
|
||||
}) => {
|
||||
const consolePage = useConsolePage();
|
||||
const isMobile = useIsMobile();
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -103,7 +105,7 @@ const CardTable = ({
|
||||
selectableKeys.length > 0 &&
|
||||
selectableKeys.every((key) => selectedKeys.includes(key));
|
||||
|
||||
if (!isMobile) {
|
||||
if (!isMobile || consolePage) {
|
||||
const finalTableProps = hidePagination
|
||||
? { ...tableProps, pagination: false }
|
||||
: tableProps;
|
||||
|
||||
@@ -20,7 +20,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Card, Button, Typography, Tag } from '@/components/ui';
|
||||
import { copy, showSuccess } from '../../../helpers';
|
||||
import { copy, showError, showSuccess } from '../../../helpers';
|
||||
|
||||
/**
|
||||
* 解析密钥数据,支持多种格式
|
||||
@@ -95,14 +95,14 @@ const ChannelKeyDisplay = ({
|
||||
const parsedKeys = parseChannelKeys(keyData, t);
|
||||
const isMultipleKeys = parsedKeys.length > 1;
|
||||
|
||||
const handleCopyAll = () => {
|
||||
copy(keyData);
|
||||
showSuccess(t('所有密钥已复制到剪贴板'));
|
||||
const handleCopyAll = async () => {
|
||||
if (await copy(keyData)) showSuccess(t('所有密钥已复制到剪贴板'));
|
||||
else showError(t('复制失败,请手动复制'));
|
||||
};
|
||||
|
||||
const handleCopyKey = (content) => {
|
||||
copy(content);
|
||||
showSuccess(t('密钥已复制到剪贴板'));
|
||||
const handleCopyKey = async (content) => {
|
||||
if (await copy(content)) showSuccess(t('密钥已复制到剪贴板'));
|
||||
else showError(t('复制失败,请手动复制'));
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -21,6 +21,7 @@ import React from 'react';
|
||||
import { Button } from '@/components/ui';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useIsMobile } from '../../../hooks/common/useIsMobile';
|
||||
import { useConsolePage } from '../../console/ConsoleContext';
|
||||
|
||||
/**
|
||||
* 紧凑模式切换按钮组件
|
||||
@@ -37,9 +38,10 @@ const CompactModeToggle = ({
|
||||
...props
|
||||
}) => {
|
||||
const isMobile = useIsMobile();
|
||||
const consolePage = useConsolePage();
|
||||
|
||||
// 在移动端隐藏紧凑列表切换按钮
|
||||
if (isMobile) {
|
||||
// Console lists keep their stored density, but no longer expose a toggle.
|
||||
if (isMobile || consolePage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ const JSONEditor = ({
|
||||
template,
|
||||
templateLabel,
|
||||
editorType = 'keyValue',
|
||||
objectValueAutoSize,
|
||||
rules = [],
|
||||
formApi = null,
|
||||
...props
|
||||
@@ -368,6 +369,7 @@ const JSONEditor = ({
|
||||
return (
|
||||
<TextArea
|
||||
rows={2}
|
||||
autosize={objectValueAutoSize}
|
||||
value={JSON.stringify(value, null, 2)}
|
||||
onChange={(txt) => {
|
||||
try {
|
||||
@@ -407,7 +409,7 @@ const JSONEditor = ({
|
||||
// 渲染键值对编辑器
|
||||
const renderKeyValueEditor = () => {
|
||||
return (
|
||||
<div className='space-y-1'>
|
||||
<div className='json-editor-pairs space-y-1'>
|
||||
{/* 重复键警告 */}
|
||||
{duplicateKeys.size > 0 && (
|
||||
<Banner
|
||||
@@ -442,7 +444,12 @@ const JSONEditor = ({
|
||||
keyValuePairs.slice(index + 1).every((p) => p.key !== pair.key);
|
||||
|
||||
return (
|
||||
<Row key={pair.id} gutter={8} align='middle'>
|
||||
<Row
|
||||
key={pair.id}
|
||||
gutter={8}
|
||||
align='middle'
|
||||
className='json-editor-pair'
|
||||
>
|
||||
<Col span={10}>
|
||||
<div className='relative'>
|
||||
<Input
|
||||
@@ -486,7 +493,7 @@ const JSONEditor = ({
|
||||
);
|
||||
})}
|
||||
|
||||
<div className='mt-2 flex justify-center'>
|
||||
<div className='json-editor-add mt-2 flex justify-center'>
|
||||
<Button
|
||||
icon={<IconPlus />}
|
||||
type='primary'
|
||||
@@ -568,7 +575,10 @@ const JSONEditor = ({
|
||||
<Tooltip content={t('重复的键名')}>
|
||||
<IconAlertTriangle
|
||||
className='absolute right-2 top-1/2 transform -translate-y-1/2'
|
||||
style={{ color: 'var(--ui-color-warning)', fontSize: '14px' }}
|
||||
style={{
|
||||
color: 'var(--ui-color-warning)',
|
||||
fontSize: '14px',
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
@@ -628,8 +638,9 @@ const JSONEditor = ({
|
||||
<Form.Slot label={label}>
|
||||
<Card
|
||||
header={
|
||||
<div className='flex justify-between items-center'>
|
||||
<div className='json-editor-header flex justify-between items-center'>
|
||||
<Tabs
|
||||
className='json-editor-tabs'
|
||||
type='slash'
|
||||
activeKey={editMode}
|
||||
onChange={(key) => {
|
||||
@@ -651,7 +662,9 @@ const JSONEditor = ({
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
headerStyle={{ padding: '12px 16px' }}
|
||||
headerStyle={{
|
||||
padding: 'var(--json-editor-header-padding, 12px 16px)',
|
||||
}}
|
||||
bodyStyle={{ padding: '16px' }}
|
||||
className='!rounded-2xl'
|
||||
>
|
||||
@@ -670,6 +683,7 @@ const JSONEditor = ({
|
||||
{renderVisualEditor()}
|
||||
{/* 隐藏的Form字段用于验证和数据绑定 */}
|
||||
<Form.Input
|
||||
className='json-editor-bound-field'
|
||||
field={field}
|
||||
value={value}
|
||||
rules={rules}
|
||||
@@ -689,6 +703,7 @@ const JSONEditor = ({
|
||||
/>
|
||||
{/* 隐藏的Form字段用于验证和数据绑定 */}
|
||||
<Form.Input
|
||||
className='json-editor-bound-field'
|
||||
field={field}
|
||||
value={value}
|
||||
rules={rules}
|
||||
@@ -701,7 +716,7 @@ const JSONEditor = ({
|
||||
|
||||
{/* 额外文本显示在卡片底部 */}
|
||||
{extraText && (
|
||||
<Divider margin='12px' align='center'>
|
||||
<Divider margin='var(--json-editor-note-margin, 12px)' align='center'>
|
||||
<Text type='tertiary' size='small'>
|
||||
{extraText}
|
||||
</Text>
|
||||
|
||||
Reference in New Issue
Block a user