فهرست منبع

:art: https://github.com/siyuan-note/siyuan/issues/10823

Vanessa 1 سال پیش
والد
کامیت
149eb0da5a

+ 1 - 0
app/appearance/langs/en_US.json

@@ -1,4 +1,5 @@
 {
 {
+  "fillCreated": "Default fill created time",
   "removeCard": "Remove flashcard",
   "removeCard": "Remove flashcard",
   "updateLayout": "Update layout",
   "updateLayout": "Update layout",
   "dndFolderTip": "Please note that ${x} only inserts the file:// hyperlink and does not copy the file",
   "dndFolderTip": "Please note that ${x} only inserts the file:// hyperlink and does not copy the file",

+ 1 - 0
app/appearance/langs/es_ES.json

@@ -1,4 +1,5 @@
 {
 {
+  "fillCreated": "Hora de creación del relleno predeterminado",
   "removeCard": "Eliminar tarjeta flash",
   "removeCard": "Eliminar tarjeta flash",
   "updateLayout": "Actualizar diseño",
   "updateLayout": "Actualizar diseño",
   "dndFolderTip": "Tenga en cuenta que ${x} solo inserta el hipervínculo file:// y no copia el archivo",
   "dndFolderTip": "Tenga en cuenta que ${x} solo inserta el hipervínculo file:// y no copia el archivo",

+ 1 - 0
app/appearance/langs/fr_FR.json

@@ -1,4 +1,5 @@
 {
 {
+  "fillCreated": "Heure de création de remplissage par défaut",
   "removeCard": "Supprimer la flashcard",
   "removeCard": "Supprimer la flashcard",
   "updateLayout": "Mettre à jour la mise en page",
   "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",
   "dndFolderTip": "Veuillez noter que ${x} insère uniquement le lien hypertexte file:// et ne copie pas le fichier",

+ 1 - 0
app/appearance/langs/zh_CHT.json

@@ -1,4 +1,5 @@
 {
 {
+  "fillCreated": "Default fill creation time",
   "removeCard": "移除閃卡",
   "removeCard": "移除閃卡",
   "updateLayout": "更新版面配置",
   "updateLayout": "更新版面配置",
   "dndFolderTip": "請注意 ${x} 僅插入 file:// 超鏈接,不複製檔案",
   "dndFolderTip": "請注意 ${x} 僅插入 file:// 超鏈接,不複製檔案",

+ 1 - 0
app/appearance/langs/zh_CN.json

@@ -1,4 +1,5 @@
 {
 {
+  "fillCreated": "默认填充创建时间",
   "removeCard": "移除闪卡",
   "removeCard": "移除闪卡",
   "updateLayout": "更新布局",
   "updateLayout": "更新布局",
   "dndFolderTip": "请注意 ${x} 仅插入 file:// 超链接,不复制文件",
   "dndFolderTip": "请注意 ${x} 仅插入 file:// 超链接,不复制文件",

+ 18 - 2
app/src/protyle/render/av/col.ts

@@ -195,9 +195,9 @@ export const getEditHTML = (options: {
     } else if (colData.type === "date") {
     } else if (colData.type === "date") {
         html += `<button class="b3-menu__separator"></button>
         html += `<button class="b3-menu__separator"></button>
 <label class="b3-menu__item">
 <label class="b3-menu__item">
-    <span class="fn__flex-center">${window.siyuan.languages.backRelation}</span>
+    <span class="fn__flex-center">${window.siyuan.languages.fillCreated}</span>
     <span class="fn__space fn__flex-1"></span>
     <span class="fn__space fn__flex-1"></span>
-    <input data-type="backRelation" type="checkbox" class="b3-switch b3-switch--menu" ${colData.relation?.isTwoWay ? "checked" : ""}>
+    <input data-type="fillCreated" type="checkbox" class="b3-switch b3-switch--menu" ${colData.date?.autoFillNow ? "checked" : ""}>
 </label>`;
 </label>`;
     }
     }
     return `<div class="b3-menu__items">
     return `<div class="b3-menu__items">
@@ -371,6 +371,22 @@ export const bindEditEvent = (options: {
             }
             }
         });
         });
     }
     }
+    const fillCreatedElement = options.menuElement.querySelector('[data-type="fillCreated"]') as HTMLInputElement;
+    if (fillCreatedElement) {
+        fillCreatedElement.addEventListener("change", () => {
+            transaction(options.protyle, [{
+                avID,
+                action: "setAttrViewColDate",
+                id: colId,
+                data: fillCreatedElement.checked
+            }], [{
+                avID,
+                action: "setAttrViewColDate",
+                id: colId,
+                data: !fillCreatedElement.checked
+            }]);
+        });
+    }
 
 
     const backRelationElement = options.menuElement.querySelector('[data-type="backRelation"]') as HTMLInputElement;
     const backRelationElement = options.menuElement.querySelector('[data-type="backRelation"]') as HTMLInputElement;
     if (backRelationElement) {
     if (backRelationElement) {

+ 4 - 0
app/src/types/index.d.ts

@@ -49,6 +49,7 @@ type TOperation =
     | "moveOutlineHeading"
     | "moveOutlineHeading"
     | "updateAttrViewColRollup"
     | "updateAttrViewColRollup"
     | "hideAttrViewName"
     | "hideAttrViewName"
+    | "setAttrViewColDate"
 type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins"
 type TBazaarType = "templates" | "icons" | "widgets" | "themes" | "plugins"
 type TCardType = "doc" | "notebook" | "all"
 type TCardType = "doc" | "notebook" | "all"
 type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
 type TEventBus = "ws-main" | "sync-start" | "sync-end" | "sync-fail" |
@@ -813,6 +814,9 @@ interface IAVColumn {
     numberFormat: string,
     numberFormat: string,
     template: string,
     template: string,
     calc: IAVCalc,
     calc: IAVCalc,
+    date?: {
+        autoFillNow: boolean,
+    }
     // 选项列表
     // 选项列表
     options?: {
     options?: {
         name: string,
         name: string,