improve text

This commit is contained in:
chenos 2021-08-24 23:10:19 +08:00
parent 53fa47c56f
commit 4507a5aca1
27 changed files with 101 additions and 95 deletions

View File

@ -20,7 +20,7 @@ import { useState } from 'react';
const actionTypeMap = new Map(
Object.entries({
create: '新增',
create: '创建',
get: '查看',
update: '编辑',
destroy: '删除',

View File

@ -294,7 +294,7 @@ const schema: ISchema = {
[uid()]: {
type: 'void',
name: 'action1',
title: '新增',
title: '创建',
'x-align': 'right',
'x-decorator': 'AddNew.Displayed',
'x-decorator-props': {
@ -307,7 +307,7 @@ const schema: ISchema = {
properties: {
modal: {
type: 'void',
title: '新增数据',
title: '创建数据',
'x-decorator': 'Form',
'x-component': 'Action.Drawer',
'x-component-props': {

View File

@ -26,7 +26,7 @@ ActionLogs.FieldValue = observer((props: any) => {
if (!collectionField.uiSchema) {
if (!field.value) {
return <div>N/A</div>;
return <div></div>;
}
if (typeof field.value === 'boolean') {
return <div>{field.value ? 'true' : 'false'}</div>;

View File

@ -503,7 +503,7 @@ Action.DesignableBar = (props: any) => {
setVisible(false);
}}
>
</Menu.Item>
</Menu>
}

View File

@ -1,5 +1,5 @@
---
title: AddNew - 新增
title: AddNew - 创建
nav:
title: 组件
path: /client
@ -9,7 +9,7 @@ group:
path: /client/schemas
---
# AddNew - 新增
# AddNew - 创建
## Node Tree

View File

@ -181,7 +181,7 @@ function generateCardItemSchema(component) {
[uid()]: {
type: 'void',
name: 'action1',
title: '新增',
title: '创建',
'x-align': 'right',
'x-decorator': 'AddNew.Displayed',
'x-decorator-props': {
@ -195,7 +195,7 @@ function generateCardItemSchema(component) {
properties: {
modal: {
type: 'void',
title: '新增数据',
title: '创建数据',
'x-decorator': 'Form',
'x-component': 'Action.Drawer',
'x-component-props': {
@ -365,7 +365,7 @@ function generateCardItemSchema(component) {
properties: {
create: {
type: 'void',
title: '新增卡片',
title: '添加卡片',
// 'x-designable-bar': 'Kanban.AddCardDesignableBar',
'x-component': 'Kanban.Card.AddNew',
// 'x-decorator': 'AddNew.Displayed',
@ -376,7 +376,7 @@ function generateCardItemSchema(component) {
properties: {
modal: {
type: 'void',
title: '新增数据',
title: '创建数据',
'x-decorator': 'Form',
'x-component': 'Action.Drawer',
'x-component-props': {
@ -408,7 +408,7 @@ function generateCardItemSchema(component) {
},
view1: {
type: 'void',
title: '修改数据',
title: '编辑数据',
'x-decorator': 'Form',
'x-component': 'Kanban.Card.View',
'x-component-props': {
@ -512,7 +512,7 @@ function generateCardItemSchema(component) {
properties: {
modal: {
type: 'void',
title: '新增数据',
title: '创建数据',
'x-decorator': 'Form',
'x-component': 'Action.Drawer',
'x-component-props': {
@ -1340,7 +1340,7 @@ AddNew.CardItem = observer((props: any) => {
className={'designable-btn designable-btn-dash'}
icon={<PlusOutlined />}
>
</Button>
)}
</Dropdown>
@ -1435,7 +1435,7 @@ AddNew.FormItem = observer((props: any) => {
key={item.name}
onClick={async () => {
setVisible(false);
const values = await FormDialog(`新增字段`, () => {
const values = await FormDialog(`创建字段`, () => {
return (
<FormLayout layout={'vertical'}>
<SchemaField schema={item} />
@ -1739,7 +1739,7 @@ AddNew.PaneItem = observer((props: any) => {
type={'dashed'}
icon={<PlusOutlined />}
>
</Button>
)}
</Dropdown>

View File

@ -164,7 +164,7 @@ function generateActionSchema(type) {
},
create: {
type: 'void',
title: '新增',
title: '创建',
'x-align': 'right',
'x-designable-bar': 'Calendar.ActionDesignableBar',
'x-component': 'Action',
@ -178,7 +178,7 @@ function generateActionSchema(type) {
properties: {
modal: {
type: 'void',
title: '新增数据',
title: '创建数据',
'x-decorator': 'Form',
'x-component': 'Action.Drawer',
'x-component-props': {
@ -222,7 +222,7 @@ function AddActionButton() {
{ title: '标题', name: 'title' },
{ title: '视图切换', name: 'viewSelect' },
{ title: '筛选', name: 'filter' },
{ title: '新增', name: 'create' },
{ title: '创建', name: 'create' },
].map((item) => (
<SwitchMenuItem
key={item.name}

View File

@ -92,7 +92,7 @@ const schema: ISchema = {
properties: {
modal: {
type: 'void',
title: '新增数据',
title: '创建数据',
'x-decorator': 'Form',
'x-component': 'Action.Drawer',
'x-component-props': {

View File

@ -574,7 +574,7 @@ Calendar.Filter.DesignableBar = () => {
setVisible(false);
}}
>
</Menu.Item>
</Menu>
}

View File

@ -74,7 +74,7 @@ Chart.DesignableBar = observer((props) => {
setVisible(false);
}}
>
</Menu.Item>
<Menu.Divider />
<Menu.Item

View File

@ -27,7 +27,7 @@ export const Checkbox: ComposedCheckbox = connect(
),
mapReadPretty((props) => {
if (!isValid(props.value)) {
return <div>N/A</div>;
return <div></div>;
}
return props.value ? (
<CheckOutlined style={{ color: '#52c41a' }} />
@ -46,7 +46,7 @@ Checkbox.Group = connect(
}),
mapReadPretty((props) => {
if (!isValid(props.value)) {
return <div>N/A</div>;
return <div></div>;
}
const { options = [] } = props;
const field = useField<any>();

View File

@ -180,7 +180,7 @@ export const DatabaseCollection = observer((props) => {
>
<Input.Search
size={'middle'}
placeholder={'新增数据表'}
placeholder={'创建数据表'}
enterButton={<PlusOutlined />}
value={newValue}
onChange={(e) => {
@ -480,8 +480,13 @@ export const DatabaseField: any = observer((props) => {
</Menu>
}
>
<Button block type={'dashed'} style={{ marginTop: 10 }}>
<Button
block
type={'dashed'}
icon={<PlusOutlined />}
style={{ marginTop: 10 }}
>
</Button>
</Dropdown>
</div>

View File

@ -20,12 +20,12 @@ import {
import { FullscreenOutlined } from '@ant-design/icons';
import moment from 'moment';
const PlaceholderContext = createContext<string>('N/A');
const PlaceholderContext = createContext<string>('');
const Placeholder = PlaceholderContext.Provider;
const usePlaceholder = (value?: any) => {
const placeholder = useContext(PlaceholderContext) || 'N/A';
const placeholder = useContext(PlaceholderContext) || '';
return isValid(value) && value !== '' ? value : placeholder;
};
@ -299,7 +299,7 @@ const Cascader: React.FC<CascaderProps> = observer((props) => {
const DatePicker: React.FC<DatePickerProps> = (props: any) => {
if (!props.value) {
return <div>N/A</div>;
return <div></div>;
}
const placeholder = usePlaceholder();
const prefixCls = usePrefixCls('description-text', props);

View File

@ -78,7 +78,7 @@ export const FieldDesignableBar = observer((props) => {
<Menu.Item
key={'update'}
onClick={async () => {
const values = await FormDialog('修改字段名称', () => {
const values = await FormDialog('自定义字段名称', () => {
return (
<FormLayout layout={'vertical'}>
<SchemaField
@ -122,7 +122,7 @@ export const FieldDesignableBar = observer((props) => {
});
}}
>
</Menu.Item>
<Menu.Item
style={{ minWidth: 150 }}

View File

@ -74,7 +74,7 @@ export const IconPicker = connect(
}),
mapReadPretty((props) => {
if (!isValid(props.value)) {
return <div>N/A</div>;
return <div></div>;
}
return <Icon type={props.value} />;
}),

View File

@ -35,7 +35,7 @@ export const InputNumber: any = connect(
mapReadPretty((props: any) => {
const { step, value, addonBefore, addonAfter } = props;
if (!isValid(props.value)) {
return <div>N/A</div>;
return <div></div>;
}
const precision = Math.max(
getNumberPrecision(String(value)),
@ -56,7 +56,7 @@ InputNumber.Percent = connect(
mapReadPretty((props: any) => {
const { step, value } = props;
if (!isValid(props.value)) {
return <div>N/A</div>;
return <div></div>;
}
return toFixed(
String(value),

View File

@ -78,7 +78,7 @@ export const FieldDesignableBar = observer((props) => {
<Menu.Item
key={'update'}
onClick={async () => {
const values = await FormDialog('修改字段名称', () => {
const values = await FormDialog('自定义字段名称', () => {
return (
<FormLayout layout={'vertical'}>
<SchemaField
@ -122,7 +122,7 @@ export const FieldDesignableBar = observer((props) => {
});
}}
>
</Menu.Item>
<Menu.Divider />
<Menu.Item

View File

@ -126,7 +126,7 @@ const schema: ISchema = {
properties: {
create: {
type: 'void',
title: '新增卡片',
title: '添加卡片',
// 'x-designable-bar': 'Kanban.AddCardDesignableBar',
'x-component': 'Kanban.Card.AddNew',
// 'x-decorator': 'AddNew.Displayed',
@ -137,7 +137,7 @@ const schema: ISchema = {
properties: {
modal: {
type: 'void',
title: '新增数据',
title: '创建数据',
'x-decorator': 'Form',
'x-component': 'Action.Drawer',
'x-component-props': {
@ -182,7 +182,7 @@ const schema: ISchema = {
},
view1: {
type: 'void',
title: '修改数据',
title: '编辑数据',
'x-decorator': 'Form',
'x-component': 'Kanban.Card.View',
'x-component-props': {

View File

@ -138,7 +138,7 @@ Markdown.Void.DesignableBar = observer((props) => {
setVisible(false);
}}
>
</Menu.Item>
<Menu.Divider />
<Menu.Item

View File

@ -402,13 +402,13 @@ Menu.AddNew = observer((props: any) => {
const schemas = {
'Menu.Link': {
icon: <MenuOutlined />,
title: '建菜单项',
title: '建菜单项',
schema: {
type: 'object',
properties: {
title: {
type: 'string',
title: '菜单项名称',
title: '名称',
required: true,
'x-decorator': 'FormItem',
'x-component': 'Input',
@ -424,13 +424,13 @@ Menu.AddNew = observer((props: any) => {
},
'Menu.SubMenu': {
icon: <GroupOutlined />,
title: '建菜单分组',
title: '建菜单分组',
schema: {
type: 'object',
properties: {
title: {
type: 'string',
title: '分组名称',
title: '名称',
required: true,
'x-decorator': 'FormItem',
'x-component': 'Input',
@ -446,13 +446,13 @@ Menu.AddNew = observer((props: any) => {
},
'Menu.URL': {
icon: <LinkOutlined />,
title: '添加自定义链接',
title: '创建自定义链接',
schema: {
type: 'object',
properties: {
title: {
type: 'string',
title: '链接名称',
title: '名称',
required: true,
'x-decorator': 'FormItem',
'x-component': 'Input',
@ -498,13 +498,13 @@ Menu.AddNew = observer((props: any) => {
}}
>
<AntdMenu.Item key={'Menu.Link'} icon={<MenuOutlined />}>
</AntdMenu.Item>
<AntdMenu.Item key={'Menu.SubMenu'} icon={<GroupOutlined />}>
</AntdMenu.Item>
<AntdMenu.Item key={'Menu.URL'} icon={<LinkOutlined />}>
</AntdMenu.Item>
</AntdMenu>
}
@ -526,7 +526,7 @@ Menu.DesignableBar = (props) => {
properties: {
title: {
type: 'string',
title: '菜单项名称',
title: '名称',
required: true,
'x-decorator': 'FormItem',
'x-component': 'Input',
@ -548,7 +548,7 @@ Menu.DesignableBar = (props) => {
properties: {
title: {
type: 'string',
title: '菜单项名称',
title: '名称',
required: true,
'x-decorator': 'FormItem',
'x-component': 'Input',
@ -570,7 +570,7 @@ Menu.DesignableBar = (props) => {
properties: {
title: {
type: 'string',
title: '菜单项名称',
title: '名称',
required: true,
'x-decorator': 'FormItem',
'x-component': 'Input',
@ -592,7 +592,7 @@ Menu.DesignableBar = (props) => {
properties: {
title: {
type: 'string',
title: '分组名称',
title: '名称',
required: true,
'x-decorator': 'FormItem',
'x-component': 'Input',
@ -614,7 +614,7 @@ Menu.DesignableBar = (props) => {
properties: {
title: {
type: 'string',
title: '链接名称',
title: '名称',
required: true,
'x-decorator': 'FormItem',
'x-component': 'Input',
@ -651,6 +651,7 @@ Menu.DesignableBar = (props) => {
const formConfig = schemas[schema['x-component']];
const isSubMenu = schema['x-component'] === 'Menu.SubMenu';
const ctx = useContext(MenuContext);
const mode = useContext(MenuModeContext);
return (
<div className={cls('designable-bar', { active: visible })}>
@ -687,7 +688,7 @@ Menu.DesignableBar = (props) => {
return;
}
const values = await FormDialog(
`在「${schema.title}${methodLabels[method]}新建${config.title}`,
`在「${schema.title}${methodLabels[method]}插入${config.title}`,
() => {
return (
<FormLayout layout={'vertical'}>
@ -716,7 +717,7 @@ Menu.DesignableBar = (props) => {
},
);
const values = await FormDialog(
`修改${formConfig.title}`,
`编辑${formConfig.title}`,
() => {
return (
<FormLayout layout={'vertical'}>
@ -740,7 +741,7 @@ Menu.DesignableBar = (props) => {
await updateSchema(schema);
}}
>
<EditOutlined /> {formConfig.title}
<EditOutlined /> {formConfig.title}
</AntdMenu.Item>
<AntdMenu.Item
key={'move'}
@ -861,77 +862,78 @@ Menu.DesignableBar = (props) => {
<AntdMenu.SubMenu
key={'insertBefore'}
icon={<ArrowUpOutlined />}
title={'当前菜单项之前'}
title={`${mode == 'inline' ? '上' : '左'}插入`}
>
<AntdMenu.Item
key={'insertBefore.Menu.Link'}
icon={<MenuOutlined />}
>
</AntdMenu.Item>
<AntdMenu.Item
key={'insertBefore.Menu.SubMenu'}
icon={<GroupOutlined />}
>
</AntdMenu.Item>
<AntdMenu.Item
key={'insertBefore.Menu.URL'}
icon={<LinkOutlined />}
>
</AntdMenu.Item>
</AntdMenu.SubMenu>
<AntdMenu.SubMenu
key={'insertAfter'}
icon={<ArrowDownOutlined />}
title={'当前菜单项之后'}
title={`${mode == 'inline' ? '下' : '右'}插入`}
>
<AntdMenu.Item
key={'insertAfter.Menu.Link'}
icon={<MenuOutlined />}
>
</AntdMenu.Item>
<AntdMenu.Item
key={'insertAfter.Menu.SubMenu'}
icon={<GroupOutlined />}
>
</AntdMenu.Item>
<AntdMenu.Item
key={'insertAfter.Menu.URL'}
icon={<LinkOutlined />}
>
</AntdMenu.Item>
</AntdMenu.SubMenu>
{isSubMenu && (
<AntdMenu.SubMenu
key={'appendChild'}
icon={<ArrowRightOutlined />}
title={'当前菜单分组里'}
title={'向里插入'}
>
<AntdMenu.Item
key={'appendChild.Menu.Link'}
icon={<MenuOutlined />}
>
</AntdMenu.Item>
<AntdMenu.Item
key={'appendChild.Menu.SubMenu'}
icon={<GroupOutlined />}
>
</AntdMenu.Item>
<AntdMenu.Item
key={'appendChild.Menu.URL'}
icon={<LinkOutlined />}
>
</AntdMenu.Item>
</AntdMenu.SubMenu>
)}
<AntdMenu.Divider />
<AntdMenu.Item
icon={<LockOutlined />}
onClick={async () => {
@ -961,7 +963,7 @@ Menu.DesignableBar = (props) => {
properties: {
roles: {
type: 'array',
title: '可访问该菜单的权限组',
title: '允许访问的权限组',
'x-reactions': [
'{{useAsyncDataSource(loadRoles)}}',
],

View File

@ -61,7 +61,7 @@ export const Password = connect(
},
mapReadPretty((props) => {
if (!isValid(props.value)) {
return <div>N/A</div>;
return <div></div>;
}
return <div>********</div>;
}),

View File

@ -26,7 +26,7 @@ Radio.Group = connect(
}),
mapReadPretty((props) => {
if (!isValid(props.value)) {
return <div>N/A</div>;
return <div></div>;
}
const { options = [], value } = props;
const field = useField<any>();

View File

@ -66,13 +66,13 @@ export const Select: any = connect(
),
mapReadPretty((props) => {
// console.log('mapReadPretty', props.value)
// return <div>N/A</div>;
// return <div></div>;
if (!isValid(props.value)) {
return <div>N/A</div>;
return <div></div>;
}
const field = useField<any>();
if (isArrayField(field) && field?.value?.length === 0) {
return <div>N/A</div>;
return <div></div>;
}
const dataSource = field.dataSource || [];
console.log('field.value', field.value, dataSource);

View File

@ -139,7 +139,7 @@ export const SimpleDesignableBar = observer((props) => {
'x-component': 'Select',
enum: [
{
label: '新增数据',
label: '创建数据',
value: 'create',
},
{

View File

@ -59,7 +59,7 @@ const schema: ISchema = {
properties: {
modal: {
type: 'void',
title: '新增数据',
title: '创建数据',
'x-decorator': 'Form',
'x-component': 'Action.Modal',
'x-component-props': {

View File

@ -471,7 +471,7 @@ function AddColumn() {
<Menu.Divider />
<Menu.SubMenu
popupClassName={'add-new-fields-popup'}
title={'新增字段'}
title={'创建字段'}
>
{options.map((option) => (
<Menu.ItemGroup title={option.label}>
@ -481,7 +481,7 @@ function AddColumn() {
key={item.name}
onClick={async () => {
setVisible(false);
const values = await FormDialog(`新增字段`, () => {
const values = await FormDialog(`创建字段`, () => {
return (
<FormLayout layout={'vertical'}>
<SchemaField schema={item} />
@ -896,7 +896,7 @@ function generateActionSchema(type) {
key: uid(),
type: 'void',
name: uid(),
title: '新增',
title: '创建',
'x-align': 'right',
'x-decorator': 'AddNew.Displayed',
'x-decorator-props': {
@ -910,7 +910,7 @@ function generateActionSchema(type) {
properties: {
modal: {
type: 'void',
title: '新增数据',
title: '创建数据',
'x-decorator': 'Form',
'x-component': 'Action.Drawer',
'x-component-props': {
@ -1075,7 +1075,7 @@ function AddActionButton() {
{[
{ title: '筛选', name: 'filter' },
{ title: '导出', name: 'export' },
{ title: '新增', name: 'create' },
{ title: '创建', name: 'create' },
{ title: '删除', name: 'destroy' },
].map((item) => (
<SwitchMenuItem
@ -1471,7 +1471,7 @@ Table.Filter.DesignableBar = () => {
setVisible(false);
}}
>
</Menu.Item>
</Menu>
}
@ -1594,7 +1594,7 @@ Table.ExportActionDesignableBar = () => {
setVisible(false);
}}
>
</Menu.Item>
</Menu>
}
@ -1820,7 +1820,7 @@ Table.Action.DesignableBar = () => {
setVisible(false);
}}
>
</Menu.Item>
</Menu>
}
@ -2117,11 +2117,9 @@ Table.DesignableBar = observer((props) => {
direction: {
type: 'string',
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component': 'Radio.Group',
'x-component-props': {
style: {
width: 100,
},
optionType: 'button',
},
enum: [
{ label: '正序', value: 'asc' },
@ -2144,7 +2142,7 @@ Table.DesignableBar = observer((props) => {
properties: {
add: {
type: 'void',
title: '新增',
title: '添加排序字段',
'x-component': 'ArrayItems.Addition',
},
},

View File

@ -111,7 +111,7 @@ export const Tabs: any = observer((props: any) => {
type={'dashed'}
icon={<PlusOutlined />}
onClick={async () => {
const values = await FormDialog('新增标签页', () => {
const values = await FormDialog('创建标签页', () => {
return (
<FormLayout layout={'vertical'}>
<SchemaField
@ -164,7 +164,7 @@ export const Tabs: any = observer((props: any) => {
await createSchema(data);
}}
>
</Button>
)
}
@ -281,7 +281,8 @@ Tabs.TabPane.DesignableBar = () => {
<Menu>
<Menu.Item
onClick={async () => {
const values = await FormDialog('编辑按钮', () => {
setVisible(false);
const values = await FormDialog('编辑标签页', () => {
return (
<FormLayout layout={'vertical'}>
<SchemaField
@ -321,7 +322,7 @@ Tabs.TabPane.DesignableBar = () => {
updateSchema(schema);
}}
>
</Menu.Item>
<Menu.Divider />
<Menu.Item