改进数据库属性面板样式、添加占位符
This commit is contained in:
parent
1e2aed3fe5
commit
72d026e23a
2 changed files with 12 additions and 7 deletions
|
@ -17,6 +17,11 @@
|
|||
padding: 7px 8px;
|
||||
line-height: 26px;
|
||||
min-height: 26px;
|
||||
|
||||
&[data-type="created"],
|
||||
&[data-type="updated"] {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.av__checkbox {
|
||||
|
@ -72,7 +77,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
& > [data-dtype]:empty:before {
|
||||
[placeholder]:empty:before {
|
||||
color: var(--b3-empty-color);
|
||||
content: attr(placeholder);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {
|
|||
});
|
||||
break;
|
||||
case "date":
|
||||
html = `<span class="av__celltext" data-value='${JSON.stringify(value[value.type])}'>`;
|
||||
html = `<span class="av__celltext" data-value='${JSON.stringify(value[value.type])}' placeholder="${window.siyuan.languages.empty}">`;
|
||||
if (value[value.type] && value[value.type].isNotEmpty) {
|
||||
html += dayjs(value[value.type].content).format(value[value.type].isNotTime ? "YYYY-MM-DD" : "YYYY-MM-DD HH:mm");
|
||||
}
|
||||
|
@ -100,12 +100,12 @@ export const genAVValueHTML = (value: IAVCellValue) => {
|
|||
}
|
||||
break;
|
||||
case "url":
|
||||
html = `<input value="${value.url.content}" class="b3-text-field b3-text-field--text fn__flex-1">
|
||||
html = `<input value="${value.url.content}" class="b3-text-field b3-text-field--text fn__flex-1" placeholder="${window.siyuan.languages.empty}">
|
||||
<span class="fn__space"></span>
|
||||
<a href="${value.url.content}" target="_blank" aria-label="${window.siyuan.languages.openBy}" class="block__icon block__icon--show fn__flex-center b3-tooltips__w b3-tooltips"><svg><use xlink:href="#iconLink"></use></svg></a>`;
|
||||
break;
|
||||
case "phone":
|
||||
html = `<input value="${value.phone.content}" class="b3-text-field b3-text-field--text fn__flex-1">
|
||||
html = `<input value="${value.phone.content}" class="b3-text-field b3-text-field--text fn__flex-1" placeholder="${window.siyuan.languages.empty}">
|
||||
<span class="fn__space"></span>
|
||||
<a href="tel:${value.phone.content}" target="_blank" aria-label="${window.siyuan.languages.openBy}" class="block__icon block__icon--show fn__flex-center b3-tooltips__w b3-tooltips"><svg><use xlink:href="#iconPhone"></use></svg></a>`;
|
||||
break;
|
||||
|
@ -113,10 +113,10 @@ export const genAVValueHTML = (value: IAVCellValue) => {
|
|||
html = `<svg class="av__checkbox"><use xlink:href="#icon${value.checkbox.checked ? "Check" : "Uncheck"}"></use></svg>`;
|
||||
break;
|
||||
case "template":
|
||||
html = `<div class="fn__flex-1">${value.template.content}</div>`;
|
||||
html = `<div class="fn__flex-1" placeholder="${window.siyuan.languages.empty}">${value.template.content}</div>`;
|
||||
break;
|
||||
case "email":
|
||||
html = `<input value="${value.email.content}" class="b3-text-field b3-text-field--text fn__flex-1">
|
||||
html = `<input value="${value.email.content}" class="b3-text-field b3-text-field--text fn__flex-1" placeholder="${window.siyuan.languages.empty}">
|
||||
<span class="fn__space"></span>
|
||||
<a href="mailto:${value.email.content}" target="_blank" aria-label="${window.siyuan.languages.openBy}" class="block__icon block__icon--show fn__flex-center b3-tooltips__w b3-tooltips"><svg><use xlink:href="#iconEmail"></use></svg></a>`;
|
||||
break;
|
||||
|
@ -188,7 +188,7 @@ 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)) : "[]"}" placeholder="${window.siyuan.languages.empty}"
|
||||
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) ? "" : ["block", "created", "updated"].includes(item.values[0].type) ? " custom-attr__avvalue--readonly" : " custom-attr__avvalue"}">${genAVValueHTML(item.values[0])}</div>
|
||||
</div>`;
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue