buckaroo-js-core 0.8.5 → 0.14.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 +24 -12
- package/README.md +55 -51
- package/dist/index.cjs.js +114 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.es.js +61171 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.esm.js +61171 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/jest.setup.d.ts +0 -0
- package/dist/src/SampleComponent.d.ts +10 -0
- package/{buckaroo_js → dist/src}/baked_data/colorMap.d.ts +0 -1
- package/dist/src/baked_data/olympic-winners.d.ts +12 -0
- package/dist/src/components/BuckarooInfiniteWidget.flash.test.d.ts +1 -0
- package/dist/src/components/BuckarooStaticTable.d.ts +26 -0
- package/dist/src/components/BuckarooWidgetInfinite.d.ts +40 -0
- package/{buckaroo_js → dist/src}/components/ColumnsEditor.d.ts +5 -8
- package/{buckaroo_js → dist/src}/components/CommandUtils.d.ts +9 -5
- package/dist/src/components/DCFCell.d.ts +19 -0
- package/dist/src/components/DFViewerParts/ChartCell.d.ts +43 -0
- package/dist/src/components/DFViewerParts/ChartCell.hooks.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/DFViewerConfigs.d.ts +5 -0
- package/dist/src/components/DFViewerParts/DFViewerDataHelper.d.ts +20 -0
- package/dist/src/components/DFViewerParts/DFViewerInfinite.d.ts +47 -0
- package/dist/src/components/DFViewerParts/DFViewerInfinite.flash.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/DFViewerInfinite.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/DFWhole.d.ts +176 -0
- package/{buckaroo_js → dist/src}/components/DFViewerParts/Displayer.d.ts +20 -5
- package/dist/src/components/DFViewerParts/HistogramCell.d.ts +29 -0
- package/dist/src/components/DFViewerParts/HistogramCell.hooks.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/OtherRenderers.d.ts +9 -0
- package/dist/src/components/DFViewerParts/RowCache.d.ts +61 -0
- package/dist/src/components/DFViewerParts/RowCache.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/RowStore.d.ts +22 -0
- package/dist/src/components/DFViewerParts/RowStore.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/RowStoreGc.d.ts +22 -0
- package/dist/src/components/DFViewerParts/RowStoreGc.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/SeriesSummaryTooltip.d.ts +13 -0
- package/dist/src/components/DFViewerParts/SmartRowCache.d.ts +83 -0
- package/dist/src/components/DFViewerParts/SmartRowCache.test.d.ts +23 -0
- package/dist/src/components/DFViewerParts/Styler.d.ts +33 -0
- package/dist/src/components/DFViewerParts/TableInfinite.d.ts +10 -0
- package/dist/src/components/DFViewerParts/ViewRegistry.d.ts +21 -0
- package/dist/src/components/DFViewerParts/ViewRegistry.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/Views.d.ts +53 -0
- package/dist/src/components/DFViewerParts/Views.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/autocleaning.toggle.integration.test.d.ts +27 -0
- package/dist/src/components/DFViewerParts/gridUtils.d.ts +81 -0
- package/dist/src/components/DFViewerParts/gridUtils.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/highlight.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/resolveDFData.d.ts +29 -0
- package/dist/src/components/DFViewerParts/resolveDFData.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/xorqWindow.dom.test.d.ts +1 -0
- package/dist/src/components/DFViewerParts/xorqWindow.test.d.ts +1 -0
- package/{buckaroo_js → dist/src}/components/DependentTabs.d.ts +8 -13
- package/dist/src/components/MessageBox.d.ts +8 -0
- package/{buckaroo_js → dist/src}/components/OperationDetail.d.ts +4 -6
- package/dist/src/components/OperationExamples.d.ts +8 -0
- package/{buckaroo_js → dist/src}/components/OperationUtils.d.ts +1 -1
- package/dist/src/components/Operations.d.ts +14 -0
- package/dist/src/components/Operations.test.d.ts +4 -0
- package/dist/src/components/OperationsList.d.ts +9 -0
- package/dist/src/components/OperationsList.test.d.ts +0 -0
- package/dist/src/components/StatusBar.d.ts +15 -0
- package/{buckaroo_js → dist/src}/components/WidgetTypes.d.ts +3 -4
- package/dist/src/components/useColorScheme.d.ts +7 -0
- package/dist/src/components/utils.d.ts +299 -0
- package/dist/src/index.d.ts +64 -0
- package/dist/src/server/BuckarooServerView.d.ts +52 -0
- package/dist/src/server/BuckarooServerView.test.d.ts +1 -0
- package/dist/src/server/WebSocketModel.d.ts +31 -0
- package/dist/src/stories/BuckarooWidgetTest.stories.d.ts +12 -0
- package/dist/src/stories/ChartCell.stories.d.ts +20 -0
- package/dist/src/stories/ColumnsEditor.stories.d.ts +17 -0
- package/dist/src/stories/DFViewer.stories.d.ts +26 -0
- package/dist/src/stories/DFViewerInfiniteRaw.stories.d.ts +24 -0
- package/dist/src/stories/DFViewerInfiniteShadow.stories.d.ts +31 -0
- package/dist/src/stories/HistogramCell.stories.d.ts +18 -0
- package/dist/src/stories/InheritEdgeCases.stories.d.ts +12 -0
- package/dist/src/stories/InheritPinnedRows.stories.d.ts +13 -0
- package/dist/src/stories/MessageBox.stories.d.ts +26 -0
- package/dist/src/stories/OperationViewer.stories.d.ts +24 -0
- package/dist/src/stories/OperationsList.stories.d.ts +19 -0
- package/dist/src/stories/OutsideParamsInconsistency.stories.d.ts +16 -0
- package/dist/src/stories/PinnedRowsDynamic.stories.d.ts +12 -0
- package/dist/src/stories/PinnedRowsRace.stories.d.ts +12 -0
- package/dist/src/stories/PinnedRowsTranscriptReplayer.stories.d.ts +13 -0
- package/dist/src/stories/RawAGGrid.stories.d.ts +17 -0
- package/dist/src/stories/SmallDFScroll.stories.d.ts +11 -0
- package/dist/src/stories/StatusBar.stories.d.ts +19 -0
- package/dist/src/stories/StoryUtils.d.ts +13 -0
- package/dist/src/stories/Styling.stories.d.ts +15 -0
- package/dist/src/stories/StylingIssues.stories.d.ts +54 -0
- package/dist/src/stories/ThemeCustomization.stories.d.ts +22 -0
- package/dist/src/stories/UseMemoExamples.stories.d.ts +12 -0
- package/dist/src/stories/WeirdTypes.stories.d.ts +17 -0
- package/dist/src/test-utils/agGridSpy.d.ts +53 -0
- package/dist/src/widgetUtils.d.ts +1 -0
- package/dist/style.css +1 -0
- package/package.json +109 -98
- package/.prettierrc +0 -16
- package/CHANGELOG.md +0 -23
- package/buckaroo_js/baked_data/colorMap.d.ts.map +0 -1
- package/buckaroo_js/baked_data/colorMap.js +0 -520
- package/buckaroo_js/baked_data/colorMap.js.map +0 -1
- package/buckaroo_js/baked_data/staticData.d.ts +0 -124
- package/buckaroo_js/baked_data/staticData.d.ts.map +0 -1
- package/buckaroo_js/baked_data/staticData.js +0 -459
- package/buckaroo_js/baked_data/staticData.js.map +0 -1
- package/buckaroo_js/components/ColumnsEditor.d.ts.map +0 -1
- package/buckaroo_js/components/ColumnsEditor.js +0 -68
- package/buckaroo_js/components/ColumnsEditor.js.map +0 -1
- package/buckaroo_js/components/CommandUtils.d.ts.map +0 -1
- package/buckaroo_js/components/CommandUtils.js +0 -17
- package/buckaroo_js/components/CommandUtils.js.map +0 -1
- package/buckaroo_js/components/DCFCell.d.ts +0 -28
- package/buckaroo_js/components/DCFCell.d.ts.map +0 -1
- package/buckaroo_js/components/DCFCell.js +0 -120
- package/buckaroo_js/components/DCFCell.js.map +0 -1
- package/buckaroo_js/components/DFViewerParts/DFViewer.d.ts +0 -29
- package/buckaroo_js/components/DFViewerParts/DFViewer.d.ts.map +0 -1
- package/buckaroo_js/components/DFViewerParts/DFViewer.js +0 -163
- package/buckaroo_js/components/DFViewerParts/DFViewer.js.map +0 -1
- package/buckaroo_js/components/DFViewerParts/DFWhole.d.ts +0 -111
- package/buckaroo_js/components/DFViewerParts/DFWhole.d.ts.map +0 -1
- package/buckaroo_js/components/DFViewerParts/DFWhole.js +0 -17
- package/buckaroo_js/components/DFViewerParts/DFWhole.js.map +0 -1
- package/buckaroo_js/components/DFViewerParts/Displayer.d.ts.map +0 -1
- package/buckaroo_js/components/DFViewerParts/Displayer.js +0 -220
- package/buckaroo_js/components/DFViewerParts/Displayer.js.map +0 -1
- package/buckaroo_js/components/DFViewerParts/HistogramCell.d.ts +0 -20
- package/buckaroo_js/components/DFViewerParts/HistogramCell.d.ts.map +0 -1
- package/buckaroo_js/components/DFViewerParts/HistogramCell.js +0 -184
- package/buckaroo_js/components/DFViewerParts/HistogramCell.js.map +0 -1
- package/buckaroo_js/components/DFViewerParts/OtherRenderers.d.ts +0 -7
- package/buckaroo_js/components/DFViewerParts/OtherRenderers.d.ts.map +0 -1
- package/buckaroo_js/components/DFViewerParts/OtherRenderers.js +0 -29
- package/buckaroo_js/components/DFViewerParts/OtherRenderers.js.map +0 -1
- package/buckaroo_js/components/DFViewerParts/SeriesSummaryTooltip.d.ts +0 -5
- package/buckaroo_js/components/DFViewerParts/SeriesSummaryTooltip.d.ts.map +0 -1
- package/buckaroo_js/components/DFViewerParts/SeriesSummaryTooltip.js +0 -18
- package/buckaroo_js/components/DFViewerParts/SeriesSummaryTooltip.js.map +0 -1
- package/buckaroo_js/components/DFViewerParts/gridUtils.d.ts +0 -24
- package/buckaroo_js/components/DFViewerParts/gridUtils.d.ts.map +0 -1
- package/buckaroo_js/components/DFViewerParts/gridUtils.js +0 -230
- package/buckaroo_js/components/DFViewerParts/gridUtils.js.map +0 -1
- package/buckaroo_js/components/DependentTabs.d.ts.map +0 -1
- package/buckaroo_js/components/DependentTabs.js +0 -108
- package/buckaroo_js/components/DependentTabs.js.map +0 -1
- package/buckaroo_js/components/OperationDetail.d.ts.map +0 -1
- package/buckaroo_js/components/OperationDetail.js +0 -144
- package/buckaroo_js/components/OperationDetail.js.map +0 -1
- package/buckaroo_js/components/OperationUtils.d.ts.map +0 -1
- package/buckaroo_js/components/OperationUtils.js +0 -14
- package/buckaroo_js/components/OperationUtils.js.map +0 -1
- package/buckaroo_js/components/Operations.d.ts +0 -24
- package/buckaroo_js/components/Operations.d.ts.map +0 -1
- package/buckaroo_js/components/Operations.js +0 -209
- package/buckaroo_js/components/Operations.js.map +0 -1
- package/buckaroo_js/components/StatusBar.d.ts +0 -12
- package/buckaroo_js/components/StatusBar.d.ts.map +0 -1
- package/buckaroo_js/components/StatusBar.js +0 -155
- package/buckaroo_js/components/StatusBar.js.map +0 -1
- package/buckaroo_js/components/WidgetTypes.d.ts.map +0 -1
- package/buckaroo_js/components/WidgetTypes.js +0 -3
- package/buckaroo_js/components/WidgetTypes.js.map +0 -1
- package/buckaroo_js/components/bakedOperationDefaults.d.ts +0 -5
- package/buckaroo_js/components/bakedOperationDefaults.d.ts.map +0 -1
- package/buckaroo_js/components/bakedOperationDefaults.js +0 -15
- package/buckaroo_js/components/bakedOperationDefaults.js.map +0 -1
- package/buckaroo_js/components/utils.d.ts +0 -294
- package/buckaroo_js/components/utils.d.ts.map +0 -1
- package/buckaroo_js/components/utils.js +0 -143
- package/buckaroo_js/components/utils.js.map +0 -1
- package/buckaroo_js/extension.d.ts +0 -2
- package/buckaroo_js/extension.d.ts.map +0 -1
- package/buckaroo_js/extension.js +0 -20
- package/buckaroo_js/extension.js.map +0 -1
- package/buckaroo_js/index.d.ts +0 -24
- package/buckaroo_js/index.d.ts.map +0 -1
- package/buckaroo_js/index.js +0 -44
- package/buckaroo_js/index.js.map +0 -1
- package/buckaroo_js/vendor/RechartExtra.d.ts +0 -38
- package/buckaroo_js/vendor/RechartExtra.d.ts.map +0 -1
- package/buckaroo_js/vendor/RechartExtra.js +0 -17
- package/buckaroo_js/vendor/RechartExtra.js.map +0 -1
- package/buckaroo_js/vendor/RechartTooltip.d.ts +0 -82
- package/buckaroo_js/vendor/RechartTooltip.d.ts.map +0 -1
- package/buckaroo_js/vendor/RechartTooltip.js +0 -231
- package/buckaroo_js/vendor/RechartTooltip.js.map +0 -1
- package/codecov.yml +0 -16
- package/eslint.config.mjs +0 -88
- package/examples/App.tsx +0 -160
- package/examples/CodeBlock.tsx +0 -27
- package/examples/CodePenButton.tsx +0 -72
- package/examples/ReadmeBlock.tsx +0 -11
- package/examples/app.css +0 -29
- package/examples/ex/ColumnsEditorEx.tsx +0 -5
- package/examples/ex/CommandViewerEx.tsx +0 -18
- package/examples/ex/DFViewerEx.tsx +0 -3
- package/examples/ex/DFViewerEx_large.tsx +0 -266
- package/examples/ex/DFViewerEx_real_summary.tsx +0 -18
- package/examples/ex/DFViewerEx_short_data.tsx +0 -22
- package/examples/ex/DFViewerEx_string_index.tsx +0 -1012
- package/examples/ex/HistogramEx.tsx +0 -41
- package/examples/ex/StatusBarEx.tsx +0 -46
- package/examples/ex/WidgetDCFCellEx.tsx +0 -6
- package/examples/example.css +0 -20
- package/examples/index-iframe.hnottml +0 -24
- package/examples/index-react18.tsx +0 -8
- package/examples/index.html +0 -20
- package/examples/jsx-loader.ts +0 -16
- package/examples/tsconfig.json +0 -31
- package/index.d.ts +0 -2
- package/index.d.ts.map +0 -1
- package/index.js +0 -7
- package/index.js.map +0 -1
- package/jest.config.js +0 -24
- package/screen-animation.gif +0 -0
- package/src/buckaroo_js/baked_data/colorMap.ts +0 -523
- package/src/buckaroo_js/baked_data/staticData.ts +0 -503
- package/src/buckaroo_js/components/ColumnsEditor.tsx +0 -66
- package/src/buckaroo_js/components/CommandUtils.ts +0 -40
- package/src/buckaroo_js/components/DCFCell.tsx +0 -175
- package/src/buckaroo_js/components/DFViewerParts/DFViewer.tsx +0 -215
- package/src/buckaroo_js/components/DFViewerParts/DFWhole.ts +0 -190
- package/src/buckaroo_js/components/DFViewerParts/Displayer.ts +0 -218
- package/src/buckaroo_js/components/DFViewerParts/OtherRenderers.tsx +0 -28
- package/src/buckaroo_js/components/DFViewerParts/SeriesSummaryTooltip.tsx +0 -20
- package/src/buckaroo_js/components/DFViewerParts/gridUtils.ts +0 -291
- package/src/buckaroo_js/components/DependentTabs.tsx +0 -134
- package/src/buckaroo_js/components/OperationDetail.tsx +0 -203
- package/src/buckaroo_js/components/OperationUtils.ts +0 -33
- package/src/buckaroo_js/components/Operations.tsx +0 -243
- package/src/buckaroo_js/components/StatusBar.tsx +0 -190
- package/src/buckaroo_js/components/WidgetTypes.tsx +0 -42
- package/src/buckaroo_js/components/bakedOperationDefaults.ts +0 -14
- package/src/buckaroo_js/components/utils.ts +0 -60
- package/src/buckaroo_js/extension.ts +0 -15
- package/src/buckaroo_js/index.ts +0 -32
- package/src/buckaroo_js/style/dcf-npm.css +0 -244
- package/src/buckaroo_js/style/icons/arrow-down-short-dark.svg +0 -4
- package/src/buckaroo_js/style/icons/arrow-down-short.svg +0 -4
- package/src/buckaroo_js/style/icons/arrow-up-short-dark.svg +0 -4
- package/src/buckaroo_js/style/icons/arrow-up-short.svg +0 -4
- package/src/buckaroo_js/style/icons/filter-dark.svg +0 -3
- package/src/buckaroo_js/style/icons/filter.svg +0 -3
- package/src/index.tsx +0 -3
- package/tsconfig.json +0 -41
- package/webpack.config.ts +0 -98
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import React, {useState, Dispatch, SetStateAction} from 'react';
|
|
2
|
-
import _ from 'lodash';
|
|
3
|
-
import {OperationResult, baseOperationResults} from './DependentTabs';
|
|
4
|
-
import {ColumnsEditor} from './ColumnsEditor';
|
|
5
|
-
import {
|
|
6
|
-
dfviewer_config_no_pinned,
|
|
7
|
-
realSummaryConfig,
|
|
8
|
-
realSummaryTableData,
|
|
9
|
-
summaryDfForTableDf,
|
|
10
|
-
tableDf
|
|
11
|
-
} from '../baked_data/staticData';
|
|
12
|
-
import {DFData, DFViewerConfig} from './DFViewerParts/DFWhole';
|
|
13
|
-
import {DFViewer} from './DFViewerParts/DFViewer';
|
|
14
|
-
import {StatusBar} from './StatusBar';
|
|
15
|
-
import {BuckarooState} from './WidgetTypes';
|
|
16
|
-
import {BuckarooOptions} from './WidgetTypes';
|
|
17
|
-
import {DFMeta} from './WidgetTypes';
|
|
18
|
-
import {CommandConfigT} from './CommandUtils';
|
|
19
|
-
import {bakedCommandConfig} from './bakedOperationDefaults';
|
|
20
|
-
import {Operation, bakedOperations} from './OperationUtils';
|
|
21
|
-
|
|
22
|
-
export type CommandConfigSetterT = (setter: Dispatch<SetStateAction<CommandConfigT>>) => void;
|
|
23
|
-
|
|
24
|
-
/*
|
|
25
|
-
Widget DCFCell is meant to be used with callback functions and passed values, not explicit http calls
|
|
26
|
-
|
|
27
|
-
TODO:add height settings to dfConfig rather than hardcoded.
|
|
28
|
-
*/
|
|
29
|
-
export interface IDisplayArgs {
|
|
30
|
-
data_key: string;
|
|
31
|
-
df_viewer_config: DFViewerConfig;
|
|
32
|
-
summary_stats_key: string;
|
|
33
|
-
}
|
|
34
|
-
export function WidgetDCFCell({
|
|
35
|
-
df_data_dict,
|
|
36
|
-
df_display_args,
|
|
37
|
-
df_meta,
|
|
38
|
-
operations,
|
|
39
|
-
on_operations,
|
|
40
|
-
operation_results,
|
|
41
|
-
commandConfig,
|
|
42
|
-
buckaroo_state,
|
|
43
|
-
on_buckaroo_state,
|
|
44
|
-
buckaroo_options
|
|
45
|
-
}: {
|
|
46
|
-
df_meta: DFMeta;
|
|
47
|
-
df_data_dict: Record<string, DFData>;
|
|
48
|
-
df_display_args: Record<string, IDisplayArgs>;
|
|
49
|
-
operations: Operation[];
|
|
50
|
-
on_operations: (ops: Operation[]) => void;
|
|
51
|
-
operation_results: OperationResult;
|
|
52
|
-
commandConfig: CommandConfigT;
|
|
53
|
-
buckaroo_state: BuckarooState;
|
|
54
|
-
on_buckaroo_state: React.Dispatch<React.SetStateAction<BuckarooState>>;
|
|
55
|
-
buckaroo_options: BuckarooOptions;
|
|
56
|
-
}) {
|
|
57
|
-
const [activeCol, setActiveCol] = useState('stoptime');
|
|
58
|
-
|
|
59
|
-
const cDisp = df_display_args[buckaroo_state.df_display];
|
|
60
|
-
if (cDisp === undefined) {
|
|
61
|
-
console.log('cDisp undefined', buckaroo_state.df_display, buckaroo_options.df_display);
|
|
62
|
-
} else {
|
|
63
|
-
// console.log("cDisp", cDisp);
|
|
64
|
-
}
|
|
65
|
-
const dfData = df_data_dict[cDisp.data_key];
|
|
66
|
-
//console.log("dfData", dfData);
|
|
67
|
-
const summaryStatsData = df_data_dict[cDisp.summary_stats_key];
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<div className='dcf-root flex flex-col' style={{width: '100%', height: '100%'}}>
|
|
71
|
-
<div
|
|
72
|
-
className='orig-df flex flex-row'
|
|
73
|
-
style={{
|
|
74
|
-
// height: '450px',
|
|
75
|
-
overflow: 'hidden'
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
78
|
-
<StatusBar
|
|
79
|
-
dfMeta={df_meta}
|
|
80
|
-
buckarooState={buckaroo_state}
|
|
81
|
-
setBuckarooState={on_buckaroo_state}
|
|
82
|
-
buckarooOptions={buckaroo_options}
|
|
83
|
-
/>
|
|
84
|
-
<DFViewer
|
|
85
|
-
df_data={dfData}
|
|
86
|
-
df_viewer_config={cDisp.df_viewer_config}
|
|
87
|
-
summary_stats_data={summaryStatsData}
|
|
88
|
-
activeCol={activeCol}
|
|
89
|
-
setActiveCol={setActiveCol}
|
|
90
|
-
/>
|
|
91
|
-
</div>
|
|
92
|
-
{buckaroo_state.show_commands ? (
|
|
93
|
-
<ColumnsEditor
|
|
94
|
-
df_viewer_config={cDisp.df_viewer_config}
|
|
95
|
-
activeColumn={activeCol}
|
|
96
|
-
operations={operations}
|
|
97
|
-
setOperations={on_operations}
|
|
98
|
-
operationResult={operation_results}
|
|
99
|
-
commandConfig={commandConfig}
|
|
100
|
-
/>
|
|
101
|
-
) : (
|
|
102
|
-
<span></span>
|
|
103
|
-
)}
|
|
104
|
-
</div>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function WidgetDCFCellExample() {
|
|
109
|
-
const dfm: DFMeta = {
|
|
110
|
-
columns: 5,
|
|
111
|
-
rows_shown: 20,
|
|
112
|
-
filtered_rows: 89,
|
|
113
|
-
total_rows: 877
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const [bState, setBState] = useState<BuckarooState>({
|
|
117
|
-
auto_clean: '',
|
|
118
|
-
sampled: false,
|
|
119
|
-
show_commands: false,
|
|
120
|
-
df_display: 'main',
|
|
121
|
-
post_processing: '',
|
|
122
|
-
quick_command_args: {}
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
const bOptions: BuckarooOptions = {
|
|
126
|
-
auto_clean: ['', 'aggressive', 'conservative'],
|
|
127
|
-
df_display: ['main', 'realSummary', 'no_pinned'],
|
|
128
|
-
sampled: ['random'],
|
|
129
|
-
post_processing: ['', 'foo', 'bar'],
|
|
130
|
-
show_commands: ['on']
|
|
131
|
-
// 'summary_stats' : ['full', 'all', 'typing_stats']
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const [operations, setOperations] = useState<Operation[]>(bakedOperations);
|
|
135
|
-
|
|
136
|
-
const bakedDfDisplay: Record<string, IDisplayArgs> = {
|
|
137
|
-
main: {
|
|
138
|
-
data_key: 'main',
|
|
139
|
-
df_viewer_config: tableDf.dfviewer_config,
|
|
140
|
-
summary_stats_key: 'all'
|
|
141
|
-
},
|
|
142
|
-
realSummary: {
|
|
143
|
-
data_key: 'empty',
|
|
144
|
-
df_viewer_config: realSummaryConfig,
|
|
145
|
-
summary_stats_key: 'real_summary'
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
no_pinned: {
|
|
149
|
-
data_key: 'main',
|
|
150
|
-
df_viewer_config: dfviewer_config_no_pinned,
|
|
151
|
-
summary_stats_key: 'all'
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const df_data_dict = {
|
|
156
|
-
main: tableDf.data,
|
|
157
|
-
all: summaryDfForTableDf,
|
|
158
|
-
real_summary: realSummaryTableData,
|
|
159
|
-
empty: [{index: 'distinct_count'}]
|
|
160
|
-
};
|
|
161
|
-
return (
|
|
162
|
-
<WidgetDCFCell
|
|
163
|
-
df_meta={dfm}
|
|
164
|
-
df_display_args={bakedDfDisplay}
|
|
165
|
-
df_data_dict={df_data_dict}
|
|
166
|
-
buckaroo_options={bOptions}
|
|
167
|
-
buckaroo_state={bState}
|
|
168
|
-
on_buckaroo_state={setBState}
|
|
169
|
-
commandConfig={bakedCommandConfig}
|
|
170
|
-
operations={operations}
|
|
171
|
-
on_operations={setOperations}
|
|
172
|
-
operation_results={baseOperationResults}
|
|
173
|
-
/>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import React, {useRef, CSSProperties, useState} from 'react';
|
|
2
|
-
import _ from 'lodash';
|
|
3
|
-
import {ComponentConfig, DFData, DFViewerConfig} from './DFWhole';
|
|
4
|
-
|
|
5
|
-
import {dfToAgrid, extractPinnedRows} from './gridUtils';
|
|
6
|
-
import {replaceAtMatch} from '../utils';
|
|
7
|
-
import {AgGridReact} from 'ag-grid-react'; // the AG Grid React Component
|
|
8
|
-
import {
|
|
9
|
-
DomLayoutType,
|
|
10
|
-
GridOptions,
|
|
11
|
-
SizeColumnsToContentStrategy,
|
|
12
|
-
SizeColumnsToFitProvidedWidthStrategy
|
|
13
|
-
} from 'ag-grid-community';
|
|
14
|
-
import {summaryDfForTableDf, tableDf} from '../../baked_data/staticData';
|
|
15
|
-
|
|
16
|
-
import {getCellRendererSelector} from './gridUtils';
|
|
17
|
-
|
|
18
|
-
export type setColumFunc = (newCol: string) => void;
|
|
19
|
-
|
|
20
|
-
export function DFViewer({
|
|
21
|
-
df_data: df,
|
|
22
|
-
df_viewer_config,
|
|
23
|
-
summary_stats_data,
|
|
24
|
-
style,
|
|
25
|
-
activeCol,
|
|
26
|
-
setActiveCol
|
|
27
|
-
}: {
|
|
28
|
-
df_data: DFData;
|
|
29
|
-
df_viewer_config: DFViewerConfig;
|
|
30
|
-
summary_stats_data?: DFData;
|
|
31
|
-
style?: CSSProperties;
|
|
32
|
-
activeCol?: string;
|
|
33
|
-
setActiveCol?: setColumFunc;
|
|
34
|
-
}) {
|
|
35
|
-
/* = {
|
|
36
|
-
df: EmptyDf.data,
|
|
37
|
-
df_viewer_config: EmptyDf.dfviewer_config,
|
|
38
|
-
summary_stats_data: [],
|
|
39
|
-
style: { height: '300px' },
|
|
40
|
-
setActiveCol: () => null,
|
|
41
|
-
}*/
|
|
42
|
-
//console.log("dfviewer df_viewer_config", df_viewer_config);
|
|
43
|
-
// console.log("summary_stats_data", summary_stats_data);
|
|
44
|
-
// console.log("full_object", {'df':df, 'df_viewer_config':df_viewer_config, 'summary_stats_data': summary_stats_data})
|
|
45
|
-
const [agColsPure, agData] = dfToAgrid(df, df_viewer_config, summary_stats_data || []);
|
|
46
|
-
|
|
47
|
-
const styledColumns = replaceAtMatch(_.clone(agColsPure), activeCol || '___never', {
|
|
48
|
-
cellStyle: {background: 'var(--ag-range-selection-background-color-3)'}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
const defaultColDef = {
|
|
52
|
-
sortable: true,
|
|
53
|
-
type: 'rightAligned',
|
|
54
|
-
cellRendererSelector: getCellRendererSelector(df_viewer_config.pinned_rows)
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const gridOptions: GridOptions = {
|
|
58
|
-
rowSelection: 'single',
|
|
59
|
-
|
|
60
|
-
enableCellTextSelection: true,
|
|
61
|
-
onRowClicked: (event) => {
|
|
62
|
-
// console.log('A row was clicked')
|
|
63
|
-
// console.log("event", event)
|
|
64
|
-
const sel = document.getSelection();
|
|
65
|
-
if (sel === null) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const range = document.createRange();
|
|
69
|
-
const el = event?.event?.target;
|
|
70
|
-
if (el === null || el === undefined) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
74
|
-
//@ts-ignore
|
|
75
|
-
range.selectNodeContents(el);
|
|
76
|
-
sel.removeAllRanges();
|
|
77
|
-
sel.addRange(range);
|
|
78
|
-
},
|
|
79
|
-
tooltipShowDelay: 0,
|
|
80
|
-
|
|
81
|
-
// defaultColDef needs to be specifically passed in as a prop to the component, not defined here,
|
|
82
|
-
// otherwise updates aren't reactive
|
|
83
|
-
|
|
84
|
-
onCellClicked: (event) => {
|
|
85
|
-
const colName = event.column.getColId();
|
|
86
|
-
if (setActiveCol === undefined || colName === undefined) {
|
|
87
|
-
return;
|
|
88
|
-
} else {
|
|
89
|
-
setActiveCol(colName);
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
...(df_viewer_config.extra_grid_config ? df_viewer_config.extra_grid_config : {})
|
|
93
|
-
};
|
|
94
|
-
const gridRef = useRef<AgGridReact<unknown>>(null);
|
|
95
|
-
const pinned_rows = df_viewer_config.pinned_rows;
|
|
96
|
-
const topRowData = summary_stats_data
|
|
97
|
-
? extractPinnedRows(summary_stats_data, pinned_rows ? pinned_rows : [])
|
|
98
|
-
: [];
|
|
99
|
-
|
|
100
|
-
const getAutoSize = ():
|
|
101
|
-
| SizeColumnsToFitProvidedWidthStrategy
|
|
102
|
-
| SizeColumnsToContentStrategy => {
|
|
103
|
-
if (styledColumns.length < 1) {
|
|
104
|
-
return {
|
|
105
|
-
type: 'fitProvidedWidth',
|
|
106
|
-
width: window.innerWidth - 100
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
type: 'fitCellContents'
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const hs = heightStyle({
|
|
115
|
-
numRows: agData.length,
|
|
116
|
-
pinnedRowLen: df_viewer_config.pinned_rows.length,
|
|
117
|
-
location: window.location,
|
|
118
|
-
compC: df_viewer_config?.component_config,
|
|
119
|
-
rowHeight: df_viewer_config?.extra_grid_config?.rowHeight
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<div className={`df-viewer ${hs.classMode} ${hs.inIframe}`}>
|
|
124
|
-
<div style={hs.applicableStyle} className='theme-hanger ag-theme-alpine-dark '>
|
|
125
|
-
<AgGridReact
|
|
126
|
-
ref={gridRef}
|
|
127
|
-
domLayout={hs.domLayout}
|
|
128
|
-
defaultColDef={defaultColDef}
|
|
129
|
-
gridOptions={gridOptions}
|
|
130
|
-
rowData={agData}
|
|
131
|
-
pinnedTopRowData={topRowData}
|
|
132
|
-
columnDefs={_.cloneDeep(styledColumns)}
|
|
133
|
-
autoSizeStrategy={getAutoSize()}
|
|
134
|
-
></AgGridReact>
|
|
135
|
-
</div>
|
|
136
|
-
</div>
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
interface HeightStyleArgs {
|
|
141
|
-
numRows: number;
|
|
142
|
-
pinnedRowLen: number;
|
|
143
|
-
readonly location: Location;
|
|
144
|
-
rowHeight?: number;
|
|
145
|
-
compC?: ComponentConfig;
|
|
146
|
-
}
|
|
147
|
-
interface HeightStyleI {
|
|
148
|
-
domLayout: DomLayoutType;
|
|
149
|
-
inIframe: string;
|
|
150
|
-
classMode: 'short-mode' | 'regular-mode';
|
|
151
|
-
applicableStyle: CSSProperties;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export const heightStyle = (hArgs: HeightStyleArgs): HeightStyleI => {
|
|
155
|
-
const {numRows, pinnedRowLen, location, rowHeight, compC} = hArgs;
|
|
156
|
-
const isGoogleColab = location.host.indexOf('colab.googleusercontent.com') !== -1;
|
|
157
|
-
|
|
158
|
-
const inIframe = window.parent !== window;
|
|
159
|
-
const regularCompHeight = window.innerHeight / (compC?.height_fraction || 2);
|
|
160
|
-
const dfvHeight = compC?.dfvHeight || regularCompHeight;
|
|
161
|
-
const regularDivStyle = {height: dfvHeight};
|
|
162
|
-
const shortDivStyle = {minHeight: 50, maxHeight: dfvHeight};
|
|
163
|
-
|
|
164
|
-
const belowMinRows = numRows + pinnedRowLen < 10;
|
|
165
|
-
|
|
166
|
-
const shortMode = compC?.shortMode || (belowMinRows && rowHeight === undefined);
|
|
167
|
-
console.log(
|
|
168
|
-
'shortMode',
|
|
169
|
-
shortMode,
|
|
170
|
-
'dfvHeight',
|
|
171
|
-
dfvHeight,
|
|
172
|
-
'isGoogleColab',
|
|
173
|
-
isGoogleColab,
|
|
174
|
-
'inIframe',
|
|
175
|
-
inIframe
|
|
176
|
-
);
|
|
177
|
-
const inIframeClass = inIframe ? 'inIframe' : '';
|
|
178
|
-
if (isGoogleColab || inIframe) {
|
|
179
|
-
return {
|
|
180
|
-
classMode: 'regular-mode',
|
|
181
|
-
domLayout: 'normal',
|
|
182
|
-
applicableStyle: {height: 500},
|
|
183
|
-
inIframe: inIframeClass
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
const domLayout: DomLayoutType = compC?.layoutType || (shortMode ? 'autoHeight' : 'normal');
|
|
187
|
-
const applicableStyle = shortMode ? shortDivStyle : regularDivStyle;
|
|
188
|
-
const classMode = shortMode ? 'short-mode' : 'regular-mode';
|
|
189
|
-
return {
|
|
190
|
-
classMode,
|
|
191
|
-
domLayout,
|
|
192
|
-
applicableStyle,
|
|
193
|
-
inIframe: inIframeClass
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
/*
|
|
197
|
-
ab = window.location.host;
|
|
198
|
-
"cskfus796ts-496ff2e9c6d22116-0-colab.googleusercontent.com"
|
|
199
|
-
bc = window.location.pathname
|
|
200
|
-
"/outputframe.html"
|
|
201
|
-
*/
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
export function DFViewerEx() {
|
|
205
|
-
const [activeCol, setActiveCol] = useState('tripduration');
|
|
206
|
-
return (
|
|
207
|
-
<DFViewer
|
|
208
|
-
df_data={tableDf.data}
|
|
209
|
-
df_viewer_config={tableDf.dfviewer_config}
|
|
210
|
-
summary_stats_data={summaryDfForTableDf}
|
|
211
|
-
activeCol={activeCol}
|
|
212
|
-
setActiveCol={setActiveCol}
|
|
213
|
-
/>
|
|
214
|
-
);
|
|
215
|
-
}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
// I'm not sure about adding underlying types too
|
|
2
|
-
|
|
3
|
-
import {ColDef, GridOptions} from 'ag-grid-community';
|
|
4
|
-
import _ from 'lodash';
|
|
5
|
-
|
|
6
|
-
type AGGrid_ColDef = ColDef;
|
|
7
|
-
|
|
8
|
-
export interface ObjDisplayerA {
|
|
9
|
-
displayer: 'obj';
|
|
10
|
-
max_length?: number;
|
|
11
|
-
}
|
|
12
|
-
export interface BooleanDisplayerA {
|
|
13
|
-
displayer: 'boolean';
|
|
14
|
-
}
|
|
15
|
-
export interface StringDisplayerA {
|
|
16
|
-
displayer: 'string';
|
|
17
|
-
max_length?: number;
|
|
18
|
-
}
|
|
19
|
-
export interface FloatDisplayerA {
|
|
20
|
-
displayer: 'float';
|
|
21
|
-
min_fraction_digits: number;
|
|
22
|
-
max_fraction_digits: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface DatetimeDefaultDisplayerA {
|
|
26
|
-
displayer: 'datetimeDefault';
|
|
27
|
-
}
|
|
28
|
-
export interface IntegerDisplayerA {
|
|
29
|
-
displayer: 'integer';
|
|
30
|
-
min_digits: number;
|
|
31
|
-
max_digits: number;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface DatetimeLocaleDisplayerA {
|
|
35
|
-
displayer: 'datetimeLocaleString';
|
|
36
|
-
locale: 'en-US' | 'en-GB' | 'en-CA' | 'fr-FR' | 'es-ES' | 'de-DE' | 'ja-JP';
|
|
37
|
-
args: Intl.DateTimeFormatOptions;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Used DisplayerA instead of FormatterArgs, Displayer makes sense from the python side
|
|
41
|
-
// python doesn't care that histogram requires a cellRenderer and Integer only changes the formatter
|
|
42
|
-
export type FormatterArgs =
|
|
43
|
-
| ObjDisplayerA
|
|
44
|
-
| BooleanDisplayerA
|
|
45
|
-
| StringDisplayerA
|
|
46
|
-
| FloatDisplayerA
|
|
47
|
-
| DatetimeDefaultDisplayerA
|
|
48
|
-
| DatetimeLocaleDisplayerA
|
|
49
|
-
| IntegerDisplayerA;
|
|
50
|
-
|
|
51
|
-
export interface HistogramDisplayerA {
|
|
52
|
-
displayer: 'histogram';
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface LinkifyDisplayerA {
|
|
56
|
-
displayer: 'linkify';
|
|
57
|
-
}
|
|
58
|
-
export interface BooleanCheckboxDisplayerA {
|
|
59
|
-
displayer: 'boolean_checkbox';
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface Base64PNGImageDisplayerA {
|
|
63
|
-
displayer: 'Base64PNGImageDisplayer';
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface SVGDisplayerA {
|
|
67
|
-
displayer: 'SVGDisplayer';
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type CellRendererArgs =
|
|
71
|
-
| HistogramDisplayerA
|
|
72
|
-
| LinkifyDisplayerA
|
|
73
|
-
| BooleanCheckboxDisplayerA
|
|
74
|
-
| Base64PNGImageDisplayerA
|
|
75
|
-
| SVGDisplayerA;
|
|
76
|
-
|
|
77
|
-
export type DisplayerArgs = FormatterArgs | CellRendererArgs;
|
|
78
|
-
|
|
79
|
-
export const cellRendererDisplayers = [
|
|
80
|
-
'histogram',
|
|
81
|
-
'linkify',
|
|
82
|
-
'Base64PNGImageDisplayer',
|
|
83
|
-
'SVGDisplayer'
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
//ColorMapRules
|
|
87
|
-
export interface ColorMapRules {
|
|
88
|
-
color_rule: 'color_map';
|
|
89
|
-
map_name: 'BLUE_TO_YELLOW' | 'DIVERGING_RED_WHITE_BLUE';
|
|
90
|
-
//optional, the column to base the ranges on. the proper histogram_bins must still be sent in for that column
|
|
91
|
-
val_column?: string;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
//if exist_column is not null, set cell style to condtional_color... used for highlighting changed values or errored_rows
|
|
95
|
-
export interface ColorWhenNotNullRules {
|
|
96
|
-
color_rule: 'color_not_null';
|
|
97
|
-
conditional_color: string | 'red';
|
|
98
|
-
exist_column: string;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface ColorFromColumn {
|
|
102
|
-
color_rule: 'color_from_column';
|
|
103
|
-
col_name: string;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export type ColorMappingConfig = ColorMapRules | ColorWhenNotNullRules | ColorFromColumn;
|
|
107
|
-
|
|
108
|
-
//TooltipRules
|
|
109
|
-
export interface SimpleTooltip {
|
|
110
|
-
tooltip_type: 'simple';
|
|
111
|
-
val_column: string;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export interface SummarySeriesTooltip {
|
|
115
|
-
tooltip_type: 'summary_series';
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export type TooltipConfig = SimpleTooltip | SummarySeriesTooltip; //more to be added
|
|
119
|
-
|
|
120
|
-
export type ColumnConfig = {
|
|
121
|
-
col_name: string;
|
|
122
|
-
displayer_args: DisplayerArgs;
|
|
123
|
-
color_map_config?: ColorMappingConfig;
|
|
124
|
-
tooltip_config?: TooltipConfig;
|
|
125
|
-
ag_grid_specs?: AGGrid_ColDef;
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export type PinnedRowConfig = {
|
|
129
|
-
primary_key_val: string;
|
|
130
|
-
displayer_args: DisplayerArgs;
|
|
131
|
-
//used to render index column values with string not the specified displayer, otherwise the column will be listed as NaN or blank
|
|
132
|
-
//by default the "index" column is always rendered with "obj"
|
|
133
|
-
default_renderer_columns?: string[];
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export type ComponentConfig = {
|
|
137
|
-
height_fraction?: number;
|
|
138
|
-
// temporary debugging props
|
|
139
|
-
dfvHeight?: number;
|
|
140
|
-
layoutType?: 'autoHeight' | 'normal';
|
|
141
|
-
shortMode?: boolean;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export interface DFViewerConfig {
|
|
145
|
-
pinned_rows: PinnedRowConfig[];
|
|
146
|
-
column_config: ColumnConfig[];
|
|
147
|
-
extra_grid_config?: GridOptions;
|
|
148
|
-
component_config?: ComponentConfig;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export type DFDataRow = Record<
|
|
152
|
-
string,
|
|
153
|
-
string | number | boolean | any[] | Record<string, any> | null
|
|
154
|
-
>;
|
|
155
|
-
|
|
156
|
-
export type DFData = DFDataRow[];
|
|
157
|
-
|
|
158
|
-
/*
|
|
159
|
-
When I want to start tagging metadata onto DFData
|
|
160
|
-
export interface DFData {
|
|
161
|
-
rows: DFDataRow[];
|
|
162
|
-
//data_meta expansion point for typing info about the data as needed by non-display stuff
|
|
163
|
-
// typing, sorting, null handling I'm not sure about it
|
|
164
|
-
};
|
|
165
|
-
*/
|
|
166
|
-
|
|
167
|
-
export interface DFWhole {
|
|
168
|
-
dfviewer_config: DFViewerConfig;
|
|
169
|
-
data: DFData;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export const EmptyDf: DFWhole = {
|
|
173
|
-
dfviewer_config: {
|
|
174
|
-
pinned_rows: [],
|
|
175
|
-
column_config: []
|
|
176
|
-
},
|
|
177
|
-
data: []
|
|
178
|
-
};
|
|
179
|
-
|
|
180
|
-
//actually SDFT is summary stats transposed to be useful
|
|
181
|
-
// SDFT[col][stat_name]
|
|
182
|
-
// SDFT really only needs histogramBins and histogramLogBins and...? at this point
|
|
183
|
-
//type SDFT = any;
|
|
184
|
-
|
|
185
|
-
export interface SDFMeasure {
|
|
186
|
-
histogram_bins: number[];
|
|
187
|
-
histogram_log_bins: number[];
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export type SDFT = Record<string, SDFMeasure>;
|