mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 11:02:27 +08:00
feat: 🎸 add first week of year option
This commit is contained in:
parent
0982a0e503
commit
ec06503104
@ -35,6 +35,35 @@ const TPL = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="option-row">
|
||||||
|
<label id="first-week-of-year-label">${t("i18n.first-week-of-the-year")}</label>
|
||||||
|
<div role="group" aria-labelledby="first-week-of-year-label">
|
||||||
|
<label class="tn-radio">
|
||||||
|
<input name="first-week-of-year" type="radio" value="0" />
|
||||||
|
${t("i18n.first-week-contains-first-day")}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="tn-radio">
|
||||||
|
<input name="first-week-of-year" type="radio" value="1" />
|
||||||
|
${t("i18n.first-week-contains-first-thursday")}
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="tn-radio">
|
||||||
|
<input name="first-week-of-year" type="radio" value="2" />
|
||||||
|
${t("i18n.first-week-has-minimum-days")}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="option-row">
|
||||||
|
<label for="min-days-in-first-week">${t("i18n.min-days-in-first-week")}</label>
|
||||||
|
<select id="min-days-in-first-week" class="form-select">
|
||||||
|
${Array.from({length: 7}, (_, i) => i + 1)
|
||||||
|
.map(num => `<option value="${num}">${num}</option>`)
|
||||||
|
.join('')}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="option-row centered">
|
<div class="option-row centered">
|
||||||
<button class="btn btn-secondary btn-micro restart-app-button">${t("electron_integration.restart-app-button")}</button>
|
<button class="btn btn-secondary btn-micro restart-app-button">${t("electron_integration.restart-app-button")}</button>
|
||||||
</div>
|
</div>
|
||||||
@ -64,6 +93,16 @@ const TPL = `
|
|||||||
.locale-options-container .option-row.centered {
|
.locale-options-container .option-row.centered {
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.locale-options-container .option-row [aria-labelledby="first-week-of-year-label"] {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.locale-options-container .option-row [aria-labelledby="first-week-of-year-label"] .tn-radio {
|
||||||
|
margin-left: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
@ -92,6 +131,17 @@ export default class LocalizationOptions extends OptionsWidget {
|
|||||||
const firstDayOfWeek = String(this.$widget.find(`input[name="first-day-of-week"]:checked`).val());
|
const firstDayOfWeek = String(this.$widget.find(`input[name="first-day-of-week"]:checked`).val());
|
||||||
this.updateOption("firstDayOfWeek", firstDayOfWeek);
|
this.updateOption("firstDayOfWeek", firstDayOfWeek);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.$widget.find(`input[name="first-week-of-year"]`).on("change", () => {
|
||||||
|
const firstWeekOfYear = String(this.$widget.find(`input[name="first-week-of-year"]:checked`).val());
|
||||||
|
this.updateOption("firstWeekOfYear", firstWeekOfYear);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$widget.find("#min-days-in-first-week").on("change", () => {
|
||||||
|
const minDays = String(this.$widget.find("#min-days-in-first-week").val());
|
||||||
|
this.updateOption("minDaysInFirstWeek", minDays);
|
||||||
|
});
|
||||||
|
|
||||||
this.$widget.find(".restart-app-button").on("click", utils.restartDesktopApp);
|
this.$widget.find(".restart-app-button").on("click", utils.restartDesktopApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,5 +170,10 @@ export default class LocalizationOptions extends OptionsWidget {
|
|||||||
|
|
||||||
this.$widget.find(`input[name="first-day-of-week"][value="${options.firstDayOfWeek}"]`)
|
this.$widget.find(`input[name="first-day-of-week"][value="${options.firstDayOfWeek}"]`)
|
||||||
.prop("checked", "true");
|
.prop("checked", "true");
|
||||||
|
|
||||||
|
this.$widget.find(`input[name="first-week-of-year"][value="${options.firstWeekOfYear || '0'}"]`)
|
||||||
|
.prop("checked", "true");
|
||||||
|
|
||||||
|
this.$widget.find("#min-days-in-first-week").val(options.minDaysInFirstWeek || "4");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1232,7 +1232,13 @@
|
|||||||
"language": "语言",
|
"language": "语言",
|
||||||
"first-day-of-the-week": "一周的第一天",
|
"first-day-of-the-week": "一周的第一天",
|
||||||
"sunday": "周日",
|
"sunday": "周日",
|
||||||
"monday": "周一"
|
"monday": "周一",
|
||||||
|
"first-week-of-the-year": "一年的第一周",
|
||||||
|
"first-week-contains-first-day": "第一周包含一年的第一天",
|
||||||
|
"first-week-contains-first-thursday": "第一周包含一年的第一个周四",
|
||||||
|
"first-week-has-minimum-days": "第一周有最小天数",
|
||||||
|
"min-days-in-first-week": "第一周的最小天数",
|
||||||
|
"formatting-locale": "日期和数字格式"
|
||||||
},
|
},
|
||||||
"backup": {
|
"backup": {
|
||||||
"automatic_backup": "自动备份",
|
"automatic_backup": "自动备份",
|
||||||
|
@ -1243,6 +1243,11 @@
|
|||||||
"first-day-of-the-week": "First day of the week",
|
"first-day-of-the-week": "First day of the week",
|
||||||
"sunday": "Sunday",
|
"sunday": "Sunday",
|
||||||
"monday": "Monday",
|
"monday": "Monday",
|
||||||
|
"first-week-of-the-year": "First week of the year",
|
||||||
|
"first-week-contains-first-day": "First week contains first day of the year",
|
||||||
|
"first-week-contains-first-thursday": "First week contains first Thursday of the year",
|
||||||
|
"first-week-has-minimum-days": "First week has minimum days",
|
||||||
|
"min-days-in-first-week": "Minimum days in first week",
|
||||||
"formatting-locale": "Date & number format"
|
"formatting-locale": "Date & number format"
|
||||||
},
|
},
|
||||||
"backup": {
|
"backup": {
|
||||||
|
@ -143,6 +143,8 @@ const defaultOptions: DefaultOption[] = [
|
|||||||
{ name: "locale", value: "en", isSynced: true },
|
{ name: "locale", value: "en", isSynced: true },
|
||||||
{ name: "formattingLocale", value: "en", isSynced: true },
|
{ name: "formattingLocale", value: "en", isSynced: true },
|
||||||
{ name: "firstDayOfWeek", value: "1", isSynced: true },
|
{ name: "firstDayOfWeek", value: "1", isSynced: true },
|
||||||
|
{ name: "firstWeekOfYear", value: "0", isSynced: true },
|
||||||
|
{ name: "minDaysInFirstWeek", value: "4", isSynced: true },
|
||||||
{ name: "languages", value: "[]", isSynced: true },
|
{ name: "languages", value: "[]", isSynced: true },
|
||||||
|
|
||||||
// Code block configuration
|
// Code block configuration
|
||||||
|
@ -85,6 +85,8 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi
|
|||||||
eraseUnusedAttachmentsAfterSeconds: number;
|
eraseUnusedAttachmentsAfterSeconds: number;
|
||||||
eraseUnusedAttachmentsAfterTimeScale: number;
|
eraseUnusedAttachmentsAfterTimeScale: number;
|
||||||
firstDayOfWeek: number;
|
firstDayOfWeek: number;
|
||||||
|
firstWeekOfYear: number;
|
||||||
|
minDaysInFirstWeek: number;
|
||||||
languages: string;
|
languages: string;
|
||||||
|
|
||||||
// Appearance
|
// Appearance
|
||||||
|
Loading…
x
Reference in New Issue
Block a user