mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Add Default fill specific time switch to database date field https://github.com/siyuan-note/siyuan/issues/12089
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
e6a9db0253
commit
0147a6573d
18 changed files with 77 additions and 9 deletions
|
|
@ -128,6 +128,7 @@
|
|||
"unbindBlock": "فك ربط الكتلة",
|
||||
"showTitle": "عرض عنوان قاعدة البيانات",
|
||||
"fillCreated": "ملء وقت الإنشاء افتراضياً",
|
||||
"fillSpecificTime": "ملء الوقت المحدد افتراضيًا",
|
||||
"removeCard": "إزالة بطاقة تعليمية",
|
||||
"updateLayout": "تحديث التصميم",
|
||||
"dndFolderTip": "يرجى ملاحظة أن ${x} يقوم فقط بإدراج رابط file:// ولا يقوم بنسخ الملف",
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@
|
|||
"unbindBlock": "שחרר בלוק",
|
||||
"showTitle": "הצג כותרת מסד נתונים",
|
||||
"fillCreated": "מלא את זמן היצירה ברירת מחדל",
|
||||
"fillSpecificTime": "מילוי זמן מסוים כברירת מחדל",
|
||||
"removeCard": "הסר כרטיסון",
|
||||
"updateLayout": "עדכן עימוד",
|
||||
"dndFolderTip": "שים לב כי ${x} ניחש את ה-hyperlink file:// ואינו מעתיק את הקובץ",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@
|
|||
"unbindBlock": "ブロックのバインドを解除",
|
||||
"showTitle": "データベースのタイトルを表示",
|
||||
"fillCreated": "デフォルトで作成時間を入力",
|
||||
"fillSpecificTime": "デフォルトで具体的な時間を入力",
|
||||
"removeCard": "フラッシュカードを削除",
|
||||
"updateLayout": "レイアウトを更新",
|
||||
"dndFolderTip": "${x} は file:// 形式のハイパーリンクを挿入するだけでファイルはコピーされないので注意してください",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@
|
|||
"unbindBlock": "Отвязать блок",
|
||||
"showTitle": "Показать заголовок базы данных",
|
||||
"fillCreated": "Заполнить время создания по умолчанию",
|
||||
"fillSpecificTime": "Заполнить конкретное время по умолчанию",
|
||||
"removeCard": "Удалить карточку",
|
||||
"updateLayout": "Обновить макет",
|
||||
"dndFolderTip": "Пожалуйста, обратите внимание, что ${x} только вставляет файл:// гиперссылку и не копирует файл",
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@
|
|||
"unbindBlock": "取消綁定塊",
|
||||
"showTitle": "顯示資料庫標題",
|
||||
"fillCreated": "預設填滿創建時間",
|
||||
"fillSpecificTime": "預設填入具體時間",
|
||||
"removeCard": "移除閃卡",
|
||||
"updateLayout": "更新版面配置",
|
||||
"dndFolderTip": "請注意 ${x} 僅插入 file:// 超鏈接,不複製檔案",
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@
|
|||
"unbindBlock": "取消绑定块",
|
||||
"showTitle": "显示数据库标题",
|
||||
"fillCreated": "默认填充创建时间",
|
||||
"fillSpecificTime": "默认填充具体时间",
|
||||
"removeCard": "移除闪卡",
|
||||
"updateLayout": "更新布局",
|
||||
"dndFolderTip": "请注意 ${x} 仅插入 file:// 超链接,不复制文件",
|
||||
|
|
|
|||
|
|
@ -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", () => {
|
||||
|
|
|
|||
4
app/src/types/index.d.ts
vendored
4
app/src/types/index.d.ts
vendored
|
|
@ -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?: {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -2147,15 +2147,15 @@ func GetCurrentAttributeViewImages(avID, viewID, query string) (ret []string, er
|
|||
return
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue