An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Add `Default fill specific time` switch to database date field https://github.com/siyuan-note/siyuan/issues/12089
Daniel0147a6573d6a
diff --git a/app/appearance/langs/ar_SA.json b/app/appearance/langs/ar_SA.jsonindex bdefc8dab0..b32209648f 100644--- a/app/appearance/langs/ar_SA.json+++ b/app/appearance/langs/ar_SA.json@@ -128,6 +128,7 @@"unbindBlock": "فك ربط الكتلة","showTitle": "عرض عنوان قاعدة البيانات","fillCreated": "ملء وقت الإنشاء افتراضياً",+ "fillSpecificTime": "ملء الوقت المحدد افتراضيًا","removeCard": "إزالة بطاقة تعليمية","updateLayout": "تحديث التصميم","dndFolderTip": "يرجى ملاحظة أن ${x} يقوم فقط بإدراج رابط file:// ولا يقوم بنسخ الملف",diff --git a/app/appearance/langs/de_DE.json b/app/appearance/langs/de_DE.jsonindex 819056bc26..651680e08d 100644--- a/app/appearance/langs/de_DE.json+++ b/app/appearance/langs/de_DE.json@@ -128,6 +128,7 @@"unbindBlock": "Block entkoppeln","showTitle": "Datenbanktitel anzeigen","fillCreated": "Standardfüllzeit erstellen",+ "fillSpecificTime": "Standardmäßig bestimmte Zeit ausfüllen","removeCard": "Karte entfernen","updateLayout": "Layout aktualisieren","dndFolderTip": "Bitte beachten Sie, dass ${x} nur den file:// Hyperlink einfügt und die Datei nicht kopiert.",diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex 7947ab32bf..9201246057 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -128,6 +128,7 @@"unbindBlock": "Unbind block","showTitle": "Show database title","fillCreated": "Default fill created time",+ "fillSpecificTime": "Default fill specific time","removeCard": "Remove flashcard","updateLayout": "Update layout","dndFolderTip": "Please note that ${x} only inserts the file:// hyperlink and does not copy the file",diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex 632da1e4a4..85eb31afd8 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -128,6 +128,7 @@"unbindBlock": "Desvincular bloque","showTitle": "Mostrar título de la base de datos","fillCreated": "Hora de creación del relleno predeterminado",+ "fillSpecificTime": "Rellenar hora específica por defecto","removeCard": "Eliminar tarjeta flash","updateLayout": "Actualizar diseño","dndFolderTip": "Tenga en cuenta que ${x} solo inserta el hipervínculo file:// y no copia el archivo",diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex fbfdefecb1..9ea6ee2ce5 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -128,6 +128,7 @@"unbindBlock": "Dissocier le bloc","showTitle": "Afficher le titre de la base de données","fillCreated": "Heure de création de remplissage par défaut",+ "fillSpecificTime": "Remplir l'heure spécifique par défaut","removeCard": "Supprimer la flashcard","updateLayout": "Mettre à jour la mise en page","dndFolderTip": "Veuillez noter que ${x} insère uniquement le lien hypertexte file:// et ne copie pas le fichier",diff --git a/app/appearance/langs/he_IL.json b/app/appearance/langs/he_IL.jsonindex 27aa75cf4b..e729e1d5fb 100644--- a/app/appearance/langs/he_IL.json+++ b/app/appearance/langs/he_IL.json@@ -128,6 +128,7 @@"unbindBlock": "שחרר בלוק","showTitle": "הצג כותרת מסד נתונים","fillCreated": "מלא את זמן היצירה ברירת מחדל",+ "fillSpecificTime": "מילוי זמן מסוים כברירת מחדל","removeCard": "הסר כרטיסון","updateLayout": "עדכן עימוד","dndFolderTip": "שים לב כי ${x} ניחש את ה-hyperlink file:// ואינו מעתיק את הקובץ",diff --git a/app/appearance/langs/it_IT.json b/app/appearance/langs/it_IT.jsonindex 8ed125a4b8..b81d9ff956 100644--- a/app/appearance/langs/it_IT.json+++ b/app/appearance/langs/it_IT.json@@ -128,6 +128,7 @@"unbindBlock": "Scollega blocco","showTitle": "Mostra titolo del database","fillCreated": "Compilazione automatica del tempo di creazione",+ "fillSpecificTime": "Compila l'orario specifico di default","removeCard": "Rimuovi flashcard","updateLayout": "Aggiorna layout","dndFolderTip": "Nota che ${x} inserisce solo il collegamento file:// e non copia il file",diff --git a/app/appearance/langs/ja_JP.json b/app/appearance/langs/ja_JP.jsonindex b0e1faa0ab..88d23a14ff 100644--- a/app/appearance/langs/ja_JP.json+++ b/app/appearance/langs/ja_JP.json@@ -128,6 +128,7 @@"unbindBlock": "ブロックのバインドを解除","showTitle": "データベースのタイトルを表示","fillCreated": "デフォルトで作成時間を入力",+ "fillSpecificTime": "デフォルトで具体的な時間を入力","removeCard": "フラッシュカードを削除","updateLayout": "レイアウトを更新","dndFolderTip": "${x} は file:// 形式のハイパーリンクを挿入するだけでファイルはコピーされないので注意してください",diff --git a/app/appearance/langs/pl_PL.json b/app/appearance/langs/pl_PL.jsonindex ee2e55f0e1..a816a7987c 100644--- a/app/appearance/langs/pl_PL.json+++ b/app/appearance/langs/pl_PL.json@@ -128,6 +128,7 @@"unbindBlock": "Odłącz blok","showTitle": "Pokaż tytuł bazy danych","fillCreated": "Domyślnie wypełnij czas utworzenia",+ "fillSpecificTime": "Domyślnie wypełnij konkretny czas","removeCard": "Usuń fiszkę","updateLayout": "Zaktualizuj układ","dndFolderTip": "Proszę pamiętać, że ${x} tylko wstawia link file:// i nie kopiuje pliku",diff --git a/app/appearance/langs/pt_BR.json b/app/appearance/langs/pt_BR.jsonindex b684bdb9a6..e39490f6be 100644--- a/app/appearance/langs/pt_BR.json+++ b/app/appearance/langs/pt_BR.json@@ -128,6 +128,7 @@"unbindBlock": "Desvincular bloco","showTitle": "Mostrar título do banco de dados","fillCreated": "Preencher automaticamente a hora de criação",+ "fillSpecificTime": "Preencher horário específico por padrão","removeCard": "Remover cartão de memorização","updateLayout": "Atualizar layout","dndFolderTip": "Observe que ${x} apenas insere o hiperlink file:// e não copia o arquivo",diff --git a/app/appearance/langs/ru_RU.json b/app/appearance/langs/ru_RU.jsonindex 9f0c2e67a4..bb70775075 100644--- a/app/appearance/langs/ru_RU.json+++ b/app/appearance/langs/ru_RU.json@@ -128,6 +128,7 @@"unbindBlock": "Отвязать блок","showTitle": "Показать заголовок базы данных","fillCreated": "Заполнить время создания по умолчанию",+ "fillSpecificTime": "Заполнить конкретное время по умолчанию","removeCard": "Удалить карточку","updateLayout": "Обновить макет","dndFolderTip": "Пожалуйста, обратите внимание, что ${x} только вставляет файл:// гиперссылку и не копирует файл",diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex 06fd737de1..fccf54baeb 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -128,6 +128,7 @@"unbindBlock": "取消綁定塊","showTitle": "顯示資料庫標題","fillCreated": "預設填滿創建時間",+ "fillSpecificTime": "預設填入具體時間","removeCard": "移除閃卡","updateLayout": "更新版面配置","dndFolderTip": "請注意 ${x} 僅插入 file:// 超鏈接,不複製檔案",diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex 292a763bd0..f26fa27e2c 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -128,6 +128,7 @@"unbindBlock": "取消绑定块","showTitle": "显示数据库标题","fillCreated": "默认填充创建时间",+ "fillSpecificTime": "默认填充具体时间","removeCard": "移除闪卡","updateLayout": "更新布局","dndFolderTip": "请注意 ${x} 仅插入 file:// 超链接,不复制文件",diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.tsindex 17bce4717f..a27e17ca12 100644--- a/app/src/protyle/render/av/col.ts+++ b/app/src/protyle/render/av/col.ts@@ -182,6 +182,11 @@ export const getEditHTML = (options: {<span class="fn__flex-center">${window.siyuan.languages.fillCreated}</span><span class="fn__space fn__flex-1"></span><input data-type="fillCreated" type="checkbox" class="b3-switch b3-switch--menu" ${colData.date?.autoFillNow ? "checked" : ""}>+</label>+<label class="b3-menu__item">+ <span class="fn__flex-center">${window.siyuan.languages.fillSpecificTime}</span>+ <span class="fn__space fn__flex-1"></span>+ <input data-type="fillSpecificTime" type="checkbox" class="b3-switch b3-switch--menu" ${colData.date?.fillSpecificTime ? "checked" : ""}></label>`;}html += `<button class="b3-menu__separator" data-id="separator_3"></button>@@ -439,18 +444,35 @@ export const bindEditEvent = (options: {fillCreatedElement.addEventListener("change", () => {transaction(options.protyle, [{avID,- action: "setAttrViewColDate",+ action: "setAttrViewColDateFillCreated",id: colId,data: fillCreatedElement.checked}], [{avID,- action: "setAttrViewColDate",+ action: "setAttrViewColDateFillCreated",id: colId,data: !fillCreatedElement.checked}]);});}+ const fillSpecificTimeElement = options.menuElement.querySelector('[data-type="fillSpecificTime"]') as HTMLInputElement;+ if (fillSpecificTimeElement) {+ fillSpecificTimeElement.addEventListener("change", () => {+ transaction(options.protyle, [{+ avID,+ action: "setAttrViewColDateFillSpecificTime",+ id: colId,+ data: fillSpecificTimeElement.checked+ }], [{+ avID,+ action: "setAttrViewColDateFillSpecificTime",+ id: colId,+ data: !fillSpecificTimeElement.checked+ }]);+ });+ }+const backRelationElement = options.menuElement.querySelector('[data-type="backRelation"]') as HTMLInputElement;if (backRelationElement) {backRelationElement.addEventListener("change", () => {diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex 52a587c767..b900f46dfb 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -58,7 +58,8 @@ type TOperation =| "setAttrViewFitImage"| "setAttrViewShowIcon"| "setAttrViewWrapField"- | "setAttrViewColDate"+ | "setAttrViewColDateFillCreated"+ | "setAttrViewColDateFillSpecificTime"| "setAttrViewViewDesc"| "setAttrViewColDesc"| "setAttrViewBlockView"@@ -942,6 +943,7 @@ interface IAVColumn {calc: IAVCalc,date?: {autoFillNow: boolean,+ fillSpecificTime: boolean,}// 选项列表options?: {diff --git a/kernel/av/av.go b/kernel/av/av.goindex 3cbe0752f2..195aa18869 100644--- a/kernel/av/av.go+++ b/kernel/av/av.go@@ -168,7 +168,8 @@ func (k *Key) GetOption(name string) (ret *SelectOption) {}type Date struct {- AutoFillNow bool `json:"autoFillNow"` // 是否自动填充当前时间 The database date field supports filling the current time by default https://github.com/siyuan-note/siyuan/issues/10823+ AutoFillNow bool `json:"autoFillNow"` // 是否自动填充当前时间 The database date field supports filling the current time by default https://github.com/siyuan-note/siyuan/issues/10823+ FillSpecificTime bool `json:"fillSpecificTime"` // 是否填充具体时间 Add `Default fill specific time` switch to database date field https://github.com/siyuan-note/siyuan/issues/12089}type Rollup struct {diff --git a/kernel/model/attribute_view.go b/kernel/model/attribute_view.goindex 64c3082320..71e3738f7b 100644--- a/kernel/model/attribute_view.go+++ b/kernel/model/attribute_view.go@@ -2147,15 +2147,15 @@ func GetCurrentAttributeViewImages(avID, viewID, query string) (ret []string, erreturn}-func (tx *Transaction) doSetAttrViewColDate(operation *Operation) (ret *TxErr) {- err := setAttributeViewColDate(operation)+func (tx *Transaction) doSetAttrViewColDateFillCreated(operation *Operation) (ret *TxErr) {+ err := setAttributeViewColDateFillCreated(operation)if err != nil {return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}}return}-func setAttributeViewColDate(operation *Operation) (err error) {+func setAttributeViewColDateFillCreated(operation *Operation) (err error) {attrView, err := av.ParseAttributeView(operation.AvID)if err != nil {return@@ -2172,7 +2172,35 @@ func setAttributeViewColDate(operation *Operation) (err error) {}key.Date.AutoFillNow = operation.Data.(bool)+ err = av.SaveAttributeView(attrView)+ return+}++func (tx *Transaction) doSetAttrViewColDateFillSpecificTime(operation *Operation) (ret *TxErr) {+ err := setAttrViewColDateFillSpecificTime(operation)+ if err != nil {+ return &TxErr{code: TxErrHandleAttributeView, id: operation.AvID, msg: err.Error()}+ }+ return+}++func setAttrViewColDateFillSpecificTime(operation *Operation) (err error) {+ attrView, err := av.ParseAttributeView(operation.AvID)+ if err != nil {+ return+ }++ keyID := operation.ID+ key, _ := attrView.GetKey(keyID)+ if nil == key || av.KeyTypeDate != key.Type {+ return+ }++ if nil == key.Date {+ key.Date = &av.Date{}+ }+ key.Date.FillSpecificTime = operation.Data.(bool)err = av.SaveAttributeView(attrView)return}diff --git a/kernel/model/transaction.go b/kernel/model/transaction.goindex 97f19b859d..201c808fdb 100644--- a/kernel/model/transaction.go+++ b/kernel/model/transaction.go@@ -275,8 +275,10 @@ func performTx(tx *Transaction) (ret *TxErr) {ret = tx.doUpdateAttrViewColRollup(op)case "hideAttrViewName":ret = tx.doHideAttrViewName(op)- case "setAttrViewColDate":- ret = tx.doSetAttrViewColDate(op)+ case "setAttrViewColDateFillCreated":+ ret = tx.doSetAttrViewColDateFillCreated(op)+ case "setAttrViewColDateFillSpecificTime":+ ret = tx.doSetAttrViewColDateFillSpecificTime(op)case "duplicateAttrViewKey":ret = tx.doDuplicateAttrViewKey(op)case "setAttrViewCoverFrom":