From 6d693a5ab63efa06f9af319731b734f0e6180306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=B0=8F=E6=96=90?= <623536309@qq.com> Date: Sun, 23 Apr 2023 18:29:17 +0800 Subject: [PATCH] fix: custom column title, same as form field title (#1745) --- packages/core/client/src/locale/en_US.ts | 1 + packages/core/client/src/locale/ja_JP.ts | 1 + packages/core/client/src/locale/pt_BR.ts | 1 + packages/core/client/src/locale/ru_RU.ts | 1 + packages/core/client/src/locale/tr_TR.ts | 1 + packages/core/client/src/locale/zh_CN.ts | 1 + .../antd/table-v2/Table.Column.Designer.tsx | 9 +++++---- 7 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/locale/en_US.ts b/packages/core/client/src/locale/en_US.ts index d46178143..4f85357e9 100644 --- a/packages/core/client/src/locale/en_US.ts +++ b/packages/core/client/src/locale/en_US.ts @@ -492,6 +492,7 @@ export default { "Dialog": "Dialog", "Delete action": "Delete action", "Custom column title": "Custom column title", + 'Column title': 'column title', "Original title: ": "Original title: ", "Delete table column": "Delete table column", "Skip required validation": "Skip required validation", diff --git a/packages/core/client/src/locale/ja_JP.ts b/packages/core/client/src/locale/ja_JP.ts index 7ad5f0fe6..b725113bf 100644 --- a/packages/core/client/src/locale/ja_JP.ts +++ b/packages/core/client/src/locale/ja_JP.ts @@ -415,6 +415,7 @@ export default { "Dialog": "ダイアログ", "Delete action": "操作を削除", "Custom column title": "カスタムカラムタイトル", + 'Column title': 'カラムタイトル', "Original title: ": "元のタイトル: ", "Delete table column": "テーブルのカラムを削除", "Skip required validation": "必須のバリデーションをスキップ", diff --git a/packages/core/client/src/locale/pt_BR.ts b/packages/core/client/src/locale/pt_BR.ts index da702d87c..1d93e7d2a 100644 --- a/packages/core/client/src/locale/pt_BR.ts +++ b/packages/core/client/src/locale/pt_BR.ts @@ -452,6 +452,7 @@ export default { "Dialog": "Diálogo", "Delete action": "Excluir ação", "Custom column title": "Título da coluna personalizado", + 'Column title': 'cabeçalho da coluna', "Original title: ": "Título original: ", "Delete table column": "Excluir coluna da tabela", "Skip required validation": "Ignorar validação obrigatória", diff --git a/packages/core/client/src/locale/ru_RU.ts b/packages/core/client/src/locale/ru_RU.ts index 7ac20d20a..eb0352168 100644 --- a/packages/core/client/src/locale/ru_RU.ts +++ b/packages/core/client/src/locale/ru_RU.ts @@ -357,6 +357,7 @@ export default { "Dialog": "Диалог", "Delete action": "Удалить действие", "Custom column title": "Пользовательский заголовок колонки", + 'Column title': 'заголовок столбца', "Original title: ": "Заголовок по умолчанию: ", "Delete table column": "Удалить колонку таблицы", "Skip required validation": "Пропустить обязатеьную проверку", diff --git a/packages/core/client/src/locale/tr_TR.ts b/packages/core/client/src/locale/tr_TR.ts index c843eace1..c9f26afb6 100644 --- a/packages/core/client/src/locale/tr_TR.ts +++ b/packages/core/client/src/locale/tr_TR.ts @@ -356,6 +356,7 @@ export default { "Dialog": "Pencere", "Delete action": "İşlemi sil", "Custom column title": "Özel sütun başlığı", + 'Column title': 'Sütun başlığı', "Original title: ": "Orjinal başlık: ", "Delete table column": "Tablo sütununu sil", "Skip required validation": "Zorunlu alan kontrollerini atla", diff --git a/packages/core/client/src/locale/zh_CN.ts b/packages/core/client/src/locale/zh_CN.ts index 0bba0bfc8..657cd0735 100644 --- a/packages/core/client/src/locale/zh_CN.ts +++ b/packages/core/client/src/locale/zh_CN.ts @@ -529,6 +529,7 @@ export default { 'Dialog': '对话框', 'Delete action': '删除操作', 'Custom column title': '自定义列标题', + 'Column title': '列标题', 'Original title: ': '原始标题: ', 'Delete table column': '删除列', diff --git a/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx b/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx index 75098ee5f..47f51031e 100644 --- a/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/table-v2/Table.Column.Designer.tsx @@ -6,11 +6,12 @@ import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings' import { useCompile, useDesignable } from '../../hooks'; const useLabelFields = (collectionName?: any) => { + // 需要在组件顶层调用 + const compile = useCompile(); + const { getCollectionFields } = useCollectionManager(); if (!collectionName) { return []; } - const compile = useCompile(); - const { getCollectionFields } = useCollectionManager(); const targetFields = getCollectionFields(collectionName); return targetFields ?.filter?.((field) => field?.interface && !field?.target && field.type !== 'boolean' && !field.isForeignKey) @@ -44,9 +45,9 @@ export const TableColumnDesigner = (props) => { title: t('Custom column title'), properties: { title: { - // title: t('Column title'), + title: t('Column title'), default: columnSchema?.title, - description: `${t('Original title: ')}${collectionField?.uiSchema?.title || fieldSchema?.title}`, + description: `${t('Original field title: ')}${collectionField?.uiSchema?.title || fieldSchema?.title}`, 'x-decorator': 'FormItem', 'x-component': 'Input', 'x-component-props': {},