chore: replace all cn comments of fe to en version by volc api (#320)

This commit is contained in:
tecvan
2025-07-31 10:32:15 +08:00
committed by GitHub
parent 716ec0cba8
commit 71f6245a01
2960 changed files with 15545 additions and 15545 deletions

View File

@@ -26,12 +26,12 @@ export interface ActionsRenderProps {
index: number;
editProps?: {
disabled: boolean;
// 编辑回调
// edit callback
onEdit?: (record: TableViewRecord, index: number) => void;
};
deleteProps?: {
disabled: boolean;
// 删除回调
// Delete callback
onDelete?: (index: number) => void;
};
className?: string;

View File

@@ -25,20 +25,20 @@ import styles from './index.module.less';
export interface EditHeaderRenderProps {
value: string;
deleteProps?: {
// 禁用删除
// disable deletion
disabled: boolean;
// 删除回调
// Delete callback
onDelete?: (v: string) => void;
};
editProps?: {
// 编辑回调
// edit callback
onChange?: (v: string) => void;
// 失焦回调
// out of focus callback
onBlur?: (v: string) => void;
};
// 失焦回调
// out of focus callback
onBlur: (v: string) => void;
// 表头校验逻辑
// header check logic
validator: ValidatorProps;
editable?: boolean;
}
@@ -75,7 +75,7 @@ export const EditHeaderRender = ({
const isError = useMemo(() => validate && validate(value), [inputValue]);
return (
<div className={styles['edit-header-render']}>
{/* 编辑态组件 */}
{/* edit state component */}
{isEditCom && (
<UIInput
autoFocus
@@ -100,7 +100,7 @@ export const EditHeaderRender = ({
/>
)}
{/* 预览态组件 */}
{/* preview component */}
{!isEditCom && (
<div
className={styles['header-preview']}
@@ -110,7 +110,7 @@ export const EditHeaderRender = ({
</div>
)}
{/* 列删除按钮 */}
{/* column delete button */}
{editable && (
<UIButton
disabled={deleteDisabled}

View File

@@ -23,7 +23,7 @@ import styles from '../index.module.less';
import { useImagePreview } from './use-image-preview';
export interface ImageRenderProps {
srcList: string[];
// 图片是否可编辑,默认为false
// Whether the picture can be edited, the default is false
editable?: boolean;
onChange?: (tosKey: string, src: string) => void;
dataIndex?: string;
@@ -60,7 +60,7 @@ const ImageContainer = ({
}}
preview={false}
src={src}
// 失败时兜底图
// bottom line on failure
fallback={
<IconImageFailOutlined
className={styles['image-failed']}
@@ -70,7 +70,7 @@ const ImageContainer = ({
}}
/>
}
// 图片加载时的占位图,主要用于大图加载
// The placeholder map when the picture is loaded, mainly used for large image loading
placeholder={<div className="image-skeleton" onClick={onClick} />}
/>
))}

View File

@@ -74,7 +74,7 @@ export const useImagePreview = ({
return;
}
try {
// 业务
// business
const { name, fileInstance, url } = file;
setUploading(true);
if (fileInstance) {

View File

@@ -70,7 +70,7 @@ export const TextRender = ({
try {
await onBlur(inputValue, updateRecord, index);
} catch (e) {
// 更新失败,恢复原值
// Update failed, restore original value
console.log('update table content error', e);
setInputValue(String(value));
}
@@ -86,7 +86,7 @@ export const TextRender = ({
}
setInputValue(v);
};
// 校验状态
// check state
const isError = useMemo(
() => !!validate?.(String(inputValue), record, index),
[inputValue, validate],
@@ -113,7 +113,7 @@ export const TextRender = ({
className={`${styles['cell-text-render']} text-render-wrapper`}
data-testid={CommonE2e.CommonTableViewTextRender}
>
{/* 编辑态组件 */}
{/* edit state component */}
{isEditCom ? (
<span
className={`${styles['cell-text-edit']} ${
@@ -141,7 +141,7 @@ export const TextRender = ({
</span>
) : null}
{/* 预览态组件 */}
{/* preview component */}
{!isEditCom && (
<div
className={`${styles['cell-text-preview']} text-content`}

View File

@@ -42,7 +42,7 @@ export interface EditMenuProps {
};
onExit?: () => void | Promise<void>;
onDelete?: (indexs: (string | number)[]) => void | Promise<void>;
// 行操作编辑行的回调
// Line operations edit line callbacks
onEdit?: (
record: TableViewRecord,
index: string | number,

View File

@@ -9,9 +9,9 @@
.table-wrapper {
:global {
/** 公共样式 **/
/** Common Style **/
/** 重置table背景色 */
/** Reset table background color */
.semi-table-tbody>.semi-table-row,
.semi-table-thead>.semi-table-row>.semi-table-row-head,
.semi-table-tbody>.semi-table-row>.semi-table-cell-fixed-left,
@@ -37,7 +37,7 @@
}
/** table header样式 **/
/** Table header style **/
.semi-table-thead {
// 拖拽列宽度的图标样式
&:hover {
@@ -85,13 +85,13 @@
}
}
/** table body部分样式 **/
/** Table body part style **/
.semi-table-tbody {
.semi-table-row {
>.semi-table-row-cell {
/**
* table 开启虚拟滚动后 单元格会加上 overflow: hidden
* 未开启虚拟滚动情况下正常展示溢出内容
* After table turns on virtual scrolling, the cell will be added with overflow: hidden.
* Display overflow content normally without virtual scrolling enabled
*/
overflow: visible;
border-top: 1px solid var(--coz-stroke-primary);

View File

@@ -52,40 +52,40 @@ import { EditMenu, EditToolBar } from './edit-menu';
import styles from './index.module.less';
export interface TableViewProps {
// 唯一标识表,且会作为列宽缓存map中的key值
// Uniquely identifies the table and is used as the key value in the column width cache map
tableKey?: string;
// 类名,用于样式覆盖
// Class name for style overrides
className?: string;
// 编辑配置
// Edit Configuration
editProps?: {
// 数据删除的回调,支持批量
// Callback for data deletion, batch support
onDelete?: (indexs: (string | number)[]) => void;
// 行操作编辑行的回调
// Line operations edit line callbacks
onEdit?: (record: TableViewRecord, index: string | number) => void;
};
// 滚动到底部的回调
// Scroll to the bottom of the callback
scrollToBottom?: () => void | Promise<void>;
// 拖拽钩子
// Drag hook
onResize?: (col: TableViewColumns) => void;
// 是否开启虚拟滚动,默认为false
// Whether to enable virtual scrolling, the default is false
isVirtualized?: boolean;
// 是否开启伸缩列,默认为false
// Whether to enable scaled columns, the default is false
resizable?: boolean;
// 是否开启行选择,默认为false
// Whether to enable line selection, the default is false
rowSelect?: boolean;
// 是否支持行操作,默认为false
// Whether line operations are supported, the default is false
rowOperation?: boolean;
// 数据
// data
dataSource: TableViewRecord[];
// 表头项
// header item
columns: TableViewColumns[];
// 数据为空的兜底展示
// The data is empty.
empty?: ReactNode;
// loading
loading?: boolean;
// 不消费仅用于触发渲染的state需优化
// No consumption, only used to trigger the rendered state, which needs to be optimized
resizeTriState?: number;
// 额外 tableProps
// Additional tableProps
tableProps?: TableProps;
}
export interface TableViewMethods {
@@ -204,7 +204,7 @@ export const TableView = forwardRef<TableViewMethods, TableViewProps>(
if (e.button === MOUSE_RIGHT_BTN && rowOperation) {
e.preventDefault();
const { offsetWidth, offsetHeight } = document.body;
// 如果右键位置非选中项,取消选中
// If the right-click position is not selected, uncheck it
if (
rowIndex &&
selected?.length &&
@@ -212,7 +212,7 @@ export const TableView = forwardRef<TableViewMethods, TableViewProps>(
) {
setSelected([]);
}
// 右键展示菜单
// right-click to display the menu
setFocusRow(rowIndex);
setMenuVisible(true);
setMenuStyle({
@@ -283,8 +283,8 @@ export const TableView = forwardRef<TableViewMethods, TableViewProps>(
scrollDirection === 'forward' &&
scrollOffset &&
/**
* 这一行一点余量都没留 可能在不同浏览器渲染下会有 bad case 导致无法满足条件
* 如果有遇到类似反馈可以优先排查这里
* This line has no margin at all, and there may be bad cases in different browsers that cannot meet the conditions.
* If you encounter similar feedback, you can give priority to checking here.
*/
scrollOffset + height - HEADER_SIZE >= tableData.length * ITEM_SIZE &&
!scrollUpdateWasRequested &&
@@ -330,7 +330,7 @@ export const TableView = forwardRef<TableViewMethods, TableViewProps>(
onResize: col =>
onResize ? onResize(col) : resizeFn(col),
onResizeStop: col => {
// resize完后缓存列宽
// Cache column width after resizing
const resizedCols = newColumns.map(oCol => {
if (oCol.dataIndex === col.dataIndex) {
return col;

View File

@@ -18,7 +18,7 @@ import { REPORT_EVENTS } from '@coze-arch/report-events';
import { CustomError } from '@coze-arch/bot-error';
/**
* 缓存列宽的方法类
* Method class with cache column width
*/
class ColWidthCacheService {
@@ -46,18 +46,18 @@ class ColWidthCacheService {
}
/**
* 初始化伸缩列缓存
* Initializing the scaled column cache
*/
initWidthMap() {
const widthMap = window.localStorage.getItem(this.mapName);
if (!widthMap) {
// 利用Map可记录键值对顺序的特性完成一个简易的LRU
// Completing a simple LRU using the characteristic that Map can record the order of key-value pairs
window.localStorage.setItem(this.mapName, this.mapToString(new Map()));
}
}
/**
* 设置列宽缓存,若超过缓存个数删除map中最近未使用的值
* Set the column width cache, if it exceeds the number of caches, delete the most recently unused value in the map
*/
setWidthMap(widthMap: Record<string, number>, tableKey?: string) {
if (!tableKey) {
@@ -68,11 +68,11 @@ class ColWidthCacheService {
window.localStorage.getItem(this.mapName) || '',
);
if (cacheWidthMap.has(tableKey)) {
// 存在即更新(删除后加入)
// Exist and update (join after deletion)
cacheWidthMap.delete(tableKey);
} else if (cacheWidthMap.size >= this.capacity) {
// 不存在即加入
// 缓存超过最大值,则移除最近没有使用的
// Join if you don't exist
// If the cache exceeds the maximum value, remove the recently unused
cacheWidthMap.delete(cacheWidthMap.keys().next().value);
}
cacheWidthMap.set(tableKey, widthMap);
@@ -89,7 +89,7 @@ class ColWidthCacheService {
}
/**
* 以表维度查询列宽缓存信息
* Query column width cache information in table dimension
* @param tableKey
*/
getTableWidthMap(tableKey: string) {
@@ -97,7 +97,7 @@ class ColWidthCacheService {
const cacheWidthMap = this.stringToMap(
window.localStorage.getItem(this.mapName) || '',
);
// 存在即更新
// exist and update
const temp = cacheWidthMap.get(tableKey);
cacheWidthMap.delete(tableKey);
cacheWidthMap.set(tableKey, temp);

View File

@@ -39,7 +39,7 @@ export interface GetRowOpConfig {
}
/**
* 表格列伸缩时的回调,用于限制伸缩边界
* Callbacks when table columns are scaled to limit the scaling boundaries
* @param column
* @returns
*/
@@ -64,7 +64,7 @@ export const getRowKey: RowKey<TableViewRecord> = (record?: TableViewRecord) =>
record?.tableViewKey || '';
/**
* 获取行操作配置
* Get row operation configuration
* @param record
* @param indexs
* @param onEdit