This commit is contained in:
parent
f273e0af19
commit
6225246d99
13 changed files with 64 additions and 26 deletions
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"includeTime": "Include time",
|
||||
"accountSupport1": "So far, we have made more than 5,000 improvements to SiYuan. Our unremitting efforts are entirely due to users' recognition and support of SiYuan.",
|
||||
"accountSupport2": "The development of SiYuan cannot be separated from your support. We will continue to make good products with our heart and provide you with a better knowledge management experience.",
|
||||
"goToTab1": "Go to tab #1",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"includeTime": "Incluir tiempo",
|
||||
"accountSupport1": "Hasta ahora, hemos realizado más de 5000 mejoras en SiYuan. Nuestros incansables esfuerzos se deben enteramente al reconocimiento y apoyo de los usuarios a SiYuan.",
|
||||
"accountSupport2": "El desarrollo de SiYuan no puede separarse de su apoyo. Continuaremos fabricando buenos productos con nuestro corazón y brindándole una mejor experiencia de gestión del conocimiento.",
|
||||
"goToTab1": "Ir a la pestaña #1",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"includeTime": "Inclure l'heure",
|
||||
"accountSupport1": "Jusqu'à présent, nous avons apporté plus de 5 000 améliorations à SiYuan. Nos efforts inlassables sont entièrement dus à la reconnaissance et au soutien des utilisateurs pour SiYuan.",
|
||||
"accountSupport2": "Le développement de SiYuan ne peut être séparé de votre soutien. Nous continuerons à fabriquer de bons produits avec notre cœur et à vous offrir une meilleure expérience de gestion des connaissances.",
|
||||
"goToTab1": "Aller à l'onglet #1",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"includeTime": "具體時間",
|
||||
"accountSupport1": "到目前為止,我們對思源筆記進行了 5000 多項改進,我們堅持不懈的努力完全源於用戶對思源筆記的認可和支持。",
|
||||
"accountSupport2": "思源筆記的發展離不開你的支持,我們會繼續用心做好產品,為你提供更好的知識管理體驗。",
|
||||
"goToTab1": "跳到第一個頁籤",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"includeTime": "具体时间",
|
||||
"accountSupport1": "到目前为止,我们对思源笔记进行了 5000 多项改进,我们坚持不懈的努力完全源于用户对思源笔记的认可和支持。",
|
||||
"accountSupport2": "思源笔记的发展离不开你的支持,我们会继续用心做好产品,为你提供更好的知识管理体验。",
|
||||
"goToTab1": "跳转到第一个页签",
|
||||
|
|
|
@ -36,7 +36,7 @@ export const openWechatNotify = (nodeElement: Element) => {
|
|||
const reminder = nodeElement.getAttribute(Constants.CUSTOM_REMINDER_WECHAT);
|
||||
let reminderFormat = "";
|
||||
if (reminder) {
|
||||
reminderFormat = dayjs(reminder).format("YYYY-MM-DDTHH:mm");
|
||||
reminderFormat = dayjs(reminder).format("YYYY-MM-DD HH:mm");
|
||||
}
|
||||
const dialog = new Dialog({
|
||||
width: isMobile() ? "92vw" : "50vw",
|
||||
|
@ -101,7 +101,7 @@ export const openFileWechatNotify = (protyle: IProtyle) => {
|
|||
const reminder = response.data.ial[Constants.CUSTOM_REMINDER_WECHAT];
|
||||
let reminderFormat = "";
|
||||
if (reminder) {
|
||||
reminderFormat = dayjs(reminder).format("YYYY-MM-DDTHH:mm");
|
||||
reminderFormat = dayjs(reminder).format("YYYY-MM-DD HH:mm");
|
||||
}
|
||||
const dialog = new Dialog({
|
||||
width: isMobile() ? "92vw" : "50vw",
|
||||
|
@ -162,7 +162,7 @@ export const openFileAttr = (attrs: IObject, focusName = "bookmark", protyle?: I
|
|||
notifyHTML = `<label class="b3-label b3-label--noborder">
|
||||
${window.siyuan.languages.wechatReminder}
|
||||
<div class="fn__hr"></div>
|
||||
<input class="b3-text-field fn__block" type="datetime-local" readonly data-name="${item}" value="${dayjs(attrs[item]).format("YYYY-MM-DDTHH:mm")}">
|
||||
<input class="b3-text-field fn__block" type="datetime-local" readonly data-name="${item}" value="${dayjs(attrs[item]).format("YYYY-MM-DD HH:mm")}">
|
||||
</label>`;
|
||||
} else if (item.indexOf("custom-av") > -1) {
|
||||
hasAV = true;
|
||||
|
|
|
@ -33,14 +33,18 @@ export const genAVValueHTML = (value: IAVCellValue) => {
|
|||
});
|
||||
break;
|
||||
case "date":
|
||||
if (value[value.type].isNotEmpty) {
|
||||
html = `<span data-content="${value[value.type].content}">${dayjs(value[value.type].content).format(value[value.type].isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm")}</span>`;
|
||||
}
|
||||
if (value[value.type].hasEndDate && value[value.type].isNotEmpty2 && value[value.type].isNotEmpty) {
|
||||
html += `<svg class="custom-attr__avarrow"><use xlink:href="#iconForward"></use></svg><span data-content="${value[value.type].content2}">${dayjs(value[value.type].content2).format(value[value.type].isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm")}</span>`;
|
||||
}
|
||||
break;
|
||||
case "created":
|
||||
case "updated":
|
||||
if (value[value.type].isNotEmpty) {
|
||||
html = `<span data-content="${value[value.type].content}">${dayjs(value[value.type].content).format("YYYY-MM-DD HH:mm")}</span>`;
|
||||
}
|
||||
if (value[value.type].hasEndDate && value[value.type].isNotEmpty2 && value[value.type].isNotEmpty) {
|
||||
html += `<svg class="custom-attr__avarrow"><use xlink:href="#iconForward"></use></svg><span data-content="${value[value.type].content2}">${dayjs(value[value.type].content2).format("YYYY-MM-DD HH:mm")}</span>`;
|
||||
}
|
||||
break;
|
||||
case "url":
|
||||
html = `<input value="${value.url.content}" class="b3-text-field b3-text-field--text fn__flex-1">
|
||||
|
|
|
@ -113,6 +113,7 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {
|
|||
content2: null,
|
||||
isNotEmpty2: false,
|
||||
hasEndDate: false,
|
||||
isNotTime: true,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -27,22 +27,27 @@ export const getDateHTML = (data: IAVTable, cellElements: HTMLElement[]) => {
|
|||
}
|
||||
let value = "";
|
||||
if (cellValue?.value?.date?.isNotEmpty) {
|
||||
value = dayjs(cellValue.value.date.content).format("YYYY-MM-DDTHH:mm");
|
||||
value = dayjs(cellValue.value.date.content).format(cellValue.value.date.isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm");
|
||||
}
|
||||
let value2 = "";
|
||||
if (cellValue?.value?.date?.isNotEmpty2) {
|
||||
value2 = dayjs(cellValue.value.date.content2).format("YYYY-MM-DDTHH:mm");
|
||||
value2 = dayjs(cellValue.value.date.content2).format(cellValue.value.date.isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm");
|
||||
}
|
||||
return `<div class="b3-menu__items">
|
||||
<div>
|
||||
<input type="datetime-local" value="${value}" class="b3-text-field fn__size200"><br>
|
||||
<input type="datetime-local" value="${value2}" style="margin-top: 8px" class="b3-text-field fn__size200${hasEndDate ? "" : " fn__none"}">
|
||||
<input type="${cellValue.value.date.isNotTime ? "date" : "datetime-local"}" value="${value}" data-value="${value}" class="b3-text-field fn__size200"><br>
|
||||
<input type="${cellValue.value.date.isNotTime ? "date" : "datetime-local"}" value="${value2}" data-value="${value2}" style="margin-top: 8px" class="b3-text-field fn__size200${hasEndDate ? "" : " fn__none"}">
|
||||
<button class="b3-menu__separator"></button>
|
||||
<label class="b3-menu__item">
|
||||
<span>${window.siyuan.languages.endDate}</span>
|
||||
<span class="fn__space fn__flex-1"></span>
|
||||
<input type="checkbox" class="b3-switch fn__flex-center"${hasEndDate ? " checked" : ""}>
|
||||
</label>
|
||||
<label class="b3-menu__item">
|
||||
<span>${window.siyuan.languages.includeTime}</span>
|
||||
<span class="fn__space fn__flex-1"></span>
|
||||
<input type="checkbox" class="b3-switch fn__flex-center"${cellValue.value.date.isNotTime ? "" : " checked"}>
|
||||
</label>
|
||||
<button class="b3-menu__separator"></button>
|
||||
<button class="b3-menu__item" data-type="clearDate">
|
||||
<svg class="b3-menu__icon"><use xlink:href="#iconTrashcan"></use></svg>
|
||||
|
@ -58,7 +63,7 @@ export const bindDateEvent = (options: {
|
|||
menuElement: HTMLElement,
|
||||
cellElements: HTMLElement[]
|
||||
}) => {
|
||||
const inputElements: NodeListOf<HTMLInputElement> = options.menuElement.querySelectorAll(".b3-text-field");
|
||||
const inputElements: NodeListOf<HTMLInputElement> = options.menuElement.querySelectorAll("input");
|
||||
inputElements[0].addEventListener("change", () => {
|
||||
setDateValue({
|
||||
cellElements: options.cellElements,
|
||||
|
@ -69,6 +74,7 @@ export const bindDateEvent = (options: {
|
|||
content: new Date(inputElements[0].value).getTime()
|
||||
}
|
||||
});
|
||||
inputElements[0].dataset.value = inputElements[0].value;
|
||||
});
|
||||
inputElements[1].addEventListener("change", () => {
|
||||
setDateValue({
|
||||
|
@ -80,10 +86,10 @@ export const bindDateEvent = (options: {
|
|||
content2: new Date(inputElements[1].value).getTime()
|
||||
}
|
||||
});
|
||||
inputElements[1].dataset.value = inputElements[1].value;
|
||||
});
|
||||
const checkElement = options.menuElement.querySelector(".b3-switch") as HTMLInputElement;
|
||||
checkElement.addEventListener("change", () => {
|
||||
if (checkElement.checked) {
|
||||
inputElements[2].addEventListener("change", () => {
|
||||
if (inputElements[2].checked) {
|
||||
inputElements[1].classList.remove("fn__none");
|
||||
} else {
|
||||
inputElements[1].classList.add("fn__none");
|
||||
|
@ -93,7 +99,28 @@ export const bindDateEvent = (options: {
|
|||
data: options.data,
|
||||
protyle: options.protyle,
|
||||
value: {
|
||||
hasEndDate: checkElement.checked
|
||||
hasEndDate: inputElements[2].checked
|
||||
}
|
||||
});
|
||||
});
|
||||
inputElements[3].addEventListener("change", () => {
|
||||
if (inputElements[3].checked) {
|
||||
inputElements[0].setAttribute("type", "datetime-local");
|
||||
inputElements[1].setAttribute("type", "datetime-local");
|
||||
inputElements[0].value = inputElements[0].dataset.value
|
||||
inputElements[1].value = inputElements[1].dataset.value
|
||||
} else {
|
||||
inputElements[0].setAttribute("type", "date");
|
||||
inputElements[1].setAttribute("type", "date");
|
||||
inputElements[0].value = inputElements[0].dataset.value.substring(0, 10)
|
||||
inputElements[1].value = inputElements[1].dataset.value.substring(0, 10)
|
||||
}
|
||||
setDateValue({
|
||||
cellElements: options.cellElements,
|
||||
data: options.data,
|
||||
protyle: options.protyle,
|
||||
value: {
|
||||
isNotTime: !inputElements[3].checked
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -245,11 +245,11 @@ export const setFilter = (options: {
|
|||
const dateValue = options.filter.value ? options.filter.value[colData.type as "date"] : null;
|
||||
menu.addItem({
|
||||
iconHTML: "",
|
||||
label: `<input style="margin: 4px 0" value="${(dateValue.isNotEmpty || colData.type !== "date") ? dayjs(dateValue.content).format("YYYY-MM-DDTHH:mm") : ""}" type="datetime-local" class="b3-text-field fn__size200">`
|
||||
label: `<input style="margin: 4px 0" value="${(dateValue.isNotEmpty || colData.type !== "date") ? dayjs(dateValue.content).format("YYYY-MM-DD") : ""}" type="date" class="b3-text-field fn__size200">`
|
||||
});
|
||||
menu.addItem({
|
||||
iconHTML: "",
|
||||
label: `<input style="margin: 4px 0" value="${dateValue.isNotEmpty2 ? dayjs(dateValue.content2).format("YYYY-MM-DDTHH:mm") : ""}" type="datetime-local" class="b3-text-field fn__size200">`
|
||||
label: `<input style="margin: 4px 0" value="${dateValue.isNotEmpty2 ? dayjs(dateValue.content2).format("YYYY-MM-DD") : ""}" type="date" class="b3-text-field fn__size200">`
|
||||
});
|
||||
}
|
||||
menu.addItem({
|
||||
|
@ -377,15 +377,15 @@ export const getFiltersHTML = (data: IAVTable) => {
|
|||
filterValue = ": " + window.siyuan.languages.filterOperatorIsNotEmpty;
|
||||
} else if (filter.value?.date?.content) {
|
||||
if (filter.value?.date?.content2 && filter.operator === "Is between") {
|
||||
filterValue = ` ${window.siyuan.languages.filterOperatorIsBetween} ${dayjs(filter.value.date.content).format("YYYY-MM-DD HH:mm")} ${dayjs(filter.value.date.content2).format("YYYY-MM-DD HH:mm")}`;
|
||||
filterValue = ` ${window.siyuan.languages.filterOperatorIsBetween} ${dayjs(filter.value.date.content).format("YYYY-MM-DD")} ${dayjs(filter.value.date.content2).format("YYYY-MM-DD")}`;
|
||||
} else if ("=" === filter.operator) {
|
||||
filterValue = `: ${dayjs(filter.value.date.content).format("YYYY-MM-DD HH:mm")}`;
|
||||
filterValue = `: ${dayjs(filter.value.date.content).format("YYYY-MM-DD")}`;
|
||||
} else if ([">", "<"].includes(filter.operator)) {
|
||||
filterValue = ` ${filter.operator} ${dayjs(filter.value.date.content).format("YYYY-MM-DD HH:mm")}`;
|
||||
filterValue = ` ${filter.operator} ${dayjs(filter.value.date.content).format("YYYY-MM-DD")}`;
|
||||
} else if (">=" === filter.operator) {
|
||||
filterValue = ` ≥ ${dayjs(filter.value.date.content).format("YYYY-MM-DD HH:mm")}`;
|
||||
filterValue = ` ≥ ${dayjs(filter.value.date.content).format("YYYY-MM-DD")}`;
|
||||
} else if ("<=" === filter.operator) {
|
||||
filterValue = ` ≤ ${dayjs(filter.value.date.content).format("YYYY-MM-DD HH:mm")}`;
|
||||
filterValue = ` ≤ ${dayjs(filter.value.date.content).format("YYYY-MM-DD")}`;
|
||||
}
|
||||
} else if (filter.value?.mSelect?.length > 0) {
|
||||
let selectContent = "";
|
||||
|
|
|
@ -827,7 +827,8 @@ export const openMenuPanel = (options: {
|
|||
isNotEmpty: false,
|
||||
content: null,
|
||||
content2: null,
|
||||
hasEndDate: false
|
||||
hasEndDate: false,
|
||||
isNotTime: true,
|
||||
}
|
||||
});
|
||||
avPanelElement.remove();
|
||||
|
|
|
@ -120,10 +120,10 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
|
|||
text = '<span class="av__celltext">';
|
||||
const dataValue = cell.value ? cell.value.date : null;
|
||||
if (dataValue && dataValue.isNotEmpty) {
|
||||
text += dayjs(dataValue.content).format("YYYY-MM-DD HH:mm");
|
||||
text += dayjs(dataValue.content).format(dataValue.isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm");
|
||||
}
|
||||
if (dataValue && dataValue.hasEndDate && dataValue.isNotEmpty && dataValue.isNotEmpty2) {
|
||||
text += `<svg class="av__cellicon"><use xlink:href="#iconForward"></use></svg>${dayjs(dataValue.content2).format("YYYY-MM-DD HH:mm")}`;
|
||||
text += `<svg class="av__cellicon"><use xlink:href="#iconForward"></use></svg>${dayjs(dataValue.content2).format(dataValue.isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm")}`;
|
||||
}
|
||||
text += "</span>";
|
||||
} else if (["created", "updated"].includes(cell.valueType)) {
|
||||
|
|
2
app/src/types/index.d.ts
vendored
2
app/src/types/index.d.ts
vendored
|
@ -1097,7 +1097,7 @@ interface IAVCellDateValue {
|
|||
content2?: number,
|
||||
isNotEmpty2?: boolean
|
||||
hasEndDate?: boolean
|
||||
isNotTime?: boolean
|
||||
isNotTime?: boolean // 默认 true
|
||||
}
|
||||
|
||||
interface IAVCellSelectValue {
|
||||
|
|
Loading…
Add table
Reference in a new issue