From 4507a5aca10834e2c600546b2f29c27797780ec0 Mon Sep 17 00:00:00 2001 From: chenos Date: Tue, 24 Aug 2021 23:10:19 +0800 Subject: [PATCH] improve text --- .../Permissions/ActionPermissionField.tsx | 2 +- .../admin-layout/Permissions/index.tsx | 4 +- .../client/src/schemas/action-logs/index.tsx | 2 +- packages/client/src/schemas/action/index.tsx | 2 +- packages/client/src/schemas/add-new/index.md | 4 +- packages/client/src/schemas/add-new/index.tsx | 18 +++--- .../client/src/schemas/calendar/ActionBar.tsx | 6 +- .../src/schemas/calendar/demos/demo1.tsx | 2 +- .../client/src/schemas/calendar/index.tsx | 2 +- packages/client/src/schemas/chart/index.tsx | 2 +- .../client/src/schemas/checkbox/index.tsx | 4 +- .../src/schemas/database-field/index.tsx | 11 +++- packages/client/src/schemas/display/index.tsx | 6 +- .../src/schemas/form/Field.DesignableBar.tsx | 4 +- .../client/src/schemas/icon-picker/index.tsx | 2 +- .../client/src/schemas/input-number/index.tsx | 4 +- .../src/schemas/kanban/FieldDesignableBar.tsx | 4 +- .../client/src/schemas/kanban/demos/demo1.tsx | 6 +- .../client/src/schemas/markdown/index.tsx | 2 +- packages/client/src/schemas/menu/index.tsx | 62 ++++++++++--------- .../client/src/schemas/password/index.tsx | 2 +- packages/client/src/schemas/radio/index.tsx | 2 +- packages/client/src/schemas/select/index.tsx | 6 +- .../src/schemas/table/SimpleDesignableBar.tsx | 2 +- .../client/src/schemas/table/demos/demo3.tsx | 2 +- packages/client/src/schemas/table/index.tsx | 24 ++++--- packages/client/src/schemas/tabs/index.tsx | 9 +-- 27 files changed, 101 insertions(+), 95 deletions(-) diff --git a/packages/client/src/components/admin-layout/Permissions/ActionPermissionField.tsx b/packages/client/src/components/admin-layout/Permissions/ActionPermissionField.tsx index ab6d65589..aa1492768 100644 --- a/packages/client/src/components/admin-layout/Permissions/ActionPermissionField.tsx +++ b/packages/client/src/components/admin-layout/Permissions/ActionPermissionField.tsx @@ -20,7 +20,7 @@ import { useState } from 'react'; const actionTypeMap = new Map( Object.entries({ - create: '新增', + create: '创建', get: '查看', update: '编辑', destroy: '删除', diff --git a/packages/client/src/components/admin-layout/Permissions/index.tsx b/packages/client/src/components/admin-layout/Permissions/index.tsx index 397f869eb..86a41573e 100644 --- a/packages/client/src/components/admin-layout/Permissions/index.tsx +++ b/packages/client/src/components/admin-layout/Permissions/index.tsx @@ -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': { diff --git a/packages/client/src/schemas/action-logs/index.tsx b/packages/client/src/schemas/action-logs/index.tsx index 67bf1e867..26daf9227 100644 --- a/packages/client/src/schemas/action-logs/index.tsx +++ b/packages/client/src/schemas/action-logs/index.tsx @@ -26,7 +26,7 @@ ActionLogs.FieldValue = observer((props: any) => { if (!collectionField.uiSchema) { if (!field.value) { - return
N/A
; + return
; } if (typeof field.value === 'boolean') { return
{field.value ? 'true' : 'false'}
; diff --git a/packages/client/src/schemas/action/index.tsx b/packages/client/src/schemas/action/index.tsx index 888bb8f61..e6f98f1f1 100644 --- a/packages/client/src/schemas/action/index.tsx +++ b/packages/client/src/schemas/action/index.tsx @@ -503,7 +503,7 @@ Action.DesignableBar = (props: any) => { setVisible(false); }} > - 移除 + 隐藏 } diff --git a/packages/client/src/schemas/add-new/index.md b/packages/client/src/schemas/add-new/index.md index cb51b80e0..bec518a3f 100644 --- a/packages/client/src/schemas/add-new/index.md +++ b/packages/client/src/schemas/add-new/index.md @@ -1,5 +1,5 @@ --- -title: AddNew - 新增 +title: AddNew - 创建 nav: title: 组件 path: /client @@ -9,7 +9,7 @@ group: path: /client/schemas --- -# AddNew - 新增 +# AddNew - 创建 ## Node Tree diff --git a/packages/client/src/schemas/add-new/index.tsx b/packages/client/src/schemas/add-new/index.tsx index 4b070c2cc..dc1f9cd65 100644 --- a/packages/client/src/schemas/add-new/index.tsx +++ b/packages/client/src/schemas/add-new/index.tsx @@ -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={} > - 新增区块 + 创建区块 )} @@ -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 ( @@ -1739,7 +1739,7 @@ AddNew.PaneItem = observer((props: any) => { type={'dashed'} icon={} > - 新增区块 + 创建区块 )} diff --git a/packages/client/src/schemas/calendar/ActionBar.tsx b/packages/client/src/schemas/calendar/ActionBar.tsx index 0f07867ec..e5cd3d1f0 100644 --- a/packages/client/src/schemas/calendar/ActionBar.tsx +++ b/packages/client/src/schemas/calendar/ActionBar.tsx @@ -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) => ( { setVisible(false); }} > - 移除 + 隐藏 } diff --git a/packages/client/src/schemas/chart/index.tsx b/packages/client/src/schemas/chart/index.tsx index 263577316..70545a84e 100644 --- a/packages/client/src/schemas/chart/index.tsx +++ b/packages/client/src/schemas/chart/index.tsx @@ -74,7 +74,7 @@ Chart.DesignableBar = observer((props) => { setVisible(false); }} > - 修改内容 + 编辑图表 { if (!isValid(props.value)) { - return
N/A
; + return
; } return props.value ? ( @@ -46,7 +46,7 @@ Checkbox.Group = connect( }), mapReadPretty((props) => { if (!isValid(props.value)) { - return
N/A
; + return
; } const { options = [] } = props; const field = useField(); diff --git a/packages/client/src/schemas/database-field/index.tsx b/packages/client/src/schemas/database-field/index.tsx index 3422cbb17..08910e4dd 100644 --- a/packages/client/src/schemas/database-field/index.tsx +++ b/packages/client/src/schemas/database-field/index.tsx @@ -180,7 +180,7 @@ export const DatabaseCollection = observer((props) => { > } value={newValue} onChange={(e) => { @@ -480,8 +480,13 @@ export const DatabaseField: any = observer((props) => { } > - diff --git a/packages/client/src/schemas/display/index.tsx b/packages/client/src/schemas/display/index.tsx index 4ca9d266e..ff59874ca 100644 --- a/packages/client/src/schemas/display/index.tsx +++ b/packages/client/src/schemas/display/index.tsx @@ -20,12 +20,12 @@ import { import { FullscreenOutlined } from '@ant-design/icons'; import moment from 'moment'; -const PlaceholderContext = createContext('N/A'); +const PlaceholderContext = createContext(''); 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 = observer((props) => { const DatePicker: React.FC = (props: any) => { if (!props.value) { - return
N/A
; + return
; } const placeholder = usePlaceholder(); const prefixCls = usePrefixCls('description-text', props); diff --git a/packages/client/src/schemas/form/Field.DesignableBar.tsx b/packages/client/src/schemas/form/Field.DesignableBar.tsx index 1d9d94269..be15280d8 100644 --- a/packages/client/src/schemas/form/Field.DesignableBar.tsx +++ b/packages/client/src/schemas/form/Field.DesignableBar.tsx @@ -78,7 +78,7 @@ export const FieldDesignableBar = observer((props) => { { - const values = await FormDialog('修改字段名称', () => { + const values = await FormDialog('自定义字段名称', () => { return ( { }); }} > - 修改字段名称 + 自定义字段名称 { if (!isValid(props.value)) { - return
N/A
; + return
; } return ; }), diff --git a/packages/client/src/schemas/input-number/index.tsx b/packages/client/src/schemas/input-number/index.tsx index 22317f688..2db915554 100644 --- a/packages/client/src/schemas/input-number/index.tsx +++ b/packages/client/src/schemas/input-number/index.tsx @@ -35,7 +35,7 @@ export const InputNumber: any = connect( mapReadPretty((props: any) => { const { step, value, addonBefore, addonAfter } = props; if (!isValid(props.value)) { - return
N/A
; + return
; } 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
N/A
; + return
; } return toFixed( String(value), diff --git a/packages/client/src/schemas/kanban/FieldDesignableBar.tsx b/packages/client/src/schemas/kanban/FieldDesignableBar.tsx index 31d7f633f..695125459 100644 --- a/packages/client/src/schemas/kanban/FieldDesignableBar.tsx +++ b/packages/client/src/schemas/kanban/FieldDesignableBar.tsx @@ -78,7 +78,7 @@ export const FieldDesignableBar = observer((props) => { { - const values = await FormDialog('修改字段名称', () => { + const values = await FormDialog('自定义字段名称', () => { return ( { }); }} > - 修改字段名称 + 自定义字段名称 { setVisible(false); }} > - 修改内容 + 编辑内容 { const schemas = { 'Menu.Link': { icon: , - 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: , - 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: , - 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) => { }} > }> - 新建菜单项 + 菜单项 }> - 新建菜单分组 + 菜单分组 }> - 添加自定义链接 + 自定义链接 } @@ -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 (
@@ -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 ( @@ -716,7 +717,7 @@ Menu.DesignableBar = (props) => { }, ); const values = await FormDialog( - `修改${formConfig.title}`, + `编辑${formConfig.title}`, () => { return ( @@ -740,7 +741,7 @@ Menu.DesignableBar = (props) => { await updateSchema(schema); }} > - 修改{formConfig.title} + 编辑{formConfig.title} { } - title={'当前菜单项之前'} + title={`向${mode == 'inline' ? '上' : '左'}插入`} > } > - 新建菜单项 + 菜单项 } > - 新建菜单分组 + 菜单分组 } > - 添加自定义链接 + 自定义链接 } - title={'当前菜单项之后'} + title={`向${mode == 'inline' ? '下' : '右'}插入`} > } > - 新建菜单项 + 菜单项 } > - 新建菜单分组 + 菜单分组 } > - 添加自定义链接 + 自定义链接 {isSubMenu && ( } - title={'当前菜单分组里'} + title={'向里插入'} > } > - 新建菜单项 + 菜单项 } > - 新建菜单分组 + 菜单分组 } > - 添加自定义链接 + 自定义链接 )} + } onClick={async () => { @@ -961,7 +963,7 @@ Menu.DesignableBar = (props) => { properties: { roles: { type: 'array', - title: '可访问该菜单的权限组', + title: '允许访问的权限组', 'x-reactions': [ '{{useAsyncDataSource(loadRoles)}}', ], diff --git a/packages/client/src/schemas/password/index.tsx b/packages/client/src/schemas/password/index.tsx index 89245bdb8..95773bc7c 100644 --- a/packages/client/src/schemas/password/index.tsx +++ b/packages/client/src/schemas/password/index.tsx @@ -61,7 +61,7 @@ export const Password = connect( }, mapReadPretty((props) => { if (!isValid(props.value)) { - return
N/A
; + return
; } return
********
; }), diff --git a/packages/client/src/schemas/radio/index.tsx b/packages/client/src/schemas/radio/index.tsx index b0998c6d8..87e39f8d3 100644 --- a/packages/client/src/schemas/radio/index.tsx +++ b/packages/client/src/schemas/radio/index.tsx @@ -26,7 +26,7 @@ Radio.Group = connect( }), mapReadPretty((props) => { if (!isValid(props.value)) { - return
N/A
; + return
; } const { options = [], value } = props; const field = useField(); diff --git a/packages/client/src/schemas/select/index.tsx b/packages/client/src/schemas/select/index.tsx index 3b9298ff9..7ac83ed23 100644 --- a/packages/client/src/schemas/select/index.tsx +++ b/packages/client/src/schemas/select/index.tsx @@ -66,13 +66,13 @@ export const Select: any = connect( ), mapReadPretty((props) => { // console.log('mapReadPretty', props.value) - // return
N/A
; + // return
; if (!isValid(props.value)) { - return
N/A
; + return
; } const field = useField(); if (isArrayField(field) && field?.value?.length === 0) { - return
N/A
; + return
; } const dataSource = field.dataSource || []; console.log('field.value', field.value, dataSource); diff --git a/packages/client/src/schemas/table/SimpleDesignableBar.tsx b/packages/client/src/schemas/table/SimpleDesignableBar.tsx index 749b3e0fd..963f1af66 100644 --- a/packages/client/src/schemas/table/SimpleDesignableBar.tsx +++ b/packages/client/src/schemas/table/SimpleDesignableBar.tsx @@ -139,7 +139,7 @@ export const SimpleDesignableBar = observer((props) => { 'x-component': 'Select', enum: [ { - label: '新增数据', + label: '创建数据', value: 'create', }, { diff --git a/packages/client/src/schemas/table/demos/demo3.tsx b/packages/client/src/schemas/table/demos/demo3.tsx index db5eeb0c5..61dbab57e 100644 --- a/packages/client/src/schemas/table/demos/demo3.tsx +++ b/packages/client/src/schemas/table/demos/demo3.tsx @@ -59,7 +59,7 @@ const schema: ISchema = { properties: { modal: { type: 'void', - title: '新增数据', + title: '创建数据', 'x-decorator': 'Form', 'x-component': 'Action.Modal', 'x-component-props': { diff --git a/packages/client/src/schemas/table/index.tsx b/packages/client/src/schemas/table/index.tsx index 147bd20f1..777ff116c 100644 --- a/packages/client/src/schemas/table/index.tsx +++ b/packages/client/src/schemas/table/index.tsx @@ -471,7 +471,7 @@ function AddColumn() { {options.map((option) => ( @@ -481,7 +481,7 @@ function AddColumn() { key={item.name} onClick={async () => { setVisible(false); - const values = await FormDialog(`新增字段`, () => { + const values = await FormDialog(`创建字段`, () => { return ( @@ -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) => ( { setVisible(false); }} > - 移除 + 隐藏 } @@ -1594,7 +1594,7 @@ Table.ExportActionDesignableBar = () => { setVisible(false); }} > - 移除 + 隐藏 } @@ -1820,7 +1820,7 @@ Table.Action.DesignableBar = () => { setVisible(false); }} > - 移除 + 隐藏 } @@ -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', }, }, diff --git a/packages/client/src/schemas/tabs/index.tsx b/packages/client/src/schemas/tabs/index.tsx index 2240a72fc..d42460f8e 100644 --- a/packages/client/src/schemas/tabs/index.tsx +++ b/packages/client/src/schemas/tabs/index.tsx @@ -111,7 +111,7 @@ export const Tabs: any = observer((props: any) => { type={'dashed'} icon={} onClick={async () => { - const values = await FormDialog('新增标签页', () => { + const values = await FormDialog('创建标签页', () => { return ( { await createSchema(data); }} > - 新增标签页 + 创建标签页 ) } @@ -281,7 +281,8 @@ Tabs.TabPane.DesignableBar = () => { { - const values = await FormDialog('编辑按钮', () => { + setVisible(false); + const values = await FormDialog('编辑标签页', () => { return ( { updateSchema(schema); }} > - 编辑按钮 + 编辑标签页