@akohn/dashql-react 0.0.0-stage → 0.0.20-dev.664.g9e89b805d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (342) hide show
  1. package/LICENSE +373 -0
  2. package/NOTICE +66 -0
  3. package/README.md +46 -2
  4. package/dist/_virtual/_vite/preload-helper.js +100 -0
  5. package/dist/brand/brand.d.ts +13 -0
  6. package/dist/brand/brand.js +14 -0
  7. package/dist/brand/landing_backdrop.d.ts +56 -0
  8. package/dist/brand/landing_backdrop.js +1019 -0
  9. package/dist/brand/wobble_morph.d.ts +54 -0
  10. package/dist/brand/wobble_morph.js +439 -0
  11. package/dist/components/action_list.d.ts +31 -0
  12. package/dist/components/action_list.js +63 -0
  13. package/dist/components/action_list.module.js +11 -0
  14. package/dist/components/anchored_overlay.d.ts +28 -0
  15. package/dist/components/anchored_overlay.js +93 -0
  16. package/dist/components/button.d.ts +42 -0
  17. package/dist/components/button.js +97 -0
  18. package/dist/components/button.module.js +20 -0
  19. package/dist/components/button_group.d.ts +7 -0
  20. package/dist/components/button_group.js +18 -0
  21. package/dist/components/button_group.module.js +3 -0
  22. package/dist/components/card_placeholder.d.ts +9 -0
  23. package/dist/components/card_placeholder.js +39 -0
  24. package/dist/components/card_placeholder.module.js +6 -0
  25. package/dist/components/clipboard.d.ts +19 -0
  26. package/dist/components/clipboard.js +54 -0
  27. package/dist/components/data_table/computation_tables.d.ts +12 -0
  28. package/dist/components/data_table/computation_tables.js +42 -0
  29. package/dist/components/data_table/data_table.d.ts +38 -0
  30. package/dist/components/data_table/data_table.js +378 -0
  31. package/dist/components/data_table/data_table.module.js +41 -0
  32. package/dist/components/data_table/data_table_cell.d.ts +7 -0
  33. package/dist/components/data_table/data_table_cell.js +9 -0
  34. package/dist/components/data_table/data_table_cell_data.d.ts +21 -0
  35. package/dist/components/data_table/data_table_cell_data.js +99 -0
  36. package/dist/components/data_table/data_table_cell_header_name.d.ts +17 -0
  37. package/dist/components/data_table/data_table_cell_header_name.js +73 -0
  38. package/dist/components/data_table/data_table_cell_header_plots.d.ts +31 -0
  39. package/dist/components/data_table/data_table_cell_header_plots.js +122 -0
  40. package/dist/components/data_table/data_table_colors.d.ts +19 -0
  41. package/dist/components/data_table/data_table_colors.js +27 -0
  42. package/dist/components/data_table/data_table_column_resize.d.ts +21 -0
  43. package/dist/components/data_table/data_table_column_resize.js +121 -0
  44. package/dist/components/data_table/data_table_focus.d.ts +15 -0
  45. package/dist/components/data_table/data_table_focus.js +53 -0
  46. package/dist/components/data_table/data_table_layout.d.ts +18 -0
  47. package/dist/components/data_table/data_table_layout.js +103 -0
  48. package/dist/components/data_table/data_table_ordering.d.ts +9 -0
  49. package/dist/components/data_table/data_table_ordering.js +39 -0
  50. package/dist/components/data_table/data_table_portals.d.ts +9 -0
  51. package/dist/components/data_table/data_table_portals.js +29 -0
  52. package/dist/components/data_table/data_table_sticky_views.d.ts +34 -0
  53. package/dist/components/data_table/data_table_sticky_views.js +161 -0
  54. package/dist/components/data_table/data_table_window.d.ts +18 -0
  55. package/dist/components/data_table/data_table_window.js +118 -0
  56. package/dist/components/data_table/format_peek.d.ts +2 -0
  57. package/dist/components/data_table/format_peek.js +17 -0
  58. package/dist/components/data_table/histogram_bars.d.ts +36 -0
  59. package/dist/components/data_table/histogram_bars.js +100 -0
  60. package/dist/components/data_table/histogram_brush.d.ts +23 -0
  61. package/dist/components/data_table/histogram_brush.js +107 -0
  62. package/dist/components/data_table/histogram_cell.d.ts +19 -0
  63. package/dist/components/data_table/histogram_cell.js +325 -0
  64. package/dist/components/data_table/histogram_cell.module.js +9 -0
  65. package/dist/components/data_table/histogram_label.d.ts +1 -0
  66. package/dist/components/data_table/histogram_label.js +7 -0
  67. package/dist/components/data_table/memo_props.d.ts +1 -0
  68. package/dist/components/data_table/memo_props.js +17 -0
  69. package/dist/components/data_table/mostfrequent_cell.d.ts +17 -0
  70. package/dist/components/data_table/mostfrequent_cell.js +316 -0
  71. package/dist/components/data_table/mostfrequent_cell.module.js +10 -0
  72. package/dist/components/data_table/use_cross_filters.d.ts +14 -0
  73. package/dist/components/data_table/use_cross_filters.js +47 -0
  74. package/dist/components/deferred.d.ts +11 -0
  75. package/dist/components/deferred.js +41 -0
  76. package/dist/components/deferred.module.js +5 -0
  77. package/dist/components/error_boundary.d.ts +18 -0
  78. package/dist/components/error_boundary.js +15 -0
  79. package/dist/components/graph.module.js +15 -0
  80. package/dist/components/graph_port.d.ts +10 -0
  81. package/dist/components/graph_port.js +34 -0
  82. package/dist/components/inspector_overlay.d.ts +32 -0
  83. package/dist/components/inspector_overlay.js +72 -0
  84. package/dist/components/inspector_overlay.module.js +18 -0
  85. package/dist/components/json/json_arrow_symbol.d.ts +4 -0
  86. package/dist/components/json/json_arrow_symbol.js +25 -0
  87. package/dist/components/json/json_copy_button.d.ts +11 -0
  88. package/dist/components/json/json_copy_button.js +61 -0
  89. package/dist/components/json/json_ellipsis_symbol.d.ts +7 -0
  90. package/dist/components/json/json_ellipsis_symbol.js +11 -0
  91. package/dist/components/json/json_item_count.d.ts +5 -0
  92. package/dist/components/json/json_item_count.js +12 -0
  93. package/dist/components/json/json_key_name.d.ts +6 -0
  94. package/dist/components/json/json_key_name.js +40 -0
  95. package/dist/components/json/json_key_values.d.ts +12 -0
  96. package/dist/components/json/json_key_values.js +99 -0
  97. package/dist/components/json/json_literal.d.ts +8 -0
  98. package/dist/components/json/json_literal.js +140 -0
  99. package/dist/components/json/json_nested_close.d.ts +11 -0
  100. package/dist/components/json/json_nested_close.js +31 -0
  101. package/dist/components/json/json_nested_open.d.ts +18 -0
  102. package/dist/components/json/json_nested_open.js +150 -0
  103. package/dist/components/json/json_nested_state.d.ts +14 -0
  104. package/dist/components/json/json_nested_state.js +28 -0
  105. package/dist/components/json/json_tool_state.d.ts +18 -0
  106. package/dist/components/json/json_tool_state.js +46 -0
  107. package/dist/components/json/json_value.d.ts +10 -0
  108. package/dist/components/json/json_value.js +46 -0
  109. package/dist/components/json/json_view.d.ts +14 -0
  110. package/dist/components/json/json_view.js +37 -0
  111. package/dist/components/json/json_view.module.js +41 -0
  112. package/dist/components/json/json_view_state.d.ts +14 -0
  113. package/dist/components/json/json_view_state.js +32 -0
  114. package/dist/components/json/unique_key.d.ts +1 -0
  115. package/dist/components/json/unique_key.js +8 -0
  116. package/dist/components/keyvalue_list.d.ts +25 -0
  117. package/dist/components/keyvalue_list.js +106 -0
  118. package/dist/components/keyvalue_list.module.js +15 -0
  119. package/dist/components/name_input.d.ts +11 -0
  120. package/dist/components/name_input.js +51 -0
  121. package/dist/components/overlay.d.ts +53 -0
  122. package/dist/components/overlay.js +183 -0
  123. package/dist/components/overlay.module.js +32 -0
  124. package/dist/components/panel_resize_handle.d.ts +12 -0
  125. package/dist/components/panel_resize_handle.js +39 -0
  126. package/dist/components/portal.d.ts +8 -0
  127. package/dist/components/portal.js +53 -0
  128. package/dist/components/progress_bar.d.ts +7 -0
  129. package/dist/components/progress_bar.js +21 -0
  130. package/dist/components/progress_bar.module.js +3 -0
  131. package/dist/components/query_history_viewer.d.ts +33 -0
  132. package/dist/components/query_history_viewer.js +268 -0
  133. package/dist/components/query_history_viewer.module.js +7 -0
  134. package/dist/components/query_profile/engine_profile_view.d.ts +19 -0
  135. package/dist/components/query_profile/engine_profile_view.js +94 -0
  136. package/dist/components/query_profile/numeric_limits.d.ts +1 -0
  137. package/dist/components/query_profile/numeric_limits.js +2 -0
  138. package/dist/components/query_profile/profile_execution_controller.d.ts +14 -0
  139. package/dist/components/query_profile/profile_execution_controller.js +56 -0
  140. package/dist/components/query_profile/profile_fit.d.ts +24 -0
  141. package/dist/components/query_profile/profile_fit.js +22 -0
  142. package/dist/components/query_profile/profile_navigation.d.ts +3 -0
  143. package/dist/components/query_profile/profile_navigation.js +34 -0
  144. package/dist/components/query_profile/profile_scene.d.ts +64 -0
  145. package/dist/components/query_profile/profile_scene.js +422 -0
  146. package/dist/components/query_profile/query_profile_view.d.ts +44 -0
  147. package/dist/components/query_profile/query_profile_view.js +961 -0
  148. package/dist/components/query_profile/query_profile_view.module.js +23 -0
  149. package/dist/components/query_progress/query_profile_overlay.d.ts +7 -0
  150. package/dist/components/query_progress/query_profile_overlay.js +67 -0
  151. package/dist/components/query_progress/query_profile_overlay.module.js +6 -0
  152. package/dist/components/query_progress/query_progress_panel.d.ts +14 -0
  153. package/dist/components/query_progress/query_progress_panel.js +255 -0
  154. package/dist/components/query_progress/query_progress_panel.module.js +10 -0
  155. package/dist/components/query_result/cell_detail_overlay.d.ts +34 -0
  156. package/dist/components/query_result/cell_detail_overlay.js +277 -0
  157. package/dist/components/query_result/cell_detail_overlay.module.js +21 -0
  158. package/dist/components/query_result/query_result_action_menu.d.ts +12 -0
  159. package/dist/components/query_result/query_result_action_menu.js +62 -0
  160. package/dist/components/query_result/query_result_action_menu.module.js +2 -0
  161. package/dist/components/query_result/query_result_details.d.ts +17 -0
  162. package/dist/components/query_result/query_result_details.js +46 -0
  163. package/dist/components/query_result/query_result_details.module.js +5 -0
  164. package/dist/components/query_result/query_result_download_button.d.ts +8 -0
  165. package/dist/components/query_result/query_result_download_button.js +38 -0
  166. package/dist/components/query_result/query_result_header.d.ts +21 -0
  167. package/dist/components/query_result/query_result_header.js +71 -0
  168. package/dist/components/query_result/query_result_header.module.js +3 -0
  169. package/dist/components/query_result/query_result_search_controls.d.ts +12 -0
  170. package/dist/components/query_result/query_result_search_controls.js +141 -0
  171. package/dist/components/query_result/query_result_search_controls.module.js +7 -0
  172. package/dist/components/query_result/query_result_toolbar.d.ts +21 -0
  173. package/dist/components/query_result/query_result_toolbar.js +74 -0
  174. package/dist/components/query_result/result_table_overlay.d.ts +9 -0
  175. package/dist/components/query_result/result_table_overlay.js +73 -0
  176. package/dist/components/query_result/result_table_overlay.module.js +6 -0
  177. package/dist/components/query_result/use_query_result_search.d.ts +8 -0
  178. package/dist/components/query_result/use_query_result_search.js +28 -0
  179. package/dist/components/segmented_control.d.ts +58 -0
  180. package/dist/components/segmented_control.js +116 -0
  181. package/dist/components/segmented_control.module.js +17 -0
  182. package/dist/components/separator.d.ts +21 -0
  183. package/dist/components/separator.js +79 -0
  184. package/dist/components/separator.module.js +7 -0
  185. package/dist/components/size_observer.d.ts +7 -0
  186. package/dist/components/size_observer.js +57 -0
  187. package/dist/components/skeleton.d.ts +2 -0
  188. package/dist/components/skeleton.js +14 -0
  189. package/dist/components/skeleton.module.js +2 -0
  190. package/dist/components/spinners.d.ts +8 -0
  191. package/dist/components/spinners.js +33 -0
  192. package/dist/components/spinners.module.js +8 -0
  193. package/dist/components/status_indicator.d.ts +36 -0
  194. package/dist/components/status_indicator.js +182 -0
  195. package/dist/components/status_indicator.module.js +3 -0
  196. package/dist/components/symbol_icon.d.ts +65 -0
  197. package/dist/components/symbol_icon.js +213 -0
  198. package/dist/components/tab_header.d.ts +11 -0
  199. package/dist/components/tab_header.js +55 -0
  200. package/dist/components/tab_header.module.js +7 -0
  201. package/dist/components/tag.d.ts +10 -0
  202. package/dist/components/tag.js +17 -0
  203. package/dist/components/tag.module.js +4 -0
  204. package/dist/components/text_field.d.ts +44 -0
  205. package/dist/components/text_field.js +159 -0
  206. package/dist/components/text_field.module.js +15 -0
  207. package/dist/components/text_input.d.ts +25 -0
  208. package/dist/components/text_input.js +90 -0
  209. package/dist/components/text_input.module.js +13 -0
  210. package/dist/components/text_input_action.d.ts +19 -0
  211. package/dist/components/text_input_action.js +33 -0
  212. package/dist/components/text_input_action.module.js +2 -0
  213. package/dist/components/toggle_switch.d.ts +7 -0
  214. package/dist/components/toggle_switch.js +22 -0
  215. package/dist/components/toggle_switch.module.js +6 -0
  216. package/dist/components/tooltip.d.ts +22 -0
  217. package/dist/components/tooltip.js +139 -0
  218. package/dist/components/tooltip.module.js +2 -0
  219. package/dist/components/tree_entry.d.ts +17 -0
  220. package/dist/components/tree_entry.js +48 -0
  221. package/dist/components/tree_entry.module.js +9 -0
  222. package/dist/components/value_list.d.ts +17 -0
  223. package/dist/components/value_list.js +70 -0
  224. package/dist/components/value_list.module.js +8 -0
  225. package/dist/components/vegalite_chart.d.ts +18 -0
  226. package/dist/components/vegalite_chart.js +151 -0
  227. package/dist/components/vegalite_chart.module.js +3 -0
  228. package/dist/components/vegalite_view.d.ts +27 -0
  229. package/dist/components/vegalite_view.js +248 -0
  230. package/dist/components/vegalite_view.module.js +5 -0
  231. package/dist/components/vertical_scroll_shadows.d.ts +14 -0
  232. package/dist/components/vertical_scroll_shadows.js +55 -0
  233. package/dist/components/vertical_scroll_shadows.module.js +5 -0
  234. package/dist/components/vertical_split.d.ts +15 -0
  235. package/dist/components/vertical_split.js +112 -0
  236. package/dist/components/vertical_split.module.js +5 -0
  237. package/dist/components/vertical_tabs.d.ts +36 -0
  238. package/dist/components/vertical_tabs.js +169 -0
  239. package/dist/components/vertical_tabs.module.js +23 -0
  240. package/dist/components/visualization/capped_rows.d.ts +9 -0
  241. package/dist/components/visualization/capped_rows.js +23 -0
  242. package/dist/components/visualization/capped_rows.module.js +3 -0
  243. package/dist/components/visualization/chart_download_button.d.ts +12 -0
  244. package/dist/components/visualization/chart_download_button.js +41 -0
  245. package/dist/components/visualization/kpi_view.d.ts +10 -0
  246. package/dist/components/visualization/kpi_view.js +215 -0
  247. package/dist/components/visualization/kpi_view.module.js +17 -0
  248. package/dist/components/visualization/markdown_view.d.ts +17 -0
  249. package/dist/components/visualization/markdown_view.js +154 -0
  250. package/dist/components/visualization/markdown_view.module.js +4 -0
  251. package/dist/components/visualization/result_rows.d.ts +17 -0
  252. package/dist/components/visualization/result_rows.js +82 -0
  253. package/dist/components/visualization/vegalite_preview.d.ts +8 -0
  254. package/dist/components/visualization/vegalite_preview.js +17 -0
  255. package/dist/components/visualization/vegalite_preview.module.js +2 -0
  256. package/dist/components/visualization/visualization_dispatch.d.ts +14 -0
  257. package/dist/components/visualization/visualization_dispatch.js +41 -0
  258. package/dist/components/visualization/visualization_panel.d.ts +10 -0
  259. package/dist/components/visualization/visualization_panel.js +37 -0
  260. package/dist/components/visualization/visualization_panel.module.js +3 -0
  261. package/dist/dom/anchored_position.d.ts +42 -0
  262. package/dist/dom/anchored_position.js +255 -0
  263. package/dist/dom/app_host.d.ts +6 -0
  264. package/dist/dom/app_host.js +13 -0
  265. package/dist/dom/calm_frames.d.ts +24 -0
  266. package/dist/dom/calm_frames.js +96 -0
  267. package/dist/dom/classnames.d.ts +8 -0
  268. package/dist/dom/classnames.js +20 -0
  269. package/dist/dom/download_file.d.ts +1 -0
  270. package/dist/dom/download_file.js +12 -0
  271. package/dist/dom/focus.d.ts +29 -0
  272. package/dist/dom/focus.js +84 -0
  273. package/dist/dom/graph_edges.d.ts +53 -0
  274. package/dist/dom/graph_edges.js +450 -0
  275. package/dist/dom/key_events.d.ts +9 -0
  276. package/dist/dom/key_events.js +33 -0
  277. package/dist/dom/media_query.d.ts +2 -0
  278. package/dist/dom/media_query.js +15 -0
  279. package/dist/dom/outside_click.d.ts +8 -0
  280. package/dist/dom/outside_click.js +32 -0
  281. package/dist/dom/rerender_ref.d.ts +2 -0
  282. package/dist/dom/rerender_ref.js +11 -0
  283. package/dist/dom/row_context_menu.d.ts +7 -0
  284. package/dist/dom/row_context_menu.js +32 -0
  285. package/dist/dom/scrollbar.d.ts +3 -0
  286. package/dist/dom/scrollbar.js +23 -0
  287. package/dist/format/format.d.ts +11 -0
  288. package/dist/format/format.js +72 -0
  289. package/dist/format/query_progress_format.d.ts +17 -0
  290. package/dist/format/query_progress_format.js +69 -0
  291. package/dist/format/time_format.d.ts +5 -0
  292. package/dist/format/time_format.js +45 -0
  293. package/dist/hooks.d.ts +71 -0
  294. package/dist/hooks.js +302 -0
  295. package/dist/host.d.ts +10 -0
  296. package/dist/host.js +12 -0
  297. package/dist/logger.d.ts +4 -0
  298. package/dist/logger.js +6 -0
  299. package/dist/models/computation_model.d.ts +14 -0
  300. package/dist/models/computation_model.js +27 -0
  301. package/dist/models/query_model.d.ts +12 -0
  302. package/dist/models/query_model.js +27 -0
  303. package/dist/models/script_model.d.ts +17 -0
  304. package/dist/models/script_model.js +69 -0
  305. package/dist/style.css +4226 -0
  306. package/dist/svg_symbols.d.ts +2 -0
  307. package/dist/svg_symbols.js +2 -0
  308. package/dist/symbols.svg +1197 -0
  309. package/dist/theme/color_scheme.d.ts +4 -0
  310. package/dist/theme/color_scheme.js +28 -0
  311. package/dist/theme/xcode_palette.d.ts +22 -0
  312. package/dist/theme/xcode_palette.js +4 -0
  313. package/dist/theme/xcode_palettes.js +41 -0
  314. package/dist/utils/plan_engine.d.ts +2 -0
  315. package/dist/utils/plan_engine.js +13 -0
  316. package/dist/vegalite/vegalite_check.d.ts +1 -0
  317. package/dist/vegalite/vegalite_check.js +7 -0
  318. package/dist/vegalite/vegalite_crossfilter.d.ts +54 -0
  319. package/dist/vegalite/vegalite_crossfilter.js +187 -0
  320. package/dist/vegalite/vegalite_image.d.ts +16 -0
  321. package/dist/vegalite/vegalite_image.js +28 -0
  322. package/dist/vegalite/vegalite_loader.d.ts +7 -0
  323. package/dist/vegalite/vegalite_loader.js +15 -0
  324. package/dist/vegalite/vegalite_rows.d.ts +3 -0
  325. package/dist/vegalite/vegalite_rows.js +17 -0
  326. package/dist/vegalite/vegalite_theme.d.ts +11 -0
  327. package/dist/vegalite/vegalite_theme.js +125 -0
  328. package/fonts/InstrumentSans-Bold.ttf +0 -0
  329. package/fonts/InstrumentSans-Medium.ttf +0 -0
  330. package/fonts/InstrumentSans-OFL.txt +93 -0
  331. package/fonts/InstrumentSans-Regular.ttf +0 -0
  332. package/fonts/InstrumentSans-SemiBold.ttf +0 -0
  333. package/fonts/JetBrainsMono-Bold.ttf +0 -0
  334. package/fonts/JetBrainsMono-Medium.ttf +0 -0
  335. package/fonts/JetBrainsMono-OFL.txt +93 -0
  336. package/fonts/JetBrainsMono-Regular.ttf +0 -0
  337. package/fonts/JetBrainsMono-SemiBold.ttf +0 -0
  338. package/fonts/fonts.css +61 -0
  339. package/package.json +43 -4
  340. package/styles/colors.css +110 -0
  341. package/styles/flavors/dbcom.css +48 -0
  342. package/styles/tokens.css +192 -0
