mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
This commit is contained in:
parent
7822e66ce4
commit
2ee0155ee0
5 changed files with 29 additions and 7 deletions
|
|
@ -114,6 +114,10 @@
|
||||||
&__celltext {
|
&__celltext {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
.b3-chip {
|
||||||
|
margin: 2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__firstcol {
|
&__firstcol {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => {
|
||||||
html = `<textarea ${style} class="b3-text-field">${cellElement.textContent}</textarea>`;
|
html = `<textarea ${style} class="b3-text-field">${cellElement.textContent}</textarea>`;
|
||||||
} else if (type === "number") {
|
} else if (type === "number") {
|
||||||
html = `<input type="number" value="${cellElement.textContent}" ${style} class="b3-text-field">`;
|
html = `<input type="number" value="${cellElement.textContent}" ${style} class="b3-text-field">`;
|
||||||
} else if (type === "select" && blockElement) {
|
} else if (["select", "mSelect"].includes(type) && blockElement) {
|
||||||
openMenuPanel(protyle, blockElement, "select", {cellElement});
|
openMenuPanel(protyle, blockElement, "select", {cellElement});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ export const setFilter = (options: {
|
||||||
label: `<select style="margin: 4px 0" class="b3-select fn__size200">${selectHTML}</select>`
|
label: `<select style="margin: 4px 0" class="b3-select fn__size200">${selectHTML}</select>`
|
||||||
});
|
});
|
||||||
if (options.filter.value.type === "select" || options.filter.value.type === "mSelect") {
|
if (options.filter.value.type === "select" || options.filter.value.type === "mSelect") {
|
||||||
colData.options.forEach((option) => {
|
colData.options?.forEach((option) => {
|
||||||
let icon = "iconUncheck"
|
let icon = "iconUncheck"
|
||||||
options.filter.value.mSelect.find((optionItem) => {
|
options.filter.value.mSelect.find((optionItem) => {
|
||||||
if (optionItem.content === option.name) {
|
if (optionItem.content === option.name) {
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,12 @@ ${column.wrap ? "" : "white-space: nowrap;"}">
|
||||||
text = `<span class="av__celltext">${cell.value?.number.content || ""}</span>`;
|
text = `<span class="av__celltext">${cell.value?.number.content || ""}</span>`;
|
||||||
} else if (cell.valueType === "mSelect" || cell.valueType === "select") {
|
} else if (cell.valueType === "mSelect" || cell.valueType === "select") {
|
||||||
cell.value?.mSelect?.forEach((item: { content: string, color: string }) => {
|
cell.value?.mSelect?.forEach((item: { content: string, color: string }) => {
|
||||||
text += `<span class="av__celltext"><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></span>`;
|
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>`;
|
||||||
});
|
});
|
||||||
if (!text) {
|
if (!text) {
|
||||||
text = '<span class="av__celltext"></span>';
|
text = '<span class="av__celltext"></span>';
|
||||||
|
} else {
|
||||||
|
text = `<span class="av__celltext">${text}</span>`;
|
||||||
}
|
}
|
||||||
} else if (cell.valueType === "date") {
|
} else if (cell.valueType === "date") {
|
||||||
text = `<span class="av__celltext">${cell.value?.date.content || ""}</span>`;
|
text = `<span class="av__celltext">${cell.value?.date.content || ""}</span>`;
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: {
|
||||||
transaction(protyle, [{
|
transaction(protyle, [{
|
||||||
action: "updateAttrViewColOption",
|
action: "updateAttrViewColOption",
|
||||||
id: colId,
|
id: colId,
|
||||||
parentID: data.id,
|
avID: data.id,
|
||||||
data: {
|
data: {
|
||||||
newColor: color,
|
newColor: color,
|
||||||
oldName: name,
|
oldName: name,
|
||||||
|
|
@ -127,7 +127,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: {
|
||||||
}], [{
|
}], [{
|
||||||
action: "updateAttrViewColOption",
|
action: "updateAttrViewColOption",
|
||||||
id: colId,
|
id: colId,
|
||||||
parentID: data.id,
|
avID: data.id,
|
||||||
data: {
|
data: {
|
||||||
newColor: color,
|
newColor: color,
|
||||||
oldName: inputElement.value,
|
oldName: inputElement.value,
|
||||||
|
|
@ -238,7 +238,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: {
|
||||||
transaction(protyle, [{
|
transaction(protyle, [{
|
||||||
action: "updateAttrViewColOption",
|
action: "updateAttrViewColOption",
|
||||||
id: colId,
|
id: colId,
|
||||||
parentID: data.id,
|
avID: data.id,
|
||||||
data: {
|
data: {
|
||||||
oldName: name,
|
oldName: name,
|
||||||
newName: inputElement.value,
|
newName: inputElement.value,
|
||||||
|
|
@ -248,7 +248,7 @@ export const setSelectCol = (protyle: IProtyle, data: IAV, options: {
|
||||||
}], [{
|
}], [{
|
||||||
action: "updateAttrViewColOption",
|
action: "updateAttrViewColOption",
|
||||||
id: colId,
|
id: colId,
|
||||||
parentID: data.id,
|
avID: data.id,
|
||||||
data: {
|
data: {
|
||||||
oldName: inputElement.value,
|
oldName: inputElement.value,
|
||||||
newName: name,
|
newName: name,
|
||||||
|
|
@ -389,6 +389,18 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: {
|
||||||
value: genCellValue(colData.type, ""),
|
value: genCellValue(colData.type, ""),
|
||||||
valueType: colData.type
|
valueType: colData.type
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
let hasSelected = false
|
||||||
|
cellData.value.mSelect.find((item) => {
|
||||||
|
if (item.content === currentElement.dataset.name) {
|
||||||
|
hasSelected = true
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (hasSelected) {
|
||||||
|
menuElement.querySelector("input").focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const oldValue = Object.assign([], cellData.value.mSelect);
|
const oldValue = Object.assign([], cellData.value.mSelect);
|
||||||
|
|
@ -448,6 +460,10 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: {
|
||||||
}
|
}
|
||||||
if (colData.type === "select") {
|
if (colData.type === "select") {
|
||||||
menuElement.parentElement.remove();
|
menuElement.parentElement.remove();
|
||||||
|
} else {
|
||||||
|
menuElement.innerHTML = getSelectHTML(data.view, options);
|
||||||
|
bindSelectEvent(protyle, data, menuElement, options);
|
||||||
|
menuElement.querySelector("input").focus();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue