mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
feat: keep reference templates feature (#6743)
* feat: be able to create reference template * chore: update template title * fix: template menu position inconsitant * chore: add reference templates into block template management view * fix: menu not correct * fix: incorrect label * chore: remove useless component * fix: build error * fix: incorrect translate * fix: incorrect translate tab [skip ci] * chore: remove edit icon[skip ci] * fix: e2e tests failing
This commit is contained in:
parent
5b0b208515
commit
b923d89fa0
@ -500,7 +500,8 @@
|
||||
"Turn pages": "Seiten umblättern",
|
||||
"Others": "Andere",
|
||||
"Other records": "Andere Datensätze",
|
||||
"Save as template": "Als Vorlage speichern",
|
||||
"Save as reference template": "Als Referenzvorlage speichern",
|
||||
"Save as inherited template": "Als vererbte Vorlage speichern",
|
||||
"Save as block template": "Als Blockvorlage speichern",
|
||||
"Block templates": "Blockvorlagen",
|
||||
"Block template": "Blockvorlage",
|
||||
@ -589,6 +590,7 @@
|
||||
"Blank block": "Leerer Block",
|
||||
"Duplicate template": "Vorlage duplizieren",
|
||||
"Reference template": "Referenzvorlage",
|
||||
"Inherited template": "Vererbte Vorlage",
|
||||
"Create calendar block": "Kalenderblock erstellen",
|
||||
"Create kanban block": "Kanban-Block erstellen",
|
||||
"Grouping field": "Gruppierungsfeld",
|
||||
|
@ -505,7 +505,7 @@
|
||||
"Save as block template": "Save as block template",
|
||||
"Block templates": "Block templates",
|
||||
"Block template": "Block template",
|
||||
"Convert reference to duplicate": "Convert reference to duplicate",
|
||||
"Convert template to duplicate": "Convert template to duplicate",
|
||||
"Template name": "Template name",
|
||||
"Block type": "Block type",
|
||||
"No blocks to connect": "No blocks to connect",
|
||||
@ -590,6 +590,7 @@
|
||||
"Blank block": "Blank block",
|
||||
"Duplicate template": "Duplicate template",
|
||||
"Reference template": "Reference template",
|
||||
"Inherited template": "Inherited template",
|
||||
"Create calendar block": "Create calendar block",
|
||||
"Create kanban block": "Create kanban block",
|
||||
"Grouping field": "Grouping field",
|
||||
@ -889,7 +890,6 @@
|
||||
"No pages yet, please configure first": "No pages yet, please configure first",
|
||||
"Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode": "Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode",
|
||||
"Deprecated": "Deprecated",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "The following old template features have been deprecated and will be removed in next version.",
|
||||
"Full permissions": "Full permissions",
|
||||
"Refresh data blocks": "Refresh data blocks",
|
||||
"Select data blocks to refresh": "Select data blocks to refresh",
|
||||
|
@ -470,7 +470,8 @@
|
||||
"Turn pages": "Pasar páginas",
|
||||
"Others": "Otros",
|
||||
"Other records": "Otros registros",
|
||||
"Save as template": "Guardar como plantilla",
|
||||
"Save as reference template": "Guardar como plantilla de referencia",
|
||||
"Save as inherited template": "Guardar como plantilla heredada",
|
||||
"Save as block template": "Guardar como plantilla de bloque",
|
||||
"Block templates": "Bloquear plantillas",
|
||||
"Block template": "Plantilla de bloque",
|
||||
@ -560,6 +561,7 @@
|
||||
"Blank block": "Bloque en blanco",
|
||||
"Duplicate template": "Duplicar plantilla",
|
||||
"Reference template": "Plantilla de referencia",
|
||||
"Inherited template": "Plantilla heredada",
|
||||
"Create calendar block": "Crear bloque de calendario",
|
||||
"Create kanban block": "Crear bloque kanban",
|
||||
"Grouping field": "Campo de agrupación",
|
||||
@ -806,7 +808,6 @@
|
||||
"No pages yet, please configure first": "Aún no hay páginas, por favor configura primero",
|
||||
"Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode": "Haga clic en el icono \"Editor de UI\" en la esquina superior derecha para entrar en el modo de Editor de UI.",
|
||||
"Deprecated": "Obsoleto",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "Las siguientes características de plantilla antigua han quedado obsoletas y se eliminarán en la próxima versión.",
|
||||
"Full permissions": "Todos los derechos",
|
||||
"Refresh data blocks": "Actualizar bloques de datos",
|
||||
"Select data blocks to refresh": "Actualizar bloques de datos",
|
||||
|
@ -485,7 +485,8 @@
|
||||
"Turn pages": "Tourner les pages",
|
||||
"Others": "Autres",
|
||||
"Other records": "Autres enregistrements",
|
||||
"Save as template": "Enregistrer en tant que modèle",
|
||||
"Save as reference template": "Enregistrer en tant que modèle de référence",
|
||||
"Save as inherited template": "Enregistrer en tant que modèle hérité",
|
||||
"Save as block template": "Enregistrer en tant que modèle de bloc",
|
||||
"Block templates": "Modèles de bloc",
|
||||
"Block template": "Modèle de bloc",
|
||||
@ -573,6 +574,7 @@
|
||||
"Blank block": "Bloc vierge",
|
||||
"Duplicate template": "Dupliquer le modèle",
|
||||
"Reference template": "Référencer le modèle",
|
||||
"Inherited template": "Modèle hérité",
|
||||
"Create calendar block": "Créer un bloc de calendrier",
|
||||
"Create kanban block": "Créer un bloc kanban",
|
||||
"Grouping field": "Champ de regroupement",
|
||||
@ -826,7 +828,6 @@
|
||||
"No pages yet, please configure first": "Pas encore de pages, veuillez configurer d'abord",
|
||||
"Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode": "Cliquez sur l'icône \"Éditeur d'interface utilisateur\" dans le coin supérieur droit pour entrer en mode Éditeur d'interface utilisateur",
|
||||
"Deprecated": "Déprécié",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "Les fonctionnalités des anciens modèles ont été dépréciées et seront supprimées dans la prochaine version.",
|
||||
"Full permissions": "Tous les droits",
|
||||
"Refresh data blocks": "Actualiser les blocs de données",
|
||||
"Select data blocks to refresh": "Actualiser les blocs de données",
|
||||
|
@ -494,7 +494,8 @@
|
||||
"Turn pages": "Volta pagine",
|
||||
"Others": "Altri",
|
||||
"Other records": "Altri record",
|
||||
"Save as template": "Salva come modello",
|
||||
"Save as reference template": "Salva come modello di riferimento",
|
||||
"Save as inherited template": "Salva come modello ereditato",
|
||||
"Save as block template": "Salva come modello blocco",
|
||||
"Block templates": "Modelli blocco",
|
||||
"Block template": "Modello blocco",
|
||||
@ -580,6 +581,7 @@
|
||||
"Blank block": "Blocco vuoto",
|
||||
"Duplicate template": "Modello duplicato",
|
||||
"Reference template": "Modello di riferimento",
|
||||
"Inherited template": "Modello ereditato",
|
||||
"Create calendar block": "Crea blocco calendario",
|
||||
"Create kanban block": "Crea blocco kanban",
|
||||
"Grouping field": "Campo di raggruppamento",
|
||||
|
@ -397,7 +397,8 @@
|
||||
"Turn pages": "ページをめくる",
|
||||
"Others": "その他",
|
||||
"Other records": "他のレコード",
|
||||
"Save as template": "テンプレートとして保存",
|
||||
"Save as reference template": "参照テンプレートとして保存",
|
||||
"Save as inherited template": "継承テンプレートとして保存",
|
||||
"Save as block template": "ブロックテンプレートとして保存",
|
||||
"Block templates": "ブロックテンプレート",
|
||||
"Block template": "ブロックテンプレート",
|
||||
@ -472,6 +473,7 @@
|
||||
"Blank block": "空のブロック",
|
||||
"Duplicate template": "テンプレートをコピー",
|
||||
"Reference template": "テンプレートを参照",
|
||||
"Inherited template": "継承テンプレート",
|
||||
"Create calendar block": "カレンダーブロックの作成",
|
||||
"Create kanban block": "かんばんブロックの作成",
|
||||
"Grouping field": "グループフィールド",
|
||||
@ -1044,7 +1046,6 @@
|
||||
"No pages yet, please configure first": "まだページがありません。最初に設定してください",
|
||||
"Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode": "ユーザーインターフェースエディターモードに入るには、右上隅の「UIエディタ」アイコンをクリックしてください",
|
||||
"Deprecated": "非推奨",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "次の古いテンプレート機能は非推奨になり、次のバージョンで削除されます。",
|
||||
"Full permissions": "すべての権限",
|
||||
"Refresh data blocks": "データブロックを更新",
|
||||
"Select data blocks to refresh": "データブロックを選択して更新",
|
||||
|
@ -517,7 +517,8 @@
|
||||
"Turn pages": "페이지 넘김",
|
||||
"Others": "기타",
|
||||
"Other records": "기타 레코드",
|
||||
"Save as template": "템플릿으로 저장",
|
||||
"Save as reference template": "참조 템플릿으로 저장",
|
||||
"Save as inherited template": "상속 템플릿으로 저장",
|
||||
"Save as block template": "블록 템플릿으로 저장",
|
||||
"Block templates": "블록 템플릿",
|
||||
"Block template": "블록 템플릿",
|
||||
@ -601,6 +602,7 @@
|
||||
"Blank block": "빈 블록",
|
||||
"Duplicate template": "템플릿 복제",
|
||||
"Reference template": "참조 템플릿",
|
||||
"Inherited template": "상속 템플릿",
|
||||
"Create calendar block": "캘린더 블록 생성",
|
||||
"Create kanban block": "칸반 블록 생성",
|
||||
"Grouping field": "그루핑 필드",
|
||||
@ -917,7 +919,6 @@
|
||||
"No pages yet, please configure first": "아직 페이지가 없습니다. 먼저 설정하십시오",
|
||||
"Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode": "사용자 인터페이스 편집기 모드에 들어가려면 오른쪽 상단의 \"UI 편집기\" 아이콘을 클릭하십시오",
|
||||
"Deprecated": "사용 중단됨",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "다음 오래된 템플릿 기능은 사용 중단되었으며 다음 버전에서 제거될 것입니다.",
|
||||
"Full permissions": "모든 권한",
|
||||
"Refresh data blocks": "데이터 블록 새로 고침",
|
||||
"Select data blocks to refresh": "데이터 블록을 선택하여 새로 고침",
|
||||
|
@ -504,7 +504,8 @@
|
||||
"Turn pages": "Pagina's omslaan",
|
||||
"Others": "Overigen",
|
||||
"Other records": "Andere records",
|
||||
"Save as template": "Opslaan als sjabloon",
|
||||
"Save as reference template": "Opslaan als referentiesjabloon",
|
||||
"Save as inherited template": "Opslaan als overerfde sjabloon",
|
||||
"Save as block template": "Opslaan als bloksjabloon",
|
||||
"Block templates": "Bloksjablonen",
|
||||
"Block template": "Bloksjabloon",
|
||||
@ -593,6 +594,7 @@
|
||||
"Blank block": "Leeg blok",
|
||||
"Duplicate template": "Sjabloon dupliceren",
|
||||
"Reference template": "Sjabloon refereren",
|
||||
"Inherited template": "Overerfde sjabloon",
|
||||
"Create calendar block": "Kalenderblok maken",
|
||||
"Create kanban block": "Kanbanblok maken",
|
||||
"Grouping field": "Groepeer veld",
|
||||
|
@ -433,7 +433,8 @@
|
||||
"Turn pages": "Virar páginas",
|
||||
"Others": "Outros",
|
||||
"Other records": "Outros registros",
|
||||
"Save as template": "Salvar como modelo",
|
||||
"Save as reference template": "Salvar como modelo de referência",
|
||||
"Save as inherited template": "Salvar como modelo herdado",
|
||||
"Save as block template": "Salvar como modelo de bloco",
|
||||
"Block templates": "Modelos de bloco",
|
||||
"Block template": "Modelo de bloco",
|
||||
@ -525,6 +526,7 @@
|
||||
"Blank block": "Bloco em branco",
|
||||
"Duplicate template": "Duplicar modelo",
|
||||
"Reference template": "Modelo de referência",
|
||||
"Inherited template": "Modelo herdado",
|
||||
"Create calendar block": "Criar bloco de calendário",
|
||||
"Create kanban block": "Criar bloco Kanban",
|
||||
"Grouping field": "Campo de agrupamento",
|
||||
@ -781,7 +783,6 @@
|
||||
"Are you sure you want to hide this tab?": "Tem certeza de que deseja ocultar esta guia?",
|
||||
"After hiding, this tab will no longer appear in the tab bar. To show it again, you need to go to the route management page to set it.": "Depois de ocultar, esta guia não aparecerá mais na barra de guias. Para mostrá-la novamente, você precisa ir à página de gerenciamento de rotas para configurá-la.",
|
||||
"Deprecated": "Descontinuado",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "As seguintes funcionalidades de modelo antigo foram descontinuadas e serão removidas na próxima versão.",
|
||||
"Full permissions": "Todas as permissões",
|
||||
"No pages yet, please configure first": "Ainda não há páginas, por favor configure primeiro",
|
||||
"Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode": "Cliquez sur l'icône \"Éditeur d'interface utilisateur\" dans le coin supérieur droit pour entrer en mode Éditeur d'interface utilisateur",
|
||||
|
@ -337,7 +337,8 @@
|
||||
"Turn pages": "Перелистывать страницы",
|
||||
"Others": "Другие",
|
||||
"Other records": "Другие записи",
|
||||
"Save as template": "Сохранить как шаблон",
|
||||
"Save as reference template": "Сохранить как шаблон ссылки",
|
||||
"Save as inherited template": "Сохранить как шаблон наследования",
|
||||
"Save as block template": "Сохранить как шаблон Блока",
|
||||
"Block templates": "Шаблоны блоков",
|
||||
"Convert reference to duplicate": "Преобразовать ссылку в дубликат",
|
||||
@ -411,6 +412,7 @@
|
||||
"Blank block": "Пустой блок",
|
||||
"Duplicate template": "Дублировать шаблон",
|
||||
"Reference template": "Справочный шаблон",
|
||||
"Inherited template": "Наследуемый шаблон",
|
||||
"Create calendar block": "Создать блок календаря",
|
||||
"Create kanban block": "Создать блок Канбан",
|
||||
"Grouping field": "Поле группировки",
|
||||
@ -610,7 +612,6 @@
|
||||
"Are you sure you want to hide this tab?": "Вы уверены, что хотите скрыть эту вкладку?",
|
||||
"After hiding, this tab will no longer appear in the tab bar. To show it again, you need to go to the route management page to set it.": "После скрытия этой вкладки она больше не будет отображаться во вкладке. Чтобы снова отобразить ее, вам нужно будет перейти на страницу управления маршрутами, чтобы установить ее.",
|
||||
"Deprecated": "Устаревший",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "Следующие старые функции шаблонов устарели и будут удалены в следующей версии.",
|
||||
"Full permissions": "Полные права",
|
||||
"No pages yet, please configure first": "Пока нет страниц, пожалуйста, настройте сначала",
|
||||
"Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode": "Нажмите на значок \"Редактор пользовательского интерфейса\" в правом верхнем углу, чтобы войти в режим редактора пользовательского интерфейса",
|
||||
|
@ -336,7 +336,8 @@
|
||||
"Turn pages": "Sayfaları çevir",
|
||||
"Others": "Diğerleri",
|
||||
"Other records": "Diğer kayıtlar",
|
||||
"Save as template": "Şablon olarak kaydet",
|
||||
"Save as reference template": "Referans şablonu olarak kaydet",
|
||||
"Save as inherited template": "Kalıtım şablonu olarak kaydet",
|
||||
"Save as block template": "Blok şablonu olarak kaydet",
|
||||
"Block templates": "Blok şablonları",
|
||||
"Block template": "Blok şablonu",
|
||||
@ -411,6 +412,7 @@
|
||||
"Blank block": "Boş blok",
|
||||
"Duplicate template": "Şablonun kopyasını oluştur",
|
||||
"Reference template": "Referans şablon",
|
||||
"Inherited template": "Kalıtım şablonu",
|
||||
"Create calendar block": "Takvim bloğu oluştur",
|
||||
"Create kanban block": "Kanban bloğu oluştur",
|
||||
"Grouping field": "Alan gruplandırma",
|
||||
@ -608,7 +610,6 @@
|
||||
"Are you sure you want to hide this tab?": "Bu sekmeyi gizlemek istediğinizden emin misiniz?",
|
||||
"After hiding, this tab will no longer appear in the tab bar. To show it again, you need to go to the route management page to set it.": "Gizlendikten sonra, bu sekme artık sekme çubuğunda görünmeyecek. Onu tekrar göstermek için, rotayı yönetim sayfasına gidip ayarlamanız gerekiyor.",
|
||||
"Deprecated": "Kullanımdan kaldırıldı",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "Aşağıdaki eski şablon özellikleri kullanımdan kaldırıldı ve gelecek sürümlerde kaldırılacaktır.",
|
||||
"Full permissions": "Tüm izinler",
|
||||
"No pages yet, please configure first": "Henüz sayfa yok, lütfen önce yapılandırın",
|
||||
"Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode": "Kullanıcı arayüzü düzenleyici moduna girmek için sağ üst köşedeki \"Kullanıcı Arayüzü Düzenleyici\" simgesine tıklayın",
|
||||
|
@ -487,7 +487,8 @@
|
||||
"Turn pages": "Переключати сторінки",
|
||||
"Others": "Інші",
|
||||
"Other records": "Інші записи",
|
||||
"Save as template": "Зберегти як шаблон",
|
||||
"Save as reference template": "Зберегти як шаблон посилання",
|
||||
"Save as inherited template": "Зберегти як шаблон нащадка",
|
||||
"Save as block template": "Зберегти як шаблон блока",
|
||||
"Block templates": "Шаблони блоків",
|
||||
"Block template": "Шаблон блока",
|
||||
@ -577,6 +578,7 @@
|
||||
"Blank block": "Порожній блок",
|
||||
"Duplicate template": "Дублювати шаблон",
|
||||
"Reference template": "Посилання на шаблон",
|
||||
"Inherited template": "Нащадковий шаблон",
|
||||
"Create calendar block": "Створити блок календаря",
|
||||
"Create kanban block": "Створити блок канбану",
|
||||
"Grouping field": "Поле для групування",
|
||||
@ -824,7 +826,6 @@
|
||||
"Are you sure you want to hide this tab?": "Ви впевнені, що хочете приховати цю вкладку?",
|
||||
"After hiding, this tab will no longer appear in the tab bar. To show it again, you need to go to the route management page to set it.": "Після приховування цієї вкладки вона більше не з'явиться в панелі вкладок. Щоб знову показати її, вам потрібно перейти на сторінку керування маршрутами, щоб налаштувати її.",
|
||||
"Deprecated": "Застаріло",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "Наступні старі функції шаблонів були застарілі і будуть видалені в наступній версії.",
|
||||
"Full permissions": "Повні права",
|
||||
"No pages yet, please configure first": "Ще немає сторінок, будь ласка, спочатку налаштуйте",
|
||||
"Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode": "Натисніть на значок \"Редактор користувацького інтерфейсу\" в правому верхньому куті, щоб увійти в режим редактора користувацького інтерфейсу.",
|
||||
|
@ -527,7 +527,8 @@
|
||||
"Turn pages": "翻页",
|
||||
"Others": "其他",
|
||||
"Other records": "其他记录",
|
||||
"Save as template": "保存为模板",
|
||||
"Save as reference template": "保存为引用模板",
|
||||
"Save as inherited template": "保存为继承模板",
|
||||
"Save as block template": "保存为区块模板",
|
||||
"Block templates": "区块模板",
|
||||
"Block template": "区块模板",
|
||||
@ -611,6 +612,7 @@
|
||||
"Blank block": "空区块",
|
||||
"Duplicate template": "复制模板",
|
||||
"Reference template": "引用模板",
|
||||
"Inherited template": "继承模板",
|
||||
"Create calendar block": "创建日历区块",
|
||||
"Create kanban block": "创建看板区块",
|
||||
"Grouping field": "分组字段",
|
||||
@ -1088,7 +1090,6 @@
|
||||
"Are you sure you want to hide this tab?": "你确定要隐藏该标签页吗?",
|
||||
"After hiding, this tab will no longer appear in the tab bar. To show it again, you need to go to the route management page to set it.": "隐藏后,该标签将不再显示在标签栏中。要想再次显示它,你需要到路由管理页面进行设置。",
|
||||
"Deprecated": "已弃用",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "以下旧的模板功能已弃用,将在下个版本移除。",
|
||||
"Full permissions": "全部权限",
|
||||
"Enable index column": "启用序号列",
|
||||
"Date scope": "日期范围",
|
||||
|
@ -518,7 +518,8 @@
|
||||
"Turn pages": "翻頁",
|
||||
"Others": "其他",
|
||||
"Other records": "其他記錄",
|
||||
"Save as template": "儲存為模板",
|
||||
"Save as reference template": "儲存為引用模板",
|
||||
"Save as inherited template": "儲存為繼承模板",
|
||||
"Save as block template": "儲存為區塊模板",
|
||||
"Block templates": "區塊模板",
|
||||
"Block template": "區塊模板",
|
||||
@ -602,6 +603,7 @@
|
||||
"Blank block": "空區塊",
|
||||
"Duplicate template": "複製模板",
|
||||
"Reference template": "引用模板",
|
||||
"Inherited template": "繼承模板",
|
||||
"Create calendar block": "建立日曆區塊",
|
||||
"Create kanban block": "建立看板區塊",
|
||||
"Grouping field": "群組欄位",
|
||||
@ -915,7 +917,6 @@
|
||||
"Are you sure you want to hide this tab?": "你確定要隱藏這個標籤嗎?",
|
||||
"After hiding, this tab will no longer appear in the tab bar. To show it again, you need to go to the route management page to set it.": "隱藏後,這個標籤將不再出現在標籤欄中。要再次顯示它,你需要到路由管理頁面進行設置。",
|
||||
"Deprecated": "已棄用",
|
||||
"The following old template features have been deprecated and will be removed in next version.": "以下舊的模板功能已棄用,將在下個版本移除。",
|
||||
"Full permissions": "完全權限",
|
||||
"No pages yet, please configure first": "尚未配置頁面,請先配置",
|
||||
"Click the \"UI Editor\" icon in the upper right corner to enter the UI Editor mode": "點擊右上角的 \"介面設定\" 圖示進入介面設定模式",
|
||||
|
@ -39,7 +39,7 @@ test.describe('where table block can be added', () => {
|
||||
await page.getByLabel('schema-initializer-Grid-popup').hover();
|
||||
await page.getByRole('menuitem', { name: 'Table right' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'childAssociationField' }).waitFor({ state: 'detached' });
|
||||
await page.getByRole('menuitem', { name: 'Associated records' }).last().hover();
|
||||
await page.getByRole('menuitem', { name: 'Associated records right' }).last().hover();
|
||||
await page.getByRole('menuitem', { name: 'childAssociationField' }).click();
|
||||
await page
|
||||
.getByTestId('drawer-Action.Container-childCollection-View record')
|
||||
@ -50,8 +50,9 @@ test.describe('where table block can be added', () => {
|
||||
// 添加父表关系区块
|
||||
await page.getByRole('menuitem', { name: 'Table right' }).waitFor({ state: 'detached' });
|
||||
await page.getByLabel('schema-initializer-Grid-popup').hover();
|
||||
await page.getByRole('menuitem', { name: 'Associated records right' }).waitFor({ state: 'detached' });
|
||||
await page.getByRole('menuitem', { name: 'Table right' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Associated records' }).last().hover();
|
||||
await page.getByRole('menuitem', { name: 'Associated records right' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'parentAssociationField' }).click();
|
||||
await page.getByLabel('schema-initializer-TableV2-table:configureColumns-parentTargetCollection').hover();
|
||||
await page.getByRole('menuitem', { name: 'parentTargetText' }).click();
|
||||
@ -72,6 +73,7 @@ test.describe('where table block can be added', () => {
|
||||
|
||||
// 通过 Other records 创建一个表格区块
|
||||
await page.getByLabel('schema-initializer-Grid-popup').hover();
|
||||
await page.getByRole('menuitem', { name: 'Other records right' }).waitFor({ state: 'detached' });
|
||||
await page.getByRole('menuitem', { name: 'Table right' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Other records right' }).hover();
|
||||
await page.getByRole('menuitem', { name: 'Users' }).click();
|
||||
|
@ -41,7 +41,7 @@ export const usePopupSettings = () => {
|
||||
const isOldMobileMode = pathname?.includes('/mobile/') || hash?.includes('/mobile/');
|
||||
const isNewMobileMode = pathname?.includes('/m/');
|
||||
const isPCMode = pathname?.includes('/admin/');
|
||||
const isMobileTemplateSettingsPage = pathname?.includes('/m/block-templates/');
|
||||
const isMobileTemplateSettingsPage = pathname?.includes('/m/block-templates/inherited');
|
||||
|
||||
return (
|
||||
(isPCMode || isNewMobileMode) &&
|
||||
|
@ -1,29 +0,0 @@
|
||||
/**
|
||||
* This file is part of the NocoBase (R) project.
|
||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
||||
* Authors: NocoBase Team.
|
||||
*
|
||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons';
|
||||
import { Space, Tooltip } from 'antd';
|
||||
|
||||
export const DeprecatedTemplateTitle = () => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Space>
|
||||
{t('Deprecated')}
|
||||
<Tooltip
|
||||
title={t('The following old template features have been deprecated and will be removed in next version.')}
|
||||
>
|
||||
<QuestionCircleOutlined />
|
||||
</Tooltip>
|
||||
</Space>
|
||||
);
|
||||
};
|
||||
|
||||
export const DeprecatedTemplateTitleElement = <DeprecatedTemplateTitle />;
|
@ -36,7 +36,6 @@ import { isAssocField } from '../filter-provider/utils';
|
||||
import { useActionContext, useCompile, useDesignable } from '../schema-component';
|
||||
import { useSchemaTemplateManager } from '../schema-templates';
|
||||
import { useBlockTemplateContext } from '../schema-templates/BlockTemplateProvider';
|
||||
import { DeprecatedTemplateTitleElement } from './components/DeprecatedTemplateTitle';
|
||||
|
||||
export const itemsMerge = (items1) => {
|
||||
return items1;
|
||||
@ -838,66 +837,71 @@ export const useRecordCollectionDataSourceItems = (
|
||||
.filter((template) => {
|
||||
return ['FormItem', 'ReadPrettyFormItem'].includes(componentName) || template.resourceName === resourceName;
|
||||
});
|
||||
const extralCollectionMenuItems = Array.from(initializerMenusGenerators.values())
|
||||
const inheritedTemplatesMenuItems = Array.from(initializerMenusGenerators.values())
|
||||
.map((generator) => generator({ collection, componentName }))
|
||||
.filter(Boolean)
|
||||
.flat();
|
||||
if ((!templates.length && !extralCollectionMenuItems.length) || isInTemplateSettingPage()) {
|
||||
if ((!templates.length && !inheritedTemplatesMenuItems.length) || isInTemplateSettingPage()) {
|
||||
return [];
|
||||
}
|
||||
const index = 0;
|
||||
const deprecatedTemplatesMenuItems = [];
|
||||
const allTemplatesMenuItems: SchemaInitializerItemType[] = [
|
||||
{
|
||||
type: 'divider',
|
||||
name: 'divider',
|
||||
},
|
||||
];
|
||||
if (templates.length) {
|
||||
deprecatedTemplatesMenuItems.push(
|
||||
allTemplatesMenuItems.push(
|
||||
{
|
||||
type: 'divider',
|
||||
key: `${collectionName || componentName}_table_subMenu_${index}_copy`,
|
||||
type: 'subMenu',
|
||||
name: 'copy',
|
||||
title: t('Duplicate template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'copy',
|
||||
name: collection.name,
|
||||
template,
|
||||
item,
|
||||
title: templateName || t('Untitled'),
|
||||
};
|
||||
}),
|
||||
},
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: DeprecatedTemplateTitleElement,
|
||||
children: [
|
||||
{
|
||||
key: `${collectionName || componentName}_table_subMenu_${index}_copy`,
|
||||
type: 'subMenu',
|
||||
name: 'copy',
|
||||
title: t('Duplicate template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'copy',
|
||||
name: collection.name,
|
||||
template,
|
||||
item,
|
||||
title: templateName || t('Untitled'),
|
||||
};
|
||||
}),
|
||||
},
|
||||
{
|
||||
key: `${collectionName || componentName}_table_subMenu_${index}_ref`,
|
||||
type: 'subMenu',
|
||||
name: 'ref',
|
||||
title: t('Reference template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'reference',
|
||||
name: collection.name,
|
||||
template,
|
||||
item,
|
||||
title: templateName || t('Untitled'),
|
||||
};
|
||||
}),
|
||||
},
|
||||
],
|
||||
key: `${collectionName || componentName}_table_subMenu_${index}_ref`,
|
||||
type: 'subMenu',
|
||||
name: 'ref',
|
||||
title: t('Reference template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'reference',
|
||||
name: collection.name,
|
||||
template,
|
||||
item,
|
||||
title: templateName || t('Untitled'),
|
||||
};
|
||||
}),
|
||||
},
|
||||
);
|
||||
}
|
||||
if (inheritedTemplatesMenuItems.length) {
|
||||
allTemplatesMenuItems.push({
|
||||
type: 'subMenu',
|
||||
name: 'inherited_templates',
|
||||
key: `associationFiled_${componentName}_table_subMenu_${index}_inherited`,
|
||||
title: t('Inherited template'),
|
||||
children: inheritedTemplatesMenuItems,
|
||||
});
|
||||
}
|
||||
return [
|
||||
{
|
||||
key: `${collectionName || componentName}_table_blank`,
|
||||
@ -906,8 +910,7 @@ export const useRecordCollectionDataSourceItems = (
|
||||
title: t('Blank block'),
|
||||
item,
|
||||
},
|
||||
...extralCollectionMenuItems,
|
||||
...deprecatedTemplatesMenuItems,
|
||||
...allTemplatesMenuItems,
|
||||
];
|
||||
};
|
||||
|
||||
@ -1533,13 +1536,13 @@ const getChildren = ({
|
||||
|
||||
return componentName && template.componentName === componentName;
|
||||
});
|
||||
const extralCollectionMenuItems = Array.from(initializerMenusGenerators.values())
|
||||
const inheritedTemplatesMenuItems = Array.from(initializerMenusGenerators.values())
|
||||
.map((generator) => {
|
||||
return generator({ item, index, componentName, association });
|
||||
})
|
||||
.filter(Boolean)
|
||||
.flat();
|
||||
if ((!templates.length && !extralCollectionMenuItems.length) || isInTemplateSettingPage()) {
|
||||
if ((!templates.length && !inheritedTemplatesMenuItems.length) || isInTemplateSettingPage()) {
|
||||
return {
|
||||
type: 'item',
|
||||
name: item.name,
|
||||
@ -1547,66 +1550,72 @@ const getChildren = ({
|
||||
dataSource,
|
||||
};
|
||||
}
|
||||
const deprecatedTemplatesMenuItems = [];
|
||||
const allTemplatesMenuItems: SchemaInitializerItemType[] = [
|
||||
{
|
||||
type: 'divider',
|
||||
name: 'divider',
|
||||
},
|
||||
];
|
||||
if (templates.length) {
|
||||
deprecatedTemplatesMenuItems.push(
|
||||
allTemplatesMenuItems.push(
|
||||
{
|
||||
type: 'divider',
|
||||
key: `${componentName}_table_subMenu_${index}_copy`,
|
||||
type: 'subMenu',
|
||||
name: 'copy',
|
||||
dataSource,
|
||||
title: t('Duplicate template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = [
|
||||
componentNamePrefix + 'FormItem',
|
||||
componentNamePrefix + 'ReadPrettyFormItem',
|
||||
].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'copy',
|
||||
name: item.name,
|
||||
template,
|
||||
dataSource,
|
||||
title: templateName || t('Untitled'),
|
||||
};
|
||||
}),
|
||||
},
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: DeprecatedTemplateTitleElement,
|
||||
children: [
|
||||
{
|
||||
key: `${componentName}_table_subMenu_${index}_copy`,
|
||||
type: 'subMenu',
|
||||
name: 'copy',
|
||||
key: `${componentName}_table_subMenu_${index}_ref`,
|
||||
type: 'subMenu',
|
||||
name: 'ref',
|
||||
dataSource,
|
||||
title: t('Reference template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = [
|
||||
componentNamePrefix + 'FormItem',
|
||||
componentNamePrefix + 'ReadPrettyFormItem',
|
||||
].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'reference',
|
||||
name: item.name,
|
||||
template,
|
||||
dataSource,
|
||||
title: t('Duplicate template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = [
|
||||
componentNamePrefix + 'FormItem',
|
||||
componentNamePrefix + 'ReadPrettyFormItem',
|
||||
].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'copy',
|
||||
name: item.name,
|
||||
template,
|
||||
dataSource,
|
||||
title: templateName || t('Untitled'),
|
||||
};
|
||||
}),
|
||||
},
|
||||
{
|
||||
key: `${componentName}_table_subMenu_${index}_ref`,
|
||||
type: 'subMenu',
|
||||
name: 'ref',
|
||||
dataSource,
|
||||
title: t('Reference template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = [
|
||||
componentNamePrefix + 'FormItem',
|
||||
componentNamePrefix + 'ReadPrettyFormItem',
|
||||
].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'reference',
|
||||
name: item.name,
|
||||
template,
|
||||
dataSource,
|
||||
title: templateName || t('Untitled'),
|
||||
};
|
||||
}),
|
||||
},
|
||||
],
|
||||
title: templateName || t('Untitled'),
|
||||
};
|
||||
}),
|
||||
},
|
||||
);
|
||||
}
|
||||
if (inheritedTemplatesMenuItems.length) {
|
||||
allTemplatesMenuItems.push({
|
||||
type: 'subMenu',
|
||||
name: 'inherited_templates',
|
||||
key: `associationFiled_${componentName}_table_subMenu_${index}_inherited`,
|
||||
dataSource,
|
||||
title: t('Inherited template'),
|
||||
children: inheritedTemplatesMenuItems,
|
||||
});
|
||||
}
|
||||
return {
|
||||
key: `${componentName}_table_subMenu_${index}`,
|
||||
type: 'subMenu',
|
||||
@ -1620,8 +1629,7 @@ const getChildren = ({
|
||||
dataSource,
|
||||
title: t('Blank block'),
|
||||
},
|
||||
...extralCollectionMenuItems,
|
||||
...deprecatedTemplatesMenuItems,
|
||||
...allTemplatesMenuItems,
|
||||
],
|
||||
};
|
||||
});
|
||||
@ -1804,11 +1812,11 @@ function useAssociationFields({
|
||||
return template.componentName === componentName;
|
||||
});
|
||||
const keyPrefix = `associationFiled_table_subMenu`;
|
||||
const extralCollectionMenuItems = Array.from(initializerMenusGenerators.values())
|
||||
const inheritedTemplatesMenuItems = Array.from(initializerMenusGenerators.values())
|
||||
.map((generator) => generator({ collection, index, field, componentName, keyPrefix, name }))
|
||||
.filter(Boolean)
|
||||
.flat();
|
||||
if ((!templates.length && !extralCollectionMenuItems.length) || isInTemplateSettingPage()) {
|
||||
if ((!templates.length && !inheritedTemplatesMenuItems.length) || isInTemplateSettingPage()) {
|
||||
return {
|
||||
type: 'item',
|
||||
name: `${field.collectionName}.${field.name}`,
|
||||
@ -1818,70 +1826,77 @@ function useAssociationFields({
|
||||
associationField: field,
|
||||
};
|
||||
}
|
||||
const deprecatedTemplatesMenuItems = [];
|
||||
const allTemplatesMenuItems: SchemaInitializerItemType[] = [
|
||||
{
|
||||
type: 'divider',
|
||||
name: 'divider',
|
||||
},
|
||||
];
|
||||
if (templates.length) {
|
||||
deprecatedTemplatesMenuItems.push(
|
||||
allTemplatesMenuItems.push(
|
||||
{
|
||||
type: 'divider',
|
||||
key: `associationFiled_${componentName}_table_subMenu_${index}_copy`,
|
||||
type: 'subMenu',
|
||||
name: 'copy',
|
||||
dataSource,
|
||||
title: t('Duplicate template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = [
|
||||
componentNamePrefix + 'FormItem',
|
||||
componentNamePrefix + 'ReadPrettyFormItem',
|
||||
].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'copy',
|
||||
name: `${field.collectionName}.${field.name}`,
|
||||
collectionName: field.target,
|
||||
template,
|
||||
dataSource,
|
||||
title: templateName || t('Untitled'),
|
||||
associationField: field,
|
||||
};
|
||||
}),
|
||||
},
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: DeprecatedTemplateTitleElement,
|
||||
children: [
|
||||
{
|
||||
key: `associationFiled_${componentName}_table_subMenu_${index}_copy`,
|
||||
type: 'subMenu',
|
||||
name: 'copy',
|
||||
key: `associationFiled_${componentName}_table_subMenu_${index}_ref`,
|
||||
type: 'subMenu',
|
||||
name: 'ref',
|
||||
dataSource,
|
||||
title: t('Reference template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = [
|
||||
componentNamePrefix + 'FormItem',
|
||||
componentNamePrefix + 'ReadPrettyFormItem',
|
||||
].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'reference',
|
||||
name: `${field.collectionName}.${field.name}`,
|
||||
collectionName: field.target,
|
||||
template,
|
||||
dataSource,
|
||||
title: t('Duplicate template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = [
|
||||
componentNamePrefix + 'FormItem',
|
||||
componentNamePrefix + 'ReadPrettyFormItem',
|
||||
].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'copy',
|
||||
name: `${field.collectionName}.${field.name}`,
|
||||
collectionName: field.target,
|
||||
template,
|
||||
dataSource,
|
||||
title: templateName || t('Untitled'),
|
||||
associationField: field,
|
||||
};
|
||||
}),
|
||||
},
|
||||
{
|
||||
key: `associationFiled_${componentName}_table_subMenu_${index}_ref`,
|
||||
type: 'subMenu',
|
||||
name: 'ref',
|
||||
dataSource,
|
||||
title: t('Reference template'),
|
||||
children: templates.map((template) => {
|
||||
const templateName = [
|
||||
componentNamePrefix + 'FormItem',
|
||||
componentNamePrefix + 'ReadPrettyFormItem',
|
||||
].includes(template?.componentName)
|
||||
? `${template?.name} ${t('(Fields only)')}`
|
||||
: template?.name;
|
||||
return {
|
||||
type: 'item',
|
||||
mode: 'reference',
|
||||
name: `${field.collectionName}.${field.name}`,
|
||||
collectionName: field.target,
|
||||
template,
|
||||
dataSource,
|
||||
title: templateName || t('Untitled'),
|
||||
associationField: field,
|
||||
};
|
||||
}),
|
||||
},
|
||||
],
|
||||
title: templateName || t('Untitled'),
|
||||
associationField: field,
|
||||
};
|
||||
}),
|
||||
},
|
||||
);
|
||||
}
|
||||
if (inheritedTemplatesMenuItems.length) {
|
||||
allTemplatesMenuItems.push({
|
||||
type: 'subMenu',
|
||||
name: 'inherited_templates',
|
||||
key: `associationFiled_${componentName}_table_subMenu_${index}_inherited`,
|
||||
dataSource,
|
||||
title: t('Inherited template'),
|
||||
children: inheritedTemplatesMenuItems,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
key: `associationFiled_${componentName}_table_subMenu_${index}`,
|
||||
type: 'subMenu',
|
||||
@ -1897,8 +1912,7 @@ function useAssociationFields({
|
||||
title: t('Blank block'),
|
||||
associationField: field,
|
||||
},
|
||||
...extralCollectionMenuItems,
|
||||
...deprecatedTemplatesMenuItems,
|
||||
...allTemplatesMenuItems,
|
||||
],
|
||||
};
|
||||
});
|
||||
@ -1917,7 +1931,7 @@ function useAssociationFields({
|
||||
]);
|
||||
}
|
||||
|
||||
const isInTemplateSettingPage = () => window.location.pathname.includes('/block-templates/');
|
||||
const isInTemplateSettingPage = () => window.location.pathname.includes('/block-templates/inherited');
|
||||
|
||||
const initializerMenusGenerators = new Map<
|
||||
string,
|
||||
|
@ -263,7 +263,7 @@ const InternalSchemaToolbar: FC<SchemaToolbarProps> = React.memo((props) => {
|
||||
if (typeof title === 'string') return [compile(title)];
|
||||
if (Array.isArray(title)) {
|
||||
if (title.length === 1 && fieldSchema['x-template-title']) {
|
||||
templateTitleLabel.current = t('Template');
|
||||
templateTitleLabel.current = t('Inherited template');
|
||||
return compile([title[0], fieldSchema['x-template-title']]);
|
||||
}
|
||||
return compile(title);
|
||||
|
@ -342,13 +342,13 @@ export const SchemaSettingsFormItemTemplate = function FormItemTemplate(props) {
|
||||
}
|
||||
return (
|
||||
<SchemaSettingsItem
|
||||
title="Save as block template"
|
||||
title={t('Save as reference template')}
|
||||
onClick={async () => {
|
||||
setVisible(false);
|
||||
const collection = collectionName && cm?.getCollection(collectionName);
|
||||
const gridSchema = findGridSchema(fieldSchema);
|
||||
const values = await FormDialog(
|
||||
t('Save as template'),
|
||||
t('Save as reference template'),
|
||||
() => {
|
||||
const componentTitle = {
|
||||
FormItem: t('Form'),
|
||||
@ -414,7 +414,7 @@ export const SchemaSettingsFormItemTemplate = function FormItemTemplate(props) {
|
||||
dn.refresh();
|
||||
}}
|
||||
>
|
||||
{t('Save as block template')}
|
||||
{t('Save as reference template')}
|
||||
</SchemaSettingsItem>
|
||||
);
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ export function SchemaSettingsTemplate(props) {
|
||||
if (template) {
|
||||
return (
|
||||
<SchemaSettingsItem
|
||||
title="Convert reference to duplicate"
|
||||
title={t('Convert reference to duplicate')}
|
||||
onClick={async () => {
|
||||
const schema = await copyTemplateSchema(template);
|
||||
const removed = tdn.removeWithoutEmit();
|
||||
@ -59,12 +59,12 @@ export function SchemaSettingsTemplate(props) {
|
||||
}
|
||||
return (
|
||||
<SchemaSettingsItem
|
||||
title="Save as template"
|
||||
title={t('Save as reference template')}
|
||||
onClick={async () => {
|
||||
setVisible(false);
|
||||
const collection = collectionName && getCollection(collectionName);
|
||||
const values = await FormDialog(
|
||||
t('Save as template'),
|
||||
t('Save as reference template'),
|
||||
() => {
|
||||
return (
|
||||
<FormLayout layout={'vertical'}>
|
||||
@ -115,7 +115,7 @@ export function SchemaSettingsTemplate(props) {
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t('Save as template')}
|
||||
{t('Save as reference template')}
|
||||
</SchemaSettingsItem>
|
||||
);
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ export const BlockTemplateMenusProvider = ({ children }) => {
|
||||
|
||||
useEffect(() => {
|
||||
const isLeavingTemplatesPage =
|
||||
previousPathRef.current.includes('/settings/block-templates') &&
|
||||
!location.pathname.includes('/settings/block-templates');
|
||||
previousPathRef.current.includes('/settings/block-templates/inherited') &&
|
||||
!location.pathname.includes('/settings/block-templates/inherited');
|
||||
if (isLeavingTemplatesPage) {
|
||||
refresh();
|
||||
}
|
||||
@ -159,7 +159,7 @@ export const BlockTemplateMenusProvider = ({ children }) => {
|
||||
collectionName = field?.target;
|
||||
}
|
||||
const isDetails = name === 'details' || componentName === 'ReadPrettyFormItem';
|
||||
const children = data?.data
|
||||
const children: SchemaInitializerItemType[] = data?.data
|
||||
?.filter(
|
||||
(d) =>
|
||||
(d.componentType === componentName ||
|
||||
@ -197,16 +197,7 @@ export const BlockTemplateMenusProvider = ({ children }) => {
|
||||
if (!children?.length) {
|
||||
return null;
|
||||
}
|
||||
return [
|
||||
{
|
||||
type: 'divider',
|
||||
},
|
||||
{
|
||||
type: 'itemGroup',
|
||||
title: t('Block template'),
|
||||
children,
|
||||
},
|
||||
] as SchemaInitializerItemType[];
|
||||
return children;
|
||||
};
|
||||
registerInitializerMenusGenerator('block_template', generator);
|
||||
}, [data?.data, plugin.isInBlockTemplateConfigPage, handleTemplateClick, t, plugin]);
|
||||
|
@ -15,9 +15,9 @@ export const ConfigureLink = () => {
|
||||
const value = useFilterByTk();
|
||||
const recordData = useCollectionRecordData();
|
||||
const t = useT();
|
||||
let to = `/admin/settings/block-templates/${value}`;
|
||||
let to = `/admin/settings/block-templates/inherited/${value}`;
|
||||
if (recordData.type === 'Mobile') {
|
||||
to = `/m/block-templates/${recordData.key}/${recordData.uid}`;
|
||||
to = `/m/block-templates/inherited/${recordData.key}/${recordData.uid}`;
|
||||
}
|
||||
|
||||
return <Link to={to}>{t('Configure')}</Link>;
|
||||
|
@ -58,11 +58,11 @@ export const SaveAsTemplateSetting = () => {
|
||||
|
||||
return (
|
||||
<SchemaSettingsModalItem
|
||||
title={t('Save as template')}
|
||||
title={t('Save as inherited template')}
|
||||
schema={
|
||||
{
|
||||
type: 'object',
|
||||
title: t('Save as template'),
|
||||
title: t('Save as inherited template'),
|
||||
properties: {
|
||||
title: {
|
||||
type: 'string',
|
||||
|
@ -23,7 +23,7 @@ export const useIsPageBlock = () => {
|
||||
const notInPopup = !location.pathname.includes('/popups/');
|
||||
const notInSetting = !location.pathname.startsWith('/admin/settings/');
|
||||
const notInWorkflow = !location.pathname.startsWith('/admin/workflow/workflows/');
|
||||
const notInBlockTemplate = !location.pathname.startsWith('/block-templates/');
|
||||
const notInBlockTemplate = !location.pathname.startsWith('/block-templates/inherited/');
|
||||
return isPage && notInPopup && notInSetting && notInWorkflow && notInBlockTemplate;
|
||||
}, [location.pathname, fieldSchema]);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { Plugin } from '@nocobase/client';
|
||||
import { BlockTemplatesPane, Plugin, SchemaSettingsFormItemTemplate, SchemaSettingsTemplate } from '@nocobase/client';
|
||||
import { templateBlockInitializerItem } from './initializers';
|
||||
import { NAMESPACE } from './constants';
|
||||
import { BlockTemplateList, BlockTemplatePage } from './components';
|
||||
@ -91,10 +91,20 @@ export class PluginBlockTemplateClient extends Plugin {
|
||||
this.app.pluginSettingsManager.add('block-templates', {
|
||||
title: `{{t("Block templates", { ns: "${NAMESPACE}" })}}`,
|
||||
icon: 'ProfileOutlined',
|
||||
// Component: BlockTemplateList,
|
||||
});
|
||||
|
||||
this.app.pluginSettingsManager.add(`block-templates.reference`, {
|
||||
title: `{{t("Reference template")}}`,
|
||||
Component: BlockTemplatesPane,
|
||||
});
|
||||
|
||||
this.app.pluginSettingsManager.add(`block-templates.inherited`, {
|
||||
title: `{{t("Inherited template")}}`,
|
||||
Component: BlockTemplateList,
|
||||
});
|
||||
|
||||
this.app.pluginSettingsManager.add(`block-templates/:key`, {
|
||||
this.app.pluginSettingsManager.add(`block-templates/inherited/:key`, {
|
||||
title: false,
|
||||
pluginKey: 'block-templates',
|
||||
isTopLevel: false,
|
||||
@ -103,14 +113,15 @@ export class PluginBlockTemplateClient extends Plugin {
|
||||
|
||||
// add mobile router
|
||||
this.app.pluginManager.get<PluginMobileClient>('mobile')?.mobileRouter?.add('mobile.schema.blockTemplate', {
|
||||
path: `/block-templates/:key/:pageSchemaUid`,
|
||||
path: `/block-templates/inherited/:key/:pageSchemaUid`,
|
||||
Component: BlockTemplateMobilePage,
|
||||
});
|
||||
}
|
||||
|
||||
isInBlockTemplateConfigPage() {
|
||||
const mobilePath = this.app.pluginManager.get<PluginMobileClient>('mobile')?.mobileBasename + '/block-templates';
|
||||
const desktopPath = 'admin/settings/block-templates';
|
||||
const mobilePath =
|
||||
this.app.pluginManager.get<PluginMobileClient>('mobile')?.mobileBasename + '/block-templates/inherited';
|
||||
const desktopPath = 'admin/settings/block-templates/inherited';
|
||||
return window.location.pathname.includes(desktopPath) || window.location.pathname.includes(mobilePath);
|
||||
}
|
||||
|
||||
@ -141,7 +152,7 @@ export class PluginBlockTemplateClient extends Plugin {
|
||||
// if not filter out fieldSettings:component:, we will show two revert setting item
|
||||
if (schemaSetting && !key.startsWith('fieldSettings:component:')) {
|
||||
for (let i = 0; i < schemaSetting.items.length; i++) {
|
||||
// hide convert to block setting item
|
||||
// hide reference template setting item
|
||||
hideConvertToBlockSettingItem(
|
||||
schemaSetting.items[i],
|
||||
schemaSetting.items[i - 1],
|
||||
@ -189,13 +200,15 @@ export class PluginBlockTemplateClient extends Plugin {
|
||||
'FormDetailsSettings',
|
||||
];
|
||||
if (blockSettings.includes(key)) {
|
||||
// schemaSetting.add('template-saveAsTemplateItem', saveAsTemplateSetting);
|
||||
// 放到template-revertSettingItem上方
|
||||
const revertItemIndex = schemaSetting.items.findIndex((item) => item.name === 'template-revertSettingItem');
|
||||
if (revertItemIndex !== -1) {
|
||||
schemaSetting.items.splice(revertItemIndex, 0, saveAsTemplateSetting);
|
||||
} else {
|
||||
schemaSetting.items.push(saveAsTemplateSetting);
|
||||
const referenceTemplateItemIndex = schemaSetting.items.findIndex(
|
||||
(item) =>
|
||||
item['Component'] === SchemaSettingsTemplate || item['Component'] === SchemaSettingsFormItemTemplate,
|
||||
);
|
||||
if (referenceTemplateItemIndex !== -1) {
|
||||
schemaSetting.items.splice(referenceTemplateItemIndex + 1, 0, {
|
||||
...saveAsTemplateSetting,
|
||||
sort: schemaSetting.items[referenceTemplateItemIndex].sort,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,9 +88,6 @@ export const blockTemplatesSchema: ISchema = {
|
||||
type: 'void',
|
||||
title: '{{ t("Title") }}',
|
||||
'x-component': 'TableV2.Column',
|
||||
'x-component-props': {
|
||||
width: 150,
|
||||
},
|
||||
properties: {
|
||||
title: {
|
||||
type: 'string',
|
||||
|
@ -10,7 +10,6 @@
|
||||
import { useFieldSchema } from '@formily/react';
|
||||
import { ConvertToNormalBlockSetting } from '../components/ConvertToNormalBlockSetting';
|
||||
import { tStr } from '../locale';
|
||||
import { useIsInTemplate } from '../hooks/useIsInTemplate';
|
||||
|
||||
export const convertToNormalBlockSettingItem = {
|
||||
name: 'template-convertToNormalBlockSettingItem',
|
||||
|
@ -7,6 +7,7 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { useSchemaSettings } from '@nocobase/client';
|
||||
import { SaveAsTemplateSetting } from '../components/SaveAsTemplateSetting';
|
||||
import { useIsPageBlock } from '../hooks/useIsPageBlock';
|
||||
|
||||
@ -15,6 +16,7 @@ export const saveAsTemplateSetting = {
|
||||
Component: SaveAsTemplateSetting,
|
||||
useVisible: () => {
|
||||
const isPageBlock = useIsPageBlock();
|
||||
return isPageBlock;
|
||||
const { template: deprecatedTemplate } = useSchemaSettings();
|
||||
return isPageBlock && !deprecatedTemplate;
|
||||
},
|
||||
};
|
||||
|
@ -16,7 +16,6 @@ import {
|
||||
SchemaSettingsTemplate,
|
||||
SchemaSettingsConnectDataBlocks,
|
||||
usePlugin,
|
||||
useSchemaSettings,
|
||||
} from '@nocobase/client';
|
||||
|
||||
export const hideConvertToBlockSettingItem = (
|
||||
@ -29,19 +28,21 @@ export const hideConvertToBlockSettingItem = (
|
||||
settingItem['Component'] === SchemaSettingsFormItemTemplate
|
||||
) {
|
||||
// hide covert to block setting item
|
||||
const visible = settingItem['useVisible'] || (() => true);
|
||||
settingItem['useVisible'] = function useVisible() {
|
||||
const { template: deprecatedTemplate } = useSchemaSettings();
|
||||
if (deprecatedTemplate && ['formItemTemplate', 'ConvertReferenceToDuplicate'].includes(settingItem['name'])) {
|
||||
// still allow user to convert reference to duplicate, this way user can migrate to new template easily
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !useIsInTemplate() && visible();
|
||||
};
|
||||
if (preSettingItem?.['type'] === 'divider') {
|
||||
preSettingItem['useVisible'] = () => false;
|
||||
const preVisible = preSettingItem['useVisible'] || (() => true);
|
||||
preSettingItem['useVisible'] = function useVisible() {
|
||||
return !useIsInTemplate() && preVisible();
|
||||
};
|
||||
}
|
||||
if (nextSettingItem?.['type'] === 'divider') {
|
||||
nextSettingItem['useVisible'] = () => false;
|
||||
const nextVisible = nextSettingItem['useVisible'] || (() => true);
|
||||
nextSettingItem['useVisible'] = function useVisible() {
|
||||
return !useIsInTemplate() && nextVisible();
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ export const ShowTipWhenNoPages: FC = ({ children }) => {
|
||||
const { designable } = useDesignable();
|
||||
const { routeList } = useMobileRoutes();
|
||||
const { t } = usePluginTranslation();
|
||||
const isInBlockTemplateSettingsPage = window.location.pathname?.includes('/m/block-templates/');
|
||||
const isInBlockTemplateSettingsPage = window.location.pathname?.includes('/m/block-templates/inherited/');
|
||||
|
||||
if (!isInBlockTemplateSettingsPage && (!designable || isMobile) && _.isEmpty(routeList)) {
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user