feat: translation

This commit is contained in:
chenos 2022-05-01 11:09:22 +08:00
parent ebfe11ff09
commit 5a023f5eec
4 changed files with 9 additions and 5 deletions

View File

@ -8,4 +8,5 @@ package.json
.umi-test .umi-test
packages/**/lib/** packages/**/lib/**
packages/**/esm/** packages/**/esm/**
packages/**/node_modules/** packages/**/node_modules/**
packages/core/client/src/locale/*

View File

@ -476,5 +476,6 @@ export default {
'Multiple records': '多条数据', 'Multiple records': '多条数据',
'Please select collection first': '请先选择数据表', 'Please select collection first': '请先选择数据表',
'Only update records matching conditions': '只更新满足条件的数据', 'Only update records matching conditions': '只更新满足条件的数据',
'Fields that are not assigned a value will be set to the default value, and those that do not have a default value are set to null.': '未被赋值的字段将被设置为默认值,没有默认值的设置为空值。' 'Fields that are not assigned a value will be set to the default value, and those that do not have a default value are set to null.': '未被赋值的字段将被设置为默认值,没有默认值的设置为空值。',
'Dragging': '拖拽中',
} }

View File

@ -6,7 +6,7 @@ import React, { useState } from 'react';
import { useActionContext } from '../..'; import { useActionContext } from '../..';
import { Icon } from '../../../icon'; import { Icon } from '../../../icon';
import { SortableItem } from '../../common'; import { SortableItem } from '../../common';
import { useDesigner } from '../../hooks'; import { useCompile, useDesigner } from '../../hooks';
import { useProps } from '../../hooks/useProps'; import { useProps } from '../../hooks/useProps';
import ActionContainer from './Action.Container'; import ActionContainer from './Action.Container';
import { ActionDesigner } from './Action.Designer'; import { ActionDesigner } from './Action.Designer';
@ -84,6 +84,7 @@ export const Action: ComposedAction = observer((props: any) => {
const field = useField<any>(); const field = useField<any>();
const { run } = useAction(); const { run } = useAction();
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
const compile = useCompile();
const designerProps = fieldSchema['x-designer-props']; const designerProps = fieldSchema['x-designer-props'];
const openMode = fieldSchema?.['x-component-props']?.['openMode']; const openMode = fieldSchema?.['x-component-props']?.['openMode'];
const renderButton = () => ( const renderButton = () => (
@ -111,7 +112,7 @@ export const Action: ComposedAction = observer((props: any) => {
component={component || Button} component={component || Button}
className={classnames(className, actionDesignerCss)} className={classnames(className, actionDesignerCss)}
> >
{field.title} {compile(fieldSchema.title)}
<Designer {...designerProps} /> <Designer {...designerProps} />
</SortableItem> </SortableItem>
); );

View File

@ -57,6 +57,7 @@ const useDragEnd = (props?: any) => {
}; };
export const DndContext = observer((props: Props) => { export const DndContext = observer((props: Props) => {
const { t } = useTranslation();
return ( return (
<DndKitContext collisionDetection={rectIntersection} {...props} onDragEnd={useDragEnd(props)}> <DndKitContext collisionDetection={rectIntersection} {...props} onDragEnd={useDragEnd(props)}>
<DragOverlay <DragOverlay
@ -65,7 +66,7 @@ export const DndContext = observer((props: Props) => {
easing: 'cubic-bezier(0.18, 0.67, 0.6, 1.22)', easing: 'cubic-bezier(0.18, 0.67, 0.6, 1.22)',
}} }}
> >
<span style={{ whiteSpace: 'nowrap' }}></span> <span style={{ whiteSpace: 'nowrap' }}>{t('Dragging')}</span>
</DragOverlay> </DragOverlay>
{props.children} {props.children}
</DndKitContext> </DndKitContext>