@perspective-dev/viewer 4.0.1 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/perspective-viewer.js +2 -2
- package/dist/cdn/perspective-viewer.js.map +4 -4
- package/dist/css/dracula.css +1 -1
- package/dist/css/gruvbox-dark.css +1 -1
- package/dist/css/gruvbox.css +1 -1
- package/dist/css/icons.css +1 -1
- package/dist/css/monokai.css +1 -1
- package/dist/css/pro-dark.css +1 -1
- package/dist/css/pro.css +1 -1
- package/dist/css/solarized-dark.css +1 -1
- package/dist/css/solarized.css +1 -1
- package/dist/css/themes.css +1 -1
- package/dist/css/vaporwave.css +1 -1
- package/dist/esm/extensions.d.ts +23 -2
- package/dist/esm/perspective-viewer.d.ts +2 -7
- package/dist/esm/perspective-viewer.inline.js +2 -2
- package/dist/esm/perspective-viewer.inline.js.map +4 -4
- package/dist/esm/perspective-viewer.js +2 -2
- package/dist/esm/perspective-viewer.js.map +4 -4
- package/dist/esm/plugin.d.ts +1 -1
- package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +1 -0
- package/dist/wasm/perspective-viewer.d.ts +218 -46
- package/dist/wasm/perspective-viewer.js +1242 -753
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +38 -19
- package/package.json +1 -1
- package/src/less/containers/scroll-panel.less +0 -1
- package/src/less/plugin-selector.less +15 -5
- package/src/less/status-bar.less +75 -27
- package/src/less/viewer.less +140 -58
- package/src/rust/components/column_dropdown.rs +21 -21
- package/src/rust/components/column_selector/active_column.rs +131 -120
- package/src/rust/components/column_selector/add_expression_button.rs +5 -0
- package/src/rust/components/column_selector/aggregate_selector.rs +8 -4
- package/src/rust/components/column_selector/config_selector.rs +170 -161
- package/src/rust/components/column_selector/empty_column.rs +16 -11
- package/src/rust/components/column_selector/{expression_toolbar.rs → expr_edit_button.rs} +7 -0
- package/src/rust/components/column_selector/filter_column.rs +195 -194
- package/src/rust/components/column_selector/inactive_column.rs +82 -67
- package/src/rust/components/column_selector/pivot_column.rs +16 -11
- package/src/rust/components/column_selector/sort_column.rs +9 -7
- package/src/rust/components/column_selector.rs +42 -37
- package/src/rust/components/column_settings_sidebar/save_settings.rs +3 -1
- package/src/rust/components/column_settings_sidebar/style_tab/agg_depth_selector.rs +58 -0
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/row_selector.rs +6 -6
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_pairs.rs +2 -94
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_pairs_item.rs +111 -0
- package/src/rust/components/column_settings_sidebar/style_tab/symbol.rs +3 -3
- package/src/rust/components/column_settings_sidebar/style_tab.rs +23 -83
- package/src/rust/components/{column_settings_sidebar/sidebar.rs → column_settings_sidebar.rs} +198 -171
- package/src/rust/components/containers/dragdrop_list.rs +20 -20
- package/src/rust/components/containers/dropdown_menu.rs +4 -6
- package/src/rust/components/containers/mod.rs +1 -4
- package/src/rust/components/containers/scroll_panel.rs +80 -80
- package/src/rust/components/containers/scroll_panel_item.rs +36 -36
- package/src/rust/components/containers/select.rs +46 -44
- package/src/rust/components/containers/sidebar.rs +3 -19
- package/src/rust/components/{column_settings_sidebar/style_tab/symbol/symbol_config.rs → containers/sidebar_close_button.rs} +15 -9
- package/src/rust/components/containers/split_panel.rs +212 -200
- package/src/rust/components/containers/tab_list.rs +11 -11
- package/src/rust/components/copy_dropdown.rs +22 -25
- package/src/rust/components/datetime_column_style/custom.rs +19 -19
- package/src/rust/components/datetime_column_style/simple.rs +13 -14
- package/src/rust/components/datetime_column_style.rs +75 -76
- package/src/rust/components/editable_header.rs +18 -14
- package/src/rust/components/empty_row.rs +5 -5
- package/src/rust/components/export_dropdown.rs +42 -42
- package/src/rust/components/expression_editor.rs +25 -19
- package/src/rust/components/filter_dropdown.rs +22 -22
- package/src/rust/components/font_loader.rs +11 -9
- package/src/rust/components/form/code_editor.rs +106 -105
- package/src/rust/components/form/color_range_selector.rs +14 -12
- package/src/rust/components/form/color_selector.rs +3 -1
- package/src/rust/components/form/debug.rs +95 -94
- package/src/rust/components/form/highlight.rs +5 -3
- package/src/rust/components/form/mod.rs +3 -2
- package/src/rust/components/form/optional_field.rs +2 -2
- package/src/rust/components/form/{select_field.rs → select_enum_field.rs} +1 -46
- package/src/rust/components/form/select_value_field.rs +64 -0
- package/src/rust/components/function_dropdown.rs +21 -21
- package/src/rust/components/main_panel.rs +219 -0
- package/src/rust/components/mod.rs +6 -6
- package/src/rust/components/modal.rs +42 -42
- package/src/rust/components/number_column_style.rs +34 -88
- package/src/rust/components/plugin_selector.rs +22 -25
- package/src/rust/components/render_warning.rs +9 -6
- package/src/rust/components/settings_panel.rs +82 -0
- package/src/rust/components/status_bar.rs +250 -146
- package/src/rust/components/status_bar_counter.rs +26 -119
- package/src/rust/components/status_indicator.rs +95 -79
- package/src/rust/components/string_column_style.rs +45 -45
- package/src/rust/components/style/style_provider.rs +1 -15
- package/src/rust/components/style_controls/number_string_format/digits_section.rs +1 -1
- package/src/rust/components/style_controls/number_string_format/misc_section.rs +1 -1
- package/src/rust/components/style_controls/number_string_format/style_section.rs +1 -1
- package/src/rust/components/style_controls/number_string_format.rs +45 -46
- package/src/rust/components/type_icon.rs +14 -11
- package/src/rust/components/viewer.rs +241 -384
- package/src/rust/config/columns_config.rs +2 -2
- package/src/rust/config/datetime_column_style.rs +1 -6
- package/src/rust/config/mod.rs +1 -0
- package/src/rust/config/number_column_style.rs +0 -6
- package/src/rust/config/number_string_format.rs +27 -4
- package/src/rust/config/viewer_config.rs +27 -167
- package/src/rust/custom_elements/copy_dropdown.rs +14 -6
- package/src/rust/custom_elements/export_dropdown.rs +15 -7
- package/src/rust/custom_elements/filter_dropdown.rs +4 -4
- package/src/rust/custom_elements/mod.rs +3 -0
- package/src/rust/custom_elements/viewer.rs +367 -169
- package/src/rust/custom_events.rs +55 -32
- package/src/rust/dragdrop.rs +4 -24
- package/src/rust/exprtk/cursor.rs +10 -1
- package/src/rust/exprtk/mod.rs +2 -0
- package/src/rust/exprtk/tokenize.rs +20 -3
- package/src/rust/js/clipboard.rs +2 -2
- package/src/rust/js/mimetype.rs +2 -7
- package/src/rust/js/mod.rs +0 -1
- package/src/rust/js/plugin.rs +7 -0
- package/src/rust/lib.rs +18 -5
- package/src/rust/model/column_locator.rs +82 -0
- package/src/rust/model/columns_iter_set.rs +1 -0
- package/src/rust/model/copy_export.rs +50 -14
- package/src/rust/model/edit_expression.rs +2 -5
- package/src/rust/model/eject.rs +41 -0
- package/src/rust/model/get_viewer_config.rs +4 -28
- package/src/rust/model/intersection_observer.rs +20 -8
- package/src/rust/model/mod.rs +11 -4
- package/src/rust/model/plugin_column_styles.rs +0 -31
- package/src/rust/model/reset_all.rs +38 -0
- package/src/rust/model/resize_observer.rs +34 -7
- package/src/rust/model/restore_and_render.rs +12 -7
- package/src/rust/{utils/scope.rs → model/send_plugin_config.rs} +32 -35
- package/src/rust/model/structural.rs +194 -23
- package/src/rust/model/update_and_render.rs +14 -4
- package/src/rust/{model/create_col.rs → presentation/column_locator.rs} +73 -42
- package/src/rust/{utils/wasm_abi.rs → presentation/sheets.rs} +54 -40
- package/src/rust/presentation.rs +60 -119
- package/src/rust/renderer/activate.rs +20 -5
- package/src/rust/renderer/limits.rs +0 -149
- package/src/rust/renderer/render_timer.rs +1 -1
- package/src/rust/renderer.rs +34 -18
- package/src/rust/root.rs +50 -0
- package/src/rust/session/column_defaults_update.rs +4 -4
- package/src/rust/session/drag_drop_update.rs +1 -1
- package/src/rust/session/metadata.rs +3 -17
- package/src/rust/session/replace_expression_update.rs +1 -2
- package/src/rust/session.rs +162 -82
- package/src/rust/utils/browser/blob.rs +16 -2
- package/src/rust/utils/browser/download.rs +1 -0
- package/src/rust/{components/column_settings_sidebar/mod.rs → utils/browser/dragdrop.rs} +14 -5
- package/src/rust/utils/browser/mod.rs +8 -4
- package/src/rust/utils/browser/selection.rs +5 -0
- package/src/rust/utils/custom_element.rs +28 -13
- package/src/rust/utils/datetime.rs +5 -0
- package/src/rust/utils/debounce.rs +7 -1
- package/src/rust/utils/hooks/use_async_callback.rs +7 -17
- package/src/rust/utils/mod.rs +28 -40
- package/src/rust/utils/number_format.rs +6 -5
- package/src/rust/utils/pubsub.rs +15 -10
- package/src/rust/utils/weak_scope.rs +11 -1
- package/src/svg/bookmark-icon.svg +4 -0
- package/src/svg/drag-handle copy.svg +10 -0
- package/src/svg/drawer-tab-hover.svg +5 -7
- package/src/svg/drawer-tab-invert-hover.svg +4 -8
- package/src/svg/drawer-tab-invert.svg +4 -7
- package/src/svg/drawer-tab.svg +4 -6
- package/src/svg/status_ok.svg +24 -24
- package/src/ts/extensions.ts +51 -3
- package/src/ts/perspective-viewer.ts +2 -14
- package/src/ts/plugin.ts +1 -1
- package/src/ts/ts-rs/ViewerConfigUpdate.ts +1 -1
- package/src/rust/components/column_settings_sidebar/style_tab/column_style.rs +0 -177
- package/src/rust/components/containers/tests/mod.rs +0 -11
- package/src/rust/components/containers/tests/split_panel.rs +0 -91
- package/src/rust/js/testing.rs +0 -149
- package/src/rust/utils/tee.rs +0 -88
- /package/dist/wasm/snippets/{perspective-viewer-9a89352df1552d2b → perspective-viewer-11a3c51b6310ee99}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-9a89352df1552d2b → perspective-viewer-11a3c51b6310ee99}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-9a89352df1552d2b → perspective-viewer-11a3c51b6310ee99}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-9a89352df1552d2b → perspective-viewer-11a3c51b6310ee99}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-9a89352df1552d2b → perspective-viewer-11a3c51b6310ee99}/inline4.js +0 -0
- /package/src/rust/components/{style_controls.rs → style_controls/mod.rs} +0 -0
- /package/src/rust/{components/containers → config}/kvpair.rs +0 -0
|
@@ -20,10 +20,11 @@ pub mod code_editor;
|
|
|
20
20
|
pub mod color_range_selector;
|
|
21
21
|
pub mod color_selector;
|
|
22
22
|
pub mod debug;
|
|
23
|
-
mod highlight;
|
|
24
23
|
pub mod number_field;
|
|
25
24
|
pub mod number_input;
|
|
26
25
|
pub mod number_range_field;
|
|
27
26
|
pub mod optional_field;
|
|
27
|
+
pub mod select_enum_field;
|
|
28
|
+
pub mod select_value_field;
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
mod highlight;
|
|
@@ -14,10 +14,10 @@ use yew::{Callback, Children, Html, MouseEvent, Properties, classes, function_co
|
|
|
14
14
|
|
|
15
15
|
#[derive(Properties, PartialEq)]
|
|
16
16
|
pub struct OptionalFieldProps {
|
|
17
|
-
pub label: String,
|
|
18
|
-
pub on_check: Callback<MouseEvent>,
|
|
19
17
|
pub checked: bool,
|
|
20
18
|
pub children: Children,
|
|
19
|
+
pub label: String,
|
|
20
|
+
pub on_check: Callback<MouseEvent>,
|
|
21
21
|
|
|
22
22
|
#[prop_or(String::from("section"))]
|
|
23
23
|
pub class: String,
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
12
|
|
|
13
13
|
use std::fmt::{Debug, Display};
|
|
14
|
-
use std::rc::Rc;
|
|
15
14
|
|
|
16
15
|
use itertools::Itertools;
|
|
17
16
|
use strum::IntoEnumIterator;
|
|
@@ -25,8 +24,8 @@ pub struct SelectEnumFieldProps<T>
|
|
|
25
24
|
where
|
|
26
25
|
T: IntoEnumIterator + Display + Default + PartialEq + Clone + 'static,
|
|
27
26
|
{
|
|
28
|
-
pub label: String,
|
|
29
27
|
pub current_value: Option<T>,
|
|
28
|
+
pub label: String,
|
|
30
29
|
pub on_change: Callback<Option<T>>,
|
|
31
30
|
|
|
32
31
|
#[prop_or_default]
|
|
@@ -58,47 +57,3 @@ where
|
|
|
58
57
|
</div>
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
|
-
|
|
62
|
-
#[derive(Properties, Debug, PartialEq, Clone)]
|
|
63
|
-
pub struct SelectValueFieldProps<T>
|
|
64
|
-
where
|
|
65
|
-
T: Display + PartialEq + Clone + 'static,
|
|
66
|
-
{
|
|
67
|
-
pub label: String,
|
|
68
|
-
pub current_value: Option<T>,
|
|
69
|
-
pub default_value: T,
|
|
70
|
-
pub values: Rc<Vec<T>>,
|
|
71
|
-
pub on_change: Callback<Option<T>>,
|
|
72
|
-
|
|
73
|
-
#[prop_or_default]
|
|
74
|
-
pub disabled: bool,
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
#[function_component(SelectValueField)]
|
|
78
|
-
pub fn select_value_field<T>(props: &SelectValueFieldProps<T>) -> yew::Html
|
|
79
|
-
where
|
|
80
|
-
T: Display + PartialEq + Clone + 'static,
|
|
81
|
-
{
|
|
82
|
-
let values = yew::use_memo(props.values.clone(), |values| {
|
|
83
|
-
values.iter().cloned().map(SelectItem::Option).collect_vec()
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
let selected = props
|
|
87
|
-
.current_value
|
|
88
|
-
.clone()
|
|
89
|
-
.unwrap_or_else(|| props.default_value.clone());
|
|
90
|
-
|
|
91
|
-
let checked = selected != props.default_value;
|
|
92
|
-
html! {
|
|
93
|
-
<div class="row">
|
|
94
|
-
<OptionalField
|
|
95
|
-
label={props.label.clone()}
|
|
96
|
-
on_check={props.on_change.reform(|_| None)}
|
|
97
|
-
{checked}
|
|
98
|
-
disabled={props.disabled}
|
|
99
|
-
>
|
|
100
|
-
<Select<T> {values} {selected} on_select={props.on_change.reform(Option::Some)} />
|
|
101
|
-
</OptionalField>
|
|
102
|
-
</div>
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
2
|
+
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
3
|
+
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
4
|
+
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
5
|
+
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
6
|
+
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
7
|
+
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
8
|
+
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
9
|
+
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
10
|
+
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
|
+
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
|
+
|
|
13
|
+
use std::fmt::{Debug, Display};
|
|
14
|
+
use std::rc::Rc;
|
|
15
|
+
|
|
16
|
+
use itertools::Itertools;
|
|
17
|
+
use yew::{Callback, Properties, function_component, html};
|
|
18
|
+
|
|
19
|
+
use crate::components::containers::select::{Select, SelectItem};
|
|
20
|
+
use crate::components::form::optional_field::OptionalField;
|
|
21
|
+
|
|
22
|
+
#[derive(Properties, Debug, PartialEq, Clone)]
|
|
23
|
+
pub struct SelectValueFieldProps<T>
|
|
24
|
+
where
|
|
25
|
+
T: Display + PartialEq + Clone + 'static,
|
|
26
|
+
{
|
|
27
|
+
pub current_value: Option<T>,
|
|
28
|
+
pub default_value: T,
|
|
29
|
+
pub label: String,
|
|
30
|
+
pub on_change: Callback<Option<T>>,
|
|
31
|
+
pub values: Rc<Vec<T>>,
|
|
32
|
+
|
|
33
|
+
#[prop_or_default]
|
|
34
|
+
pub disabled: bool,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[function_component(SelectValueField)]
|
|
38
|
+
pub fn select_value_field<T>(props: &SelectValueFieldProps<T>) -> yew::Html
|
|
39
|
+
where
|
|
40
|
+
T: Display + PartialEq + Clone + 'static,
|
|
41
|
+
{
|
|
42
|
+
let values = yew::use_memo(props.values.clone(), |values| {
|
|
43
|
+
values.iter().cloned().map(SelectItem::Option).collect_vec()
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
let selected = props
|
|
47
|
+
.current_value
|
|
48
|
+
.clone()
|
|
49
|
+
.unwrap_or_else(|| props.default_value.clone());
|
|
50
|
+
|
|
51
|
+
let checked = selected != props.default_value;
|
|
52
|
+
html! {
|
|
53
|
+
<div class="row">
|
|
54
|
+
<OptionalField
|
|
55
|
+
label={props.label.clone()}
|
|
56
|
+
on_check={props.on_change.reform(|_| None)}
|
|
57
|
+
{checked}
|
|
58
|
+
disabled={props.disabled}
|
|
59
|
+
>
|
|
60
|
+
<Select<T> {values} {selected} on_select={props.on_change.reform(Option::Some)} />
|
|
61
|
+
</OptionalField>
|
|
62
|
+
</div>
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -19,6 +19,18 @@ use crate::utils::WeakScope;
|
|
|
19
19
|
|
|
20
20
|
static CSS: &str = include_str!(concat!(env!("OUT_DIR"), "/css/function-dropdown.css"));
|
|
21
21
|
|
|
22
|
+
#[derive(Properties, PartialEq)]
|
|
23
|
+
pub struct FunctionDropDownProps {
|
|
24
|
+
#[prop_or_default]
|
|
25
|
+
pub weak_link: WeakScope<FunctionDropDown>,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
impl ModalLink<FunctionDropDown> for FunctionDropDownProps {
|
|
29
|
+
fn weak_link(&self) -> &'_ WeakScope<FunctionDropDown> {
|
|
30
|
+
&self.weak_link
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
pub enum FunctionDropDownMsg {
|
|
23
35
|
SetValues(Vec<CompletionItemSuggestion>),
|
|
24
36
|
SetCallback(Callback<CompletionItemSuggestion>),
|
|
@@ -33,18 +45,6 @@ pub struct FunctionDropDown {
|
|
|
33
45
|
on_select: Option<Callback<CompletionItemSuggestion>>,
|
|
34
46
|
}
|
|
35
47
|
|
|
36
|
-
#[derive(Properties, PartialEq)]
|
|
37
|
-
pub struct FunctionDropDownProps {
|
|
38
|
-
#[prop_or_default]
|
|
39
|
-
pub weak_link: WeakScope<FunctionDropDown>,
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
impl ModalLink<FunctionDropDown> for FunctionDropDownProps {
|
|
43
|
-
fn weak_link(&self) -> &'_ WeakScope<FunctionDropDown> {
|
|
44
|
-
&self.weak_link
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
48
|
impl Component for FunctionDropDown {
|
|
49
49
|
type Message = FunctionDropDownMsg;
|
|
50
50
|
type Properties = FunctionDropDownProps;
|
|
@@ -88,19 +88,19 @@ impl Component for FunctionDropDown {
|
|
|
88
88
|
},
|
|
89
89
|
FunctionDropDownMsg::ItemDown => {
|
|
90
90
|
self.selected += 1;
|
|
91
|
-
if let Some(ref values) = self.values
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
if let Some(ref values) = self.values {
|
|
92
|
+
if self.selected >= values.len() {
|
|
93
|
+
self.selected = 0;
|
|
94
|
+
}
|
|
95
95
|
};
|
|
96
96
|
|
|
97
97
|
true
|
|
98
98
|
},
|
|
99
99
|
FunctionDropDownMsg::ItemUp => {
|
|
100
|
-
if let Some(ref values) = self.values
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
if let Some(ref values) = self.values {
|
|
101
|
+
if self.selected < 1 {
|
|
102
|
+
self.selected = values.len();
|
|
103
|
+
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
self.selected -= 1;
|
|
@@ -146,6 +146,6 @@ impl Component for FunctionDropDown {
|
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
148
|
|
|
149
|
-
html! { <><style>{
|
|
149
|
+
html! { <><style>{ CSS }</style>{ body }</> }
|
|
150
150
|
}
|
|
151
151
|
}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
2
|
+
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
|
|
3
|
+
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
|
|
4
|
+
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
|
|
5
|
+
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
|
|
6
|
+
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
7
|
+
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
|
|
8
|
+
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
|
|
9
|
+
// ┃ This file is part of the Perspective library, distributed under the terms ┃
|
|
10
|
+
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
|
|
11
|
+
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
|
+
|
|
13
|
+
use futures::channel::oneshot::*;
|
|
14
|
+
use perspective_js::utils::*;
|
|
15
|
+
use wasm_bindgen::prelude::*;
|
|
16
|
+
use yew::prelude::*;
|
|
17
|
+
|
|
18
|
+
use super::render_warning::RenderWarning;
|
|
19
|
+
use super::status_bar::StatusBar;
|
|
20
|
+
use crate::PerspectiveProperties;
|
|
21
|
+
use crate::custom_events::CustomEvents;
|
|
22
|
+
use crate::presentation::Presentation;
|
|
23
|
+
use crate::renderer::*;
|
|
24
|
+
use crate::session::*;
|
|
25
|
+
use crate::utils::*;
|
|
26
|
+
|
|
27
|
+
#[derive(Clone, Properties, PerspectiveProperties!)]
|
|
28
|
+
pub struct MainPanelProps {
|
|
29
|
+
pub on_settings: Callback<()>,
|
|
30
|
+
|
|
31
|
+
/// State
|
|
32
|
+
pub custom_events: CustomEvents,
|
|
33
|
+
pub session: Session,
|
|
34
|
+
pub renderer: Renderer,
|
|
35
|
+
pub presentation: Presentation,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
impl PartialEq for MainPanelProps {
|
|
39
|
+
fn eq(&self, _rhs: &Self) -> bool {
|
|
40
|
+
false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
impl MainPanelProps {
|
|
45
|
+
fn is_title(&self) -> bool {
|
|
46
|
+
self.session.get_title().is_some()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#[derive(Debug)]
|
|
51
|
+
pub enum MainPanelMsg {
|
|
52
|
+
Reset(bool, Option<Sender<()>>),
|
|
53
|
+
RenderLimits(Option<(usize, usize, Option<usize>, Option<usize>)>),
|
|
54
|
+
PointerEvent(web_sys::PointerEvent),
|
|
55
|
+
Error,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
pub struct MainPanel {
|
|
59
|
+
_subscriptions: [Subscription; 2],
|
|
60
|
+
dimensions: Option<(usize, usize, Option<usize>, Option<usize>)>,
|
|
61
|
+
main_panel_ref: NodeRef,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
impl Component for MainPanel {
|
|
65
|
+
type Message = MainPanelMsg;
|
|
66
|
+
type Properties = MainPanelProps;
|
|
67
|
+
|
|
68
|
+
fn create(ctx: &Context<Self>) -> Self {
|
|
69
|
+
let session_sub = {
|
|
70
|
+
let callback = ctx.link().callback(move |(_, render_limits)| {
|
|
71
|
+
MainPanelMsg::RenderLimits(Some(render_limits))
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
ctx.props()
|
|
75
|
+
.renderer
|
|
76
|
+
.render_limits_changed
|
|
77
|
+
.add_listener(callback)
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
let error_sub = ctx
|
|
81
|
+
.props()
|
|
82
|
+
.session
|
|
83
|
+
.table_errored
|
|
84
|
+
.add_listener(ctx.link().callback(|_| MainPanelMsg::Error));
|
|
85
|
+
|
|
86
|
+
Self {
|
|
87
|
+
_subscriptions: [session_sub, error_sub],
|
|
88
|
+
dimensions: None,
|
|
89
|
+
main_panel_ref: NodeRef::default(),
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
|
94
|
+
match msg {
|
|
95
|
+
MainPanelMsg::Error => true,
|
|
96
|
+
MainPanelMsg::Reset(all, sender) => {
|
|
97
|
+
ctx.props().presentation.set_open_column_settings(None);
|
|
98
|
+
|
|
99
|
+
clone!(
|
|
100
|
+
ctx.props().renderer,
|
|
101
|
+
ctx.props().session,
|
|
102
|
+
ctx.props().presentation
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
ApiFuture::spawn(async move {
|
|
106
|
+
session
|
|
107
|
+
.reset(ResetOptions {
|
|
108
|
+
config: true,
|
|
109
|
+
expressions: all,
|
|
110
|
+
..ResetOptions::default()
|
|
111
|
+
})
|
|
112
|
+
.await?;
|
|
113
|
+
let columns_config = if all {
|
|
114
|
+
presentation.reset_columns_configs();
|
|
115
|
+
None
|
|
116
|
+
} else {
|
|
117
|
+
Some(presentation.all_columns_configs())
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
renderer.reset(columns_config.as_ref()).await?;
|
|
121
|
+
presentation.reset_available_themes(None).await;
|
|
122
|
+
if all {
|
|
123
|
+
presentation.reset_theme().await?;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
let result = renderer.draw(session.validate().await?.create_view()).await;
|
|
127
|
+
if let Some(sender) = sender {
|
|
128
|
+
sender.send(()).unwrap();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
renderer.reset_changed.emit(());
|
|
132
|
+
result
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
false
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
MainPanelMsg::RenderLimits(dimensions) => {
|
|
139
|
+
if self.dimensions != dimensions {
|
|
140
|
+
self.dimensions = dimensions;
|
|
141
|
+
true
|
|
142
|
+
} else {
|
|
143
|
+
false
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
MainPanelMsg::PointerEvent(event) => {
|
|
148
|
+
if event.target().map(JsValue::from)
|
|
149
|
+
== self
|
|
150
|
+
.main_panel_ref
|
|
151
|
+
.cast::<web_sys::HtmlElement>()
|
|
152
|
+
.map(JsValue::from)
|
|
153
|
+
{
|
|
154
|
+
ctx.props()
|
|
155
|
+
.custom_events
|
|
156
|
+
.dispatch_event(format!("statusbar-{}", event.type_()).as_str(), &event)
|
|
157
|
+
.unwrap();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
false
|
|
161
|
+
},
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
fn changed(&mut self, _ctx: &Context<Self>, _old: &Self::Properties) -> bool {
|
|
166
|
+
true
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
fn view(&self, ctx: &Context<Self>) -> Html {
|
|
170
|
+
let Self::Properties {
|
|
171
|
+
custom_events,
|
|
172
|
+
presentation,
|
|
173
|
+
renderer,
|
|
174
|
+
session,
|
|
175
|
+
..
|
|
176
|
+
} = ctx.props();
|
|
177
|
+
|
|
178
|
+
let is_settings_open =
|
|
179
|
+
ctx.props().presentation.is_settings_open() && ctx.props().session.has_table();
|
|
180
|
+
|
|
181
|
+
let on_settings = (!is_settings_open).then(|| ctx.props().on_settings.clone());
|
|
182
|
+
|
|
183
|
+
let mut class = classes!();
|
|
184
|
+
if !is_settings_open {
|
|
185
|
+
class.push("settings-closed");
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if ctx.props().is_title() {
|
|
189
|
+
class.push("titled");
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
let on_reset = ctx.link().callback(|all| MainPanelMsg::Reset(all, None));
|
|
193
|
+
let pointerdown = ctx.link().callback(MainPanelMsg::PointerEvent);
|
|
194
|
+
html! {
|
|
195
|
+
<div id="main_column">
|
|
196
|
+
<StatusBar
|
|
197
|
+
id="status_bar"
|
|
198
|
+
{on_settings}
|
|
199
|
+
on_reset={on_reset.clone()}
|
|
200
|
+
{custom_events}
|
|
201
|
+
{presentation}
|
|
202
|
+
{renderer}
|
|
203
|
+
{session}
|
|
204
|
+
/>
|
|
205
|
+
<div
|
|
206
|
+
id="main_panel_container"
|
|
207
|
+
ref={self.main_panel_ref.clone()}
|
|
208
|
+
{class}
|
|
209
|
+
onpointerdown={pointerdown}
|
|
210
|
+
>
|
|
211
|
+
<RenderWarning {renderer} {session} dimensions={self.dimensions} />
|
|
212
|
+
<slot />
|
|
213
|
+
</div>
|
|
214
|
+
</div>
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
fn destroy(&mut self, _ctx: &Context<Self>) {}
|
|
219
|
+
}
|
|
@@ -16,9 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
pub mod column_dropdown;
|
|
18
18
|
pub mod column_selector;
|
|
19
|
+
pub mod column_settings_sidebar;
|
|
19
20
|
pub mod containers;
|
|
20
21
|
pub mod copy_dropdown;
|
|
21
22
|
pub mod datetime_column_style;
|
|
23
|
+
pub mod editable_header;
|
|
24
|
+
pub mod empty_row;
|
|
22
25
|
pub mod error_message;
|
|
23
26
|
pub mod export_dropdown;
|
|
24
27
|
pub mod expression_editor;
|
|
@@ -26,20 +29,17 @@ pub mod filter_dropdown;
|
|
|
26
29
|
pub mod font_loader;
|
|
27
30
|
pub mod form;
|
|
28
31
|
pub mod function_dropdown;
|
|
32
|
+
pub mod main_panel;
|
|
29
33
|
pub mod modal;
|
|
30
34
|
pub mod number_column_style;
|
|
31
35
|
pub mod plugin_selector;
|
|
32
36
|
pub mod render_warning;
|
|
37
|
+
pub mod settings_panel;
|
|
33
38
|
pub mod status_bar;
|
|
34
39
|
pub mod status_bar_counter;
|
|
35
40
|
pub mod status_indicator;
|
|
36
41
|
pub mod string_column_style;
|
|
37
42
|
pub mod style;
|
|
43
|
+
pub mod style_controls;
|
|
38
44
|
pub mod type_icon;
|
|
39
45
|
pub mod viewer;
|
|
40
|
-
|
|
41
|
-
pub mod column_settings_sidebar;
|
|
42
|
-
pub mod style_controls;
|
|
43
|
-
// pub mod empty_row;
|
|
44
|
-
pub mod editable_header;
|
|
45
|
-
pub mod empty_row;
|
|
@@ -21,36 +21,14 @@ use yew::virtual_dom::VChild;
|
|
|
21
21
|
|
|
22
22
|
use crate::utils::WeakScope;
|
|
23
23
|
|
|
24
|
-
#[derive(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
impl ImplicitClone for ModalOrientation {}
|
|
28
|
-
|
|
29
|
-
impl From<ModalOrientation> for bool {
|
|
30
|
-
fn from(x: ModalOrientation) -> Self {
|
|
31
|
-
x.0.get()
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
pub trait ModalLink<T>
|
|
36
|
-
where
|
|
37
|
-
T: Component,
|
|
38
|
-
{
|
|
39
|
-
fn weak_link(&self) -> &'_ WeakScope<T>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
pub trait SetModalLink {
|
|
43
|
-
fn set_modal_link(&self);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
impl<T> SetModalLink for &Context<T>
|
|
24
|
+
#[derive(Properties, Derivative)]
|
|
25
|
+
#[derivative(PartialEq(bound = ""))]
|
|
26
|
+
pub struct ModalProps<T>
|
|
47
27
|
where
|
|
48
28
|
T: Component,
|
|
49
29
|
T::Properties: ModalLink<T>,
|
|
50
30
|
{
|
|
51
|
-
|
|
52
|
-
*self.props().weak_link().borrow_mut() = Some(self.link().clone());
|
|
53
|
-
}
|
|
31
|
+
pub child: Option<VChild<T>>,
|
|
54
32
|
}
|
|
55
33
|
|
|
56
34
|
#[derive(Debug)]
|
|
@@ -67,16 +45,6 @@ where
|
|
|
67
45
|
SubMsg(T::Message),
|
|
68
46
|
}
|
|
69
47
|
|
|
70
|
-
#[derive(Properties, Derivative)]
|
|
71
|
-
#[derivative(PartialEq(bound = ""))]
|
|
72
|
-
pub struct ModalProps<T>
|
|
73
|
-
where
|
|
74
|
-
T: Component,
|
|
75
|
-
T::Properties: ModalLink<T>,
|
|
76
|
-
{
|
|
77
|
-
pub child: Option<VChild<T>>,
|
|
78
|
-
}
|
|
79
|
-
|
|
80
48
|
#[derive(Default)]
|
|
81
49
|
pub struct Modal<T> {
|
|
82
50
|
css: String,
|
|
@@ -114,10 +82,10 @@ where
|
|
|
114
82
|
true
|
|
115
83
|
},
|
|
116
84
|
ModalMsg::SubMsg(msg) => {
|
|
117
|
-
if let Some(child) = &ctx.props().child
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
85
|
+
if let Some(child) = &ctx.props().child {
|
|
86
|
+
if let Some(link) = child.props.weak_link().borrow().as_ref() {
|
|
87
|
+
link.send_message(msg);
|
|
88
|
+
}
|
|
121
89
|
}
|
|
122
90
|
|
|
123
91
|
false
|
|
@@ -144,8 +112,40 @@ where
|
|
|
144
112
|
}
|
|
145
113
|
}
|
|
146
114
|
|
|
115
|
+
#[derive(Clone, Default, Eq, PartialEq)]
|
|
116
|
+
pub struct ModalOrientation(Rc<Cell<bool>>);
|
|
117
|
+
|
|
118
|
+
impl ImplicitClone for ModalOrientation {}
|
|
119
|
+
|
|
120
|
+
impl From<ModalOrientation> for bool {
|
|
121
|
+
fn from(x: ModalOrientation) -> Self {
|
|
122
|
+
x.0.get()
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
pub trait ModalLink<T>
|
|
127
|
+
where
|
|
128
|
+
T: Component,
|
|
129
|
+
{
|
|
130
|
+
fn weak_link(&self) -> &'_ WeakScope<T>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
pub trait SetModalLink {
|
|
134
|
+
fn set_modal_link(&self);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
impl<T> SetModalLink for &Context<T>
|
|
138
|
+
where
|
|
139
|
+
T: Component,
|
|
140
|
+
T::Properties: ModalLink<T>,
|
|
141
|
+
{
|
|
142
|
+
fn set_modal_link(&self) {
|
|
143
|
+
*self.props().weak_link().borrow_mut() = Some(self.link().clone());
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
147
|
#[derive(Properties, Clone)]
|
|
148
|
-
|
|
148
|
+
struct NoRenderProps {
|
|
149
149
|
pub children: Children,
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -155,7 +155,7 @@ impl PartialEq for NoRenderProps {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
struct NoRender {}
|
|
159
159
|
|
|
160
160
|
impl Component for NoRender {
|
|
161
161
|
type Message = ();
|