mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
23fe26b37e
commit
c16091332f
10 changed files with 92 additions and 14 deletions
|
|
@ -1,5 +1,9 @@
|
||||||
document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
|
document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
|
||||||
<defs>
|
<defs>
|
||||||
|
<symbol id="iconClock" viewBox="0 0 32 32">
|
||||||
|
<path d="M16 1c-8.283 0-15 6.717-15 15s6.717 15 15 15 15-6.717 15-15-6.717-15-15-15zM16 28.455c-6.877 0-12.455-5.578-12.455-12.455s5.578-12.455 12.455-12.455 12.455 5.578 12.455 12.455-5.578 12.455-12.455 12.455z"></path>
|
||||||
|
<path d="M21.849 20.239l-4.775-3.452v-8.287c0-0.147-0.12-0.268-0.268-0.268h-1.61c-0.147 0-0.268 0.12-0.268 0.268v9.221c0 0.087 0.040 0.167 0.11 0.218l5.538 4.038c0.12 0.087 0.288 0.060 0.375-0.057l0.958-1.306c0.087-0.124 0.060-0.291-0.060-0.375z"></path>
|
||||||
|
</symbol>
|
||||||
<symbol id="iconAttr" viewBox="0 0 32 32">
|
<symbol id="iconAttr" viewBox="0 0 32 32">
|
||||||
<path d="M4.75 31q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM19.75 31q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM12.25 23.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM27.25 23.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM4.75 16q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM19.75 16q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM12.25 8.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM27.25 8.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102z"></path>
|
<path d="M4.75 31q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM19.75 31q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM12.25 23.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM27.25 23.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM4.75 16q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM19.75 16q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM12.25 8.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM27.25 8.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102z"></path>
|
||||||
</symbol>
|
</symbol>
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
"name": "ant",
|
"name": "ant",
|
||||||
"author": "Vanessa",
|
"author": "Vanessa",
|
||||||
"url": "https://github.com/Vanessa219",
|
"url": "https://github.com/Vanessa219",
|
||||||
"version": "1.23.1"
|
"version": "1.24.0"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,12 @@
|
||||||
<body>
|
<body>
|
||||||
<h2>SiYuan</h2>
|
<h2>SiYuan</h2>
|
||||||
<div class="fn__clear">
|
<div class="fn__clear">
|
||||||
|
<div>
|
||||||
|
<svg>
|
||||||
|
<use xlink:href="#iconClock"></use>
|
||||||
|
</svg>
|
||||||
|
iconClock
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<svg>
|
<svg>
|
||||||
<use xlink:href="#iconAttr"></use>
|
<use xlink:href="#iconAttr"></use>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
|
document.body.insertAdjacentHTML('afterbegin', `<svg style="position: absolute; width: 0; height: 0; overflow: hidden;" xmlns="http://www.w3.org/2000/svg">
|
||||||
<defs>
|
<defs>
|
||||||
|
<symbol id="iconClock" viewBox="0 0 32 32">
|
||||||
|
<path d="M20.95 23.050l2.1-2.1-5.55-5.55v-6.9h-3v8.1l6.45 6.45zM16 31q-3.113 0-5.85-1.181t-4.763-3.206-3.206-4.762-1.181-5.85 1.181-5.85 3.206-4.763 4.763-3.206 5.85-1.181 5.85 1.181 4.762 3.206 3.206 4.763 1.181 5.85-1.181 5.85-3.206 4.762-4.762 3.206-5.85 1.181zM16 28q4.988 0 8.494-3.506t3.506-8.494-3.506-8.494-8.494-3.506-8.494 3.506-3.506 8.494 3.506 8.494 8.494 3.506z"></path>
|
||||||
|
</symbol>
|
||||||
<symbol id="iconAttr" viewBox="0 0 32 32">
|
<symbol id="iconAttr" viewBox="0 0 32 32">
|
||||||
<path d="M4.75 31q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM19.75 31q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM12.25 23.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM27.25 23.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM4.75 16q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM19.75 16q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM12.25 8.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM27.25 8.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102z"></path>
|
<path d="M4.75 31q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM19.75 31q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM12.25 23.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM27.25 23.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM4.75 16q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM19.75 16q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM12.25 8.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102zM27.25 8.5q-1.547 0-2.648-1.102t-1.102-2.648 1.102-2.648 2.648-1.102 2.648 1.102 1.102 2.648-1.102 2.648-2.648 1.102z"></path>
|
||||||
</symbol>
|
</symbol>
|
||||||
|
|
|
||||||
|
|
@ -2,5 +2,5 @@
|
||||||
"name": "material",
|
"name": "material",
|
||||||
"author": "Vanessa",
|
"author": "Vanessa",
|
||||||
"url": "https://github.com/Vanessa219",
|
"url": "https://github.com/Vanessa219",
|
||||||
"version": "1.23.1"
|
"version": "1.24.0"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -255,5 +255,55 @@ export const addCol = (protyle: IProtyle, blockElement: Element) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
menu.addItem({
|
||||||
|
icon: "iconClock",
|
||||||
|
label: window.siyuan.languages.creationDate,
|
||||||
|
click() {
|
||||||
|
const id = Lute.NewNodeID();
|
||||||
|
transaction(protyle, [{
|
||||||
|
action: "addAttrViewCol",
|
||||||
|
name: window.siyuan.languages.creationDate,
|
||||||
|
avID,
|
||||||
|
type: "created",
|
||||||
|
id
|
||||||
|
}], [{
|
||||||
|
action: "removeAttrViewCol",
|
||||||
|
id,
|
||||||
|
avID,
|
||||||
|
}]);
|
||||||
|
addAttrViewColAnimation({
|
||||||
|
blockElement: blockElement,
|
||||||
|
protyle: protyle,
|
||||||
|
type: "created",
|
||||||
|
name: window.siyuan.languages.creationDate,
|
||||||
|
id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menu.addItem({
|
||||||
|
icon: "iconClock",
|
||||||
|
label: window.siyuan.languages.modificationDate,
|
||||||
|
click() {
|
||||||
|
const id = Lute.NewNodeID();
|
||||||
|
transaction(protyle, [{
|
||||||
|
action: "addAttrViewCol",
|
||||||
|
name: window.siyuan.languages.modificationDate,
|
||||||
|
avID,
|
||||||
|
type: "updated",
|
||||||
|
id
|
||||||
|
}], [{
|
||||||
|
action: "removeAttrViewCol",
|
||||||
|
id,
|
||||||
|
avID,
|
||||||
|
}]);
|
||||||
|
addAttrViewColAnimation({
|
||||||
|
blockElement: blockElement,
|
||||||
|
protyle: protyle,
|
||||||
|
type: "updated",
|
||||||
|
name: window.siyuan.languages.modificationDate,
|
||||||
|
id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
return menu;
|
return menu;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ export const getCalcValue = (column: IAVColumn) => {
|
||||||
}
|
}
|
||||||
let resultCalc: any = column.calc.result.number;
|
let resultCalc: any = column.calc.result.number;
|
||||||
if (column.calc.operator === "Earliest" || column.calc.operator === "Latest" ||
|
if (column.calc.operator === "Earliest" || column.calc.operator === "Latest" ||
|
||||||
(column.calc.operator === "Range" && column.type === "date")) {
|
(column.calc.operator === "Range" && ["date", "created", "updated"].includes(column.type))) {
|
||||||
resultCalc = column.calc.result.date;
|
resultCalc = column.calc.result[column.type as "date"];
|
||||||
}
|
}
|
||||||
let value = "";
|
let value = "";
|
||||||
switch (column.calc.operator) {
|
switch (column.calc.operator) {
|
||||||
|
|
@ -101,10 +101,10 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {
|
||||||
color: ""
|
color: ""
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
} else if (colType === "date" && value === "") {
|
} else if (["date", "created", "updated"].includes(colType) && value === "") {
|
||||||
cellValue = {
|
cellValue = {
|
||||||
type: colType,
|
type: colType,
|
||||||
date: {
|
[colType]: {
|
||||||
content: null,
|
content: null,
|
||||||
isNotEmpty: false,
|
isNotEmpty: false,
|
||||||
content2: null,
|
content2: null,
|
||||||
|
|
@ -119,10 +119,10 @@ export const genCellValue = (colType: TAVCol, value: string | any) => {
|
||||||
type: colType,
|
type: colType,
|
||||||
mSelect: value as IAVCellSelectValue[]
|
mSelect: value as IAVCellSelectValue[]
|
||||||
};
|
};
|
||||||
} else if (colType === "date") {
|
} else if (["date", "created", "updated"].includes(colType)) {
|
||||||
cellValue = {
|
cellValue = {
|
||||||
type: colType,
|
type: colType,
|
||||||
date: value as IAVCellDateValue
|
[colType]: value as IAVCellDateValue
|
||||||
};
|
};
|
||||||
} else if (colType === "mAsset") {
|
} else if (colType === "mAsset") {
|
||||||
cellValue = {
|
cellValue = {
|
||||||
|
|
@ -309,7 +309,7 @@ export const openCalcMenu = (protyle: IProtyle, calcElement: HTMLElement) => {
|
||||||
operator: "Range",
|
operator: "Range",
|
||||||
label: window.siyuan.languages.calcOperatorRange
|
label: window.siyuan.languages.calcOperatorRange
|
||||||
});
|
});
|
||||||
} else if (type === "date") {
|
} else if (["date", "created", "updated"].includes(type)) {
|
||||||
calcItem({
|
calcItem({
|
||||||
menu,
|
menu,
|
||||||
protyle,
|
protyle,
|
||||||
|
|
@ -346,7 +346,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
|
||||||
if (!type) {
|
if (!type) {
|
||||||
type = cellElements[0].parentElement.parentElement.firstElementChild.querySelector(`[data-col-id="${cellElements[0].getAttribute("data-col-id")}"]`).getAttribute("data-dtype") as TAVCol;
|
type = cellElements[0].parentElement.parentElement.firstElementChild.querySelector(`[data-col-id="${cellElements[0].getAttribute("data-col-id")}"]`).getAttribute("data-dtype") as TAVCol;
|
||||||
}
|
}
|
||||||
if (type === "template") {
|
if (type === "template" || type === "updated" || type === "created") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (type === "block" && (cellElements.length > 1 || !cellElements[0].getAttribute("data-detached"))) {
|
if (type === "block" && (cellElements.length > 1 || !cellElements[0].getAttribute("data-detached"))) {
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,9 @@ export const getColIconByType = (type: TAVCol) => {
|
||||||
return "iconList";
|
return "iconList";
|
||||||
case "date":
|
case "date":
|
||||||
return "iconCalendar";
|
return "iconCalendar";
|
||||||
|
case "updated":
|
||||||
|
case "created":
|
||||||
|
return "iconClock";
|
||||||
case "url":
|
case "url":
|
||||||
return "iconLink";
|
return "iconLink";
|
||||||
case "mAsset":
|
case "mAsset":
|
||||||
|
|
|
||||||
|
|
@ -96,11 +96,19 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
|
||||||
}
|
}
|
||||||
} else if (cell.valueType === "date") {
|
} else if (cell.valueType === "date") {
|
||||||
text = '<span class="av__celltext av__celltext--date">';
|
text = '<span class="av__celltext av__celltext--date">';
|
||||||
if (cell.value?.date.isNotEmpty) {
|
const dataValue = cell.value ? cell.value.date : null;
|
||||||
text += dayjs(cell.value.date.content).format("YYYY-MM-DD HH:mm");
|
if (dataValue && dataValue.isNotEmpty) {
|
||||||
|
text += dayjs(dataValue.content).format("YYYY-MM-DD HH:mm");
|
||||||
}
|
}
|
||||||
if (cell.value?.date.hasEndDate && cell.value?.date.isNotEmpty && cell.value?.date.isNotEmpty2) {
|
if (dataValue && dataValue.hasEndDate && dataValue.isNotEmpty && dataValue.isNotEmpty2) {
|
||||||
text += `<svg><use xlink:href="#iconForward"></use></svg>${dayjs(cell.value.date.content2).format("YYYY-MM-DD HH:mm")}`;
|
text += `<svg><use xlink:href="#iconForward"></use></svg>${dayjs(dataValue.content2).format("YYYY-MM-DD HH:mm")}`;
|
||||||
|
}
|
||||||
|
text += "</span>";
|
||||||
|
} else if (["created", "updated"].includes(cell.valueType)) {
|
||||||
|
text = '<span class="av__celltext av__celltext--date">';
|
||||||
|
const dataValue = cell.value ? cell.value[cell.valueType as "date"] : null;
|
||||||
|
if (dataValue && dataValue.content) {
|
||||||
|
text += dayjs(dataValue.content).format("YYYY-MM-DD HH:mm");
|
||||||
}
|
}
|
||||||
text += "</span>";
|
text += "</span>";
|
||||||
} else if (cell.valueType === "mAsset") {
|
} else if (cell.valueType === "mAsset") {
|
||||||
|
|
|
||||||
4
app/src/types/index.d.ts
vendored
4
app/src/types/index.d.ts
vendored
|
|
@ -65,6 +65,8 @@ type TAVCol =
|
||||||
| "phone"
|
| "phone"
|
||||||
| "mAsset"
|
| "mAsset"
|
||||||
| "template"
|
| "template"
|
||||||
|
| "created"
|
||||||
|
| "updated"
|
||||||
type THintSource = "search" | "av" | "hint";
|
type THintSource = "search" | "av" | "hint";
|
||||||
type TAVFilterOperator =
|
type TAVFilterOperator =
|
||||||
"="
|
"="
|
||||||
|
|
@ -1078,6 +1080,8 @@ interface IAVCellValue {
|
||||||
content: string
|
content: string
|
||||||
}
|
}
|
||||||
date?: IAVCellDateValue
|
date?: IAVCellDateValue
|
||||||
|
created?: IAVCellDateValue
|
||||||
|
updated?: IAVCellDateValue
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IAVCellDateValue {
|
interface IAVCellDateValue {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue