@perspective-dev/viewer 4.0.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/LICENSE.md +193 -0
- package/README.md +4 -0
- package/dist/cdn/perspective-viewer.js +3 -0
- package/dist/cdn/perspective-viewer.js.map +7 -0
- package/dist/css/dracula.css +1 -0
- package/dist/css/gruvbox-dark.css +1 -0
- package/dist/css/gruvbox.css +1 -0
- package/dist/css/icons.css +1 -0
- package/dist/css/intl/de.css +1 -0
- package/dist/css/intl/es.css +1 -0
- package/dist/css/intl/fr.css +1 -0
- package/dist/css/intl/ja.css +1 -0
- package/dist/css/intl/pt.css +1 -0
- package/dist/css/intl/zh.css +1 -0
- package/dist/css/intl.css +1 -0
- package/dist/css/monokai.css +1 -0
- package/dist/css/pro-dark.css +1 -0
- package/dist/css/pro.css +1 -0
- package/dist/css/solarized-dark.css +1 -0
- package/dist/css/solarized.css +1 -0
- package/dist/css/themes.css +1 -0
- package/dist/css/vaporwave.css +1 -0
- package/dist/css/variables.css +0 -0
- package/dist/esm/bootstrap.d.ts +1 -0
- package/dist/esm/extensions.d.ts +70 -0
- package/dist/esm/perspective-viewer.d.ts +39 -0
- package/dist/esm/perspective-viewer.inline.js +3 -0
- package/dist/esm/perspective-viewer.inline.js.map +7 -0
- package/dist/esm/perspective-viewer.js +3 -0
- package/dist/esm/perspective-viewer.js.map +7 -0
- package/dist/esm/plugin.d.ts +195 -0
- package/dist/esm/ts-rs/Aggregate.d.ts +1 -0
- package/dist/esm/ts-rs/ColumnConfigValues.d.ts +31 -0
- package/dist/esm/ts-rs/CustomDatetimeFormat.d.ts +1 -0
- package/dist/esm/ts-rs/CustomDatetimeStyleConfig.d.ts +15 -0
- package/dist/esm/ts-rs/CustomNumberFormatConfig.d.ts +18 -0
- package/dist/esm/ts-rs/DatetimeColorMode.d.ts +1 -0
- package/dist/esm/ts-rs/DatetimeFormatType.d.ts +6 -0
- package/dist/esm/ts-rs/Expressions.d.ts +3 -0
- package/dist/esm/ts-rs/Filter.d.ts +2 -0
- package/dist/esm/ts-rs/FilterReducer.d.ts +1 -0
- package/dist/esm/ts-rs/FilterTerm.d.ts +2 -0
- package/dist/esm/ts-rs/FormatMode.d.ts +1 -0
- package/dist/esm/ts-rs/FormatUnit.d.ts +1 -0
- package/dist/esm/ts-rs/NumberBackgroundMode.d.ts +1 -0
- package/dist/esm/ts-rs/NumberForegroundMode.d.ts +1 -0
- package/dist/esm/ts-rs/OptionalUpdate.d.ts +1 -0
- package/dist/esm/ts-rs/PluginConfig.d.ts +2 -0
- package/dist/esm/ts-rs/RoundingMode.d.ts +1 -0
- package/dist/esm/ts-rs/RoundingPriority.d.ts +1 -0
- package/dist/esm/ts-rs/Scalar.d.ts +5 -0
- package/dist/esm/ts-rs/SignDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/SimpleDatetimeFormat.d.ts +1 -0
- package/dist/esm/ts-rs/SimpleDatetimeStyleConfig.d.ts +6 -0
- package/dist/esm/ts-rs/Sort.d.ts +2 -0
- package/dist/esm/ts-rs/SortDir.d.ts +1 -0
- package/dist/esm/ts-rs/StringColorMode.d.ts +1 -0
- package/dist/esm/ts-rs/TrailingZeroDisplay.d.ts +1 -0
- package/dist/esm/ts-rs/UseGrouping.d.ts +1 -0
- package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +102 -0
- package/dist/esm/ts-rs/serde_json/JsonValue.d.ts +3 -0
- package/dist/wasm/perspective-viewer.d.ts +1291 -0
- package/dist/wasm/perspective-viewer.js +3883 -0
- package/dist/wasm/perspective-viewer.wasm +0 -0
- package/dist/wasm/perspective-viewer.wasm.d.ts +142 -0
- package/dist/wasm/snippets/perspective-viewer-c69283f6f62a5f14/inline0.js +1 -0
- package/dist/wasm/snippets/perspective-viewer-c69283f6f62a5f14/inline1.js +1 -0
- package/dist/wasm/snippets/perspective-viewer-c69283f6f62a5f14/inline2.js +1 -0
- package/dist/wasm/snippets/perspective-viewer-c69283f6f62a5f14/inline3.js +44 -0
- package/dist/wasm/snippets/perspective-viewer-c69283f6f62a5f14/inline4.js +1 -0
- package/package.json +55 -0
- package/src/less/aggregate-selector.less +72 -0
- package/src/less/column-dropdown.less +95 -0
- package/src/less/column-selector.less +551 -0
- package/src/less/column-settings-panel.less +255 -0
- package/src/less/column-style.less +319 -0
- package/src/less/column-symbol-attributes.less +73 -0
- package/src/less/config-selector.less +363 -0
- package/src/less/containers/dropdown-menu.less +94 -0
- package/src/less/containers/pairs-list.less +46 -0
- package/src/less/containers/radio-list.less +29 -0
- package/src/less/containers/scroll-panel.less +27 -0
- package/src/less/containers/split-panel.less +80 -0
- package/src/less/containers/tabs.less +90 -0
- package/src/less/dom/checkbox.less +100 -0
- package/src/less/dom/scrollbar.less +35 -0
- package/src/less/dom/select.less +63 -0
- package/src/less/empty-column.less +72 -0
- package/src/less/expression-editor.less +152 -0
- package/src/less/filter-dropdown.less +53 -0
- package/src/less/filter-item.less +126 -0
- package/src/less/form/code-editor.less +137 -0
- package/src/less/form/debug.less +88 -0
- package/src/less/function-dropdown.less +45 -0
- package/src/less/plugin-selector.less +173 -0
- package/src/less/render-warning.less +81 -0
- package/src/less/status-bar.less +551 -0
- package/src/less/type-icon.less +68 -0
- package/src/less/viewer.less +368 -0
- package/src/rust/components/column_dropdown.rs +162 -0
- package/src/rust/components/column_selector/active_column.rs +462 -0
- package/src/rust/components/column_selector/add_expression_button.rs +59 -0
- package/src/rust/components/column_selector/aggregate_selector.rs +186 -0
- package/src/rust/components/column_selector/config_selector.rs +674 -0
- package/src/rust/components/column_selector/empty_column.rs +134 -0
- package/src/rust/components/column_selector/expression_toolbar.rs +45 -0
- package/src/rust/components/column_selector/filter_column.rs +530 -0
- package/src/rust/components/column_selector/inactive_column.rs +221 -0
- package/src/rust/components/column_selector/invalid_column.rs +37 -0
- package/src/rust/components/column_selector/pivot_column.rs +93 -0
- package/src/rust/components/column_selector/sort_column.rs +135 -0
- package/src/rust/components/column_selector.rs +426 -0
- package/src/rust/components/column_settings_sidebar/attributes_tab.rs +34 -0
- package/src/rust/components/column_settings_sidebar/mod.rs +17 -0
- package/src/rust/components/column_settings_sidebar/save_settings.rs +68 -0
- package/src/rust/components/column_settings_sidebar/sidebar.rs +396 -0
- package/src/rust/components/column_settings_sidebar/style_tab/column_style.rs +177 -0
- package/src/rust/components/column_settings_sidebar/style_tab/stub.rs +34 -0
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/row_selector.rs +101 -0
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_config.rs +24 -0
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_pairs.rs +185 -0
- package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_selector.rs +55 -0
- package/src/rust/components/column_settings_sidebar/style_tab/symbol.rs +131 -0
- package/src/rust/components/column_settings_sidebar/style_tab.rs +231 -0
- package/src/rust/components/containers/dragdrop_list.rs +325 -0
- package/src/rust/components/containers/dropdown_menu.rs +104 -0
- package/src/rust/components/containers/kvpair.rs +47 -0
- package/src/rust/components/containers/mod.rs +28 -0
- package/src/rust/components/containers/scroll_panel.rs +311 -0
- package/src/rust/components/containers/scroll_panel_item.rs +111 -0
- package/src/rust/components/containers/select.rs +269 -0
- package/src/rust/components/containers/sidebar.rs +89 -0
- package/src/rust/components/containers/split_panel.rs +483 -0
- package/src/rust/components/containers/tab_list.rs +104 -0
- package/src/rust/components/containers/tests/mod.rs +11 -0
- package/src/rust/components/containers/tests/split_panel.rs +91 -0
- package/src/rust/components/containers/trap_door_panel.rs +50 -0
- package/src/rust/components/copy_dropdown.rs +136 -0
- package/src/rust/components/datetime_column_style/custom.rs +222 -0
- package/src/rust/components/datetime_column_style/simple.rs +122 -0
- package/src/rust/components/datetime_column_style.rs +284 -0
- package/src/rust/components/editable_header.rs +183 -0
- package/src/rust/components/empty_row.rs +169 -0
- package/src/rust/components/error_message.rs +56 -0
- package/src/rust/components/export_dropdown.rs +153 -0
- package/src/rust/components/expression_editor.rs +153 -0
- package/src/rust/components/filter_dropdown.rs +144 -0
- package/src/rust/components/font_loader.rs +254 -0
- package/src/rust/components/form/code_editor.rs +286 -0
- package/src/rust/components/form/color_range_selector.rs +115 -0
- package/src/rust/components/form/color_selector.rs +54 -0
- package/src/rust/components/form/debug.rs +253 -0
- package/src/rust/components/form/highlight.rs +50 -0
- package/src/rust/components/form/mod.rs +29 -0
- package/src/rust/components/form/number_field.rs +72 -0
- package/src/rust/components/form/number_input.rs +45 -0
- package/src/rust/components/form/number_range_field.rs +77 -0
- package/src/rust/components/form/optional_field.rs +53 -0
- package/src/rust/components/form/select_field.rs +104 -0
- package/src/rust/components/function_dropdown.rs +151 -0
- package/src/rust/components/mod.rs +45 -0
- package/src/rust/components/modal.rs +171 -0
- package/src/rust/components/number_column_style.rs +522 -0
- package/src/rust/components/plugin_selector.rs +196 -0
- package/src/rust/components/render_warning.rs +178 -0
- package/src/rust/components/status_bar.rs +315 -0
- package/src/rust/components/status_bar_counter.rs +229 -0
- package/src/rust/components/status_indicator.rs +164 -0
- package/src/rust/components/string_column_style.rs +186 -0
- package/src/rust/components/style/local_style.rs +35 -0
- package/src/rust/components/style/mod.rs +52 -0
- package/src/rust/components/style/style_cache.rs +132 -0
- package/src/rust/components/style/style_provider.rs +65 -0
- package/src/rust/components/style_controls/number_string_format/digits_section.rs +140 -0
- package/src/rust/components/style_controls/number_string_format/misc_section.rs +56 -0
- package/src/rust/components/style_controls/number_string_format/style_section.rs +69 -0
- package/src/rust/components/style_controls/number_string_format/types.rs +31 -0
- package/src/rust/components/style_controls/number_string_format.rs +259 -0
- package/src/rust/components/style_controls.rs +15 -0
- package/src/rust/components/type_icon.rs +53 -0
- package/src/rust/components/viewer.rs +668 -0
- package/src/rust/config/columns_config.rs +132 -0
- package/src/rust/config/datetime_column_style/color_mode.rs +62 -0
- package/src/rust/config/datetime_column_style/custom.rs +121 -0
- package/src/rust/config/datetime_column_style/custom_format.rs +90 -0
- package/src/rust/config/datetime_column_style/simple.rs +55 -0
- package/src/rust/config/datetime_column_style/simple_format.rs +86 -0
- package/src/rust/config/datetime_column_style.rs +104 -0
- package/src/rust/config/mod.rs +30 -0
- package/src/rust/config/number_column_style.rs +138 -0
- package/src/rust/config/number_string_format/enums.rs +298 -0
- package/src/rust/config/number_string_format.rs +269 -0
- package/src/rust/config/string_column_style.rs +140 -0
- package/src/rust/config/view_config.rs +24 -0
- package/src/rust/config/viewer_config.rs +337 -0
- package/src/rust/custom_elements/column_dropdown.rs +123 -0
- package/src/rust/custom_elements/copy_dropdown.rs +112 -0
- package/src/rust/custom_elements/debug_plugin.rs +114 -0
- package/src/rust/custom_elements/export_dropdown.rs +112 -0
- package/src/rust/custom_elements/filter_dropdown.rs +179 -0
- package/src/rust/custom_elements/function_dropdown.rs +115 -0
- package/src/rust/custom_elements/mod.rs +24 -0
- package/src/rust/custom_elements/modal.rs +395 -0
- package/src/rust/custom_elements/viewer.rs +880 -0
- package/src/rust/custom_events.rs +214 -0
- package/src/rust/dragdrop.rs +362 -0
- package/src/rust/exprtk/cursor.rs +81 -0
- package/src/rust/exprtk/mod.rs +17 -0
- package/src/rust/exprtk/tokenize/comment.rs +21 -0
- package/src/rust/exprtk/tokenize/number.rs +44 -0
- package/src/rust/exprtk/tokenize/string.rs +98 -0
- package/src/rust/exprtk/tokenize/symbol.rs +26 -0
- package/src/rust/exprtk/tokenize.rs +190 -0
- package/src/rust/js/clipboard.rs +77 -0
- package/src/rust/js/clipboard_item.rs +21 -0
- package/src/rust/js/intersection_observer.rs +32 -0
- package/src/rust/js/mimetype.rs +42 -0
- package/src/rust/js/mod.rs +29 -0
- package/src/rust/js/plugin.rs +167 -0
- package/src/rust/js/resize_observer.rs +37 -0
- package/src/rust/js/testing.rs +149 -0
- package/src/rust/lib.rs +116 -0
- package/src/rust/model/columns_iter_set.rs +340 -0
- package/src/rust/model/copy_export.rs +157 -0
- package/src/rust/model/create_col.rs +59 -0
- package/src/rust/model/edit_expression.rs +95 -0
- package/src/rust/model/export_app.rs +58 -0
- package/src/rust/model/export_method.rs +151 -0
- package/src/rust/model/get_viewer_config.rs +85 -0
- package/src/rust/model/intersection_observer.rs +81 -0
- package/src/rust/model/is_invalid_drop.rs +36 -0
- package/src/rust/model/mod.rs +93 -0
- package/src/rust/model/plugin_column_styles.rs +106 -0
- package/src/rust/model/resize_observer.rs +98 -0
- package/src/rust/model/restore_and_render.rs +113 -0
- package/src/rust/model/structural.rs +73 -0
- package/src/rust/model/update_and_render.rs +74 -0
- package/src/rust/presentation.rs +370 -0
- package/src/rust/renderer/activate.rs +49 -0
- package/src/rust/renderer/limits.rs +200 -0
- package/src/rust/renderer/plugin_store.rs +45 -0
- package/src/rust/renderer/registry.rs +135 -0
- package/src/rust/renderer/render_timer.rs +185 -0
- package/src/rust/renderer.rs +463 -0
- package/src/rust/session/column_defaults_update.rs +141 -0
- package/src/rust/session/drag_drop_update.rs +179 -0
- package/src/rust/session/metadata.rs +308 -0
- package/src/rust/session/replace_expression_update.rs +131 -0
- package/src/rust/session/view_subscription.rs +189 -0
- package/src/rust/session.rs +794 -0
- package/src/rust/utils/browser/blob.rs +49 -0
- package/src/rust/utils/browser/download.rs +26 -0
- package/src/rust/utils/browser/mod.rs +24 -0
- package/src/rust/utils/browser/request_animation_frame.rs +76 -0
- package/src/rust/utils/browser/selection.rs +79 -0
- package/src/rust/utils/browser/tests/debounce.rs +114 -0
- package/src/rust/utils/browser/tests/mod.rs +13 -0
- package/src/rust/utils/custom_element.rs +85 -0
- package/src/rust/utils/datetime.rs +49 -0
- package/src/rust/utils/debounce.rs +54 -0
- package/src/rust/utils/hooks/mod.rs +15 -0
- package/src/rust/utils/hooks/use_async_callback.rs +53 -0
- package/src/rust/utils/mod.rs +114 -0
- package/src/rust/utils/number_format.rs +48 -0
- package/src/rust/utils/pubsub.rs +222 -0
- package/src/rust/utils/scope.rs +54 -0
- package/src/rust/utils/tee.rs +88 -0
- package/src/rust/utils/tests/mod.rs +14 -0
- package/src/rust/utils/tests/pubsub.rs +95 -0
- package/src/rust/utils/tests/request_animation_frame.rs +42 -0
- package/src/rust/utils/wasm_abi.rs +61 -0
- package/src/rust/utils/weak_scope.rs +39 -0
- package/src/svg/align-scroll-icon.svg +7 -0
- package/src/svg/bg-pattern.png +0 -0
- package/src/svg/boolean-type.svg +3 -0
- package/src/svg/checkbox-checked-icon.svg +7 -0
- package/src/svg/checkbox-hover.svg +4 -0
- package/src/svg/checkbox-off.svg +4 -0
- package/src/svg/checkbox-on.svg +4 -0
- package/src/svg/checkbox-unchecked-icon.svg +3 -0
- package/src/svg/close-icon.svg +6 -0
- package/src/svg/column-settings-icon.svg +6 -0
- package/src/svg/datagrid-select-column.svg +15 -0
- package/src/svg/datagrid-select-region.svg +15 -0
- package/src/svg/datagrid-select-row.svg +13 -0
- package/src/svg/datagrid.svg +13 -0
- package/src/svg/date-type.svg +23 -0
- package/src/svg/downloading.gif +0 -0
- package/src/svg/drag-handle.svg +10 -0
- package/src/svg/drawer-bg-pattern-hidpi.png +0 -0
- package/src/svg/drawer-tab-hover.svg +8 -0
- package/src/svg/drawer-tab-invert-hover.svg +9 -0
- package/src/svg/drawer-tab-invert.svg +8 -0
- package/src/svg/drawer-tab.svg +7 -0
- package/src/svg/dropdown-selector-light.svg +3 -0
- package/src/svg/dropdown-selector.svg +3 -0
- package/src/svg/duplicate-icon.svg +4 -0
- package/src/svg/editable-icon.svg +5 -0
- package/src/svg/export-icon.svg +4 -0
- package/src/svg/expression.svg +10 -0
- package/src/svg/free-scroll-icon.svg +5 -0
- package/src/svg/inactive-mouseover.svg +4 -0
- package/src/svg/mega-menu-icons-candlestick.svg +38 -0
- package/src/svg/mega-menu-icons-datagrid.svg +38 -0
- package/src/svg/mega-menu-icons-heatmap.svg +60 -0
- package/src/svg/mega-menu-icons-map-scatter.svg +43 -0
- package/src/svg/mega-menu-icons-ohlc.svg +40 -0
- package/src/svg/mega-menu-icons-sunburst.svg +39 -0
- package/src/svg/mega-menu-icons-treemap.svg +44 -0
- package/src/svg/mega-menu-icons-x-bar.svg +36 -0
- package/src/svg/mega-menu-icons-x-y-line.svg +38 -0
- package/src/svg/mega-menu-icons-x-y-scatter.svg +72 -0
- package/src/svg/mega-menu-icons-y-area.svg +73 -0
- package/src/svg/mega-menu-icons-y-bar.svg +36 -0
- package/src/svg/mega-menu-icons-y-line.svg +36 -0
- package/src/svg/mega-menu-icons-y-scatter.svg +72 -0
- package/src/svg/number-type.svg +4 -0
- package/src/svg/radio-hover.svg +4 -0
- package/src/svg/radio-off.svg +3 -0
- package/src/svg/radio-on.svg +4 -0
- package/src/svg/read-only-icon.svg +6 -0
- package/src/svg/revert-icon.svg +4 -0
- package/src/svg/sort-abs-asc-icon.svg +3 -0
- package/src/svg/sort-abs-col-asc-icon.svg +3 -0
- package/src/svg/sort-abs-col-desc-icon.svg +3 -0
- package/src/svg/sort-abs-desc-icon.svg +3 -0
- package/src/svg/sort-asc-icon.svg +4 -0
- package/src/svg/sort-col-asc-icon.svg +4 -0
- package/src/svg/sort-col-desc-icon.svg +4 -0
- package/src/svg/sort-desc-icon.svg +4 -0
- package/src/svg/sort-none-icon.svg +3 -0
- package/src/svg/status_error.svg +70 -0
- package/src/svg/status_ok.svg +26 -0
- package/src/svg/string-type.svg +8 -0
- package/src/svg/theme-icon.svg +5 -0
- package/src/svg/updating.gif +0 -0
- package/src/themes/dracula.less +101 -0
- package/src/themes/gruvbox-dark.less +116 -0
- package/src/themes/gruvbox.less +152 -0
- package/src/themes/icons.less +130 -0
- package/src/themes/intl/de.less +102 -0
- package/src/themes/intl/es.less +102 -0
- package/src/themes/intl/fr.less +102 -0
- package/src/themes/intl/ja.less +102 -0
- package/src/themes/intl/pt.less +102 -0
- package/src/themes/intl/zh.less +102 -0
- package/src/themes/intl.less +102 -0
- package/src/themes/monokai.less +107 -0
- package/src/themes/pro-dark.less +147 -0
- package/src/themes/pro.less +186 -0
- package/src/themes/solarized-dark.less +78 -0
- package/src/themes/solarized.less +102 -0
- package/src/themes/themes.less +21 -0
- package/src/themes/vaporwave.less +145 -0
- package/src/themes/variables.less +24 -0
- package/src/ts/bootstrap.ts +26 -0
- package/src/ts/extensions.ts +124 -0
- package/src/ts/perspective-viewer.cdn.ts +19 -0
- package/src/ts/perspective-viewer.inline.ts +23 -0
- package/src/ts/perspective-viewer.ts +59 -0
- package/src/ts/plugin.ts +279 -0
- package/src/ts/ts-rs/Aggregate.ts +3 -0
- package/src/ts/ts-rs/ColumnConfigValues.ts +14 -0
- package/src/ts/ts-rs/CustomDatetimeFormat.ts +3 -0
- package/src/ts/ts-rs/CustomDatetimeStyleConfig.ts +5 -0
- package/src/ts/ts-rs/CustomNumberFormatConfig.ts +8 -0
- package/src/ts/ts-rs/DatetimeColorMode.ts +3 -0
- package/src/ts/ts-rs/DatetimeFormatType.ts +8 -0
- package/src/ts/ts-rs/Expressions.ts +3 -0
- package/src/ts/ts-rs/Filter.ts +4 -0
- package/src/ts/ts-rs/FilterReducer.ts +3 -0
- package/src/ts/ts-rs/FilterTerm.ts +4 -0
- package/src/ts/ts-rs/FormatMode.ts +3 -0
- package/src/ts/ts-rs/FormatUnit.ts +3 -0
- package/src/ts/ts-rs/NumberBackgroundMode.ts +3 -0
- package/src/ts/ts-rs/NumberForegroundMode.ts +3 -0
- package/src/ts/ts-rs/OnUpdateData.ts +8 -0
- package/src/ts/ts-rs/OptionalUpdate.ts +3 -0
- package/src/ts/ts-rs/PluginConfig.ts +4 -0
- package/src/ts/ts-rs/RoundingMode.ts +3 -0
- package/src/ts/ts-rs/RoundingPriority.ts +3 -0
- package/src/ts/ts-rs/Scalar.ts +7 -0
- package/src/ts/ts-rs/SignDisplay.ts +3 -0
- package/src/ts/ts-rs/SimpleDatetimeFormat.ts +3 -0
- package/src/ts/ts-rs/SimpleDatetimeStyleConfig.ts +4 -0
- package/src/ts/ts-rs/Sort.ts +4 -0
- package/src/ts/ts-rs/SortDir.ts +3 -0
- package/src/ts/ts-rs/StringColorMode.ts +3 -0
- package/src/ts/ts-rs/TrailingZeroDisplay.ts +3 -0
- package/src/ts/ts-rs/UseGrouping.ts +3 -0
- package/src/ts/ts-rs/ViewOnUpdateResp.ts +3 -0
- package/src/ts/ts-rs/ViewerConfigUpdate.ts +90 -0
- package/src/ts/ts-rs/serde_json/JsonValue.ts +3 -0
- package/tsconfig.json +15 -0
package/src/ts/plugin.ts
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
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
|
+
import { View } from "@perspective-dev/client";
|
|
14
|
+
|
|
15
|
+
// import type * as perspective from "@perspective-dev/client";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The `IPerspectiveViewerPlugin` interface defines the necessary API for a
|
|
19
|
+
* `<perspective-viewer>` plugin, which also must be an `HTMLElement` via the
|
|
20
|
+
* Custom Elements API or otherwise. Rather than implement this API from
|
|
21
|
+
* scratch however, the simplest way is to inherit from
|
|
22
|
+
* `<perspective-viewer-plugin>`, which implements `IPerspectiveViewerPlugin`
|
|
23
|
+
* with non-offensive default implementations, where only the `draw()` and
|
|
24
|
+
* `name()` methods need be overridden to get started with a simple plugin.
|
|
25
|
+
*
|
|
26
|
+
* Note that plugins are frozen once a `<perspective-viewer>` has been
|
|
27
|
+
* instantiated, so generally new plugin code must be executed at the module
|
|
28
|
+
* level (if packaged as a library), or during application init to ensure global
|
|
29
|
+
* availability of a plugin.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```javascript
|
|
33
|
+
* const BasePlugin = customElements.get("perspective-viewer-plugin");
|
|
34
|
+
* class MyPlugin extends BasePlugin {
|
|
35
|
+
* get name() {
|
|
36
|
+
* return "My Plugin";
|
|
37
|
+
* }
|
|
38
|
+
* async draw(view) {
|
|
39
|
+
* const count = await view.num_rows();
|
|
40
|
+
* this.innerHTML = `View has ${count} rows`;
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* customElements.define("my-plugin", MyPlugin);
|
|
45
|
+
* const Viewer = customElements.get("perspective-viewer");
|
|
46
|
+
* Viewer.registerPlugin("my-plugin");
|
|
47
|
+
* ```
|
|
48
|
+
* @noInheritDoc
|
|
49
|
+
*/
|
|
50
|
+
export interface IPerspectiveViewerPlugin {
|
|
51
|
+
/**
|
|
52
|
+
* The name for this plugin, which is used as both it's unique key for use
|
|
53
|
+
* as a parameter for the `plugin` field of a `ViewerConfig`, and as the
|
|
54
|
+
* display name for this plugin in the `<perspective-viewer>` UI.
|
|
55
|
+
*/
|
|
56
|
+
get name(): string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Select mode determines how column add/remove buttons behave for this
|
|
60
|
+
* plugin. `"select"` mode exclusively selects the added column, removing
|
|
61
|
+
* other columns. `"toggle"` mode toggles the column on or off (dependent
|
|
62
|
+
* on column state), leaving existing columns alone.
|
|
63
|
+
*/
|
|
64
|
+
get select_mode(): string | undefined;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The minimum number of columns required for this plugin to operate.
|
|
68
|
+
* This mostly affects drag/drop and column remove button behavior,
|
|
69
|
+
* preventing the use from applying configs which violate this min.
|
|
70
|
+
*
|
|
71
|
+
* While this option can technically be `undefined` (as in the case of
|
|
72
|
+
* `@perspective-dev/viewer-datagrid`), doing so currently has nearly
|
|
73
|
+
* identical behavior to 1.
|
|
74
|
+
*/
|
|
75
|
+
get min_config_columns(): number | undefined;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The named column labels, if desired. Named columns behave differently
|
|
79
|
+
* in drag/drop mode than unnamed columns, having replace/swap behavior
|
|
80
|
+
* rather than insert. If provided, the length of `config_column_names`
|
|
81
|
+
* _must_ be `>= min_config_columns`, as this is assumed by the drag/drop
|
|
82
|
+
* logic.
|
|
83
|
+
*/
|
|
84
|
+
get config_column_names(): string[] | undefined;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The load priority of the plugin. If the plugin shares priority with another,
|
|
88
|
+
* the first to load has a higher priority.
|
|
89
|
+
*
|
|
90
|
+
* A larger number has a higher priority.
|
|
91
|
+
*
|
|
92
|
+
* The plugin with the highest priority will be loaded by default by the Perspective viewer.
|
|
93
|
+
* If you would like to instead begin with a lower priority plugin, choose it explicitly with
|
|
94
|
+
* a `HTMLPerspectiveViewerPluginElement.restore` call.
|
|
95
|
+
*/
|
|
96
|
+
get priority(): number | undefined;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Given a column's grouping (determined by indexing it in `plugin.config_column_names`)
|
|
100
|
+
* and its view type, determines whether or not to render column styles in the settings sidebar.
|
|
101
|
+
* Implementing this function and `column_style_config` allows the plugin to interface with the viewer's column configuration API.
|
|
102
|
+
*/
|
|
103
|
+
can_render_column_styles?: (view_type: string, group: string) => boolean;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Determines which column configuration controls are populated in the viewer.
|
|
107
|
+
* Corresponds to the data the plugin will recieve on save.
|
|
108
|
+
* Implementing this function and `can_render_column_styles` allows the plugin to interface with the viewer's column configuration API.
|
|
109
|
+
*/
|
|
110
|
+
column_style_config?: (view_type: string, group: string) => any;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Render this plugin using the provided `View`. While there is no
|
|
114
|
+
* provision to cancel a render in progress per se, calling a method on
|
|
115
|
+
* a `View` which has been deleted will throw an exception.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```
|
|
119
|
+
* async draw(view: perspective.View): Promise<void> {
|
|
120
|
+
* const csv = await view.to_csv();
|
|
121
|
+
* this.innerHTML = `<pre>${csv}</pre>`;
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
draw(view: View): Promise<void>;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Draw under the assumption that the `ViewConfig` has not changed since
|
|
129
|
+
* the previous call to `draw()`, but the underlying data has. Defaults to
|
|
130
|
+
* dispatch to `draw()`.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```javascript
|
|
134
|
+
* async update(view: perspective.View): Promise<void> {
|
|
135
|
+
* return this.draw(view);
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
update(view: View): Promise<void>;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Clear this plugin, though it is up to the discretion of the plugin
|
|
143
|
+
* author to determine what this means. Defaults to resetting this
|
|
144
|
+
* element's `innerHTML`, so be sure to override if you want custom
|
|
145
|
+
* behavior.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```javascript
|
|
149
|
+
* async clear(): Promise<void> {
|
|
150
|
+
* this.innerHTML = "";
|
|
151
|
+
* }
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
clear(): Promise<void>;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Like `update()`, but for when the dimensions of the plugin have changed
|
|
158
|
+
* and the underlying data has not.
|
|
159
|
+
*/
|
|
160
|
+
resize(): Promise<void>;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Notify the plugin that the style environment has changed. Useful for
|
|
164
|
+
* plugins which read CSS styles via `window.getComputedStyle()`.
|
|
165
|
+
*/
|
|
166
|
+
restyle(): Promise<void>;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Save this plugin's state to a JSON-serializable value. While this value
|
|
170
|
+
* can be anything, it should work reciprocally with `restore()` to return
|
|
171
|
+
* this plugin's renderer to the same state, though potentially with a
|
|
172
|
+
* different `View`.
|
|
173
|
+
*
|
|
174
|
+
* `save()` should be used for user-persistent settings that are
|
|
175
|
+
* data-agnostic, so the user can have persistent view during refresh or
|
|
176
|
+
* reload. For example, `@perspective-dev/viewer-d3fc` uses
|
|
177
|
+
* `plugin_config` to remember the user-repositionable legend coordinates.
|
|
178
|
+
*/
|
|
179
|
+
save(): Promise<any>;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Restore this plugin to a state previously returned by `save()`.
|
|
183
|
+
*/
|
|
184
|
+
restore(config: any): Promise<void>;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Free any resources acquired by this plugin and prepare to be deleted.
|
|
188
|
+
*/
|
|
189
|
+
delete(): Promise<void>;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The `<perspective-viewer-plugin>` element, the default perspective plugin
|
|
194
|
+
* which is registered and activated automcatically when a
|
|
195
|
+
* `<perspective-viewer>` is loaded without plugins. While you will not
|
|
196
|
+
* typically instantiate this class directly, it is simple enough to function
|
|
197
|
+
* as a good "default" plugin implementation which can be extended to create
|
|
198
|
+
* custom plugins.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```javascript
|
|
202
|
+
* class MyPlugin extends customElements.get("perspective-viewer-plugin") {
|
|
203
|
+
* // Custom plugin overrides
|
|
204
|
+
* }
|
|
205
|
+
* ```
|
|
206
|
+
* @noInheritDoc
|
|
207
|
+
*/
|
|
208
|
+
export class HTMLPerspectiveViewerPluginElement
|
|
209
|
+
extends HTMLElement
|
|
210
|
+
implements IPerspectiveViewerPlugin
|
|
211
|
+
{
|
|
212
|
+
constructor() {
|
|
213
|
+
super();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
get name(): string {
|
|
217
|
+
return "Debug";
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
get select_mode(): "select" | "toggle" {
|
|
221
|
+
return "select";
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
get min_config_columns(): number | undefined {
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
get config_column_names(): string[] | undefined {
|
|
229
|
+
return undefined;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
get priority(): number {
|
|
233
|
+
return 0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
can_render_column_styles(): boolean {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
column_style_config(): any {
|
|
241
|
+
{
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async update(view: View): Promise<void> {
|
|
246
|
+
return this.draw(view);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
async draw(view: View): Promise<void> {
|
|
250
|
+
this.style.backgroundColor = "#fff";
|
|
251
|
+
const csv = await view.to_csv();
|
|
252
|
+
const css = `margin:0;overflow:scroll;position:absolute;width:100%;height:100%`;
|
|
253
|
+
this.innerHTML = `<pre style='${css}'>${csv}</pre>`;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
async clear(): Promise<void> {
|
|
257
|
+
this.innerHTML = "";
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async resize(): Promise<void> {
|
|
261
|
+
// Not Implemented
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
async restyle(): Promise<void> {
|
|
265
|
+
// Not Implemented
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
async save(): Promise<any> {
|
|
269
|
+
// Not Implemented
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
async restore(): Promise<void> {
|
|
273
|
+
// Not Implemented
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
async delete(): Promise<void> {
|
|
277
|
+
// Not Implemented
|
|
278
|
+
}
|
|
279
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { CustomNumberFormatConfig } from "./CustomNumberFormatConfig.js";
|
|
3
|
+
import type { DatetimeColorMode } from "./DatetimeColorMode.js";
|
|
4
|
+
import type { DatetimeFormatType } from "./DatetimeFormatType.js";
|
|
5
|
+
import type { FormatMode } from "./FormatMode.js";
|
|
6
|
+
import type { NumberBackgroundMode } from "./NumberBackgroundMode.js";
|
|
7
|
+
import type { NumberForegroundMode } from "./NumberForegroundMode.js";
|
|
8
|
+
import type { StringColorMode } from "./StringColorMode.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The value de/serialized and stored in the viewer config.
|
|
12
|
+
* Also passed to the plugin via `plugin.save()`.
|
|
13
|
+
*/
|
|
14
|
+
export type ColumnConfigValues = { symbols?: { [key in string]?: string }, number_format?: CustomNumberFormatConfig | null, aggregate_depth?: number, number_fg_mode?: NumberForegroundMode, number_bg_mode?: NumberBackgroundMode, pos_fg_color: string | null, neg_fg_color: string | null, pos_bg_color: string | null, neg_bg_color: string | null, fg_gradient: number | null, bg_gradient: number | null, format?: FormatMode, string_color_mode?: StringColorMode, color?: string | null, date_format?: DatetimeFormatType, datetime_color_mode?: DatetimeColorMode, };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { CustomDatetimeFormat } from "./CustomDatetimeFormat.js";
|
|
3
|
+
import type { FormatUnit } from "./FormatUnit.js";
|
|
4
|
+
|
|
5
|
+
export type CustomDatetimeStyleConfig = { format: FormatUnit, timeZone?: string | null, fractionalSecondDigits?: number, second?: CustomDatetimeFormat, minute?: CustomDatetimeFormat, hour?: CustomDatetimeFormat, day?: CustomDatetimeFormat, weekday?: CustomDatetimeFormat, month?: CustomDatetimeFormat, year?: CustomDatetimeFormat, hour12?: boolean, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { RoundingMode } from "./RoundingMode.js";
|
|
3
|
+
import type { RoundingPriority } from "./RoundingPriority.js";
|
|
4
|
+
import type { SignDisplay } from "./SignDisplay.js";
|
|
5
|
+
import type { TrailingZeroDisplay } from "./TrailingZeroDisplay.js";
|
|
6
|
+
import type { UseGrouping } from "./UseGrouping.js";
|
|
7
|
+
|
|
8
|
+
export type CustomNumberFormatConfig = { minimumIntegerDigits: number | null, minimumFractionDigits: number | null, maximumFractionDigits: number | null, minimumSignificantDigits: number | null, maximumSignificantDigits: number | null, roundingPriority: RoundingPriority | null, roundingIncrement: number | null, roundingMode: RoundingMode | null, trailingZeroDisplay: TrailingZeroDisplay | null, useGrouping: UseGrouping | null, signDisplay: SignDisplay | null, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { CustomDatetimeStyleConfig } from "./CustomDatetimeStyleConfig.js";
|
|
3
|
+
import type { SimpleDatetimeStyleConfig } from "./SimpleDatetimeStyleConfig.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `Simple` case has all default-able keys and must be last!
|
|
7
|
+
*/
|
|
8
|
+
export type DatetimeFormatType = CustomDatetimeStyleConfig | SimpleDatetimeStyleConfig;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { ViewOnUpdateResp } from "./ViewOnUpdateResp.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Rows updated and port ID corresponding to an update batch, provided to the
|
|
6
|
+
* callback argument to [`View::on_update`] with the "rows" mode.
|
|
7
|
+
*/
|
|
8
|
+
export type OnUpdateData = ViewOnUpdateResp;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { SimpleDatetimeFormat } from "./SimpleDatetimeFormat.js";
|
|
3
|
+
|
|
4
|
+
export type SimpleDatetimeStyleConfig = { timeZone?: string | null, dateStyle?: SimpleDatetimeFormat, timeStyle?: SimpleDatetimeFormat, };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
|
2
|
+
import type { Aggregate } from "./Aggregate.js";
|
|
3
|
+
import type { ColumnConfigValues } from "./ColumnConfigValues.js";
|
|
4
|
+
import type { Expressions } from "./Expressions.js";
|
|
5
|
+
import type { Filter } from "./Filter.js";
|
|
6
|
+
import type { FilterReducer } from "./FilterReducer.js";
|
|
7
|
+
import type { OptionalUpdate } from "./OptionalUpdate.js";
|
|
8
|
+
import type { PluginConfig } from "./PluginConfig.js";
|
|
9
|
+
import type { Sort } from "./Sort.js";
|
|
10
|
+
|
|
11
|
+
export type ViewerConfigUpdate = { version?: OptionalUpdate<string>, plugin?: OptionalUpdate<string>, title?: OptionalUpdate<string>, theme?: OptionalUpdate<string>, settings?: OptionalUpdate<boolean>, plugin_config?: PluginConfig | null, columns_config?: OptionalUpdate<{ [key in string]?: ColumnConfigValues }>,
|
|
12
|
+
/**
|
|
13
|
+
* A group by _groups_ the dataset by the unique values of each column used
|
|
14
|
+
* as a group by - a close analogue in SQL to the `GROUP BY` statement.
|
|
15
|
+
* The underlying dataset is aggregated to show the values belonging to
|
|
16
|
+
* each group, and a total row is calculated for each group, showing
|
|
17
|
+
* the currently selected aggregated value (e.g. `sum`) of the column.
|
|
18
|
+
* Group by are useful for hierarchies, categorizing data and
|
|
19
|
+
* attributing values, i.e. showing the number of units sold based on
|
|
20
|
+
* State and City. In Perspective, group by are represented as an array
|
|
21
|
+
* of string column names to pivot, are applied in the order provided;
|
|
22
|
+
* For example, a group by of `["State", "City", "Postal Code"]` shows
|
|
23
|
+
* the values for each Postal Code, which are grouped by City,
|
|
24
|
+
* which are in turn grouped by State.
|
|
25
|
+
*/
|
|
26
|
+
group_by?: Array<string>,
|
|
27
|
+
/**
|
|
28
|
+
* A split by _splits_ the dataset by the unique values of each column used
|
|
29
|
+
* as a split by. The underlying dataset is not aggregated, and a new
|
|
30
|
+
* column is created for each unique value of the split by. Each newly
|
|
31
|
+
* created column contains the parts of the dataset that correspond to
|
|
32
|
+
* the column header, i.e. a `View` that has `["State"]` as its split
|
|
33
|
+
* by will have a new column for each state. In Perspective, Split By
|
|
34
|
+
* are represented as an array of string column names to pivot.
|
|
35
|
+
*/
|
|
36
|
+
split_by?: Array<string>,
|
|
37
|
+
/**
|
|
38
|
+
* The `columns` property specifies which columns should be included in the
|
|
39
|
+
* [`crate::View`]'s output. This allows users to show or hide a specific
|
|
40
|
+
* subset of columns, as well as control the order in which columns
|
|
41
|
+
* appear to the user. This is represented in Perspective as an array
|
|
42
|
+
* of string column names.
|
|
43
|
+
*/
|
|
44
|
+
columns?: Array<string | null>,
|
|
45
|
+
/**
|
|
46
|
+
* The `filter` property specifies columns on which the query can be
|
|
47
|
+
* filtered, returning rows that pass the specified filter condition.
|
|
48
|
+
* This is analogous to the `WHERE` clause in SQL. There is no limit on
|
|
49
|
+
* the number of columns where `filter` is applied, but the resulting
|
|
50
|
+
* dataset is one that passes all the filter conditions, i.e. the
|
|
51
|
+
* filters are joined with an `AND` condition.
|
|
52
|
+
*
|
|
53
|
+
* Perspective represents `filter` as an array of arrays, with the values
|
|
54
|
+
* of each inner array being a string column name, a string filter
|
|
55
|
+
* operator, and a filter operand in the type of the column.
|
|
56
|
+
*/
|
|
57
|
+
filter?: Array<Filter>,
|
|
58
|
+
/**
|
|
59
|
+
* The `sort` property specifies columns on which the query should be
|
|
60
|
+
* sorted, analogous to `ORDER BY` in SQL. A column can be sorted
|
|
61
|
+
* regardless of its data type, and sorts can be applied in ascending
|
|
62
|
+
* or descending order. Perspective represents `sort` as an array of
|
|
63
|
+
* arrays, with the values of each inner array being a string column
|
|
64
|
+
* name and a string sort direction. When `column-pivots` are applied,
|
|
65
|
+
* the additional sort directions `"col asc"` and `"col desc"` will
|
|
66
|
+
* determine the order of pivot columns groups.
|
|
67
|
+
*/
|
|
68
|
+
sort?: Array<Sort>,
|
|
69
|
+
/**
|
|
70
|
+
* The `expressions` property specifies _new_ columns in Perspective that
|
|
71
|
+
* are created using existing column values or arbitary scalar values
|
|
72
|
+
* defined within the expression. In `<perspective-viewer>`,
|
|
73
|
+
* expressions are added using the "New Column" button in the side
|
|
74
|
+
* panel.
|
|
75
|
+
*/
|
|
76
|
+
expressions?: Expressions,
|
|
77
|
+
/**
|
|
78
|
+
* Aggregates perform a calculation over an entire column, and are
|
|
79
|
+
* displayed when one or more [Group By](#group-by) are applied to the
|
|
80
|
+
* `View`. Aggregates can be specified by the user, or Perspective will
|
|
81
|
+
* use the following sensible default aggregates based on column type:
|
|
82
|
+
*
|
|
83
|
+
* - "sum" for `integer` and `float` columns
|
|
84
|
+
* - "count" for all other columns
|
|
85
|
+
*
|
|
86
|
+
* Perspective provides a selection of aggregate functions that can be
|
|
87
|
+
* applied to columns in the `View` constructor using a dictionary of
|
|
88
|
+
* column name to aggregate function name.
|
|
89
|
+
*/
|
|
90
|
+
aggregates?: { [key in string]?: Aggregate }, group_by_depth?: number, filter_op?: FilterReducer, };
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"target": "ESNext",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"emitDeclarationOnly": true,
|
|
8
|
+
"outDir": "./dist/esm",
|
|
9
|
+
"rootDir": "./src/ts",
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"typeRoots": ["./node_modules/@types"]
|
|
13
|
+
},
|
|
14
|
+
"files": ["src/ts/perspective-viewer.ts"]
|
|
15
|
+
}
|