@perspective-dev/viewer 5.3.1 → 5.5.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.
- package/dist/cdn/perspective-viewer.js +6 -6
- package/dist/cdn/perspective-viewer.js.map +2 -2
- package/dist/css/blueprint.css +1 -1
- package/dist/css/botanical.css +1 -1
- package/dist/css/dracula.css +1 -1
- package/dist/css/eggplant.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/ar.css +1 -0
- 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/ledger.css +1 -1
- package/dist/css/monokai.css +1 -1
- package/dist/css/nord.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/css/velvet.css +1 -1
- package/dist/docs/perspective-docs.json +1 -1
- package/dist/esm/extensions.d.ts +0 -5
- package/dist/esm/perspective-viewer.d.ts +2 -0
- package/dist/esm/perspective-viewer.inline.js +8 -8
- package/dist/esm/perspective-viewer.inline.js.map +2 -2
- package/dist/esm/perspective-viewer.js +5 -5
- package/dist/esm/perspective-viewer.js.map +2 -2
- package/dist/esm/plugin.d.ts +9 -0
- package/dist/esm/ts-rs/AddPanelOptions.d.ts +9 -0
- package/dist/esm/ts-rs/GetViewMode.d.ts +4 -0
- package/dist/esm/ts-rs/GetViewOptions.d.ts +8 -0
- package/dist/esm/ts-rs/RestoreOptions.d.ts +6 -0
- package/dist/esm/ts-rs/RestoreWorkspaceOptions.d.ts +9 -0
- package/dist/esm/ts-rs/ViewOnUpdateResp.d.ts +1 -1
- package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +30 -22
- package/dist/wasm/perspective-viewer.d.ts +137 -104
- package/dist/wasm/perspective-viewer.js +337 -269
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +20 -30
- package/package.json +7 -7
- package/src/css/_context_menu.css +1 -1
- package/src/css/_dropdown_menu.css +1 -1
- package/src/css/_viewer_bundle.css +7 -8
- package/src/css/column-dropdown.css +0 -3
- package/src/css/column-selector.css +18 -7
- package/src/css/column-settings-panel.css +0 -225
- package/src/css/column-style.css +175 -0
- package/src/css/config-selector.css +19 -11
- package/src/css/filter-dropdown.css +5 -5
- package/src/css/form/debug.css +37 -4
- package/src/css/function-dropdown.css +5 -5
- package/src/css/panel-tab.css +23 -0
- package/src/css/plugin-selector.css +5 -5
- package/src/css/render-warning.css +1 -1
- package/src/css/status-bar.css +63 -21
- package/src/css/type-icon.css +1 -3
- package/src/css/{containers → ui/containers}/context-menu.css +22 -16
- package/src/css/ui/containers/dropdown-menu-items.css +66 -0
- package/src/css/{containers → ui/containers}/dropdown-menu.css +8 -53
- package/src/css/{containers → ui/containers}/tabs.css +2 -1
- package/src/css/viewer.css +32 -26
- package/src/rust/agent/tools.rs +80 -7
- package/src/rust/components/chat_panel.rs +1 -1
- package/src/rust/components/{form/code_editor.rs → code_editor.rs} +4 -2
- package/src/rust/components/column_dropdown.rs +2 -2
- package/src/rust/components/column_selector/active_column.rs +24 -9
- package/src/rust/components/column_selector/aggregate_selector.rs +1 -1
- package/src/rust/components/column_selector/config_selector.rs +2 -2
- package/src/rust/components/column_selector/filter_column.rs +8 -5
- package/src/rust/components/column_selector/inactive_column.rs +4 -2
- package/src/rust/components/column_selector/pivot_column.rs +4 -3
- package/src/rust/components/column_selector/sort_column.rs +7 -4
- package/src/rust/components/column_selector.rs +14 -3
- package/src/rust/components/column_settings_sidebar/style_tab/agg_depth_selector.rs +1 -1
- package/src/rust/components/column_settings_sidebar/style_tab/alignment_field.rs +90 -0
- package/src/rust/components/column_settings_sidebar/style_tab/font_field.rs +267 -0
- package/src/rust/components/column_settings_sidebar/style_tab/primitive_field.rs +16 -18
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_selector.rs +1 -1
- package/src/rust/components/column_settings_sidebar/style_tab.rs +70 -12
- package/src/rust/components/column_settings_sidebar.rs +3 -4
- package/src/rust/components/copy_dropdown.rs +1 -1
- package/src/rust/components/datetime_column_style/custom.rs +1 -3
- package/src/rust/components/datetime_column_style/simple.rs +1 -2
- package/src/rust/components/datetime_column_style.rs +1 -2
- package/src/rust/components/{form/debug.rs → debug_panel.rs} +112 -55
- package/src/rust/components/{containers/dragdrop_list.rs → dragdrop_list.rs} +2 -10
- package/src/rust/components/export_dropdown.rs +1 -1
- package/src/rust/components/expression_editor.rs +1 -1
- package/src/rust/components/filter_dropdown.rs +2 -2
- package/src/rust/components/function_dropdown.rs +2 -2
- package/src/rust/components/main_panel/frame_theme.rs +3 -59
- package/src/rust/components/main_panel/msg.rs +4 -0
- package/src/rust/components/main_panel/reconcile.rs +9 -4
- package/src/rust/components/main_panel/render.rs +62 -11
- package/src/rust/components/main_panel/update.rs +39 -10
- package/src/rust/components/main_panel.rs +40 -2
- package/src/rust/components/mod.rs +5 -8
- package/src/rust/components/new_panel_menu.rs +97 -0
- package/src/rust/components/number_series_style.rs +2 -3
- package/src/rust/components/panel_menu.rs +61 -87
- package/src/rust/components/panel_tab.rs +100 -43
- package/src/rust/components/plugin_tab.rs +58 -4
- package/src/rust/components/render_warning.rs +2 -2
- package/src/rust/components/{status_bar_counter.rs → rows_counter.rs} +10 -10
- package/src/rust/components/settings_panel.rs +8 -2
- package/src/rust/components/status_bar.rs +113 -19
- package/src/rust/components/status_indicator.rs +9 -14
- package/src/rust/components/{style/mod.rs → style.rs} +32 -15
- package/src/rust/components/style_controls/number_string_format/digits_section.rs +3 -5
- 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/viewer/msg.rs +43 -30
- package/src/rust/components/viewer/panels.rs +53 -19
- package/src/rust/components/viewer/render.rs +16 -13
- package/src/rust/components/viewer/settings.rs +137 -68
- package/src/rust/components/viewer/snapshots.rs +5 -10
- package/src/rust/components/viewer/wiring.rs +11 -22
- package/src/rust/components/viewer.rs +15 -10
- package/src/rust/components/window_editor.rs +8 -9
- package/src/rust/config/column_config_schema.rs +312 -33
- package/src/rust/config/datetime_column_style.rs +0 -11
- package/src/rust/config/mod.rs +0 -4
- package/src/rust/config/options.rs +50 -0
- package/src/rust/config/workspace_config.rs +70 -24
- package/src/rust/custom_elements/debug_plugin.rs +1 -10
- package/src/rust/custom_elements/mod.rs +0 -3
- package/src/rust/custom_elements/viewer.rs +194 -115
- package/src/rust/js/plugin.rs +3 -87
- package/src/rust/lib.rs +19 -18
- package/src/rust/presentation/column_locator.rs +3 -7
- package/src/rust/presentation.rs +68 -38
- package/src/rust/queries/hosted_tables.rs +38 -0
- package/src/rust/queries/mod.rs +2 -0
- package/src/rust/queries/palette_set.rs +1 -1
- package/src/rust/queries/plugin_column_styles.rs +6 -5
- package/src/rust/renderer/activate.rs +1 -3
- package/src/rust/renderer/dispatch.rs +83 -22
- package/src/rust/renderer/limits.rs +24 -5
- package/src/rust/renderer/plugin_config.rs +201 -41
- package/src/rust/renderer/plugin_store.rs +2 -1
- package/src/rust/renderer/props.rs +7 -1
- package/src/rust/renderer.rs +23 -27
- package/src/rust/session/props.rs +8 -3
- package/src/rust/session/view_subscription.rs +19 -6
- package/src/rust/session.rs +189 -150
- package/src/rust/tasks/create_panel.rs +5 -2
- package/src/rust/tasks/dismiss_render_warning.rs +1 -1
- package/src/rust/tasks/eject.rs +1 -0
- package/src/rust/tasks/pipeline.rs +18 -67
- package/src/rust/tasks/presize_panels.rs +24 -1
- package/src/rust/tasks/restore_and_render.rs +0 -17
- package/src/rust/tasks/restore_panel.rs +129 -30
- package/src/rust/tasks/send_column_config.rs +4 -1
- package/src/rust/tasks/send_plugin_config.rs +1 -1
- package/src/rust/tasks/set_edit_mode.rs +1 -1
- package/src/rust/tasks/sync_update_panels.rs +147 -67
- package/src/rust/tasks/table_lifecycle.rs +7 -1
- package/src/rust/{components → ui}/containers/control_group.rs +25 -3
- package/src/rust/{components → ui}/containers/dropdown_menu.rs +5 -2
- package/src/rust/{components → ui}/containers/mod.rs +0 -4
- package/src/rust/{components → ui}/containers/scroll_panel.rs +0 -22
- package/src/rust/{components → ui}/containers/scroll_panel_item.rs +0 -13
- package/src/rust/{components → ui}/containers/select.rs +0 -6
- package/src/rust/{components → ui}/containers/sidebar.rs +5 -32
- package/src/rust/{components → ui}/containers/split_panel.rs +8 -80
- package/src/rust/{components → ui}/containers/tab_list.rs +15 -9
- package/src/rust/{components → ui}/context_menu.rs +8 -13
- package/src/rust/{presentation/drag_helpers.rs → ui/dragdrop.rs} +26 -31
- package/src/rust/{components → ui}/font_loader.rs +0 -26
- package/src/rust/{components → ui}/form/color_selector.rs +4 -2
- package/src/rust/{config/datetime_column_style/color_mode.rs → ui/form/intl_label.rs} +42 -42
- package/src/rust/{components → ui}/form/mirrored_textarea.rs +0 -53
- package/src/rust/{components → ui}/form/mod.rs +1 -10
- package/src/rust/{components → ui}/form/multi_stop_gradient_selector.rs +4 -5
- package/src/rust/{components → ui}/form/named_value_picker.rs +1 -6
- package/src/rust/{components → ui}/form/number_field.rs +1 -1
- package/src/rust/{components → ui}/form/number_range_field.rs +1 -1
- package/src/rust/{components → ui}/form/optional_field.rs +3 -1
- package/src/rust/{components → ui}/form/palette_selector.rs +4 -5
- package/src/rust/{components → ui}/form/select_enum_field.rs +2 -2
- package/src/rust/{components → ui}/form/select_value_field.rs +2 -2
- package/src/rust/ui/mod.rs +56 -0
- package/src/rust/ui/modal.rs +61 -0
- package/src/rust/{components → ui}/portal.rs +175 -79
- package/src/rust/{components/style/style_provider.rs → ui/style.rs} +4 -34
- package/src/rust/utils/completion.rs +0 -6
- package/src/rust/{config/css_scale.rs → utils/css.rs} +38 -35
- package/src/rust/utils/css_vars.rs +13 -0
- package/src/rust/utils/local_fonts.rs +395 -0
- package/src/rust/utils/mod.rs +4 -0
- package/src/rust/workspace.rs +47 -0
- package/src/svg/boolean-type.svg +3 -2
- package/src/svg/checkbox-checked-icon.svg +4 -7
- package/src/svg/checkbox-hover.svg +3 -3
- package/src/svg/checkbox-off.svg +2 -3
- package/src/svg/checkbox-on.svg +3 -3
- package/src/svg/checkbox-unchecked-icon.svg +3 -3
- package/src/svg/datagrid-select-column.svg +8 -15
- package/src/svg/datagrid-select-region.svg +8 -15
- package/src/svg/datagrid-select-row-tree.svg +7 -12
- package/src/svg/datagrid-select-row.svg +8 -13
- package/src/svg/date-type.svg +4 -23
- package/src/svg/drawer-tab-hover.svg +4 -6
- package/src/svg/drawer-tab-invert-hover.svg +5 -5
- package/src/svg/drawer-tab-invert.svg +3 -5
- package/src/svg/drawer-tab.svg +5 -5
- package/src/svg/mega-menu-icons-candlestick.svg +5 -37
- package/src/svg/mega-menu-icons-ohlc.svg +4 -39
- package/src/svg/mega-menu-icons-sunburst.svg +4 -38
- package/src/svg/mega-menu-icons-treemap.svg +3 -43
- package/src/svg/mega-menu-icons-y-scatter.svg +12 -72
- package/src/svg/new-panel-icon.svg +4 -0
- package/src/svg/number-type.svg +3 -3
- package/src/svg/radio-hover.svg +3 -3
- package/src/svg/radio-off.svg +3 -3
- package/src/svg/radio-on.svg +3 -3
- package/src/svg/status_ok.svg +3 -26
- package/src/svg/status_pending.svg +3 -0
- package/src/svg/string-type.svg +4 -8
- package/src/svg/theme-icon.svg +5 -5
- package/src/themes/blueprint.css +0 -57
- package/src/themes/botanical.css +0 -36
- package/src/themes/defaults.css +1 -24
- package/src/themes/dracula.css +0 -58
- package/src/themes/eggplant.css +0 -58
- package/src/themes/gruvbox-dark.css +0 -65
- package/src/themes/gruvbox.css +1 -39
- package/src/themes/icons.css +2 -8
- package/src/themes/intl/ar.css +198 -0
- package/src/themes/intl/de.css +63 -40
- package/src/themes/intl/es.css +58 -35
- package/src/themes/intl/fr.css +57 -34
- package/src/themes/intl/ja.css +59 -36
- package/src/themes/intl/pt.css +54 -31
- package/src/themes/intl/zh.css +65 -42
- package/src/themes/intl.css +34 -8
- package/src/themes/ledger.css +1 -59
- package/src/themes/monokai.css +0 -51
- package/src/themes/nord.css +0 -55
- package/src/themes/phosphor.css +0 -48
- package/src/themes/pro-dark.css +0 -37
- package/src/themes/pro.css +3 -23
- package/src/themes/solarized-dark.css +0 -31
- package/src/themes/solarized.css +1 -24
- package/src/themes/vaporwave.css +0 -44
- package/src/themes/velvet.css +0 -60
- package/src/ts/extensions.ts +0 -13
- package/src/ts/perspective-viewer.ts +2 -0
- package/src/ts/plugin.ts +9 -0
- package/src/ts/ts-rs/AddPanelOptions.ts +10 -0
- package/src/ts/ts-rs/{DatetimeColorMode.ts → GetViewMode.ts} +4 -1
- package/src/ts/ts-rs/GetViewOptions.ts +7 -0
- package/src/ts/ts-rs/RestoreOptions.ts +7 -1
- package/src/ts/ts-rs/RestoreWorkspaceOptions.ts +10 -0
- package/src/ts/ts-rs/ViewOnUpdateResp.ts +1 -1
- package/src/ts/ts-rs/WorkspaceConfigUpdate.ts +31 -20
- package/dist/esm/ts-rs/DatetimeColorMode.d.ts +0 -1
- package/dist/esm/ts-rs/FormatMode.d.ts +0 -1
- package/dist/esm/ts-rs/StringColorMode.d.ts +0 -1
- package/src/css/plugin-settings-panel.css +0 -171
- package/src/rust/components/modal.rs +0 -177
- package/src/rust/components/string_column_style.rs +0 -121
- package/src/rust/config/string_column_style.rs +0 -135
- package/src/rust/custom_elements/copy_dropdown.rs +0 -219
- package/src/rust/custom_elements/export_dropdown.rs +0 -216
- package/src/rust/custom_elements/modal.rs +0 -299
- package/src/ts/ts-rs/FormatMode.ts +0 -3
- package/src/ts/ts-rs/StringColorMode.ts +0 -3
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline0.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline1.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline2.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline3.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline4.js +0 -0
- /package/dist/wasm/snippets/{perspective-viewer-87bd21b215d0631a → perspective-viewer-ea71a3990cad35d7}/inline5.js +0 -0
- /package/src/css/{containers → ui/containers}/scroll-panel.css +0 -0
- /package/src/css/{containers → ui/containers}/split-panel.css +0 -0
- /package/src/css/{dom → ui/dom}/checkbox.css +0 -0
- /package/src/css/{dom → ui/dom}/scrollbar.css +0 -0
- /package/src/css/{dom → ui/dom}/select.css +0 -0
- /package/src/css/{form → ui/form}/mirrored-textarea.css +0 -0
- /package/src/rust/components/{form → code_editor}/highlight.rs +0 -0
- /package/src/rust/{components → ui}/containers/sidebar_close_button.rs +0 -0
- /package/src/rust/{components → ui}/form/number_input.rs +0 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* How `getView` resolves the `View` it returns.
|
|
5
|
+
*/
|
|
6
|
+
export type GetViewMode = "live" | "clone" | "auto";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { GetViewMode } from "./GetViewMode.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The `getView` argument: the `mode` and the target panel.
|
|
6
|
+
*/
|
|
7
|
+
export type GetViewOptions = { mode?: GetViewMode, panel?: string, };
|
|
@@ -17,4 +17,10 @@ panel?: string,
|
|
|
17
17
|
* The config may be partially applied on failure; restore a
|
|
18
18
|
* known-good config to recover exactly.
|
|
19
19
|
*/
|
|
20
|
-
suppress_errors?: boolean,
|
|
20
|
+
suppress_errors?: boolean,
|
|
21
|
+
/**
|
|
22
|
+
* When `true`, a `table` no loaded client hosts yet leaves the panel
|
|
23
|
+
* empty and pending until the table is created, instead of the default
|
|
24
|
+
* error.
|
|
25
|
+
*/
|
|
26
|
+
wait_for_table?: boolean, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Options for the `restoreWorkspace()` method.
|
|
5
|
+
*/
|
|
6
|
+
export type RestoreWorkspaceOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* As `RestoreOptions::wait_for_table`, applied to every panel entry.
|
|
9
|
+
*/
|
|
10
|
+
wait_for_table?: boolean, };
|
|
@@ -1,33 +1,44 @@
|
|
|
1
1
|
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
2
|
import type { Filter } from "./Filter.js";
|
|
3
3
|
import type { Layout } from "./Layout.js";
|
|
4
|
+
import type { OptionalUpdate } from "./OptionalUpdate.js";
|
|
4
5
|
import type { ViewerConfigInitial } from "./ViewerConfigInitial.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
|
-
* The
|
|
8
|
-
* [`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* stray per-panel `settings` key is ignored; it is element-level state,
|
|
12
|
-
* carried by the top-level `active` field).
|
|
8
|
+
* The [`PerspectiveViewerElement::restoreWorkspace`] argument: a field-wise
|
|
9
|
+
* update of the element's workspace state, like [`ViewerConfigUpdate`] for a
|
|
10
|
+
* panel, where an absent key is unchanged, `null` resets and a value
|
|
11
|
+
* replaces.
|
|
13
12
|
*/
|
|
14
|
-
export type WorkspaceConfigUpdate = {
|
|
13
|
+
export type WorkspaceConfigUpdate = {
|
|
15
14
|
/**
|
|
16
|
-
* The
|
|
17
|
-
*
|
|
18
|
-
* unattributed bucket: the next selection on any master replaces it.
|
|
19
|
-
* `Option` so an explicit `undefined` property deserializes as
|
|
20
|
-
* `None` like an absent key (also `masters` / `palette` below).
|
|
15
|
+
* The panel to activate with the settings sidebar open, by `panels` key
|
|
16
|
+
* or existing panel id; `null` closes the sidebar.
|
|
21
17
|
*/
|
|
22
|
-
|
|
18
|
+
active?: OptionalUpdate<string>,
|
|
23
19
|
/**
|
|
24
|
-
* The
|
|
25
|
-
* `panels` warns and is dropped.
|
|
20
|
+
* The layout tree to stage, naming `panels` keys or existing panel ids.
|
|
26
21
|
*/
|
|
27
|
-
|
|
22
|
+
layout?: Layout,
|
|
28
23
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
24
|
+
* The complete replacement panel set, each [`ViewerConfigInitial`] entry
|
|
25
|
+
* creating a new panel (`{}` empties the element); absent keeps the
|
|
26
|
+
* existing panels.
|
|
32
27
|
*/
|
|
33
|
-
|
|
28
|
+
panels?: { [key in string]?: ViewerConfigInitial },
|
|
29
|
+
/**
|
|
30
|
+
* The element-level cross-filter set applied to every detail panel as
|
|
31
|
+
* one unattributed bucket, replacing the current set; `null` clears it.
|
|
32
|
+
*/
|
|
33
|
+
global_filters?: OptionalUpdate<Array<Filter>>,
|
|
34
|
+
/**
|
|
35
|
+
* The master (filter-source) panels by `panels` key or existing panel
|
|
36
|
+
* id, unknown ids dropped with a warning; `null` demotes every panel.
|
|
37
|
+
*/
|
|
38
|
+
masters?: OptionalUpdate<Array<string>>,
|
|
39
|
+
/**
|
|
40
|
+
* Named color-scale definitions applied to the host (see
|
|
41
|
+
* [`WorkspaceConfig::palette`]), replacing the previous palette; `null`
|
|
42
|
+
* clears it.
|
|
43
|
+
*/
|
|
44
|
+
palette?: OptionalUpdate<{ [key in string]?: string }>, };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type DatetimeColorMode = "none" | "foreground" | "background";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type FormatMode = "none" | "link" | "bold" | "italics";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type StringColorMode = "none" | "foreground" | "background" | "series";
|
|
@@ -1,171 +0,0 @@
|
|
|
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
|
-
|
|
14
|
-
:host {
|
|
15
|
-
label#edit_mode-label:before {
|
|
16
|
-
content: var(--psp-label--edit-mode--content);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
label#scroll_lock-label:before {
|
|
20
|
-
content: var(--psp-label--scroll-lock--content);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
label#chart_type-label:before {
|
|
24
|
-
content: var(--psp-label--chart-type--content);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* viewer-charts plugin_config controls */
|
|
28
|
-
label#auto_alt_y_axis-label:before {
|
|
29
|
-
content: var(--psp-label--auto-alt-y-axis--content);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
label#facet_mode-label:before {
|
|
33
|
-
content: var(--psp-label--facet-mode--content);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
label#facet_zoom_mode-label:before {
|
|
37
|
-
content: var(--psp-label--facet-zoom-mode--content);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
label#series_zoom_mode-label:before {
|
|
41
|
-
content: var(--psp-label--series-zoom-mode--content);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
label#line_width_px-label:before {
|
|
45
|
-
content: var(--psp-label--line-width-px--content);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
label#point_size_px-label:before {
|
|
49
|
-
content: var(--psp-label--point-size-px--content);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
label#band_inner_frac-label:before {
|
|
53
|
-
content: var(--psp-label--band-inner-frac--content);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
label#bar_inner_pad-label:before {
|
|
57
|
-
content: var(--psp-label--bar-inner-pad--content);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
label#wick_width_px-label:before {
|
|
61
|
-
content: var(--psp-label--wick-width-px--content);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
label#ohlc_line_width_px-label:before {
|
|
65
|
-
content: var(--psp-label--ohlc-line-width-px--content);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
label#include_zero-label:before {
|
|
69
|
-
content: var(--psp-label--include-zero--content);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
label#domain_mode-label:before {
|
|
73
|
-
content: var(--psp-label--domain-mode--content);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
label#gradient_color_mode-label:before {
|
|
77
|
-
content: var(--psp-label--gradient-color-mode--content);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
label#gradient_radius_px-label:before {
|
|
81
|
-
content: var(--psp-label--gradient-radius-px--content);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
label#gradient_intensity-label:before {
|
|
85
|
-
content: var(--psp-label--gradient-intensity--content);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
label#gradient_heat_max-label:before {
|
|
89
|
-
content: var(--psp-label--gradient-heat-max--content);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
label#map_tile_provider-label:before {
|
|
93
|
-
content: var(--psp-label--map-tile-provider--content);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
label#map_tile_alpha-label:before {
|
|
97
|
-
content: var(--psp-label--map-tile-alpha--content);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
label#numeric_axes-label:before {
|
|
101
|
-
content: var(--psp-label--numeric-axes--content);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
label#legend_mode-label:before {
|
|
105
|
-
content: var(--psp-label--legend-mode--content);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
label#legend_size_mode-label:before {
|
|
109
|
-
content: var(--psp-label--legend-size-mode--content);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
label#legend_width_px-label:before {
|
|
113
|
-
content: var(--psp-label--legend-width-px--content);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
label#legend_height_px-label:before {
|
|
117
|
-
content: var(--psp-label--legend-height-px--content);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
label#legend_anchor-label:before {
|
|
121
|
-
content: var(--psp-label--legend-anchor--content);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
label#legend_x-label:before {
|
|
125
|
-
content: var(--psp-label--legend-x--content);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
label#legend_y-label:before {
|
|
129
|
-
content: var(--psp-label--legend-y--content);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
label#legend_opacity-label:before {
|
|
133
|
-
content: var(--psp-label--legend-opacity--content);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
label#tooltip_max_column_px-label:before {
|
|
137
|
-
content: var(--psp-label--tooltip-max-column-px--content);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
label#tooltip_opacity-label:before {
|
|
141
|
-
content: var(--psp-label--tooltip-opacity--content);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
label#axes-group-label:before {
|
|
145
|
-
content: var(--psp-label--group-axes--content, "Axes");
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
label#facets-group-label:before {
|
|
149
|
-
content: var(--psp-label--group-facets--content, "Facets");
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
label#glyph-group-label:before {
|
|
153
|
-
content: var(--psp-label--group-glyph--content, "Glyphs");
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
label#density-group-label:before {
|
|
157
|
-
content: var(--psp-label--group-density--content, "Density");
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
label#basemap-group-label:before {
|
|
161
|
-
content: var(--psp-label--group-basemap--content, "Basemap");
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
label#legend-group-label:before {
|
|
165
|
-
content: var(--psp-label--group-legend--content, "Legend");
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
label#tooltip-group-label:before {
|
|
169
|
-
content: var(--psp-label--group-tooltip--content, "Tooltips");
|
|
170
|
-
}
|
|
171
|
-
}
|
|
@@ -1,177 +0,0 @@
|
|
|
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::cell::Cell;
|
|
14
|
-
use std::marker::PhantomData;
|
|
15
|
-
use std::rc::Rc;
|
|
16
|
-
|
|
17
|
-
use derivative::Derivative;
|
|
18
|
-
use yew::html::*;
|
|
19
|
-
use yew::prelude::*;
|
|
20
|
-
use yew::virtual_dom::VChild;
|
|
21
|
-
|
|
22
|
-
use crate::utils::WeakScope;
|
|
23
|
-
|
|
24
|
-
#[derive(Properties, Derivative)]
|
|
25
|
-
#[derivative(PartialEq(bound = ""))]
|
|
26
|
-
pub struct ModalProps<T>
|
|
27
|
-
where
|
|
28
|
-
T: Component,
|
|
29
|
-
T::Properties: ModalLink<T>,
|
|
30
|
-
{
|
|
31
|
-
pub child: Option<VChild<T>>,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
#[derive(Debug)]
|
|
35
|
-
pub enum ModalMsg<T>
|
|
36
|
-
where
|
|
37
|
-
T: Component,
|
|
38
|
-
{
|
|
39
|
-
SetPos {
|
|
40
|
-
top: f64,
|
|
41
|
-
left: f64,
|
|
42
|
-
visible: bool,
|
|
43
|
-
rev_vert: bool,
|
|
44
|
-
},
|
|
45
|
-
SubMsg(T::Message),
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
#[derive(Default)]
|
|
49
|
-
pub struct Modal<T> {
|
|
50
|
-
css: String,
|
|
51
|
-
rev_vert: ModalOrientation,
|
|
52
|
-
_comp: PhantomData<T>,
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
impl<T> Component for Modal<T>
|
|
56
|
-
where
|
|
57
|
-
T: Component,
|
|
58
|
-
T::Properties: ModalLink<T>,
|
|
59
|
-
{
|
|
60
|
-
type Message = ModalMsg<T>;
|
|
61
|
-
type Properties = ModalProps<T>;
|
|
62
|
-
|
|
63
|
-
fn create(_ctx: &Context<Self>) -> Self {
|
|
64
|
-
Self {
|
|
65
|
-
css: ":host{{top:0px;left:0px;opacity:0}}".to_owned(),
|
|
66
|
-
rev_vert: Default::default(),
|
|
67
|
-
_comp: PhantomData,
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
fn update(&mut self, ctx: &Context<Self>, msg: ModalMsg<T>) -> bool {
|
|
72
|
-
match msg {
|
|
73
|
-
ModalMsg::SetPos {
|
|
74
|
-
top,
|
|
75
|
-
left,
|
|
76
|
-
visible,
|
|
77
|
-
rev_vert,
|
|
78
|
-
} => {
|
|
79
|
-
let opacity = if visible { "" } else { ";opacity:0" };
|
|
80
|
-
self.css = format!(":host{{top:{top}px;left:{left}px{opacity}}}");
|
|
81
|
-
self.rev_vert.set(rev_vert);
|
|
82
|
-
true
|
|
83
|
-
},
|
|
84
|
-
ModalMsg::SubMsg(msg) => {
|
|
85
|
-
if let Some(child) = &ctx.props().child
|
|
86
|
-
&& let Some(link) = child.props.weak_link().borrow().as_ref()
|
|
87
|
-
{
|
|
88
|
-
link.send_message(msg);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
false
|
|
92
|
-
},
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
fn view(&self, ctx: &Context<Self>) -> Html {
|
|
97
|
-
let child = ctx
|
|
98
|
-
.props()
|
|
99
|
-
.child
|
|
100
|
-
.clone()
|
|
101
|
-
.map(Html::from)
|
|
102
|
-
.unwrap_or_default();
|
|
103
|
-
|
|
104
|
-
html! {
|
|
105
|
-
<>
|
|
106
|
-
<style>{ self.css.to_owned() }</style>
|
|
107
|
-
<ContextProvider<ModalOrientation> context={&self.rev_vert}>
|
|
108
|
-
<NoRender>{ child }</NoRender>
|
|
109
|
-
</ContextProvider<ModalOrientation>>
|
|
110
|
-
</>
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
#[derive(Clone, Default, Eq, PartialEq)]
|
|
116
|
-
pub struct ModalOrientation(Rc<Cell<bool>>);
|
|
117
|
-
|
|
118
|
-
impl ImplicitClone for ModalOrientation {}
|
|
119
|
-
|
|
120
|
-
impl ModalOrientation {
|
|
121
|
-
pub fn set(&self, value: bool) {
|
|
122
|
-
self.0.set(value);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
impl From<ModalOrientation> for bool {
|
|
127
|
-
fn from(x: ModalOrientation) -> Self {
|
|
128
|
-
x.0.get()
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
pub trait ModalLink<T>
|
|
133
|
-
where
|
|
134
|
-
T: Component,
|
|
135
|
-
{
|
|
136
|
-
fn weak_link(&self) -> &'_ WeakScope<T>;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
pub trait SetModalLink {
|
|
140
|
-
fn set_modal_link(&self);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
impl<T> SetModalLink for &Context<T>
|
|
144
|
-
where
|
|
145
|
-
T: Component,
|
|
146
|
-
T::Properties: ModalLink<T>,
|
|
147
|
-
{
|
|
148
|
-
fn set_modal_link(&self) {
|
|
149
|
-
*self.props().weak_link().borrow_mut() = Some(self.link().clone());
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
#[derive(Properties, Clone)]
|
|
154
|
-
struct NoRenderProps {
|
|
155
|
-
pub children: Children,
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
impl PartialEq for NoRenderProps {
|
|
159
|
-
fn eq(&self, _other: &Self) -> bool {
|
|
160
|
-
true
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
struct NoRender {}
|
|
165
|
-
|
|
166
|
-
impl Component for NoRender {
|
|
167
|
-
type Message = ();
|
|
168
|
-
type Properties = NoRenderProps;
|
|
169
|
-
|
|
170
|
-
fn create(_ctx: &Context<Self>) -> Self {
|
|
171
|
-
Self {}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
fn view(&self, ctx: &Context<Self>) -> Html {
|
|
175
|
-
html! { { ctx.props().children.iter().collect::<Html>() } }
|
|
176
|
-
}
|
|
177
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
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 yew::prelude::*;
|
|
14
|
-
|
|
15
|
-
use super::modal::{ModalLink, SetModalLink};
|
|
16
|
-
use crate::components::form::select_enum_field::SelectEnumField;
|
|
17
|
-
use crate::config::*;
|
|
18
|
-
use crate::utils::WeakScope;
|
|
19
|
-
|
|
20
|
-
/// Format-only widget for [`String`] columns. Renders the `format` enum
|
|
21
|
-
/// only; color/color-mode UI is provided externally as primitive `Enum`
|
|
22
|
-
/// + `Color` schema fields.
|
|
23
|
-
#[derive(Properties)]
|
|
24
|
-
pub struct StringColumnStyleProps {
|
|
25
|
-
pub config: Option<StringColumnStyleConfig>,
|
|
26
|
-
|
|
27
|
-
#[prop_or_default]
|
|
28
|
-
pub on_change: Callback<ColumnConfigFieldUpdate>,
|
|
29
|
-
|
|
30
|
-
#[prop_or_default]
|
|
31
|
-
pub keys: Vec<String>,
|
|
32
|
-
|
|
33
|
-
#[prop_or_default]
|
|
34
|
-
weak_link: WeakScope<StringColumnStyle>,
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
impl ModalLink<StringColumnStyle> for StringColumnStyleProps {
|
|
38
|
-
fn weak_link(&self) -> &'_ WeakScope<StringColumnStyle> {
|
|
39
|
-
&self.weak_link
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
impl PartialEq for StringColumnStyleProps {
|
|
44
|
-
fn eq(&self, other: &Self) -> bool {
|
|
45
|
-
self.config == other.config
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
pub enum StringColumnStyleMsg {
|
|
50
|
-
FormatChanged(Option<FormatMode>),
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
pub struct StringColumnStyle {
|
|
54
|
-
config: StringColumnStyleConfig,
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
impl Component for StringColumnStyle {
|
|
58
|
-
type Message = StringColumnStyleMsg;
|
|
59
|
-
type Properties = StringColumnStyleProps;
|
|
60
|
-
|
|
61
|
-
fn create(ctx: &Context<Self>) -> Self {
|
|
62
|
-
ctx.set_modal_link();
|
|
63
|
-
Self {
|
|
64
|
-
config: ctx.props().config.clone().unwrap_or_default(),
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
fn changed(&mut self, ctx: &Context<Self>, _old: &Self::Properties) -> bool {
|
|
69
|
-
let mut new_config = ctx.props().config.clone().unwrap_or_default();
|
|
70
|
-
if self.config != new_config {
|
|
71
|
-
std::mem::swap(&mut self.config, &mut new_config);
|
|
72
|
-
true
|
|
73
|
-
} else {
|
|
74
|
-
false
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
|
|
79
|
-
match msg {
|
|
80
|
-
StringColumnStyleMsg::FormatChanged(val) => {
|
|
81
|
-
self.config.format = val.unwrap_or_default();
|
|
82
|
-
self.dispatch_config(ctx);
|
|
83
|
-
true
|
|
84
|
-
},
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
fn view(&self, ctx: &Context<Self>) -> Html {
|
|
89
|
-
let format_mode_changed = ctx.link().callback(StringColumnStyleMsg::FormatChanged);
|
|
90
|
-
html! {
|
|
91
|
-
<>
|
|
92
|
-
<div id="column-style-container" class="string-column-style-container">
|
|
93
|
-
<SelectEnumField<FormatMode>
|
|
94
|
-
label="format"
|
|
95
|
-
on_change={format_mode_changed}
|
|
96
|
-
current_value={self.config.format}
|
|
97
|
-
/>
|
|
98
|
-
</div>
|
|
99
|
-
</>
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
impl StringColumnStyle {
|
|
105
|
-
/// When this config has changed, we must signal the wrapper element.
|
|
106
|
-
fn dispatch_config(&self, ctx: &Context<Self>) {
|
|
107
|
-
let value = if self.config == StringColumnStyleConfig::default() {
|
|
108
|
-
serde_json::Map::new()
|
|
109
|
-
} else {
|
|
110
|
-
match serde_json::to_value(&self.config) {
|
|
111
|
-
Ok(serde_json::Value::Object(m)) => m,
|
|
112
|
-
_ => serde_json::Map::new(),
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
ctx.props().on_change.emit(ColumnConfigFieldUpdate {
|
|
117
|
-
keys: ctx.props().keys.clone(),
|
|
118
|
-
value,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
}
|