@perspective-dev/viewer 4.0.0 → 4.1.0

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.
Files changed (184) hide show
  1. package/dist/cdn/perspective-viewer.js +2 -2
  2. package/dist/cdn/perspective-viewer.js.map +4 -4
  3. package/dist/css/dracula.css +1 -1
  4. package/dist/css/gruvbox-dark.css +1 -1
  5. package/dist/css/gruvbox.css +1 -1
  6. package/dist/css/icons.css +1 -1
  7. package/dist/css/monokai.css +1 -1
  8. package/dist/css/pro-dark.css +1 -1
  9. package/dist/css/pro.css +1 -1
  10. package/dist/css/solarized-dark.css +1 -1
  11. package/dist/css/solarized.css +1 -1
  12. package/dist/css/themes.css +1 -1
  13. package/dist/css/vaporwave.css +1 -1
  14. package/dist/esm/extensions.d.ts +23 -2
  15. package/dist/esm/perspective-viewer.d.ts +2 -7
  16. package/dist/esm/perspective-viewer.inline.js +2 -2
  17. package/dist/esm/perspective-viewer.inline.js.map +4 -4
  18. package/dist/esm/perspective-viewer.js +2 -2
  19. package/dist/esm/perspective-viewer.js.map +4 -4
  20. package/dist/esm/plugin.d.ts +1 -1
  21. package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +1 -0
  22. package/dist/wasm/perspective-viewer.d.ts +218 -46
  23. package/dist/wasm/perspective-viewer.js +1251 -762
  24. package/dist/wasm/perspective-viewer.wasm +0 -0
  25. package/dist/wasm/perspective-viewer.wasm.d.ts +38 -19
  26. package/package.json +1 -1
  27. package/src/less/containers/scroll-panel.less +0 -1
  28. package/src/less/plugin-selector.less +15 -5
  29. package/src/less/status-bar.less +75 -27
  30. package/src/less/viewer.less +140 -58
  31. package/src/rust/components/column_dropdown.rs +21 -21
  32. package/src/rust/components/column_selector/active_column.rs +131 -120
  33. package/src/rust/components/column_selector/add_expression_button.rs +5 -0
  34. package/src/rust/components/column_selector/aggregate_selector.rs +8 -4
  35. package/src/rust/components/column_selector/config_selector.rs +170 -161
  36. package/src/rust/components/column_selector/empty_column.rs +16 -11
  37. package/src/rust/components/column_selector/{expression_toolbar.rs → expr_edit_button.rs} +7 -0
  38. package/src/rust/components/column_selector/filter_column.rs +195 -194
  39. package/src/rust/components/column_selector/inactive_column.rs +82 -67
  40. package/src/rust/components/column_selector/pivot_column.rs +16 -11
  41. package/src/rust/components/column_selector/sort_column.rs +9 -7
  42. package/src/rust/components/column_selector.rs +42 -37
  43. package/src/rust/components/column_settings_sidebar/save_settings.rs +3 -1
  44. package/src/rust/components/column_settings_sidebar/style_tab/agg_depth_selector.rs +58 -0
  45. package/src/rust/components/column_settings_sidebar/style_tab/symbol/row_selector.rs +6 -6
  46. package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_pairs.rs +2 -94
  47. package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_pairs_item.rs +111 -0
  48. package/src/rust/components/column_settings_sidebar/style_tab/symbol.rs +3 -3
  49. package/src/rust/components/column_settings_sidebar/style_tab.rs +23 -83
  50. package/src/rust/components/{column_settings_sidebar/sidebar.rs → column_settings_sidebar.rs} +198 -171
  51. package/src/rust/components/containers/dragdrop_list.rs +20 -20
  52. package/src/rust/components/containers/dropdown_menu.rs +4 -6
  53. package/src/rust/components/containers/mod.rs +1 -4
  54. package/src/rust/components/containers/scroll_panel.rs +80 -80
  55. package/src/rust/components/containers/scroll_panel_item.rs +36 -36
  56. package/src/rust/components/containers/select.rs +46 -44
  57. package/src/rust/components/containers/sidebar.rs +3 -19
  58. package/src/rust/components/{column_settings_sidebar/style_tab/symbol/symbol_config.rs → containers/sidebar_close_button.rs} +15 -9
  59. package/src/rust/components/containers/split_panel.rs +212 -200
  60. package/src/rust/components/containers/tab_list.rs +11 -11
  61. package/src/rust/components/copy_dropdown.rs +22 -25
  62. package/src/rust/components/datetime_column_style/custom.rs +19 -19
  63. package/src/rust/components/datetime_column_style/simple.rs +13 -14
  64. package/src/rust/components/datetime_column_style.rs +75 -76
  65. package/src/rust/components/editable_header.rs +18 -14
  66. package/src/rust/components/empty_row.rs +5 -5
  67. package/src/rust/components/export_dropdown.rs +42 -42
  68. package/src/rust/components/expression_editor.rs +25 -19
  69. package/src/rust/components/filter_dropdown.rs +22 -22
  70. package/src/rust/components/font_loader.rs +11 -9
  71. package/src/rust/components/form/code_editor.rs +106 -105
  72. package/src/rust/components/form/color_range_selector.rs +14 -12
  73. package/src/rust/components/form/color_selector.rs +3 -1
  74. package/src/rust/components/form/debug.rs +95 -94
  75. package/src/rust/components/form/highlight.rs +5 -3
  76. package/src/rust/components/form/mod.rs +3 -2
  77. package/src/rust/components/form/optional_field.rs +2 -2
  78. package/src/rust/components/form/{select_field.rs → select_enum_field.rs} +1 -46
  79. package/src/rust/components/form/select_value_field.rs +64 -0
  80. package/src/rust/components/function_dropdown.rs +21 -21
  81. package/src/rust/components/main_panel.rs +219 -0
  82. package/src/rust/components/mod.rs +6 -6
  83. package/src/rust/components/modal.rs +42 -42
  84. package/src/rust/components/number_column_style.rs +34 -88
  85. package/src/rust/components/plugin_selector.rs +22 -25
  86. package/src/rust/components/render_warning.rs +9 -6
  87. package/src/rust/components/settings_panel.rs +82 -0
  88. package/src/rust/components/status_bar.rs +250 -146
  89. package/src/rust/components/status_bar_counter.rs +26 -119
  90. package/src/rust/components/status_indicator.rs +95 -79
  91. package/src/rust/components/string_column_style.rs +45 -45
  92. package/src/rust/components/style/style_provider.rs +1 -15
  93. package/src/rust/components/style_controls/number_string_format/digits_section.rs +1 -1
  94. package/src/rust/components/style_controls/number_string_format/misc_section.rs +1 -1
  95. package/src/rust/components/style_controls/number_string_format/style_section.rs +1 -1
  96. package/src/rust/components/style_controls/number_string_format.rs +45 -46
  97. package/src/rust/components/type_icon.rs +14 -11
  98. package/src/rust/components/viewer.rs +241 -384
  99. package/src/rust/config/columns_config.rs +2 -2
  100. package/src/rust/config/datetime_column_style.rs +1 -6
  101. package/src/rust/config/mod.rs +1 -0
  102. package/src/rust/config/number_column_style.rs +0 -6
  103. package/src/rust/config/number_string_format.rs +27 -4
  104. package/src/rust/config/viewer_config.rs +27 -167
  105. package/src/rust/custom_elements/copy_dropdown.rs +14 -6
  106. package/src/rust/custom_elements/export_dropdown.rs +15 -7
  107. package/src/rust/custom_elements/filter_dropdown.rs +4 -4
  108. package/src/rust/custom_elements/mod.rs +3 -0
  109. package/src/rust/custom_elements/viewer.rs +353 -161
  110. package/src/rust/custom_events.rs +55 -32
  111. package/src/rust/dragdrop.rs +4 -24
  112. package/src/rust/exprtk/cursor.rs +10 -1
  113. package/src/rust/exprtk/mod.rs +2 -0
  114. package/src/rust/exprtk/tokenize.rs +20 -3
  115. package/src/rust/js/clipboard.rs +2 -2
  116. package/src/rust/js/mimetype.rs +2 -7
  117. package/src/rust/js/mod.rs +0 -1
  118. package/src/rust/js/plugin.rs +7 -0
  119. package/src/rust/lib.rs +18 -5
  120. package/src/rust/model/column_locator.rs +82 -0
  121. package/src/rust/model/columns_iter_set.rs +1 -0
  122. package/src/rust/model/copy_export.rs +50 -14
  123. package/src/rust/model/edit_expression.rs +2 -5
  124. package/src/rust/model/eject.rs +41 -0
  125. package/src/rust/model/export_app.rs +3 -2
  126. package/src/rust/model/get_viewer_config.rs +4 -28
  127. package/src/rust/model/intersection_observer.rs +20 -8
  128. package/src/rust/model/mod.rs +11 -4
  129. package/src/rust/model/plugin_column_styles.rs +0 -31
  130. package/src/rust/model/reset_all.rs +38 -0
  131. package/src/rust/model/resize_observer.rs +34 -7
  132. package/src/rust/model/restore_and_render.rs +12 -7
  133. package/src/rust/{utils/scope.rs → model/send_plugin_config.rs} +32 -35
  134. package/src/rust/model/structural.rs +194 -23
  135. package/src/rust/model/update_and_render.rs +14 -4
  136. package/src/rust/{model/create_col.rs → presentation/column_locator.rs} +73 -42
  137. package/src/rust/{utils/wasm_abi.rs → presentation/sheets.rs} +54 -40
  138. package/src/rust/presentation.rs +60 -119
  139. package/src/rust/renderer/activate.rs +20 -5
  140. package/src/rust/renderer/limits.rs +0 -149
  141. package/src/rust/renderer/render_timer.rs +1 -1
  142. package/src/rust/renderer.rs +34 -18
  143. package/src/rust/root.rs +50 -0
  144. package/src/rust/session/column_defaults_update.rs +4 -4
  145. package/src/rust/session/drag_drop_update.rs +1 -1
  146. package/src/rust/session/metadata.rs +3 -17
  147. package/src/rust/session/replace_expression_update.rs +1 -2
  148. package/src/rust/session.rs +162 -82
  149. package/src/rust/utils/browser/blob.rs +16 -2
  150. package/src/rust/utils/browser/download.rs +1 -0
  151. package/src/rust/{components/column_settings_sidebar/mod.rs → utils/browser/dragdrop.rs} +14 -5
  152. package/src/rust/utils/browser/mod.rs +8 -4
  153. package/src/rust/utils/browser/selection.rs +5 -0
  154. package/src/rust/utils/custom_element.rs +28 -13
  155. package/src/rust/utils/datetime.rs +5 -0
  156. package/src/rust/utils/debounce.rs +7 -1
  157. package/src/rust/utils/hooks/use_async_callback.rs +7 -17
  158. package/src/rust/utils/mod.rs +28 -40
  159. package/src/rust/utils/number_format.rs +6 -5
  160. package/src/rust/utils/pubsub.rs +15 -10
  161. package/src/rust/utils/weak_scope.rs +11 -1
  162. package/src/svg/bookmark-icon.svg +4 -0
  163. package/src/svg/drag-handle copy.svg +10 -0
  164. package/src/svg/drawer-tab-hover.svg +5 -7
  165. package/src/svg/drawer-tab-invert-hover.svg +4 -8
  166. package/src/svg/drawer-tab-invert.svg +4 -7
  167. package/src/svg/drawer-tab.svg +4 -6
  168. package/src/svg/status_ok.svg +24 -24
  169. package/src/ts/extensions.ts +51 -3
  170. package/src/ts/perspective-viewer.ts +2 -14
  171. package/src/ts/plugin.ts +1 -1
  172. package/src/ts/ts-rs/ViewerConfigUpdate.ts +1 -1
  173. package/src/rust/components/column_settings_sidebar/style_tab/column_style.rs +0 -177
  174. package/src/rust/components/containers/tests/mod.rs +0 -11
  175. package/src/rust/components/containers/tests/split_panel.rs +0 -91
  176. package/src/rust/js/testing.rs +0 -149
  177. package/src/rust/utils/tee.rs +0 -88
  178. /package/dist/wasm/snippets/{perspective-viewer-c69283f6f62a5f14 → perspective-viewer-0d326a25c1022412}/inline0.js +0 -0
  179. /package/dist/wasm/snippets/{perspective-viewer-c69283f6f62a5f14 → perspective-viewer-0d326a25c1022412}/inline1.js +0 -0
  180. /package/dist/wasm/snippets/{perspective-viewer-c69283f6f62a5f14 → perspective-viewer-0d326a25c1022412}/inline2.js +0 -0
  181. /package/dist/wasm/snippets/{perspective-viewer-c69283f6f62a5f14 → perspective-viewer-0d326a25c1022412}/inline3.js +0 -0
  182. /package/dist/wasm/snippets/{perspective-viewer-c69283f6f62a5f14 → perspective-viewer-0d326a25c1022412}/inline4.js +0 -0
  183. /package/src/rust/components/{style_controls.rs → style_controls/mod.rs} +0 -0
  184. /package/src/rust/{components/containers → config}/kvpair.rs +0 -0
@@ -21,14 +21,13 @@ use yew::{Callback, Component, Properties, html};
21
21
 
22
22
  use crate::components::style::LocalStyle;
23
23
  use crate::config::*;
24
- use crate::{css, max, min};
24
+ use crate::css;
25
25
 
26
26
  #[derive(Properties, PartialEq, Clone)]
27
27
  pub struct CustomNumberFormatProps {
28
28
  pub restored_config: CustomNumberFormatConfig,
29
29
  pub on_change: Callback<ColumnConfigValueUpdate>,
30
30
  pub view_type: ColumnType,
31
- // just for rerendering
32
31
  pub column_name: String,
33
32
  }
34
33
 
@@ -63,46 +62,6 @@ pub struct CustomNumberFormat {
63
62
  // disable_rounding_priority: bool,
64
63
  }
65
64
 
66
- impl CustomNumberFormat {
67
- fn initialize(ctx: &yew::prelude::Context<Self>) -> Self {
68
- let config = ctx.props().restored_config.clone();
69
- // let show_frac = config
70
- // .minimum_fraction_digits
71
- // .or(config.maximum_fraction_digits)
72
- // .or(config.rounding_increment)
73
- // .is_some();
74
- // let show_sig = config
75
- // .minimum_significant_digits
76
- // .or(config.maximum_significant_digits)
77
- // .is_some();
78
- // let disable_rounding_increment = show_sig
79
- // || show_frac
80
- // || !matches!(
81
- // config.rounding_priority,
82
- // Some(RoundingPriority::Auto) | None
83
- // );
84
- // let disable_rounding_priority = !(show_frac && show_sig);
85
- Self {
86
- style: config
87
- ._style
88
- .as_ref()
89
- .map(|style| match style {
90
- NumberFormatStyle::Decimal => NumberStyle::Decimal,
91
- NumberFormatStyle::Currency(_) => NumberStyle::Currency,
92
- NumberFormatStyle::Percent => NumberStyle::Percent,
93
- NumberFormatStyle::Unit(_) => NumberStyle::Unit,
94
- })
95
- .unwrap_or_default(),
96
- config,
97
- // show_frac,
98
- // show_sig,
99
- // disable_rounding_increment,
100
- // disable_rounding_priority,
101
- notation: None,
102
- }
103
- }
104
- }
105
-
106
65
  impl Component for CustomNumberFormat {
107
66
  type Message = CustomNumberFormatMsg;
108
67
  type Properties = CustomNumberFormatProps;
@@ -195,23 +154,23 @@ impl Component for CustomNumberFormat {
195
154
  self.config.rounding_increment = None;
196
155
  self.config.maximum_fraction_digits = val.map(|(_, val)| {
197
156
  let min = self.config.minimum_fraction_digits.unwrap_or(2.);
198
- max!(val, min)
157
+ val.max(min)
199
158
  });
200
159
 
201
160
  self.config.minimum_fraction_digits = val.map(|(val, _)| {
202
161
  let max = self.config.maximum_fraction_digits.unwrap_or(2.);
203
- min!(val, max)
162
+ val.min(max)
204
163
  });
205
164
  },
206
165
  CustomNumberFormatMsg::SigChange(val) => {
207
166
  self.config.maximum_significant_digits = val.map(|(_, val)| {
208
167
  let min = self.config.minimum_significant_digits.unwrap_or(1.);
209
- max!(val, min)
168
+ val.max(min)
210
169
  });
211
170
 
212
171
  self.config.minimum_significant_digits = val.map(|(val, _)| {
213
172
  let max = self.config.maximum_significant_digits.unwrap_or(21.);
214
- min!(val, max)
173
+ val.min(max)
215
174
  });
216
175
  },
217
176
  CustomNumberFormatMsg::RoundingIncrement(val) => {
@@ -257,3 +216,43 @@ impl Component for CustomNumberFormat {
257
216
  }
258
217
  }
259
218
  }
