chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -120,7 +120,7 @@ export function UIEmpty({
|
||||
);
|
||||
}
|
||||
|
||||
// 无图场景下的原生用法
|
||||
// Native usage in non-graphic scenarios
|
||||
UIEmpty.Semi = Empty;
|
||||
|
||||
export default UIEmpty;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { FC, useRef } from 'react';
|
||||
|
||||
import cs from 'classnames';
|
||||
@@ -35,7 +35,7 @@ export const UIFormInput: FC<CommonFieldProps & InputProps> = ({
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
// @ts-expect-error ts 无法识别 css 自定义变量
|
||||
// @ts-expect-error ts cannot recognize css custom variable
|
||||
'--var-error-msg-offset': props.addonBefore
|
||||
? `${inputRef.current?.offsetLeft ?? 0}px`
|
||||
: '0px',
|
||||
|
||||
@@ -22,7 +22,7 @@ import { withField } from '@douyinfe/semi-ui';
|
||||
|
||||
import { UISelect } from '../../ui-select';
|
||||
|
||||
// UISelect 的 label 属性是提供给 borderless 主题使用的 表单场景下没有此主题,去掉这个属性避免和 form label 混合
|
||||
// The label attribute of UISelect is provided for the borderless theme. There is no such theme in the form scene. Remove this attribute to avoid mixing with the form label.
|
||||
const SelectInner: React.FC<
|
||||
Omit<ComponentProps<typeof UISelect>, 'label'>
|
||||
> = props => <UISelect {...props} />;
|
||||
|
||||
@@ -25,12 +25,12 @@ import s from './index.module.less';
|
||||
export interface UIIconButtonProps extends ButtonProps {
|
||||
wrapperClass?: string;
|
||||
/**
|
||||
* iconSize: 带hover大小,small:18、default:24、large:32
|
||||
* iconSize: with hover size, small: 18, default: 24, large: 32
|
||||
*/
|
||||
iconSize?: 'small' | 'default' | 'large';
|
||||
}
|
||||
|
||||
//图标按钮组件
|
||||
//icon button component
|
||||
export const UIIconButton = forwardRef(
|
||||
(
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ export type UIDragModalType =
|
||||
export type UIDragModalProps = ComponentProps<typeof Modal> & {
|
||||
type?: UIDragModalType;
|
||||
focusKey?: string;
|
||||
onWindowFocus?: (v: string) => void; // 当前窗口被点击时的回调
|
||||
onWindowFocus?: (v: string) => void; // Callback when the current window is clicked
|
||||
};
|
||||
|
||||
export const UIDragModal: FC<PropsWithChildren<UIDragModalProps>> = props => {
|
||||
|
||||
@@ -59,7 +59,7 @@ export const UIMobileModal = forwardRef(
|
||||
) => (
|
||||
<Modal
|
||||
{...props}
|
||||
// 对齐 UX 规范,点击半透明背景默认不关闭
|
||||
// Align the UX specification, click on the translucent background and do not close by default
|
||||
maskClosable={false}
|
||||
ref={ref}
|
||||
centered={centered}
|
||||
|
||||
@@ -56,7 +56,7 @@ export class UIModal extends Modal {
|
||||
return (
|
||||
<Modal
|
||||
{...props}
|
||||
// 对齐 UX 规范,点击半透明背景默认不关闭
|
||||
// Align the UX specification, click on the translucent background and do not close by default
|
||||
maskClosable={false}
|
||||
centered={centered}
|
||||
cancelButtonProps={{
|
||||
|
||||
@@ -27,7 +27,7 @@ export type UISearchInputProps = InputProps & {
|
||||
type InputRefType = HTMLInputElement | null;
|
||||
|
||||
/**
|
||||
* 搜索场景下的 Input 组件 结合 composition api 优化了中文输入场景
|
||||
* Input component in the search scene, combined with the composition API to optimize the Chinese input scene
|
||||
* @returns Input
|
||||
*/
|
||||
export const UISearchInput = forwardRef(
|
||||
|
||||
@@ -156,7 +156,7 @@ export const UISelect: ForwardRefExoticComponent<
|
||||
Omit<FilterProps & Omit<SelectProps, 'clickToHide'>, 'ref'> &
|
||||
RefAttributes<SemiSelectActions>
|
||||
> & {
|
||||
// follow Semi 组件命名
|
||||
// Name the following Semi components
|
||||
|
||||
OptGroup: typeof Select.OptGroup;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export const UITabBar: React.FC<PropsWithChildren<UITabBarProps>> = ({
|
||||
<div className={cs(s.header, containerClass)}>
|
||||
<Node {...innerProps} />
|
||||
|
||||
{/* 右侧工具栏,没有可不传children */}
|
||||
{/* Right toolbar, no children can be passed on. */}
|
||||
<div className={s['tool-bar']}>{children}</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -25,14 +25,14 @@ import s from './index.module.less';
|
||||
export interface UITableMetaProps {
|
||||
className?: string;
|
||||
avatarClassName?: string;
|
||||
icon_url?: string; //icon图标
|
||||
icon?: ReactElement; //支持传入icon标签
|
||||
name?: string; //名称
|
||||
description?: string; //描述
|
||||
suffix?: ReactElement; //额外元素
|
||||
icon_url?: string; //icon icon
|
||||
icon?: ReactElement; //Support for incoming icon tags
|
||||
name?: string; //name
|
||||
description?: string; //describe
|
||||
suffix?: ReactElement; //Extra Element
|
||||
}
|
||||
|
||||
//Table表头详情组件
|
||||
//Table header details component
|
||||
export const UITableMeta: React.FC<UITableMetaProps> = ({
|
||||
className,
|
||||
avatarClassName,
|
||||
|
||||
@@ -92,7 +92,7 @@ export const UITable = forwardRef<UITableMethods, UITableProps>(
|
||||
const showTable = initialized && !!dataSource?.length;
|
||||
|
||||
/**
|
||||
* TODO:处理触底加载,一坨💩,待优化
|
||||
* TODO: handle bottom loading, a lump of 💩, to be optimized
|
||||
*/
|
||||
const IndicatorRoot = useRef<Root>();
|
||||
|
||||
@@ -133,7 +133,7 @@ export const UITable = forwardRef<UITableMethods, UITableProps>(
|
||||
useEffect(() => {
|
||||
if (tableRef.current && enableLoad && needRenderIndicator) {
|
||||
const tableContainer =
|
||||
// FIXME: 这段代码这么多层 ref,需要优化
|
||||
// FIXME: This code has so many layers of refs and needs to be optimized
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(tableRef.current as any).tableRef.current.bodyWrapRef.current;
|
||||
|
||||
@@ -196,7 +196,7 @@ export const UITable = forwardRef<UITableMethods, UITableProps>(
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{/* 空状态 */}
|
||||
{/* empty state */}
|
||||
{initialized && !tableProps?.loading && !dataSource?.length ? (
|
||||
<div className={styles['empty-content']}>{empty}</div>
|
||||
) : null}
|
||||
@@ -205,7 +205,7 @@ export const UITable = forwardRef<UITableMethods, UITableProps>(
|
||||
},
|
||||
);
|
||||
|
||||
// Indicatore 组件
|
||||
// Indicatore component
|
||||
interface IndicatorState {
|
||||
done: boolean;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import { ToastFactory, Toast } from '@douyinfe/semi-ui';
|
||||
|
||||
import styles from './index.module.less';
|
||||
|
||||
// Toast展示位置离top 80px
|
||||
// Toast display 80px from the top
|
||||
Toast.config({
|
||||
top: 80,
|
||||
});
|
||||
@@ -61,9 +61,9 @@ function rewriteToastCreate(opts: ToastReactProps) {
|
||||
className: classNames(styles.container, className),
|
||||
icon: getIcon(),
|
||||
theme: 'light',
|
||||
// 默认不展示close图标
|
||||
// Default does not display close icon
|
||||
showClose: false,
|
||||
// Toast展示位置离top 80px
|
||||
// Toast display 80px from the top
|
||||
top: 80,
|
||||
...rest,
|
||||
}),
|
||||
@@ -83,7 +83,7 @@ function rewriteToastCreateAlias(type?: RequiredToastType) {
|
||||
return rewriteToastCreate(merge({}, opts, { type }));
|
||||
};
|
||||
}
|
||||
/* 重写Toast的方法 */
|
||||
/* How to Override Toast */
|
||||
UIToast.create = rewriteToastCreateAlias();
|
||||
UIToast.info = rewriteToastCreateAlias('info');
|
||||
UIToast.error = rewriteToastCreateAlias('error');
|
||||
|
||||
@@ -66,15 +66,15 @@ const useShouldUpdateAnchor = () => {
|
||||
|
||||
export interface GrabProps {
|
||||
/**
|
||||
* 拖拽的锚点
|
||||
* Drag anchor
|
||||
* @default grabTarget
|
||||
*/
|
||||
grabAnchor?: RefObject<HTMLDivElement>;
|
||||
/** 被拖拽移动的目标 */
|
||||
/** Dragged moving target */
|
||||
grabTarget: RefObject<HTMLDivElement>;
|
||||
/** 是否直接修改 style 达到移动的效果 */
|
||||
/** Whether to directly modify the style to achieve the effect of moving */
|
||||
isModifyStyle: boolean;
|
||||
/** 位置改变时的回调 */
|
||||
/** Callback when position changes */
|
||||
onPositionChange?: (param: { left: number; top: number }) => void;
|
||||
}
|
||||
|
||||
@@ -113,8 +113,8 @@ export const useGrab = ({
|
||||
e.preventDefault();
|
||||
|
||||
/**
|
||||
* 计算页面宽度和目标宽度, 和拖拽的位置进行比较
|
||||
* 避免将弹窗拖离页面
|
||||
* Calculate the page width and target width, and compare with the drag position
|
||||
* Avoid dragging pop-ups off the page
|
||||
*/
|
||||
const currentLeft = Math.min(
|
||||
Math.max(e.clientX - anchorOffsetX.current, 0),
|
||||
@@ -157,8 +157,8 @@ export const useGrab = ({
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* 计算鼠标在拖拽目标 dom 中的相对位置
|
||||
* 用于后续和全局鼠标位置进行差值计算得到拖拽位置
|
||||
* Calculate the relative position of the mouse in the drag target dom
|
||||
* Use for subsequent and global mouse position difference calculations to get the drag position
|
||||
*/
|
||||
const left = target.offsetLeft;
|
||||
const top = target.offsetTop;
|
||||
@@ -176,7 +176,7 @@ export const useGrab = ({
|
||||
const handleAnchorMouseDown = (e: MouseEvent) => {
|
||||
/**
|
||||
* https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/buttons
|
||||
* 只识别鼠标主按键(左键)按下
|
||||
* Only the main mouse button (left button) is recognized and pressed.
|
||||
*/
|
||||
if (e.button !== 0) {
|
||||
return;
|
||||
@@ -188,8 +188,8 @@ export const useGrab = ({
|
||||
};
|
||||
|
||||
/**
|
||||
* 当弹窗到达边界/由于 resize 导致弹窗超出边界后
|
||||
* 鼠标移动过程中需要更新 anchor 位置, 否则会出现鼠标移动但是弹窗位置不更新的问题
|
||||
* When the pop-up window reaches the boundary/after the pop-up window exceeds the boundary due to resize
|
||||
* The anchor position needs to be updated during the mouse movement, otherwise there will be a problem that the mouse moves but the pop-up window position is not updated.
|
||||
*/
|
||||
const handleAnchorMouseMove = (e: MouseEvent) => {
|
||||
if (!isGrabbingRef.current) {
|
||||
@@ -203,8 +203,8 @@ export const useGrab = ({
|
||||
updateGrabAnchorBuffer();
|
||||
|
||||
/**
|
||||
* 避免正常拖拽时 anchor 位置和全局鼠标位置同时变化
|
||||
* 导致差值计算后位置不更新
|
||||
* Avoid changing anchor position and global mouse position simultaneously during normal dragging
|
||||
* The position is not updated after the difference is calculated
|
||||
*/
|
||||
if (!getGrabAnchorBufferExceed()) {
|
||||
return;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
// re-export everything from semi ui
|
||||
// 这里保留具名导出,未来那些 component 需要做修改的时候,补充文件修改即可
|
||||
// Keep the named export here. When those components need to be modified in the future, you can modify the supplementary file.
|
||||
export {
|
||||
Anchor,
|
||||
AutoComplete,
|
||||
@@ -25,7 +25,7 @@ export {
|
||||
Badge,
|
||||
Banner,
|
||||
Breadcrumb,
|
||||
// FIXME: Button 这个名字已经被上层占用,需要先修复上层所有被调用的地方,之后才能导出这个组件
|
||||
// The name FIXME: Button has been taken by the upper layer. You need to fix all the places where the upper layer is called before exporting this component.
|
||||
// Button,
|
||||
ButtonGroup,
|
||||
Calendar,
|
||||
@@ -53,7 +53,7 @@ export {
|
||||
List,
|
||||
IconButton,
|
||||
Icon,
|
||||
// FIXME: Input 这个名字已经被上层占用,需要先修复上层所有被调用的地方,之后才能导出这个组件
|
||||
// FIXME: The name Input is already occupied by the upper layer. You need to fix all the places where the upper layer is called before exporting this component.
|
||||
// Input,
|
||||
InputGroup,
|
||||
TextArea,
|
||||
|
||||
Reference in New Issue
Block a user