mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 09:00:12 +01:00
This commit is contained in:
parent
892b308d56
commit
44d0537f10
2 changed files with 29 additions and 9 deletions
|
|
@ -94,6 +94,7 @@ export const setFilter = (options: {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let selectHTML = "";
|
let selectHTML = "";
|
||||||
|
let colData: IAVColumn
|
||||||
switch (colType) {
|
switch (colType) {
|
||||||
case "text":
|
case "text":
|
||||||
selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option>
|
selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option>
|
||||||
|
|
@ -120,6 +121,7 @@ export const setFilter = (options: {
|
||||||
case "mSelect":
|
case "mSelect":
|
||||||
options.data.columns.find((column) => {
|
options.data.columns.find((column) => {
|
||||||
if (column.id === options.filter.column) {
|
if (column.id === options.filter.column) {
|
||||||
|
colData = column;
|
||||||
if (column.type === "select") {
|
if (column.type === "select") {
|
||||||
selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option>
|
selectHTML = `<option ${"=" === options.filter.operator ? "selected" : ""} value="=">${window.siyuan.languages.filterOperatorIs}</option>
|
||||||
<option ${"!=" === options.filter.operator ? "selected" : ""} value="!=">${window.siyuan.languages.filterOperatorIsNot}</option>
|
<option ${"!=" === options.filter.operator ? "selected" : ""} value="!=">${window.siyuan.languages.filterOperatorIsNot}</option>
|
||||||
|
|
@ -143,7 +145,15 @@ 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 (colType === "mSelect") {
|
if (colType === "mSelect") {
|
||||||
|
// TODO
|
||||||
|
colData.options.forEach((option) => {
|
||||||
|
menu.addItem({
|
||||||
|
label: `<input style="margin: 4px 0" value="${options.filter.value.text.content}" class="b3-text-field fn__size200">`,
|
||||||
|
click() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
} else if (colType === "text") {
|
} else if (colType === "text") {
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
iconHTML: "",
|
iconHTML: "",
|
||||||
|
|
@ -205,12 +215,12 @@ export const setFilter = (options: {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
if (selectElement.value === "Is empty" || selectElement.value === "Is not empty") {
|
if (selectElement.value === "Is empty" || selectElement.value === "Is not empty") {
|
||||||
selectElement.parentElement.parentElement.nextElementSibling.classList.add("fn__none");
|
selectElement.parentElement.parentElement.nextElementSibling.classList.add("fn__none");
|
||||||
} else {
|
} else {
|
||||||
selectElement.parentElement.parentElement.nextElementSibling.classList.remove("fn__none");
|
selectElement.parentElement.parentElement.nextElementSibling.classList.remove("fn__none");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
menu.open({x: rectTarget.left, y: rectTarget.bottom});
|
menu.open({x: rectTarget.left, y: rectTarget.bottom});
|
||||||
if (textElement) {
|
if (textElement) {
|
||||||
textElement.select();
|
textElement.select();
|
||||||
|
|
|
||||||
|
|
@ -368,6 +368,9 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: {
|
||||||
row.cells.find(cell => {
|
row.cells.find(cell => {
|
||||||
if (cell.id === cellId) {
|
if (cell.id === cellId) {
|
||||||
cellData = cell;
|
cellData = cell;
|
||||||
|
if (!cellData.value.mSelect) {
|
||||||
|
cellData.value.mSelect = [];
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -376,10 +379,17 @@ export const addSelectColAndCell = (protyle: IProtyle, data: IAV, options: {
|
||||||
});
|
});
|
||||||
|
|
||||||
const oldValue = Object.assign([], cellData.value.mSelect);
|
const oldValue = Object.assign([], cellData.value.mSelect);
|
||||||
cellData.value.mSelect?.push({
|
if (colData.type === "mSelect") {
|
||||||
|
cellData.value.mSelect.push({
|
||||||
color: currentElement.dataset.color,
|
color: currentElement.dataset.color,
|
||||||
content: currentElement.dataset.name
|
content: currentElement.dataset.name
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
cellData.value.mSelect = [{
|
||||||
|
color: currentElement.dataset.color,
|
||||||
|
content: currentElement.dataset.name
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
if (currentElement.querySelector(".b3-menu__accelerator")) {
|
if (currentElement.querySelector(".b3-menu__accelerator")) {
|
||||||
colData.options.push({
|
colData.options.push({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue