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

@@ -19,21 +19,21 @@ import { describe, it, expect } from 'vitest';
import { safeJsonParse } from '../../src/utils/safe-json-parse';
describe('utils-safe-json-parse', () => {
// 测试正常解析 JSON 字符串
// Test parsing JSON string normally
it('should parse valid JSON string', () => {
const jsonString = '{"key": "value"}';
const result = safeJsonParse(jsonString);
expect(result).toEqual({ key: 'value' });
});
// 测试解析无效 JSON 字符串
// Test parsing invalid JSON string
it('should return undefined when parsing invalid JSON string', () => {
const invalidJsonString = '{key: "value"}';
const result = safeJsonParse(invalidJsonString);
expect(result).toBeUndefined();
});
// 测试空字符串输入
// Test empty string input
it('should return emptyValue when input is an empty string', () => {
const emptyString = '';
const emptyValue = {};

View File

@@ -28,19 +28,19 @@ import css from './panel.module.less';
interface BasePanelProps {
className?: string;
/**
* 面板头,不传不渲染
* Panel header, no pass and no render
*/
header?: React.ReactNode;
/**
* 面板脚,不传不渲染
* Panel foot, do not pass and do not render
*/
footer?: React.ReactNode;
/**
* 默认初始高度,不支持响应式
* Default initial height, does not support responsive
*/
height?: number;
/**
* 是否可拖拽改变高度
* Can you drag and drop to change the height?
*/
resizable?:
| boolean
@@ -49,7 +49,7 @@ interface BasePanelProps {
max?: number;
};
/**
* 点击关闭事件,仅当渲染面板头时可能触发
* Click to close the event, which may only be triggered when rendering the panel header
*/
onClose?: () => void;
}

View File

@@ -25,26 +25,26 @@ interface Config {
}
/**
* 目前仅支持高度可变
* Currently only highly variable is supported
*/
export const useResize = (config: Config) => {
const [dragging, setDragging] = useState(false);
const [height, setHeight] = useState(config.default);
const ref = useRef<HTMLDivElement>(null);
/**
* 拖拽过程中
* Dragging process
*/
const resizing = useRef(false);
/**
* y 轴变化
* Y-axis variation
*/
const startY = useRef(0);
/** 开始位置 */
/** starting position */
const start = useRef(0);
const handleMouseMove = useMemoizedFn(e => {
if (resizing.current) {
const newHeight = start.current - (e.clientY - startY.current); // 计算新的高度
const newHeight = start.current - (e.clientY - startY.current); // Calculate the new height
if (config.max && newHeight > config.max) {
setHeight(config.max);
} else if (config.min && newHeight < config.min) {
@@ -57,17 +57,17 @@ export const useResize = (config: Config) => {
const handleMouseUp = useCallback(() => {
resizing.current = false;
setDragging(false);
document.removeEventListener('mousemove', handleMouseMove); // 取消监听
document.removeEventListener('mouseup', handleMouseUp); // 取消监听
document.removeEventListener('mousemove', handleMouseMove); // Cancel listening
document.removeEventListener('mouseup', handleMouseUp); // Cancel listening
}, [handleMouseMove]);
const handleMouseDown = useMemoizedFn(e => {
resizing.current = true;
setDragging(true);
startY.current = e.clientY; // 记录鼠标开始拖拽时的 Y 轴坐标
startY.current = e.clientY; // Record the Y-axis coordinates when the mouse starts dragging
start.current = ref.current?.offsetHeight || 0;
document.addEventListener('mousemove', handleMouseMove); // 监听鼠标移动事件
document.addEventListener('mouseup', handleMouseUp); // 监听鼠标抬起事件
document.addEventListener('mousemove', handleMouseMove); // Monitor mouse movement events
document.addEventListener('mouseup', handleMouseUp); // Monitor mouse lift events
});
return {

View File

@@ -23,7 +23,7 @@ interface DebugUrlParams {
}
/**
* 计算 DebugUrl
* Calculate DebugUrl
*/
const getDebugUrl = (params: DebugUrlParams) => {
const { spaceId, workflowId, executeId, subExecuteId, nodeId } = params;