@darajs/components 1.0.0-a.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +5 -0
- package/dist/common/accordion/accordion.d.ts +17 -0
- package/dist/common/accordion/accordion.d.ts.map +1 -0
- package/dist/common/accordion/accordion.js +34 -0
- package/dist/common/accordion/accordion.js.map +1 -0
- package/dist/common/anchor/anchor.d.ts +17 -0
- package/dist/common/anchor/anchor.d.ts.map +1 -0
- package/dist/common/anchor/anchor.js +25 -0
- package/dist/common/anchor/anchor.js.map +1 -0
- package/dist/common/bullet-list/bullet_list.d.ts +16 -0
- package/dist/common/bullet-list/bullet_list.d.ts.map +1 -0
- package/dist/common/bullet-list/bullet_list.js +17 -0
- package/dist/common/bullet-list/bullet_list.js.map +1 -0
- package/dist/common/button/button.d.ts +24 -0
- package/dist/common/button/button.d.ts.map +1 -0
- package/dist/common/button/button.js +46 -0
- package/dist/common/button/button.js.map +1 -0
- package/dist/common/button-bar/button-bar.d.ts +22 -0
- package/dist/common/button-bar/button-bar.d.ts.map +1 -0
- package/dist/common/button-bar/button-bar.js +26 -0
- package/dist/common/button-bar/button-bar.js.map +1 -0
- package/dist/common/card/card.d.ts +24 -0
- package/dist/common/card/card.d.ts.map +1 -0
- package/dist/common/card/card.js +54 -0
- package/dist/common/card/card.js.map +1 -0
- package/dist/common/carousel/carousel.d.ts +27 -0
- package/dist/common/carousel/carousel.d.ts.map +1 -0
- package/dist/common/carousel/carousel.js +42 -0
- package/dist/common/carousel/carousel.js.map +1 -0
- package/dist/common/checkbox-group/checkbox-group.d.ts +24 -0
- package/dist/common/checkbox-group/checkbox-group.d.ts.map +1 -0
- package/dist/common/checkbox-group/checkbox-group.js +36 -0
- package/dist/common/checkbox-group/checkbox-group.js.map +1 -0
- package/dist/common/code/code.d.ts +15 -0
- package/dist/common/code/code.d.ts.map +1 -0
- package/dist/common/code/code.js +41 -0
- package/dist/common/code/code.js.map +1 -0
- package/dist/common/component-select-list/component-select-list.d.ts +23 -0
- package/dist/common/component-select-list/component-select-list.d.ts.map +1 -0
- package/dist/common/component-select-list/component-select-list.js +29 -0
- package/dist/common/component-select-list/component-select-list.js.map +1 -0
- package/dist/common/constants.d.ts +19 -0
- package/dist/common/constants.d.ts.map +1 -0
- package/dist/common/constants.js +21 -0
- package/dist/common/constants.js.map +1 -0
- package/dist/common/context/form-context.d.ts +21 -0
- package/dist/common/context/form-context.d.ts.map +1 -0
- package/dist/common/context/form-context.js +28 -0
- package/dist/common/context/form-context.js.map +1 -0
- package/dist/common/context/index.d.ts +2 -0
- package/dist/common/context/index.d.ts.map +1 -0
- package/dist/common/context/index.js +2 -0
- package/dist/common/context/index.js.map +1 -0
- package/dist/common/datepicker/datepicker.d.ts +31 -0
- package/dist/common/datepicker/datepicker.d.ts.map +1 -0
- package/dist/common/datepicker/datepicker.js +70 -0
- package/dist/common/datepicker/datepicker.js.map +1 -0
- package/dist/common/dropzone/dropzone.d.ts +19 -0
- package/dist/common/dropzone/dropzone.d.ts.map +1 -0
- package/dist/common/dropzone/dropzone.js +101 -0
- package/dist/common/dropzone/dropzone.js.map +1 -0
- package/dist/common/form/form.d.ts +11 -0
- package/dist/common/form/form.d.ts.map +1 -0
- package/dist/common/form/form.js +46 -0
- package/dist/common/form/form.js.map +1 -0
- package/dist/common/form-page/form-page.d.ts +12 -0
- package/dist/common/form-page/form-page.d.ts.map +1 -0
- package/dist/common/form-page/form-page.js +18 -0
- package/dist/common/form-page/form-page.js.map +1 -0
- package/dist/common/grid/column.d.ts +24 -0
- package/dist/common/grid/column.d.ts.map +1 -0
- package/dist/common/grid/column.js +22 -0
- package/dist/common/grid/column.js.map +1 -0
- package/dist/common/grid/grid.d.ts +18 -0
- package/dist/common/grid/grid.d.ts.map +1 -0
- package/dist/common/grid/grid.js +31 -0
- package/dist/common/grid/grid.js.map +1 -0
- package/dist/common/grid/row.d.ts +22 -0
- package/dist/common/grid/row.d.ts.map +1 -0
- package/dist/common/grid/row.js +236 -0
- package/dist/common/grid/row.js.map +1 -0
- package/dist/common/heading/heading.d.ts +9 -0
- package/dist/common/heading/heading.d.ts.map +1 -0
- package/dist/common/heading/heading.js +14 -0
- package/dist/common/heading/heading.js.map +1 -0
- package/dist/common/html-raw/html-raw.d.ts +15 -0
- package/dist/common/html-raw/html-raw.d.ts.map +1 -0
- package/dist/common/html-raw/html-raw.js +22 -0
- package/dist/common/html-raw/html-raw.js.map +1 -0
- package/dist/common/icon/icon.d.ts +8 -0
- package/dist/common/icon/icon.d.ts.map +1 -0
- package/dist/common/icon/icon.js +11 -0
- package/dist/common/icon/icon.js.map +1 -0
- package/dist/common/if/if.d.ts +27 -0
- package/dist/common/if/if.d.ts.map +1 -0
- package/dist/common/if/if.js +52 -0
- package/dist/common/if/if.js.map +1 -0
- package/dist/common/image/image.d.ts +15 -0
- package/dist/common/image/image.d.ts.map +1 -0
- package/dist/common/image/image.js +21 -0
- package/dist/common/image/image.js.map +1 -0
- package/dist/common/index.d.ts +43 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +41 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/input/input.d.ts +20 -0
- package/dist/common/input/input.d.ts.map +1 -0
- package/dist/common/input/input.js +45 -0
- package/dist/common/input/input.js.map +1 -0
- package/dist/common/label/label.d.ts +21 -0
- package/dist/common/label/label.d.ts.map +1 -0
- package/dist/common/label/label.js +28 -0
- package/dist/common/label/label.js.map +1 -0
- package/dist/common/markdown/markdown.d.ts +17 -0
- package/dist/common/markdown/markdown.d.ts.map +1 -0
- package/dist/common/markdown/markdown.js +186 -0
- package/dist/common/markdown/markdown.js.map +1 -0
- package/dist/common/modal/modal.d.ts +15 -0
- package/dist/common/modal/modal.d.ts.map +1 -0
- package/dist/common/modal/modal.js +19 -0
- package/dist/common/modal/modal.js.map +1 -0
- package/dist/common/overlay/overlay.d.ts +16 -0
- package/dist/common/overlay/overlay.d.ts.map +1 -0
- package/dist/common/overlay/overlay.js +31 -0
- package/dist/common/overlay/overlay.js.map +1 -0
- package/dist/common/paragraph/paragraph.d.ts +9 -0
- package/dist/common/paragraph/paragraph.d.ts.map +1 -0
- package/dist/common/paragraph/paragraph.js +10 -0
- package/dist/common/paragraph/paragraph.js.map +1 -0
- package/dist/common/progress-bar/progress-bar.d.ts +17 -0
- package/dist/common/progress-bar/progress-bar.d.ts.map +1 -0
- package/dist/common/progress-bar/progress-bar.js +23 -0
- package/dist/common/progress-bar/progress-bar.js.map +1 -0
- package/dist/common/radio-group/radio-group.d.ts +21 -0
- package/dist/common/radio-group/radio-group.d.ts.map +1 -0
- package/dist/common/radio-group/radio-group.js +28 -0
- package/dist/common/radio-group/radio-group.js.map +1 -0
- package/dist/common/select/select.d.ts +31 -0
- package/dist/common/select/select.d.ts.map +1 -0
- package/dist/common/select/select.js +105 -0
- package/dist/common/select/select.js.map +1 -0
- package/dist/common/slider/slider.d.ts +29 -0
- package/dist/common/slider/slider.d.ts.map +1 -0
- package/dist/common/slider/slider.js +38 -0
- package/dist/common/slider/slider.js.map +1 -0
- package/dist/common/spacer/spacer.d.ts +10 -0
- package/dist/common/spacer/spacer.d.ts.map +1 -0
- package/dist/common/spacer/spacer.js +30 -0
- package/dist/common/spacer/spacer.js.map +1 -0
- package/dist/common/stack/stack.d.ts +14 -0
- package/dist/common/stack/stack.d.ts.map +1 -0
- package/dist/common/stack/stack.js +49 -0
- package/dist/common/stack/stack.js.map +1 -0
- package/dist/common/switch/switch.d.ts +14 -0
- package/dist/common/switch/switch.d.ts.map +1 -0
- package/dist/common/switch/switch.js +30 -0
- package/dist/common/switch/switch.js.map +1 -0
- package/dist/common/tabbed-card/tabbed-card.d.ts +24 -0
- package/dist/common/tabbed-card/tabbed-card.d.ts.map +1 -0
- package/dist/common/tabbed-card/tabbed-card.js +61 -0
- package/dist/common/tabbed-card/tabbed-card.js.map +1 -0
- package/dist/common/table/cells/adaptive-precision-cell.d.ts +9 -0
- package/dist/common/table/cells/adaptive-precision-cell.d.ts.map +1 -0
- package/dist/common/table/cells/adaptive-precision-cell.js +30 -0
- package/dist/common/table/cells/adaptive-precision-cell.js.map +1 -0
- package/dist/common/table/cells/badge-formatter-cell.d.ts +19 -0
- package/dist/common/table/cells/badge-formatter-cell.d.ts.map +1 -0
- package/dist/common/table/cells/badge-formatter-cell.js +16 -0
- package/dist/common/table/cells/badge-formatter-cell.js.map +1 -0
- package/dist/common/table/cells/code-cell.d.ts +12 -0
- package/dist/common/table/cells/code-cell.d.ts.map +1 -0
- package/dist/common/table/cells/code-cell.js +19 -0
- package/dist/common/table/cells/code-cell.js.map +1 -0
- package/dist/common/table/cells/compare-cell.d.ts +13 -0
- package/dist/common/table/cells/compare-cell.d.ts.map +1 -0
- package/dist/common/table/cells/compare-cell.js +34 -0
- package/dist/common/table/cells/compare-cell.js.map +1 -0
- package/dist/common/table/cells/formatted-text-cell.d.ts +9 -0
- package/dist/common/table/cells/formatted-text-cell.d.ts.map +1 -0
- package/dist/common/table/cells/formatted-text-cell.js +15 -0
- package/dist/common/table/cells/formatted-text-cell.js.map +1 -0
- package/dist/common/table/cells/index.d.ts +11 -0
- package/dist/common/table/cells/index.d.ts.map +1 -0
- package/dist/common/table/cells/index.js +11 -0
- package/dist/common/table/cells/index.js.map +1 -0
- package/dist/common/table/cells/link-cell.d.ts +10 -0
- package/dist/common/table/cells/link-cell.d.ts.map +1 -0
- package/dist/common/table/cells/link-cell.js +15 -0
- package/dist/common/table/cells/link-cell.js.map +1 -0
- package/dist/common/table/cells/number-cell.d.ts +11 -0
- package/dist/common/table/cells/number-cell.d.ts.map +1 -0
- package/dist/common/table/cells/number-cell.js +16 -0
- package/dist/common/table/cells/number-cell.js.map +1 -0
- package/dist/common/table/cells/number-intl-cell.d.ts +11 -0
- package/dist/common/table/cells/number-intl-cell.d.ts.map +1 -0
- package/dist/common/table/cells/number-intl-cell.js +16 -0
- package/dist/common/table/cells/number-intl-cell.js.map +1 -0
- package/dist/common/table/cells/percentage-cell.d.ts +11 -0
- package/dist/common/table/cells/percentage-cell.d.ts.map +1 -0
- package/dist/common/table/cells/percentage-cell.js +16 -0
- package/dist/common/table/cells/percentage-cell.js.map +1 -0
- package/dist/common/table/cells/threshold-formatted-cell.d.ts +15 -0
- package/dist/common/table/cells/threshold-formatted-cell.d.ts.map +1 -0
- package/dist/common/table/cells/threshold-formatted-cell.js +20 -0
- package/dist/common/table/cells/threshold-formatted-cell.js.map +1 -0
- package/dist/common/table/table.d.ts +56 -0
- package/dist/common/table/table.d.ts.map +1 -0
- package/dist/common/table/table.js +404 -0
- package/dist/common/table/table.js.map +1 -0
- package/dist/common/text/text.d.ts +12 -0
- package/dist/common/text/text.d.ts.map +1 -0
- package/dist/common/text/text.js +23 -0
- package/dist/common/text/text.js.map +1 -0
- package/dist/common/textarea/textarea.d.ts +19 -0
- package/dist/common/textarea/textarea.d.ts.map +1 -0
- package/dist/common/textarea/textarea.js +42 -0
- package/dist/common/textarea/textarea.js.map +1 -0
- package/dist/common/tooltip/tooltip.d.ts +18 -0
- package/dist/common/tooltip/tooltip.d.ts.map +1 -0
- package/dist/common/tooltip/tooltip.js +18 -0
- package/dist/common/tooltip/tooltip.js.map +1 -0
- package/dist/common/types.d.ts +26 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/types.js +9 -0
- package/dist/common/types.js.map +1 -0
- package/dist/dara_components-1.0.0a1-py3-none-any.whl +0 -0
- package/dist/graphs/causal-graph-viewer.d.ts +50 -0
- package/dist/graphs/causal-graph-viewer.d.ts.map +1 -0
- package/dist/graphs/causal-graph-viewer.js +32 -0
- package/dist/graphs/causal-graph-viewer.js.map +1 -0
- package/dist/graphs/graph-layout.d.ts +60 -0
- package/dist/graphs/graph-layout.d.ts.map +1 -0
- package/dist/graphs/graph-layout.js +110 -0
- package/dist/graphs/graph-layout.js.map +1 -0
- package/dist/graphs/index.d.ts +4 -0
- package/dist/graphs/index.d.ts.map +1 -0
- package/dist/graphs/index.js +4 -0
- package/dist/graphs/index.js.map +1 -0
- package/dist/graphs/node-hierarchy-builder.d.ts +24 -0
- package/dist/graphs/node-hierarchy-builder.d.ts.map +1 -0
- package/dist/graphs/node-hierarchy-builder.js +40 -0
- package/dist/graphs/node-hierarchy-builder.js.map +1 -0
- package/dist/graphs/visual-edge-encoder.d.ts +32 -0
- package/dist/graphs/visual-edge-encoder.d.ts.map +1 -0
- package/dist/graphs/visual-edge-encoder.js +84 -0
- package/dist/graphs/visual-edge-encoder.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/plotting/bokeh/bokeh.d.ts +28 -0
- package/dist/plotting/bokeh/bokeh.d.ts.map +1 -0
- package/dist/plotting/bokeh/bokeh.js +125 -0
- package/dist/plotting/bokeh/bokeh.js.map +1 -0
- package/dist/plotting/index.d.ts +4 -0
- package/dist/plotting/index.d.ts.map +1 -0
- package/dist/plotting/index.js +5 -0
- package/dist/plotting/index.js.map +1 -0
- package/dist/plotting/matplotlib/matplotlib.d.ts +12 -0
- package/dist/plotting/matplotlib/matplotlib.d.ts.map +1 -0
- package/dist/plotting/matplotlib/matplotlib.js +14 -0
- package/dist/plotting/matplotlib/matplotlib.js.map +1 -0
- package/dist/plotting/plotly/plotly.d.ts +60 -0
- package/dist/plotting/plotly/plotly.d.ts.map +1 -0
- package/dist/plotting/plotly/plotly.js +233 -0
- package/dist/plotting/plotly/plotly.js.map +1 -0
- package/dist/smart/code-editor.d.ts +11 -0
- package/dist/smart/code-editor.d.ts.map +1 -0
- package/dist/smart/code-editor.js +15 -0
- package/dist/smart/code-editor.js.map +1 -0
- package/dist/smart/data-slicer-filter/data-slicer-filter.d.ts +47 -0
- package/dist/smart/data-slicer-filter/data-slicer-filter.d.ts.map +1 -0
- package/dist/smart/data-slicer-filter/data-slicer-filter.js +123 -0
- package/dist/smart/data-slicer-filter/data-slicer-filter.js.map +1 -0
- package/dist/smart/filter-status-button/filter-status-button.d.ts +14 -0
- package/dist/smart/filter-status-button/filter-status-button.d.ts.map +1 -0
- package/dist/smart/filter-status-button/filter-status-button.js +49 -0
- package/dist/smart/filter-status-button/filter-status-button.js.map +1 -0
- package/dist/smart/hierarchy-selector/hierarchy-selector.d.ts +23 -0
- package/dist/smart/hierarchy-selector/hierarchy-selector.d.ts.map +1 -0
- package/dist/smart/hierarchy-selector/hierarchy-selector.js +17 -0
- package/dist/smart/hierarchy-selector/hierarchy-selector.js.map +1 -0
- package/dist/smart/hierarchy-viewer/hierarchy-viewer.d.ts +16 -0
- package/dist/smart/hierarchy-viewer/hierarchy-viewer.d.ts.map +1 -0
- package/dist/smart/hierarchy-viewer/hierarchy-viewer.js +17 -0
- package/dist/smart/hierarchy-viewer/hierarchy-viewer.js.map +1 -0
- package/dist/smart/index.d.ts +6 -0
- package/dist/smart/index.d.ts.map +1 -0
- package/dist/smart/index.js +7 -0
- package/dist/smart/index.js.map +1 -0
- package/dist/umd/dara.components.umd.js +386628 -0
- package/dist/umd/style.css +745 -0
- package/package.json +87 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { useEffect, useId, useMemo, useState } from 'react';
|
|
12
|
+
import { DefaultFallback, injectCss, useAction, useComponentStyles } from '@darajs/core';
|
|
13
|
+
import styled from '@darajs/styled-components';
|
|
14
|
+
const BOKEH_LIBRARIES = [
|
|
15
|
+
'https://cdn.bokeh.org/bokeh/release/bokeh-{version}.min.js',
|
|
16
|
+
'https://cdn.bokeh.org/bokeh/release/bokeh-widgets-{version}.min.js',
|
|
17
|
+
'https://cdn.bokeh.org/bokeh/release/bokeh-tables-{version}.min.js',
|
|
18
|
+
'https://cdn.bokeh.org/bokeh/release/bokeh-api-{version}.min.js',
|
|
19
|
+
'https://cdn.bokeh.org/bokeh/release/bokeh-gl-{version}.min.js',
|
|
20
|
+
'https://cdn.bokeh.org/bokeh/release/bokeh-mathjax-{version}.min.js',
|
|
21
|
+
];
|
|
22
|
+
const BokehRoot = injectCss(styled.div `
|
|
23
|
+
display: flex;
|
|
24
|
+
flex: 1 1 auto;
|
|
25
|
+
`);
|
|
26
|
+
const createEventName = (baseEventName, figId) => `BOKEH_FIGURE_${baseEventName}_${figId}`;
|
|
27
|
+
/* eslint-disable no-underscore-dangle */
|
|
28
|
+
/**
|
|
29
|
+
* A component for displaying a serialized Bokeh Document. Takes a Bokeh Document that has been serialized
|
|
30
|
+
* to a JSON string.
|
|
31
|
+
*
|
|
32
|
+
* @param {BokehProps} props - the component props
|
|
33
|
+
*/
|
|
34
|
+
function Bokeh(props) {
|
|
35
|
+
const [style, css] = useComponentStyles(props);
|
|
36
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
37
|
+
const docJson = useMemo(() => JSON.parse(props.document), [props.document]);
|
|
38
|
+
const rootId = useMemo(() => docJson.roots[0].id, [docJson]);
|
|
39
|
+
const id = useId();
|
|
40
|
+
const events = [];
|
|
41
|
+
const eventActions = [];
|
|
42
|
+
if (props.events) {
|
|
43
|
+
for (let i = 0; i < props.events.length; i++) {
|
|
44
|
+
const [name, action] = props.events[i];
|
|
45
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
46
|
+
eventActions.push([name, useAction(action)]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Wait for Bokeh to be available on window
|
|
51
|
+
*/
|
|
52
|
+
function waitForBokeh() {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return new Promise((resolve) => {
|
|
55
|
+
const interval = setInterval(() => {
|
|
56
|
+
if (window.Bokeh) {
|
|
57
|
+
clearInterval(interval);
|
|
58
|
+
resolve();
|
|
59
|
+
}
|
|
60
|
+
}, 100);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function loadBokehLibrary(url, version) {
|
|
65
|
+
const script = document.createElement('script');
|
|
66
|
+
script.src = url.replace('{version}', version);
|
|
67
|
+
script.async = true;
|
|
68
|
+
document.head.appendChild(script);
|
|
69
|
+
}
|
|
70
|
+
function initializeBokeh() {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const bokehVersion = docJson.version;
|
|
73
|
+
// if it's already loading, wait for it to be available
|
|
74
|
+
if (window.bokehLoading) {
|
|
75
|
+
yield waitForBokeh();
|
|
76
|
+
}
|
|
77
|
+
else if (!window.Bokeh) {
|
|
78
|
+
// otherwise, load it
|
|
79
|
+
const [core, ...libraries] = BOKEH_LIBRARIES;
|
|
80
|
+
// Core needs to be loaded before all the other libraries
|
|
81
|
+
loadBokehLibrary(core, bokehVersion);
|
|
82
|
+
yield waitForBokeh();
|
|
83
|
+
libraries.forEach((url) => {
|
|
84
|
+
loadBokehLibrary(url, bokehVersion);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
events.forEach(([ev, handler]) => {
|
|
88
|
+
document.removeEventListener(ev, handler);
|
|
89
|
+
});
|
|
90
|
+
eventActions.forEach(([name, [action]]) => {
|
|
91
|
+
const handler = (e) => {
|
|
92
|
+
action(e.detail);
|
|
93
|
+
};
|
|
94
|
+
const evtName = createEventName(name, docJson.roots[0].id);
|
|
95
|
+
document.addEventListener(evtName, handler);
|
|
96
|
+
events.push([evtName, handler]);
|
|
97
|
+
});
|
|
98
|
+
if (docJson) {
|
|
99
|
+
window.Bokeh.embed.embed_item({
|
|
100
|
+
doc: docJson,
|
|
101
|
+
root_id: rootId,
|
|
102
|
+
target_id: id,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
setIsLoading(false);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
initializeBokeh();
|
|
110
|
+
return () => {
|
|
111
|
+
const index = window.Bokeh.documents.findIndex((doc) => doc.roots()[0].id === docJson.roots[0].id);
|
|
112
|
+
if (index > -1) {
|
|
113
|
+
const doc = window.Bokeh.documents[index];
|
|
114
|
+
doc.clear();
|
|
115
|
+
window.Bokeh.documents.splice(index, 1);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}, [docJson]);
|
|
119
|
+
return (_jsx(BokehRoot, { "$rawCss": css, "data-root-id": rootId, id: id, style: style, children: isLoading && (_jsx(DefaultFallback, { style: {
|
|
120
|
+
display: 'flex',
|
|
121
|
+
flex: '1 1 auto',
|
|
122
|
+
} })) }));
|
|
123
|
+
}
|
|
124
|
+
export default Bokeh;
|
|
125
|
+
//# sourceMappingURL=bokeh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bokeh.js","sourceRoot":"","sources":["../../../js/plotting/bokeh/bokeh.tsx"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAU,eAAe,EAAwB,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAE/C,MAAM,eAAe,GAAG;IACpB,4DAA4D;IAC5D,oEAAoE;IACpE,mEAAmE;IACnE,gEAAgE;IAChE,+DAA+D;IAC/D,oEAAoE;CACvE,CAAC;AAEF,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,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AAC,CAAC,CAAC;aAC3C;QACL,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,CACH,KAAC,SAAS,eAAU,GAAG,kBAAgB,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,YAC9D,SAAS,IAAI,CACV,KAAC,eAAe,IACZ,KAAK,EAAE;gBACH,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,UAAU;aACnB,GACH,CACL,GACO,CACf,CAAC;AACN,CAAC;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../js/plotting/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../js/plotting/index.tsx"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StyledComponentProps } from '@darajs/core';
|
|
2
|
+
interface MatplotlibProps extends StyledComponentProps {
|
|
3
|
+
figure: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A component for displaying an image of Matplotlib or Seaborn plot.
|
|
7
|
+
*
|
|
8
|
+
* @param {MatplotlibProps} props - the component props
|
|
9
|
+
*/
|
|
10
|
+
declare function Matplotlib(props: MatplotlibProps): JSX.Element;
|
|
11
|
+
export default Matplotlib;
|
|
12
|
+
//# sourceMappingURL=matplotlib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matplotlib.d.ts","sourceRoot":"","sources":["../../../js/plotting/matplotlib/matplotlib.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAiC,MAAM,cAAc,CAAC;AAEnF,UAAU,eAAgB,SAAQ,oBAAoB;IAClD,MAAM,EAAE,MAAM,CAAC;CAClB;AAID;;;;GAIG;AACH,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAUvD;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { injectCss, useComponentStyles } from '@darajs/core';
|
|
3
|
+
const StyledImg = injectCss('img');
|
|
4
|
+
/**
|
|
5
|
+
* A component for displaying an image of Matplotlib or Seaborn plot.
|
|
6
|
+
*
|
|
7
|
+
* @param {MatplotlibProps} props - the component props
|
|
8
|
+
*/
|
|
9
|
+
function Matplotlib(props) {
|
|
10
|
+
const [style, css] = useComponentStyles(props);
|
|
11
|
+
return (_jsx(StyledImg, { "$rawCss": css, alt: "Matplotlib graph", src: `data:image/svg+xml;base64,${props.figure}`, style: style }));
|
|
12
|
+
}
|
|
13
|
+
export default Matplotlib;
|
|
14
|
+
//# sourceMappingURL=matplotlib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matplotlib.js","sourceRoot":"","sources":["../../../js/plotting/matplotlib/matplotlib.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAwB,SAAS,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAMnF,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AAEnC;;;;GAIG;AACH,SAAS,UAAU,CAAC,KAAsB;IACtC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,CACH,KAAC,SAAS,eACG,GAAG,EACZ,GAAG,EAAC,kBAAkB,EACtB,GAAG,EAAE,6BAA6B,KAAK,CAAC,MAAM,EAAE,EAChD,KAAK,EAAE,KAAK,GACd,CACL,CAAC;AACN,CAAC;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Action, StyledComponentProps } from '@darajs/core';
|
|
2
|
+
/**
|
|
3
|
+
* Names defined by plotly.js, this is what Python will send us
|
|
4
|
+
*/
|
|
5
|
+
declare enum PlotlyEventName {
|
|
6
|
+
AfterExport = "plotly_afterexport",
|
|
7
|
+
AfterPlot = "plotly_afterplot",
|
|
8
|
+
Animated = "plotly_animated",
|
|
9
|
+
AnimatingFrame = "plotly_animatingframe",
|
|
10
|
+
AnimationInterrupted = "plotly_animationinterrupted",
|
|
11
|
+
AutoSize = "plotly_autosize",
|
|
12
|
+
BeforeExport = "plotly_beforeexport",
|
|
13
|
+
BeforeHover = "plotly_beforehover",
|
|
14
|
+
ButtonClicked = "plotly_buttonclicked",
|
|
15
|
+
Click = "plotly_click",
|
|
16
|
+
ClickAnnotation = "plotly_clickannotation",
|
|
17
|
+
Deselect = "plotly_deselect",
|
|
18
|
+
DoubleClick = "plotly_doubleclick",
|
|
19
|
+
Framework = "plotly_framework",
|
|
20
|
+
Hover = "plotly_hover",
|
|
21
|
+
LegendClick = "plotly_legendclick",
|
|
22
|
+
LegendDoubleClick = "plotly_legenddoubleclick",
|
|
23
|
+
Redraw = "plotly_redraw",
|
|
24
|
+
Relayout = "plotly_relayout",
|
|
25
|
+
Restyle = "plotly_restyle",
|
|
26
|
+
Selected = "plotly_selected",
|
|
27
|
+
Selecting = "plotly_selecting",
|
|
28
|
+
SliderChange = "plotly_sliderchange",
|
|
29
|
+
SliderEnd = "plotly_sliderend",
|
|
30
|
+
SliderStart = "plotly_sliderstart",
|
|
31
|
+
TransitionInterrupted = "plotly_transitioninterrupted",
|
|
32
|
+
Transitioning = "plotly_transitioning",
|
|
33
|
+
Unhover = "plotly_unhover",
|
|
34
|
+
WebglContextLost = "plotly_webglcontextlost"
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Event object as passed from Python
|
|
38
|
+
*/
|
|
39
|
+
interface Event {
|
|
40
|
+
actions: Array<Action>;
|
|
41
|
+
custom_js: string;
|
|
42
|
+
event_name: PlotlyEventName;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Props for the Plotly component
|
|
46
|
+
*/
|
|
47
|
+
interface PlotlyProps extends StyledComponentProps {
|
|
48
|
+
/** An array of event objects */
|
|
49
|
+
events?: Array<Event>;
|
|
50
|
+
/** A string containing the JSON object of figure properties */
|
|
51
|
+
figure: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A component for displaying Plotly graphs
|
|
55
|
+
*
|
|
56
|
+
* @param {PlotlyProps} props - the component props
|
|
57
|
+
*/
|
|
58
|
+
declare function Plotly(props: PlotlyProps): JSX.Element;
|
|
59
|
+
export default Plotly;
|
|
60
|
+
//# sourceMappingURL=plotly.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plotly.d.ts","sourceRoot":"","sources":["../../../js/plotting/plotly/plotly.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAA4C,MAAM,cAAc,CAAC;AAEtG;;GAEG;AACH,aAAK,eAAe;IAChB,WAAW,uBAAuB;IAClC,SAAS,qBAAqB;IAC9B,QAAQ,oBAAoB;IAC5B,cAAc,0BAA0B;IACxC,oBAAoB,gCAAgC;IACpD,QAAQ,oBAAoB;IAC5B,YAAY,wBAAwB;IACpC,WAAW,uBAAuB;IAClC,aAAa,yBAAyB;IACtC,KAAK,iBAAiB;IACtB,eAAe,2BAA2B;IAC1C,QAAQ,oBAAoB;IAC5B,WAAW,uBAAuB;IAClC,SAAS,qBAAqB;IAC9B,KAAK,iBAAiB;IACtB,WAAW,uBAAuB;IAClC,iBAAiB,6BAA6B;IAC9C,MAAM,kBAAkB;IACxB,QAAQ,oBAAoB;IAC5B,OAAO,mBAAmB;IAC1B,QAAQ,oBAAoB;IAC5B,SAAS,qBAAqB;IAC9B,YAAY,wBAAwB;IACpC,SAAS,qBAAqB;IAC9B,WAAW,uBAAuB;IAClC,qBAAqB,iCAAiC;IACtD,aAAa,yBAAyB;IACtC,OAAO,mBAAmB;IAC1B,gBAAgB,4BAA4B;CAC/C;AA8DD;;GAEG;AACH,UAAU,KAAK;IACX,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,eAAe,CAAC;CAC/B;AAED;;GAEG;AACH,UAAU,WAAY,SAAQ,oBAAoB;IAC9C,gCAAgC;IAChC,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACtB,+DAA+D;IAC/D,MAAM,EAAE,MAAM,CAAC;CAClB;AA6JD;;;;GAIG;AACH,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAyC/C;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import Plot from 'react-plotly.js';
|
|
4
|
+
import { injectCss, useAction, useComponentStyles } from '@darajs/core';
|
|
5
|
+
/**
|
|
6
|
+
* Names defined by plotly.js, this is what Python will send us
|
|
7
|
+
*/
|
|
8
|
+
var PlotlyEventName;
|
|
9
|
+
(function (PlotlyEventName) {
|
|
10
|
+
PlotlyEventName["AfterExport"] = "plotly_afterexport";
|
|
11
|
+
PlotlyEventName["AfterPlot"] = "plotly_afterplot";
|
|
12
|
+
PlotlyEventName["Animated"] = "plotly_animated";
|
|
13
|
+
PlotlyEventName["AnimatingFrame"] = "plotly_animatingframe";
|
|
14
|
+
PlotlyEventName["AnimationInterrupted"] = "plotly_animationinterrupted";
|
|
15
|
+
PlotlyEventName["AutoSize"] = "plotly_autosize";
|
|
16
|
+
PlotlyEventName["BeforeExport"] = "plotly_beforeexport";
|
|
17
|
+
PlotlyEventName["BeforeHover"] = "plotly_beforehover";
|
|
18
|
+
PlotlyEventName["ButtonClicked"] = "plotly_buttonclicked";
|
|
19
|
+
PlotlyEventName["Click"] = "plotly_click";
|
|
20
|
+
PlotlyEventName["ClickAnnotation"] = "plotly_clickannotation";
|
|
21
|
+
PlotlyEventName["Deselect"] = "plotly_deselect";
|
|
22
|
+
PlotlyEventName["DoubleClick"] = "plotly_doubleclick";
|
|
23
|
+
PlotlyEventName["Framework"] = "plotly_framework";
|
|
24
|
+
PlotlyEventName["Hover"] = "plotly_hover";
|
|
25
|
+
PlotlyEventName["LegendClick"] = "plotly_legendclick";
|
|
26
|
+
PlotlyEventName["LegendDoubleClick"] = "plotly_legenddoubleclick";
|
|
27
|
+
PlotlyEventName["Redraw"] = "plotly_redraw";
|
|
28
|
+
PlotlyEventName["Relayout"] = "plotly_relayout";
|
|
29
|
+
PlotlyEventName["Restyle"] = "plotly_restyle";
|
|
30
|
+
PlotlyEventName["Selected"] = "plotly_selected";
|
|
31
|
+
PlotlyEventName["Selecting"] = "plotly_selecting";
|
|
32
|
+
PlotlyEventName["SliderChange"] = "plotly_sliderchange";
|
|
33
|
+
PlotlyEventName["SliderEnd"] = "plotly_sliderend";
|
|
34
|
+
PlotlyEventName["SliderStart"] = "plotly_sliderstart";
|
|
35
|
+
PlotlyEventName["TransitionInterrupted"] = "plotly_transitioninterrupted";
|
|
36
|
+
PlotlyEventName["Transitioning"] = "plotly_transitioning";
|
|
37
|
+
PlotlyEventName["Unhover"] = "plotly_unhover";
|
|
38
|
+
PlotlyEventName["WebglContextLost"] = "plotly_webglcontextlost";
|
|
39
|
+
})(PlotlyEventName || (PlotlyEventName = {}));
|
|
40
|
+
/**
|
|
41
|
+
* eventHandlersMap maps the plotly.js event names to the names we need for Plot component props
|
|
42
|
+
*/
|
|
43
|
+
const eventHandlersMap = {
|
|
44
|
+
[PlotlyEventName.Click]: 'onClick',
|
|
45
|
+
[PlotlyEventName.Hover]: 'onHover',
|
|
46
|
+
[PlotlyEventName.Selecting]: 'onSelecting',
|
|
47
|
+
[PlotlyEventName.Selected]: 'onSelected',
|
|
48
|
+
[PlotlyEventName.Unhover]: 'onUnhover',
|
|
49
|
+
[PlotlyEventName.SliderChange]: 'onSliderChange',
|
|
50
|
+
[PlotlyEventName.AnimationInterrupted]: 'onAnimationInterrupted',
|
|
51
|
+
[PlotlyEventName.AnimatingFrame]: 'onAnimatingFrame',
|
|
52
|
+
[PlotlyEventName.Animated]: 'onAnimated',
|
|
53
|
+
[PlotlyEventName.BeforeHover]: 'onBeforeHover',
|
|
54
|
+
[PlotlyEventName.ButtonClicked]: 'onButtonClicked',
|
|
55
|
+
[PlotlyEventName.ClickAnnotation]: 'onClickAnnotation',
|
|
56
|
+
[PlotlyEventName.Deselect]: 'onDeselect',
|
|
57
|
+
[PlotlyEventName.DoubleClick]: 'onDoubleClick',
|
|
58
|
+
[PlotlyEventName.Framework]: 'onFramework',
|
|
59
|
+
[PlotlyEventName.LegendClick]: 'onLegendClick',
|
|
60
|
+
[PlotlyEventName.LegendDoubleClick]: 'onLegendDoubleClick',
|
|
61
|
+
[PlotlyEventName.Redraw]: 'onRedraw',
|
|
62
|
+
[PlotlyEventName.Relayout]: 'onRelayout',
|
|
63
|
+
[PlotlyEventName.Restyle]: 'onRestyle',
|
|
64
|
+
[PlotlyEventName.TransitionInterrupted]: 'onTransitionInterrupted',
|
|
65
|
+
[PlotlyEventName.Transitioning]: 'onTransitioning',
|
|
66
|
+
[PlotlyEventName.WebglContextLost]: 'onWebGlContextLost',
|
|
67
|
+
[PlotlyEventName.SliderEnd]: 'onSliderEnd',
|
|
68
|
+
[PlotlyEventName.SliderStart]: 'onSliderStart',
|
|
69
|
+
[PlotlyEventName.BeforeExport]: 'onBeforeExport',
|
|
70
|
+
[PlotlyEventName.AfterExport]: 'onAfterExport',
|
|
71
|
+
[PlotlyEventName.AfterPlot]: 'onAfterPlot',
|
|
72
|
+
[PlotlyEventName.AutoSize]: 'onAutoSize',
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* Filters the event data received from plotly to remove large objects that cause JSON stringify circular structure errors.
|
|
77
|
+
* Taken and adapted from https://github.com/plotly/dash/blob/dev/components/dash-core-components/src/fragments/Graph.react.js#L55
|
|
78
|
+
*
|
|
79
|
+
* @param figure - the plotly figure
|
|
80
|
+
* @param eventData - the data from the event
|
|
81
|
+
* @param event - the name of the event
|
|
82
|
+
* @returns - the filtered event data
|
|
83
|
+
*/
|
|
84
|
+
function filterEventData(figure, eventData, event) {
|
|
85
|
+
var _a;
|
|
86
|
+
let filteredEventData;
|
|
87
|
+
if ([PlotlyEventName.Click, PlotlyEventName.Hover, PlotlyEventName.Selected].includes(event)) {
|
|
88
|
+
const points = [];
|
|
89
|
+
const pointEventData = eventData;
|
|
90
|
+
if (!pointEventData) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
/*
|
|
94
|
+
* remove `data`, `layout`, `xaxis`, etc
|
|
95
|
+
* objects from the event data since they're so big
|
|
96
|
+
* and cause JSON stringify ciricular structure errors.
|
|
97
|
+
*
|
|
98
|
+
* also, pull down the `customdata` point from the data array
|
|
99
|
+
* into the event object
|
|
100
|
+
*/
|
|
101
|
+
const { data } = figure;
|
|
102
|
+
for (let i = 0; i < pointEventData.points.length; i++) {
|
|
103
|
+
const fullPoint = pointEventData.points[i];
|
|
104
|
+
const pointData = Object.fromEntries(Object.entries(fullPoint).filter(([, value]) => {
|
|
105
|
+
return typeof value !== 'object' && !Array.isArray(value);
|
|
106
|
+
}));
|
|
107
|
+
// permit a bounding box to pass through, if present
|
|
108
|
+
if ('bbox' in fullPoint) {
|
|
109
|
+
pointData.bbox = fullPoint.bbox;
|
|
110
|
+
}
|
|
111
|
+
if ((fullPoint === null || fullPoint === void 0 ? void 0 : fullPoint.curveNumber) && ((_a = data[pointData.curveNumber]) === null || _a === void 0 ? void 0 : _a.customdata)) {
|
|
112
|
+
if (fullPoint.pointNumber) {
|
|
113
|
+
if (typeof fullPoint.pointNumber === 'number') {
|
|
114
|
+
pointData.customdata = data[pointData.curveNumber].customdata[fullPoint.pointNumber];
|
|
115
|
+
}
|
|
116
|
+
else if (!fullPoint.pointNumber && fullPoint.data.mode.includes('lines')) {
|
|
117
|
+
pointData.customdata = data[pointData.curveNumber].customdata;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else if ('pointNumbers' in fullPoint) {
|
|
121
|
+
pointData.customdata = fullPoint.pointNumbers.map((point) => {
|
|
122
|
+
return data[pointData.curveNumber].customdata[point];
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// specific to histogram. see https://github.com/plotly/plotly.js/pull/2113/
|
|
127
|
+
if ('pointNumbers' in fullPoint) {
|
|
128
|
+
pointData.pointNumbers = fullPoint.pointNumbers;
|
|
129
|
+
}
|
|
130
|
+
points[i] = pointData;
|
|
131
|
+
}
|
|
132
|
+
filteredEventData = { points };
|
|
133
|
+
}
|
|
134
|
+
else if (event === PlotlyEventName.Relayout || event === PlotlyEventName.Restyle) {
|
|
135
|
+
/*
|
|
136
|
+
* relayout shouldn't include any big objects
|
|
137
|
+
* it will usually just contain the ranges of the axes like
|
|
138
|
+
* "xaxis.range[0]": 0.7715822247381828,
|
|
139
|
+
* "xaxis.range[1]": 3.0095292008680063`
|
|
140
|
+
*/
|
|
141
|
+
filteredEventData = eventData;
|
|
142
|
+
}
|
|
143
|
+
if ('range' in eventData) {
|
|
144
|
+
filteredEventData.range = eventData.range;
|
|
145
|
+
}
|
|
146
|
+
if ('lassoPoints' in eventData) {
|
|
147
|
+
filteredEventData.lassoPoints = eventData.lassoPoints;
|
|
148
|
+
}
|
|
149
|
+
return filteredEventData;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
*
|
|
153
|
+
* Executes the custom js for a given event
|
|
154
|
+
*
|
|
155
|
+
* @param customJs - the custom js string to execute
|
|
156
|
+
* @param eventData - the data from the event
|
|
157
|
+
* @param figure - the plotly figure
|
|
158
|
+
* @returns - the new figure obtained by the customJS function
|
|
159
|
+
*/
|
|
160
|
+
function executeCustomJs(customJs, eventData, figure) {
|
|
161
|
+
// function running under eval is not run underst strict mode, therefore we need to prepend it
|
|
162
|
+
const customJsFunction = `
|
|
163
|
+
return (function(data, figure) {
|
|
164
|
+
'use strict';
|
|
165
|
+
${customJs}
|
|
166
|
+
return figure;
|
|
167
|
+
})(data, figure);
|
|
168
|
+
`;
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
|
|
170
|
+
const userFunction = new Function('data', 'figure', customJsFunction);
|
|
171
|
+
const newFigure = userFunction(eventData, figure);
|
|
172
|
+
return newFigure;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
*
|
|
176
|
+
* For a given event type executes if defined the Dara actions and custom js. It will also update the figure object based on the custom js function.
|
|
177
|
+
*
|
|
178
|
+
* @param eventType - the name of the event
|
|
179
|
+
* @param eventData - the data from the event
|
|
180
|
+
* @param eventActions - the actions to execute
|
|
181
|
+
* @param figure - the plotly figure
|
|
182
|
+
* @param setFigure - the function to update the figure
|
|
183
|
+
*/
|
|
184
|
+
function handleEvent(eventType, eventData, eventActions, figure, setFigure) {
|
|
185
|
+
eventActions === null || eventActions === void 0 ? void 0 : eventActions.forEach((eventAction) => {
|
|
186
|
+
if (eventAction === null || eventAction === void 0 ? void 0 : eventAction.handler) {
|
|
187
|
+
const filteredData = filterEventData(figure, eventData, eventType);
|
|
188
|
+
eventAction.handler(filteredData.points);
|
|
189
|
+
}
|
|
190
|
+
if (eventAction === null || eventAction === void 0 ? void 0 : eventAction.custom_js) {
|
|
191
|
+
const newFigure = executeCustomJs(eventAction.custom_js, eventData, figure);
|
|
192
|
+
setFigure(newFigure);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
const StyledPlotly = injectCss(Plot);
|
|
197
|
+
/* eslint-disable no-underscore-dangle */
|
|
198
|
+
/**
|
|
199
|
+
* A component for displaying Plotly graphs
|
|
200
|
+
*
|
|
201
|
+
* @param {PlotlyProps} props - the component props
|
|
202
|
+
*/
|
|
203
|
+
function Plotly(props) {
|
|
204
|
+
const [style, css] = useComponentStyles(props);
|
|
205
|
+
const [figure, setFigure] = useState(() => JSON.parse(props.figure));
|
|
206
|
+
const eventActions = new Map();
|
|
207
|
+
if (props.events) {
|
|
208
|
+
props.events.forEach((event) => {
|
|
209
|
+
var _a;
|
|
210
|
+
const actions = new Array();
|
|
211
|
+
event === null || event === void 0 ? void 0 : event.actions.forEach((action) => {
|
|
212
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
213
|
+
const [actionHandler] = useAction(action);
|
|
214
|
+
actions.push({ custom_js: event.custom_js, handler: actionHandler });
|
|
215
|
+
});
|
|
216
|
+
const currentActions = (_a = eventActions.get(event.event_name)) !== null && _a !== void 0 ? _a : [];
|
|
217
|
+
eventActions.set(event.event_name, [...currentActions, ...actions]);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
// add an event handler for each Plot event, e.g. onClick, onHover, etc
|
|
221
|
+
const eventHandlers = Object.keys(eventHandlersMap).reduce((acc, key) => {
|
|
222
|
+
const eventHandlerName = eventHandlersMap[key];
|
|
223
|
+
const eventHandler = (e) => {
|
|
224
|
+
handleEvent(key, e, eventActions.get(key), figure, setFigure);
|
|
225
|
+
};
|
|
226
|
+
// we are casting to any here because there is an issue with union vs intersection of types
|
|
227
|
+
acc[eventHandlerName] = eventHandler;
|
|
228
|
+
return acc;
|
|
229
|
+
}, {});
|
|
230
|
+
return (_jsx(StyledPlotly, Object.assign({ "$rawCss": css, config: { responsive: true }, data: figure.data, frames: figure.frames, layout: figure.layout }, eventHandlers, { style: Object.assign({ display: 'flex', flex: '1 1 auto', flexDirection: 'column', width: '100%' }, style), useResizeHandler: true })));
|
|
231
|
+
}
|
|
232
|
+
export default Plotly;
|
|
233
|
+
//# sourceMappingURL=plotly.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plotly.js","sourceRoot":"","sources":["../../../js/plotting/plotly/plotly.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,IAAoB,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAgC,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEtG;;GAEG;AACH,IAAK,eA8BJ;AA9BD,WAAK,eAAe;IAChB,qDAAkC,CAAA;IAClC,iDAA8B,CAAA;IAC9B,+CAA4B,CAAA;IAC5B,2DAAwC,CAAA;IACxC,uEAAoD,CAAA;IACpD,+CAA4B,CAAA;IAC5B,uDAAoC,CAAA;IACpC,qDAAkC,CAAA;IAClC,yDAAsC,CAAA;IACtC,yCAAsB,CAAA;IACtB,6DAA0C,CAAA;IAC1C,+CAA4B,CAAA;IAC5B,qDAAkC,CAAA;IAClC,iDAA8B,CAAA;IAC9B,yCAAsB,CAAA;IACtB,qDAAkC,CAAA;IAClC,iEAA8C,CAAA;IAC9C,2CAAwB,CAAA;IACxB,+CAA4B,CAAA;IAC5B,6CAA0B,CAAA;IAC1B,+CAA4B,CAAA;IAC5B,iDAA8B,CAAA;IAC9B,uDAAoC,CAAA;IACpC,iDAA8B,CAAA;IAC9B,qDAAkC,CAAA;IAClC,yEAAsD,CAAA;IACtD,yDAAsC,CAAA;IACtC,6CAA0B,CAAA;IAC1B,+DAA4C,CAAA;AAChD,CAAC,EA9BI,eAAe,KAAf,eAAe,QA8BnB;AAED;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACrB,CAAC,eAAe,C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AE,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QAClE,CAAC,CAAC;QACF,2FAA2F;QAC3F,GAAG,CAAC,gBAAgB,CAAC,GAAG,YAAmB,CAAC;QAC5C,OAAO,GAAG,CAAC;IACf,CAAC,EAAE,EAAwB,CAAC,CAAC;IAE7B,OAAO,CACH,KAAC,YAAY,6BACA,GAAG,EACZ,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAC5B,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,IACjB,aAAa,IACjB,KAAK,kBAAI,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,IAAK,KAAK,GAC5F,gBAAgB,UAClB,CACL,CAAC;AACN,CAAC;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StyledComponentProps, Variable } from '@darajs/core';
|
|
2
|
+
interface CodeEditorProps extends StyledComponentProps {
|
|
3
|
+
script: Variable<string>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A component that creates a CodeEditor. The script is stored in a variable and is updated
|
|
7
|
+
* as user types in the code editor area.
|
|
8
|
+
*/
|
|
9
|
+
declare function CodeEditor(props: CodeEditorProps): JSX.Element;
|
|
10
|
+
export default CodeEditor;
|
|
11
|
+
//# sourceMappingURL=code-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-editor.d.ts","sourceRoot":"","sources":["../../js/smart/code-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAA8C,MAAM,cAAc,CAAC;AAG1G,UAAU,eAAgB,SAAQ,oBAAoB;IAClD,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC5B;AAID;;;GAGG;AACH,iBAAS,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAKvD;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { injectCss, useComponentStyles, useVariable } from '@darajs/core';
|
|
3
|
+
import { CodeEditor as UICodeEditor } from '@darajs/ui-code-editor';
|
|
4
|
+
const StyledCodeEditor = injectCss(UICodeEditor);
|
|
5
|
+
/**
|
|
6
|
+
* A component that creates a CodeEditor. The script is stored in a variable and is updated
|
|
7
|
+
* as user types in the code editor area.
|
|
8
|
+
*/
|
|
9
|
+
function CodeEditor(props) {
|
|
10
|
+
const [style, css] = useComponentStyles(props);
|
|
11
|
+
const [script, setScript] = useVariable(props.script);
|
|
12
|
+
return _jsx(StyledCodeEditor, { "$rawCss": css, initialScript: script, onChange: setScript, style: style });
|
|
13
|
+
}
|
|
14
|
+
export default CodeEditor;
|
|
15
|
+
//# sourceMappingURL=code-editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-editor.js","sourceRoot":"","sources":["../../js/smart/code-editor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkC,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1G,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAMpE,MAAM,gBAAgB,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AAEjD;;;GAGG;AACH,SAAS,UAAU,CAAC,KAAsB;IACtC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEtD,OAAO,KAAC,gBAAgB,eAAU,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC;AACxG,CAAC;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Variable } from '@darajs/core';
|
|
2
|
+
declare enum ColumnType {
|
|
3
|
+
CATEGORICAL = "categorical",
|
|
4
|
+
DATETIME = "datetime",
|
|
5
|
+
NUMERICAL = "numerical"
|
|
6
|
+
}
|
|
7
|
+
interface Column {
|
|
8
|
+
name: string;
|
|
9
|
+
type: ColumnType;
|
|
10
|
+
}
|
|
11
|
+
interface FilterInstance {
|
|
12
|
+
/**
|
|
13
|
+
* Used internally to uniquely identify filters - prevents us from having to rely on indexes
|
|
14
|
+
*/
|
|
15
|
+
__id: string;
|
|
16
|
+
column: string;
|
|
17
|
+
from_date: string;
|
|
18
|
+
range: string;
|
|
19
|
+
to_date: string;
|
|
20
|
+
values: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parse a date value into a date
|
|
24
|
+
*
|
|
25
|
+
* @param date date to parse
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseDateString(date: string | Date): Date;
|
|
28
|
+
interface DataSlicerFilterProps {
|
|
29
|
+
/**
|
|
30
|
+
* List of available columns
|
|
31
|
+
*/
|
|
32
|
+
columns: Variable<Column[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Variable holding a list of filters
|
|
35
|
+
*/
|
|
36
|
+
filters: Variable<FilterInstance[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Height of the filter component
|
|
39
|
+
*/
|
|
40
|
+
height: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* DataSlicerFilter displays an editable list of filters to apply to a dataset
|
|
44
|
+
*/
|
|
45
|
+
declare function DataSlicerFilter(props: DataSlicerFilterProps): JSX.Element;
|
|
46
|
+
export default DataSlicerFilter;
|
|
47
|
+
//# sourceMappingURL=data-slicer-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-slicer-filter.d.ts","sourceRoot":"","sources":["../../../js/smart/data-slicer-filter/data-slicer-filter.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAe,MAAM,cAAc,CAAC;AAKrD,aAAK,UAAU;IACX,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;IACrB,SAAS,cAAc;CAC1B;AAED,UAAU,MAAM;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;CACpB;AAED,UAAU,cAAc;IACpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAClB;AAsDD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAYzD;AAED,UAAU,qBAAqB;IAC3B;;OAEG;IACH,OAAO,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5B;;OAEG;IACH,OAAO,EAAE,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC;IACpC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAClB;AAID;;GAEG;AACH,iBAAS,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CAgHnE;AAED,eAAe,gBAAgB,CAAC"}
|