|
@@ -50,6 +50,7 @@ export const openMenuPanel = (options: {
|
|
id: avID,
|
|
id: avID,
|
|
pageSize: parseInt(options.blockElement.getAttribute("data-page-size")) || undefined,
|
|
pageSize: parseInt(options.blockElement.getAttribute("data-page-size")) || undefined,
|
|
}, (response) => {
|
|
}, (response) => {
|
|
|
|
+ const isCustomAttr = !options.blockElement.classList.contains("av");
|
|
const data = response.data as IAV;
|
|
const data = response.data as IAV;
|
|
let html;
|
|
let html;
|
|
if (options.type === "config") {
|
|
if (options.type === "config") {
|
|
@@ -67,7 +68,7 @@ export const openMenuPanel = (options: {
|
|
} else if (options.type === "asset") {
|
|
} else if (options.type === "asset") {
|
|
html = getAssetHTML(options.cellElements);
|
|
html = getAssetHTML(options.cellElements);
|
|
} else if (options.type === "edit") {
|
|
} else if (options.type === "edit") {
|
|
- html = getEditHTML({protyle: options.protyle, data, colId: options.colId});
|
|
|
|
|
|
+ html = getEditHTML({protyle: options.protyle, data, colId: options.colId, isCustomAttr});
|
|
} else if (options.type === "date") {
|
|
} else if (options.type === "date") {
|
|
html = getDateHTML(data.view, options.cellElements);
|
|
html = getDateHTML(data.view, options.cellElements);
|
|
} else if (options.type === "rollup") {
|
|
} else if (options.type === "rollup") {
|
|
@@ -75,14 +76,12 @@ export const openMenuPanel = (options: {
|
|
} else if (options.type === "relation") {
|
|
} else if (options.type === "relation") {
|
|
html = getRelationHTML(data, options.cellElements);
|
|
html = getRelationHTML(data, options.cellElements);
|
|
if (!html) {
|
|
if (!html) {
|
|
- if (options.blockElement.classList.contains("av")) {
|
|
|
|
- openMenuPanel({
|
|
|
|
- protyle: options.protyle,
|
|
|
|
- blockElement: options.blockElement,
|
|
|
|
- type: "edit",
|
|
|
|
- colId: options.cellElements[0].dataset.colId
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ openMenuPanel({
|
|
|
|
+ protyle: options.protyle,
|
|
|
|
+ blockElement: options.blockElement,
|
|
|
|
+ type: "edit",
|
|
|
|
+ colId: options.cellElements[0].dataset.colId
|
|
|
|
+ });
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -93,7 +92,7 @@ export const openMenuPanel = (options: {
|
|
</div>`);
|
|
</div>`);
|
|
avPanelElement = document.querySelector(".av__panel");
|
|
avPanelElement = document.querySelector(".av__panel");
|
|
const menuElement = avPanelElement.lastElementChild as HTMLElement;
|
|
const menuElement = avPanelElement.lastElementChild as HTMLElement;
|
|
- const tabRect = options.blockElement.querySelector(".av__views")?.getBoundingClientRect();
|
|
|
|
|
|
+ const tabRect = options.blockElement.querySelector(`.av__views, .av__row[data-col-id="${options.colId}"] > .block__logo`)?.getBoundingClientRect();
|
|
if (["select", "date", "asset", "relation", "rollup"].includes(options.type)) {
|
|
if (["select", "date", "asset", "relation", "rollup"].includes(options.type)) {
|
|
const cellRect = options.cellElements[options.cellElements.length - 1].getBoundingClientRect();
|
|
const cellRect = options.cellElements[options.cellElements.length - 1].getBoundingClientRect();
|
|
if (options.type === "select") {
|
|
if (options.type === "select") {
|
|
@@ -135,7 +134,7 @@ export const openMenuPanel = (options: {
|
|
if (options.type === "sorts") {
|
|
if (options.type === "sorts") {
|
|
bindSortsEvent(options.protyle, menuElement, data);
|
|
bindSortsEvent(options.protyle, menuElement, data);
|
|
} else if (options.type === "edit") {
|
|
} else if (options.type === "edit") {
|
|
- bindEditEvent({protyle: options.protyle, data, menuElement});
|
|
|
|
|
|
+ bindEditEvent({protyle: options.protyle, data, menuElement, isCustomAttr});
|
|
} else if (options.type === "config") {
|
|
} else if (options.type === "config") {
|
|
bindViewEvent({protyle: options.protyle, data, menuElement});
|
|
bindViewEvent({protyle: options.protyle, data, menuElement});
|
|
}
|
|
}
|
|
@@ -322,9 +321,10 @@ export const openMenuPanel = (options: {
|
|
menuElement.innerHTML = getEditHTML({
|
|
menuElement.innerHTML = getEditHTML({
|
|
protyle: options.protyle,
|
|
protyle: options.protyle,
|
|
data,
|
|
data,
|
|
- colId
|
|
|
|
|
|
+ colId,
|
|
|
|
+ isCustomAttr
|
|
});
|
|
});
|
|
- bindEditEvent({protyle: options.protyle, data, menuElement});
|
|
|
|
|
|
+ bindEditEvent({protyle: options.protyle, data, menuElement, isCustomAttr});
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -678,7 +678,12 @@ export const openMenuPanel = (options: {
|
|
data: target.dataset.icon,
|
|
data: target.dataset.icon,
|
|
}]);
|
|
}]);
|
|
target.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(target.dataset.colType as TAVCol)}"></use></svg>`;
|
|
target.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(target.dataset.colType as TAVCol)}"></use></svg>`;
|
|
- updateAttrViewCellAnimation(options.blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${colId}"]`), undefined, {icon: unicode});
|
|
|
|
|
|
+ if (isCustomAttr) {
|
|
|
|
+ const iconElement = options.blockElement.querySelector(`.av__row[data-col-id="${colId}"] .block__logoicon`)
|
|
|
|
+ iconElement.outerHTML = unicode ? unicode2Emoji(unicode, "block__logoicon", true) : `<svg class="block__logoicon"><use xlink:href="#${getColIconByType(iconElement.nextElementSibling.getAttribute("data-type") as TAVCol)}"></use></svg>`;
|
|
|
|
+ } else {
|
|
|
|
+ updateAttrViewCellAnimation(options.blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${colId}"]`), undefined, {icon: unicode});
|
|
|
|
+ }
|
|
target.dataset.icon = unicode;
|
|
target.dataset.icon = unicode;
|
|
});
|
|
});
|
|
event.preventDefault();
|
|
event.preventDefault();
|
|
@@ -744,9 +749,10 @@ export const openMenuPanel = (options: {
|
|
menuElement.innerHTML = getEditHTML({
|
|
menuElement.innerHTML = getEditHTML({
|
|
protyle: options.protyle,
|
|
protyle: options.protyle,
|
|
data,
|
|
data,
|
|
- colId: target.parentElement.dataset.id
|
|
|
|
|
|
+ colId: target.parentElement.dataset.id,
|
|
|
|
+ isCustomAttr
|
|
});
|
|
});
|
|
- bindEditEvent({protyle: options.protyle, data, menuElement});
|
|
|
|
|
|
+ bindEditEvent({protyle: options.protyle, data, menuElement, isCustomAttr});
|
|
setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);
|
|
setPosition(menuElement, tabRect.right - menuElement.clientWidth, tabRect.bottom, tabRect.height);
|
|
event.preventDefault();
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
event.stopPropagation();
|
|
@@ -854,9 +860,10 @@ export const openMenuPanel = (options: {
|
|
menuElement.innerHTML = getEditHTML({
|
|
menuElement.innerHTML = getEditHTML({
|
|
protyle: options.protyle,
|
|
protyle: options.protyle,
|
|
data,
|
|
data,
|
|
- colId
|
|
|
|
|
|
+ colId,
|
|
|
|
+ isCustomAttr
|
|
});
|
|
});
|
|
- bindEditEvent({protyle: options.protyle, data, menuElement});
|
|
|
|
|
|
+ bindEditEvent({protyle: options.protyle, data, menuElement, isCustomAttr});
|
|
} else {
|
|
} else {
|
|
menuElement.innerHTML = getPropertiesHTML(data.view);
|
|
menuElement.innerHTML = getPropertiesHTML(data.view);
|
|
}
|
|
}
|
|
@@ -883,9 +890,10 @@ export const openMenuPanel = (options: {
|
|
menuElement.innerHTML = getEditHTML({
|
|
menuElement.innerHTML = getEditHTML({
|
|
protyle: options.protyle,
|
|
protyle: options.protyle,
|
|
data,
|
|
data,
|
|
- colId
|
|
|
|
|
|
+ colId,
|
|
|
|
+ isCustomAttr
|
|
});
|
|
});
|
|
- bindEditEvent({protyle: options.protyle, data, menuElement});
|
|
|
|
|
|
+ bindEditEvent({protyle: options.protyle, data, menuElement, isCustomAttr});
|
|
} else {
|
|
} else {
|
|
menuElement.innerHTML = getPropertiesHTML(data.view);
|
|
menuElement.innerHTML = getPropertiesHTML(data.view);
|
|
}
|
|
}
|
|
@@ -935,7 +943,7 @@ export const openMenuPanel = (options: {
|
|
event.stopPropagation();
|
|
event.stopPropagation();
|
|
break;
|
|
break;
|
|
} else if (type === "setColOption") {
|
|
} else if (type === "setColOption") {
|
|
- setColOption(options.protyle, data, target, options.blockElement, options.cellElements);
|
|
|
|
|
|
+ setColOption(options.protyle, data, target, options.blockElement, isCustomAttr, options.cellElements);
|
|
event.preventDefault();
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
event.stopPropagation();
|
|
break;
|
|
break;
|