diff --git a/stanzas/barchart/index.ts b/stanzas/barchart/index.ts index 67e36aa6..603d189b 100644 --- a/stanzas/barchart/index.ts +++ b/stanzas/barchart/index.ts @@ -475,15 +475,12 @@ export default class Barchart extends MetaStanza { } handleEvent(event) { - console.trace(event.detail); - console.log(this.params["event-incoming_change_selected_nodes"]); - console.log(event.detail === this.params["data-url"]); - const { dataUrl } = event.detail; + const { selectedIds, dataUrl } = event.detail; if ( this.params["event-incoming_change_selected_nodes"] && dataUrl === this.params["data-url"] ) { - changeSelectedStyle.apply(this, [event.detail.selectedIds]); + changeSelectedStyle.apply(this, [selectedIds]); } } } diff --git a/stanzas/pagination-table/app.vue b/stanzas/pagination-table/app.vue index 01654d43..b5d53c5f 100644 --- a/stanzas/pagination-table/app.vue +++ b/stanzas/pagination-table/app.vue @@ -658,7 +658,7 @@ export default defineComponent({ rowIndex; const rowId = filteredRowIds[actualRowIndex]; // selected rows - let selectedRows = [...state.selectedRows]; + let selectedIds = [...state.selectedRows]; // update selected rows if (isShift && state.lastSelectedRow !== null) { const lastSelectedRowIndex = filteredRowIds.indexOf( @@ -667,30 +667,33 @@ export default defineComponent({ const start = Math.min(lastSelectedRowIndex, actualRowIndex); const end = Math.max(lastSelectedRowIndex, actualRowIndex); for (let i = start; i <= end; i++) { - if (!selectedRows.includes(filteredRowIds[i])) { - selectedRows.push(filteredRowIds[i]); + if (!selectedIds.includes(filteredRowIds[i])) { + selectedIds.push(filteredRowIds[i]); } } } else if (isCmd) { - if (selectedRows.includes(rowId)) { - selectedRows.splice(selectedRows.indexOf(rowId), 1); + if (selectedIds.includes(rowId)) { + selectedIds.splice(selectedIds.indexOf(rowId), 1); } else { - selectedRows.push(rowId); + selectedIds.push(rowId); } } else { - selectedRows = [rowId]; + selectedIds = [rowId]; } // dispatch event - const stanza = rootElement.value.parentNode.parentNode.parentNode.host; stanza.dispatchEvent( new CustomEvent("changeSelectedNodes", { - detail: selectedRows, + detail: { + selectedIds, + targetId: rowId, + dataUrl: params.dataUrl + }, }) ); state.lastSelectedRow = rowId; - state.selectedRows = [...selectedRows.map(row => row.toString())]; + state.selectedRows = [...selectedIds.map(row => row.toString())]; }; const handleMouseDown = (event) => { @@ -716,8 +719,9 @@ export default defineComponent({ return state.selectedRows.includes(rowID); }; - const updateSelectedRows = (rows) => { - state.selectedRows = [...rows.map(row => row.toString())]; + const updateSelectedRows = (emitSelectedEventParams) => { + const {selectedIds} = emitSelectedEventParams + state.selectedRows = [...selectedIds.map(id => id.toString())]; }; return { diff --git a/stanzas/treemap/index.js b/stanzas/treemap/index.js index c1aac170..561c609c 100644 --- a/stanzas/treemap/index.js +++ b/stanzas/treemap/index.js @@ -96,7 +96,6 @@ export default class TreeMapStanza extends MetaStanza { } handleEvent(event) { - console.log(event.detail); const { selectedIds, dataUrl } = event.detail; if ( @@ -253,11 +252,10 @@ function draw(el, dataset, opts, stanza) { .text((d) => d === root ? "" - : `${name(d)}\n${ - d?.children - ? format(sum(d, (d) => d?.data?.data.value || 0)) - : d.data.data.value - }` + : `${name(d)}\n${d?.children + ? format(sum(d, (d) => d?.data?.data.value || 0)) + : d.data.data.value + }` ); node @@ -266,11 +264,10 @@ function draw(el, dataset, opts, stanza) { .classed("breadcrumb", (d) => d === root) .attr("id", (d) => (d.leafUid = uid("leaf")).id) .attr("style", (d) => { - return `fill: ${ - d === root + return `fill: ${d === root ? "var(--togostanza-theme-background_color)" : colorScale(d.data.data.label) - }`; + }`; }); //Add inner nodes to show that it's a zoomable tile @@ -408,13 +405,11 @@ function draw(el, dataset, opts, stanza) { if (d === root) { return `translate(0,0)`; } else if (d.parent !== root) { - return `translate(${x(d.x0) - x(d.parent.x0)},${ - y(d.y0) - y(d.parent.y0) - })`; + return `translate(${x(d.x0) - x(d.parent.x0)},${y(d.y0) - y(d.parent.y0) + })`; } else { - return `translate(${x(d.x0) + gapWidth},${ - y(d.y0) + rootHeight + gapWidth - })`; + return `translate(${x(d.x0) + gapWidth},${y(d.y0) + rootHeight + gapWidth + })`; } }); @@ -510,11 +505,11 @@ function getLineHeight(el) { temp.setAttribute( "style", "margin:0; padding:0; " + - "font-family:" + - (el.style.fontFamily || "inherit") + - "; " + - "font-size:" + - (el.style.fontSize || "inherit") + "font-family:" + + (el.style.fontFamily || "inherit") + + "; " + + "font-size:" + + (el.style.fontSize || "inherit") ); temp.innerHTML = "A";