An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Support database list view https://github.com/siyuan-note/siyuan/issues/17743
Daniel59e7109ae6e0
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.jsonindex 493f2db0dc..a3d69c04e3 100644--- a/app/appearance/langs/ar.json+++ b/app/appearance/langs/ar.json@@ -1,4 +1,6 @@{+ "listView": "قائمة",+ "databaseListView": "عرض قائمة قاعدة البيانات","copyRuntimeInfo": "نسخ معلومات التشغيل","duplicateDocTree": "إنشاء نسخة مع المستندات الفرعية","syncProviderChangeConfirm": "قبل تبديل مزوّد المزامنة، يحتاج SiYuan إلى فحص الموارد واللقطات السابقة، وقد ينزّل المحتوى المفقود من التخزين السحابي الحالي. قد يستغرق ذلك بعض الوقت. هل تريد المتابعة؟",@@ -2479,6 +2481,7 @@"quit": "خروج من التطبيق"},"_attrView": {+ "list": "قائمة","dateFormat": "تنسيق التاريخ","fullDate": "تاريخ محلي","dateMonths": "يناير|فبراير|مارس|أبريل|مايو|يونيو|يوليو|أغسطس|سبتمبر|أكتوبر|نوفمبر|ديسمبر",diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.jsonindex 55c4cb0e83..0f9c079c9f 100644--- a/app/appearance/langs/de.json+++ b/app/appearance/langs/de.json@@ -1,4 +1,6 @@{+ "listView": "Liste",+ "databaseListView": "Datenbank-Listenansicht","copyRuntimeInfo": "Laufzeitinformationen kopieren","duplicateDocTree": "Mit Unterdokumenten duplizieren","syncProviderChangeConfirm": "Vor dem Wechsel des Synchronisierungsanbieters muss SiYuan Ressourcen und frühere Schnappschüsse prüfen und gegebenenfalls fehlende Inhalte aus dem aktuellen Cloud-Speicher herunterladen. Dies kann einige Zeit dauern. Fortfahren?",@@ -2479,6 +2481,7 @@"quit": "Anwendung beenden"},"_attrView": {+ "list": "Liste","dateFormat": "Datumsformat","fullDate": "Lokalisiertes Datum","dateMonths": "Januar|Februar|März|April|Mai|Juni|Juli|August|September|Oktober|November|Dezember",diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.jsonindex f38e3cd0b0..1c8a90e385 100644--- a/app/appearance/langs/en.json+++ b/app/appearance/langs/en.json@@ -1,4 +1,6 @@{+ "listView": "List",+ "databaseListView": "Database list view","copyRuntimeInfo": "Copy runtime information","duplicateDocTree": "Duplicate with sub-documents","syncProviderChangeConfirm": "Before switching sync providers, SiYuan needs to check resources and historical snapshots and may download missing content from the current cloud storage. This may take some time. Continue?",@@ -2479,6 +2481,7 @@"quit": "Quit application"},"_attrView": {+ "list": "List","dateFormat": "Date format","fullDate": "Localized date","dateMonths": "January|February|March|April|May|June|July|August|September|October|November|December",diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.jsonindex 8857a06159..80246e62d4 100644--- a/app/appearance/langs/es.json+++ b/app/appearance/langs/es.json@@ -1,4 +1,6 @@{+ "listView": "Lista",+ "databaseListView": "Vista de lista de base de datos","copyRuntimeInfo": "Copiar información de ejecución","duplicateDocTree": "Duplicar con subdocumentos","syncProviderChangeConfirm": "Antes de cambiar de proveedor de sincronización, SiYuan debe comprobar los recursos y las instantáneas anteriores, y puede descargar el contenido que falte del almacenamiento en la nube actual. Esto puede tardar un tiempo. ¿Continuar?",@@ -2479,6 +2481,7 @@"quit": "Salir de la aplicación"},"_attrView": {+ "list": "Lista","dateFormat": "Formato de fecha","fullDate": "Fecha localizada","dateMonths": "enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre",diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.jsonindex 839f77c8db..d2fe29d541 100644--- a/app/appearance/langs/fr.json+++ b/app/appearance/langs/fr.json@@ -1,4 +1,6 @@{+ "listView": "Liste",+ "databaseListView": "Vue liste de base de données","copyRuntimeInfo": "Copier les informations d’exécution","duplicateDocTree": "Dupliquer avec les sous-documents","syncProviderChangeConfirm": "Avant de changer de fournisseur de synchronisation, SiYuan doit vérifier les ressources et les anciens instantanés, et peut télécharger le contenu manquant depuis le stockage cloud actuel. Cela peut prendre un certain temps. Continuer ?",@@ -2479,6 +2481,7 @@"quit": "Quitter le programme"},"_attrView": {+ "list": "Liste","dateFormat": "Format de date","fullDate": "Date localisée","dateMonths": "janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre",diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.jsonindex b2dcaaeb66..62da906b66 100644--- a/app/appearance/langs/he.json+++ b/app/appearance/langs/he.json@@ -1,4 +1,6 @@{+ "listView": "רשימה",+ "databaseListView": "תצוגת רשימה של מסד נתונים","copyRuntimeInfo": "העתקת מידע על סביבת הריצה","duplicateDocTree": "שכפול עם מסמכי משנה","syncProviderChangeConfirm": "לפני החלפת ספק הסנכרון, SiYuan צריך לבדוק משאבים ותמונות מצב קודמות, וייתכן שיוריד תוכן חסר מאחסון הענן הנוכחי. הפעולה עשויה להימשך זמן מה. להמשיך?",@@ -2479,6 +2481,7 @@"quit": "צא מהאפליקציה"},"_attrView": {+ "list": "רשימה","dateFormat": "תבנית תאריך","fullDate": "תאריך מקומי","dateMonths": "ינואר|פברואר|מרץ|אפריל|מאי|יוני|יולי|אוגוסט|ספטמבר|אוקטובר|נובמבר|דצמבר",diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.jsonindex e1dabcab39..720839dcd9 100644--- a/app/appearance/langs/hi.json+++ b/app/appearance/langs/hi.json@@ -1,4 +1,6 @@{+ "listView": "सूची",+ "databaseListView": "डेटाबेस सूची दृश्य","copyRuntimeInfo": "रनटाइम की जानकारी कॉपी करें","duplicateDocTree": "उप-दस्तावेज़ों सहित प्रतिलिपि बनाएँ","syncProviderChangeConfirm": "सिंक प्रदाता बदलने से पहले, SiYuan को संसाधनों और पुराने स्नैपशॉट की जाँच करनी होगी और वर्तमान क्लाउड स्टोरेज से अनुपलब्ध सामग्री डाउनलोड करनी पड़ सकती है। इसमें कुछ समय लग सकता है। जारी रखें?",@@ -2479,6 +2481,7 @@"quit": "एप्लिकेशन से बाहर निकलें"},"_attrView": {+ "list": "सूची","dateFormat": "दिनांक प्रारूप","fullDate": "स्थानीयकृत दिनांक","dateMonths": "जनवरी|फ़रवरी|मार्च|अप्रैल|मई|जून|जुलाई|अगस्त|सितंबर|अक्टूबर|नवंबर|दिसंबर",diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.jsonindex a10c0c4b86..4264c912c9 100644--- a/app/appearance/langs/id.json+++ b/app/appearance/langs/id.json@@ -1,4 +1,6 @@{+ "listView": "Daftar",+ "databaseListView": "Tampilan daftar database","copyRuntimeInfo": "Salin informasi runtime","duplicateDocTree": "Duplikasikan beserta subdokumen","syncProviderChangeConfirm": "Sebelum mengganti penyedia sinkronisasi, SiYuan perlu memeriksa sumber daya dan snapshot lama, serta mungkin mengunduh konten yang hilang dari penyimpanan cloud saat ini. Proses ini dapat memakan waktu. Lanjutkan?",@@ -2479,6 +2481,7 @@"quit": "Keluar aplikasi"},"_attrView": {+ "list": "Daftar","dateFormat": "Format tanggal","fullDate": "Tanggal lokal","dateMonths": "Januari|Februari|Maret|April|Mei|Juni|Juli|Agustus|September|Oktober|November|Desember",diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.jsonindex 59df8f9fd9..b29746a8e6 100644--- a/app/appearance/langs/it.json+++ b/app/appearance/langs/it.json@@ -1,4 +1,6 @@{+ "listView": "Elenco",+ "databaseListView": "Vista elenco del database","copyRuntimeInfo": "Copia informazioni di esecuzione","duplicateDocTree": "Duplica con i sottodocumenti","syncProviderChangeConfirm": "Prima di cambiare provider di sincronizzazione, SiYuan deve verificare le risorse e le istantanee precedenti e potrebbe scaricare i contenuti mancanti dall’archiviazione cloud attuale. L’operazione potrebbe richiedere del tempo. Continuare?",@@ -2479,6 +2481,7 @@"quit": "Esci dall'applicazione"},"_attrView": {+ "list": "Elenco","dateFormat": "Formato data","fullDate": "Data localizzata","dateMonths": "gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre",diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.jsonindex ec5c894216..10b0879c68 100644--- a/app/appearance/langs/ja.json+++ b/app/appearance/langs/ja.json@@ -1,4 +1,6 @@{+ "listView": "リスト",+ "databaseListView": "データベース リストビュー","copyRuntimeInfo": "実行環境情報をコピー","duplicateDocTree": "子ドキュメントを含めて複製","syncProviderChangeConfirm": "同期プロバイダーを切り替える前に、リソースと過去のスナップショットの完全性を確認し、必要に応じて現在のクラウドストレージから不足している内容をダウンロードします。時間がかかる場合があります。続行しますか?",@@ -2479,6 +2481,7 @@"quit": "アプリケーションを終了"},"_attrView": {+ "list": "リスト","dateFormat": "日付形式","fullDate": "ローカル形式の日付","dateMonths": "1月|2月|3月|4月|5月|6月|7月|8月|9月|10月|11月|12月",diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.jsonindex 68b54175bc..f6e09ba00c 100644--- a/app/appearance/langs/ko.json+++ b/app/appearance/langs/ko.json@@ -1,4 +1,6 @@{+ "listView": "목록",+ "databaseListView": "데이터베이스 목록 보기","copyRuntimeInfo": "실행 환경 정보 복사","duplicateDocTree": "하위 문서와 함께 복제","syncProviderChangeConfirm": "동기화 제공업체를 변경하기 전에 리소스와 과거 스냅샷의 무결성을 확인하고, 필요한 경우 현재 클라우드 저장소에서 누락된 내용을 다운로드합니다. 시간이 걸릴 수 있습니다. 계속하시겠습니까?",@@ -2479,6 +2481,7 @@"quit": "애플리케이션 종료"},"_attrView": {+ "list": "목록","dateFormat": "날짜 형식","fullDate": "현지화된 날짜","dateMonths": "1월|2월|3월|4월|5월|6월|7월|8월|9월|10월|11월|12월",diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.jsonindex 9cf296b4b0..bdb3160422 100644--- a/app/appearance/langs/nl.json+++ b/app/appearance/langs/nl.json@@ -1,4 +1,6 @@{+ "listView": "Lijst",+ "databaseListView": "Lijstweergave van database","copyRuntimeInfo": "Runtime-informatie kopiëren","duplicateDocTree": "Dupliceren met subdocumenten","syncProviderChangeConfirm": "Voordat u van synchronisatieprovider wisselt, moet SiYuan bronnen en eerdere momentopnamen controleren en mogelijk ontbrekende inhoud uit de huidige cloudopslag downloaden. Dit kan enige tijd duren. Doorgaan?",@@ -2479,6 +2481,7 @@"quit": "Applicatie afsluiten"},"_attrView": {+ "list": "Lijst","dateFormat": "Datumnotatie","fullDate": "Gelokaliseerde datum","dateMonths": "januari|februari|maart|april|mei|juni|juli|augustus|september|oktober|november|december",diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.jsonindex 5cd157bc4a..1e72ca11ba 100644--- a/app/appearance/langs/pl.json+++ b/app/appearance/langs/pl.json@@ -1,4 +1,6 @@{+ "listView": "Lista",+ "databaseListView": "Widok listy bazy danych","copyRuntimeInfo": "Kopiuj informacje o środowisku uruchomieniowym","duplicateDocTree": "Duplikuj wraz z dokumentami podrzędnymi","syncProviderChangeConfirm": "Przed zmianą dostawcy synchronizacji SiYuan musi sprawdzić zasoby i wcześniejsze migawki. Może być konieczne pobranie brakującej zawartości z obecnej chmury. Może to potrwać. Kontynuować?",@@ -2479,6 +2481,7 @@"quit": "Zamknij aplikację"},"_attrView": {+ "list": "Lista","dateFormat": "Format daty","fullDate": "Data w formacie lokalnym","dateMonths": "stycznia|lutego|marca|kwietnia|maja|czerwca|lipca|sierpnia|września|października|listopada|grudnia",diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.jsonindex 367511b1e4..14cc613e1c 100644--- a/app/appearance/langs/pt-BR.json+++ b/app/appearance/langs/pt-BR.json@@ -1,4 +1,6 @@{+ "listView": "Lista",+ "databaseListView": "Visualização de lista do banco de dados","copyRuntimeInfo": "Copiar informações de execução","duplicateDocTree": "Duplicar com subdocumentos","syncProviderChangeConfirm": "Antes de trocar o provedor de sincronização, o SiYuan precisa verificar os recursos e os snapshots anteriores e pode baixar o conteúdo ausente do armazenamento em nuvem atual. Isso pode levar algum tempo. Continuar?",@@ -2479,6 +2481,7 @@"quit": "Sair do aplicativo"},"_attrView": {+ "list": "Lista","dateFormat": "Formato de data","fullDate": "Data localizada","dateMonths": "janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro",diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.jsonindex 142ed224de..4c9a938873 100644--- a/app/appearance/langs/ru.json+++ b/app/appearance/langs/ru.json@@ -1,4 +1,6 @@{+ "listView": "Список",+ "databaseListView": "Представление базы данных в виде списка","copyRuntimeInfo": "Копировать информацию о среде выполнения","duplicateDocTree": "Дублировать с дочерними документами","syncProviderChangeConfirm": "Перед сменой провайдера синхронизации SiYuan должен проверить ресурсы и предыдущие снимки и при необходимости загрузить недостающие данные из текущего облачного хранилища. Это может занять некоторое время. Продолжить?",@@ -2479,6 +2481,7 @@"quit": "Выйти из приложения"},"_attrView": {+ "list": "Список","dateFormat": "Формат даты","fullDate": "Локализованная дата","dateMonths": "января|февраля|марта|апреля|мая|июня|июля|августа|сентября|октября|ноября|декабря",diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.jsonindex 19ec8bbb70..1a05757e03 100644--- a/app/appearance/langs/sk.json+++ b/app/appearance/langs/sk.json@@ -1,4 +1,6 @@{+ "listView": "Zoznam",+ "databaseListView": "Zoznamové zobrazenie databázy","copyRuntimeInfo": "Kopírovať informácie o prostredí behu","duplicateDocTree": "Duplikovať s poddokumentmi","syncProviderChangeConfirm": "Pred zmenou poskytovateľa synchronizácie musí SiYuan skontrolovať zdroje a staršie snímky a prípadne stiahnuť chýbajúci obsah z aktuálneho cloudového úložiska. Môže to chvíľu trvať. Pokračovať?",@@ -2479,6 +2481,7 @@"quit": "Ukončiť aplikáciu"},"_attrView": {+ "list": "Zoznam","dateFormat": "Formát dátumu","fullDate": "Lokalizovaný dátum","dateMonths": "januára|februára|marca|apríla|mája|júna|júla|augusta|septembra|októbra|novembra|decembra",diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.jsonindex c6cde181ec..f11fa1b31d 100644--- a/app/appearance/langs/sr.json+++ b/app/appearance/langs/sr.json@@ -1,4 +1,6 @@{+ "listView": "Lista",+ "databaseListView": "Prikaz baze - lista","copyRuntimeInfo": "Копирај информације о извршавању","duplicateDocTree": "Дуплирај са поддокументима","syncProviderChangeConfirm": "Пре промене провајдера синхронизације, SiYuan мора да провери ресурсе и претходне снимке и по потреби преузме недостајући садржај из тренутног складишта у облаку. Ово може потрајати. Наставити?",@@ -2479,6 +2481,7 @@"quit": "Ugasi aplikaciju"},"_attrView": {+ "list": "Lista","dateFormat": "Format datuma","fullDate": "Lokalizovani datum","dateMonths": "januara|februara|marta|aprila|maja|juna|jula|avgusta|septembra|oktobra|novembra|decembra",diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.jsonindex 1a19c6ab39..dcb357e30f 100644--- a/app/appearance/langs/th.json+++ b/app/appearance/langs/th.json@@ -1,4 +1,6 @@{+ "listView": "รายการ",+ "databaseListView": "มุมมองรายการฐานข้อมูล","copyRuntimeInfo": "คัดลอกข้อมูลสภาพแวดล้อมการทำงาน","duplicateDocTree": "สร้างสำเนาพร้อมเอกสารย่อย","syncProviderChangeConfirm": "ก่อนเปลี่ยนผู้ให้บริการซิงค์ SiYuan ต้องตรวจสอบทรัพยากรและสแนปช็อตย้อนหลัง และอาจต้องดาวน์โหลดเนื้อหาที่ขาดหายจากพื้นที่จัดเก็บบนคลาวด์ปัจจุบัน ซึ่งอาจใช้เวลาสักครู่ ต้องการดำเนินการต่อหรือไม่?",@@ -2479,6 +2481,7 @@"quit": "ออก"},"_attrView": {+ "list": "รายการ","dateFormat": "รูปแบบวันที่","fullDate": "วันที่ตามภาษาท้องถิ่น","dateMonths": "มกราคม|กุมภาพันธ์|มีนาคม|เมษายน|พฤษภาคม|มิถุนายน|กรกฎาคม|สิงหาคม|กันยายน|ตุลาคม|พฤศจิกายน|ธันวาคม",diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.jsonindex acb6b53043..e4b56f1552 100644--- a/app/appearance/langs/tr.json+++ b/app/appearance/langs/tr.json@@ -1,4 +1,6 @@{+ "listView": "Liste",+ "databaseListView": "Veritabanı liste görünümü","copyRuntimeInfo": "Çalışma zamanı bilgilerini kopyala","duplicateDocTree": "Alt belgelerle birlikte çoğalt","syncProviderChangeConfirm": "Senkronizasyon sağlayıcısını değiştirmeden önce SiYuan, kaynakları ve geçmiş anlık görüntüleri kontrol etmeli ve gerekirse eksik içeriği mevcut bulut depolamasından indirmelidir. Bu işlem biraz zaman alabilir. Devam edilsin mi?",@@ -2479,6 +2481,7 @@"quit": "Uygulamadan çık"},"_attrView": {+ "list": "Liste","dateFormat": "Tarih biçimi","fullDate": "Yerelleştirilmiş tarih","dateMonths": "Ocak|Şubat|Mart|Nisan|Mayıs|Haziran|Temmuz|Ağustos|Eylül|Ekim|Kasım|Aralık",diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.jsonindex 7a824ee9dc..e0cc787390 100644--- a/app/appearance/langs/uk.json+++ b/app/appearance/langs/uk.json@@ -1,4 +1,6 @@{+ "listView": "Список",+ "databaseListView": "Подання бази даних у вигляді списку","copyRuntimeInfo": "Копіювати інформацію про середовище виконання","duplicateDocTree": "Дублювати з дочірніми документами","syncProviderChangeConfirm": "Перед зміною постачальника синхронізації SiYuan має перевірити ресурси та попередні знімки й за потреби завантажити відсутній вміст із поточного хмарного сховища. Це може зайняти певний час. Продовжити?",@@ -2479,6 +2481,7 @@"quit": "Вийти із застосунку"},"_attrView": {+ "list": "Список","dateFormat": "Формат дати","fullDate": "Локалізована дата","dateMonths": "січня|лютого|березня|квітня|травня|червня|липня|серпня|вересня|жовтня|листопада|грудня",diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.jsonindex c3bc20c045..83c3e70a6c 100644--- a/app/appearance/langs/zh-CN.json+++ b/app/appearance/langs/zh-CN.json@@ -1,4 +1,6 @@{+ "listView": "列表",+ "databaseListView": "数据库列表视图","copyRuntimeInfo": "复制运行信息","duplicateDocTree": "带子文档创建副本","syncProviderChangeConfirm": "切换同步提供商前,需要检查资源和历史快照的完整性,必要时会从当前云端下载缺失内容,可能需要较长时间。是否继续?",@@ -2479,6 +2481,7 @@"quit": "退出程序"},"_attrView": {+ "list": "列表","dateFormat": "日期格式","fullDate": "本地化日期","dateMonths": "1月|2月|3月|4月|5月|6月|7月|8月|9月|10月|11月|12月",diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.jsonindex 67cebb094e..5618b02cd8 100644--- a/app/appearance/langs/zh-TW.json+++ b/app/appearance/langs/zh-TW.json@@ -1,4 +1,6 @@{+ "listView": "列表",+ "databaseListView": "資料庫列表檢視","copyRuntimeInfo": "複製執行資訊","duplicateDocTree": "連同子文件複製為副本","syncProviderChangeConfirm": "切換同步服務提供者前,需要檢查資源和歷史快照的完整性,必要時會從目前的雲端下載缺失內容,可能需要較長時間。是否繼續?",@@ -2479,6 +2481,7 @@"quit": "退出程序"},"_attrView": {+ "list": "列表","dateFormat": "日期格式","fullDate": "本地化日期","dateMonths": "1月|2月|3月|4月|5月|6月|7月|8月|9月|10月|11月|12月",diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.syindex fcb07a9bac..892da78426 100644--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy@@ -7,7 +7,7 @@"id": "20240208172514-9dsv6na","title": "Database","type": "doc",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -16,7 +16,7 @@"HeadingLevel": 2,"Properties": {"id": "20251224101749-fnv59m7",- "updated": "20251224101813"+ "updated": "20260920084445"},"Children": [{@@ -30,12 +30,12 @@"Type": "NodeParagraph","Properties": {"id": "20251224101749-zd1sdj7",- "updated": "20251224101813"+ "updated": "20260920084445"},"Children": [{"Type": "NodeText",- "Data": "Databases consist of content blocks or non-content block data, and are presented in different views, such as table view, kanban view, and card view."+ "Data": "Databases consist of content blocks or non-content block data, and are presented in different views, such as table view, list view, kanban view, and card view."}]},@@ -45,7 +45,7 @@"HeadingLevel": 2,"Properties": {"id": "20251224101749-zybcbjk",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -502,6 +502,185 @@}]},+ {+ "ID": "20260920084445-xgbteah",+ "Type": "NodeHeading",+ "HeadingLevel": 3,+ "Properties": {+ "id": "20260920084445-xgbteah",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "List View"+ }+ ]+ },+ {+ "ID": "20260920084445-92ydsjz",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-92ydsjz",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Displays each entry on one line, without column headers or a table grid. A newly created list view shows only the primary key field; all other fields are hidden by default."+ }+ ]+ },+ {+ "ID": "20260920084445-56ro8a2",+ "Type": "NodeList",+ "ListData": {},+ "Properties": {+ "id": "20260920084445-56ro8a2",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-bjzjg8s",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-bjzjg8s",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-25ekao7",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-25ekao7",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Switching: Open the view settings and select "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Layout"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "List"+ },+ {+ "Type": "NodeText",+ "Data": ", or insert a database list view from the slash menu"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-39ih6ur",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-39ih6ur",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-i33u60f",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-i33u60f",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Fields: Open "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "Fields"+ },+ {+ "Type": "NodeText",+ "Data": " to show the fields you need. Visible fields appear alongside the primary key on the same line, and their values can be edited"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-4dpfqq3",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-4dpfqq3",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-38pz053",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-38pz053",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "View settings: Duplicating a list view or switching back to its list layout preserves the field visibility you configured"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-q8nlr4p",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-q8nlr4p",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-6lh2jh4",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-6lh2jh4",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "Filtering, sorting, and grouping: Shares data with other views of the same database and supports independent filter, sort, and group settings"+ }+ ]+ }+ ]+ }+ ]+ },{"ID": "20260613162855-cdeorum","Type": "NodeHeading",@@ -984,7 +1163,7 @@"HeadingLevel": 3,"Properties": {"id": "20260613171129-edm1pru",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -1951,7 +2130,7 @@"HeadingLevel": 4,"Properties": {"id": "20260613171129-y8inb0t",- "updated": "20260613171129"+ "updated": "20260920084445"},"Children": [{@@ -1980,7 +2159,7 @@"ListData": {},"Properties": {"id": "20260613171129-y221wzt",- "updated": "20260613171129"+ "updated": "20260920084445"},"Children": [{@@ -2153,7 +2332,7 @@},"Properties": {"id": "20260613171129-ravjist",- "updated": "20260613171129"+ "updated": "20260920084445"},"Children": [{@@ -2181,7 +2360,7 @@"ListData": {},"Properties": {"id": "20260613171129-qfcbary",- "updated": "20260613171129"+ "updated": "20260920084445"},"Children": [{@@ -2193,7 +2372,7 @@},"Properties": {"id": "20260613171129-e2s3vqd",- "updated": "20260613171129"+ "updated": "20260920084445"},"Children": [{@@ -2201,12 +2380,12 @@"Type": "NodeParagraph","Properties": {"id": "20260613171129-wrv369s",- "updated": "20260613171129"+ "updated": "20260920084445"},"Children": [{"Type": "NodeText",- "Data": "Table View: Rows are categorized by group, each group can be collapsed/expanded"+ "Data": "Table and List Views: Rows are categorized by group, each group can be collapsed/expanded"}]}@@ -2281,7 +2460,7 @@},"Properties": {"id": "20260613171129-ksd0v5v",- "updated": "20260613171129"+ "updated": "20260920084445"},"Children": [{@@ -2289,7 +2468,7 @@"Type": "NodeParagraph","Properties": {"id": "20260613171129-l092i7g",- "updated": "20260613171129"+ "updated": "20260920084445"},"Children": [{@@ -2299,7 +2478,7 @@},{"Type": "NodeText",- "Data": ": In table and gallery views, select \"None\" to remove grouping; kanban view cannot remove grouping"+ "Data": ": In table, list, and gallery views, select \"None\" to remove grouping; kanban view cannot remove grouping"}]}diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.syindex 9029de7598..9ad1bae247 100644--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy@@ -7,7 +7,7 @@"id": "20240208113259-nykkvaq","title": "数据库","type": "doc",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -16,7 +16,7 @@"HeadingLevel": 2,"Properties": {"id": "20240208113259-sp3g7zb",- "updated": "20251224100843"+ "updated": "20260920084445"},"Children": [{@@ -30,12 +30,12 @@"Type": "NodeParagraph","Properties": {"id": "20240208114024-40auf5m",- "updated": "20251224100843"+ "updated": "20260920084445"},"Children": [{"Type": "NodeText",- "Data": "数据库由内容块或者非内容块数据组成,并以不同视图呈现,比如表格视图、看板视图和卡片视图。"+ "Data": "数据库由内容块或者非内容块数据组成,并以不同视图呈现,比如表格视图、列表视图、看板视图和卡片视图。"}]},@@ -45,7 +45,7 @@"HeadingLevel": 2,"Properties": {"id": "20240208115136-9g2b46l",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -502,6 +502,185 @@}]},+ {+ "ID": "20260920084445-ujj7y47",+ "Type": "NodeHeading",+ "HeadingLevel": 3,+ "Properties": {+ "id": "20260920084445-ujj7y47",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "列表视图"+ }+ ]+ },+ {+ "ID": "20260920084445-iglvf09",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-iglvf09",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "每个条目显示为一行,不显示表头和表格网格。新建列表视图默认只显示主键字段,其他字段均隐藏。"+ }+ ]+ },+ {+ "ID": "20260920084445-hq4xiri",+ "Type": "NodeList",+ "ListData": {},+ "Properties": {+ "id": "20260920084445-hq4xiri",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-brs3h3s",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-brs3h3s",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-yahw7bf",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-yahw7bf",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "切换方式:在视图设置中选择 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "布局"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "列表"+ },+ {+ "Type": "NodeText",+ "Data": ",也可通过斜杠菜单插入数据库列表视图"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-3oqs6eb",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-3oqs6eb",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-vy20kr8",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-vy20kr8",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "字段显示:打开 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "字段"+ },+ {+ "Type": "NodeText",+ "Data": " 面板启用需要显示的字段。可见字段与主键同行显示,并支持编辑字段值"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-8rdt2le",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-8rdt2le",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-fj2rtkf",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-fj2rtkf",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "视图设置:复制列表视图或切回该视图的列表布局时,会保留已配置的字段显隐设置"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-zgww1e6",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-zgww1e6",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-akby47e",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-akby47e",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "过滤、排序和分组:与同一数据库的其他视图共享数据,支持独立设置过滤、排序和分组"+ }+ ]+ }+ ]+ }+ ]+ },{"ID": "20260613162748-v93usth","Type": "NodeHeading",@@ -984,7 +1163,7 @@"HeadingLevel": 3,"Properties": {"id": "20260613170258-y3mj135",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -1951,7 +2130,7 @@"HeadingLevel": 4,"Properties": {"id": "20260613170258-j738gis",- "updated": "20260613170258"+ "updated": "20260920084445"},"Children": [{@@ -1980,7 +2159,7 @@"ListData": {},"Properties": {"id": "20260613170258-jcdhbkf",- "updated": "20260613170258"+ "updated": "20260920084445"},"Children": [{@@ -2153,7 +2332,7 @@},"Properties": {"id": "20260613170258-5q65i2h",- "updated": "20260613170258"+ "updated": "20260920084445"},"Children": [{@@ -2181,7 +2360,7 @@"ListData": {},"Properties": {"id": "20260613170258-57c2uxa",- "updated": "20260613170258"+ "updated": "20260920084445"},"Children": [{@@ -2193,7 +2372,7 @@},"Properties": {"id": "20260613170258-8levr5l",- "updated": "20260613170258"+ "updated": "20260920084445"},"Children": [{@@ -2201,12 +2380,12 @@"Type": "NodeParagraph","Properties": {"id": "20260613170258-wnuyau1",- "updated": "20260613170258"+ "updated": "20260920084445"},"Children": [{"Type": "NodeText",- "Data": "表格视图:分组后行按分组归类,每个分组可折叠展开"+ "Data": "表格和列表视图:分组后行按分组归类,每个分组可折叠展开"}]}@@ -2281,7 +2460,7 @@},"Properties": {"id": "20260613170258-r43mzwx",- "updated": "20260613170258"+ "updated": "20260920084445"},"Children": [{@@ -2289,7 +2468,7 @@"Type": "NodeParagraph","Properties": {"id": "20260613170258-vy3k2oa",- "updated": "20260613170258"+ "updated": "20260920084445"},"Children": [{@@ -2299,7 +2478,7 @@},{"Type": "NodeText",- "Data": ":表格和卡片视图中可选择「无」取消分组;看板视图不可取消"+ "Data": ":表格、列表和卡片视图中可选择「无」取消分组;看板视图不可取消"}]}diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.syindex fc2f4b2efe..15f3a185c2 100644--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy@@ -7,7 +7,7 @@"id": "20240208171522-y7dxcno","title": "資料庫","type": "doc",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -16,7 +16,7 @@"HeadingLevel": 2,"Properties": {"id": "20251224101729-y8gjlt8",- "updated": "20251224101729"+ "updated": "20260920084445"},"Children": [{@@ -30,12 +30,12 @@"Type": "NodeParagraph","Properties": {"id": "20251224101729-3lny7un",- "updated": "20260730184353"+ "updated": "20260920084445"},"Children": [{"Type": "NodeText",- "Data": "資料庫由內容區塊或非內容區塊資料組成,並以不同視圖呈現,例如表格視圖、看板視圖和卡片視圖。"+ "Data": "資料庫由內容區塊或非內容區塊資料組成,並以不同視圖呈現,例如表格視圖、列表視圖、看板視圖和卡片視圖。"}]},@@ -45,7 +45,7 @@"HeadingLevel": 2,"Properties": {"id": "20251224101729-yhz5zrt",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -502,6 +502,185 @@}]},+ {+ "ID": "20260920084445-j00bcic",+ "Type": "NodeHeading",+ "HeadingLevel": 3,+ "Properties": {+ "id": "20260920084445-j00bcic",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "列表視圖"+ }+ ]+ },+ {+ "ID": "20260920084445-smyd92u",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-smyd92u",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "每個項目顯示為一行,不顯示表頭和表格格線。新建列表視圖預設只顯示主鍵欄位,其他欄位均隱藏。"+ }+ ]+ },+ {+ "ID": "20260920084445-8tidkbr",+ "Type": "NodeList",+ "ListData": {},+ "Properties": {+ "id": "20260920084445-8tidkbr",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-x1l8sd3",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-x1l8sd3",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-derir4d",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-derir4d",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "切換方式:在視圖設定中選擇 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "佈局"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "列表"+ },+ {+ "Type": "NodeText",+ "Data": ",也可透過斜線選單插入資料庫列表檢視"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-m4ql9o3",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-m4ql9o3",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-25af675",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-25af675",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "欄位顯示:開啟 "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "欄位"+ },+ {+ "Type": "NodeText",+ "Data": " 面板啟用需要顯示的欄位。可見欄位與主鍵顯示於同一行,並支援編輯欄位值"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-n3ijykx",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-n3ijykx",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-k2g10dv",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-k2g10dv",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "視圖設定:複製列表視圖或切回該視圖的列表佈局時,會保留已設定的欄位顯示與隱藏狀態"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-nz5oupp",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-nz5oupp",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-z20o9jj",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-z20o9jj",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "篩選、排序和分組:與同一資料庫的其他視圖共享資料,支援獨立設定篩選、排序和分組"+ }+ ]+ }+ ]+ }+ ]+ },{"ID": "20260613164228-rrw0f53","Type": "NodeHeading",@@ -984,7 +1163,7 @@"HeadingLevel": 3,"Properties": {"id": "20260613171246-whfdkq8",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -1951,7 +2130,7 @@"HeadingLevel": 4,"Properties": {"id": "20260613171246-35o76s9",- "updated": "20260613171246"+ "updated": "20260920084445"},"Children": [{@@ -1980,7 +2159,7 @@"ListData": {},"Properties": {"id": "20260613171246-7c32wem",- "updated": "20260613171246"+ "updated": "20260920084445"},"Children": [{@@ -2153,7 +2332,7 @@},"Properties": {"id": "20260613171246-3rb2k71",- "updated": "20260613171246"+ "updated": "20260920084445"},"Children": [{@@ -2181,7 +2360,7 @@"ListData": {},"Properties": {"id": "20260613171246-gfghf2c",- "updated": "20260613171246"+ "updated": "20260920084445"},"Children": [{@@ -2193,7 +2372,7 @@},"Properties": {"id": "20260613171246-5qgzfeh",- "updated": "20260613171246"+ "updated": "20260920084445"},"Children": [{@@ -2201,12 +2380,12 @@"Type": "NodeParagraph","Properties": {"id": "20260613171246-b6yc0id",- "updated": "20260613171246"+ "updated": "20260920084445"},"Children": [{"Type": "NodeText",- "Data": "表格視圖:分組後行按分組歸類,每個分組可摺疊展開"+ "Data": "表格和列表視圖:分組後行按分組歸類,每個分組可摺疊展開"}]}@@ -2281,7 +2460,7 @@},"Properties": {"id": "20260613171246-2v29lph",- "updated": "20260613171246"+ "updated": "20260920084445"},"Children": [{@@ -2289,7 +2468,7 @@"Type": "NodeParagraph","Properties": {"id": "20260613171246-510h6ik",- "updated": "20260613171246"+ "updated": "20260920084445"},"Children": [{@@ -2299,7 +2478,7 @@},{"Type": "NodeText",- "Data": ":表格和卡片視圖中可選擇「無」取消分組;看板視圖不可取消"+ "Data": ":表格、列表和卡片視圖中可選擇「無」取消分組;看板視圖不可取消"}]}diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.syindex ae52e115f7..1441dd7c99 100644--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy@@ -8,7 +8,7 @@"id": "20240530101000-3eaevtp","title": "データベース","type": "doc",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -17,7 +17,7 @@"HeadingLevel": 2,"Properties": {"id": "20251224101829-7bloks9",- "updated": "20251224101829"+ "updated": "20260920084445"},"Children": [{@@ -31,12 +31,12 @@"Type": "NodeParagraph","Properties": {"id": "20251224101829-j0vtpnz",- "updated": "20251224101829"+ "updated": "20260920084445"},"Children": [{"Type": "NodeText",- "Data": "データベースは、コンテンツブロックまたは非コンテンツブロックデータで構成され、テーブルビュー、カンバンビュー、カードビューなど、さまざまなビューで表示されます。"+ "Data": "データベースは、コンテンツブロックまたは非コンテンツブロックデータで構成され、テーブルビュー、リストビュー、カンバンビュー、カードビューなど、さまざまなビューで表示されます。"}]},@@ -46,7 +46,7 @@"HeadingLevel": 2,"Properties": {"id": "20251224101829-lva3op2",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -503,6 +503,185 @@}]},+ {+ "ID": "20260920084445-49cpwr3",+ "Type": "NodeHeading",+ "HeadingLevel": 3,+ "Properties": {+ "id": "20260920084445-49cpwr3",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "リストビュー"+ }+ ]+ },+ {+ "ID": "20260920084445-8jydb2r",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-8jydb2r",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "各エントリを1行で表示し、列ヘッダーや表の罫線は表示しません。新しく作成したリストビューでは主キーフィールドのみが表示され、ほかのフィールドはすべて非表示になります。"+ }+ ]+ },+ {+ "ID": "20260920084445-ksbezy4",+ "Type": "NodeList",+ "ListData": {},+ "Properties": {+ "id": "20260920084445-ksbezy4",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-uvsrid1",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-uvsrid1",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-jieo1xv",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-jieo1xv",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "切り替え:ビュー設定で "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "レイアウト"+ },+ {+ "Type": "NodeText",+ "Data": " - "+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "リスト"+ },+ {+ "Type": "NodeText",+ "Data": " を選択します。スラッシュメニューからデータベースのリストビューを挿入することもできます"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-ux0p6c6",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-ux0p6c6",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-qg8vpt6",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-qg8vpt6",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "フィールドの表示:"+ },+ {+ "Type": "NodeTextMark",+ "TextMarkType": "kbd",+ "TextMarkTextContent": "属性"+ },+ {+ "Type": "NodeText",+ "Data": " パネルで表示するフィールドを有効にします。表示するフィールドは主キーと同じ行に並び、値を編集できます"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-lthew83",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-lthew83",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-49wkcie",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-49wkcie",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "ビュー設定:リストビューを複製した場合や、そのビューをリストレイアウトに戻した場合も、設定したフィールドの表示・非表示は保持されます"+ }+ ]+ }+ ]+ },+ {+ "ID": "20260920084445-5evfzws",+ "Type": "NodeListItem",+ "ListData": {+ "BulletChar": 42,+ "Marker": "Kg=="+ },+ "Properties": {+ "id": "20260920084445-5evfzws",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "ID": "20260920084445-6ki99qy",+ "Type": "NodeParagraph",+ "Properties": {+ "id": "20260920084445-6ki99qy",+ "updated": "20260920084445"+ },+ "Children": [+ {+ "Type": "NodeText",+ "Data": "フィルター、ソート、グループ化:同じデータベースのほかのビューとデータを共有し、フィルター、ソート、グループ化を個別に設定できます"+ }+ ]+ }+ ]+ }+ ]+ },{"ID": "20260613164213-x497lrs","Type": "NodeHeading",@@ -985,7 +1164,7 @@"HeadingLevel": 3,"Properties": {"id": "20260613171234-4oam4x1",- "updated": "20260904121106"+ "updated": "20260920084445"},"Children": [{@@ -1952,7 +2131,7 @@"HeadingLevel": 4,"Properties": {"id": "20260613171234-567esec",- "updated": "20260613171234"+ "updated": "20260920084445"},"Children": [{@@ -1981,7 +2160,7 @@"ListData": {},"Properties": {"id": "20260613171234-5xm22ao",- "updated": "20260613171234"+ "updated": "20260920084445"},"Children": [{@@ -2154,7 +2333,7 @@},"Properties": {"id": "20260613171234-kyk19y3",- "updated": "20260613171234"+ "updated": "20260920084445"},"Children": [{@@ -2182,7 +2361,7 @@"ListData": {},"Properties": {"id": "20260613171234-dmaihcf",- "updated": "20260613171234"+ "updated": "20260920084445"},"Children": [{@@ -2194,7 +2373,7 @@},"Properties": {"id": "20260613171234-kd8txk4",- "updated": "20260613171234"+ "updated": "20260920084445"},"Children": [{@@ -2202,12 +2381,12 @@"Type": "NodeParagraph","Properties": {"id": "20260613171234-5ul4iy6",- "updated": "20260613171234"+ "updated": "20260920084445"},"Children": [{"Type": "NodeText",- "Data": "テーブルビュー:行がグループごとに分類され、各グループは折りたたみ/展開可能"+ "Data": "テーブルビューとリストビュー:行がグループごとに分類され、各グループは折りたたみ/展開可能"}]}@@ -2282,7 +2461,7 @@},"Properties": {"id": "20260613171234-fn0tmi6",- "updated": "20260613171234"+ "updated": "20260920084445"},"Children": [{@@ -2290,7 +2469,7 @@"Type": "NodeParagraph","Properties": {"id": "20260613171234-195iexs",- "updated": "20260613171234"+ "updated": "20260920084445"},"Children": [{@@ -2300,7 +2479,7 @@},{"Type": "NodeText",- "Data": ":テーブルビューとギャラリービューでは「なし」を選択して解除可能。カンバンビューでは解除不可"+ "Data": ":テーブルビュー、リストビュー、ギャラリービューでは「なし」を選択して解除可能。カンバンビューでは解除不可"}]}diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scssindex 7058084cc0..6b89f30ab9 100644--- a/app/src/assets/scss/business/_av.scss+++ b/app/src/assets/scss/business/_av.scss@@ -6,6 +6,79 @@margin-top: 4px !important;margin-bottom: 4px !important;+ &[data-av-type="list"] {+ width: 100%;++ > .av__container,+ .av__body {+ width: 100%;+ }++ .av__row--header,+ .av__row--footer,+ .av__freeze-drag,+ .av__drag-fill {+ display: none;+ }++ .av__row {+ border-bottom: 0;+ border-radius: var(--b3-border-radius);++ &[data-id] {+ border-top: 2px solid transparent;+ border-bottom: 2px solid transparent;+ background-clip: padding-box;+ }++ &:hover {+ background-color: var(--b3-list-hover);+ }++ &.av__row--select,+ &.av__row--hl {+ background-color: var(--b3-theme-primary-lightest);++ &::before {+ content: "";+ position: absolute;+ inset: 0;+ border-radius: var(--b3-border-radius);+ box-shadow: 0 1px 2px var(--b3-border-color);+ pointer-events: none;+ }++ > .av__cell {+ background-color: transparent;+ }+ }++ > .av__colsticky {+ background-color: transparent;+ flex-shrink: 0;++ > .av__firstcol {+ display: none;+ }+ }++ > .av__cell {+ border-right: 0;+ border-radius: inherit;+ flex: 0 1 auto;+ min-width: 2em;+ max-width: 30%;+ width: auto;++ &[data-dtype="block"] {+ flex: 1 1 12em;+ min-width: 8em;+ max-width: none;+ }+ }+ }+ }+&--backlink {max-height: min(400px, 60vh);overflow: auto;diff --git a/app/src/config/entryVisibility/catalog.test.ts b/app/src/config/entryVisibility/catalog.test.tsindex d936ddfc27..902e58befa 100644--- a/app/src/config/entryVisibility/catalog.test.ts+++ b/app/src/config/entryVisibility/catalog.test.ts@@ -97,6 +97,7 @@ const slashMenuBuiltinOrder = ["math","html","databaseTableView",+ "databaseListView","databaseKanbanView","databaseGalleryView","separator_2",@@ -496,7 +497,7 @@ test("slash menu catalog follows the built-in hint order", () => {assert.deepEqual(section?.children.map((item) => item.key), ["menu"]);const children = getEntryCatalogChildren(SLASH_MENU_ROOT_PATH);assert.deepEqual(children.map((item) => item.key), slashMenuBuiltinOrder);- assert.equal(children.filter((item) => item.type === "entry").length, 64);+ assert.equal(children.filter((item) => item.type === "entry").length, 65);assert.equal(children.filter((item) => item.type === "separator").length, 5);assert.equal(children.every((item) => item.simple), true);});diff --git a/app/src/config/entryVisibility/catalog.ts b/app/src/config/entryVisibility/catalog.tsindex 4f384b6859..c72f009193 100644--- a/app/src/config/entryVisibility/catalog.ts+++ b/app/src/config/entryVisibility/catalog.ts@@ -540,6 +540,7 @@ const slashMenuBuiltinChildren = [node("math", lang("math")),node("html", literal("HTML")),node("databaseTableView", lang("databaseTableView")),+ node("databaseListView", lang("databaseListView")),node("databaseKanbanView", lang("databaseKanbanView")),node("databaseGalleryView", lang("databaseGalleryView")),separator("separator_2"),diff --git a/app/src/config/entryVisibility/order.test.ts b/app/src/config/entryVisibility/order.test.tsindex 40c6d7e40b..4d0156b2cb 100644--- a/app/src/config/entryVisibility/order.test.ts+++ b/app/src/config/entryVisibility/order.test.ts@@ -28,6 +28,20 @@ test("entry order keeps custom order and inserts new entries by their default neassert.deepEqual(mergeEntryOrder(["a", "new", "b", "c"], ["c", "a", "b"]), ["c", "a", "new", "b"]);});+test("database list view merges into saved slash orders and preserves plugin slots", () => {+ const entries = getEntryCatalogChildren("editor.slash.menu");+ const defaults = entries.map(item => item.key);+ const saved = defaults.filter(key => key !== "databaseListView");+ saved.splice(1, 0, "plugin:example:item");+ const merged = mergeEntryOrderPreservingUnknown(defaults, saved);+ assert.deepEqual(merged.filter(key => key !== "databaseListView"), saved);+ assert.equal(merged[merged.indexOf("databaseTableView") + 1], "databaseListView");+ const separators = new Set(entries.filter(item => item.type === "separator").map(item => item.key));+ assert.deepEqual(resolveEntryOrder([...defaults, "plugin:example:item"], merged, separators), merged);+ assert.deepEqual(resolveEntryOrder(["databaseTableView", "databaseListView"], merged, separators),+ ["databaseTableView", "databaseListView"]);+});+test("custom task status merges into saved list menus without moving existing entries", () => {const entries = getEntryCatalogChildren("gutter.single.listBlock");const defaults = entries.map(item => item.key);diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.tsindex 4e842f41b9..d37e48a49e 100644--- a/app/src/protyle/hint/extend.ts+++ b/app/src/protyle/hint/extend.ts@@ -240,6 +240,11 @@ export const getBuiltinSlashMenuItems = (protyle: IProtyle): IHintData[] => {id: "databaseTableView",value: '<div data-type="NodeAttributeView" data-av-type="table"></div>',html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconTable"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.databaseTableView}</span></div>`,+ }, {+ filter: [window.siyuan.languages.databaseListView, "database list view", "数据库列表视图", "shujukuliebiaoshitu", "sjklbs"],+ id: "databaseListView",+ value: '<div data-type="NodeAttributeView" data-av-type="list"></div>',+ html: `<div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconList"></use></svg><span class="b3-list-item__text">${window.siyuan.languages.databaseListView}</span></div>`,}, {filter: [window.siyuan.languages.databaseKanbanView, "database kanban view", "数据库看板视图", "shujukukanbanshitu", "sjkkbs"],id: "databaseKanbanView",diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.tsindex 528632feb9..7143043e58 100644--- a/app/src/protyle/hint/index.ts+++ b/app/src/protyle/hint/index.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "../render/av/viewType";import {Constants} from "../../constants";import {isBuiltinSlashHint} from "./builtinSlash";import {@@ -788,7 +789,7 @@ ${genHintItemHTML(item)}if (!cellElement) {return;}- const rowElement = hasClosestByClassName(cellElement, nodeElement.getAttribute("data-av-type") === "table" ? "av__row" : "av__gallery-item");+ const rowElement = hasClosestByClassName(cellElement, isTableLikeView(nodeElement.getAttribute("data-av-type")) ? "av__row" : "av__gallery-item");if (!rowElement) {return;}diff --git a/app/src/protyle/hint/slashMenu.test.ts b/app/src/protyle/hint/slashMenu.test.tsindex f8c456b791..61634f089b 100644--- a/app/src/protyle/hint/slashMenu.test.ts+++ b/app/src/protyle/hint/slashMenu.test.ts@@ -84,7 +84,7 @@ test("slash menu separator normalization removes leading, trailing, and consecut});test("lite slash menu hides document-dependent entries and keeps local editing entries", () => {- const unavailable = ["database", "databaseTableView", "databaseKanbanView", "databaseGalleryView",+ const unavailable = ["database", "databaseTableView", "databaseListView", "databaseKanbanView", "databaseGalleryView","newFileRef", "newSubDocRef", "template", "blockEmbed", "aiWriting", "widget", "unknown"];const available = ["ref", "assets", "heading1", "table", "bold", "mermaid"];const items = [...unavailable, ...available].map((id) => entry(id));diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.tsindex e9ba9fd3c6..1f5f823d83 100644--- a/app/src/protyle/render/av/action.ts+++ b/app/src/protyle/render/av/action.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {Menu} from "../../../plugin/Menu";import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";import {transaction} from "../../wysiwyg/transaction";@@ -551,7 +552,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElereturn;}const cellType = getTypeByCellElement(target);- if (viewType === "table") {+ if (isTableLikeView(viewType)) {const scrollElement = hasClosestByClassName(target, "av__scroll");if (!scrollElement) {return;@@ -868,7 +869,7 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement | undefreturn false;}const avType = blockElement.getAttribute("data-av-type") as TAVView;- if (rowElement && avType === "table") {+ if (rowElement && isTableLikeView(avType)) {if (!rowElement.classList.contains("av__row--select")) {clearSelect(["row"], blockElement);}@@ -1233,10 +1234,10 @@ export const avContextmenu = (protyle: IProtyle, rowElement: HTMLElement | undefmenu.addSeparator({id: "separator_1"});}menu.addItem({- id: avType === "table" ? "insertRowBefore" : "insertItemBefore",+ id: isTableLikeView(avType) ? "insertRowBefore" : "insertItemBefore",icon: "iconBefore",label: `<div class="fn__flex" style="align-items: center;">-${window.siyuan.languages[avType === "table" ? "insertRowBefore" : "insertItemBefore"].replace("${x}", `<span class="fn__space"></span><input type="number" step="1" min="1" value="1" placeholder="${window.siyuan.languages.enterKey}" class="b3-text-field b3-text-field--size"><span class="fn__space"></span>`)}+${window.siyuan.languages[isTableLikeView(avType) ? "insertRowBefore" : "insertItemBefore"].replace("${x}", `<span class="fn__space"></span><input type="number" step="1" min="1" value="1" placeholder="${window.siyuan.languages.enterKey}" class="b3-text-field b3-text-field--size"><span class="fn__space"></span>`)}</div>`,bind(element) {const inputElement = element.querySelector("input");@@ -1268,10 +1269,10 @@ ${window.siyuan.languages[avType === "table" ? "insertRowBefore" : "insertItemBe}});menu.addItem({- id: avType === "table" ? "insertRowAfter" : "insertItemAfter",+ id: isTableLikeView(avType) ? "insertRowAfter" : "insertItemAfter",icon: "iconAfter",label: `<div class="fn__flex" style="align-items: center;">-${window.siyuan.languages[avType === "table" ? "insertRowAfter" : "insertItemAfter"].replace("${x}", `<span class="fn__space"></span><input type="number" step="1" min="1" placeholder="${window.siyuan.languages.enterKey}" class="b3-text-field b3-text-field--size" value="1"><span class="fn__space"></span>`)}+${window.siyuan.languages[isTableLikeView(avType) ? "insertRowAfter" : "insertItemAfter"].replace("${x}", `<span class="fn__space"></span><input type="number" step="1" min="1" placeholder="${window.siyuan.languages.enterKey}" class="b3-text-field b3-text-field--size" value="1"><span class="fn__space"></span>`)}</div>`,bind(element) {const inputElement = element.querySelector("input");diff --git a/app/src/protyle/render/av/asset.test.ts b/app/src/protyle/render/av/asset.test.tsindex 09e9e2e3ce..f2ea4ca58e 100644--- a/app/src/protyle/render/av/asset.test.ts+++ b/app/src/protyle/render/av/asset.test.ts@@ -8,9 +8,10 @@ import * as selectionState from "./selectionState";import * as assetUploadTarget from "./assetUploadTarget";import {updateAVCachedCellValue} from "./cellValue";import * as uploadResult from "../../upload/uploadResult";+import * as viewType from "./viewType";// 使用完整资源消费者,控制上传完成与虚拟行移除的顺序,记录实际生成的事务。-const createHarness = () => {+const createHarness = (layout = "table") => {const column = {id: "assets", type: "mAsset"} as IAVColumn;const cell = {id: "value", value: {id: "value", type: "mAsset", mAsset: [{content: "original.png", name: "original", type: "image"},@@ -26,7 +27,7 @@ const createHarness = () => {closest: () => ({dataset: {}}),};const block = {- getAttribute: (key: string) => ({"data-av-type": "table", "data-av-id": "av", "data-node-id": "block"})[key],+ getAttribute: (key: string) => ({"data-av-type": layout, "data-av-id": "av", "data-node-id": "block"})[key],contains: () => rendered,querySelector: () => rendered ? element : null,querySelectorAll: () => rendered ? [element] : [],@@ -34,6 +35,7 @@ const createHarness = () => {const operations: IOperation[] = [];const pending: Array<(_response: string, result: unknown) => void> = [];const mocks: Record<string, unknown> = {+ "./viewType": viewType,"./selectionState": selectionState,"./assetUploadTarget": assetUploadTarget,"../../upload/uploadResult": uploadResult,@@ -95,6 +97,14 @@ const createHarness = () => {};describe("database resource upload consumers", () => {+ it("keeps list uploads bound to the original row after virtualization removes it", () => {+ const harness = createHarness("list");+ harness.start("picker");+ harness.hide();+ harness.complete("list.png");+ assert.deepEqual(harness.cell.value.mAsset.map(value => value.content), ["original.png", "list.png"]);+ assert.equal(harness.operations.filter(op => op.action === "updateAttrViewCell").length, 1);+ });for (const kind of ["picker", "drop", "panel"] as const) {it(`${kind}: appends to a visible target`, () => {const harness = createHarness();diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.tsindex 8a0482946b..ea07518027 100644--- a/app/src/protyle/render/av/asset.ts+++ b/app/src/protyle/render/av/asset.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {Menu} from "../../../plugin/Menu";import {transaction} from "../../wysiwyg/transaction";import {updateAttrViewCellAnimation} from "./action";@@ -145,7 +146,7 @@ export const updateAssetCell = (options: {return;}if (!options.blockElement.contains(item)) {- if (viewType === "table") {+ if (isTableLikeView(viewType)) {item = (options.blockElement.querySelector(`.av__row[data-id="${rowID}"] .av__cell[data-col-id="${item.dataset.colId}"]`) ||options.blockElement.querySelector(`.fn__flex-1[data-col-id="${item.dataset.colId}"]`)) as HTMLElement;} else {diff --git a/app/src/protyle/render/av/batchEdit.ts b/app/src/protyle/render/av/batchEdit.tsindex 2ac296d837..6c56b85957 100644--- a/app/src/protyle/render/av/batchEdit.ts+++ b/app/src/protyle/render/av/batchEdit.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {createEmptyAVValue} from "./attributeValue";import {popTextCell, renderCell, updateCellsValue} from "./cell";import {getAVData, getAVSelectedItemIDs} from "./virtualScroll";@@ -39,7 +40,7 @@ const findItemCell = (view: IAVView, viewType: TAVView, itemID: string, fieldInd}return;}- const isTable = viewType === "table";+ const isTable = isTableLikeView(viewType);if (isTable) {const item = (view as IAVTable).rows?.find((currentItem) => currentItem.id === itemID);return item?.cells[fieldIndex];diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex c219a57c63..2355d52f1a 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {isAVRenderData} from "./renderData";import {transaction} from "../../wysiwyg/transaction";import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";@@ -419,14 +420,16 @@ export const cellScrollIntoView = (blockElement: HTMLElement, cellElement: Elemeif (!bodyElement) {return;}- const avHeaderRect = bodyElement.querySelector(".av__row--header").getBoundingClientRect();+ const isList = blockElement.getAttribute("data-av-type") === "list";+ const avHeaderRect = (isList ? blockElement.querySelector(".av__views") :+ bodyElement.querySelector(".av__row--header")).getBoundingClientRect();if (avHeaderRect.bottom > cellRect.top) {const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);if (contentElement) {contentElement.scrollTop = contentElement.scrollTop + cellRect.top - avHeaderRect.bottom;}} else {- const footerElement = bodyElement.querySelector(".av__row--footer");+ const footerElement = isList ? null : bodyElement.querySelector(".av__row--footer");if (footerElement?.querySelector(".av__calc--ashow")) {const avFooterRect = footerElement.getBoundingClientRect();if (avFooterRect.top < cellRect.bottom) {@@ -467,7 +470,7 @@ const getStableTextCells = (cellElements: HTMLElement[], blockElement: HTMLElemeconst colID = getColId(cellElement, viewType);const value = getStoredCellValueByElement(cellElement) || genCellValueByElement("text", cellElement);const rowElement = hasClosestByClassName(cellElement,- viewType === "table" ? "av__row" : "av__gallery-item");+ isTableLikeView(viewType) ? "av__row" : "av__gallery-item");const groupElement = hasClosestByClassName(cellElement, "av__body");const rowIndex = parseInt(rowElement ? rowElement.getAttribute("data-index") || "0" : "0") || 0;const stableCell = createAVStableTextCell({@@ -514,7 +517,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], typeconst viewType = blockElement.getAttribute("data-av-type") as TAVView;let cellRect = cellElements[0].getBoundingClientRect();const contentElement = hasClosestByClassName(blockElement, "protyle-content", true);- if (viewType === "table" && options?.scrollIntoView !== false) {+ if (isTableLikeView(viewType) && options?.scrollIntoView !== false) {cellScrollIntoView(blockElement, cellElements[0], false);}cellRect = cellElements[0].getBoundingClientRect();@@ -637,7 +640,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type} else {options?.destroyCallback?.();}- if (viewType === "table" && !hasClosestByClassName(cellElements[0], "custom-attr")) {+ if (isTableLikeView(viewType) && !hasClosestByClassName(cellElements[0], "custom-attr")) {cellElements[0].classList.add("av__cell--select");addDragFill(cellElements[0]);}@@ -706,7 +709,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], typeprotyle.toolbar.range = document.createRange();if (cellElements[0] && !blockElement.contains(cellElements[0])) {const rowID = getFieldIdByCellElement(cellElements[0], viewType);- if (viewType === "table") {+ if (isTableLikeView(viewType)) {cellElements[0] = (blockElement.querySelector(`.av__row[data-id="${rowID}"] .av__cell[data-col-id="${cellElements[0].dataset.colId}"]`)) as HTMLElement;} else {cellElements[0] = (blockElement.querySelector(`.av__gallery-item[data-id="${rowID}"] .av__cell[data-field-id="${cellElements[0].dataset.fieldId}"]`)) as HTMLElement;@@ -714,7 +717,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type}protyle.toolbar.range.selectNodeContents(cellElements[0].lastChild);focusByRange(protyle.toolbar.range);- if (viewType === "table") {+ if (isTableLikeView(viewType)) {cellElements[0].classList.add("av__cell--select");addDragFill(cellElements[0]);}@@ -786,7 +789,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], typeconst updateCellValueByInput = (protyle: IProtyle, type: TAVCol, blockElement: HTMLElement, cellElements: HTMLElement[],restoreFocus = true) => {const viewType = blockElement.getAttribute("data-av-type") as TAVView;- if (viewType === "table" && !cellElements[0].dataset.avId) {+ if (isTableLikeView(viewType) && !cellElements[0].dataset.avId) {const rowElement = hasClosestByClassName(cellElements[0], "av__row");if (!rowElement) {return;@@ -832,7 +835,7 @@ const updateCellValueByInput = (protyle: IProtyle, type: TAVCol, blockElement: Hchecked: !genCellValueByElement(type, cellElements[0]).checkbox?.checked} : inputElement.value, cellElements);}- if (viewType === "table" &&+ if (isTableLikeView(viewType) &&// 兼容新增行后台隐藏cellElements[0] &&!hasClosestByClassName(cellElements[0], "custom-attr")) {@@ -895,7 +898,7 @@ export const updateCellsValue = async (protyle: IProtyle, nodeElement: HTMLElemecontinue;}if (item && !nodeElement.contains(item)) {- if (viewType === "table") {+ if (isTableLikeView(viewType)) {item = source.element = (nodeElement.querySelector(`.av__row[data-id="${rowID}"] .av__cell[data-col-id="${item.dataset.colId}"]`) ||nodeElement.querySelector(`.fn__flex-1[data-col-id="${item.dataset.colId}"]`)) as HTMLElement;} else {diff --git a/app/src/protyle/render/av/cellEditor.test.ts b/app/src/protyle/render/av/cellEditor.test.tsindex b59aebe7ce..fac1dbcf34 100644--- a/app/src/protyle/render/av/cellEditor.test.ts+++ b/app/src/protyle/render/av/cellEditor.test.ts@@ -3,6 +3,7 @@ import {readFileSync} from "node:fs";import {describe, it} from "node:test";import {runInNewContext} from "node:vm";import {ModuleKind, ScriptTarget, transpileModule} from "typescript";+import {isTableLikeView} from "./viewType";const source = readFileSync("src/protyle/render/av/cell.ts", "utf8");const compiled = transpileModule(source.slice(source.indexOf("const updateCellValueByInput ="),@@ -10,7 +11,7 @@ const compiled = transpileModule(source.slice(source.indexOf("const updateCellVacompilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2020},}).outputText;-const createEditor = (changed: boolean) => {+const createEditor = (changed: boolean, viewType = "table") => {const saved: unknown[][] = [];let focusCount = 0;let removed = false;@@ -23,10 +24,11 @@ const createEditor = (changed: boolean) => {};const protyle = {};const block = {- getAttribute: (name: string) => name === "data-av-type" ? "table" : "database-id",+ getAttribute: (name: string) => name === "data-av-type" ? viewType : "database-id",};const cells = [{dataset: {}, classList: {add: () => {}}}];const context = {+ isTableLikeView,document: {querySelector: (selector: string) => selector === ".av__mask" ? mask : null,querySelectorAll: () => [mask],@@ -50,6 +52,13 @@ const createEditor = (changed: boolean) => {};describe("database cell editor navigation", () => {+ it("submits list property edits using the row identity and restores focus", () => {+ const editor = createEditor(true, "list");+ editor.close(true);+ assert.deepEqual(editor.saved[0], [editor.protyle, editor.block, "updated value", editor.cells]);+ assert.equal(editor.focusCount(), 1);+ assert.equal(editor.isRemoved(), true);+ });it("submits edited content to the original cell without focusing the departing document", () => {const editor = createEditor(true);editor.close();diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.tsindex 704d8ea657..83c9261343 100644--- a/app/src/protyle/render/av/col.ts+++ b/app/src/protyle/render/av/col.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {isAVRenderData} from "./renderData";import {Menu} from "../../../plugin/Menu";import {transaction} from "../../wysiwyg/transaction";@@ -30,7 +31,7 @@ import {activeBlur} from "../../../mobile/util/keyboardToolbar";/// #endifexport const getColId = (element: Element, viewType: TAVView) => {- if (viewType === "table" || hasClosestByClassName(element, "custom-attr")) {+ if (isTableLikeView(viewType) || hasClosestByClassName(element, "custom-attr")) {return element.getAttribute("data-col-id");} else if (["gallery", "kanban"].includes(viewType)) {return element.getAttribute("data-field-id");@@ -1611,7 +1612,7 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: st/// #endifconst menu = new Menu(Constants.MENU_AV_HEADER_ADD);const avID = blockElement.getAttribute("data-av-id");- if (typeof previousID === "undefined" && blockElement.getAttribute("data-av-type") === "table") {+ if (typeof previousID === "undefined" && isTableLikeView(blockElement.getAttribute("data-av-type"))) {previousID = Array.from(blockElement.querySelectorAll(".av__row--header .av__cell")).pop().getAttribute("data-col-id");}const blockId = blockElement.getAttribute("data-node-id");@@ -1624,6 +1625,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.text,avID,type: "text",@@ -1662,6 +1665,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.number,avID,type: "number",@@ -1700,6 +1705,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.select,avID,type: "select",@@ -1738,6 +1745,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.multiSelect,avID,type: "mSelect",@@ -1776,6 +1785,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.date,avID,type: "date",@@ -1815,6 +1826,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.assets,avID,type: "mAsset",@@ -1853,6 +1866,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.checkbox,avID,type: "checkbox",@@ -1891,6 +1906,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.link,avID,type: "url",@@ -1929,6 +1946,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.email,avID,type: "email",@@ -1967,6 +1986,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.phone,avID,type: "phone",@@ -2005,6 +2026,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.template,avID,type: "template",@@ -2043,6 +2066,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.relation,avID,type: "relation",@@ -2081,6 +2106,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.rollup,avID,type: "rollup",@@ -2120,6 +2147,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.lineNumber,avID,type: "lineNumber",@@ -2158,6 +2187,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.createdTime,avID,type: "created",@@ -2197,6 +2228,8 @@ export const addCol = (protyle: IProtyle, blockElement: Element, previousID?: stconst newUpdated = dayjs().format("YYYYMMDDHHmmss");transaction(protyle, [{action: "addAttrViewCol",+ blockID: blockId,+ viewID: blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",name: window.siyuan.languages.updatedTime,avID,type: "updated",diff --git a/app/src/protyle/render/av/dragSelect.ts b/app/src/protyle/render/av/dragSelect.tsindex 298d3b8690..dd07844c43 100644--- a/app/src/protyle/render/av/dragSelect.ts+++ b/app/src/protyle/render/av/dragSelect.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {resetAVRowSelect} from "./virtualScroll";import {updateAVSelectionStatus} from "./row";import {hasClosestByClassName} from "../../util/hasClosest";@@ -16,11 +17,11 @@ const isRectIntersecting = (rect: DOMRect, selectRect: DOMRect, clipRect?: DOMReexport const isAVDragSelectSupported = (blockElement: HTMLElement) => {return blockElement.classList.contains("av") &&- ["table", "kanban", "gallery"].includes(blockElement.dataset.avType);+ ["table", "list", "kanban", "gallery"].includes(blockElement.dataset.avType);};export const applyAVDragSelection = (blockElement: HTMLElement, selectRect: DOMRect) => {- const isTable = blockElement.dataset.avType === "table";+ const isTable = isTableLikeView(blockElement.dataset.avType);const itemSelector = isTable ? ".av__row[data-id]" :".av__gallery-item[data-id]:not([data-type=\"ghost\"])";const clipRect = blockElement.dataset.avType === "kanban" ?@@ -62,7 +63,7 @@ export const applyAVDragSelection = (blockElement: HTMLElement, selectRect: DOMRexport const clearAVDragSelection = (blockElement: HTMLElement) => {clearAVItemSelectionState(blockElement);- const isTable = blockElement.dataset.avType === "table";+ const isTable = isTableLikeView(blockElement.dataset.avType);blockElement.querySelectorAll(".av__body").forEach((bodyElement: HTMLElement) => {if (hasClosestByClassName(bodyElement, "av") !== blockElement) {return;diff --git a/app/src/protyle/render/av/fieldVisibility.ts b/app/src/protyle/render/av/fieldVisibility.tsindex 424b54a083..0c62b8a233 100644--- a/app/src/protyle/render/av/fieldVisibility.ts+++ b/app/src/protyle/render/av/fieldVisibility.ts@@ -7,6 +7,8 @@ import {setPosition} from "../../../util/setPosition";const getViewIcon = (type: TAVView) => {switch (type) {+ case "list":+ return "iconList";case "gallery":return "iconGallery";case "kanban":diff --git a/app/src/protyle/render/av/focus.ts b/app/src/protyle/render/av/focus.tsindex c811a01c0f..afb0d6f97d 100644--- a/app/src/protyle/render/av/focus.ts+++ b/app/src/protyle/render/av/focus.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {addDragFill, cellScrollIntoView} from "./cell";import {clearSelect} from "../../util/clear";import {focusBlock, focusByRange} from "../../util/selection";@@ -64,7 +65,7 @@ export const focusAVVerticalRegion = (blockElement: HTMLElement, direction: TVerreturn focusAVTitleByVerticalArrow(blockElement, direction, goalX, scrollBoundary);}- if (blockElement.dataset.avType === "table") {+ if (isTableLikeView(blockElement.dataset.avType)) {const rows = getOwnVisibleElements(blockElement, ".av__row[data-id]:not(.av__row--header)");const rowElement = getAVData(blockElement) ? ensureAVTableBoundaryRow(blockElement, direction) :rows[direction === "down" ? 0 : rows.length - 1];@@ -119,7 +120,7 @@ export const focusAVByArrow = (protyle: IProtyle, blockElement: HTMLElement, keyreturn true;}- if (blockElement.dataset.avType !== "table") {+ if (!isTableLikeView(blockElement.dataset.avType)) {return false;}diff --git a/app/src/protyle/render/av/gallery/render.ts b/app/src/protyle/render/av/gallery/render.tsindex dc837b805e..0f023dc0ba 100644--- a/app/src/protyle/render/av/gallery/render.ts+++ b/app/src/protyle/render/av/gallery/render.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "../viewType";import {isAVRenderData} from "../renderData";import {hasClosestBlock, hasClosestByClassName} from "../../../util/hasClosest";import {Constants} from "../../../../constants";@@ -312,7 +313,7 @@ export const renderGallery = async (options: {}applyAVRenderContext(options.blockElement, data);prepareAVLocate(options.blockElement, data, resetData);- if (data.viewType === "table") {+ if (isTableLikeView(data.viewType)) {avRender(options.blockElement, options.protyle, options.cb, options.renderAll, data);return;}diff --git a/app/src/protyle/render/av/insertRows.test.ts b/app/src/protyle/render/av/insertRows.test.tsindex cf3057d92e..3a3a025551 100644--- a/app/src/protyle/render/av/insertRows.test.ts+++ b/app/src/protyle/render/av/insertRows.test.ts@@ -10,7 +10,7 @@ const compiled = transpileModule(source.slice(source.indexOf("export const insercompilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2021},}).outputText;-for (const viewType of ["table", "gallery", "kanban"]) {+for (const viewType of ["table", "list", "gallery", "kanban"]) {for (const count of [1, 3]) {test(`${viewType}: undo and redo ${count} added entries using their item IDs`, () => {let nextID = 0;diff --git a/app/src/protyle/render/av/kanban/render.ts b/app/src/protyle/render/av/kanban/render.tsindex b50c801038..9c9a1a0aa9 100644--- a/app/src/protyle/render/av/kanban/render.ts+++ b/app/src/protyle/render/av/kanban/render.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "../viewType";import {isAVRenderData} from "../renderData";import {getPublishAVView} from "../publishState";import {hasClosestByAttribute, hasClosestByClassName} from "../../../util/hasClosest";@@ -192,7 +193,7 @@ export const renderKanban = async (options: {}applyAVRenderContext(options.blockElement, data);prepareAVLocate(options.blockElement, data, resetData);- if (data.viewType === "table") {+ if (isTableLikeView(data.viewType)) {avRender(options.blockElement, options.protyle, options.cb, options.renderAll, data);return;}diff --git a/app/src/protyle/render/av/layout.ts b/app/src/protyle/render/av/layout.tsindex 923e693598..e4f7eaea1b 100644--- a/app/src/protyle/render/av/layout.ts+++ b/app/src/protyle/render/av/layout.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {isAVRenderData} from "./renderData";import {transaction} from "../../wysiwyg/transaction";import {Constants} from "../../../constants";@@ -119,6 +120,11 @@ export const getLayoutHTML = (data: IAV) => {<div class="fn__hr"></div><div>${window.siyuan.languages.table}</div></div>+ <div data-type="set-layout" data-view-type="list" class="av__layout-item${data.viewType === "list" ? " av__layout-item--select" : ""}">+ <svg><use xlink:href="#iconList"></use></svg>+ <div class="fn__hr"></div>+ <div>${window.siyuan.languages.listView}</div>+ </div><div data-type="set-layout" data-view-type="kanban" class="av__layout-item${data.viewType === "kanban" ? " av__layout-item--select" : ""}"><svg><use xlink:href="#iconBoard"></use></svg><div class="fn__hr"></div>@@ -266,7 +272,7 @@ export const bindLayoutEvent = (options: {});options.data.view.wrapField = checked;});- if (options.data.viewType === "table") {+ if (isTableLikeView(options.data.viewType)) {return;}const cardLayoutElement = options.menuElement.querySelector('[data-type="set-card-layout"]') as HTMLButtonElement;diff --git a/app/src/protyle/render/av/listView.test.ts b/app/src/protyle/render/av/listView.test.tsnew file mode 100644index 0000000000..17e2afc669--- /dev/null+++ b/app/src/protyle/render/av/listView.test.ts@@ -0,0 +1,130 @@+import {describe, it} from "node:test";+import * as assert from "node:assert/strict";+import {readFileSync} from "node:fs";+import {join} from "node:path";+import {runInNewContext} from "node:vm";+import * as ts from "typescript";+import * as viewType from "./viewType";+import {resolveAVSelectedCell} from "./selectionState";++// 使用实际行渲染与字段定位函数,检查列表沿用行列交互时的字段映射。+const loadModule = (name: string) => {+ const mocks: Record<string, unknown> = {+ "./viewType": viewType,+ "./cell": {renderCell: (value: IAVCellValue) => value?.text?.content || value?.block?.content || ""},+ "./blockAttr": {isCustomAttr: () => false},+ "../../util/hasClosest": {hasClosestByClassName: (element: HTMLElement, className: string) =>+ element.closest(`.${className}`)},+ "../../../util/escape": {escapeAttr: (value: string) => value || "", escapeAriaLabel: (value: string) => value || ""},+ };+ const module = {exports: {}};+ runInNewContext(ts.transpileModule(readFileSync(join(__dirname, `${name}.ts`), "utf8"), {+ compilerOptions: {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022},+ }).outputText, {+ module, exports: module.exports, require: (id: string) => mocks[id] || {},+ window: {siyuan: {languages: {freezeDrag: "Freeze"}}},+ });+ return module.exports;+};++const {getRowHTML, getFieldIdByCellElement} = loadModule("row") as typeof import("./row");+const {getColId} = loadModule("col") as typeof import("./col");++const createView = () => ({+ rowCount: 1,+ columns: [+ {id: "title", name: "Title", type: "block", hidden: false, width: "360px", pin: true},+ {id: "tag", name: "Tag", type: "text", hidden: true, width: "180px"},+ ],+ rows: [{id: "row", cells: [+ {id: "title-value", valueType: "block", value: {type: "block", block: {content: "Entry"}}},+ {id: "tag-value", valueType: "text", value: {type: "text", text: {content: "Work"}}},+ ]}],+}) as IAVTable;++describe("database list view", () => {+ it("renders the primary field without column widths or freezing and reveals selected properties", () => {+ const data = createView();+ const options = {data, row: data.rows[0], rowIndex: 0, pinIndex: 0, type: "list" as TAVView};+ const html = getRowHTML(options);+ assert.match(html, /data-col-id="title"/);+ assert.match(html, />Entry<\/div>/);+ assert.doesNotMatch(html, /data-col-id="tag"|width:|av__freeze-drag|av__colsticky--freeze/);++ data.columns[1].hidden = false;+ const revealedHTML = getRowHTML(options);+ assert.match(revealedHTML, /data-col-id="tag"/);+ assert.match(revealedHTML, /aria-label="Tag"/);+ assert.match(revealedHTML, />Work<\/div>/);+ assert.doesNotMatch(revealedHTML, /width:/);+ });++ it("keeps table widths and frozen columns when rendering the same data as a table", () => {+ const data = createView();+ const html = getRowHTML({data, row: data.rows[0], rowIndex: 0, pinIndex: 0, type: "table"});+ assert.match(html, /width: 360px/);+ assert.match(html, /av__colsticky--freeze/);+ assert.match(html, /av__freeze-drag/);+ });++ it("resolves list edit targets from row IDs and column IDs", () => {+ const row = {dataset: {id: "row"}};+ const element = {+ closest: (selector: string) => selector === ".av__row" ? row : undefined,+ getAttribute: (name: string) => name === "data-col-id" ? "tag" : undefined,+ } as unknown as HTMLElement;+ assert.equal(getFieldIdByCellElement(element, "list"), "row");+ assert.equal(getColId(element, "list"), "tag");++ const view = createView();+ view.columns[1].hidden = false;+ const selected = resolveAVSelectedCell({view, viewType: "list"} as IAV,+ {groupID: "", rowID: "row", colID: "tag"});+ assert.equal(selected.column.id, "tag");+ assert.equal(selected.cell.id, "tag-value");+ });++ it("creates every property type in the active list view when the database has another primary view", () => {+ const source = readFileSync(join(__dirname, "col.ts"), "utf8");+ const compiled = ts.transpileModule(source.slice(source.indexOf("export const addCol ="),+ source.indexOf("const genColDataByType =")), {+ compilerOptions: {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022},+ }).outputText;+ const items: Array<{click: () => void}> = [];+ const operations: IOperation[] = [];+ const exports: {addCol?: typeof import("./col").addCol} = {};+ runInNewContext(compiled, {+ exports,+ Menu: class {+ addItem(item: {click: () => void}) {+ items.push(item);+ }+ },+ activeBlur: () => {},+ Lute: {NewNodeID: () => "new-field"},+ dayjs: () => ({format: () => "20260920120000"}),+ Constants: {CUSTOM_SY_AV_VIEW: "custom-sy-av-view"},+ window: {siyuan: {languages: {}}},+ transaction: (_protyle: IProtyle, values: IOperation[]) => operations.push(...values),+ addAttrViewColAnimation: () => {},+ });+ const block = {+ getAttribute: (name: string) => ({+ "data-av-id": "database",+ "data-node-id": "carrier",+ "custom-sy-av-view": "list-view",+ })[name],+ setAttribute: () => {},+ } as unknown as Element;+ exports.addCol({} as IProtyle, block, "title");+ items.forEach(item => item.click());+ const columns = operations.filter(operation => operation.action === "addAttrViewCol");+ assert.equal(columns.length, items.length);+ assert.ok(columns.length > 0);+ columns.forEach(operation => {+ assert.equal(operation.blockID, "carrier");+ assert.equal(operation.viewID, "list-view");+ assert.equal(operation.previousID, "title");+ });+ });+});diff --git a/app/src/protyle/render/av/locate.ts b/app/src/protyle/render/av/locate.tsindex 74885038fe..aa697bdaf8 100644--- a/app/src/protyle/render/av/locate.ts+++ b/app/src/protyle/render/av/locate.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {Constants} from "../../../constants";import {applyPublishAVFolds, getPublishAVView, setPublishAVView} from "./publishState";import {getCardWidth} from "./gallery/style";@@ -42,7 +43,7 @@ const highlightLocatedItem = (blockElement: HTMLElement, protyle: IProtyle, viewconst token = Symbol();highlightTokens.set(blockElement, token);const className = "protyle-wysiwyg--hl";- const targetQuery = viewType === "table" ? `.av__row[data-id="${itemID}"]` : `.av__gallery-item[data-id="${itemID}"]`;+ const targetQuery = isTableLikeView(viewType) ? `.av__row[data-id="${itemID}"]` : `.av__gallery-item[data-id="${itemID}"]`;requestAnimationFrame(() => {if (!blockElement.isConnected || highlightTokens.get(blockElement) !== token) {return;@@ -53,7 +54,7 @@ const highlightLocatedItem = (blockElement: HTMLElement, protyle: IProtyle, viewreturn;}blockElement.querySelectorAll(`.${className}`).forEach(item => item.classList.remove(className));- if (viewType === "table") {+ if (isTableLikeView(viewType)) {protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--hl, .av__row--hl").forEach(item => {item.classList.remove("protyle-wysiwyg--hl", "av__row--hl");});@@ -87,7 +88,7 @@ const getLocalAVLocateData = (data: IAV | undefined, request: IAVLocateRequest)return;}const findTarget = (view: IAVTable | IAVGallery | IAVKanban, groupID = "") => {- const items = data.viewType === "table" ? (view as IAVTable).rows : (view as IAVGallery | IAVKanban).cards;+ const items = isTableLikeView(data.viewType) ? (view as IAVTable).rows : (view as IAVGallery | IAVKanban).cards;const localIndex = items?.findIndex(item => item.id === request.itemID) ?? -1;if (localIndex < 0) {return;@@ -314,7 +315,7 @@ export const prepareAVLocate = (blockElement: HTMLElement, data: IAV, resetData:}const key = data.target.groupID || "all";const view = (data.target.groupID ? data.view.groups?.find(item => item.id === data.target.groupID) : data.view) as IAVTable | IAVGallery | IAVKanban;- const itemLength = data.viewType === "table" ? (view as IAVTable).rows.length : (view as IAVGallery | IAVKanban).cards.length;+ const itemLength = isTableLikeView(data.viewType) ? (view as IAVTable).rows.length : (view as IAVGallery | IAVKanban).cards.length;const offset = data.target.offset || 0;const localIndex = Math.max(0, data.target.index - offset);let renderedStart = Math.max(0, localIndex - locateRenderSize / 2);@@ -323,7 +324,7 @@ export const prepareAVLocate = (blockElement: HTMLElement, data: IAV, resetData:let topSpacerHeight: number;const bodyQuery = data.target.groupID ? `.av__body[data-group-id="${data.target.groupID}"]` : ".av__body";const currentBody = blockElement.querySelector(bodyQuery);- if (data.viewType === "table") {+ if (isTableLikeView(data.viewType)) {const rowHeight = (currentBody?.querySelector(".av__row[data-id]") as HTMLElement)?.offsetHeight || 36;topSpacerHeight = renderedStart * rowHeight;} else {@@ -376,7 +377,7 @@ export const finishAVLocate = (blockElement: HTMLElement, protyle: IProtyle, datreturn;}let targetElement: HTMLElement;- if (data.viewType === "table") {+ if (isTableLikeView(data.viewType)) {const rowElement = bodyElement?.querySelector(`.av__row[data-id="${request.itemID}"]`) as HTMLElement;targetElement = rowElement?.querySelector(".av__cell[data-dtype=\"block\"]") as HTMLElement;if (targetElement && request.select !== false) {@@ -414,7 +415,7 @@ export const finishAVLocate = (blockElement: HTMLElement, protyle: IProtyle, dat}}if (request.scroll !== false && !scrollBacklinkTarget(blockElement, targetElement)) {- if (!request.keyID && data.viewType === "table" && data.target.index === 0 && !data.target.groupID) {+ if (!request.keyID && isTableLikeView(data.viewType) && data.target.index === 0 && !data.target.groupID) {const contentRect = protyle.contentElement.getBoundingClientRect();protyle.contentElement.scrollTop += blockElement.getBoundingClientRect().top - contentRect.top;} else {@@ -429,7 +430,7 @@ export const finishAVLocate = (blockElement: HTMLElement, protyle: IProtyle, datkanbanElement.scrollLeft += targetRect.left + targetRect.width / 2 - (kanbanRect.left + kanbanRect.width / 2);}}- if (data.viewType === "table" && request.keyID) {+ if (isTableLikeView(data.viewType) && request.keyID) {const scroller = blockElement.querySelector<HTMLElement>(".av__scroll");const rect = scroller?.getBoundingClientRect();const targetRect = targetElement.getBoundingClientRect();diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.tsindex 03f5383d58..f9eecd2aa2 100644--- a/app/src/protyle/render/av/openMenuPanel.ts+++ b/app/src/protyle/render/av/openMenuPanel.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {transaction} from "../../wysiwyg/transaction";import {fetchPost} from "../../../util/fetch";import {@@ -270,7 +271,7 @@ export const openMenuPanel = (options: {if (!options.blockElement.contains(lastElement)) {// https://github.com/siyuan-note/siyuan/issues/15839const rowID = getFieldIdByCellElement(lastElement, data.viewType);- if (data.viewType === "table") {+ if (isTableLikeView(data.viewType)) {lastElement = options.blockElement.querySelector(`.av__row[data-id="${rowID}"] .av__cell[data-col-id="${lastElement.dataset.colId}"]`);} else {lastElement = options.blockElement.querySelector(`.av__gallery-item[data-id="${rowID}"] .av__cell[data-field-id="${lastElement.dataset.fieldId}"]`);diff --git a/app/src/protyle/render/av/rangeSelect.ts b/app/src/protyle/render/av/rangeSelect.tsindex e7529fe019..273b013041 100644--- a/app/src/protyle/render/av/rangeSelect.ts+++ b/app/src/protyle/render/av/rangeSelect.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {hasClosestByClassName} from "../../util/hasClosest";import {getAVData,@@ -199,7 +200,7 @@ const getItemElement = (blockElement: HTMLElement, item: Pick<IAVItemInfo, "itemconst getItemKey = (groupID: string, itemID: string) => `${groupID}:${itemID}`;const syncItemSelectionDOM = (blockElement: HTMLElement, selectedKeys: Set<string>) => {- const isTable = blockElement.dataset.avType === "table";+ const isTable = isTableLikeView(blockElement.dataset.avType);blockElement.querySelectorAll<HTMLElement>(".av__row[data-id], .av__gallery-item[data-id]").forEach(item => {if (item.closest(".av") !== blockElement) {return;diff --git a/app/src/protyle/render/av/relation.ts b/app/src/protyle/render/av/relation.tsindex f2da2b5b1b..5c559101d5 100644--- a/app/src/protyle/render/av/relation.ts+++ b/app/src/protyle/render/av/relation.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {Menu} from "../../../plugin/Menu";import {hasClosestByAttribute, hasClosestByClassName, hasTopClosestByClassName} from "../../util/hasClosest";import {UDLRHint, upDownHint} from "../../../util/upDownHint";@@ -944,7 +945,7 @@ export const setRelationCell = async (protyle: IProtyle, nodeElement: HTMLElemenif (!nodeElement.contains(cellElements[0])) {const viewType = nodeElement.getAttribute("data-av-type") as TAVView;const rowID = getFieldIdByCellElement(cellElements[0], viewType);- if (viewType === "table") {+ if (isTableLikeView(viewType)) {cellElements[0] = (nodeElement.querySelector(`.av__row[data-id="${rowID}"] .av__cell[data-col-id="${cellElements[0].dataset.colId}"]`) ||nodeElement.querySelector(`.fn__flex-1[data-col-id="${cellElements[0].dataset.colId}"]`)) as HTMLElement;} else {diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.tsindex 684fb2deaf..7afc364e8d 100644--- a/app/src/protyle/render/av/render.ts+++ b/app/src/protyle/render/av/render.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {isAVRenderData} from "./renderData";import {fetchSyncPost} from "../../../util/fetch";import {getColIconByType} from "./col";@@ -196,11 +197,12 @@ export const genTabHeaderHTML = (data: IAV, showSearch: boolean, editable: booleconst getTableHTMLs = (data: IAVTable, e: HTMLElement, virtualData: IAVVirtualData,reserveVirtualHeight = false) => {+ const viewType = e.dataset.avType === "list" ? "list" : "table";let calcHTML = "";let contentHTML = '<div class="av__row av__row--header"><div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div></div>';let freezeIndex = -1;data.columns.forEach((item, index) => {- if (!item.hidden && item.pin) {+ if (viewType === "table" && !item.hidden && item.pin) {freezeIndex = index;}});@@ -267,7 +269,7 @@ style="width: ${escapeAttr(column.width) || "200px"}">${getCalcValue(column) ||e.setAttribute(Constants.ATTRIBUTE_V_SCROLL, "true");return true;}- contentHTML += getRowHTML({data, row, rowIndex: rowIndex + (virtualData?.rowOffset || 0), pinIndex, type: "table"});+ contentHTML += getRowHTML({data, row, rowIndex: rowIndex + (virtualData?.rowOffset || 0), pinIndex, type: viewType});});let bottomSpacerHTML = "";if (reserveVirtualHeight && virtualData && virtualData.renderedEnd < data.rows.length - 1) {@@ -358,7 +360,7 @@ export const setAVGroupFolded = (foldElement: HTMLElement, folded: boolean) => {foldElement.setAttribute("aria-label", getGroupFoldTip(folded));const blockElement = foldElement.closest<HTMLElement>(".av");- if (blockElement?.dataset.avType !== "table") {+ if (!isTableLikeView(blockElement?.dataset.avType)) {return;}const groupID = bodyElement.dataset.groupId;@@ -374,7 +376,7 @@ export const setAVGroupFolded = (foldElement: HTMLElement, folded: boolean) => {};export const initUnfoldedGroupTables = (blockElement: HTMLElement, protyle: IProtyle) => {- if (blockElement.dataset.avType !== "table") {+ if (!isTableLikeView(blockElement.dataset.avType)) {return;}const data = getAVData(blockElement);@@ -1170,7 +1172,7 @@ export const refreshAV = (protyle: IProtyle, operation: IOperation) => {if (popCellElement && popCellElement.getAttribute("data-detached") === "true" &&!genCellValueByElement("block", popCellElement).block?.content &&popCellElement.getBoundingClientRect().height !== 0 && hasGhost) {- if (item.getAttribute("data-av-type") !== "table") {+ if (!isTableLikeView(item.getAttribute("data-av-type"))) {if (addingFocusTokens.get(addingFocusKey) === addingFocusToken) {addingFocusTokens.delete(addingFocusKey);popTextCell(protyle, [popCellElement], "block");diff --git a/app/src/protyle/render/av/row.ts b/app/src/protyle/render/av/row.tsindex e1c2016b82..6e354ebb17 100644--- a/app/src/protyle/render/av/row.ts+++ b/app/src/protyle/render/av/row.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {hasClosestBlock, hasClosestByClassName, hasTopClosestByAttribute} from "../../util/hasClosest";import {focusBlock} from "../../util/selection";import {Menu} from "../../../plugin/Menu";@@ -200,12 +201,14 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, options.ro}const tableRow = options.row as IAVRow;const tableData = options.data as IAVTable;+ const isList = options.type === "list";+ const pinIndex = isList ? -1 : options.pinIndex;html = `<div class="av__row" data-index="${options.rowIndex}" data-id="${tableRow.id}">`;- if (options.pinIndex > -1) {+ if (pinIndex > -1) {html += `<div class="av__colsticky av__colsticky--freeze"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg>${getFreezeDragHTML()}</div>`;} else {- html += `<div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg>${getFreezeDragHTML()}</div></div>`;+ html += `<div class="av__colsticky"><div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg>${isList ? "" : getFreezeDragHTML()}</div></div>`;}tableRow.cells.forEach((cell, index) => {@@ -218,18 +221,18 @@ ${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, options.roif (cell.valueType === "checkbox") {checkClass = cell.value?.checkbox?.checked ? " av__cell-check" : " av__cell-uncheck";}- html += `<div class="av__cell${checkClass}" data-id="${cell.id}" data-col-id="${column.id}"+ html += `<div class="av__cell${checkClass}${isList ? " ariaLabel" : ""}" data-id="${cell.id}" data-col-id="${column.id}" ${isList ? `aria-label="${escapeAriaLabel(column.name)}" data-position="north"` : ""}data-wrap="${column.wrap}"data-dtype="${column.type}"data-date-format="${column.dateFormat || ""}"${column.renderTemplate?.trim() ? 'data-render-template="true"' : ""}data-align="${column.align || ""}"${cell.value?.isDetached ? ' data-detached="true"' : ""}-style="width: ${escapeAttr(column.width) || "200px"};+style="${isList ? "" : `width: ${escapeAttr(column.width) || "200px"};`}${cell.bgColor ? `background-color:${cell.bgColor};` : ""}${cell.color ? `color:${cell.color};` : ""}">${renderCell(cell.value, options.rowIndex, tableData.showIcon, "table", column.options, column.dateFormat, column.renderTemplate)}</div>`;- if (options.pinIndex === index) {+ if (pinIndex === index) {html += "</div>";}});@@ -242,7 +245,7 @@ export const getFieldIdByCellElement = (cellElement: Element, viewType: TAVView)if (isCustomAttr(cellElement)) {return cellElement.getAttribute("data-row-id");}- return (hasClosestByClassName(cellElement, viewType === "table" ? "av__row" : "av__gallery-item") as HTMLElement).dataset.id;+ return (hasClosestByClassName(cellElement, isTableLikeView(viewType) ? "av__row" : "av__gallery-item") as HTMLElement).dataset.id;};export const selectRow = (checkElement: Element, type: "toggle" | "select" | "unselect" | "unselectAll") => {@@ -327,7 +330,7 @@ export const updateHeader = (rowElement: HTMLElement) => {export const updateAVSelectionStatus = (blockElement: HTMLElement) => {const avType = blockElement.getAttribute("data-av-type") as TAVView;let selectCount = 0;- if (avType === "table") {+ if (isTableLikeView(avType)) {blockElement.querySelectorAll(".av__body").forEach((bodyElement: HTMLElement) => {if (hasClosestByClassName(bodyElement, "av") !== blockElement) {return;@@ -386,7 +389,7 @@ export const setPage = (blockElement: Element) => {blockElement.querySelectorAll(".av__body").forEach((item: HTMLElement) => {const pageSize = item.dataset.pageSize;if (pageSize) {- const currentCount = item.querySelectorAll(avType === "table" ? ".av__row:not(.av__row--header)" : ".av__gallery-item").length;+ const currentCount = item.querySelectorAll(isTableLikeView(avType) ? ".av__row:not(.av__row--header)" : ".av__gallery-item").length;if (parseInt(pageSize) < currentCount) {item.dataset.pageSize = currentCount.toString();}@@ -417,6 +420,7 @@ export const insertAttrViewBlockAnimation = (options: {return previousElement;};options.blockElement.querySelector('[data-type="av-search"]').textContent = "";+ const isList = options.blockElement.getAttribute("data-av-type") === "list";const groupQuery = options.groupID ? `.av__body[data-group-id="${options.groupID}"] ` : "";let previousElement = options.blockElement.querySelector(groupQuery + `.av__row[data-id="${options.previousId}"]`) || options.blockElement.querySelector(groupQuery + ".av__row--header");// 有排序需要加入最后一行@@ -452,8 +456,7 @@ data-wrap="${item.dataset.wrap}"data-dtype="${item.dataset.dtype}"data-date-format="${item.dataset.dateFormat || ""}"data-align="${item.dataset.align || ""}"-style="width: ${item.style.width};"-${colType === "block" ? ' data-detached="true"' : ""}>${renderCell(genCellValue(colType, null), lineNumber,+style="${isList ? "" : `width: ${item.style.width};`}"${colType === "block" ? ' data-detached="true"' : ""}>${renderCell(genCellValue(colType, null), lineNumber,true, "table", undefined, item.dataset.dateFormat as TAVDateFormat)}</div>`;if (pinIndex === index) {cellsHTML += "</div>";diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.tsindex 9d074ca895..6eac0ffd55 100644--- a/app/src/protyle/render/av/select.ts+++ b/app/src/protyle/render/av/select.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {Menu} from "../../../plugin/Menu";import {transaction} from "../../wysiwyg/transaction";import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";@@ -100,7 +101,7 @@ export const removeCellOption = (protyle: IProtyle, cellElements: HTMLElement[],return;}if (!blockElement.contains(item)) {- if (viewType === "table") {+ if (isTableLikeView(viewType)) {item = cellElements[elementIndex] = (blockElement.querySelector(`.av__row[data-id="${rowID}"] .av__cell[data-col-id="${item.dataset.colId}"]`) ||blockElement.querySelector(`.fn__flex-1[data-col-id="${item.dataset.colId}"]`)) as HTMLElement;} else {@@ -243,7 +244,7 @@ export const setColOption = (protyle: IProtyle, data: IAV, target: HTMLElement,cellElements.forEach((cellElement: HTMLElement, index) => {const rowID = getFieldIdByCellElement(cellElement, viewType);if (!blockElement.contains(cellElement)) {- if (viewType === "table" || isCustomAttr) {+ if (isTableLikeView(viewType) || isCustomAttr) {cellElement = cellElements[index] = (blockElement.querySelector(`.av__row[data-id="${rowID}"] .av__cell[data-col-id="${cellElement.dataset.colId}"]`) ||blockElement.querySelector(`.fn__flex-1[data-col-id="${cellElement.dataset.colId}"]`)) as HTMLElement;} else {@@ -372,7 +373,7 @@ ${isMobile() ? "" : '<div class="fn__hr--small"></div>'}`,cellElements.forEach((cellElement: HTMLElement, index) => {const rowID = getFieldIdByCellElement(cellElement, viewType);if (!blockElement.contains(cellElement)) {- if (viewType === "table" || isCustomAttr) {+ if (isTableLikeView(viewType) || isCustomAttr) {cellElement = cellElements[index] = (blockElement.querySelector(`.av__row[data-id="${rowID}"] .av__cell[data-col-id="${cellElement.dataset.colId}"]`) ||blockElement.querySelector(`.fn__flex-1[data-col-id="${cellElement.dataset.colId}"]`)) as HTMLElement;} else {@@ -479,7 +480,7 @@ ${isMobile() ? "" : '<div class="fn__hr--small"></div>'}`,cellElements.forEach((cellElement: HTMLElement, cellIndex) => {const rowID = getFieldIdByCellElement(cellElement, viewType);if (!blockElement.contains(cellElement)) {- if (viewType === "table" || isCustomAttr) {+ if (isTableLikeView(viewType) || isCustomAttr) {cellElement = cellElements[cellIndex] = (blockElement.querySelector(`.av__row[data-id="${rowID}"] .av__cell[data-col-id="${cellElement.dataset.colId}"]`) ||blockElement.querySelector(`.fn__flex-1[data-col-id="${cellElement.dataset.colId}"]`)) as HTMLElement;} else {@@ -598,7 +599,7 @@ export const addColOptionOrCell = (protyle: IProtyle, data: IAV, cellElements: Hif (!nodeElement) {cellElements.forEach((item, index) => {const rowID = getFieldIdByCellElement(item, data.viewType);- if (data.viewType === "table" || isCustomAttr(item)) {+ if (isTableLikeView(data.viewType) || isCustomAttr(item)) {cellElements[index] = (blockElement.querySelector(`.av__row[data-id="${rowID}"] .av__cell[data-col-id="${item.dataset.colId}"]`) ||blockElement.querySelector(`.fn__flex-1[data-col-id="${item.dataset.colId}"]`)) as HTMLElement;} else {diff --git a/app/src/protyle/render/av/view.ts b/app/src/protyle/render/av/view.tsindex 9a7734beeb..ce3862b8c4 100644--- a/app/src/protyle/render/av/view.ts+++ b/app/src/protyle/render/av/view.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {Menu} from "../../../plugin/Menu";import {unicode2Emoji} from "../../../emoji";import {transaction} from "../../wysiwyg/transaction";@@ -483,6 +484,26 @@ export const addView = (protyle: IProtyle, blockElement: Element) => {}]);}});+ addMenu.addItem({+ icon: "iconList",+ label: window.siyuan.languages.listView,+ click() {+ addVisibleView();+ transaction(protyle, [{+ action: "addAttrViewView",+ avID,+ layout: "list",+ id,+ blockID: blockElement.getAttribute("data-node-id")+ }], [{+ action: "removeAttrViewView",+ layout: "list",+ avID,+ id,+ blockID: blockElement.getAttribute("data-node-id")+ }]);+ }+ });addMenu.addItem({icon: "iconBoard",label: window.siyuan.languages.kanban,@@ -536,6 +557,8 @@ export const getViewIcon = (type: string) => {switch (type) {case "table":return "iconTable";+ case "list":+ return "iconList";case "gallery":return "iconGallery";case "kanban":@@ -547,6 +570,8 @@ export const getViewName = (type: string) => {switch (type) {case "table":return window.siyuan.languages.table;+ case "list":+ return window.siyuan.languages.listView;case "gallery":return window.siyuan.languages.gallery;case "kanban":@@ -555,7 +580,7 @@ export const getViewName = (type: string) => {};export const getFieldsByData = (data: IAV) => {- return data.viewType === "table" ? (data.view as IAVTable).columns : (data.view as IAVGallery).fields;+ return isTableLikeView(data.viewType) ? (data.view as IAVTable).columns : (data.view as IAVGallery).fields;};export const dragoverTab = (event: DragEvent) => {diff --git a/app/src/protyle/render/av/viewType.ts b/app/src/protyle/render/av/viewType.tsnew file mode 100644index 0000000000..0471dcf7eb--- /dev/null+++ b/app/src/protyle/render/av/viewType.ts@@ -0,0 +1,2 @@+// 表格和列表共享行列数据及单元格交互,布局选项仍由各视图独立处理。+export const isTableLikeView = (type: string | undefined | null) => type === "table" || type === "list";diff --git a/app/src/protyle/render/av/virtualScroll.ts b/app/src/protyle/render/av/virtualScroll.tsindex 87b8975b98..e6276bdebf 100644--- a/app/src/protyle/render/av/virtualScroll.ts+++ b/app/src/protyle/render/av/virtualScroll.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "./viewType";import {Constants} from "../../../constants";import {getRowHTML} from "./row";import {IAVSelectedCell, reconcileAVSelectedItemIDs, restoreAVCellSelection} from "./selectionState";@@ -80,7 +81,7 @@ const rebuildTableWindow = (bodyEl: HTMLElement, state: IBodyState,`<div class="av__spacer" style="height:${renderWindow.topSpacerHeight}px"></div>` : "";for (let i = renderWindow.renderedStart; i <= renderWindow.renderedEnd; i++) {rowsHTML += getRowHTML({data: state.view, row: rows[i - state.dataOffset], rowIndex: i,- pinIndex: state.pinIndex, type: "table"});+ pinIndex: state.pinIndex, type: bodyEl.closest<HTMLElement>(".av").dataset.avType as TAVView});}bodyEl.querySelectorAll(".av__row[data-id], .av__spacer:not(.av__spacer--bottom)").forEach(row => row.remove());endMarker.insertAdjacentHTML("beforebegin", rowsHTML);@@ -181,12 +182,12 @@ const doTrim = (blockElement: HTMLElement, elementRect: DOMRect): void => {if (!state) {return;}- const dataRows = type === "table" ? (state.view as IAVTable).rows : (state.view as IAVKanban).cards;+ const dataRows = isTableLikeView(type) ? (state.view as IAVTable).rows : (state.view as IAVKanban).cards;const dataStart = state.dataOffset;const dataEnd = dataStart + dataRows.length - 1;let currentRows: NodeListOf<HTMLElement>;let bottomElement: Element;- if (type === "table") {+ if (isTableLikeView(type)) {currentRows = bodyEl.querySelectorAll(".av__row:not(.av__row--header):not(.av__row--footer):not(.av__row--util)") as NodeListOf<HTMLElement>;bottomElement = bodyEl.querySelector(".av__spacer--bottom") || bodyEl.querySelector(".av__row--util");} else {@@ -200,7 +201,7 @@ const doTrim = (blockElement: HTMLElement, elementRect: DOMRect): void => {// 全部渲染即可,避免短列因 trim 导致 spacer 抖动或全部移除后无法回填const trimRange = viewportHeight + buffer * 2;const coversAllRows = state.renderedStart <= dataStart && state.renderedEnd >= dataEnd;- const groupedTable = type === "table" && stored.data.view.groups?.length > 0;+ const groupedTable = isTableLikeView(type) && stored.data.view.groups?.length > 0;if (!groupedTable && coversAllRows && bodyEl.dataset.avLocateWindow !== "true" &&dataRows.length <= Math.ceil(trimRange / Math.max(state.rowHeight || currentRows[0].offsetHeight, 1))) {// 数据已经完整渲染时无需 trim,清理可能残留的 spacer。@@ -230,9 +231,9 @@ const doTrim = (blockElement: HTMLElement, elementRect: DOMRect): void => {// 给回填的行恢复选中态:遍历 body 内现存数据行,命中 selectedRowIds 的补回高亮类与选中图标。const restoreSelect = () => {if (state.selectedRowIds.size > 0) {- bodyEl.querySelectorAll(type === "table" ? ".av__row[data-id]" : ".av__gallery-item[data-id]").forEach((row: HTMLElement) => {+ bodyEl.querySelectorAll(isTableLikeView(type) ? ".av__row[data-id]" : ".av__gallery-item[data-id]").forEach((row: HTMLElement) => {if (state.selectedRowIds.has(row.getAttribute("data-id"))) {- row.classList.add(type === "table" ? "av__row--select" : "av__gallery-item--select");+ row.classList.add(isTableLikeView(type) ? "av__row--select" : "av__gallery-item--select");const use = row.querySelector(".av__firstcol use") as SVGUseElement;if (use) {use.setAttribute("xlink:href", "#iconCheck");@@ -240,7 +241,7 @@ const doTrim = (blockElement: HTMLElement, elementRect: DOMRect): void => {}});}- if (type === "table") {+ if (isTableLikeView(type)) {restoreAVCellSelection(blockElement);}};@@ -249,7 +250,7 @@ const doTrim = (blockElement: HTMLElement, elementRect: DOMRect): void => {const toRemoveAbove: HTMLElement[] = [];const toRemoveBelow: HTMLElement[] = [];const minRetainedRows = groupedTable ? 1 : 10;- let galleryColumn = type === "table" ? 1 : 0;+ let galleryColumn = isTableLikeView(type) ? 1 : 0;// 行高缓存,避免每帧读 offsetHeight 触发布局const rowHeight = state.rowHeight || currentRows[0].offsetHeight;state.rowHeight = rowHeight;@@ -268,7 +269,8 @@ const doTrim = (blockElement: HTMLElement, elementRect: DOMRect): void => {const bodyIntersectsViewport = bodyRect.bottom > viewportTop && bodyRect.top < viewportBottom;if (groupedTable && (spacerElement || bottomSpacerElement) && windowOutsideBuffer && bodyIntersectsViewport) {// 当前窗口完全离开缓冲区时,按视口在分组中的位置重建附近窗口。- const headerHeight = (bodyEl.querySelector(".av__row--header") as HTMLElement)?.offsetHeight || rowHeight;+ const headerHeight = type === "list" ? 0 :+ (bodyEl.querySelector(".av__row--header") as HTMLElement)?.offsetHeight || rowHeight;rebuildTableWindow(bodyEl, state, getGroupTableViewportWindow({dataStart,dataEnd,@@ -337,7 +339,7 @@ const doTrim = (blockElement: HTMLElement, elementRect: DOMRect): void => {toRemoveBelow.push(currentRows[i]);}// 表格下滚时 top 单调递增,后续行必然都在下方,可提前结束扫描- if (type === "table" && !isScrollingUp) {+ if (isTableLikeView(type) && !isScrollingUp) {break;}}@@ -375,7 +377,7 @@ const doTrim = (blockElement: HTMLElement, elementRect: DOMRect): void => {row.remove();});});- } else if (type === "table" && topElement) {+ } else if (isTableLikeView(type) && topElement) {const removeStartTop = toRemoveAbove[0].getBoundingClientRect().top;const removeEndTop = topElement.getBoundingClientRect().top;removeHeight = removeEndTop - removeStartTop;@@ -454,7 +456,7 @@ const doTrim = (blockElement: HTMLElement, elementRect: DOMRect): void => {});} else {topElement.insertAdjacentHTML("beforebegin", rowsHTML);- if (type === "table") {+ if (isTableLikeView(type)) {const firstInsertedElement = bodyEl.querySelector(`.av__row[data-index="${firstVisibleIndex}"]`) as HTMLElement;if (firstInsertedElement) {@@ -490,7 +492,7 @@ const doTrim = (blockElement: HTMLElement, elementRect: DOMRect): void => {}}} finally {- if (type === "table") {+ if (isTableLikeView(type)) {syncTableBottomSpacer(bodyEl, state, dataEnd);}bodyStates.set(bodyEl, state);@@ -594,7 +596,7 @@ export const ensureAVTableAdjacentRow = (rowElement: HTMLElement, direction: "prrow,rowIndex: targetIndex,pinIndex: state.pinIndex,- type: "table",+ type: bodyElement.closest<HTMLElement>(".av").dataset.avType as TAVView,}));if (direction === "previous") {state.renderedStart = targetIndex;@@ -839,7 +841,7 @@ export const getAVSelectedItemIDs = (blockElement: HTMLElement) => {};export const getAVSelectedTableCells = (blockElement: HTMLElement): IAVSelectedCell[] => {- if (blockElement.dataset.avType !== "table") {+ if (!isTableLikeView(blockElement.dataset.avType)) {return [];}const selectedKeys = new Set(getAVSelectedItemPoints(blockElement).map(getAVItemPointKey));@@ -921,7 +923,7 @@ export const initVirtualScroll = (options: {}): void => {setAVData(options.blockElement, options.data);const virtualized = options.blockElement.getAttribute(Constants.ATTRIBUTE_V_SCROLL) === "true";- const needsGroupedTableState = options.data.viewType === "table" && options.data.view.groups?.length > 0;+ const needsGroupedTableState = isTableLikeView(options.data.viewType) && options.data.view.groups?.length > 0;if (virtualized) {dataStore.set(options.blockElement, {protyle: options.protyle,@@ -943,7 +945,7 @@ export const initVirtualScroll = (options: {}// 从现存 DOM 初始化选中行 ID 快照,重渲后保留选中态const selectedRowCandidates = new Set<string>();- item.querySelectorAll(options.data.viewType === "table" ? ".av__row--select" : ".av__gallery-item--select").forEach((row: HTMLElement) => {+ item.querySelectorAll(isTableLikeView(options.data.viewType) ? ".av__row--select" : ".av__gallery-item--select").forEach((row: HTMLElement) => {const id = row.getAttribute("data-id");if (id) {selectedRowCandidates.add(id);@@ -962,14 +964,14 @@ export const initVirtualScroll = (options: {if (!selectedRowIds.has(row.dataset.id)) {return;}- if (options.data.viewType === "table") {+ if (isTableLikeView(options.data.viewType)) {row.classList.add("av__row--select");row.querySelector(".av__firstcol use")?.setAttribute("xlink:href", "#iconCheck");} else {row.classList.add("av__gallery-item--select");}});- if (options.data.viewType === "table") {+ if (isTableLikeView(options.data.viewType)) {const firstRow = item.querySelector(".av__row[data-id]") as HTMLElement;let lastRow = item.querySelector(".av__row--util")?.previousElementSibling as HTMLElement;while (lastRow && !lastRow.dataset.index) {diff --git a/app/src/protyle/util/clear.ts b/app/src/protyle/util/clear.tsindex 7dc0420112..6b265ed580 100644--- a/app/src/protyle/util/clear.ts+++ b/app/src/protyle/util/clear.ts@@ -1,3 +1,4 @@+import {isTableLikeView} from "../render/av/viewType";import {updateAVSelectionStatus, updateHeader} from "../render/av/row";import {resetAVRowSelect} from "../render/av/virtualScroll";import {hasClosestByClassName} from "./hasClosest";@@ -124,7 +125,7 @@ const resetAVBodySelect = (element: Element, type: "table" | "gallery" | "all")const avElements = element.classList.contains("av") ? [element] : Array.from(element.querySelectorAll(".av"));avElements.forEach((avElement: HTMLElement) => {const avType = avElement.dataset.avType;- if ((type === "table" && avType !== "table") || (type === "gallery" && avType === "table")) {+ if ((type === "table" && !isTableLikeView(avType)) || (type === "gallery" && isTableLikeView(avType))) {return;}avElement.querySelectorAll(".av__body").forEach((bodyElement: HTMLElement) => {diff --git a/app/src/protyle/util/insertHTML.ts b/app/src/protyle/util/insertHTML.tsindex c509ae574d..e838b0803a 100644--- a/app/src/protyle/util/insertHTML.ts+++ b/app/src/protyle/util/insertHTML.ts@@ -164,7 +164,7 @@ const insertAVPastePlaceholder = (bodyElement: HTMLElement, view: IAVTable, row:row,rowIndex,pinIndex: getAVPastePinIndex(bodyElement),- type: "table",+ type: bodyElement.closest<HTMLElement>(".av")?.dataset.avType === "list" ? "list" : "table",}));const rowElement = bottomElement.previousElementSibling as HTMLElement;rowElement.classList.add(PLACEHOLDER_ROW_CLASS);@@ -209,7 +209,7 @@ const syncAVPasteRowCells = (options: {row: options.row,rowIndex: options.rowIndex,pinIndex: getAVPastePinIndex(options.bodyElement),- type: "table",+ type: options.bodyElement.closest<HTMLElement>(".av")?.dataset.avType === "list" ? "list" : "table",});options.columnIDs.forEach(columnID => {const nextCell = template.content.querySelector(`.av__cell[data-col-id="${columnID}"]`) as HTMLElement;@@ -469,6 +469,8 @@ const pasteAVMatrix = async (options: {action: "addAttrViewCol",name,avID: options.blockElement.dataset.avId,+ blockID: options.blockElement.dataset.nodeId,+ viewID: options.blockElement.getAttribute(Constants.CUSTOM_SY_AV_VIEW) || "",type,format: getDefaultDateFormat(type),id,diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex dc3817fb10..fa1a1915e0 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1,4 +1,5 @@import {recordReplacementUndo} from "./replacementInput";+import {isTableLikeView} from "../render/av/viewType";import {visibleTabsSelectionHTML} from "../render/tabsVisibility";import {prepareInlineElementBoundaryMutation} from "../util/inlineElementBoundary";import {repairHiddenTabSelection} from "../util/tabsSelection";@@ -776,7 +777,7 @@ export class WYSIWYG {const selectImgElement = nodeElement.querySelector(".img--select");const selectAVElement = nodeElement.querySelector(".av__row--select, .av__cell--select") ||(getAVSelectedCells(nodeElement).length > 0 ||- (nodeElement.dataset.avType === "table" && getAVSelectedItemIDs(nodeElement).length > 0) ?+ (isTableLikeView(nodeElement.dataset.avType) && getAVSelectedItemIDs(nodeElement).length > 0) ?nodeElement : null);const selectTableElement = nodeElement.querySelector(".table__select")?.clientWidth > 0;// 表格内跨多单元格的文本选区:range.cloneContents() 会产出残缺的 td/tr 片段,需要重建合法 table@@ -1255,7 +1256,7 @@ export class WYSIWYG {const openListItemAttrByShift = shouldOpenListItemAttr(event.shiftKey, protyle.disabled,hasClosestByClassName(target, "protyle-action"));if (event.shiftKey && !openListItemAttrByShift) {- if (!isMobile() && !protyle.disabled && avElement?.dataset.avType === "table" &&+ if (!isMobile() && !protyle.disabled && isTableLikeView(avElement?.dataset.avType) &&avCellElement && avCellElement.dataset.id &&selectAVCellRange(avElement, avCellElement)) {if (nodeElement) {@@ -1820,7 +1821,7 @@ export class WYSIWYG {}// av cell selectif (!protyle.disabled && avCellElement && avCellElement.dataset.id && !isInEmbedBlock(avCellElement)) {- if (!nodeElement || nodeElement.dataset.avType !== "table") {+ if (!nodeElement || !isTableLikeView(nodeElement.dataset.avType)) {return;}if (!setAVCellAnchor(nodeElement, avCellElement)) {@@ -3073,7 +3074,7 @@ export class WYSIWYG {const selectImgElement = nodeElement.querySelector(".img--select");const selectAVElement = nodeElement.querySelector(".av__row--select, .av__cell--select") ||(getAVSelectedCells(nodeElement).length > 0 ||- (nodeElement.dataset.avType === "table" && getAVSelectedItemIDs(nodeElement).length > 0) ?+ (isTableLikeView(nodeElement.dataset.avType) && getAVSelectedItemIDs(nodeElement).length > 0) ?nodeElement : null);const selectTableElement = nodeElement.querySelector(".table__select")?.clientWidth > 0;// 表格内跨多单元格的文本选区:range.cloneContents() 会产出残缺的 td/tr 片段,需要重建合法 tablediff --git a/app/src/types/api/index.d.ts b/app/src/types/api/index.d.tsindex c0af887ad8..f0863a54e5 100644--- a/app/src/types/api/index.d.ts+++ b/app/src/types/api/index.d.ts@@ -202,7 +202,7 @@ export type AIToolEffectsInput = { "dataEgress"?: boolean | null; "externalCost"export type AIUserSkillInfo = { "description": string; "enabled": boolean; "id": string; "name": string; "shadowed": boolean; };-export type AVArchiveRenderData = { "colorOrder": Array<string> | null; "customColors": Array<AVAttributeViewCustomColor | null> | null; "defaultTemplateID": string; "id": string; "isMirror": boolean; "name": string; "newItemTemplates": Array<AVNewItemTemplate | null> | null; "usedCustomColorIndexes": Array<number> | null; "view": AVViewInstance; "viewID": string; "viewType": "table" | "gallery" | "kanban"; "views": Array<AVViewData | null> | null; };+export type AVArchiveRenderData = { "colorOrder": Array<string> | null; "customColors": Array<AVAttributeViewCustomColor | null> | null; "defaultTemplateID": string; "id": string; "isMirror": boolean; "name": string; "newItemTemplates": Array<AVNewItemTemplate | null> | null; "usedCustomColorIndexes": Array<number> | null; "view": AVViewInstance; "viewID": string; "viewType": "table" | "list" | "gallery" | "kanban"; "views": Array<AVViewData | null> | null; };export type AVAttributeViewBacklink = { "avID": string; "avName": string; "blockIDs": Array<string> | null; "boundBlockID": string; "boxID": string; "databaseBlockID": string; "databasePath": string; "icon": string; "isDetached": boolean; "itemID": string; "relations": Array<AVAttributeViewBacklinkRelation | null> | null; "title": string; "valueID": string; };@@ -228,7 +228,7 @@ export type AVAttributeViewCustomColorInput = { "dark"?: AVAttributeViewColorTheexport type AVAttributeViewData = { "cardCoverPositions"?: Record<string, Record<string, AVCardCoverPosition | null> | null>; "customColors": Array<AVAttributeViewCustomColor | null> | null; "defaultTemplateID"?: string; "id": string; "keyIDs": Array<string> | null; "keyValues": Array<AVKeyValues | null> | null; "name": string; "newItemTemplates"?: Array<AVNewItemTemplate | null>; "spec": number; "viewID": string; "views": Array<AVView | null> | null; };-export type AVAttributeViewFieldView = { "hidden": boolean; "icon": string; "id": string; "name": string; "type": "table" | "gallery" | "kanban"; };+export type AVAttributeViewFieldView = { "hidden": boolean; "icon": string; "id": string; "name": string; "type": "table" | "list" | "gallery" | "kanban"; };export type AVAttributeViewGroupItemPosition = { "groupID": string; "previousID": string; };@@ -238,7 +238,7 @@ export type AVAttributeViewRenderTarget = { "groupID"?: string; "index": number;export type AVAttributeViewSearchTarget = { "avID": string; "boundBlockID": string; "databaseBlockID": string; "groupID"?: string; "isDetached": boolean; "itemID": string; "keywords": Array<string> | null; "matchedKeyID": string; "matchedValueID": string; "notebookID": string; "title": string; "valueID": string; "viewID"?: string; };-export type AVAvSearchResult = { "avID": string; "avName": string; "blockID": string; "children"?: Array<AVAvSearchResult | null>; "hPath": string; "matched"?: boolean; "viewID": string; "viewLayout": "" | "table" | "gallery" | "kanban"; "viewName": string; };+export type AVAvSearchResult = { "avID": string; "avName": string; "blockID": string; "children"?: Array<AVAvSearchResult | null>; "hPath": string; "matched"?: boolean; "viewID": string; "viewLayout": "" | "table" | "list" | "gallery" | "kanban"; "viewName": string; };export type AVBlockAttributeViewKeys = { "avID": string; "avName": string; "blockIDs": Array<string> | null; "customColors": Array<AVAttributeViewCustomColor | null> | null; "itemPositions": Array<AVAttributeViewItemPosition | null> | null; "keyValues": Array<AVKeyValues | null> | null; };@@ -340,7 +340,7 @@ export type AVRelativeDate = { "count": number; "direction": number; "unit": numexport type AVRelativeDateInput = { "count"?: number | null; "direction"?: number | null; "unit"?: number | null; };-export type AVRenderData = { "colorOrder": Array<string> | null; "contextFilter": AVAttributeViewContextFilter | null; "contextFilterFields": Array<AVAttributeViewContextFilterField | null> | null; "customColors": Array<AVAttributeViewCustomColor | null> | null; "defaultTemplateID": string; "id": string; "isMirror": boolean; "name": string; "newItemTemplates": Array<AVNewItemTemplate | null> | null; "target"?: AVAttributeViewRenderTarget; "usedCustomColorIndexes": Array<number> | null; "view": AVViewInstance; "viewID": string; "viewType": "table" | "gallery" | "kanban"; "views": Array<AVViewData | null> | null; };+export type AVRenderData = { "colorOrder": Array<string> | null; "contextFilter": AVAttributeViewContextFilter | null; "contextFilterFields": Array<AVAttributeViewContextFilterField | null> | null; "customColors": Array<AVAttributeViewCustomColor | null> | null; "defaultTemplateID": string; "id": string; "isMirror": boolean; "name": string; "newItemTemplates": Array<AVNewItemTemplate | null> | null; "target"?: AVAttributeViewRenderTarget; "usedCustomColorIndexes": Array<number> | null; "view": AVViewInstance; "viewID": string; "viewType": "table" | "list" | "gallery" | "kanban"; "views": Array<AVViewData | null> | null; };export type AVRenderResult = (AVRenderData & { "error"?: never; }) | (AVViewNotFound & { "colorOrder"?: never; "contextFilter"?: never; "contextFilterFields"?: never; "customColors"?: never; "defaultTemplateID"?: never; "id"?: never; "isMirror"?: never; "name"?: never; "newItemTemplates"?: never; "target"?: never; "usedCustomColorIndexes"?: never; "view"?: never; "viewID"?: never; "viewType"?: never; "views"?: never; });@@ -452,9 +452,9 @@ export type AVValueUpdatedInput = { "content"?: number | null; "content2"?: numbexport type AVValuesData = { "values": Record<string, AVValue | null> | null; };-export type AVView = { "desc": string; "filters"?: Array<AVViewFilter | null>; "gallery"?: AVLayoutGallery; "group"?: AVViewGroup; "groupCalc"?: AVGroupCalc; "groupCreated": number; "groupFolded": boolean; "groupHidden": number; "groupItemIds": Array<string> | null; "groupKey"?: AVKey; "groupSort": number; "groupVal"?: AVValue; "groups"?: Array<AVView | null>; "hideAttrViewName": boolean; "icon": string; "id": string; "itemIds"?: Array<string>; "kanban"?: AVLayoutKanban; "name": string; "pageSize": number; "sorts"?: Array<AVViewSort | null>; "table"?: AVLayoutTable; "type": "table" | "gallery" | "kanban"; };+export type AVView = { "desc": string; "filters"?: Array<AVViewFilter | null>; "gallery"?: AVLayoutGallery; "group"?: AVViewGroup; "groupCalc"?: AVGroupCalc; "groupCreated": number; "groupFolded": boolean; "groupHidden": number; "groupItemIds": Array<string> | null; "groupKey"?: AVKey; "groupSort": number; "groupVal"?: AVValue; "groups"?: Array<AVView | null>; "hideAttrViewName": boolean; "icon": string; "id": string; "itemIds"?: Array<string>; "kanban"?: AVLayoutKanban; "list"?: AVLayoutTable; "name": string; "pageSize": number; "sorts"?: Array<AVViewSort | null>; "table"?: AVLayoutTable; "type": "table" | "list" | "gallery" | "kanban"; };-export type AVViewData = { "desc": string; "hideAttrViewName": boolean; "icon": string; "id": string; "name": string; "pageSize": number; "type": "table" | "gallery" | "kanban"; };+export type AVViewData = { "desc": string; "hideAttrViewName": boolean; "icon": string; "id": string; "name": string; "pageSize": number; "type": "table" | "list" | "gallery" | "kanban"; };export type AVViewFilter = { "column": string; "combination"?: "and" | "or"; "dateEndpoint"?: "start" | "end"; "filters"?: Array<AVViewFilter | null>; "operator": "" | "=" | "!=" | "\u003e" | "\u003e=" | "\u003c" | "\u003c=" | "Contains" | "Does not contains" | "Contains any item" | "Does not contain any item" | "Is empty" | "Is not empty" | "Starts with" | "Ends with" | "Is between" | "Is true" | "Is false"; "quantifier"?: string; "relativeDate"?: AVRelativeDate; "relativeDate2"?: AVRelativeDate; "value": AVValue | null; "valueSource"?: "stored" | "rendered"; };diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex dfd103173e..ad3b04acb5 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -25,7 +25,7 @@ type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |"kernel-plugin-state-change" |"before-show-tooltip" | "before-hide-tooltip" |"common-menu-open" | "common-menu-closed"-type TAVView = "table" | "gallery" | "kanban"+type TAVView = "table" | "list" | "gallery" | "kanban";type TAVAlign = "" | "left" | "center" | "right"type TAVDateFormat = "" | "full" | "month-day-year" | "day-month-year" | "year-month-day"type TAVCol =@@ -1221,6 +1221,7 @@ interface IAVFieldView {hidden: boolean;}+// 表格和列表视图共用行列结构,布局由 viewType 区分。interface IAVTable extends IAVView {columns: IAVColumn[],rows: IAVRow[],diff --git a/app/tests/api-contract.types.ts b/app/tests/api-contract.types.tsindex bdf293c05f..f317e7703f 100644--- a/app/tests/api-contract.types.ts+++ b/app/tests/api-contract.types.ts@@ -472,6 +472,12 @@ fetchPost("/api/av/setAttributeViewBlockAttr", {avID: "av", keyID: "key", itemIDfetchPost("/api/av/setAttrViewGroup", {avID: "av", blockID: "block", group: {field: "key", method: 0}});fetchPost("/api/av/batchSetAttributeViewBlockAttrs", {avID: "av", values: [{keyID: "key", itemID: "item", value: {checkbox: {checked: false}}}]});fetchPost("/api/av/getAttributeViewPrimaryKeyValues", {id: "av", page: 2.5, pageSize: -1, blockIDs: ["block"]});+fetchPost("/api/av/changeAttrViewLayout", {avID: "av", blockID: "block", layoutType: "list"}, response => {+ if (response.code === 0 && "viewType" in response.data && response.data.viewType === "list" && "columns" in response.data.view) {+ const columns = response.data.view.columns;+ void columns;+ }+});// @ts-expect-error 单元格文本内容不能是数字。fetchPost("/api/av/setAttributeViewBlockAttr", {avID: "av", keyID: "key", value: {text: {content: 1}}});// @ts-expect-error 批量修改必须包含字段 ID。diff --git a/docs/API-CONTRACTS.md b/docs/API-CONTRACTS.mdindex c736d143a3..b5b0041c22 100644--- a/docs/API-CONTRACTS.md+++ b/docs/API-CONTRACTS.md@@ -56,7 +56,7 @@ Plugin private services declare their existing serialization modes, raw files, rNetwork contracts retain request bytes, multipart fields, headers, URL and TLS diagnostics, including complete certificate public-key structures and large integers. Forward proxy options preserve validation order, numeric truncation, response encodings, and protocol-defined JSON payloads. HTTP, EventSource, and WebSocket proxies retain upstream statuses and bytes, repeated-header behavior, security headers, stream cancellation, and connection cleanup. Echo wildcard paths bind their own adapter while sharing the same handler behavior.-Attribute-view contracts declare table, gallery, and kanban results separately and retain missing base fields, cell patches, and null values. Known patch fields retain their supplied presence without populating omitted fields with zero values. Current, history, and snapshot rendering use their corresponding request types; callers handle error payloads before updating views. Row sorting, publish admission, encrypted-notebook leases, and fast JSON rendering preserve their existing behavior. Shared frontend and plugin declarations reflect the fields actually present in each view and cell.+Attribute-view contracts declare table, gallery, and kanban result shapes and retain missing base fields, cell patches, and null values. The independent `list` layout uses the table-shaped `columns`/`rows`/`rowCount` payload and stores its layout settings under `list`; `viewType` identifies it as `list`. Known patch fields retain their supplied presence without populating omitted fields with zero values. Current, history, and snapshot rendering use their corresponding request types; callers handle error payloads before updating views. Row sorting, publish admission, encrypted-notebook leases, and fast JSON rendering preserve their existing behavior. Shared frontend and plugin declarations reflect the fields actually present in each view and cell. `TestAVContractListLayout` covers layout switching, default field visibility, subsequent rendering, and stored-layout mapping; run `go test -tags "fts5 sqlcipher" ./api -run 'TestAVContract' -count=1` and `go test ./apicontract/...`. These tests are included in the full kernel CI suite.Publish readers of attribute-view rendering endpoints use a non-persistent rendering path. Requests retain their existing schemas, carrier authorization, content filtering, and notebook leases; even `createIfNotExist: true` cannot create a missing database for a reader. Compatibility normalization, group generation, and missing-field corrections remain in memory. `TestAVContractPublishRenderDoesNotWrite` covers explicit view switching, unchanged database and carrier files, denied access, and missing databases. It runs in the full kernel CI suite; run the focused checks with `go test -tags "fts5 sqlcipher" ./api -run 'TestAVContract(PublishRenderDoesNotWrite|RenderWire)$' -count=1` and `go test ./apicontract/...`. Frontend session-state and DOM regressions run through `node --import tsx --test src/protyle/render/av/publishState.test.ts tests/publishReadonlyFold.test.js` and the full frontend CI suite.diff --git a/docs/API-CONTRACTS.zh-CN.md b/docs/API-CONTRACTS.zh-CN.mdindex 88576c9afa..e858c93097 100644--- a/docs/API-CONTRACTS.zh-CN.md+++ b/docs/API-CONTRACTS.zh-CN.md@@ -52,7 +52,7 @@网络契约保留请求字节、表单字段、请求头、URL 和 TLS 诊断信息,包括完整证书公钥结构与大整数。转发代理选项保留校验顺序、数字截断、响应编码及协议定义的 JSON 载荷。HTTP、EventSource 和 WebSocket 代理保留上游状态与字节、重复请求头行为、安全响应头、流取消和连接清理。回显通配路径绑定独立适配器,并共用相同业务处理。-数据库契约分别声明表格、画廊和看板结果,保留基础字段缺失、单元格局部修改及 null 值。已知修改字段保留传入状态,不以零值填充未提供的字段。当前、历史和快照渲染使用对应请求类型,调用端先处理错误载荷再更新视图。行排序、发布准入、加密笔记本租约和快速 JSON 渲染保留既有行为。前端和插件的共享声明按视图及单元格实际提供的字段同步。+数据库契约分别声明表格、画廊和看板的结果结构,保留基础字段缺失、单元格局部修改及 null 值。独立的 `list` 布局复用表格的 `columns`/`rows`/`rowCount` 载荷,布局配置保存在 `list` 下,`viewType` 标识为 `list`。已知修改字段保留传入状态,不以零值填充未提供的字段。当前、历史和快照渲染使用对应请求类型,调用端先处理错误载荷再更新视图。行排序、发布准入、加密笔记本租约和快速 JSON 渲染保留既有行为。前端和插件的共享声明按视图及单元格实际提供的字段同步。`TestAVContractListLayout` 覆盖布局切换、默认字段显隐、后续渲染和持久化布局映射;运行 `go test -tags "fts5 sqlcipher" ./api -run 'TestAVContract' -count=1` 和 `go test ./apicontract/...`。这些测试已包含在内核完整 CI 测试中。AI 契约保留供应商配置、模型发现与匹配、确认结果、会话扩展字段,以及数值和省略语义。编辑器和智能体流声明实际 SSE 事件,断开连接时关闭上游请求,流生命周期仍位于请求内部。OAuth 页面保留媒体类型、HTTP 状态和安全响应头。会话权限通知使用 `WithAfterWrite`,保留先响应再广播的顺序。任意 JSON 仅用于协议扩展字段和工具结果。diff --git a/docs/API.md b/docs/API.mdindex bebc8bddc1..4702a447c0 100644--- a/docs/API.md+++ b/docs/API.md@@ -1910,7 +1910,7 @@ Note: To ensure data security, access to this interface is prohibited in Publish## Database-A database (internally an "attribute view") stores structured data as fields (columns) and items (rows). Each database is identified by an `avID` and can be embedded into a document through one or more database blocks (`blockID`). A single database may contain multiple views (`viewID`) of different layout types: `table`, `gallery`, and `kanban`.+A database (internally an "attribute view") stores structured data as fields (columns) and items (rows). Each database is identified by an `avID` and can be embedded into a document through one or more database blocks (`blockID`). A single database may contain multiple views (`viewID`) of different layout types: `table`, `list`, `gallery`, and `kanban`.The field types (`keyType`) are:@@ -2054,7 +2054,7 @@ The field types (`keyType`) are:}```- * `data.view`: The rendered view instance. Its shape depends on `viewType`: `table` returns `columns`/`rows`/`rowCount`, while `gallery` and `kanban` return `fields`/`cards`/`cardCount`. When grouping is enabled, `groups` contains a view instance for each group, including `groupKey`/`groupValue`. `view` also includes `filters`, `sorts`, `group`, `showIcon`, `wrapField`, `groupFolded`, and `groupHidden`. Note: active filters or grouping can make the item list empty even when the total item count is greater than 0+ * `data.view`: The rendered view instance. Its shape depends on `viewType`: `table` and `list` return `columns`/`rows`/`rowCount`, while `gallery` and `kanban` return `fields`/`cards`/`cardCount`. When grouping is enabled, `groups` contains a view instance for each group, including `groupKey`/`groupValue`. `view` also includes `filters`, `sorts`, `group`, `showIcon`, `wrapField`, `groupFolded`, and `groupHidden`. Note: active filters or grouping can make the item list empty even when the total item count is greater than 0* `data.view.columns[]`: Each has `id`, `name`, `type`, `icon`, `wrap`, `hidden`, `desc`, `calc`, `numberFormat`, `template`, `renderTemplate`, `pin`, `width`; `select`/`mSelect` columns additionally include `options`. Gallery and kanban fields expose the same field metadata under `data.view.fields[]`* `data.view.columns[].renderTemplate`: Optional display template for a normal field. It changes only the displayed content; the field's stored typed value remains unchanged* `data.view.rows[].id`: The table row's **item ID** (`itemID`). It also equals `value.blockID` in that row's primary-key cell. For a bound row, the bound block ID is stored in `value.block.id` in the primary-key cell; these are distinct concepts and must not be assumed equal@@ -2216,7 +2216,7 @@ The field types (`keyType`) are:}```- * `data.av`: The full `AttributeView` definition — fields (`keyValues`), field ordering (`keyIDs`, may be `null`), and all views with their raw layout config (`table`/`gallery`/`kanban`) and item ordering (`itemIds`). The compatibility `viewID` is computed as the first available view and is not persisted. Returns no rendered rows or pagination; therefore, use [Render](#Render) for computed rows+ * `data.av`: The full `AttributeView` definition — fields (`keyValues`), field ordering (`keyIDs`, may be `null`), and all views with their raw layout config (`table`/`list`/`gallery`/`kanban`) and item ordering (`itemIds`). The compatibility `viewID` is computed as the first available view and is not persisted. Returns no rendered rows or pagination; therefore, use [Render](#Render) for computed rows### Get primary key values@@ -2352,7 +2352,7 @@ Updates a single cell (one field of one row). This is the primary write endpoint| `mAsset` | `{"mAsset": [{"type": "image", "name": "", "content": "https://example.com/image"}]}` || `checkbox` | `{"checkbox": {"checked": true}}` |-> ⚠️ `itemID` is the **item ID**, which is the rendered item's `id` from [Render](#Render): `rows[].id` for a table and `cards[].id` for a gallery or kanban, inside the corresponding view instance under `groups[]` when grouping is enabled. It also equals the primary-key value's `value.blockID`. For a bound item, the bound block ID is stored in the primary-key value's `value.block.id`; these are distinct concepts and must not be assumed equal. Passing the wrong ID stores the value as an orphan that does not appear in the rendered cell.+> ⚠️ `itemID` is the **item ID**, which is the rendered item's `id` from [Render](#Render): `rows[].id` for a table or list and `cards[].id` for a gallery or kanban, inside the corresponding view instance under `groups[]` when grouping is enabled. It also equals the primary-key value's `value.blockID`. For a bound item, the bound block ID is stored in the primary-key value's `value.block.id`; these are distinct concepts and must not be assumed equal. Passing the wrong ID stores the value as an orphan that does not appear in the rendered cell.For `mAsset`, each item uses `type: "image"` to render an image or `type: "file"` to render a file link. Updating the value replaces the entire `mAsset` array, so append operations must include the existing items.@@ -2435,7 +2435,7 @@ Adds one or more items (rows). Each source can either bind an existing block (`i* `avID`: Database ID* `blockID`: The database block that owns this database (resolves target view/group)* `viewID`: Explicit target view. When omitted, the view selected by `blockID` is used, then the first available view- * `groupID`: Target group ID for kanban views. Omit for table/gallery+ * `groupID`: Target group ID for kanban views. Omit for table/list/gallery* `previousID`: Insert after this item ID. Empty means append to the end* `srcs[].id`: For bound blocks (`isDetached: false`), the block ID to bind. Must match the node ID pattern* `srcs[].isDetached`: `true` to create a detached row; `false` to bind an existing block@@ -2482,7 +2482,9 @@ Removes one or more items (rows). Detached rows are deleted; bound blocks are un### Change layout-Switches the layout type of the view selected by the database block between `table`, `gallery`, and `kanban`. On success the server re-renders the view and returns it (same shape as [Render](#Render)).+Switches the layout type of the view selected by the database block between `table`, `list`, `gallery`, and `kanban`. On success the server re-renders the view and returns it (same shape as [Render](#Render)).++The first switch to `list` initializes an independent layout with only the primary-key field visible. Subsequent switches back to this layout preserve its field visibility and ordering. Hidden fields retain their values and remain available for filtering and sorting; other layouts keep their own display settings.* `/api/av/changeAttrViewLayout`* Parameters@@ -2497,7 +2499,7 @@ Switches the layout type of the view selected by the database block between `tab* `avID`: Database ID* `blockID`: The database block that owns the view- * `layoutType`: Target layout — one of `table`, `gallery`, `kanban`+ * `layoutType`: Target layout — one of `table`, `list`, `gallery`, `kanban`* Return value: same shape as [Render](#Render). When switching to `kanban` and a group is configured, `data.view` contains a `groups[]` array; each group is a view instance with `groupKey`, `groupValue`, plus kanban-specific fields (`coverFrom`, `cardAspectRatio`, `cardSize`, `fitImage`, `displayFieldName`, `fillColBackgroundColor`, `fields`)### Set grouping@@ -2694,7 +2696,7 @@ Returns the current filter and sort rules of the view bound to a database block.### Add a field-Adds a new field (column). The field is appended to every view (table/gallery/kanban) at the position after `previousKeyID` (or at the default position when empty).+Adds a new field (column). The field is appended to every view (table/list/gallery/kanban) at the position after `previousKeyID` (or at the default position when empty).* `/api/av/addAttributeViewKey`* Parameters@@ -2715,7 +2717,7 @@ Adds a new field (column). The field is appended to every view (table/gallery/ka* `keyName`: Field display name* `keyType`: Field type — one of `text`, `number`, `date`, `select`, `mSelect`, `url`, `email`, `phone`, `mAsset`, `template`, `created`, `updated`, `checkbox`, `relation`, `rollup`, `lineNumber`. `block` (primary key) cannot be added through this endpoint* `keyIcon`: Optional field icon (emoji or empty string)- * `previousKeyID`: Insert the new column after this field ID. Empty string uses the layout default (first column for table, last for gallery/kanban)+ * `previousKeyID`: Insert the new column after this field ID. Empty string uses the layout default (first column for table, last for list/gallery/kanban)* Return value```jsondiff --git a/docs/API.zh-CN.md b/docs/API.zh-CN.mdindex dd096aa8bc..e454e174da 100644--- a/docs/API.zh-CN.md+++ b/docs/API.zh-CN.md@@ -1906,7 +1906,7 @@ if (response.code === 0 && response.data) {## 数据库-数据库(内核中为“属性视图”)以字段(列)和条目(行)的形式存储结构化数据。每个数据库由 `avID` 标识,可通过一个或多个数据库块(`blockID`)嵌入到文档中。一个数据库可包含多个不同布局类型的视图(`viewID`):`table`(表格)、`gallery`(卡片)和 `kanban`(看板)。+数据库(内核中为“属性视图”)以字段(列)和条目(行)的形式存储结构化数据。每个数据库由 `avID` 标识,可通过一个或多个数据库块(`blockID`)嵌入到文档中。一个数据库可包含多个不同布局类型的视图(`viewID`):`table`(表格)、`list`(列表)、`gallery`(卡片)和 `kanban`(看板)。字段类型(`keyType`)如下:@@ -2050,7 +2050,7 @@ if (response.code === 0 && response.data) {}```- * `data.view`: 渲染后的视图实例。结构随 `viewType` 而变:`table` 返回 `columns`/`rows`/`rowCount`,`gallery` 和 `kanban` 返回 `fields`/`cards`/`cardCount`。启用分组时,`groups` 包含各分组的视图实例,每个实例含 `groupKey`/`groupValue`。`view` 还包含 `filters`/`sorts`/`group`/`showIcon`/`wrapField`/`groupFolded`/`groupHidden`。注意:启用的过滤或分组可能使条目列表为空,即使条目总数大于 0+ * `data.view`: 渲染后的视图实例。结构随 `viewType` 而变:`table` 和 `list` 返回 `columns`/`rows`/`rowCount`,`gallery` 和 `kanban` 返回 `fields`/`cards`/`cardCount`。启用分组时,`groups` 包含各分组的视图实例,每个实例含 `groupKey`/`groupValue`。`view` 还包含 `filters`/`sorts`/`group`/`showIcon`/`wrapField`/`groupFolded`/`groupHidden`。注意:启用的过滤或分组可能使条目列表为空,即使条目总数大于 0* `data.view.columns[]`: 每列含 `id`/`name`/`type`/`icon`/`wrap`/`hidden`/`desc`/`calc`/`numberFormat`/`template`/`renderTemplate`/`pin`/`width`;`select`/`mSelect` 列还额外包含 `options`。画廊和看板字段在 `data.view.fields[]` 中返回相同的字段元数据* `data.view.columns[].renderTemplate`: 普通字段可选的显示模板,仅改变显示内容,字段原有类型的存储值保持不变* `data.view.rows[].id`: 表格行的**条目 ID**(`itemID`),也等于该行主键单元格的 `value.blockID`。对于绑定行,绑定块 ID 位于主键单元格的 `value.block.id`;二者是不同概念,不能假设相等@@ -2212,7 +2212,7 @@ if (response.code === 0 && response.data) {}```- * `data.av`: 完整的 `AttributeView` 定义——字段(`keyValues`)、字段顺序(`keyIDs`,可能为 `null`),以及所有视图的原始布局配置(`table`/`gallery`/`kanban`)和条目顺序(`itemIds`)。兼容字段 `viewID` 动态取第一个可用视图,不会持久化。返回值不含渲染后的行或分页;需要计算后的行数据请使用 [渲染](#渲染)+ * `data.av`: 完整的 `AttributeView` 定义——字段(`keyValues`)、字段顺序(`keyIDs`,可能为 `null`),以及所有视图的原始布局配置(`table`/`list`/`gallery`/`kanban`)和条目顺序(`itemIds`)。兼容字段 `viewID` 动态取第一个可用视图,不会持久化。返回值不含渲染后的行或分页;需要计算后的行数据请使用 [渲染](#渲染)### 获取主键值@@ -2347,7 +2347,7 @@ if (response.code === 0 && response.data) {| `phone` | `{"phone": {"content": "1234567890"}}` || `checkbox` | `{"checkbox": {"checked": true}}` |-> ⚠️ `itemID` 是**条目 ID**,即[渲染](#渲染)返回的条目 `id`:表格为 `rows[].id`,卡片和看板为 `cards[].id`,启用分组时位于 `groups[]` 的对应视图实例中。它也等于主键值的 `value.blockID`。对于绑定条目,绑定块 ID 位于主键值的 `value.block.id`;二者是不同概念,不能假设相等。传入错误的 ID 会把值存为孤儿数据,不会出现在渲染后的单元格中。+> ⚠️ `itemID` 是**条目 ID**,即[渲染](#渲染)返回的条目 `id`:表格和列表为 `rows[].id`,卡片和看板为 `cards[].id`,启用分组时位于 `groups[]` 的对应视图实例中。它也等于主键值的 `value.blockID`。对于绑定条目,绑定块 ID 位于主键值的 `value.block.id`;二者是不同概念,不能假设相等。传入错误的 ID 会把值存为孤儿数据,不会出现在渲染后的单元格中。对于富文本,`text.rich.content` 是权威的 Kramdown 源。内核会校验其受支持的结构并派生 `text.content` 纯文本投影;调用方提供的纯文本投影会被忽略。为兼容现有 API 客户端,省略 `text.rich` 时,如果 `text.content` 未改变则保留已存储的富文本载荷,如果 `text.content` 改变则以纯文本替换。即使纯文本投影未改变,也可以发送 `"rich": null` 明确移除富文本格式。包含富文本的数据库使用存储规范 9,无法由仅支持更早数据库规范的内核打开。@@ -2475,7 +2475,9 @@ if (response.code === 0 && response.data) {### 切换布局-在 `table`(表格)、`gallery`(卡片)和 `kanban`(看板)之间切换数据库块所选视图的布局类型。成功时服务端会重新渲染并返回视图(结构与 [渲染](#渲染) 相同)。+在 `table`(表格)、`list`(列表)、`gallery`(卡片)和 `kanban`(看板)之间切换数据库块所选视图的布局类型。成功时服务端会重新渲染并返回视图(结构与 [渲染](#渲染) 相同)。++首次切换到 `list` 时,会初始化独立布局,默认仅显示主键字段。之后切换回该布局会保留字段显隐和顺序。隐藏字段的值保持不变,仍可用于过滤和排序;其他布局保留各自的显示设置。* `/api/av/changeAttrViewLayout`* 参数@@ -2490,7 +2492,7 @@ if (response.code === 0 && response.data) {* `avID`: 数据库 ID* `blockID`: 拥有该视图的数据库块- * `layoutType`: 目标布局——`table`、`gallery`、`kanban` 之一+ * `layoutType`: 目标布局——`table`、`list`、`gallery`、`kanban` 之一* 返回值:与 [渲染](#渲染) 返回结构相同。当切换到 `kanban` 且已配置分组时,`data.view` 包含 `groups[]` 数组;每个分组是视图实例,含 `groupKey`、`groupValue`,以及看板特有字段(`coverFrom`、`cardAspectRatio`、`cardSize`、`fitImage`、`displayFieldName`、`fillColBackgroundColor`、`fields`)### 设置分组@@ -2685,7 +2687,7 @@ if (response.code === 0 && response.data) {### 添加字段-添加新字段(列)。该字段会被添加到每个视图(表格/卡片/看板)中 `previousKeyID` 之后的位置(为空时使用默认位置)。+添加新字段(列)。该字段会被添加到每个视图(表格/列表/卡片/看板)中 `previousKeyID` 之后的位置(为空时使用默认位置)。* `/api/av/addAttributeViewKey`* 参数@@ -2706,7 +2708,7 @@ if (response.code === 0 && response.data) {* `keyName`: 字段显示名* `keyType`: 字段类型——`text`、`number`、`date`、`select`、`mSelect`、`url`、`email`、`phone`、`mAsset`、`template`、`created`、`updated`、`checkbox`、`relation`、`rollup`、`lineNumber` 之一。`block`(主键)不能通过该接口添加* `keyIcon`: 可选字段图标(emoji 或空字符串)- * `previousKeyID`: 在此字段 ID 之后插入新列。为空字符串时使用布局默认位置(表格插入到首位,卡片/看板插入到末尾)+ * `previousKeyID`: 在此字段 ID 之后插入新列。为空字符串时使用布局默认位置(表格插入到首位,列表/卡片/看板插入到末尾)* 返回值```jsondiff --git a/kernel/api/av_contract_mapping.go b/kernel/api/av_contract_mapping.goindex ab59356add..55683299ec 100644--- a/kernel/api/av_contract_mapping.go+++ b/kernel/api/av_contract_mapping.go@@ -30,6 +30,8 @@ func avContractView(value av.Viewable) apicontract.AVViewInstance {switch view := value.(type) {case *av.Table:return apicontract.NewAVTableInstance(toContractAVTable(view))+ case *av.List:+ return apicontract.NewAVTableInstance(toContractAVTable(view.Table))case *av.Gallery:return apicontract.NewAVGalleryInstance(toContractAVGallery(view))case *av.Kanban:@@ -1025,6 +1027,7 @@ func toContractAVView(value *av.View) *apicontract.AVView {PageSize: value.PageSize,LayoutType: string(value.LayoutType),Table: toContractAVLayoutTable(value.Table),+ List: toContractAVLayoutTable(value.List),Gallery: toContractAVLayoutGallery(value.Gallery),Kanban: toContractAVLayoutKanban(value.Kanban),ItemIDs: value.ItemIDs,diff --git a/kernel/api/contract_av_test.go b/kernel/api/contract_av_test.goindex 8ab9e19c23..36980c0145 100644--- a/kernel/api/contract_av_test.go+++ b/kernel/api/contract_av_test.go@@ -83,6 +83,7 @@ func TestAVContractTransportMapping(t *testing.T) {&av.Gallery{BaseInstance: base},&av.Kanban{BaseInstance: base},&av.Table{},+ &av.List{Table: &av.Table{BaseInstance: base, Columns: []*av.TableColumn{{BaseInstanceField: &av.BaseInstanceField{ID: "key", Type: av.KeyTypeText, Hidden: true}}}}},} {assertAVContractJSONEqual(t, view, avContractView(view))}@@ -92,6 +93,49 @@ func TestAVContractTransportMapping(t *testing.T) {assertAVContractJSONEqual(t, model.NewAttributeViewData(fixture.attrView), toContractAVAttributeViewData(model.NewAttributeViewData(fixture.attrView)))}+func TestAVContractListLayout(t *testing.T) {+ fixture := setupAttributeViewContextFilterAPITest(t)+ util.AttrViewLangs["en"]["list"] = "List"+ path := "/api/av/changeAttrViewLayout"+ response := callAttributeViewContextFilterAPI(t, path, map[string]any{+ "avID": fixture.attrView.ID, "blockID": fixture.databaseID, "layoutType": "list",+ }, changeAttrViewLayout)+ requireAPIContract(t, http.MethodPost, path, response)+ var result struct {+ Code int `json:"code"`+ Data struct {+ ViewType string `json:"viewType"`+ View *av.Table `json:"view"`+ } `json:"data"`+ }+ decodeAttributeViewContextFilterAPIResponse(t, response, &result)+ if result.Code != 0 || result.Data.ViewType != "list" || result.Data.View == nil {+ t.Fatalf("list layout response: %s", response.Body.String())+ }+ if len(result.Data.View.Columns) != len(fixture.attrView.KeyValues) {+ t.Fatalf("list fields missing: %s", response.Body.String())+ }+ for _, field := range result.Data.View.Columns {+ if field.Hidden != (field.Type != av.KeyTypeBlock) {+ t.Fatalf("unexpected list field visibility: %+v", field)+ }+ }+ path = "/api/av/renderAttributeView"+ response = callAttributeViewContextFilterAPI(t, path, map[string]any{+ "id": fixture.attrView.ID, "blockID": fixture.databaseID, "ignoreRows": true,+ }, renderAttributeView)+ requireAPIContract(t, http.MethodPost, path, response)+ decodeAttributeViewContextFilterAPIResponse(t, response, &result)+ if result.Code != 0 || result.Data.ViewType != "list" {+ t.Fatalf("list render response: %s", response.Body.String())+ }+ stored, err := av.ParseAttributeView(fixture.attrView.ID)+ if err != nil {+ t.Fatal(err)+ }+ assertAVContractJSONEqual(t, model.NewAttributeViewData(stored), toContractAVAttributeViewData(model.NewAttributeViewData(stored)))+}+func TestAVContractRenderWire(t *testing.T) {fixture := setupAttributeViewContextFilterAPITest(t)bundle, err := apicontract.BuildBundle()diff --git a/kernel/apicontract/av_response.go b/kernel/apicontract/av_response.goindex 878f50ff74..82056f60d8 100644--- a/kernel/apicontract/av_response.go+++ b/kernel/apicontract/av_response.go@@ -61,7 +61,7 @@ type AVArchiveRenderData struct {CustomColors []*AVAttributeViewCustomColor `json:"customColors"`ColorOrder []string `json:"colorOrder"`UsedCustomColorIndexes []int `json:"usedCustomColorIndexes"`- ViewType string `json:"viewType" api:"enum=table|gallery|kanban"`+ ViewType string `json:"viewType" api:"enum=table|list|gallery|kanban"`ViewID string `json:"viewID"`Views []*AVViewData `json:"views"`View AVViewInstance `json:"view"`diff --git a/kernel/apicontract/av_types.go b/kernel/apicontract/av_types.goindex 13e8c5cf24..4125157ad7 100644--- a/kernel/apicontract/av_types.go+++ b/kernel/apicontract/av_types.go@@ -397,7 +397,7 @@ type AVViewData struct {Name string `json:"name" api:"optional,nullable"`Desc string `json:"desc" api:"optional,nullable"`HideAttrViewName bool `json:"hideAttrViewName" api:"optional,nullable"`- Type string `json:"type" api:"optional,nullable,enum=table|gallery|kanban"`+ Type string `json:"type" api:"optional,nullable,enum=table|list|gallery|kanban"`PageSize int `json:"pageSize" api:"optional,nullable"`}@@ -464,8 +464,9 @@ type AVView struct {Filters []*AVViewFilter `json:"filters,omitempty" api:"optional,nullable"`Sorts []*AVViewSort `json:"sorts,omitempty" api:"optional,nullable"`PageSize int `json:"pageSize" api:"optional,nullable"`- LayoutType string `json:"type" api:"optional,nullable,enum=table|gallery|kanban"`+ LayoutType string `json:"type" api:"optional,nullable,enum=table|list|gallery|kanban"`Table *AVLayoutTable `json:"table,omitempty" api:"optional,nullable"`+ List *AVLayoutTable `json:"list,omitempty" api:"optional,nullable"`Gallery *AVLayoutGallery `json:"gallery,omitempty" api:"optional,nullable"`Kanban *AVLayoutKanban `json:"kanban,omitempty" api:"optional,nullable"`ItemIDs []string `json:"itemIds,omitempty" api:"optional,nullable"`@@ -559,7 +560,7 @@ type AVAttributeViewFieldView struct {ID string `json:"id" api:"optional,nullable"`Icon string `json:"icon" api:"optional,nullable"`Name string `json:"name" api:"optional,nullable"`- Type string `json:"type" api:"optional,nullable,enum=table|gallery|kanban"`+ Type string `json:"type" api:"optional,nullable,enum=table|list|gallery|kanban"`Hidden bool `json:"hidden" api:"optional,nullable"`}@@ -568,7 +569,7 @@ type AVAvSearchResult struct {AvName string `json:"avName" api:"optional,nullable"`ViewName string `json:"viewName" api:"optional,nullable"`ViewID string `json:"viewID" api:"optional,nullable"`- ViewLayout string `json:"viewLayout" api:"optional,nullable,enum=|table|gallery|kanban"`+ ViewLayout string `json:"viewLayout" api:"optional,nullable,enum=|table|list|gallery|kanban"`BlockID string `json:"blockID" api:"optional,nullable"`HPath string `json:"hPath" api:"optional,nullable"`Matched bool `json:"matched,omitempty" api:"optional,nullable"`diff --git a/kernel/apicontract/av_union.go b/kernel/apicontract/av_union.goindex d6e12858ce..b2b3cae64c 100644--- a/kernel/apicontract/av_union.go+++ b/kernel/apicontract/av_union.go@@ -6,7 +6,7 @@ import ("reflect")-// AVViewInstance 表示表格、画廊或看板及其递归分组实例。+// AVViewInstance 表示表格、列表、画廊或看板及其递归分组实例,列表复用表格的行列结构。type AVViewInstance struct {table *AVTablegallery *AVGallerydiff --git a/kernel/apicontract/schema.json b/kernel/apicontract/schema.jsonindex 74b514a64c..779fa1b212 100644--- a/kernel/apicontract/schema.json+++ b/kernel/apicontract/schema.json@@ -5618,6 +5618,7 @@"type": "string","enum": ["table",+ "list","gallery","kanban"]@@ -6158,6 +6159,7 @@"type": "string","enum": ["table",+ "list","gallery","kanban"]@@ -6369,6 +6371,7 @@"enum": ["","table",+ "list","gallery","kanban"]@@ -9506,6 +9509,7 @@"type": "string","enum": ["table",+ "list","gallery","kanban"]@@ -12160,6 +12164,9 @@"kanban": {"$ref": "#/$defs/AVLayoutKanban"},+ "list": {+ "$ref": "#/$defs/AVLayoutTable"+ },"name": {"type": "string"},@@ -12186,6 +12193,7 @@"type": "string","enum": ["table",+ "list","gallery","kanban"]@@ -12232,6 +12240,7 @@"type": "string","enum": ["table",+ "list","gallery","kanban"]diff --git a/kernel/av/av.go b/kernel/av/av.goindex 67ac060e25..e4c47ccbbd 100644--- a/kernel/av/av.go+++ b/kernel/av/av.go@@ -313,6 +313,7 @@ type View struct {PageSize int `json:"pageSize"` // 每页条目数LayoutType LayoutType `json:"type"` // 当前布局类型Table *LayoutTable `json:"table,omitempty"` // 表格布局+ List *LayoutList `json:"list,omitempty"` // 列表布局Gallery *LayoutGallery `json:"gallery,omitempty"` // 卡片布局Kanban *LayoutKanban `json:"kanban,omitempty"` // 看板布局ItemIDs []string `json:"itemIds,omitempty"` // 项目 ID 列表,用于维护所有项目@@ -417,6 +418,7 @@ type LayoutType stringconst (LayoutTypeTable LayoutType = "table" // 属性视图类型 - 表格+ LayoutTypeList LayoutType = "list" // 属性视图类型 - 列表LayoutTypeGallery LayoutType = "gallery" // 属性视图类型 - 卡片LayoutTypeKanban LayoutType = "kanban" // 属性视图类型 - 看板)@@ -934,6 +936,9 @@ func ParseAttributeViewData(avID string, data []byte) (ret *AttributeView, err eif nil == err {err = CheckSpec(ret)}+ if nil == err {+ err = ret.ValidateListLayouts()+ }if nil == err {err = ret.NormalizeRichText()}@@ -964,6 +969,9 @@ func saveAttributeView(av *AttributeView, original []byte) (err error) {}}()+ if err = av.ValidateListLayouts(); nil != err {+ return+ }if err = av.NormalizeRichText(); nil != err {logging.LogErrorf("normalize attribute view [%s] rich text failed: %s", av.ID, err)return@@ -1330,18 +1338,22 @@ func (av *AttributeView) Clone() (ret *AttributeView) {view.Group.Field = keyIDMap[view.Group.Field]}- switch view.LayoutType {- case LayoutTypeTable:- view.Table.ID = ast.NewNodeID()- for _, column := range view.Table.Columns {+ for _, layout := range []*LayoutTable{view.Table, view.List} {+ if nil == layout {+ continue+ }+ layout.ID = ast.NewNodeID()+ for _, column := range layout.Columns {column.ID = keyIDMap[column.ID]}- case LayoutTypeGallery:+ }+ if nil != view.Gallery {view.Gallery.ID = ast.NewNodeID()for _, cardField := range view.Gallery.CardFields {cardField.ID = keyIDMap[cardField.ID]}- case LayoutTypeKanban:+ }+ if nil != view.Kanban {view.Kanban.ID = ast.NewNodeID()for _, field := range view.Kanban.Fields {field.ID = keyIDMap[field.ID]diff --git a/kernel/av/color.go b/kernel/av/color.goindex 9628708aa4..49e0f252b9 100644--- a/kernel/av/color.go+++ b/kernel/av/color.go@@ -470,11 +470,14 @@ func visitViewColorHolders(view *View, visitOption func(*SelectOption), visitSelif nil != view.GroupCalc && nil != view.GroupCalc.FieldCalc {walkValueSelects(view.GroupCalc.FieldCalc.Result, visitSelection)}- if nil != view.Table {- if nil != view.Table.BaseLayout {- visitFilterColorHolders(view.Table.Filters, visitSelection)+ for _, layout := range []*LayoutTable{view.Table, view.List} {+ if nil == layout {+ continue+ }+ if nil != layout.BaseLayout {+ visitFilterColorHolders(layout.Filters, visitSelection)}- for _, column := range view.Table.Columns {+ for _, column := range layout.Columns {if nil == column {continue}@@ -667,9 +670,12 @@ func collectViewCustomColorIndexes(view *View, attrView *AttributeView, addColorcollectKeyCustomColorIndexes(view.GroupKey, addColor)collectFilterCustomColorIndexes(view.Filters, attrView, addColor)collectValueCustomColorIndexes(view.GroupVal, addColor)- if nil != view.Table {- if nil != view.Table.BaseLayout {- collectFilterCustomColorIndexes(view.Table.Filters, attrView, addColor)+ for _, layout := range []*LayoutTable{view.Table, view.List} {+ if nil == layout {+ continue+ }+ if nil != layout.BaseLayout {+ collectFilterCustomColorIndexes(layout.Filters, attrView, addColor)}}if nil != view.Gallery {diff --git a/kernel/av/layout.go b/kernel/av/layout.goindex d788c1008a..171b4e327d 100644--- a/kernel/av/layout.go+++ b/kernel/av/layout.go@@ -75,9 +75,9 @@ type BaseInstance struct {func NewViewBaseInstance(view *View) *BaseInstance {showIcon, wrapField := true, falseswitch view.LayoutType {- case LayoutTypeTable:- showIcon = view.Table.ShowIcon- wrapField = view.Table.WrapField+ case LayoutTypeTable, LayoutTypeList:+ showIcon = view.GetTableLayout().ShowIcon+ wrapField = view.GetTableLayout().WrapFieldcase LayoutTypeGallery:showIcon = view.Gallery.ShowIconwrapField = view.Gallery.WrapFielddiff --git a/kernel/av/layout_list.go b/kernel/av/layout_list.gonew file mode 100644index 0000000000..a3408051ff--- /dev/null+++ b/kernel/av/layout_list.go@@ -0,0 +1,86 @@+// SiYuan - From thought to insight, with agents+// Copyright (c) 2020-present, b3log.org+// SPDX-License-Identifier: AGPL-3.0-or-later++package av++import "fmt"++// LayoutList 使用行列字段结构,独立保存列表布局的字段顺序和显隐设置。+type LayoutList = LayoutTable++// List 描述列表视图实例,复用表格的条目和字段操作。+type List struct {+ *Table+}++func (*List) GetType() LayoutType {+ return LayoutTypeList+}++func NewListView() *View {+ view := NewTableView()+ view.Name = GetAttributeViewI18n("list")+ view.LayoutType = LayoutTypeList+ view.List = NewLayoutList()+ view.Table = nil+ return view+}++func NewLayoutList() *LayoutList {+ return NewLayoutTable()+}++// GetTableLayout 返回当前布局使用的行列字段设置。+func (view *View) GetTableLayout() *LayoutTable {+ if LayoutTypeList == view.LayoutType {+ return view.List+ }+ return view.Table+}++// TableFromViewable 获取表格或列表实例的行列数据。+func TableFromViewable(viewable Viewable) *Table {+ switch instance := viewable.(type) {+ case *Table:+ return instance+ case *List:+ return instance.Table+ }+ return nil+}++// ValidateListLayouts 校验列表布局的结构,拒绝损坏数据并保留原始文件。+func (attrView *AttributeView) ValidateListLayouts() error {+ var validate func(*View) error+ validate = func(view *View) error {+ if nil == view {+ return nil+ }+ if LayoutTypeList == view.LayoutType && nil == view.List {+ return fmt.Errorf("list layout missing in view [%s]", view.ID)+ }+ if nil != view.List {+ if nil == view.List.BaseLayout {+ return fmt.Errorf("invalid list layout in view [%s]", view.ID)+ }+ for _, column := range view.List.Columns {+ if nil == column || nil == column.BaseField {+ return fmt.Errorf("invalid list field in view [%s]", view.ID)+ }+ }+ }+ for _, group := range view.Groups {+ if err := validate(group); nil != err {+ return err+ }+ }+ return nil+ }+ for _, view := range attrView.Views {+ if err := validate(view); nil != err {+ return err+ }+ }+ return nil+}diff --git a/kernel/av/render_template.go b/kernel/av/render_template.goindex c3165d0478..83d325a887 100644--- a/kernel/av/render_template.go+++ b/kernel/av/render_template.go@@ -163,11 +163,14 @@ func visitViewValues(view *View, visitValue func(*Value)) {if nil != view.GroupCalc && nil != view.GroupCalc.FieldCalc {visitValue(view.GroupCalc.FieldCalc.Result)}- if nil != view.Table {- if nil != view.Table.BaseLayout {- visitFilterValues(view.Table.Filters, visitValue)+ for _, layout := range []*LayoutTable{view.Table, view.List} {+ if nil == layout {+ continue+ }+ if nil != layout.BaseLayout {+ visitFilterValues(layout.Filters, visitValue)}- for _, column := range view.Table.Columns {+ for _, column := range layout.Columns {if nil == column {continue}diff --git a/kernel/cli/cmd/database.go b/kernel/cli/cmd/database.goindex b159eb1782..bbda904dc5 100644--- a/kernel/cli/cmd/database.go+++ b/kernel/cli/cmd/database.go@@ -481,6 +481,8 @@ func databaseViewBase(viewable av.Viewable) (ret *av.BaseInstance) {switch view := viewable.(type) {case *av.Table:ret = view.BaseInstance+ case *av.List:+ ret = view.BaseInstancecase *av.Gallery:ret = view.BaseInstancecase *av.Kanban:diff --git a/kernel/cli/cmd/database_test.go b/kernel/cli/cmd/database_test.goindex 1300717845..9836d0286d 100644--- a/kernel/cli/cmd/database_test.go+++ b/kernel/cli/cmd/database_test.go@@ -74,11 +74,16 @@ func TestWriteGroupedDatabaseView(t *testing.T) {ID: "20260806000000-view001", Name: "Table", Groups: []av.Viewable{group},}}- var output bytes.Buffer- if count := writeRenderedView(&output, attrView, root, false); count != 1 {- t.Fatalf("unexpected grouped item count: %d", count)- }- if result := output.String(); !strings.Contains(result, "[Todo]") || !strings.Contains(result, "Task") {- t.Fatalf("unexpected grouped database output: %q", result)+ list := &av.List{Table: &av.Table{BaseInstance: &av.BaseInstance{+ ID: "20260806000000-view002", Name: "List", Groups: []av.Viewable{&av.List{Table: group}},+ }}}+ for _, view := range []av.Viewable{root, list} {+ var output bytes.Buffer+ if count := writeRenderedView(&output, attrView, view, false); count != 1 {+ t.Fatalf("unexpected grouped item count for %s: %d", view.GetType(), count)+ }+ if result := output.String(); !strings.Contains(result, "[Todo]") || !strings.Contains(result, "Task") {+ t.Fatalf("unexpected grouped database output for %s: %q", view.GetType(), result)+ }}}diff --git a/kernel/mcp/tools/database.go b/kernel/mcp/tools/database.goindex 6ad5c6329b..6edec8536e 100644--- a/kernel/mcp/tools/database.go+++ b/kernel/mcp/tools/database.go@@ -76,7 +76,7 @@ var DatabaseTool = &Tool{"pageSize": {Type: "integer", Description: "Results per page (default 50)"},"name": {Type: "string", Description: "Database name (for create) or key name (for key_add)"},"primaryKeyName": {Type: "string", Description: "Primary key field name (for create, optional)"},- "layout": {Type: "string", Description: "Initial database layout (for create, default table)", Enum: []string{"table", "gallery", "kanban"}},+ "layout": {Type: "string", Description: "Initial database layout (for create, default table)", Enum: []string{"table", "list", "gallery", "kanban"}},"keys": {Type: "array", Description: "Ordered fields to create after the primary key (for create, optional)",Items: &Property{@@ -380,9 +380,9 @@ func databaseViewFieldIDs(view *av.View) (ret []string) {return}switch view.LayoutType {- case av.LayoutTypeTable:- if nil != view.Table {- for _, column := range view.Table.Columns {+ case av.LayoutTypeTable, av.LayoutTypeList:+ if layout := view.GetTableLayout(); nil != layout {+ for _, column := range layout.Columns {if nil != column && "" != column.ID {ret = append(ret, column.ID)}diff --git a/kernel/mcp/tools/database_test.go b/kernel/mcp/tools/database_test.goindex 08b6342455..c3e107591e 100644--- a/kernel/mcp/tools/database_test.go+++ b/kernel/mcp/tools/database_test.go@@ -162,6 +162,12 @@ func TestDatabasePreviousKeyIDDefaultsToViewEnd(t *testing.T) {func TestDatabaseViewFieldIDsSupportsLayouts(t *testing.T) {tests := []*av.View{+ {+ LayoutType: av.LayoutTypeList,+ List: &av.LayoutList{Columns: []*av.ViewTableColumn{+ {BaseField: &av.BaseField{ID: "list-1"}}, {BaseField: &av.BaseField{ID: "list-2", Hidden: true}},+ }},+ },{LayoutType: av.LayoutTypeTable,Table: &av.LayoutTable{Columns: []*av.ViewTableColumn{diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex 584cf5d2f4..473fde914e 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -960,6 +960,8 @@ func syncAttrViewTableColWidth(operation *Operation) (err error) {var width stringswitch view.LayoutType {+ case av.LayoutTypeList:+ returncase av.LayoutTypeTable:for _, column := range view.Table.Columns {if column.ID == operation.KeyID {@@ -1245,7 +1247,7 @@ func syncAttrViewGroupHiddenStates(attrView *av.AttributeView, view *av.View) {viewable := sql.RenderView(attrView, view, "", false)cachedAttrViews := map[string]*av.AttributeView{}rollupFurtherCollections := sql.GetFurtherCollections(attrView, cachedAttrViews)- if table, ok := viewable.(*av.Table); ok {+ if table := av.TableFromViewable(viewable); nil != table {// 过滤只依赖行字段值,先对完整父表执行一次,再按分组成员关系判断空分组。filtered := *tablefiltered.Rows = append([]*av.TableRow(nil), table.Rows...)@@ -1312,7 +1314,7 @@ func setAttrViewCardAspectRatio(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:returncase av.LayoutTypeGallery:view.Gallery.CardAspectRatio = ratio@@ -1353,7 +1355,7 @@ func setAttrViewCardAspectRatioValue(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:returncase av.LayoutTypeGallery:view.Gallery.CardAspectRatioValue = ratio@@ -1499,17 +1501,25 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout a}switch newLayout {- case av.LayoutTypeTable, av.LayoutTypeGallery, av.LayoutTypeKanban:+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeGallery, av.LayoutTypeKanban:default:return av.ErrWrongLayoutType}oldLayout := view.LayoutType+ oldFields := attributeViewFieldIDs(view)view.LayoutType = newLayoutswitch newLayout {+ case av.LayoutTypeList:+ if view.Name == av.GetAttributeViewI18n("table") || view.Name == av.GetAttributeViewI18n("gallery") || view.Name == av.GetAttributeViewI18n("kanban") {+ view.Name = av.GetAttributeViewI18n("list")+ }+ if nil == view.List {+ view.List = newAttributeViewListLayout(attrView, oldFields)+ }case av.LayoutTypeTable:- if view.Name == av.GetAttributeViewI18n("gallery") || view.Name == av.GetAttributeViewI18n("kanban") {+ if oldLayout == av.LayoutTypeList && view.Name == av.GetAttributeViewI18n("list") || view.Name == av.GetAttributeViewI18n("gallery") || view.Name == av.GetAttributeViewI18n("kanban") {view.Name = av.GetAttributeViewI18n("table")}@@ -1519,6 +1529,10 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout aview.Table = av.NewLayoutTable()switch oldLayout {+ case av.LayoutTypeList:+ for _, field := range view.List.Columns {+ view.Table.Columns = append(view.Table.Columns, &av.ViewTableColumn{BaseField: &av.BaseField{ID: field.ID}})+ }case av.LayoutTypeGallery:for _, field := range view.Gallery.CardFields {view.Table.Columns = append(view.Table.Columns, &av.ViewTableColumn{BaseField: &av.BaseField{ID: field.ID}})@@ -1529,7 +1543,7 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout a}}case av.LayoutTypeGallery:- if view.Name == av.GetAttributeViewI18n("table") || view.Name == av.GetAttributeViewI18n("kanban") {+ if oldLayout == av.LayoutTypeList && view.Name == av.GetAttributeViewI18n("list") || view.Name == av.GetAttributeViewI18n("table") || view.Name == av.GetAttributeViewI18n("kanban") {view.Name = av.GetAttributeViewI18n("gallery")}@@ -1539,9 +1553,9 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout aview.Gallery = av.NewLayoutGallery()switch oldLayout {- case av.LayoutTypeTable:- for _, col := range view.Table.Columns {- view.Gallery.CardFields = append(view.Gallery.CardFields, &av.ViewGalleryCardField{BaseField: &av.BaseField{ID: col.ID}})+ case av.LayoutTypeTable, av.LayoutTypeList:+ for _, id := range oldFields {+ view.Gallery.CardFields = append(view.Gallery.CardFields, &av.ViewGalleryCardField{BaseField: &av.BaseField{ID: id}})}case av.LayoutTypeKanban:for _, field := range view.Kanban.Fields {@@ -1549,7 +1563,7 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout a}}case av.LayoutTypeKanban:- if view.Name == av.GetAttributeViewI18n("table") || view.Name == av.GetAttributeViewI18n("gallery") {+ if oldLayout == av.LayoutTypeList && view.Name == av.GetAttributeViewI18n("list") || view.Name == av.GetAttributeViewI18n("table") || view.Name == av.GetAttributeViewI18n("gallery") {view.Name = av.GetAttributeViewI18n("kanban")}@@ -1559,9 +1573,9 @@ func changeAttrViewLayout(attrView *av.AttributeView, view *av.View, newLayout aview.Kanban = av.NewLayoutKanban()switch oldLayout {- case av.LayoutTypeTable:- for _, col := range view.Table.Columns {- view.Kanban.Fields = append(view.Kanban.Fields, &av.ViewKanbanField{BaseField: &av.BaseField{ID: col.ID}})+ case av.LayoutTypeTable, av.LayoutTypeList:+ for _, id := range oldFields {+ view.Kanban.Fields = append(view.Kanban.Fields, &av.ViewKanbanField{BaseField: &av.BaseField{ID: id}})}case av.LayoutTypeGallery:for _, field := range view.Gallery.CardFields {@@ -1599,9 +1613,9 @@ func setAttrViewWrapField(operation *Operation) (err error) {allFieldWrap := operation.Data.(bool)switch view.LayoutType {- case av.LayoutTypeTable:- view.Table.WrapField = allFieldWrap- for _, col := range view.Table.Columns {+ case av.LayoutTypeTable, av.LayoutTypeList:+ view.GetTableLayout().WrapField = allFieldWrap+ for _, col := range view.GetTableLayout().Columns {col.Wrap = allFieldWrap}case av.LayoutTypeGallery:@@ -1640,8 +1654,8 @@ func setAttrViewShowIcon(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:- view.Table.ShowIcon = operation.Data.(bool)+ case av.LayoutTypeTable, av.LayoutTypeList:+ view.GetTableLayout().ShowIcon = operation.Data.(bool)case av.LayoutTypeGallery:view.Gallery.ShowIcon = operation.Data.(bool)case av.LayoutTypeKanban:@@ -1672,7 +1686,7 @@ func setAttrViewFitImage(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:returncase av.LayoutTypeGallery:view.Gallery.FitImage = operation.Data.(bool)@@ -1720,7 +1734,7 @@ func setAttrViewDisplayFieldName(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:returncase av.LayoutTypeGallery:view.Gallery.DisplayFieldName = operation.Data.(bool)@@ -1744,7 +1758,7 @@ func setAttrViewDisplayEmptyFields(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:returncase av.LayoutTypeGallery:view.Gallery.DisplayEmptyFields = operation.Data.(bool)@@ -1768,7 +1782,7 @@ func setAttrViewFillColBackgroundColor(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:returncase av.LayoutTypeGallery:return@@ -1809,7 +1823,7 @@ func setAttrViewCardSize(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:returncase av.LayoutTypeGallery:view.Gallery.CardSize = size@@ -1851,7 +1865,7 @@ func setAttrViewCardWidth(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:returncase av.LayoutTypeGallery:view.Gallery.CardWidth = width@@ -1992,7 +2006,7 @@ func setAttrViewCoverFromAssetKeyID(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:returncase av.LayoutTypeGallery:view.Gallery.CoverFromAssetKeyID = operation.KeyID@@ -2024,7 +2038,7 @@ func setAttrViewCoverFrom(operation *Operation) (err error) {}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:returncase av.LayoutTypeGallery:view.Gallery.CoverFrom = av.CoverFrom(operation.Data.(float64))@@ -4055,6 +4069,8 @@ func genAttrViewGroupsWithItems(view *av.View, attrView *av.AttributeView, sourcfor groupValue, groupItems := range groupItemsMap {var v *av.Viewswitch view.LayoutType {+ case av.LayoutTypeList:+ v = av.NewListView()case av.LayoutTypeTable:v = av.NewTableView()v.Table = av.NewLayoutTable()@@ -4601,18 +4617,8 @@ func updateAttributeViewColRelation(operation *Operation) (err error) {Relation: &av.Relation{AvID: operation.AvID, IsTwoWay: operation.IsTwoWay, BackKeyID: operation.KeyID},},}- destAv.KeyValues = append(destAv.KeyValues, destKeyValues)-- for _, v := range destAv.Views {- switch v.LayoutType {- case av.LayoutTypeTable:- v.Table.Columns = append(v.Table.Columns, &av.ViewTableColumn{BaseField: &av.BaseField{ID: operation.BackRelationKeyID}})- case av.LayoutTypeGallery:- v.Gallery.CardFields = append(v.Gallery.CardFields, &av.ViewGalleryCardField{BaseField: &av.BaseField{ID: operation.BackRelationKeyID}})- case av.LayoutTypeKanban:- v.Kanban.Fields = append(v.Kanban.Fields, &av.ViewKanbanField{BaseField: &av.BaseField{ID: operation.BackRelationKeyID}})- }- }+ addAttributeViewKey(destAv, nil, destKeyValues.Key, "")+ destKeyValues, _ = destAv.GetKeyValues(operation.BackRelationKeyID)now := time.Now().UnixMilli()// 和现有值进行关联@@ -4932,6 +4938,8 @@ func (tx *Transaction) doDuplicateAttrViewView(operation *Operation) (ret *TxErrvar view *av.Viewswitch masterView.LayoutType {+ case av.LayoutTypeList:+ view = av.NewListView()case av.LayoutTypeTable:view = av.NewTableView()case av.LayoutTypeGallery:@@ -4961,76 +4969,8 @@ func (tx *Transaction) doDuplicateAttrViewView(operation *Operation) (ret *TxErr})}- switch masterView.LayoutType {- case av.LayoutTypeTable:- for _, col := range masterView.Table.Columns {- view.Table.Columns = append(view.Table.Columns, &av.ViewTableColumn{- BaseField: &av.BaseField{- ID: col.ID,- Wrap: col.Wrap,- Hidden: col.Hidden,- Desc: col.Desc,- },- Pin: col.Pin,- Width: col.Width,- Align: col.Align,- Calc: col.Calc,- })- }-- view.Table.ShowIcon = masterView.Table.ShowIcon- view.Table.WrapField = masterView.Table.WrapField- case av.LayoutTypeGallery:- for _, field := range masterView.Gallery.CardFields {- view.Gallery.CardFields = append(view.Gallery.CardFields, &av.ViewGalleryCardField{- BaseField: &av.BaseField{- ID: field.ID,- Wrap: field.Wrap,- Hidden: field.Hidden,- Desc: field.Desc,- },- FullRow: field.FullRow,- })- }-- view.Gallery.CoverFrom = masterView.Gallery.CoverFrom- view.Gallery.CoverFromAssetKeyID = masterView.Gallery.CoverFromAssetKeyID- view.Gallery.CardAspectRatio = masterView.Gallery.CardAspectRatio- view.Gallery.CardAspectRatioValue = masterView.Gallery.CardAspectRatioValue- view.Gallery.CardSize = masterView.Gallery.CardSize- view.Gallery.CardWidth = masterView.Gallery.CardWidth- view.Gallery.CardLayout = masterView.Gallery.CardLayout- view.Gallery.FitImage = masterView.Gallery.FitImage- view.Gallery.DisplayFieldName = masterView.Gallery.DisplayFieldName- view.Gallery.DisplayEmptyFields = masterView.Gallery.DisplayEmptyFields- view.Gallery.ShowIcon = masterView.Gallery.ShowIcon- view.Gallery.WrapField = masterView.Gallery.WrapField- case av.LayoutTypeKanban:- for _, field := range masterView.Kanban.Fields {- view.Kanban.Fields = append(view.Kanban.Fields, &av.ViewKanbanField{- BaseField: &av.BaseField{- ID: field.ID,- Wrap: field.Wrap,- Hidden: field.Hidden,- Desc: field.Desc,- },- FullRow: field.FullRow,- })- }-- view.Kanban.CoverFrom = masterView.Kanban.CoverFrom- view.Kanban.CoverFromAssetKeyID = masterView.Kanban.CoverFromAssetKeyID- view.Kanban.CardAspectRatio = masterView.Kanban.CardAspectRatio- view.Kanban.CardAspectRatioValue = masterView.Kanban.CardAspectRatioValue- view.Kanban.CardSize = masterView.Kanban.CardSize- view.Kanban.CardWidth = masterView.Kanban.CardWidth- view.Kanban.CardLayout = masterView.Kanban.CardLayout- view.Kanban.FitImage = masterView.Kanban.FitImage- view.Kanban.DisplayFieldName = masterView.Kanban.DisplayFieldName- view.Kanban.DisplayEmptyFields = masterView.Kanban.DisplayEmptyFields- view.Kanban.FillColBackgroundColor = masterView.Kanban.FillColBackgroundColor- view.Kanban.ShowIcon = masterView.Kanban.ShowIcon- view.Kanban.WrapField = masterView.Kanban.WrapField+ if err = cloneAttributeViewLayouts(view, masterView); nil != err {+ return &TxErr{code: TxErrHandleAttributeView, id: avID, msg: err.Error()}}view.ItemIDs = masterView.ItemIDs@@ -5085,11 +5025,14 @@ func addAttrViewView(avID, viewID, blockID string, layout av.LayoutType) (err ervar view *av.Viewswitch layout {+ case av.LayoutTypeList:+ view = av.NewListView()+ view.List = newAttributeViewListLayout(attrView, attributeViewFieldIDs(firstView))case av.LayoutTypeTable:view = av.NewTableView()switch firstView.LayoutType {- case av.LayoutTypeTable:- for _, col := range firstView.Table.Columns {+ case av.LayoutTypeTable, av.LayoutTypeList:+ for _, col := range firstView.GetTableLayout().Columns {view.Table.Columns = append(view.Table.Columns, &av.ViewTableColumn{BaseField: &av.BaseField{ID: col.ID}, Width: col.Width, Align: col.Align,})@@ -5106,8 +5049,8 @@ func addAttrViewView(avID, viewID, blockID string, layout av.LayoutType) (err ercase av.LayoutTypeGallery:view = av.NewGalleryView()switch firstView.LayoutType {- case av.LayoutTypeTable:- for _, col := range firstView.Table.Columns {+ case av.LayoutTypeTable, av.LayoutTypeList:+ for _, col := range firstView.GetTableLayout().Columns {view.Gallery.CardFields = append(view.Gallery.CardFields, &av.ViewGalleryCardField{BaseField: &av.BaseField{ID: col.ID}})}case av.LayoutTypeGallery:@@ -5122,8 +5065,8 @@ func addAttrViewView(avID, viewID, blockID string, layout av.LayoutType) (err ercase av.LayoutTypeKanban:view = av.NewKanbanView()switch firstView.LayoutType {- case av.LayoutTypeTable:- for _, col := range firstView.Table.Columns {+ case av.LayoutTypeTable, av.LayoutTypeList:+ for _, col := range firstView.GetTableLayout().Columns {view.Kanban.Fields = append(view.Kanban.Fields, &av.ViewKanbanField{BaseField: &av.BaseField{ID: col.ID}})}case av.LayoutTypeGallery:@@ -5190,24 +5133,7 @@ func getKanbanPreferredGroupKey(attrView *av.AttributeView) (ret *av.Key) {if nil == ret {name := av.GetAttributeViewI18n("select")ret = av.NewKey(ast.NewNodeID(), name, "", av.KeyTypeSelect)- attrView.KeyValues = append(attrView.KeyValues, &av.KeyValues{Key: ret})- for _, view := range attrView.Views {- newField := &av.BaseField{ID: ret.ID}- if nil != view.Table {- newField.Wrap = view.Table.WrapField- view.Table.Columns = append(view.Table.Columns, &av.ViewTableColumn{BaseField: newField})- }-- if nil != view.Gallery {- newField.Wrap = view.Gallery.WrapField- view.Gallery.CardFields = append(view.Gallery.CardFields, &av.ViewGalleryCardField{BaseField: newField})- }-- if nil != view.Kanban {- newField.Wrap = view.Kanban.WrapField- view.Kanban.Fields = append(view.Kanban.Fields, &av.ViewKanbanField{BaseField: newField})- }- }+ addAttributeViewKey(attrView, nil, ret, "")}return}@@ -6002,12 +5928,12 @@ func setAttributeViewColumnCalc(operation *Operation) (err error) {calc := &av.FieldCalc{}switch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:if err = gulu.JSON.UnmarshalJSON(data, calc); err != nil {return}- for _, column := range view.Table.Columns {+ for _, column := range view.GetTableLayout().Columns {if column.ID == operation.ID {column.Calc = calcbreak@@ -6708,59 +6634,52 @@ func duplicateAttributeViewKey(operation *Operation) (err error) {attrView.KeyValues = append(attrView.KeyValues, &av.KeyValues{Key: copyKey})for _, view := range attrView.Views {- switch view.LayoutType {- case av.LayoutTypeTable:- for i, column := range view.Table.Columns {- if column.ID == key.ID {- view.Table.Columns = append(view.Table.Columns[:i+1], append([]*av.ViewTableColumn{- {- BaseField: &av.BaseField{- ID: copyKey.ID,- Wrap: column.Wrap,- Hidden: column.Hidden,- Desc: column.Desc,- },- Pin: column.Pin,- Width: column.Width,- Align: column.Align,- },- }, view.Table.Columns[i+1:]...)...)- break+ for _, layout := range []*av.LayoutTable{view.Table, view.List} {+ if nil == layout {+ continue+ }+ for i, column := range layout.Columns {+ if column.ID != key.ID {+ continue+ }+ cloned := &av.ViewTableColumn{}+ if err = copier.CopyWithOption(cloned, column, copier.Option{DeepCopy: true}); nil != err {+ return}+ cloned.ID = copyKey.ID+ if layout == view.List && av.LayoutTypeList != view.LayoutType {+ cloned.Hidden = true+ }+ layout.Columns = util.InsertElem(layout.Columns, i+1, cloned)+ break}- case av.LayoutTypeGallery:+ }+ if nil != view.Gallery {for i, field := range view.Gallery.CardFields {- if field.ID == key.ID {- view.Gallery.CardFields = append(view.Gallery.CardFields[:i+1], append([]*av.ViewGalleryCardField{- {- BaseField: &av.BaseField{- ID: copyKey.ID,- Wrap: field.Wrap,- Hidden: field.Hidden,- Desc: field.Desc,- },- FullRow: field.FullRow,- },- }, view.Gallery.CardFields[i+1:]...)...)- break+ if field.ID != key.ID {+ continue+ }+ cloned := &av.ViewGalleryCardField{}+ if err = copier.CopyWithOption(cloned, field, copier.Option{DeepCopy: true}); nil != err {+ return}+ cloned.ID = copyKey.ID+ view.Gallery.CardFields = util.InsertElem(view.Gallery.CardFields, i+1, cloned)+ break}- case av.LayoutTypeKanban:+ }+ if nil != view.Kanban {for i, field := range view.Kanban.Fields {- if field.ID == key.ID {- view.Kanban.Fields = append(view.Kanban.Fields[:i+1], append([]*av.ViewKanbanField{- {- BaseField: &av.BaseField{- ID: copyKey.ID,- Wrap: field.Wrap,- Hidden: field.Hidden,- Desc: field.Desc,- },- FullRow: field.FullRow,- },- }, view.Kanban.Fields[i+1:]...)...)- break+ if field.ID != key.ID {+ continue+ }+ cloned := &av.ViewKanbanField{}+ if err = copier.CopyWithOption(cloned, field, copier.Option{DeepCopy: true}); nil != err {+ return}+ cloned.ID = copyKey.ID+ view.Kanban.Fields = util.InsertElem(view.Kanban.Fields, i+1, cloned)+ break}}}@@ -6906,14 +6825,14 @@ func setAttributeViewColWrap(operation *Operation) (err error) {newWrap := operation.Data.(bool)allFieldWrap := trueswitch view.LayoutType {- case av.LayoutTypeTable:- for _, column := range view.Table.Columns {+ case av.LayoutTypeTable, av.LayoutTypeList:+ for _, column := range view.GetTableLayout().Columns {if column.ID == operation.ID {column.Wrap = newWrap}allFieldWrap = allFieldWrap && column.Wrap}- view.Table.WrapField = allFieldWrap+ view.GetTableLayout().WrapField = allFieldWrapcase av.LayoutTypeGallery:for _, field := range view.Gallery.CardFields {if field.ID == operation.ID {@@ -6985,6 +6904,15 @@ func setAttributeViewFieldsHidden(attrView *av.AttributeView, keyID string, viewif nil == view {return fmt.Errorf("view [%s] not found", viewID)}+ if hidden && av.LayoutTypeList == view.LayoutType {+ key, keyErr := attrView.GetKey(keyID)+ if nil != keyErr {+ return keyErr+ }+ if av.KeyTypeBlock == key.Type {+ return errors.New("cannot hide the primary key in a list view")+ }+ }field := getAttributeViewField(view, keyID)if nil == field {return fmt.Errorf("field [%s] not found in view [%s]", keyID, viewID)@@ -7003,11 +6931,11 @@ func setAttributeViewFieldsHidden(attrView *av.AttributeView, keyID string, viewfunc getAttributeViewField(view *av.View, keyID string) (ret *av.BaseField) {switch view.LayoutType {- case av.LayoutTypeTable:- if nil == view.Table {+ case av.LayoutTypeTable, av.LayoutTypeList:+ if nil == view.GetTableLayout() {return}- for _, column := range view.Table.Columns {+ for _, column := range view.GetTableLayout().Columns {if column.ID == keyID {return column.BaseField}@@ -7282,9 +7210,9 @@ func SortAttributeViewViewKey(avID, blockID, keyID, previousKeyID string) (err evar curIndex, previousIndex intswitch view.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:var col *av.ViewTableColumn- for i, column := range view.Table.Columns {+ for i, column := range view.GetTableLayout().Columns {if column.ID == keyID {col = columncurIndex = i@@ -7295,14 +7223,14 @@ func SortAttributeViewViewKey(avID, blockID, keyID, previousKeyID string) (err ereturn}- view.Table.Columns = append(view.Table.Columns[:curIndex], view.Table.Columns[curIndex+1:]...)- for i, column := range view.Table.Columns {+ view.GetTableLayout().Columns = append(view.GetTableLayout().Columns[:curIndex], view.GetTableLayout().Columns[curIndex+1:]...)+ for i, column := range view.GetTableLayout().Columns {if column.ID == previousKeyID {previousIndex = i + 1break}}- view.Table.Columns = util.InsertElem(view.Table.Columns, previousIndex, col)+ view.GetTableLayout().Columns = util.InsertElem(view.GetTableLayout().Columns, previousIndex, col)case av.LayoutTypeGallery:var field *av.ViewGalleryCardFieldfor i, cardField := range view.Gallery.CardFields {@@ -7495,13 +7423,24 @@ func addAttributeViewKey(attrView *av.AttributeView, currentView *av.View, key *attrView.KeyValues = append(attrView.KeyValues, &av.KeyValues{Key: key})for _, view := range attrView.Views {- newField := &av.BaseField{ID: key.ID}+ if nil != view.List {+ hidden := nil == currentView || currentView.ID != view.ID || av.LayoutTypeList != currentView.LayoutType+ column := &av.ViewTableColumn{BaseField: &av.BaseField{ID: key.ID, Hidden: hidden, Wrap: view.List.WrapField}}+ index := len(view.List.Columns)+ for i, field := range view.List.Columns {+ if field.ID == previousKeyID {+ index = i + 1+ break+ }+ }+ view.List.Columns = util.InsertElem(view.List.Columns, index, column)+ }if nil != view.Table {- newField.Wrap = view.Table.WrapField+ newField := &av.BaseField{ID: key.ID, Wrap: view.Table.WrapField}if "" == previousKeyID {- if av.LayoutTypeGallery == currentView.LayoutType || av.LayoutTypeKanban == currentView.LayoutType {- // 如果当前视图是卡片或看板视图则添加到最后+ if nil == currentView || av.LayoutTypeTable != currentView.LayoutType {+ // 非表格视图新增的字段追加到表格末尾。view.Table.Columns = append(view.Table.Columns, &av.ViewTableColumn{BaseField: newField})} else {view.Table.Columns = append([]*av.ViewTableColumn{{BaseField: newField}}, view.Table.Columns...)@@ -7522,7 +7461,7 @@ func addAttributeViewKey(attrView *av.AttributeView, currentView *av.View, key *}if nil != view.Gallery {- newField.Wrap = view.Gallery.WrapField+ newField := &av.BaseField{ID: key.ID, Wrap: view.Gallery.WrapField}if "" == previousKeyID {view.Gallery.CardFields = append(view.Gallery.CardFields, &av.ViewGalleryCardField{BaseField: newField})@@ -7542,7 +7481,7 @@ func addAttributeViewKey(attrView *av.AttributeView, currentView *av.View, key *}if nil != view.Kanban {- newField.Wrap = view.Kanban.WrapField+ newField := &av.BaseField{ID: key.ID, Wrap: view.Kanban.WrapField}if "" == previousKeyID {view.Kanban.Fields = append(view.Kanban.Fields, &av.ViewKanbanField{BaseField: newField})diff --git a/kernel/model/attribute_view_create.go b/kernel/model/attribute_view_create.goindex 71f0a5ba1d..c0731a40e1 100644--- a/kernel/model/attribute_view_create.go+++ b/kernel/model/attribute_view_create.go@@ -63,7 +63,7 @@ func CreateAttributeViewDatabase(parentID, previousID, nextID, name, primaryKeyNlayout = av.LayoutTypeTable}switch layout {- case av.LayoutTypeTable, av.LayoutTypeGallery, av.LayoutTypeKanban:+ case av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeGallery, av.LayoutTypeKanban:default:return nil, av.ErrWrongLayoutType}@@ -174,7 +174,7 @@ func configureCreatedAttributeView(attrView *av.AttributeView, name, primaryKeyNpreviousKeyID = retainedKeyValues[len(retainedKeyValues)-1].Key.ID}for _, key := range preparedKeys {- addAttributeViewKey(attrView, currentView, key, previousKeyID)+ addAttributeViewKey(attrView, nil, key, previousKeyID)previousKeyID = key.ID}@@ -196,6 +196,15 @@ func retainCreatedAttributeViewFields(attrView *av.AttributeView, retainedKeyIDsif nil == view {continue}+ if nil != view.List {+ columns := view.List.Columns[:0]+ for _, column := range view.List.Columns {+ if nil != column && retainedKeyIDs[column.ID] {+ columns = append(columns, column)+ }+ }+ view.List.Columns = columns+ }if nil != view.Table {columns := view.Table.Columns[:0]for _, column := range view.Table.Columns {diff --git a/kernel/model/attribute_view_fields.go b/kernel/model/attribute_view_fields.goindex 0ecc1300d7..501b6fc9fb 100644--- a/kernel/model/attribute_view_fields.go+++ b/kernel/model/attribute_view_fields.go@@ -208,6 +208,9 @@ func removeAttributeViewFieldDefinition(view *av.AttributeView, keyID string) {view.RemoveNewItemTemplateFieldValue(keyID)view.RemoveCardCoverPositionsBySource(av.CardCoverSource(av.CoverFromAssetField, keyID))for _, layout := range view.Views {+ if layout.List != nil {+ layout.List.Columns = slices.DeleteFunc(layout.List.Columns, func(column *av.ViewTableColumn) bool { return column.ID == keyID })+ }if layout.Table != nil {layout.Table.Columns = slices.DeleteFunc(layout.Table.Columns, func(column *av.ViewTableColumn) bool { return column.ID == keyID })}diff --git a/kernel/model/attribute_view_list.go b/kernel/model/attribute_view_list.gonew file mode 100644index 0000000000..c554c01d1e--- /dev/null+++ b/kernel/model/attribute_view_list.go@@ -0,0 +1,94 @@+// SiYuan - From thought to insight, with agents+// Copyright (c) 2020-present, b3log.org+// SPDX-License-Identifier: AGPL-3.0-or-later++package model++import (+ "github.com/88250/lute/ast"+ "github.com/jinzhu/copier"+ "github.com/siyuan-note/siyuan/kernel/av"+)++// cloneAttributeViewLayouts 同时复制当前和暂存布局,保持切换布局后的用户设置。+func cloneAttributeViewLayouts(target, source *av.View) (err error) {+ if nil != source.Table {+ target.Table = &av.LayoutTable{}+ if err = copier.CopyWithOption(target.Table, source.Table, copier.Option{DeepCopy: true}); nil != err {+ return+ }+ target.Table.ID = ast.NewNodeID()+ }+ if nil != source.List {+ target.List = &av.LayoutList{}+ if err = copier.CopyWithOption(target.List, source.List, copier.Option{DeepCopy: true}); nil != err {+ return+ }+ target.List.ID = ast.NewNodeID()+ }+ if nil != source.Gallery {+ target.Gallery = &av.LayoutGallery{}+ if err = copier.CopyWithOption(target.Gallery, source.Gallery, copier.Option{DeepCopy: true}); nil != err {+ return+ }+ target.Gallery.ID = ast.NewNodeID()+ }+ if nil != source.Kanban {+ target.Kanban = &av.LayoutKanban{}+ if err = copier.CopyWithOption(target.Kanban, source.Kanban, copier.Option{DeepCopy: true}); nil != err {+ return+ }+ target.Kanban.ID = ast.NewNodeID()+ }+ return+}++// attributeViewFieldIDs 按当前布局的字段顺序返回字段 ID。+func attributeViewFieldIDs(view *av.View) (ret []string) {+ switch view.LayoutType {+ case av.LayoutTypeTable, av.LayoutTypeList:+ if layout := view.GetTableLayout(); nil != layout {+ for _, column := range layout.Columns {+ ret = append(ret, column.ID)+ }+ }+ case av.LayoutTypeGallery:+ for _, field := range view.Gallery.CardFields {+ ret = append(ret, field.ID)+ }+ case av.LayoutTypeKanban:+ for _, field := range view.Kanban.Fields {+ ret = append(ret, field.ID)+ }+ }+ return+}++// newAttributeViewListLayout 初始化列表字段,仅显示主键;已有列表配置无需重新初始化。+func newAttributeViewListLayout(attrView *av.AttributeView, fieldIDs []string) *av.LayoutList {+ ret := av.NewLayoutList()+ seen := map[string]bool{}+ appendField := func(id string) {+ if seen[id] {+ return+ }+ key, err := attrView.GetKey(id)+ if nil != err {+ return+ }+ seen[id] = true+ ret.Columns = append(ret.Columns, &av.ViewTableColumn{BaseField: &av.BaseField{+ ID: id, Hidden: av.KeyTypeBlock != key.Type,+ }})+ }+ if primary := attrView.GetBlockKeyValues(); nil != primary && nil != primary.Key {+ appendField(primary.Key.ID)+ }+ for _, id := range fieldIDs {+ appendField(id)+ }+ for _, keyValues := range attrView.KeyValues {+ appendField(keyValues.Key.ID)+ }+ return ret+}diff --git a/kernel/model/attribute_view_list_fts5_test.go b/kernel/model/attribute_view_list_fts5_test.gonew file mode 100644index 0000000000..558f8992f0--- /dev/null+++ b/kernel/model/attribute_view_list_fts5_test.go@@ -0,0 +1,53 @@+//go:build fts5++// SiYuan - From thought to insight, with agents+// Copyright (c) 2020-present, b3log.org+// SPDX-License-Identifier: AGPL-3.0-or-later++package model++import (+ "testing"++ "github.com/88250/lute/ast"+ "github.com/siyuan-note/siyuan/kernel/av"+ "github.com/siyuan-note/siyuan/kernel/cache"+)++func TestAttributeViewListCreateAndDuplicate(t *testing.T) {+ fixture, database, _, _ := setupAttributeViewItemsTest(t, false)+ setAttributeViewListTestLangs()+ blockID := fixture.sourceID+ listID := ast.NewNodeID()+ if err := addAttrViewView(database.ID, listID, blockID, av.LayoutTypeList); nil != err {+ t.Fatal(err)+ }+ attrView, err := av.ParseAttributeView(database.ID)+ if nil != err {+ t.Fatal(err)+ }+ list := attrView.GetView(listID)+ assertListDefaultFields(t, attrView, list)+ list.List.Columns[1].Hidden = false+ list.List.Columns[1].Wrap = true+ if err = av.SaveAttributeView(attrView); nil != err {+ t.Fatal(err)+ }+ duplicateID := ast.NewNodeID()+ tx := &Transaction{}+ if txErr := tx.doDuplicateAttrViewView(&Operation{AvID: attrView.ID, ID: duplicateID, PreviousID: listID, BlockID: blockID}); nil != txErr {+ t.Fatalf("duplicate list failed: %+v", txErr)+ }+ cache.ClearAVCache()+ attrView, err = av.ParseAttributeView(attrView.ID)+ if nil != err {+ t.Fatal(err)+ }+ duplicate := attrView.GetView(duplicateID)+ if nil == duplicate || nil == duplicate.List || duplicate.List.Columns[1].Hidden || !duplicate.List.Columns[1].Wrap {+ t.Fatalf("duplicate must preserve list settings: %+v", duplicate)+ }+ if attrView.GetView(database.Views[0].ID).Table.Columns[1].Hidden {+ t.Fatal("creating a list must not hide fields in the source table")+ }+}diff --git a/kernel/model/attribute_view_list_test.go b/kernel/model/attribute_view_list_test.gonew file mode 100644index 0000000000..0537116671--- /dev/null+++ b/kernel/model/attribute_view_list_test.go@@ -0,0 +1,229 @@+// SiYuan - From thought to insight, with agents+// Copyright (c) 2020-present, b3log.org+// SPDX-License-Identifier: AGPL-3.0-or-later++package model++import (+ "bytes"+ "encoding/json"+ "os"+ "reflect"+ "testing"++ "github.com/88250/lute/ast"+ "github.com/siyuan-note/siyuan/kernel/av"+ "github.com/siyuan-note/siyuan/kernel/cache"+ "github.com/siyuan-note/siyuan/kernel/sql"+ "github.com/siyuan-note/siyuan/kernel/util"+)++func setAttributeViewListTestLangs() {+ util.AttrViewLangs["en"]["list"] = "List"+ util.AttrViewLangs["en"]["gallery"] = "Gallery"+ util.AttrViewLangs["en"]["kanban"] = "Kanban"+}++func assertListDefaultFields(t *testing.T, attrView *av.AttributeView, view *av.View) {+ t.Helper()+ if nil == view || av.LayoutTypeList != view.LayoutType || nil == view.List {+ t.Fatalf("expected a list layout: %+v", view)+ }+ if len(view.List.Columns) != len(attrView.KeyValues) {+ t.Fatalf("list fields were lost: got %d, want %d", len(view.List.Columns), len(attrView.KeyValues))+ }+ for _, column := range view.List.Columns {+ key, err := attrView.GetKey(column.ID)+ if nil != err || column.Hidden != (av.KeyTypeBlock != key.Type) {+ t.Fatalf("unexpected list field visibility: %+v, %v", column, err)+ }+ }+}++func TestAttributeViewListInitialFieldsAndLayoutSwitch(t *testing.T) {+ setupAttributeViewValidationTest(t)+ setAttributeViewListTestLangs()+ attrView := newAttributeViewWithLayout(ast.NewNodeID(), av.LayoutTypeList)+ view := attrView.Views[0]+ assertListDefaultFields(t, attrView, view)+ primaryID := attrView.GetBlockKeyValues().Key.ID+ otherID := attrView.KeyValues[1].Key.ID+ if err := setAttributeViewFieldsHidden(attrView, primaryID, []string{view.ID}, true); nil == err {+ t.Fatal("list primary key must remain visible")+ }+ if err := setAttributeViewFieldsHidden(attrView, otherID, []string{view.ID}, false); nil != err {+ t.Fatal(err)+ }+ list := view.List+ for _, layout := range []av.LayoutType{av.LayoutTypeTable, av.LayoutTypeGallery, av.LayoutTypeKanban} {+ if err := changeAttrViewLayout(attrView, view, layout); nil != err {+ t.Fatal(err)+ }+ if err := changeAttrViewLayout(attrView, view, av.LayoutTypeList); nil != err {+ t.Fatal(err)+ }+ if view.List != list || getAttributeViewField(view, otherID).Hidden {+ t.Fatal("switching back must retain list field visibility")+ }+ }+ if err := av.SaveAttributeView(attrView); nil != err {+ t.Fatal(err)+ }+ cache.ClearAVCache()+ restored, err := av.ParseAttributeView(attrView.ID)+ if nil != err || getAttributeViewField(restored.Views[0], otherID).Hidden {+ t.Fatalf("list visibility was not persisted: %v", err)+ }+ if restored.Views[0].Table.Columns[1].Hidden {+ t.Fatal("list configuration must not affect stored table configuration")+ }+}++func TestAttributeViewListNewFieldVisibility(t *testing.T) {+ setupAttributeViewValidationTest(t)+ setAttributeViewListTestLangs()+ attrView := newAttributeViewWithLayout(ast.NewNodeID(), av.LayoutTypeList)+ view := attrView.Views[0]+ view.LayoutType = av.LayoutTypeTable+ key := av.NewKey(ast.NewNodeID(), "Added in table", "", av.KeyTypeText)+ addAttributeViewKey(attrView, view, key, "")+ view.LayoutType = av.LayoutTypeList+ if !getAttributeViewField(view, key.ID).Hidden {+ t.Fatal("fields added in another layout must be hidden in the list")+ }+ for _, column := range view.Table.Columns {+ if column.ID == key.ID && column.Hidden {+ t.Fatal("list fields must have independent visibility storage")+ }+ }+ activeKey := av.NewKey(ast.NewNodeID(), "Added in list", "", av.KeyTypeText)+ addAttributeViewKey(attrView, view, activeKey, key.ID)+ if getAttributeViewField(view, activeKey.ID).Hidden {+ t.Fatal("a field explicitly added to the active list should be visible")+ }+ removeAttributeViewFieldDefinition(attrView, key.ID)+ if nil != getAttributeViewField(view, key.ID) {+ t.Fatal("removed field remains in the list")+ }+}++func TestAttributeViewListDatabaseCreationKeys(t *testing.T) {+ setupAttributeViewValidationTest(t)+ setAttributeViewListTestLangs()+ attrView := newAttributeViewWithLayout(ast.NewNodeID(), av.LayoutTypeList)+ key := av.NewKey(ast.NewNodeID(), "Notes", "", av.KeyTypeText)+ if err := configureCreatedAttributeView(attrView, "Tasks", "Task", []*av.Key{key}); nil != err {+ t.Fatal(err)+ }+ cache.ClearAVCache()+ attrView, err := av.ParseAttributeView(attrView.ID)+ if nil != err {+ t.Fatal(err)+ }+ assertListDefaultFields(t, attrView, attrView.Views[0])+}++func TestAttributeViewListRenderAndExport(t *testing.T) {+ setupAttributeViewValidationTest(t)+ attrView, view, ids := newAttributeViewRowSortTestData(av.LayoutTypeList)+ view.List = newAttributeViewListLayout(attrView, nil)+ view.PageSize = 2+ viewable := sql.RenderView(attrView, view, "", false)+ if av.LayoutTypeList != viewable.GetType() {+ t.Fatalf("unexpected rendered type: %s", viewable.GetType())+ }+ if _, _, err := renderViewableInstance(viewable, view, attrView, 1, 2, false, "", sql.NewAttributeViewRenderContext()); nil != err {+ t.Fatal(err)+ }+ list := viewable.(*av.List)+ if list.RowCount != 4 || len(list.Rows) != 2 || list.Rows[0].ID != ids[1] || list.Rows[1].ID != ids[0] {+ t.Fatalf("unexpected sorted and paged list: %+v", list.Rows)+ }+ if list.Columns[0].Hidden || !list.Columns[1].Hidden {+ t.Fatal("rendering must preserve default list visibility")+ }+ // 导出读取列表布局字段,不能改写保留的表格字段设置。+ before := append([]*av.ViewTableColumn(nil), view.Table.Columns...)+ table := getAttrViewTable(attrView, view, "")+ if len(table.Columns) != 2 || !table.Columns[1].Hidden || !reflect.DeepEqual(before, view.Table.Columns) {+ t.Fatal("export changed layout fields or lost list visibility")+ }+}++func TestAttributeViewListRetainedLayouts(t *testing.T) {+ setupAttributeViewValidationTest(t)+ setAttributeViewListTestLangs()+ attrView := newAttributeViewWithLayout(ast.NewNodeID(), av.LayoutTypeList)+ view := attrView.Views[0]+ otherID := attrView.KeyValues[1].Key.ID+ getAttributeViewField(view, otherID).Hidden = false+ if err := av.SaveAttributeView(attrView); nil != err {+ t.Fatal(err)+ }+ duplicateID := ast.NewNodeID()+ if err := duplicateAttributeViewKey(&Operation{AvID: attrView.ID, KeyID: otherID, NextID: duplicateID}); nil != err {+ t.Fatal(err)+ }+ attrView, err := av.ParseAttributeView(attrView.ID)+ if nil != err {+ t.Fatal(err)+ }+ view = attrView.Views[0]+ if nil == getAttributeViewField(view, duplicateID) {+ t.Fatal("duplicated field is missing from the active list")+ }+ if err = changeAttrViewLayout(attrView, view, av.LayoutTypeTable); nil != err {+ t.Fatal(err)+ }+ if nil == getAttributeViewField(view, duplicateID) {+ t.Fatal("duplicated field is missing from the retained table")+ }+ copy := av.NewTableView()+ if err = cloneAttributeViewLayouts(copy, view); nil != err {+ t.Fatal(err)+ }+ if copy.List.Columns[1].Hidden || copy.List.Columns[1].BaseField == view.List.Columns[1].BaseField {+ t.Fatal("copying a table must retain an independent copy of its list settings")+ }+ copy.List.Columns[1].Hidden = true+ if view.List.Columns[1].Hidden {+ t.Fatal("changing copied list settings changed the source view")+ }+}++func TestAttributeViewListInvalidLayoutPreservesSource(t *testing.T) {+ setupAttributeViewValidationTest(t)+ setAttributeViewListTestLangs()+ attrView := newAttributeViewWithLayout(ast.NewNodeID(), av.LayoutTypeList)+ if err := av.SaveAttributeView(attrView); nil != err {+ t.Fatal(err)+ }+ path := av.GetAttributeViewDataPath(attrView.ID)+ original, err := os.ReadFile(path)+ if nil != err {+ t.Fatal(err)+ }+ attrView.Views[0].List = nil+ if err = av.SaveAttributeView(attrView); nil == err {+ t.Fatal("saving a list without a layout must fail")+ }+ preserved, err := os.ReadFile(path)+ if nil != err || !bytes.Equal(original, preserved) {+ t.Fatalf("failed save modified the source: %v", err)+ }+ corrupt, err := json.Marshal(attrView)+ if nil != err {+ t.Fatal(err)+ }+ if err = os.WriteFile(path, corrupt, 0600); nil != err {+ t.Fatal(err)+ }+ cache.ClearAVCache()+ if _, err = av.ParseAttributeView(attrView.ID); nil == err {+ t.Fatal("reading a list without a layout must fail")+ }+ preserved, err = os.ReadFile(path)+ if nil != err || !bytes.Equal(corrupt, preserved) {+ t.Fatalf("failed read modified the corrupt source: %v", err)+ }+}diff --git a/kernel/model/attribute_view_render.go b/kernel/model/attribute_view_render.goindex cbab20cfe8..f3dc378979 100644--- a/kernel/model/attribute_view_render.go+++ b/kernel/model/attribute_view_render.go@@ -265,6 +265,8 @@ func getAttributeViewBaseInstance(viewable av.Viewable) (ret *av.BaseInstance) {switch instance := viewable.(type) {case *av.Table:ret = instance.BaseInstance+ case *av.List:+ ret = instance.BaseInstancecase *av.Gallery:ret = instance.BaseInstancecase *av.Kanban:@@ -287,15 +289,15 @@ func GetAttributeViewPasteRows(blockID, avID, viewID, groupID, query, startItemIreturn nil, nil, err}- table, ok := viewable.(*av.Table)- if !ok {+ table = av.TableFromViewable(viewable)+ if nil == table {return nil, nil, fmt.Errorf("attribute view [%s] is not a table", avID)}if "" != groupID {var groupTable *av.Tablefor _, group := range table.Groups {if group.GetID() == groupID {- groupTable, _ = group.(*av.Table)+ groupTable = av.TableFromViewable(group)break}}@@ -493,7 +495,7 @@ func renderAttributeViewWithTarget(blockID, avID, viewID, query string, page, pafunc newAttributeViewWithLayout(avID string, initialLayout av.LayoutType) (ret *av.AttributeView) {ret = av.NewAttributeView(avID)switch initialLayout {- case av.LayoutTypeGallery, av.LayoutTypeKanban:+ case av.LayoutTypeList, av.LayoutTypeGallery, av.LayoutTypeKanban:default:return}@@ -514,6 +516,9 @@ const ()func renderAttributeView(attrView *av.AttributeView, nodeID, viewID, carrierViewID, query string, page, pageSize int, groupPaging map[string]any, ignoreRows, writable bool, target *AttributeViewRenderTarget, targetGroupID string) (viewable av.Viewable, err error) {+ if err = attrView.ValidateListLayouts(); nil != err {+ return+ }// 获取待渲染的视图view, err := getRenderAttributeViewView(attrView, viewID, carrierViewID, nodeID, writable)if nil != err {@@ -725,8 +730,8 @@ func renderAttributeViewGroups(viewable av.Viewable, attrView *av.AttributeView,// 将分组视图的分组字段清空,减少冗余(字段信息可以在总的视图 view 对象上获取到)switch groupView.LayoutType {- case av.LayoutTypeTable:- groupView.Table.Columns = nil+ case av.LayoutTypeTable, av.LayoutTypeList:+ groupView.GetTableLayout().Columns = nilcase av.LayoutTypeGallery:groupView.Gallery.CardFields = nilcase av.LayoutTypeKanban:@@ -772,8 +777,8 @@ func hideEmptyGroupViews(view *av.View, viewable av.Viewable) {itemCount := 0switch viewable.GetType() {- case av.LayoutTypeTable:- itemCount = viewable.(*av.Table).RowCount+ case av.LayoutTypeTable, av.LayoutTypeList:+ itemCount = av.TableFromViewable(viewable).RowCountcase av.LayoutTypeGallery:itemCount = viewable.(*av.Gallery).CardCountcase av.LayoutTypeKanban:@@ -1007,8 +1012,8 @@ func shouldDeferAttributeViewTemplateValues(attrView *av.AttributeView, view *avreturn templateKeyIDs[fieldID] && nil != calc && av.CalcOperatorNone != calc.Operator}switch view.LayoutType {- case av.LayoutTypeTable:- for _, column := range view.Table.Columns {+ case av.LayoutTypeTable, av.LayoutTypeList:+ for _, column := range view.GetTableLayout().Columns {if nil != column && nil != column.BaseField && checkField(column.ID, column.Calc) {return false}@@ -1068,8 +1073,8 @@ func renderViewableInstance(viewable av.Viewable, view *av.View, attrView *av.At// 分页switch viewable.GetType() {- case av.LayoutTypeTable:- table := viewable.(*av.Table)+ case av.LayoutTypeTable, av.LayoutTypeList:+ table := av.TableFromViewable(viewable)targetIndex = findAttributeViewTargetIndex(targetItemID, len(table.Rows), func(index int) string { return table.Rows[index].ID })table.RowCount = len(table.Rows)table.PageSize = view.PageSizediff --git a/kernel/model/attribute_view_row_sort_test.go b/kernel/model/attribute_view_row_sort_test.goindex 333cd41fe5..e0bd6022ff 100644--- a/kernel/model/attribute_view_row_sort_test.go+++ b/kernel/model/attribute_view_row_sort_test.go@@ -19,6 +19,9 @@ func newAttributeViewRowSortTestData(layout av.LayoutType) (*av.AttributeView, *number.Key.Type = av.KeyTypeNumbernumber.Key.NumberFormat = av.NumberFormatNoneview.LayoutType = layout+ if av.LayoutTypeList == layout {+ view.List = newAttributeViewListLayout(attrView, nil)+ }view.Gallery = av.NewLayoutGallery()view.Gallery.CoverFrom = av.CoverFromNoneview.Kanban = av.NewLayoutKanban()@@ -47,7 +50,7 @@ func newAttributeViewRowSortTestData(layout av.LayoutType) (*av.AttributeView, *func TestAttributeViewRowSortPreviewPersistenceAndUndo(t *testing.T) {setupAttributeViewValidationTest(t)- for _, layout := range []av.LayoutType{av.LayoutTypeTable, av.LayoutTypeGallery, av.LayoutTypeKanban} {+ for _, layout := range []av.LayoutType{av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeGallery, av.LayoutTypeKanban} {t.Run(string(layout), func(t *testing.T) {attrView, view, ids := newAttributeViewRowSortTestData(layout)// 用单页和过滤规则验证预览仍然保存完整条目顺序。@@ -194,7 +197,7 @@ func TestAttributeViewRowSortMultiSelectionAndAnchors(t *testing.T) {func TestAttributeViewRowSortPreviewDoesNotSaveFieldRepairs(t *testing.T) {setupAttributeViewValidationTest(t)- for _, layout := range []av.LayoutType{av.LayoutTypeTable, av.LayoutTypeGallery, av.LayoutTypeKanban} {+ for _, layout := range []av.LayoutType{av.LayoutTypeTable, av.LayoutTypeList, av.LayoutTypeGallery, av.LayoutTypeKanban} {t.Run(string(layout), func(t *testing.T) {attrView, view, ids := newAttributeViewRowSortTestData(layout)missing := &av.BaseField{ID: ast.NewNodeID()}diff --git a/kernel/model/export.go b/kernel/model/export.goindex ffcfd39da0..0e02865da7 100644--- a/kernel/model/export.go+++ b/kernel/model/export.go@@ -4793,6 +4793,8 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees map[stringfunc getAttrViewTable(attrView *av.AttributeView, view *av.View, query string) (ret *av.Table) {switch view.LayoutType {+ case av.LayoutTypeList:+ // 列表复用行列导出,读取独立列表布局中的字段顺序和显隐设置。case av.LayoutTypeGallery:view.Table = av.NewLayoutTable()for _, field := range view.Gallery.CardFields {diff --git a/kernel/model/publish_access.go b/kernel/model/publish_access.goindex c3aacf3b68..b69a101d09 100644--- a/kernel/model/publish_access.go+++ b/kernel/model/publish_access.go@@ -578,8 +578,8 @@ func FilterViewByPublishAccess(c *gin.Context, publishAccess PublishAccess, viewret = viewableswitch ret.GetType() {- case av.LayoutTypeTable:- table := ret.(*av.Table)+ case av.LayoutTypeTable, av.LayoutTypeList:+ table := av.TableFromViewable(ret)filteredRows := []*av.TableRow{}for _, row := range table.Rows {if checkAttributeViewItemAccessableByPublishAccess(c, publishAccess, row) {@@ -735,8 +735,8 @@ func (filter *attributeViewPublishAccessFilter) filterViewable(attrView *av.Attr}switch viewable.GetType() {- case av.LayoutTypeTable:- table := viewable.(*av.Table)+ case av.LayoutTypeTable, av.LayoutTypeList:+ table := av.TableFromViewable(viewable)filter.filterGroupValue(attrView, table.BaseInstance)for _, row := range table.Rows {if nil == row {diff --git a/kernel/model/template.go b/kernel/model/template.goindex cbb8b578b0..7dc22fda9a 100644--- a/kernel/model/template.go+++ b/kernel/model/template.go@@ -785,6 +785,11 @@ func applyTemplateAttributeViewPlan(node *ast.Node, plan *templateAttributeViewPfunc templateAttributeViewPreviewTable(node *ast.Node, plan *templateAttributeViewPlan) *ast.Node {view := *plan.selectedView+ if nil != plan.selectedView.List {+ list := *plan.selectedView.List+ list.Columns = append([]*av.ViewTableColumn(nil), plan.selectedView.List.Columns...)+ view.List = &list+ }if nil != plan.selectedView.Table {table := *plan.selectedView.Tabletable.Columns = append([]*av.ViewTableColumn(nil), plan.selectedView.Table.Columns...)diff --git a/kernel/sql/av.go b/kernel/sql/av.goindex 0c683830e4..de24f32d33 100644--- a/kernel/sql/av.go+++ b/kernel/sql/av.go@@ -176,11 +176,11 @@ func RenderGroupViewWithSourceContext(attrView *av.AttributeView, view, groupViesource *GroupViewRenderSource, ignoreRows bool, context *AttributeViewRenderContext) (ret av.Viewable) {var err errorswitch groupView.LayoutType {- case av.LayoutTypeTable:+ case av.LayoutTypeTable, av.LayoutTypeList:// 这里需要使用深拷贝,因为字段上可能会带有计算(FieldCalc),每个分组视图的计算结果都需要分别存储在不同的字段实例上- err = copier.CopyWithOption(&groupView.Table.Columns, &view.Table.Columns, copier.Option{DeepCopy: true})- groupView.Table.ShowIcon = view.Table.ShowIcon- groupView.Table.WrapField = view.Table.WrapField+ err = copier.CopyWithOption(&groupView.GetTableLayout().Columns, &view.GetTableLayout().Columns, copier.Option{DeepCopy: true})+ groupView.GetTableLayout().ShowIcon = view.GetTableLayout().ShowIcon+ groupView.GetTableLayout().WrapField = view.GetTableLayout().WrapFieldcase av.LayoutTypeGallery:err = copier.CopyWithOption(&groupView.Gallery.CardFields, &view.Gallery.CardFields, copier.Option{DeepCopy: true})groupView.Gallery.ShowIcon = view.Gallery.ShowIcon@@ -216,8 +216,8 @@ func RenderGroupViewWithSourceContext(attrView *av.AttributeView, view, groupVieif nil != err {logging.LogErrorf("copy view fields [%s] to group [%s] failed: %s", view.ID, groupView.ID, err)switch groupView.LayoutType {- case av.LayoutTypeTable:- groupView.Table.Columns = view.Table.Columns+ case av.LayoutTypeTable, av.LayoutTypeList:+ groupView.GetTableLayout().Columns = view.GetTableLayout().Columnscase av.LayoutTypeGallery:groupView.Gallery.CardFields = view.Gallery.CardFieldscase av.LayoutTypeKanban:@@ -307,6 +307,8 @@ func renderView(attrView *av.AttributeView, view *av.View, query string, depth *case av.LayoutTypeTable:ret = renderAttributeViewTable(attrView, view, query, depth, cachedAttrViews, ignoreRows, deferTemplateValues,renderContext)+ case av.LayoutTypeList:+ ret = &av.List{Table: renderAttributeViewTable(attrView, view, query, depth, cachedAttrViews, ignoreRows, deferTemplateValues, renderContext)}case av.LayoutTypeGallery:ret = renderAttributeViewGallery(attrView, view, query, depth, cachedAttrViews, ignoreRows, deferTemplateValues,renderContext)@@ -1185,10 +1187,13 @@ func removeMissingField(attrView *av.AttributeView, view *av.View, missingKeyIDlogging.LogWarnf("key [%s] is missing", missingKeyID)changed := false- if nil != view.Table {- for i, column := range view.Table.Columns {+ for _, layout := range []*av.LayoutTable{view.Table, view.List} {+ if nil == layout {+ continue+ }+ for i, column := range layout.Columns {if column.ID == missingKeyID {- view.Table.Columns = append(view.Table.Columns[:i], view.Table.Columns[i+1:]...)+ layout.Columns = append(layout.Columns[:i], layout.Columns[i+1:]...)changed = truebreak}diff --git a/kernel/sql/av_group_test.go b/kernel/sql/av_group_test.goindex d801c2f70a..8453d844d3 100644--- a/kernel/sql/av_group_test.go+++ b/kernel/sql/av_group_test.go@@ -74,6 +74,21 @@ func TestRenderGroupViewWithSourceReusesCardLayouts(t *testing.T) {getItems func(viewable av.Viewable) []av.ItemnewTestItem func(id string) av.Item}{+ {+ name: "list",+ newView: func(id string) *av.View {+ view := &av.View{ID: id, LayoutType: av.LayoutTypeList, List: av.NewLayoutList()}+ view.List.Columns = []*av.ViewTableColumn{{BaseField: &av.BaseField{ID: key.ID, Hidden: true}}}+ return view+ },+ newParent: func(view *av.View, items []av.Item) av.Viewable {+ list := &av.List{Table: &av.Table{BaseInstance: av.NewViewBaseInstance(view)}}+ list.SetItems(items)+ return list+ },+ getItems: func(viewable av.Viewable) []av.Item { return viewable.(*av.List).GetItems() },+ newTestItem: func(id string) av.Item { return &av.TableRow{ID: id} },+ },{name: "gallery",newView: func(id string) *av.View {diff --git a/kernel/sql/av_table.go b/kernel/sql/av_table.goindex ad6d02318f..335dbdcbeb 100644--- a/kernel/sql/av_table.go+++ b/kernel/sql/av_table.go@@ -32,8 +32,9 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View, query sif !ignoreRows && !deferTemplateValues {viewable := attrView.RenderedViewables[view.ID]if nil != viewable {- ret = viewable.(*av.Table)- return+ if ret = av.TableFromViewable(viewable); nil != ret {+ return+ }}}@@ -44,7 +45,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View, query s}// 组装列- for _, col := range view.Table.Columns {+ for _, col := range view.GetTableLayout().Columns {key, getErr := attrView.GetKey(col.ID)if nil != getErr {// 找不到字段则在视图中删除(元数据查询场景不写盘)@@ -61,7 +62,7 @@ func renderAttributeViewTable(attrView *av.AttributeView, view *av.View, query sType: key.Type,Icon: key.Icon,Wrap: col.Wrap,- Hidden: col.Hidden,+ Hidden: col.Hidden && !(av.LayoutTypeList == view.LayoutType && av.KeyTypeBlock == key.Type),Desc: key.Desc,Calc: col.Calc,Options: key.Options,