@@ -0,0 +1,31 @@
1
+ import * as React from 'react';
2
+ import type * as core from '@akohn/dashql';
3
+ import type { ComputationColumnGroup, ComputationTrackedTask, ComputationVersionValue } from '@akohn/dashql';
4
+ import { ColumnAggregationVariant, TableAggregation, WithFilterEpoch } from '@akohn/dashql/platform/compute/computation_types';
5
+ import { BrushingStateCallback, HistogramFilterCallback } from './histogram_cell.js';
6
+ import { MostFrequentValueFilterCallback } from './mostfrequent_cell.js';
7
+ import { DataTableLayout } from './data_table_layout.js';
8
+ export interface HeaderPlotsCellProps {
9
+ columnIndex: number;
10
+ style: React.CSSProperties;
11
+ gridLayout: DataTableLayout;
12
+ columnGroups: ComputationColumnGroup[];
13
+ columnAggregations: (ColumnAggregationVariant | null)[];
14
+ columnAggregationTasks: (ComputationTrackedTask | null)[];
15
+ filteredColumnAggregations: (WithFilterEpoch<ColumnAggregationVariant> | null)[];
16
+ filteredColumnAggregationTasks: (ComputationTrackedTask | null)[];
17
+ filteredColumnAggregationOutdated: boolean[];
18
+ tableAggregation: TableAggregation | null;
19
+ selectionEpoch: ComputationVersionValue;
20
+ dataSearchRequestId: number | null;
21
+ crossFilters: core.ComputationCrossFilter[];
22
+ isVisible: boolean;
23
+ rightmostVisibleColumn: number;
24
+ onRequestFilteredColumnAggregation: (columnId: number) => void;
25
+ onHistogramFilter: HistogramFilterCallback;
26
+ onBrushingChange: BrushingStateCallback;
27
+ onMostFrequentValueFilter: MostFrequentValueFilterCallback;
28
+ }
29
+ declare function HeaderPlotsCellImpl(props: HeaderPlotsCellProps): React.ReactElement;
30
+ export declare const HeaderPlotsCell: React.MemoExoticComponent<typeof HeaderPlotsCellImpl>;
31
+ export {};
@@ -0,0 +1,122 @@
1
+ import { plots_cell, plots_cell_rightmost, plots_corner_cell, plots_empty_cell, plots_no_summary_cell, plots_no_summary_label, plots_progress, plots_progress_spinner } from "./data_table.module.js";
2
+ import { classNames } from "../../dom/classnames.js";
3
+ import { RectangleWaveSpinner } from "../spinners.js";
4
+ import { HistogramCell } from "./histogram_cell.js";
5
+ import { MostFrequentCell } from "./mostfrequent_cell.js";
6
+ import { arePropsEqualWithStyle } from "./memo_props.js";
7
+ import { crossFilterOf } from "./use_cross_filters.js";
8
+ import * as React from "react";
9
+ import { jsx } from "react/jsx-runtime";
10
+ import { LIST_COLUMN, ORDINAL_COLUMN, SKIPPED_COLUMN, STRING_COLUMN, TaskStatus } from "@akohn/dashql/platform/compute/computation_types";
11
+ function HeaderPlotsCellImpl(props) {
12
+ const pastFields = props.columnIndex >= props.gridLayout.arrowFieldByColumnIndex.length;
13
+ let columnAggregate = null;
14
+ let columnAggregationTask = null;
15
+ let filteredColumnAggregate = null;
16
+ let filteredColumnAggregationTask = null;
17
+ let filteredColumnAggregationOutdated = false;
18
+ const columnAggregateId = pastFields ? -1 : props.gridLayout.columnAggregateByColumnIndex[props.columnIndex];
19
+ if (columnAggregateId != -1) {
20
+ columnAggregate = props.columnAggregations[columnAggregateId] ?? null;
21
+ columnAggregationTask = props.columnAggregationTasks[columnAggregateId] ?? null;
22
+ filteredColumnAggregate = props.filteredColumnAggregations[columnAggregateId] ?? null;
23
+ filteredColumnAggregationTask = props.filteredColumnAggregationTasks[columnAggregateId] ?? null;
24
+ filteredColumnAggregationOutdated = props.filteredColumnAggregationOutdated[columnAggregateId] ?? false;
25
+ }
26
+ const { isVisible, onRequestFilteredColumnAggregation } = props;
27
+ React.useEffect(() => {
28
+ if (columnAggregateId == -1 || !isVisible || !filteredColumnAggregationOutdated) return;
29
+ onRequestFilteredColumnAggregation(columnAggregateId);
30
+ }, [
31
+ columnAggregateId,
32
+ filteredColumnAggregationOutdated,
33
+ filteredColumnAggregationTask,
34
+ props.selectionEpoch,
35
+ props.dataSearchRequestId,
36
+ isVisible,
37
+ onRequestFilteredColumnAggregation
38
+ ]);
39
+ const isRightmost = props.columnIndex === props.rightmostVisibleColumn;
40
+ if (pastFields || !props.isVisible) return /* @__PURE__ */ jsx("div", { style: props.style });
41
+ const columnGroupId = props.gridLayout.columnGroupByColumnIndex[props.columnIndex];
42
+ const columnGroup = props.columnGroups[columnGroupId];
43
+ const crossFilter = crossFilterOf(props.crossFilters, columnGroupId);
44
+ const histogramSelection = crossFilter?.kind === "histogram" ? crossFilter.selection : null;
45
+ const hasNoSummaryByDesign = columnGroup?.type == LIST_COLUMN;
46
+ if (props.columnIndex == 0) return /* @__PURE__ */ jsx("div", {
47
+ className: plots_corner_cell,
48
+ style: props.style
49
+ });
50
+ else if (hasNoSummaryByDesign) return /* @__PURE__ */ jsx("div", {
51
+ className: classNames(plots_cell, plots_no_summary_cell, { [plots_cell_rightmost]: isRightmost }),
52
+ style: props.style,
53
+ title: "No column summary",
54
+ children: /* @__PURE__ */ jsx("span", {
55
+ className: plots_no_summary_label,
56
+ children: "No summary"
57
+ })
58
+ });
59
+ else if (columnAggregate == null) return /* @__PURE__ */ jsx("div", {
60
+ className: classNames(plots_cell, plots_empty_cell, { [plots_cell_rightmost]: isRightmost }),
61
+ style: props.style
62
+ });
63
+ else {
64
+ const tableAggregation = props.tableAggregation;
65
+ if (tableAggregation == null) return /* @__PURE__ */ jsx("div", {
66
+ className: classNames(plots_cell, { [plots_cell_rightmost]: isRightmost }),
67
+ style: props.style,
68
+ children: "Table summary is null"
69
+ });
70
+ switch (columnAggregationTask?.progress.status) {
71
+ case TaskStatus.TASK_RUNNING: return /* @__PURE__ */ jsx("div", {
72
+ className: classNames(plots_cell, plots_progress, { [plots_cell_rightmost]: isRightmost }),
73
+ style: props.style,
74
+ children: /* @__PURE__ */ jsx(RectangleWaveSpinner, {
75
+ className: plots_progress_spinner,
76
+ active: true,
77
+ color: "var(--color_border)"
78
+ })
79
+ });
80
+ case TaskStatus.TASK_FAILED: return /* @__PURE__ */ jsx("div", {
81
+ className: classNames(plots_cell, { [plots_cell_rightmost]: isRightmost }),
82
+ style: props.style,
83
+ children: "Failed"
84
+ });
85
+ case TaskStatus.TASK_CANCELLED: return /* @__PURE__ */ jsx("div", {
86
+ className: classNames(plots_cell, { [plots_cell_rightmost]: isRightmost }),
87
+ style: props.style,
88
+ children: "Cancelled"
89
+ });
90
+ case TaskStatus.TASK_SUCCEEDED: switch (columnAggregate?.type) {
91
+ case ORDINAL_COLUMN: return /* @__PURE__ */ jsx(HistogramCell, {
92
+ className: classNames(plots_cell, { [plots_cell_rightmost]: isRightmost }),
93
+ style: props.style,
94
+ tableAggregation,
95
+ filteredColumnAggregation: filteredColumnAggregate,
96
+ columnIndex: props.columnIndex,
97
+ columnAggregate: columnAggregate.value,
98
+ selection: histogramSelection,
99
+ onFilter: props.onHistogramFilter,
100
+ onBrushingChange: props.onBrushingChange
101
+ });
102
+ case STRING_COLUMN: return /* @__PURE__ */ jsx(MostFrequentCell, {
103
+ className: classNames(plots_cell, { [plots_cell_rightmost]: isRightmost }),
104
+ style: props.style,
105
+ tableAggregation,
106
+ filteredColumnAggregation: filteredColumnAggregate,
107
+ columnIndex: props.columnIndex,
108
+ columnAggregate: columnAggregate.value,
109
+ onFilter: props.onMostFrequentValueFilter
110
+ });
111
+ case LIST_COLUMN:
112
+ case SKIPPED_COLUMN:
113
+ }
114
+ }
115
+ }
116
+ return /* @__PURE__ */ jsx("div", {
117
+ className: classNames(plots_cell, { [plots_cell_rightmost]: isRightmost }),
118
+ style: props.style
119
+ });
120
+ }
121
+ var HeaderPlotsCell = React.memo(HeaderPlotsCellImpl, arePropsEqualWithStyle);
122
+ export { HeaderPlotsCell };
@@ -0,0 +1,19 @@
1
+ export declare const COLUMN_SUMMARY_COLORS: {
2
+ totalBar: string;
3
+ totalBarFocused: string;
4
+ totalBarWithFilter: string;
5
+ totalBarWithFilterFocused: string;
6
+ filteredBar: string;
7
+ filteredBarFocused: string;
8
+ };
9
+ export declare const COLUMN_SUMMARY_NULL_COLORS: {
10
+ totalBar: string;
11
+ totalBarFocused: string;
12
+ totalBarWithFilter: string;
13
+ totalBarWithFilterFocused: string;
14
+ filteredBar: string;
15
+ filteredBarFocused: string;
16
+ };
17
+ export declare const COLUMN_SUMMARY_BASELINE_COLOR = "var(--color_border)";
18
+ export declare function getTotalBarColor(hasFilter: boolean, isFocused: boolean, isNull?: boolean): string;
19
+ export declare function getFilteredBarColor(isFocused: boolean, isNull?: boolean): string;
@@ -0,0 +1,27 @@
1
+ var COLUMN_SUMMARY_COLORS = {
2
+ totalBar: "var(--color_neutral_fg)",
3
+ totalBarFocused: "var(--color_fg_muted)",
4
+ totalBarWithFilter: "var(--color_border)",
5
+ totalBarWithFilterFocused: "var(--color_fg_subtle)",
6
+ filteredBar: "var(--color_neutral_fg)",
7
+ filteredBarFocused: "var(--color_fg_muted)"
8
+ };
9
+ var COLUMN_SUMMARY_NULL_COLORS = {
10
+ totalBar: "var(--color_fg_subtle)",
11
+ totalBarFocused: "var(--color_fg_muted)",
12
+ totalBarWithFilter: "var(--color_border)",
13
+ totalBarWithFilterFocused: "var(--color_fg_subtle)",
14
+ filteredBar: "var(--color_neutral_fg)",
15
+ filteredBarFocused: "var(--color_fg_muted)"
16
+ };
17
+ var COLUMN_SUMMARY_BASELINE_COLOR = "var(--color_border)";
18
+ function getTotalBarColor(hasFilter, isFocused, isNull = false) {
19
+ const colors = isNull ? COLUMN_SUMMARY_NULL_COLORS : COLUMN_SUMMARY_COLORS;
20
+ if (hasFilter) return isFocused ? colors.totalBarWithFilterFocused : colors.totalBarWithFilter;
21
+ return isFocused ? colors.totalBarFocused : colors.totalBar;
22
+ }
23
+ function getFilteredBarColor(isFocused, isNull = false) {
24
+ const colors = isNull ? COLUMN_SUMMARY_NULL_COLORS : COLUMN_SUMMARY_COLORS;
25
+ return isFocused ? colors.filteredBarFocused : colors.filteredBar;
26
+ }
27
+ export { COLUMN_SUMMARY_BASELINE_COLOR, COLUMN_SUMMARY_COLORS, COLUMN_SUMMARY_NULL_COLORS, getFilteredBarColor, getTotalBarColor };
@@ -0,0 +1,21 @@
1
+ import * as arrow from 'apache-arrow';
2
+ import * as React from 'react';
3
+ import { DataTableLayout } from './data_table_layout.js';
4
+ export declare const MIN_RESIZED_COLUMN_WIDTH = 40;
5
+ export type ResizedColumnWidths = ReadonlyMap<string, number>;
6
+ export declare function findResizableColumn(layout: DataTableLayout, contentX: number, viewportX: number): number | null;
7
+ interface GridApi {
8
+ element: HTMLDivElement | null;
9
+ }
10
+ export interface DataTableColumnResizeHandlers {
11
+ onPointerDownCapture: React.PointerEventHandler<HTMLDivElement>;
12
+ onPointerMove: React.PointerEventHandler<HTMLDivElement>;
13
+ onPointerUp: React.PointerEventHandler<HTMLDivElement>;
14
+ onPointerCancel: React.PointerEventHandler<HTMLDivElement>;
15
+ onLostPointerCapture: React.PointerEventHandler<HTMLDivElement>;
16
+ onPointerLeave: React.PointerEventHandler<HTMLDivElement>;
17
+ onClickCapture: React.MouseEventHandler<HTMLDivElement>;
18
+ onDoubleClickCapture: React.MouseEventHandler<HTMLDivElement>;
19
+ }
20
+ export declare function useDataTableColumnResize(gridApi: GridApi | null, gridLayout: DataTableLayout, table: arrow.Table, setResizedColumnWidths: React.Dispatch<React.SetStateAction<ResizedColumnWidths>>): DataTableColumnResizeHandlers;
21
+ export {};
@@ -0,0 +1,121 @@
1
+ import { column_resize_hover } from "./data_table.module.js";
2
+ import * as React from "react";
3
+ var RESIZE_HANDLE_TOLERANCE = 4;
4
+ var MIN_RESIZED_COLUMN_WIDTH = 40;
5
+ function findResizableColumn(layout, contentX, viewportX) {
6
+ const offsets = layout.columnXOffsets;
7
+ if (layout.columnCount < 2) return null;
8
+ let lo = 1;
9
+ let hi = layout.columnCount - 1;
10
+ while (lo < hi) {
11
+ const mid = lo + hi >> 1;
12
+ if (offsets[mid + 1] < contentX - RESIZE_HANDLE_TOLERANCE) lo = mid + 1;
13
+ else hi = mid;
14
+ }
15
+ const border = offsets[lo + 1];
16
+ if (Math.abs(border - contentX) > RESIZE_HANDLE_TOLERANCE) return null;
17
+ const stickyColumnWidth = offsets[1] - offsets[0];
18
+ if (border - (contentX - viewportX) <= stickyColumnWidth) return null;
19
+ return lo;
20
+ }
21
+ function useDataTableColumnResize(gridApi, gridLayout, table, setResizedColumnWidths) {
22
+ const layout = React.useRef(gridLayout);
23
+ layout.current = gridLayout;
24
+ const schema = React.useRef(table.schema);
25
+ schema.current = table.schema;
26
+ const drag = React.useRef(null);
27
+ const suppressClick = React.useRef(false);
28
+ const pendingWidth = React.useRef(null);
29
+ const pendingFrame = React.useRef(null);
30
+ React.useEffect(() => () => {
31
+ if (pendingFrame.current != null) cancelAnimationFrame(pendingFrame.current);
32
+ }, []);
33
+ return React.useMemo(() => {
34
+ const hitTest = (event) => {
35
+ const grid = gridApi?.element;
36
+ if (grid == null) return null;
37
+ const bounds = grid.getBoundingClientRect();
38
+ const viewportX = event.clientX - bounds.left;
39
+ const viewportY = event.clientY - bounds.top;
40
+ if (viewportX > grid.clientWidth || viewportY > grid.clientHeight) return null;
41
+ return findResizableColumn(layout.current, viewportX + grid.scrollLeft, viewportX);
42
+ };
43
+ const applyPendingWidth = () => {
44
+ if (pendingFrame.current != null) {
45
+ cancelAnimationFrame(pendingFrame.current);
46
+ pendingFrame.current = null;
47
+ }
48
+ const pending = pendingWidth.current;
49
+ pendingWidth.current = null;
50
+ if (pending != null) setResizedColumnWidths((prev) => new Map(prev).set(pending.fieldName, pending.width));
51
+ };
52
+ const endDrag = (event) => {
53
+ if (drag.current?.pointerId !== event.pointerId) return;
54
+ applyPendingWidth();
55
+ drag.current = null;
56
+ };
57
+ return {
58
+ onPointerDownCapture: (event) => {
59
+ suppressClick.current = false;
60
+ if (event.button !== 0 || event.pointerType === "touch") return;
61
+ const column = hitTest(event);
62
+ if (column == null) return;
63
+ event.preventDefault();
64
+ event.stopPropagation();
65
+ event.currentTarget.setPointerCapture(event.pointerId);
66
+ const offsets = layout.current.columnXOffsets;
67
+ const fieldId = layout.current.arrowFieldByColumnIndex[column];
68
+ drag.current = {
69
+ pointerId: event.pointerId,
70
+ fieldName: schema.current.fields[fieldId].name,
71
+ startX: event.clientX,
72
+ startWidth: offsets[column + 1] - offsets[column]
73
+ };
74
+ suppressClick.current = true;
75
+ },
76
+ onPointerMove: (event) => {
77
+ const active = drag.current;
78
+ if (active == null) {
79
+ event.currentTarget.classList.toggle(column_resize_hover, hitTest(event) != null);
80
+ return;
81
+ }
82
+ if (active.pointerId !== event.pointerId) return;
83
+ pendingWidth.current = {
84
+ fieldName: active.fieldName,
85
+ width: Math.max(40, active.startWidth + event.clientX - active.startX)
86
+ };
87
+ if (pendingFrame.current == null) pendingFrame.current = requestAnimationFrame(() => {
88
+ pendingFrame.current = null;
89
+ applyPendingWidth();
90
+ });
91
+ },
92
+ onPointerUp: endDrag,
93
+ onPointerCancel: endDrag,
94
+ onLostPointerCapture: endDrag,
95
+ onPointerLeave: (event) => {
96
+ if (drag.current == null) event.currentTarget.classList.remove(column_resize_hover);
97
+ },
98
+ onClickCapture: (event) => {
99
+ if (suppressClick.current) {
100
+ suppressClick.current = false;
101
+ event.preventDefault();
102
+ event.stopPropagation();
103
+ }
104
+ },
105
+ onDoubleClickCapture: (event) => {
106
+ const column = hitTest(event);
107
+ if (column == null) return;
108
+ event.preventDefault();
109
+ event.stopPropagation();
110
+ const fieldName = schema.current.fields[layout.current.arrowFieldByColumnIndex[column]].name;
111
+ setResizedColumnWidths((prev) => {
112
+ if (!prev.has(fieldName)) return prev;
113
+ const next = new Map(prev);
114
+ next.delete(fieldName);
115
+ return next;
116
+ });
117
+ }
118
+ };
119
+ }, [gridApi, setResizedColumnWidths]);
120
+ }
121
+ export { MIN_RESIZED_COLUMN_WIDTH, findResizableColumn, useDataTableColumnResize };
@@ -0,0 +1,15 @@
1
+ export declare enum CellFocus {
2
+ None = 0,
3
+ Secondary = 1,
4
+ Primary = 2
5
+ }
6
+ export declare class DataTableFocusStore {
7
+ protected focusedRow: number | null;
8
+ protected focusedField: number | null;
9
+ protected listenersByRow: Map<number, Set<() => void>>;
10
+ setFocus(row: number | null, field: number | null): void;
11
+ getFocus(row: number, field: number): CellFocus;
12
+ subscribe(row: number, listener: () => void): () => void;
13
+ protected notify(row: number): void;
14
+ }
15
+ export declare function useCellFocus(store: DataTableFocusStore, row: number, field: number): CellFocus;
@@ -0,0 +1,53 @@
1
+ import * as React from "react";
2
+ var CellFocus = /* @__PURE__ */ function(CellFocus) {
3
+ CellFocus[CellFocus["None"] = 0] = "None";
4
+ CellFocus[CellFocus["Secondary"] = 1] = "Secondary";
5
+ CellFocus[CellFocus["Primary"] = 2] = "Primary";
6
+ return CellFocus;
7
+ }({});
8
+ var DataTableFocusStore = class {
9
+ focusedRow = null;
10
+ focusedField = null;
11
+ listenersByRow = /* @__PURE__ */ new Map();
12
+ setFocus(row, field) {
13
+ if (row === this.focusedRow && field === this.focusedField) return;
14
+ const prevRow = this.focusedRow;
15
+ this.focusedRow = row;
16
+ this.focusedField = field;
17
+ if (prevRow != null) this.notify(prevRow);
18
+ if (row != null && row !== prevRow) this.notify(row);
19
+ }
20
+ getFocus(row, field) {
21
+ if (row !== this.focusedRow) return CellFocus.None;
22
+ return field === this.focusedField ? CellFocus.Primary : CellFocus.Secondary;
23
+ }
24
+ subscribe(row, listener) {
25
+ let listeners = this.listenersByRow.get(row);
26
+ if (listeners == null) {
27
+ listeners = /* @__PURE__ */ new Set();
28
+ this.listenersByRow.set(row, listeners);
29
+ }
30
+ listeners.add(listener);
31
+ return () => {
32
+ const current = this.listenersByRow.get(row);
33
+ if (current == null) return;
34
+ current.delete(listener);
35
+ if (current.size == 0) this.listenersByRow.delete(row);
36
+ };
37
+ }
38
+ notify(row) {
39
+ const listeners = this.listenersByRow.get(row);
40
+ if (listeners == null) return;
41
+ for (const listener of [...listeners]) listener();
42
+ }
43
+ };
44
+ function useCellFocus(store, row, field) {
45
+ const subscribe = React.useCallback((listener) => store.subscribe(row, listener), [store, row]);
46
+ const getSnapshot = React.useCallback(() => store.getFocus(row, field), [
47
+ store,
48
+ row,
49
+ field
50
+ ]);
51
+ return React.useSyncExternalStore(subscribe, getSnapshot);
52
+ }
53
+ export { CellFocus, DataTableFocusStore, useCellFocus };
@@ -0,0 +1,18 @@
1
+ import * as arrow from 'apache-arrow';
2
+ import type { ComputationColumnGroup } from '@akohn/dashql';
3
+ export interface DataTableLayout {
4
+ columnCount: number;
5
+ arrowFieldByColumnIndex: Uint32Array;
6
+ columnXOffsets: Float64Array;
7
+ columnAggregateByColumnIndex: Int32Array;
8
+ columnGroupByColumnIndex: Uint32Array;
9
+ isTextColumn: Uint8Array;
10
+ headerRowCount: number;
11
+ }
12
+ export declare const MIN_COLUMN_WIDTH = 120;
13
+ export declare const ROW_HEADER_WIDTH = 48;
14
+ export interface DataTableLayoutInput {
15
+ columnGroups: ComputationColumnGroup[];
16
+ schema: arrow.Schema;
17
+ }
18
+ export declare function computeTableLayout(state: DataTableLayoutInput, headerRowCount: number, containerWidth?: number, visibleColumnGroups?: ReadonlySet<number> | null, resizedColumnWidths?: ReadonlyMap<string, number> | null): DataTableLayout;
@@ -0,0 +1,103 @@
1
+ import { LIST_COLUMN, ORDINAL_COLUMN, ROWNUMBER_COLUMN, SKIPPED_COLUMN, STRING_COLUMN } from "@akohn/dashql/platform/compute/computation_types";
2
+ import * as arrow from "apache-arrow";
3
+ var MAX_VALUE_COLUMN_WIDTH = 300;
4
+ var MIN_COLUMN_WIDTH = 120;
5
+ var COLUMN_HEADER_ACTION_WIDTH = 24;
6
+ var ROW_HEADER_WIDTH = 48;
7
+ var NAME_CHARACTER_WIDTH = 10;
8
+ function computeColumnCount(columnGroups, visibleColumnGroups) {
9
+ let columnCount = 0;
10
+ for (let groupIndex = 0; groupIndex < columnGroups.length; ++groupIndex) {
11
+ const columnGroup = columnGroups[groupIndex];
12
+ if (columnGroup.type !== ROWNUMBER_COLUMN && visibleColumnGroups != null && !visibleColumnGroups.has(groupIndex)) continue;
13
+ if (columnGroup.type !== SKIPPED_COLUMN) ++columnCount;
14
+ }
15
+ return columnCount;
16
+ }
17
+ function computeTableLayout(state, headerRowCount, containerWidth = 0, visibleColumnGroups, resizedColumnWidths) {
18
+ const tableSchema = state.schema;
19
+ const fieldIndexByName = /* @__PURE__ */ new Map();
20
+ for (let i = 0; i < tableSchema.fields.length; ++i) fieldIndexByName.set(tableSchema.fields[i].name, i);
21
+ const columnCount = computeColumnCount(state.columnGroups, visibleColumnGroups);
22
+ const columnFields = new Uint32Array(columnCount);
23
+ const columnOffsets = new Float64Array(columnCount + 1);
24
+ const columnAggregateIndex = new Int32Array(columnCount);
25
+ const columnGroupByColumnIndex = new Uint32Array(columnCount);
26
+ const isTextColumn = new Uint8Array(columnCount);
27
+ for (let i = 0; i < columnCount; ++i) columnAggregateIndex[i] = -1;
28
+ let nextDisplayColumn = 0;
29
+ let nextDisplayOffset = 0;
30
+ for (let groupIndex = 0; groupIndex < state.columnGroups.length; ++groupIndex) {
31
+ const columnGroup = state.columnGroups[groupIndex];
32
+ if (columnGroup.type !== ROWNUMBER_COLUMN && visibleColumnGroups != null && !visibleColumnGroups.has(groupIndex)) continue;
33
+ switch (columnGroup.type) {
34
+ case ROWNUMBER_COLUMN: {
35
+ const outputIndex = nextDisplayColumn++;
36
+ columnFields[outputIndex] = fieldIndexByName.get(columnGroup.value.rowNumberFieldName);
37
+ columnOffsets[outputIndex] = nextDisplayOffset;
38
+ columnGroupByColumnIndex[outputIndex] = groupIndex;
39
+ nextDisplayOffset += 48;
40
+ break;
41
+ }
42
+ case SKIPPED_COLUMN: break;
43
+ case ORDINAL_COLUMN:
44
+ case STRING_COLUMN:
45
+ case LIST_COLUMN: {
46
+ const outputIndex = nextDisplayColumn++;
47
+ const fieldIndex = fieldIndexByName.get(columnGroup.value.inputFieldName);
48
+ const nameWidth = COLUMN_HEADER_ACTION_WIDTH + tableSchema.fields[fieldIndex].name.length * NAME_CHARACTER_WIDTH;
49
+ const valueColumnWidth = Math.min(Math.max(nameWidth, 120), MAX_VALUE_COLUMN_WIDTH);
50
+ columnFields[outputIndex] = fieldIndex;
51
+ columnOffsets[outputIndex] = nextDisplayOffset;
52
+ columnAggregateIndex[outputIndex] = groupIndex;
53
+ columnGroupByColumnIndex[outputIndex] = groupIndex;
54
+ nextDisplayOffset += valueColumnWidth;
55
+ break;
56
+ }
57
+ }
58
+ }
59
+ columnOffsets[nextDisplayColumn] = nextDisplayOffset;
60
+ for (let i = 0; i < nextDisplayColumn; ++i) {
61
+ const typeId = tableSchema.fields[columnFields[i]].type.typeId;
62
+ if (typeId === arrow.Type.Utf8 || typeId === arrow.Type.LargeUtf8) isTextColumn[i] = 1;
63
+ }
64
+ const isResizedColumn = new Uint8Array(columnCount);
65
+ if (resizedColumnWidths != null && resizedColumnWidths.size > 0) {
66
+ let naturalStart = columnOffsets[0];
67
+ for (let i = 0; i < nextDisplayColumn; ++i) {
68
+ const naturalEnd = columnOffsets[i + 1];
69
+ const resizedWidth = resizedColumnWidths.get(tableSchema.fields[columnFields[i]].name);
70
+ let width = naturalEnd - naturalStart;
71
+ if (resizedWidth !== void 0) {
72
+ width = resizedWidth;
73
+ isResizedColumn[i] = 1;
74
+ }
75
+ columnOffsets[i + 1] = columnOffsets[i] + width;
76
+ naturalStart = naturalEnd;
77
+ }
78
+ nextDisplayOffset = columnOffsets[nextDisplayColumn];
79
+ }
80
+ if (containerWidth > 0 && nextDisplayOffset < containerWidth) {
81
+ const stretchesColumn = (i) => isResizedColumn[i] == 0 && state.columnGroups[columnGroupByColumnIndex[i]].type !== ROWNUMBER_COLUMN;
82
+ let dataColumnCount = 0;
83
+ for (let i = 0; i < nextDisplayColumn; ++i) if (stretchesColumn(i)) dataColumnCount++;
84
+ if (dataColumnCount > 0) {
85
+ const extraPerColumn = (containerWidth - nextDisplayOffset) / dataColumnCount;
86
+ let accumulatedExtra = 0;
87
+ for (let i = 0; i < nextDisplayColumn; ++i) {
88
+ if (stretchesColumn(i)) accumulatedExtra += extraPerColumn;
89
+ columnOffsets[i + 1] += accumulatedExtra;
90
+ }
91
+ }
92
+ }
93
+ return {
94
+ columnCount,
95
+ arrowFieldByColumnIndex: columnFields,
96
+ columnXOffsets: columnOffsets,
97
+ columnAggregateByColumnIndex: columnAggregateIndex,
98
+ columnGroupByColumnIndex,
99
+ isTextColumn,
100
+ headerRowCount
101
+ };
102
+ }
103
+ export { MIN_COLUMN_WIDTH, ROW_HEADER_WIDTH, computeTableLayout };
@@ -0,0 +1,9 @@
1
+ import type * as arrow from 'apache-arrow';
2
+ import type { ComputationOrderBy, ComputationView } from '@akohn/dashql';
3
+ import type { ComputationDispatch } from './use_cross_filters.js';
4
+ export declare function getColumnSortDirection(field: string, ordering: ComputationOrderBy[]): boolean | null;
5
+ export declare function getNextColumnSortDirection(field: string, ordering: ComputationOrderBy[]): boolean | null;
6
+ export declare function useDataTableOrdering(table: ComputationView, dataTable: arrow.Table, dispatchComputation: ComputationDispatch): {
7
+ orderByColumn: (fieldId: number) => void;
8
+ getSortDirection: (fieldId: number) => boolean | null;
9
+ };
@@ -0,0 +1,39 @@
1
+ import * as React from "react";
2
+ function getColumnSortDirection(field, ordering) {
3
+ if (ordering.length !== 1 || ordering[0].field !== field) return null;
4
+ return ordering[0].ascending ?? true;
5
+ }
6
+ function getNextColumnSortDirection(field, ordering) {
7
+ const currentDirection = getColumnSortDirection(field, ordering);
8
+ if (currentDirection == null) return true;
9
+ return currentDirection ? false : null;
10
+ }
11
+ function useDataTableOrdering(table, dataTable, dispatchComputation) {
12
+ const activeOrderingConstraints = React.useMemo(() => {
13
+ const taskOrdering = table.tasks.orderingTask?.orderingConstraints;
14
+ return taskOrdering != null && taskOrdering.length > 0 ? taskOrdering : table.dataTableOrdering;
15
+ }, [table.dataTableOrdering, table.tasks.orderingTask?.orderingConstraints]);
16
+ return {
17
+ orderByColumn: React.useCallback((fieldId) => {
18
+ const fieldName = dataTable.schema.fields[fieldId].name;
19
+ const nextSortDirection = getNextColumnSortDirection(fieldName, activeOrderingConstraints);
20
+ dispatchComputation({
21
+ kind: "orderBy",
22
+ value: { constraints: nextSortDirection == null ? [] : [{
23
+ field: fieldName,
24
+ ascending: nextSortDirection,
25
+ nullsFirst: false
26
+ }] }
27
+ });
28
+ }, [
29
+ activeOrderingConstraints,
30
+ dataTable,
31
+ dispatchComputation
32
+ ]),
33
+ getSortDirection: React.useCallback((fieldId) => {
34
+ const fieldName = dataTable.schema.fields[fieldId].name;
35
+ return getColumnSortDirection(fieldName, activeOrderingConstraints);
36
+ }, [activeOrderingConstraints, dataTable.schema.fields])
37
+ };
38
+ }
39
+ export { getColumnSortDirection, getNextColumnSortDirection, useDataTableOrdering };
@@ -0,0 +1,9 @@
1
+ interface GridApi {
2
+ element: HTMLDivElement | null;
3
+ }
4
+ export interface DataTablePortalContainers {
5
+ header: HTMLDivElement;
6
+ data: HTMLDivElement;
7
+ }
8
+ export declare function useDataTablePortalContainers(gridApi: GridApi | null): DataTablePortalContainers | null;
9
+ export {};
@@ -0,0 +1,29 @@
1
+ import { sticky_column_portal, sticky_header_portal } from "./data_table.module.js";
2
+ import * as React from "react";
3
+ function useDataTablePortalContainers(gridApi) {
4
+ const [containers, setContainers] = React.useState(null);
5
+ React.useEffect(() => {
6
+ const gridElement = gridApi?.element;
7
+ if (!gridElement) {
8
+ setContainers(null);
9
+ return;
10
+ }
11
+ const header = document.createElement("div");
12
+ header.className = sticky_header_portal;
13
+ gridElement.prepend(header);
14
+ const data = document.createElement("div");
15
+ data.className = sticky_column_portal;
16
+ gridElement.appendChild(data);
17
+ setContainers({
18
+ header,
19
+ data
20
+ });
21
+ return () => {
22
+ header.remove();
23
+ data.remove();
24
+ setContainers(null);
25
+ };
26
+ }, [gridApi]);
27
+ return containers;
28
+ }
29
+ export { useDataTablePortalContainers };
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ import type { DataCellData, HeaderNameCellProps, HeaderPlotsCellProps } from './data_table_cell.js';
3
+ import { TableColumnHeader } from './data_table_cell.js';
4
+ import type { DataTablePortalContainers } from './data_table_portals.js';
5
+ interface StickyHeadersProps {
6
+ container: DataTablePortalContainers['header'] | null;
7
+ totalWidth: number;
8
+ headerHeight: number;
9
+ firstColumnWidth: number;
10
+ leftSpacerWidth: number;
11
+ rightSpacerWidth: number;
12
+ firstRenderedColumn: number;
13
+ renderedColumnCount: number;
14
+ getColumnWidth: (columnIndex: number) => number;
15
+ columnHeader: TableColumnHeader;
16
+ plotsHeight: number;
17
+ plotsCollapsed: boolean;
18
+ onTogglePlots: () => void;
19
+ nameCellProps: Omit<HeaderNameCellProps, 'columnIndex' | 'style' | 'sortAscending'> & {
20
+ getSortDirection: (fieldId: number) => boolean | null;
21
+ };
22
+ plotCellProps: Omit<HeaderPlotsCellProps, 'columnIndex' | 'style'>;
23
+ }
24
+ export declare const DataTableStickyHeaders: React.MemoExoticComponent<(props: StickyHeadersProps) => React.ReactPortal | null>;
25
+ interface StickyColumnProps {
26
+ container: DataTablePortalContainers['data'] | null;
27
+ firstColumnWidth: number;
28
+ totalDataHeight: number;
29
+ startRow: number;
30
+ stopRow: number;
31
+ gridData: DataCellData;
32
+ }
33
+ export declare const DataTableStickyColumn: React.MemoExoticComponent<(props: StickyColumnProps) => React.ReactPortal | null>;
34
+ export {};