Vanessa 2024-11-27 22:33:22 +08:00
parent eb21e8f90f
commit 671851235a
3 changed files with 29 additions and 40 deletions

View file

@ -9,19 +9,12 @@
min-height: 26px;
flex-wrap: wrap;
&:hover {
&:not(.custom-attr__avvalue--readonly):hover {
background-color: var(--b3-theme-background);
}
&--readonly {
padding: 7px 8px;
line-height: 26px;
min-height: 26px;
&[data-type="created"],
&[data-type="updated"] {
padding: 4px 8px;
}
cursor: default;
}
.av__checkbox {
@ -77,33 +70,18 @@
}
}
[placeholder]:empty:before {
[placeholder]:empty::after {
color: var(--b3-empty-color);
content: attr(placeholder);
}
}
.block__icons--addcolumn {
padding: 0 8px;
.b3-button[data-type="addColumn"] {
margin: 0 0 0 16px;
color: var(--b3-theme-on-surface);
background-color: rgba(0,0,0,0);
&:hover,
&:focus {
background-color: var(--b3-list-hover);
box-shadow: none;
}
svg {
padding: 4px;
}
span {
padding-right: 4px;
}
.b3-button[data-type="addColumn"] {
margin-left: 28px;
svg {
width: 16px;
height: 16px;
margin-right: 8px;
}
}

View file

@ -66,8 +66,7 @@
font-size: 16px;
}
&--text,
&--cancel {
&--text {
color: var(--b3-theme-primary);
background-color: transparent;
@ -85,6 +84,18 @@
&--cancel {
color: var(--b3-theme-on-surface);
background-color: transparent;
&:hover,
&:focus {
background-color: var(--b3-list-hover);
box-shadow: none;
}
&:active {
background-color: var(--b3-list-icon-hover);
box-shadow: none;
}
}
&--outline {

View file

@ -56,7 +56,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {
let html = "";
switch (value.type) {
case "block":
html = `<div class="fn__flex-1">${value.block.content}</div>`;
html = `<div class="fn__flex-1" placeholder="${window.siyuan.languages.empty}">${value.block.content}</div>`;
break;
case "text":
html = `<textarea style="resize: vertical" rows="${value.text.content.split("\n").length}" class="b3-text-field b3-text-field--text fn__flex-1" placeholder="${window.siyuan.languages.empty}">${value.text.content}</textarea>`;
@ -188,14 +188,14 @@ export const renderAVAttribute = (element: HTMLElement, id: string, protyle: IPr
<span>${escapeHtml(item.key.name)}</span>
</div>
<div data-av-id="${table.avID}" data-col-id="${item.values[0].keyID}" data-block-id="${item.values[0].blockID}" data-id="${item.values[0].id}" data-type="${item.values[0].type}"
data-options="${item.key?.options ? escapeAttr(JSON.stringify(item.key.options)) : "[]"}"${["block", "created", "updated", "text", "number", "date", "url", "phone", "template", "email"].includes(item.values[0].type) ? "" : ` placeholder="${window.siyuan.languages.empty}`}"
class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes(item.values[0].type) ? "" : ["block", "created", "updated"].includes(item.values[0].type) ? " custom-attr__avvalue--readonly" : " custom-attr__avvalue"}">${genAVValueHTML(item.values[0])}</div>
data-options="${item.key?.options ? escapeAttr(JSON.stringify(item.key.options)) : "[]"}"
${["text", "number", "date", "url", "phone", "template", "email"].includes(item.values[0].type) ? "" : `placeholder="${window.siyuan.languages.empty}"`}
class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes(item.values[0].type) ? "" : " custom-attr__avvalue"}${["block", "created", "updated"].includes(item.values[0].type) ? " custom-attr__avvalue--readonly" : ""}">${genAVValueHTML(item.values[0])}</div>
</div>`;
});
innerHTML += `<div class="fn__hr></div>
<div class="fn__flex block__icons--addcolumn"">
<button data-type="addColumn" class="b3-button"><svg><use xlink:href="#iconAdd"></use></svg><span>${window.siyuan.languages.newCol}</span></button>
</div><div class="fn__hr--b"></div>`;
innerHTML += `<div class="fn__hr"></div>
<button data-type="addColumn" class="b3-button b3-button--cancel"><svg><use xlink:href="#iconAdd"></use></svg>${window.siyuan.languages.newCol}</button>
<div class="fn__hr--b"></div>`;
html += `<div data-av-id="${table.avID}" data-node-id="${id}" data-type="NodeAttributeView">${innerHTML}</div>`;
if (element.innerHTML) {