@perspective-dev/viewer 4.4.1 → 4.5.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 +1 -2
- package/dist/cdn/perspective-viewer.js.map +4 -4
- package/dist/css/botanical.css +1 -1
- 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/intl/de.css +1 -1
- package/dist/css/intl/es.css +1 -1
- package/dist/css/intl/fr.css +1 -1
- package/dist/css/intl/ja.css +1 -1
- package/dist/css/intl/pt.css +1 -1
- package/dist/css/intl/zh.css +1 -1
- package/dist/css/intl.css +1 -1
- package/dist/css/monokai.css +1 -1
- package/dist/css/phosphor.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/bootstrap.d.ts +2 -1
- package/dist/esm/column-format.d.ts +51 -0
- package/dist/esm/extensions.d.ts +2 -0
- package/dist/esm/perspective-viewer.d.ts +3 -1
- package/dist/esm/perspective-viewer.inline.js +1 -2
- package/dist/esm/perspective-viewer.inline.js.map +4 -4
- package/dist/esm/perspective-viewer.js +1 -2
- package/dist/esm/perspective-viewer.js.map +4 -4
- package/dist/esm/perspective-viewer.worker.d.ts +2 -0
- package/dist/esm/plugin.d.ts +16 -72
- package/dist/esm/ts-rs/ColumnSelectMode.d.ts +1 -0
- package/dist/esm/ts-rs/PluginStaticConfig.d.ts +77 -0
- package/dist/esm/ts-rs/ViewerConfig.d.ts +6 -3
- package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +7 -4
- package/dist/wasm/perspective-viewer.d.ts +77 -18
- package/dist/wasm/perspective-viewer.js +302 -148
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +20 -15
- package/package.json +24 -2
- package/src/css/column-selector.css +3 -2
- package/src/css/column-settings-panel.css +44 -9
- package/src/css/column-style.css +35 -2
- package/src/css/containers/scroll-panel.css +2 -1
- package/src/css/containers/tabs.css +8 -52
- package/src/css/dom/checkbox.css +2 -6
- package/src/css/form/code-editor.css +1 -0
- package/src/css/form/debug.css +3 -10
- package/src/css/plugin-selector.css +33 -0
- package/src/css/plugin-settings-panel.css +99 -0
- package/src/css/viewer.css +143 -3
- package/src/rust/components/column_dropdown.rs +3 -1
- package/src/rust/components/column_selector/active_column.rs +16 -19
- package/src/rust/components/column_selector/config_selector.rs +20 -20
- package/src/rust/components/column_selector/filter_column.rs +14 -14
- package/src/rust/components/column_selector/inactive_column.rs +10 -15
- package/src/rust/components/column_selector/pivot_column.rs +7 -7
- package/src/rust/components/column_selector/sort_column.rs +7 -7
- package/src/rust/components/column_selector.rs +55 -37
- package/src/rust/components/column_settings_sidebar/style_tab/agg_depth_selector.rs +15 -7
- package/src/rust/components/column_settings_sidebar/style_tab/primitive_field.rs +395 -0
- package/src/rust/components/column_settings_sidebar/style_tab/symbol.rs +15 -6
- package/src/rust/components/column_settings_sidebar/style_tab.rs +267 -136
- package/src/rust/components/column_settings_sidebar.rs +44 -49
- package/src/rust/components/containers/dragdrop_list.rs +32 -5
- package/src/rust/components/containers/mod.rs +0 -1
- package/src/rust/components/containers/scroll_panel.rs +21 -7
- package/src/rust/components/containers/sidebar.rs +8 -6
- package/src/rust/components/containers/split_panel.rs +3 -3
- package/src/rust/components/containers/tab_list.rs +3 -9
- package/src/rust/components/copy_dropdown.rs +2 -3
- package/src/rust/components/datetime_column_style.rs +19 -81
- package/src/rust/components/editable_header.rs +17 -3
- package/src/rust/components/export_dropdown.rs +2 -3
- package/src/rust/components/expression_editor.rs +29 -17
- package/src/rust/components/filter_dropdown.rs +2 -1
- package/src/rust/components/form/color_range_selector.rs +14 -7
- package/src/rust/components/form/debug.rs +47 -37
- package/src/rust/components/main_panel.rs +24 -65
- package/src/rust/components/mod.rs +2 -1
- package/src/rust/components/number_series_style.rs +161 -0
- package/src/rust/components/plugin_tab.rs +221 -0
- package/src/rust/components/settings_panel.rs +181 -59
- package/src/rust/components/status_bar.rs +141 -174
- package/src/rust/components/status_indicator.rs +15 -22
- package/src/rust/components/string_column_style.rs +20 -82
- package/src/rust/components/style_controls/number_string_format.rs +14 -30
- package/src/rust/components/viewer.rs +169 -132
- package/src/rust/config/column_config_schema.rs +195 -0
- package/src/rust/config/columns_config.rs +4 -97
- package/src/rust/config/datetime_column_style.rs +0 -5
- package/src/rust/config/mod.rs +8 -2
- package/src/rust/config/number_series_style.rs +79 -0
- package/src/rust/config/plugin_static_config.rs +144 -0
- package/src/rust/config/string_column_style.rs +0 -5
- package/src/rust/config/viewer_config.rs +5 -6
- package/src/rust/custom_elements/copy_dropdown.rs +30 -18
- package/src/rust/custom_elements/debug_plugin.rs +1 -3
- package/src/rust/custom_elements/export_dropdown.rs +26 -18
- package/src/rust/custom_elements/viewer.rs +62 -73
- package/src/rust/custom_events.rs +181 -224
- package/src/rust/js/plugin.rs +45 -117
- package/src/rust/lib.rs +34 -5
- package/src/rust/presentation/drag_helpers.rs +206 -0
- package/src/rust/presentation/props.rs +8 -0
- package/src/rust/presentation.rs +256 -41
- package/src/rust/{tasks → queries}/column_locator.rs +17 -73
- package/src/rust/queries/column_values.rs +59 -0
- package/src/rust/{tasks → queries}/columns_iter_set.rs +11 -18
- package/src/rust/queries/exports.rs +96 -0
- package/src/rust/queries/fetch_column_stats.rs +94 -0
- package/src/rust/queries/get_viewer_config.rs +54 -0
- package/src/rust/queries/mod.rs +44 -0
- package/src/rust/queries/plugin_column_styles.rs +101 -0
- package/src/rust/{engines.rs → queries/validate_expression.rs} +26 -15
- package/src/rust/renderer/activate.rs +1 -0
- package/src/rust/renderer/limits.rs +9 -4
- package/src/rust/renderer/plugin_store.rs +12 -0
- package/src/rust/renderer/props.rs +28 -3
- package/src/rust/renderer/registry.rs +40 -15
- package/src/rust/renderer.rs +703 -60
- package/src/rust/session/column_defaults_update.rs +20 -28
- package/src/rust/session/drag_drop_update.rs +10 -10
- package/src/rust/session/metadata.rs +31 -16
- package/src/rust/session/props.rs +15 -6
- package/src/rust/session/view_subscription.rs +10 -0
- package/src/rust/session.rs +109 -147
- package/src/rust/tasks/copy_export.rs +178 -158
- package/src/rust/tasks/{structural.rs → dismiss_render_warning.rs} +20 -40
- package/src/rust/tasks/edit_expression.rs +68 -88
- package/src/rust/tasks/eject.rs +25 -22
- package/src/rust/tasks/intersection_observer.rs +8 -21
- package/src/rust/tasks/mod.rs +19 -21
- package/src/rust/tasks/reset_all.rs +98 -0
- package/src/rust/tasks/resize_observer.rs +11 -33
- package/src/rust/tasks/restore_and_render.rs +128 -90
- package/src/rust/tasks/{get_viewer_config.rs → send_column_config.rs} +39 -35
- package/src/rust/tasks/send_plugin_config.rs +33 -33
- package/src/rust/tasks/update_and_render.rs +75 -49
- package/src/rust/{components/containers/trap_door_panel.rs → tasks/update_theme.rs} +34 -33
- package/src/rust/tasks/validate_expression.rs +61 -0
- package/src/rust/utils/browser/selection.rs +4 -4
- package/src/rust/utils/mod.rs +0 -63
- package/src/svg/checkbox-checked-icon.svg +1 -1
- package/src/svg/checkbox-unchecked-icon.svg +1 -1
- package/src/svg/mega-menu-icons-density.svg +23 -0
- package/src/svg/mega-menu-icons-map-density.svg +24 -0
- package/src/svg/mega-menu-icons-map-line.svg +19 -0
- package/src/themes/botanical.css +27 -53
- package/src/themes/defaults.css +24 -36
- package/src/themes/dracula.css +36 -54
- package/src/themes/gruvbox-dark.css +39 -59
- package/src/themes/gruvbox.css +16 -28
- package/src/themes/icons.css +5 -0
- package/src/themes/intl/de.css +43 -6
- package/src/themes/intl/es.css +43 -6
- package/src/themes/intl/fr.css +43 -6
- package/src/themes/intl/ja.css +43 -6
- package/src/themes/intl/pt.css +43 -6
- package/src/themes/intl/zh.css +43 -6
- package/src/themes/intl.css +38 -4
- package/src/themes/monokai.css +45 -61
- package/src/themes/phosphor.css +20 -29
- package/src/themes/pro-dark.css +25 -34
- package/src/themes/solarized-dark.css +21 -36
- package/src/themes/solarized.css +13 -23
- package/src/themes/vaporwave.css +40 -74
- package/src/ts/bootstrap.ts +14 -3
- package/src/ts/column-format.ts +162 -0
- package/src/ts/extensions.ts +4 -0
- package/src/ts/perspective-viewer.ts +9 -1
- package/src/{rust/components/column_settings_sidebar/style_tab/stub.rs → ts/perspective-viewer.worker.ts} +2 -22
- package/src/ts/plugin.ts +25 -101
- package/src/ts/ts-rs/{FormatUnit.ts → ColumnSelectMode.ts} +1 -1
- package/src/ts/ts-rs/PluginStaticConfig.ts +78 -0
- package/src/ts/ts-rs/ViewerConfig.ts +1 -2
- package/src/ts/ts-rs/ViewerConfigUpdate.ts +2 -3
- package/dist/esm/ts-rs/ColumnConfigValues.d.ts +0 -31
- package/dist/esm/ts-rs/CustomDatetimeFormat.d.ts +0 -1
- package/dist/esm/ts-rs/CustomDatetimeStyleConfig.d.ts +0 -15
- package/dist/esm/ts-rs/CustomNumberFormatConfig.d.ts +0 -18
- package/dist/esm/ts-rs/DatetimeColorMode.d.ts +0 -1
- package/dist/esm/ts-rs/DatetimeFormatType.d.ts +0 -6
- package/dist/esm/ts-rs/FormatMode.d.ts +0 -1
- package/dist/esm/ts-rs/FormatUnit.d.ts +0 -1
- package/dist/esm/ts-rs/NumberBackgroundMode.d.ts +0 -1
- package/dist/esm/ts-rs/NumberForegroundMode.d.ts +0 -1
- package/dist/esm/ts-rs/PluginConfig.d.ts +0 -2
- package/dist/esm/ts-rs/RoundingMode.d.ts +0 -1
- package/dist/esm/ts-rs/RoundingPriority.d.ts +0 -1
- package/dist/esm/ts-rs/SignDisplay.d.ts +0 -1
- package/dist/esm/ts-rs/SimpleDatetimeFormat.d.ts +0 -1
- package/dist/esm/ts-rs/SimpleDatetimeStyleConfig.d.ts +0 -6
- package/dist/esm/ts-rs/StringColorMode.d.ts +0 -1
- package/dist/esm/ts-rs/TrailingZeroDisplay.d.ts +0 -1
- package/dist/esm/ts-rs/UseGrouping.d.ts +0 -1
- package/src/rust/components/number_column_style.rs +0 -491
- package/src/rust/config/number_column_style.rs +0 -136
- package/src/rust/dragdrop.rs +0 -481
- package/src/rust/tasks/plugin_column_styles.rs +0 -98
- package/src/ts/ts-rs/ColumnConfigValues.ts +0 -14
- package/src/ts/ts-rs/CustomDatetimeFormat.ts +0 -3
- package/src/ts/ts-rs/CustomDatetimeStyleConfig.ts +0 -5
- package/src/ts/ts-rs/CustomNumberFormatConfig.ts +0 -8
- package/src/ts/ts-rs/DatetimeColorMode.ts +0 -3
- package/src/ts/ts-rs/DatetimeFormatType.ts +0 -8
- package/src/ts/ts-rs/FormatMode.ts +0 -3
- package/src/ts/ts-rs/NumberBackgroundMode.ts +0 -3
- package/src/ts/ts-rs/NumberForegroundMode.ts +0 -3
- package/src/ts/ts-rs/PluginConfig.ts +0 -4
- package/src/ts/ts-rs/RoundingMode.ts +0 -3
- package/src/ts/ts-rs/RoundingPriority.ts +0 -3
- package/src/ts/ts-rs/SignDisplay.ts +0 -3
- package/src/ts/ts-rs/SimpleDatetimeFormat.ts +0 -3
- package/src/ts/ts-rs/SimpleDatetimeStyleConfig.ts +0 -4
- package/src/ts/ts-rs/StringColorMode.ts +0 -3
- package/src/ts/ts-rs/TrailingZeroDisplay.ts +0 -3
- package/src/ts/ts-rs/UseGrouping.ts +0 -3
- /package/dist/wasm/snippets/{perspective-viewer-d924246f0b4a3dce → perspective-viewer-3cd58f0374935772}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-d924246f0b4a3dce → perspective-viewer-3cd58f0374935772}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-d924246f0b4a3dce → perspective-viewer-3cd58f0374935772}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-d924246f0b4a3dce → perspective-viewer-3cd58f0374935772}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-d924246f0b4a3dce → perspective-viewer-3cd58f0374935772}/inline4.js +0 -0
- /package/src/rust/{tasks → config}/export_method.rs +0 -0
- /package/src/rust/{tasks → queries}/export_app.rs +0 -0
- /package/src/rust/{tasks → queries}/is_invalid_drop.rs +0 -0
|
@@ -11,9 +11,7 @@
|
|
|
11
11
|
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
12
12
|
|
|
13
13
|
use yew::prelude::*;
|
|
14
|
-
use yew::*;
|
|
15
14
|
|
|
16
|
-
use super::form::color_selector::*;
|
|
17
15
|
use super::modal::{ModalLink, SetModalLink};
|
|
18
16
|
use super::style::LocalStyle;
|
|
19
17
|
use crate::components::form::select_enum_field::SelectEnumField;
|
|
@@ -21,13 +19,18 @@ use crate::config::*;
|
|
|
21
19
|
use crate::css;
|
|
22
20
|
use crate::utils::WeakScope;
|
|
23
21
|
|
|
22
|
+
/// Format-only widget for [`String`] columns. Renders the `format` enum
|
|
23
|
+
/// only; color/color-mode UI is provided externally as primitive `Enum`
|
|
24
|
+
/// + `Color` schema fields.
|
|
24
25
|
#[derive(Properties)]
|
|
25
26
|
pub struct StringColumnStyleProps {
|
|
26
27
|
pub config: Option<StringColumnStyleConfig>,
|
|
27
|
-
pub default_config: StringColumnStyleDefaultConfig,
|
|
28
28
|
|
|
29
29
|
#[prop_or_default]
|
|
30
|
-
pub on_change: Callback<
|
|
30
|
+
pub on_change: Callback<ColumnConfigFieldUpdate>,
|
|
31
|
+
|
|
32
|
+
#[prop_or_default]
|
|
33
|
+
pub keys: Vec<String>,
|
|
31
34
|
|
|
32
35
|
#[prop_or_default]
|
|
33
36
|
weak_link: WeakScope<StringColumnStyle>,
|
|
@@ -41,22 +44,16 @@ impl ModalLink<StringColumnStyle> for StringColumnStyleProps {
|
|
|
41
44
|
|
|
42
45
|
impl PartialEq for StringColumnStyleProps {
|
|
43
46
|
fn eq(&self, other: &Self) -> bool {
|
|
44
|
-
self.config == other.config
|
|
47
|
+
self.config == other.config
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
pub enum StringColumnStyleMsg {
|
|
49
|
-
Reset(StringColumnStyleConfig),
|
|
50
52
|
FormatChanged(Option<FormatMode>),
|
|
51
|
-
ColorModeChanged(Option<StringColorMode>),
|
|
52
|
-
ColorChanged(String),
|
|
53
|
-
ColorReset,
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
/// A component for the style form control for [`String`] columns.
|
|
57
55
|
pub struct StringColumnStyle {
|
|
58
56
|
config: StringColumnStyleConfig,
|
|
59
|
-
default_config: StringColumnStyleDefaultConfig,
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
impl Component for StringColumnStyle {
|
|
@@ -67,11 +64,9 @@ impl Component for StringColumnStyle {
|
|
|
67
64
|
ctx.set_modal_link();
|
|
68
65
|
Self {
|
|
69
66
|
config: ctx.props().config.clone().unwrap_or_default(),
|
|
70
|
-
default_config: ctx.props().default_config.clone(),
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
69
|
|
|
74
|
-
// Always re-render when config changes.
|
|
75
70
|
fn changed(&mut self, ctx: &Context<Self>, _old: &Self::Properties) -> bool {
|
|
76
71
|
let mut new_config = ctx.props().config.clone().unwrap_or_default();
|
|
77
72
|
if self.config != new_config {
|
|
@@ -84,51 +79,16 @@ impl Component for StringColumnStyle {
|
|
|
84
79
|
|
|
85
80
|
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
|
86
81
|
match msg {
|
|
87
|
-
StringColumnStyleMsg::Reset(config) => {
|
|
88
|
-
self.config = config;
|
|
89
|
-
true
|
|
90
|
-
},
|
|
91
82
|
StringColumnStyleMsg::FormatChanged(val) => {
|
|
92
83
|
self.config.format = val.unwrap_or_default();
|
|
93
84
|
self.dispatch_config(ctx);
|
|
94
85
|
true
|
|
95
86
|
},
|
|
96
|
-
StringColumnStyleMsg::ColorModeChanged(mode) => {
|
|
97
|
-
self.config.string_color_mode = mode.unwrap_or_default();
|
|
98
|
-
self.dispatch_config(ctx);
|
|
99
|
-
true
|
|
100
|
-
},
|
|
101
|
-
StringColumnStyleMsg::ColorChanged(color) => {
|
|
102
|
-
self.config.color = Some(color);
|
|
103
|
-
self.dispatch_config(ctx);
|
|
104
|
-
true
|
|
105
|
-
},
|
|
106
|
-
StringColumnStyleMsg::ColorReset => {
|
|
107
|
-
self.config.color = Some(self.default_config.color.clone());
|
|
108
|
-
self.dispatch_config(ctx);
|
|
109
|
-
true
|
|
110
|
-
},
|
|
111
87
|
}
|
|
112
88
|
}
|
|
113
89
|
|
|
114
90
|
fn view(&self, ctx: &Context<Self>) -> Html {
|
|
115
|
-
let format_mode_selected = self.config.format;
|
|
116
91
|
let format_mode_changed = ctx.link().callback(StringColumnStyleMsg::FormatChanged);
|
|
117
|
-
let selected_color_mode = self.config.string_color_mode;
|
|
118
|
-
let color_mode_changed = ctx.link().callback(StringColumnStyleMsg::ColorModeChanged);
|
|
119
|
-
let color_controls = match selected_color_mode {
|
|
120
|
-
StringColorMode::Foreground => {
|
|
121
|
-
self.color_select_row(ctx, &StringColorMode::Foreground, "foreground-label")
|
|
122
|
-
},
|
|
123
|
-
StringColorMode::Background => {
|
|
124
|
-
self.color_select_row(ctx, &StringColorMode::Background, "background-label")
|
|
125
|
-
},
|
|
126
|
-
StringColorMode::Series => {
|
|
127
|
-
self.color_select_row(ctx, &StringColorMode::Series, "series-label")
|
|
128
|
-
},
|
|
129
|
-
StringColorMode::None => html! {},
|
|
130
|
-
};
|
|
131
|
-
|
|
132
92
|
html! {
|
|
133
93
|
<>
|
|
134
94
|
<LocalStyle href={css!("column-style")} />
|
|
@@ -136,14 +96,8 @@ impl Component for StringColumnStyle {
|
|
|
136
96
|
<SelectEnumField<FormatMode>
|
|
137
97
|
label="format"
|
|
138
98
|
on_change={format_mode_changed}
|
|
139
|
-
current_value={
|
|
140
|
-
/>
|
|
141
|
-
<SelectEnumField<StringColorMode>
|
|
142
|
-
label="color"
|
|
143
|
-
on_change={color_mode_changed}
|
|
144
|
-
current_value={selected_color_mode}
|
|
99
|
+
current_value={self.config.format}
|
|
145
100
|
/>
|
|
146
|
-
{ color_controls }
|
|
147
101
|
</div>
|
|
148
102
|
</>
|
|
149
103
|
}
|
|
@@ -153,34 +107,18 @@ impl Component for StringColumnStyle {
|
|
|
153
107
|
impl StringColumnStyle {
|
|
154
108
|
/// When this config has changed, we must signal the wrapper element.
|
|
155
109
|
fn dispatch_config(&self, ctx: &Context<Self>) {
|
|
156
|
-
let
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
110
|
+
let value = if self.config == StringColumnStyleConfig::default() {
|
|
111
|
+
serde_json::Map::new()
|
|
112
|
+
} else {
|
|
113
|
+
match serde_json::to_value(&self.config) {
|
|
114
|
+
Ok(serde_json::Value::Object(m)) => m,
|
|
115
|
+
_ => serde_json::Map::new(),
|
|
116
|
+
}
|
|
117
|
+
};
|
|
161
118
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
let on_color = ctx.link().callback(StringColumnStyleMsg::ColorChanged);
|
|
166
|
-
let color = self
|
|
167
|
-
.config
|
|
168
|
-
.color
|
|
169
|
-
.clone()
|
|
170
|
-
.unwrap_or_else(|| self.default_config.color.to_owned());
|
|
171
|
-
|
|
172
|
-
let color_props = props!(ColorProps {
|
|
173
|
-
title: title.to_owned(),
|
|
174
|
-
on_color,
|
|
175
|
-
is_modified: color != self.default_config.color,
|
|
176
|
-
color,
|
|
177
|
-
on_reset: ctx.link().callback(|_| StringColumnStyleMsg::ColorReset)
|
|
119
|
+
ctx.props().on_change.emit(ColumnConfigFieldUpdate {
|
|
120
|
+
keys: ctx.props().keys.clone(),
|
|
121
|
+
value,
|
|
178
122
|
});
|
|
179
|
-
|
|
180
|
-
if &self.config.string_color_mode == mode {
|
|
181
|
-
html! { <div class="row"><ColorSelector ..color_props /></div> }
|
|
182
|
-
} else {
|
|
183
|
-
html! {}
|
|
184
|
-
}
|
|
185
123
|
}
|
|
186
124
|
}
|
|
@@ -26,9 +26,11 @@ use crate::css;
|
|
|
26
26
|
#[derive(Properties, PartialEq, Clone)]
|
|
27
27
|
pub struct CustomNumberFormatProps {
|
|
28
28
|
pub restored_config: CustomNumberFormatConfig,
|
|
29
|
-
pub on_change: Callback<
|
|
29
|
+
pub on_change: Callback<ColumnConfigFieldUpdate>,
|
|
30
30
|
pub view_type: ColumnType,
|
|
31
31
|
pub column_name: String,
|
|
32
|
+
#[prop_or_default]
|
|
33
|
+
pub keys: Vec<String>,
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
pub enum CustomNumberFormatMsg {
|
|
@@ -56,10 +58,6 @@ pub struct CustomNumberFormat {
|
|
|
56
58
|
config: CustomNumberFormatConfig,
|
|
57
59
|
style: NumberStyle,
|
|
58
60
|
notation: Option<NotationName>,
|
|
59
|
-
// show_frac: bool,
|
|
60
|
-
// show_sig: bool,
|
|
61
|
-
// disable_rounding_increment: bool,
|
|
62
|
-
// disable_rounding_priority: bool,
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
impl Component for CustomNumberFormat {
|
|
@@ -197,11 +195,17 @@ impl Component for CustomNumberFormat {
|
|
|
197
195
|
|
|
198
196
|
let is_float = ctx.props().view_type == ColumnType::Float;
|
|
199
197
|
let filtered_config = self.config.clone().filter_default(is_float);
|
|
200
|
-
let value =
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
198
|
+
let mut value = serde_json::Map::new();
|
|
199
|
+
if filtered_config != CustomNumberFormatConfig::default() {
|
|
200
|
+
value.insert(
|
|
201
|
+
"number_format".to_owned(),
|
|
202
|
+
serde_json::to_value(&filtered_config).unwrap_or(serde_json::Value::Null),
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
ctx.props().on_change.emit(ColumnConfigFieldUpdate {
|
|
206
|
+
keys: ctx.props().keys.clone(),
|
|
207
|
+
value,
|
|
208
|
+
});
|
|
205
209
|
true
|
|
206
210
|
}
|
|
207
211
|
|
|
@@ -220,22 +224,6 @@ impl Component for CustomNumberFormat {
|
|
|
220
224
|
impl CustomNumberFormat {
|
|
221
225
|
fn initialize(ctx: &yew::prelude::Context<Self>) -> Self {
|
|
222
226
|
let config = ctx.props().restored_config.clone();
|
|
223
|
-
// let show_frac = config
|
|
224
|
-
// .minimum_fraction_digits
|
|
225
|
-
// .or(config.maximum_fraction_digits)
|
|
226
|
-
// .or(config.rounding_increment)
|
|
227
|
-
// .is_some();
|
|
228
|
-
// let show_sig = config
|
|
229
|
-
// .minimum_significant_digits
|
|
230
|
-
// .or(config.maximum_significant_digits)
|
|
231
|
-
// .is_some();
|
|
232
|
-
// let disable_rounding_increment = show_sig
|
|
233
|
-
// || show_frac
|
|
234
|
-
// || !matches!(
|
|
235
|
-
// config.rounding_priority,
|
|
236
|
-
// Some(RoundingPriority::Auto) | None
|
|
237
|
-
// );
|
|
238
|
-
// let disable_rounding_priority = !(show_frac && show_sig);
|
|
239
227
|
Self {
|
|
240
228
|
style: config
|
|
241
229
|
._style
|
|
@@ -248,10 +236,6 @@ impl CustomNumberFormat {
|
|
|
248
236
|
})
|
|
249
237
|
.unwrap_or_default(),
|
|
250
238
|
config,
|
|
251
|
-
// show_frac,
|
|
252
|
-
// show_sig,
|
|
253
|
-
// disable_rounding_increment,
|
|
254
|
-
// disable_rounding_priority,
|
|
255
239
|
notation: None,
|
|
256
240
|
}
|
|
257
241
|
}
|