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 { merge } from '@formily/shared';
import { concat } from 'lodash'; import { concat } from 'lodash';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useActionContext, useCompile, useComponent, useFormBlockContext, useRecord } from '..'; import { useActionContext, useCompile, useComponent, useFormBlockContext, useRecord } from '..';
import { CollectionFieldProvider } from './CollectionFieldProvider'; import { CollectionFieldProvider } from './CollectionFieldProvider';
import { useCollectionField } from './hooks'; import { useCollectionField } from './hooks';
@ -97,6 +98,12 @@ export const InternalFallbackField = () => {
return <div>{displayText}</div>; 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) => { export const CollectionField = connect((props) => {
const fieldSchema = useFieldSchema(); const fieldSchema = useFieldSchema();
const field = fieldSchema?.['x-component-props']?.['field']; const field = fieldSchema?.['x-component-props']?.['field'];
@ -105,7 +112,7 @@ export const CollectionField = connect((props) => {
<CollectionFieldProvider <CollectionFieldProvider
name={fieldSchema.name} name={fieldSchema.name}
field={field} field={field}
fallback={snapshot ? <InternalFallbackField /> : null} fallback={snapshot ? <InternalFallbackField /> : <DeletedField />}
> >
<InternalField {...props} /> <InternalField {...props} />
</CollectionFieldProvider> </CollectionFieldProvider>

View File

@ -498,6 +498,7 @@ export default {
"Skip required validation": "Skip required validation", "Skip required validation": "Skip required validation",
"Form values": "Form values", "Form values": "Form values",
"Fields values": "Fields 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", "When submitting the following fields, the saved values are": "When submitting the following fields, the saved values are",
"After successful submission": "After successful submission", "After successful submission": "After successful submission",
"Then": "Then", "Then": "Then",

View File

@ -54,40 +54,40 @@ export default {
"Delete": "削除", "Delete": "削除",
"UI editor": "UI エディタ", "UI editor": "UI エディタ",
"Collection": "コレクション", "Collection": "コレクション",
"Enable child collections":"启用子表", "Enable child collections": "启用子表",
"Allow adding records to the current collection":"現在のデータ・フォームへのレコードの追加を許可する", "Allow adding records to the current collection": "現在のデータ・フォームへのレコードの追加を許可する",
"Collections & Fields": "コレクションとフィールド", "Collections & Fields": "コレクションとフィールド",
"All collections":"すべてのデータテーブル", "All collections": "すべてのデータテーブル",
"Add category":"分類の追加", "Add category": "分類の追加",
"Edit category":"分類の編集", "Edit category": "分類の編集",
"Sort":"ソート#ソート#", "Sort": "ソート#ソート#",
"Categories":"データテーブルカテゴリ", "Categories": "データテーブルカテゴリ",
"Category name":"分類名", "Category name": "分類名",
"Delete category":"分類の削除", "Delete category": "分類の削除",
"Collection category":"Collection category", "Collection category": "Collection category",
'Add child':'サブレコードの追加', 'Add child': 'サブレコードの追加',
'Collapse all':'すべて閉じる', 'Collapse all': 'すべて閉じる',
'Expand all':'すべて展開', 'Expand all': 'すべて展開',
'Expand/Collapse':'展開と終了', 'Expand/Collapse': '展開と終了',
"Tree table":"ツリーテーブル", "Tree table": "ツリーテーブル",
"Visible":"表示", "Visible": "表示",
"Read only":"読み取り専用(編集不可)", "Read only": "読み取り専用(編集不可)",
"Easy reading":"読み取り専用(読取りモード)", "Easy reading": "読み取り専用(読取りモード)",
"Hidden":"非表示", "Hidden": "非表示",
"Hidden(reserved value)":"非表示(値の保持)", "Hidden(reserved value)": "非表示(値の保持)",
"Not required":"必須ではありません", "Not required": "必須ではありません",
"Value":"フィールド値", "Value": "フィールド値",
"Disabled":"無効化", "Disabled": "無効化",
"Enabled":"有効化", "Enabled": "有効化",
'On':'有効化', 'On': '有効化',
'Off':'無効化', 'Off': '無効化',
"Empty":"くうきち", "Empty": "くうきち",
"Linkage rule":"連動規則", "Linkage rule": "連動規則",
"Linkage rules":"連動規則", "Linkage rules": "連動規則",
"Condition":"条件#ジョウケン#", "Condition": "条件#ジョウケン#",
"Properties":"属性#ゾクセイ#", "Properties": "属性#ゾクセイ#",
"Add linkage rule":"連動規則の追加", "Add linkage rule": "連動規則の追加",
"Add property":"属性の追加", "Add property": "属性の追加",
"Roles & Permissions": "役割と権限", "Roles & Permissions": "役割と権限",
"Edit profile": "プロフィール", "Edit profile": "プロフィール",
"Change password": "パスワード変更", "Change password": "パスワード変更",
@ -104,22 +104,22 @@ export default {
"Set the data scope": "データ範囲の設定", "Set the data scope": "データ範囲の設定",
"Data blocks": "データブロック", "Data blocks": "データブロック",
"Filter blocks": "フィルターブロック", "Filter blocks": "フィルターブロック",
"Table OID(Inheritance)":"データテーブルOID(継承)", "Table OID(Inheritance)": "データテーブルOID(継承)",
"Table": "テーブル", "Table": "テーブル",
"Form": "フォーム", "Form": "フォーム",
"Collapse": "折りたたみ", "Collapse": "折りたたみ",
"Select data source": "データソースを選択", "Select data source": "データソースを選択",
"Calendar": "カレンダー", "Calendar": "カレンダー",
"Kanban": "かんばん", "Kanban": "かんばん",
"Gantt":"ガント図", "Gantt": "ガント図",
"Create gantt block":"ガントチャートブロックの作成", "Create gantt block": "ガントチャートブロックの作成",
"Progress field":"進捗フィールド", "Progress field": "進捗フィールド",
"Time scale":"時間スケールレベル", "Time scale": "時間スケールレベル",
"Hour":"時間", "Hour": "時間",
"Quarter of day":"四分の一日", "Quarter of day": "四分の一日",
"Half of day":"半日", "Half of day": "半日",
"Year":"年", "Year": "年",
"QuarterYear":"四半期", "QuarterYear": "四半期",
"Select grouping field": "グループフィールドを選択してください", "Select grouping field": "グループフィールドを選択してください",
"Media": "メディア", "Media": "メディア",
"Markdown": "マークダウン", "Markdown": "マークダウン",
@ -174,20 +174,20 @@ export default {
"Create collection": "コレクションの作成", "Create collection": "コレクションの作成",
"Collection display name": "コレクション名", "Collection display name": "コレクション名",
"Collection name": "コレクション識別子", "Collection name": "コレクション識別子",
"Inherits":"継承", "Inherits": "継承",
"AutoGenId":"IDフィールドの自動生成", "AutoGenId": "IDフィールドの自動生成",
"CreatedBy":"レコード作成者", "CreatedBy": "レコード作成者",
"UpdatedBy":"レコード最終更新者", "UpdatedBy": "レコード最終更新者",
"CreatedAt":"レコード作成時間", "CreatedAt": "レコード作成時間",
"UpdatedAt":"レコード最終更新時間", "UpdatedAt": "レコード最終更新時間",
"Records can be sorted":"ソート可能", "Records can be sorted": "ソート可能",
"Collection template":"データテーブルテンプレート", "Collection template": "データテーブルテンプレート",
"Calendar collection":"カレンダデータテーブル", "Calendar collection": "カレンダデータテーブル",
"General collection":"一般データテーブル", "General collection": "一般データテーブル",
"Connect to database view":"ビューに接続", "Connect to database view": "ビューに接続",
"Source collections":"ソースデータセット", "Source collections": "ソースデータセット",
"Field source":"ソースフィールド", "Field source": "ソースフィールド",
"Preview":"プレビュー", "Preview": "プレビュー",
"Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.": "ランダムに生成され、変更可能です。 アルファベット、数字、アンダースコアをサポートし、アルファベットから始まる必要があります。", "Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.": "ランダムに生成され、変更可能です。 アルファベット、数字、アンダースコアをサポートし、アルファベットから始まる必要があります。",
"Storage type": "ストレージタイプ", "Storage type": "ストレージタイプ",
"Edit": "編集", "Edit": "編集",
@ -195,8 +195,8 @@ export default {
"Configure fields": "フィールドの設定", "Configure fields": "フィールドの設定",
"Configure columns": "カラムの設定", "Configure columns": "カラムの設定",
"Edit field": "フィールドの編集", "Edit field": "フィールドの編集",
"Override":"書き換え", "Override": "書き換え",
"Override field":"フィールドの上書き", "Override field": "フィールドの上書き",
"Configure fields of {{title}}": "{{title}}のフィールド設定", "Configure fields of {{title}}": "{{title}}のフィールド設定",
"Basic": "基本タイプ", "Basic": "基本タイプ",
"Single line text": "一行テキスト", "Single line text": "一行テキスト",
@ -421,6 +421,7 @@ export default {
"Skip required validation": "必須のバリデーションをスキップ", "Skip required validation": "必須のバリデーションをスキップ",
"Form values": "フォームの値", "Form values": "フォームの値",
"Fields values": "フィールドの値", "Fields values": "フィールドの値",
'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": "その後",
@ -475,10 +476,10 @@ export default {
"General permissions": "一般設定", "General permissions": "一般設定",
"Global action permissions": "グローバル操作権限", "Global action permissions": "グローバル操作権限",
"General action permissions": "一般操作権限", "General action permissions": "一般操作権限",
"Plugin settings permissions":"中央権限の設定", "Plugin settings permissions": "中央権限の設定",
'Allow to desgin pages':"インタフェース構成の許可", 'Allow to desgin pages': "インタフェース構成の許可",
"Allow to manage plugins":"管理プラグインの許可", "Allow to manage plugins": "管理プラグインの許可",
"Allow to configure plugins":"管理構成センターの許可", "Allow to configure plugins": "管理構成センターの許可",
"Action display name": "操作名", "Action display name": "操作名",
"Allow": "許可する", "Allow": "許可する",
"Data scope": "レコードスコープ", "Data scope": "レコードスコープ",

View File

@ -457,7 +457,8 @@ export default {
"Delete table column": "Excluir coluna da tabela", "Delete table column": "Excluir coluna da tabela",
"Skip required validation": "Ignorar validação obrigatória", "Skip required validation": "Ignorar validação obrigatória",
"Form values": "Valores do formulário", "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", "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", "After successful submission": "Depois do envio bem-sucedido",
"Then": "Então", "Then": "Então",

View File

@ -363,6 +363,7 @@ export default {
"Skip required validation": "Пропустить обязатеьную проверку", "Skip required validation": "Пропустить обязатеьную проверку",
"Form values": "Значения формы", "Form values": "Значения формы",
"Fields values": "Значения полей", "Fields values": "Значения полей",
'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

@ -362,6 +362,7 @@ export default {
"Skip required validation": "Zorunlu alan kontrollerini atla", "Skip required validation": "Zorunlu alan kontrollerini atla",
"Form values": "Form değerleri", "Form values": "Form değerleri",
"Fields values": "Alanların 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", "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", "After successful submission": "Başarılı gönderimden sonra",
"Then": "Then", "Then": "Then",

View File

@ -536,6 +536,7 @@ export default {
'Skip required validation': '跳过必填校验', 'Skip required validation': '跳过必填校验',
'Form values': '表单值', 'Form values': '表单值',
'Fields values': '字段值', 'Fields values': '字段值',
'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': '然后',