🎨 rm nodeID

This commit is contained in:
Vanessa 2023-09-26 09:38:16 +08:00
parent 859a541155
commit f85e1178c4
3 changed files with 3 additions and 13 deletions

View File

@ -12,7 +12,6 @@ export const duplicateCol = (options: {
protyle: IProtyle, protyle: IProtyle,
type: TAVCol, type: TAVCol,
avID: string, avID: string,
nodeID: string,
colId: string, colId: string,
newValue: string newValue: string
}) => { }) => {
@ -24,7 +23,7 @@ export const duplicateCol = (options: {
options.newValue = `${options.newValue} (1)`; options.newValue = `${options.newValue} (1)`;
} }
if (["select", "mSelect"].includes(options.type)) { if (["select", "mSelect"].includes(options.type)) {
fetchPost("/api/av/renderAttributeView", {id: options.avID, nodeID: options.nodeID}, (response) => { fetchPost("/api/av/renderAttributeView", {id: options.avID}, (response) => {
const data = response.data as IAV; const data = response.data as IAV;
let colOptions; let colOptions;
data.view.columns.find((item) => { data.view.columns.find((item) => {
@ -74,7 +73,7 @@ export const duplicateCol = (options: {
}]); }]);
} }
addAttrViewColAnimation({ addAttrViewColAnimation({
blockElement: options.protyle.wysiwyg.element.querySelector(`[data-node-id="${options.nodeID}"]`), blockElement: options.protyle.wysiwyg.element.querySelector(`[data-av-id="${options.avID}"]`),
protyle: options.protyle, protyle: options.protyle,
type: options.type, type: options.type,
name: options.newValue, name: options.newValue,
@ -289,7 +288,6 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
const type = cellElement.getAttribute("data-dtype") as TAVCol; const type = cellElement.getAttribute("data-dtype") as TAVCol;
const colId = cellElement.getAttribute("data-col-id"); const colId = cellElement.getAttribute("data-col-id");
const avID = blockElement.getAttribute("data-av-id"); const avID = blockElement.getAttribute("data-av-id");
const nodeID = blockElement.getAttribute("data-node-id");
const menu = new Menu("av-header-cell", () => { const menu = new Menu("av-header-cell", () => {
const newValue = (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement).value; const newValue = (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement).value;
if (newValue === cellElement.textContent.trim()) { if (newValue === cellElement.textContent.trim()) {
@ -339,7 +337,6 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
click() { click() {
fetchPost("/api/av/renderAttributeView", { fetchPost("/api/av/renderAttributeView", {
id: avID, id: avID,
nodeID
}, (response) => { }, (response) => {
transaction(protyle, [{ transaction(protyle, [{
action: "setAttrViewSorts", action: "setAttrViewSorts",
@ -362,7 +359,6 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
click() { click() {
fetchPost("/api/av/renderAttributeView", { fetchPost("/api/av/renderAttributeView", {
id: avID, id: avID,
nodeID
}, (response) => { }, (response) => {
transaction(protyle, [{ transaction(protyle, [{
action: "setAttrViewSorts", action: "setAttrViewSorts",
@ -386,7 +382,6 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
click() { click() {
fetchPost("/api/av/renderAttributeView", { fetchPost("/api/av/renderAttributeView", {
id: avID, id: avID,
nodeID
}, (response) => { }, (response) => {
const avData = response.data as IAV; const avData = response.data as IAV;
let filter: IAVFilter; let filter: IAVFilter;
@ -450,7 +445,6 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen
protyle, protyle,
type, type,
avID, avID,
nodeID,
colId, colId,
newValue: (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement).value newValue: (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement).value
}); });

View File

@ -27,10 +27,8 @@ export const openMenuPanel = (options: {
} }
window.siyuan.menus.menu.remove(); window.siyuan.menus.menu.remove();
const avID = options.blockElement.getAttribute("data-av-id"); const avID = options.blockElement.getAttribute("data-av-id");
const nodeID = options.blockElement.getAttribute("data-node-id");
fetchPost("/api/av/renderAttributeView", { fetchPost("/api/av/renderAttributeView", {
id: avID, id: avID,
nodeID
}, (response) => { }, (response) => {
const data = response.data as IAV; const data = response.data as IAV;
let html; let html;
@ -238,7 +236,7 @@ export const openMenuPanel = (options: {
} else { } else {
targetElement.after(sourceElement); targetElement.after(sourceElement);
} }
const replaceValue: IAVCellAssetValue[] = [] const replaceValue: IAVCellAssetValue[] = [];
Array.from(targetElement.parentElement.children).forEach((item: HTMLElement) => { Array.from(targetElement.parentElement.children).forEach((item: HTMLElement) => {
if (item.dataset.content) { if (item.dataset.content) {
replaceValue.push({ replaceValue.push({
@ -628,7 +626,6 @@ export const openMenuPanel = (options: {
type: colData.type, type: colData.type,
avID, avID,
colId, colId,
nodeID,
newValue: colData.name newValue: colData.name
}); });
avPanelElement.remove(); avPanelElement.remove();

View File

@ -23,7 +23,6 @@ export const avRender = (element: Element, protyle: IProtyle, cb?: () => void) =
const left = e.querySelector(".av__scroll")?.scrollLeft || 0; const left = e.querySelector(".av__scroll")?.scrollLeft || 0;
fetchPost("/api/av/renderAttributeView", { fetchPost("/api/av/renderAttributeView", {
id: e.getAttribute("data-av-id"), id: e.getAttribute("data-av-id"),
nodeID: e.getAttribute("data-node-id")
}, (response) => { }, (response) => {
const data = response.data.view as IAVTable; const data = response.data.view as IAVTable;
// header // header