Vanessa 2023-12-23 11:25:29 +08:00
parent 50b76c7294
commit e1c0adc633
6 changed files with 71 additions and 1 deletions

View file

@ -1,4 +1,6 @@
{
"relation": "Relation",
"rollup": "Rollup",
"replaceTypes": {
"text": "Normal text",
"imgText": "Image alt text",

View file

@ -1,4 +1,6 @@
{
"relation": "Relación",
"rollup": "Acumular",
"replaceTypes": {
"text": "Texto normal",
"imgText": "Texto alternativo de la imagen",

View file

@ -1,4 +1,6 @@
{
"relation": "Relation",
"rollup": "Rollup",
"replaceTypes": {
"text": "Texte normal",
"imgText": "Texte alternatif de l'image",

View file

@ -1,4 +1,6 @@
{
"relation": "關聯",
"rollup": "查詢引用",
"replaceTypes": {
"text": "普通文字",
"imgText": "圖片提示文字",

View file

@ -1,4 +1,6 @@
{
"relation": "关联",
"rollup": "查询引用",
"replaceTypes": {
"text": "普通文本",
"imgText": "图片提示文本",

View file

@ -24,7 +24,7 @@ export const duplicateCol = (options: {
} else {
options.newValue = `${options.newValue} (1)`;
}
if (["select", "mSelect"].includes(options.type)) {
if (["select", "mSelect", "rollup"].includes(options.type)) {
fetchPost("/api/av/renderAttributeView", {id: options.avID}, (response) => {
const data = response.data as IAV;
let colOptions;
@ -183,6 +183,8 @@ export const getEditHTML = (options: {
${genUpdateColItem("email", colData.type, colData.name)}
${genUpdateColItem("phone", colData.type, colData.name)}
${genUpdateColItem("template", colData.type, colData.name)}
${genUpdateColItem("relation", colData.type, colData.name)}
${genUpdateColItem("rollup", colData.type, colData.name)}
${genUpdateColItem("created", colData.type, colData.name)}
${genUpdateColItem("updated", colData.type, colData.name)}
</div>`;
@ -321,6 +323,10 @@ export const getColNameByType = (type: TAVCol) => {
return window.siyuan.languages[type];
case "mSelect":
return window.siyuan.languages.multiSelect;
case "relation":
return window.siyuan.languages.relation;
case "rollup":
return window.siyuan.languages.rollup;
case "updated":
return window.siyuan.languages.updatedTime;
case "created":
@ -346,6 +352,10 @@ export const getColIconByType = (type: TAVCol) => {
return "iconListItem";
case "mSelect":
return "iconList";
case "relation":
return "iconOpen";
case "rollup":
return "iconSearch";
case "date":
return "iconCalendar";
case "updated":
@ -964,6 +974,56 @@ export const addCol = (protyle: IProtyle, blockElement: Element) => {
});
}
});
menu.addItem({
icon: "iconOpen",
label: window.siyuan.languages.relation,
click() {
const id = Lute.NewNodeID();
transaction(protyle, [{
action: "addAttrViewCol",
name: window.siyuan.languages.relation,
avID,
type: "relation",
id
}], [{
action: "removeAttrViewCol",
id,
avID,
}]);
addAttrViewColAnimation({
blockElement: blockElement,
protyle: protyle,
type: "relation",
name: window.siyuan.languages.relation,
id
});
}
});
menu.addItem({
icon: "iconSearch",
label: window.siyuan.languages.rollup,
click() {
const id = Lute.NewNodeID();
transaction(protyle, [{
action: "addAttrViewCol",
name: window.siyuan.languages.rollup,
avID,
type: "rollup",
id
}], [{
action: "removeAttrViewCol",
id,
avID,
}]);
addAttrViewColAnimation({
blockElement: blockElement,
protyle: protyle,
type: "rollup",
name: window.siyuan.languages.rollup,
id
});
}
});
menu.addItem({
icon: "iconClock",
label: window.siyuan.languages.createdTime,