Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual column selector #1722

Merged
merged 1 commit into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions packages/perspective-jupyterlab/test/js/resize.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ utils.with_server({}, () => {
await document
.querySelector("perspective-viewer")
.getTable();
await document
.querySelector("perspective-viewer")
.flush();
});

await page.evaluate(async () => {
Expand All @@ -57,15 +54,15 @@ utils.with_server({}, () => {

await document
.querySelector("perspective-viewer")
.notifyResize(true);
.notifyResize();
});

return await page.evaluate(async () => {
document.querySelector(".PSPContainer").style =
"position:absolute;top:0;left:0;width:800px;height:600px";
await document
.querySelector("perspective-viewer")
.notifyResize(true);
.notifyResize();

for (const elem of document.querySelectorAll(
"perspective-viewer *"
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective-jupyterlab/test/results/results.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"__GIT_COMMIT__": "0b9fc62de9bfacc5276b8705f036dd508fef39b9",
"__GIT_COMMIT__": "e5cc80e76f83b7ff82cb7a284f1f19c14c7b8624",
"resize_Config_should_show_by_default": "70a7f98766d197aa3d6e568f5effc306",
"resize_Resize_the_container_causes_the_widget_to_resize": "0f8af36778efdff9b9cff3a3b155d2b3",
"resize_group_by_traitlet_works": "52f47ba2da28aa605a3d55051cf866c1"
Expand Down
13 changes: 9 additions & 4 deletions rust/perspective-viewer/src/less/column-selector.less
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

.dragdrop-highlight {
.column_selector_draggable.dragover,
.column-selector-column:not(:last-child)
.column-selector-column:not(:last-child):not(:nth-last-child(2))
.column_selector_draggable {
border-bottom-color: var(--active--color) !important;
}
Expand All @@ -86,7 +86,8 @@
align-items: stretch;
font-size: 12px;

&:last-child {
&:last-child,
&:nth-last-child(2) {
.column_selector_draggable {
border-color: transparent;
}
Expand Down Expand Up @@ -231,7 +232,7 @@
#active-columns,
#sub-columns {
flex: 0 1 auto;
overflow-x: hidden;
overflow-x: hidden !important;
overflow-y: scroll;

&::-webkit-scrollbar-thumb {
Expand All @@ -255,6 +256,7 @@
}

#active-columns {
display: flex;
.is_column_active {
color: var(--active--color, #999);
&:before {
Expand Down Expand Up @@ -328,7 +330,10 @@
// selected for the `columns` field of the `ViewConfig`.
#inactive-columns,
#expression-columns {
margin-bottom: 6px;
& > div:not(:empty) {
margin-bottom: 6px;
}

&:empty {
display: none;
margin: 0px;
Expand Down
24 changes: 24 additions & 0 deletions rust/perspective-viewer/src/less/scroll-panel.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/******************************************************************************
*
* Copyright (c) 2017, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms
* of the Apache License 2.0. The full license can be found in the LICENSE
* file.
*
*/

:host {
.scroll-panel-container {
will-change: transform;
}

.scroll-panel-auto-width {
height: 1px;
margin-top: -1px;
}

.scroll-panel-content {
width: 100%;
}
}
1 change: 1 addition & 0 deletions rust/perspective-viewer/src/less/viewer.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
@import "./column-selector.less";
@import "./config-selector.less";
@import "./filter-item.less";
@import "./scroll-panel.less";

:host {
position: relative;
Expand Down
17 changes: 14 additions & 3 deletions rust/perspective-viewer/src/rust/components/active_column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub struct ActiveColumnProps {
pub ondragenter: Callback<DragEvent>,
pub ondragend: Callback<DragEvent>,
pub onselect: Callback<()>,
pub config: ViewConfig,

#[prop_or_default]
pub is_pivot: bool,
Expand Down Expand Up @@ -60,6 +59,17 @@ impl ActiveColumnProps {
}
}

impl From<ActiveColumnProps> for yew::Html {
fn from(props: ActiveColumnProps) -> Self {
html! {
html! {
<ActiveColumn with props>
</ActiveColumn>
}
}
}
}

derive_session_renderer_model!(ActiveColumnProps);

impl ActiveColumnProps {
Expand All @@ -71,7 +81,7 @@ impl ActiveColumnProps {
/// respect to `columns`.
/// - `shift` whether to toggle or select this column.
pub fn deactivate_column(&self, name: String, shift: bool) {
let ViewConfig { mut columns, .. } = self.session.get_view_config();
let mut columns = self.session.borrow_view_config().columns.clone();
let max_cols = self
.renderer
.metadata()
Expand Down Expand Up @@ -290,7 +300,8 @@ impl Component for ActiveColumn {
if ctx.props().is_pivot {
let aggregate = ctx
.props()
.config
.session
.borrow_view_config()
.aggregates
.get(&name)
.cloned();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pub struct AggregateSelectorProps {
derive_session_renderer_model!(AggregateSelectorProps);

impl PartialEq for AggregateSelectorProps {
fn eq(&self, _rhs: &Self) -> bool {
false
fn eq(&self, rhs: &Self) -> bool {
self.column == rhs.column && self.aggregate == rhs.aggregate
}
}

Expand Down
Loading