Skip to content

Commit

Permalink
💄 fix siyuan-note#9418
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Oct 12, 2023
1 parent fdaf8d7 commit 02ec0f6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
20 changes: 8 additions & 12 deletions app/src/assets/scss/business/_av.scss
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@
flex-shrink: 0;
border-right: 1px solid var(--b3-theme-surface-lighter);
display: flex;
align-items: center;
transition: var(--b3-transition);

[data-type="block-ref"],
Expand All @@ -205,11 +204,13 @@
position: absolute;
right: 5px;
font-size: 85%;
top: 8px;
}

.block__icon {
position: absolute;
right: 5px;
top: 5px;
}

&:hover .block__icon {
Expand Down Expand Up @@ -240,29 +241,24 @@

.b3-chip {
margin: 1px 2px;
padding: 2px 6px;
}

&--url {
text-decoration: underline var(--b3-border-color);
}

&--date {
display: flex;
align-items: center;

svg {
margin: 0 5px;
height: 10px;
width: 10px;
flex-shrink: 0;
}
& > .av__cellicon {
margin: 0 5px;
height: 10px;
width: 10px;
}
}

&__firstcol {
svg {
color: var(--b3-theme-on-surface);
height: 36px;
height: 33px;
width: 24px;
opacity: 0;
padding: 5px;
Expand Down
18 changes: 10 additions & 8 deletions app/src/protyle/render/av/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
urlAttr = ` data-href="${urlContent}"`;
}
text = `<span class="av__celltext av__celltext--url" data-type="${cell.valueType}"${urlAttr}>${urlContent}</span>`;
if (cell.value && cell.value[cell.valueType as "url"].content) {
text += `<span data-type="copy" class="b3-tooltips b3-tooltips__n block__icon" aria-label="${window.siyuan.languages.copy}"><svg><use xlink:href="#iconCopy"></use></svg></span>`;
}
} else if (cell.valueType === "block") {
text = `<span class="av__celltext">${cell.value.block.content || ""}</span>`;
if (cell.value?.isDetached) {
Expand All @@ -102,25 +99,25 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
text = `<span class="av__celltext" data-content="${cell.value?.number.isNotEmpty ? cell.value?.number.content : ""}">${cell.value?.number.formattedContent || ""}</span>`;
} else if (cell.valueType === "mSelect" || cell.valueType === "select") {
cell.value?.mSelect?.forEach((item) => {
text += `<span class="b3-chip b3-chip--middle" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${item.content}</span>`;
text += `<span class="b3-chip" style="background-color:var(--b3-font-background${item.color});color:var(--b3-font-color${item.color})">${item.content}</span>`;
});
if (!text) {
text = '<span class="av__celltext"></span>';
} else {
text = `<span class="av__celltext">${text}</span>`;
}
} else if (cell.valueType === "date") {
text = '<span class="av__celltext av__celltext--date">';
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");
}
if (dataValue && dataValue.hasEndDate && dataValue.isNotEmpty && dataValue.isNotEmpty2) {
text += `<svg><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("YYYY-MM-DD HH:mm")}`;
}
text += "</span>";
} else if (["created", "updated"].includes(cell.valueType)) {
text = '<span class="av__celltext av__celltext--date">';
text = '<span class="av__celltext">';
const dataValue = cell.value ? cell.value[cell.valueType as "date"] : null;
if (dataValue && dataValue.isNotEmpty) {
text += dayjs(dataValue.content).format("YYYY-MM-DD HH:mm");
Expand All @@ -131,7 +128,7 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
if (item.type === "image") {
text += `<img class="av__cellassetimg" src="${item.content}">`;
} else {
text += `<span class="b3-chip b3-chip--middle av__celltext--url" data-url="${item.content}">${item.name}</span>`;
text += `<span class="b3-chip av__celltext--url" data-url="${item.content}">${item.name}</span>`;
}
});
if (!text) {
Expand All @@ -140,6 +137,11 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use x
text = `<span class="av__celltext">${text}</span>`;
}
}
if (["text", "template", "url", "email", "phone", "number", "date", "created", "updated"].includes(cell.valueType)) {
if (cell.value && cell.value[cell.valueType as "url"].content) {
text += `<span data-type="copy" class="b3-tooltips b3-tooltips__n block__icon" aria-label="${window.siyuan.languages.copy}"><svg><use xlink:href="#iconCopy"></use></svg></span>`;
}
}
tableHTML += `<div class="av__cell" data-id="${cell.id}" data-col-id="${data.columns[index].id}"
${cell.valueType === "block" ? 'data-block-id="' + (cell.value.block.id || "") + '"' : ""}
${cell.value?.isDetached ? ' data-detached="true"' : ""}
Expand Down

0 comments on commit 02ec0f6

Please sign in to comment.