diff --git a/packages/perspective-viewer-datagrid/package.json b/packages/perspective-viewer-datagrid/package.json index a4f99d0154..131f928054 100644 --- a/packages/perspective-viewer-datagrid/package.json +++ b/packages/perspective-viewer-datagrid/package.json @@ -40,9 +40,9 @@ "dependencies": { "@finos/perspective": "^0.6.2", "@finos/perspective-viewer": "^0.6.2", - "regular-table": "=0.2.1" + "regular-table": "=0.3.1" }, "devDependencies": { "@finos/perspective-test": "^0.6.2" } -} +} \ No newline at end of file diff --git a/packages/perspective-viewer-datagrid/src/js/regular_table_handlers.js b/packages/perspective-viewer-datagrid/src/js/regular_table_handlers.js index cb7e89d448..e7b813ea8b 100644 --- a/packages/perspective-viewer-datagrid/src/js/regular_table_handlers.js +++ b/packages/perspective-viewer-datagrid/src/js/regular_table_handlers.js @@ -82,8 +82,8 @@ function get_psp_type(metadata) { } } -async function sortHandler(regularTable, event) { - const meta = regularTable.getMeta(event.target); +async function sortHandler(regularTable, event, target) { + const meta = regularTable.getMeta(target); const column_name = meta.column_header[meta.column_header.length - 1]; const sort_method = event.shiftKey ? append_sort : override_sort; const sort = sort_method.call(this, column_name); @@ -149,11 +149,23 @@ async function expandCollapseHandler(regularTable, event) { } function mousedownListener(regularTable, event) { - if (event.target.classList.contains("psp-tree-label") && event.offsetX < 26) { + if (event.which !== 1) { + return; + } + + let target = event.target; + while (target.tagName !== "TD" && target.tagName !== "TH") { + target = target.parentElement; + if (!regularTable.contains(target)) { + return; + } + } + + if (target.classList.contains("psp-tree-label") && event.offsetX < 26) { expandCollapseHandler.call(this, regularTable, event); event.handled = true; - } else if (event.target.classList.contains("psp-header-leaf") && !event.target.classList.contains("psp-header-corner")) { - sortHandler.call(this, regularTable, event); + } else if (target.classList.contains("psp-header-leaf") && !target.classList.contains("psp-header-corner")) { + sortHandler.call(this, regularTable, event, target); event.handled = true; } } diff --git a/packages/perspective-viewer-datagrid/src/less/regular_table.less b/packages/perspective-viewer-datagrid/src/less/regular_table.less index 7de8834592..2cd03c1868 100644 --- a/packages/perspective-viewer-datagrid/src/less/regular_table.less +++ b/packages/perspective-viewer-datagrid/src/less/regular_table.less @@ -4,12 +4,12 @@ // Row Selection .psp-row-selected, :hover .psp-row-selected, :hover th.psp-tree-leaf.psp-row-selected, :hover th.psp-tree-label.psp-row-selected { - color: black !important; + color: white !important; background-color: #EA7319; } .psp-row-selected.psp-tree-label:not(:hover):before { - color: black; + color: white; } .psp-row-subselected, :hover .psp-row-subselected, :hover th.psp-tree-leaf.psp-row-subselected, :hover th.psp-tree-label.psp-row-subselected { diff --git a/yarn.lock b/yarn.lock index a5a068b606..9bf4fe47e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14617,10 +14617,10 @@ regjsparser@^0.6.4: dependencies: jsesc "~0.5.0" -regular-table@=0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/regular-table/-/regular-table-0.2.1.tgz#af3d1efeeebe7d8071eda4e0dda689b4683ae156" - integrity sha512-24cKRtO/Gkj1p16mvqvkqWCTJSngAtFhYea7bax9XzNjTOy2DAF/507bQE+5zjq/qydfFXOUpTjnAjyIC1E5ug== +regular-table@=0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/regular-table/-/regular-table-0.3.1.tgz#68bb61a8c70c735bd223d2dbac0a1000620068af" + integrity sha512-wsJF/Jyk5ltpyRiwzbXTomiVso2xIggbB1ZH4gUW4VWIL2zdg21yIp3B0TdKyzyFSYMyayL4lF5f6Sqsa/vn8w== relateurl@0.2.x, relateurl@^0.2.7: version "0.2.7"