chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -19,7 +19,7 @@ const styleFile = path.join(componentDir, `${setterName}.module.less`);
|
||||
const packageIndexFile = path.join(__dirname, '..', 'src', 'index.ts');
|
||||
const componentName = pascalize(setterName);
|
||||
|
||||
// 创建组件目录
|
||||
// Create component catalog
|
||||
if (fs.existsSync(componentDir)) {
|
||||
console.error('can not created because this setter existed.');
|
||||
process.exit(1);
|
||||
@@ -27,12 +27,12 @@ if (fs.existsSync(componentDir)) {
|
||||
|
||||
fs.mkdirSync(componentDir);
|
||||
|
||||
// 创建 index.ts 文件
|
||||
// Create the index.ts file
|
||||
const indexContent = `export { ${componentName} } from './${setterName}';
|
||||
export type { ${componentName}Options } from './${setterName}';`;
|
||||
fs.writeFileSync(indexFile, indexContent);
|
||||
|
||||
// 创建 {setterName}.tsx 文件
|
||||
// Create the {setterName} .tsx file
|
||||
const componentContent = `import type { Setter } from '../types';
|
||||
|
||||
import styles from './${setterName}.module.less';
|
||||
@@ -45,7 +45,7 @@ export const ${componentName}: Setter<string, ${componentName}Options> = ({value
|
||||
`;
|
||||
fs.writeFileSync(componentFile, componentContent);
|
||||
|
||||
// 创建 index.stories.tsx 文件
|
||||
// Create the index.stories.tsx file
|
||||
const storiesContent = `import type { StoryObj, Meta } from '@storybook/react';
|
||||
import { useArgs } from '@storybook/preview-api';
|
||||
|
||||
@@ -79,7 +79,7 @@ type Story = StoryObj<typeof ${componentName}>;
|
||||
export const Base: Story = {};`;
|
||||
fs.writeFileSync(storiesFile, storiesContent);
|
||||
|
||||
// 创建 index.test.tsx 文件
|
||||
// Create the index.test.tsx file
|
||||
const testContent = `import '@testing-library/jest-dom';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
@@ -101,14 +101,14 @@ describe('${componentName} Setter', () => {
|
||||
`;
|
||||
fs.writeFileSync(testFile, testContent);
|
||||
|
||||
// 创建 {setterName}.module.less 文件
|
||||
// Create the {setterName} .module.less file
|
||||
const styleContent = `.${setterName} {
|
||||
// Your styles here
|
||||
}
|
||||
`;
|
||||
fs.writeFileSync(styleFile, styleContent);
|
||||
|
||||
// 在包入口追加setter到导出
|
||||
// Append setter to export in package entry
|
||||
const packageIndexAppendedExportContent = `export { ${componentName} } from './${setterName}';
|
||||
export type { ${componentName}Options } from './${setterName}';`;
|
||||
fs.appendFileSync(packageIndexFile, packageIndexAppendedExportContent);
|
||||
|
||||
@@ -32,13 +32,13 @@ export interface ArrayOptions {
|
||||
getDefaultAppendValue?: () => any;
|
||||
fields?: Field[];
|
||||
|
||||
/** 入参最大数量,若没有提供,默认为整数最大值 */
|
||||
/** The maximum number of imported parameters, if not provided, defaults to the maximum integer value */
|
||||
maxItems?: number;
|
||||
|
||||
/** 入参最小数量,若没有提供,默认为 0 */
|
||||
/** The minimum number of imported parameters, if not provided, the default is 0 */
|
||||
minItems?: number;
|
||||
|
||||
/** 单条是否可删除 */
|
||||
/** Can a single item be deleted? */
|
||||
disableDeleteItem?: ((value: unknown, index: number) => boolean) | boolean;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ export const Array: Setter<Array<any>, ArrayOptions> = ({
|
||||
const [currentAddIndex, setCurrentAddIndex] = useState<number | undefined>();
|
||||
const { node, meta } = context || {};
|
||||
|
||||
// 后端返回的 value 可能为 null,此时不会赋值给 [],这里重新兜底下
|
||||
// The value returned by the backend may be null, and it will not be assigned to [] at this time. Here is the bottom line again.
|
||||
const originValue = value || [];
|
||||
|
||||
const add = () => {
|
||||
|
||||
@@ -34,11 +34,11 @@ async function clickNumberButtonUp(container: HTMLElement) {
|
||||
}
|
||||
|
||||
async function clickNumberButton(container: HTMLElement, arrow: 'up' | 'down') {
|
||||
// 先触发 hover
|
||||
// Trigger the hover first
|
||||
const numberContainer = container.firstChild as HTMLElement;
|
||||
fireEvent.mouseEnter(numberContainer);
|
||||
|
||||
// 等待下一个事件循环
|
||||
// Wait for the next event loop
|
||||
await Promise.resolve();
|
||||
|
||||
const upButton = container.querySelector(
|
||||
|
||||
@@ -27,7 +27,7 @@ export interface StringOptions {
|
||||
placeholder?: string;
|
||||
width?: number | string;
|
||||
maxCount?: number;
|
||||
// 新增这个配置的原因是readonly样式带有输入框 有些场景需要只展示文本
|
||||
// The reason for adding this configuration is that the readonly style has a text box, and some scenes need to display only text.
|
||||
textMode?: boolean;
|
||||
testId?: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user