feat: deleted collection field give some tips (#1744)

* feat: deleted collection field give some tips

* chore: optimize traslation

---------

Co-authored-by: Rairn <958414905@qq.com>
This commit is contained in:
李小斐 2023-04-24 21:49:56 +08:00 committed by GitHub
parent cd596925ee
commit c03d271481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 78 additions and 65 deletions

View File

@ -3,6 +3,7 @@ import { connect, useField, useFieldSchema } from '@formily/react';
import { merge } from '@formily/shared';
import { concat } from 'lodash';
import React, { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useActionContext, useCompile, useComponent, useFormBlockContext, useRecord } from '..';
import { CollectionFieldProvider } from './CollectionFieldProvider';
import { useCollectionField } from './hooks';
@ -97,6 +98,12 @@ export const InternalFallbackField = () => {
return <div>{displayText}</div>;
};
// 当字段被删除时,显示一个提示占位符
const DeletedField = () => {
const { t } = useTranslation()
return <div style={{ color: '#ccc' }}>{t('The field has bee deleted')}</div>;
}
export const CollectionField = connect((props) => {
const fieldSchema = useFieldSchema();
const field = fieldSchema?.['x-component-props']?.['field'];
@ -105,7 +112,7 @@ export const CollectionField = connect((props) => {
<CollectionFieldProvider
name={fieldSchema.name}
field={field}
fallback={snapshot ? <InternalFallbackField /> : null}
fallback={snapshot ? <InternalFallbackField /> : <DeletedField />}
>
<InternalField {...props} />
</CollectionFieldProvider>

View File

@ -498,6 +498,7 @@ export default {
"Skip required validation": "Skip required validation",
"Form values": "Form values",
"Fields values": "Fields values",
'The field has bee deleted': 'The field has bee deleted',
"When submitting the following fields, the saved values are": "When submitting the following fields, the saved values are",
"After successful submission": "After successful submission",
"Then": "Then",

View File

@ -421,6 +421,7 @@ export default {
"Skip required validation": "必須のバリデーションをスキップ",
"Form values": "フォームの値",
"Fields values": "フィールドの値",
'The field has bee deleted': 'フィールドが削除されました',
"When submitting the following fields, the saved values are": "次のフィールドを送信すると、保存された値は",
"After successful submission": "送信が成功した後",
"Then": "その後",

View File

@ -457,7 +457,8 @@ export default {
"Delete table column": "Excluir coluna da tabela",
"Skip required validation": "Ignorar validação obrigatória",
"Form values": "Valores do formulário",
"Fields values": "Valores dos campos",
"Fields values": "campo removido",
'The field has bee deleted': 'O campo foi excluído',
"When submitting the following fields, the saved values are": "Ao enviar os seguintes campos, os valores salvos são",
"After successful submission": "Depois do envio bem-sucedido",
"Then": "Então",

View File

@ -363,6 +363,7 @@ export default {
"Skip required validation": "Пропустить обязатеьную проверку",
"Form values": "Значения формы",
"Fields values": "Значения полей",
'The field has bee deleted': 'Поле было удалено',
"When submitting the following fields, the saved values are": "При отправке следующих полей, сохраненные значения такие",
"After successful submission": "После удачной отправки",
"Then": "Затем",

View File

@ -362,6 +362,7 @@ export default {
"Skip required validation": "Zorunlu alan kontrollerini atla",
"Form values": "Form değerleri",
"Fields values": "Alanların değerleri",
'The field has bee deleted': 'Alan silindi',
"When submitting the following fields, the saved values are": "Aşağıdaki alanlar gönderilirken kaydedilen değerler",
"After successful submission": "Başarılı gönderimden sonra",
"Then": "Then",

View File

@ -536,6 +536,7 @@ export default {
'Skip required validation': '跳过必填校验',
'Form values': '表单值',
'Fields values': '字段值',
'The field has bee deleted': '字段已删除',
'When submitting the following fields, the saved values are': '提交以下字段时,保存的值为',
'After successful submission': '提交成功后',
'Then': '然后',