219
+
220
+ impl CustomNumberFormat {
221
+ fn initialize(ctx: &yew::prelude::Context<Self>) -> Self {
222
+ 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
+ Self {
240
+ style: config
241
+ ._style
242
+ .as_ref()
243
+ .map(|style| match style {
244
+ NumberFormatStyle::Decimal => NumberStyle::Decimal,
245
+ NumberFormatStyle::Currency(_) => NumberStyle::Currency,
246
+ NumberFormatStyle::Percent => NumberStyle::Percent,
247
+ NumberFormatStyle::Unit(_) => NumberStyle::Unit,
248
+ })
249
+ .unwrap_or_default(),
250
+ config,
251
+ // show_frac,
252
+ // show_sig,
253
+ // disable_rounding_increment,
254
+ // disable_rounding_priority,
255
+ notation: None,
256
+ }
257
+ }
258
+ }
@@ -22,16 +22,30 @@ pub enum TypeIconType {
22
22
  Type(ColumnType),
23
23
  Expr,
24
24
  }
25
+
26
+ #[derive(PartialEq, Properties, Debug)]
27
+ pub struct TypeIconProps {
28
+ pub ty: TypeIconType,
29
+ }
30
+
31
+ #[function_component(TypeIcon)]
32
+ pub fn type_icon(p: &TypeIconProps) -> yew::Html {
33
+ let class = classes!(p.ty.to_string(), "type-icon");
34
+ html! { <><LocalStyle href={css!("type-icon")} /><span {class} /></> }
35
+ }
36
+
25
37
  impl From<ColumnType> for TypeIconType {
26
38
  fn from(value: ColumnType) -> Self {
27
39
  Self::Type(value)
28
40
  }
29
41
  }
42
+
30
43
  impl IntoPropValue<TypeIconType> for ColumnType {
31
44
  fn into_prop_value(self) -> TypeIconType {
32
45
  TypeIconType::Type(self)
33
46
  }
34
47
  }
48
+
35
49
  impl std::fmt::Display for TypeIconType {
36
50
  fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
37
51
  match self {
@@ -40,14 +54,3 @@ impl std::fmt::Display for TypeIconType {
40
54
  }
41
55
  }
42
56
  }
43
-
44
- #[derive(PartialEq, Properties, Debug)]
45
- pub struct TypeIconProps {
46
- pub ty: TypeIconType,
47
- }
48
-
49
- #[function_component(TypeIcon)]
50
- pub fn type_icon(p: &TypeIconProps) -> yew::Html {
51
- let class = classes!(p.ty.to_string(), "type-icon");
52
- html! { <><LocalStyle href={css!("type-icon")} /><span {class} /></> }
53
- }