@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,378 @@
1
+ import { data_grid, grid_container, more_rows, more_rows_clickable, root, root_compact, root_more_rows } from "./data_table.module.js";
2
+ import { resolveComputationTables, useComputationTables } from "./computation_tables.js";
3
+ import { TableColumnHeader } from "./data_table_cell.js";
4
+ import { classNames } from "../../dom/classnames.js";
5
+ import { computeTableLayout } from "./data_table_layout.js";
6
+ import { useCrossFilters } from "./use_cross_filters.js";
7
+ import { useObservedSize } from "../size_observer.js";
8
+ import { useLogger } from "../../logger.js";
9
+ import { DataCell } from "./data_table_cell_data.js";
10
+ import { useScrollbarHeight, useScrollbarsOverlay } from "../../dom/scrollbar.js";
11
+ import { useDataTableOrdering } from "./data_table_ordering.js";
12
+ import { useDataTablePortalContainers } from "./data_table_portals.js";
13
+ import { useDataTableColumnResize } from "./data_table_column_resize.js";
14
+ import { DataTableStickyColumn, DataTableStickyHeaders } from "./data_table_sticky_views.js";
15
+ import { DataTableFocusStore } from "./data_table_focus.js";
16
+ import { useDataTableWindow } from "./data_table_window.js";
17
+ import { peekFormat } from "./format_peek.js";
18
+ import * as React from "react";
19
+ import { jsx, jsxs } from "react/jsx-runtime";
20
+ import { stringifyError } from "@akohn/dashql/platform/logger/logger";
21
+ import { resolveSummaries } from "@akohn/dashql/platform/compute/computation_types";
22
+ import * as arrow from "apache-arrow";
23
+ import { Grid, useGridCallbackRef } from "react-window";
24
+ import { ArrowTableFormatter, arrowValueToJson, isArrowStructuredType } from "@akohn/dashql/platform/compute/arrow_formatter";
25
+ var MIN_GRID_HEIGHT = 200;
26
+ var MIN_GRID_WIDTH = 100;
27
+ var COLUMN_HEADER_HEIGHT = 32;
28
+ var COLUMN_HEADER_PLOTS_HEIGHT = 76;
29
+ var COLUMN_HEADER_PLOTS_COLLAPSED_HEIGHT = 18;
30
+ var ROW_HEIGHT = 26;
31
+ var MORE_ROWS_HEIGHT = 24;
32
+ var GRID_OVERSCAN_COUNT = 10;
33
+ var NOOP_BRUSHING = () => {};
34
+ function computeGridHeight(baseRowCount, visibleRowCount, headerHeight, scrollbarHeight, fitHeight, maxHeight, measuredHeight = 0, maxRows) {
35
+ const contentHeight = headerHeight + visibleRowCount * 26 + scrollbarHeight;
36
+ if (fitHeight) return Math.min(headerHeight + (maxRows == null ? baseRowCount : Math.min(baseRowCount, maxRows)) * 26 + scrollbarHeight, maxHeight ?? Number.POSITIVE_INFINITY);
37
+ return maxRows != null ? contentHeight : Math.max(measuredHeight, MIN_GRID_HEIGHT);
38
+ }
39
+ function fittingRowCount(height) {
40
+ return Math.max(1, Math.ceil((height - 32) / 26));
41
+ }
42
+ var DataTable = React.memo((props) => {
43
+ const tables = useComputationTables(props.model.computation, props.model.tables);
44
+ if (tables.dataTable == null) return null;
45
+ return /* @__PURE__ */ jsx(DataTableGrid, {
46
+ ...props,
47
+ dataTable: tables.dataTable
48
+ });
49
+ });
50
+ function DataTableGrid(props) {
51
+ const logger = useLogger();
52
+ const computationState = props.model.computation;
53
+ const summaryTables = props.model.tables;
54
+ const dispatchComputation = props.model.dispatch;
55
+ const dataTable = props.dataTable;
56
+ const matchingRows = useComputationTables(computationState, summaryTables).matchingRows;
57
+ const { tableAggregation, columnAggregates, filteredColumnAggregates, columnGroups } = computationState;
58
+ const dataTableHandle = computationState.dataTable;
59
+ const summaries = React.useMemo(() => resolveSummaries({
60
+ dataTable: dataTableHandle,
61
+ tableAggregation,
62
+ columnAggregates,
63
+ filteredColumnAggregates,
64
+ columnGroups
65
+ }, summaryTables, logger), [
66
+ summaryTables,
67
+ logger,
68
+ tableAggregation,
69
+ columnAggregates,
70
+ filteredColumnAggregates,
71
+ columnGroups,
72
+ dataTableHandle
73
+ ]);
74
+ const [gridApi, setGridApi] = useGridCallbackRef(null);
75
+ const gridContainerElement = React.useRef(null);
76
+ const gridContainerSize = useObservedSize(gridContainerElement);
77
+ const gridContainerWidth = Math.max(gridContainerSize?.width ?? 0, MIN_GRID_WIDTH);
78
+ const columnHeader = props.columnHeader ?? TableColumnHeader.OnlyColumnName;
79
+ const [plotsCollapsed, setPlotsCollapsed] = React.useState(false);
80
+ const togglePlots = React.useCallback(() => setPlotsCollapsed((c) => !c), []);
81
+ const plotsHeight = plotsCollapsed ? COLUMN_HEADER_PLOTS_COLLAPSED_HEIGHT : COLUMN_HEADER_PLOTS_HEIGHT;
82
+ const [renderedCells, setRenderedCells] = React.useState({
83
+ rowStart: 0,
84
+ rowStop: 0,
85
+ columnStart: 0,
86
+ columnStop: 0
87
+ });
88
+ const { window: rowWindow, rows: totalRowCount, error: rowsError, retry: retryRows } = useDataTableWindow(props.model, renderedCells.rowStart, renderedCells.rowStop);
89
+ const readRows = props.model.readRows;
90
+ const dataRowCount = props.maxRows != null ? Math.min(totalRowCount, props.maxRows) : totalRowCount;
91
+ const hiddenRowCount = totalRowCount - dataRowCount;
92
+ const showFewerRows = hiddenRowCount === 0 ? props.onShowFewerRows : void 0;
93
+ const footerRowCount = (rowsError != null ? 1 : 0) + (hiddenRowCount > 0 ? 1 : 0) + (showFewerRows != null ? 1 : 0);
94
+ const hasFooterRow = footerRowCount > 0;
95
+ const headerRowCount = columnHeader === TableColumnHeader.WithColumnPlots ? 2 : 1;
96
+ const visibleColumnGroups = React.useMemo(() => {
97
+ const matches = computationState.columnSearch.matchingColumnGroups;
98
+ return matches == null ? null : new Set(matches);
99
+ }, [computationState.columnSearch.matchingColumnGroups]);
100
+ const searchColumnIndexByGroup = React.useMemo(() => new Map(computationState.searchColumns.map((column) => [column.columnGroupIdx, column.columnIdx])), [computationState.searchColumns]);
101
+ const [resizedColumnWidths, setResizedColumnWidths] = React.useState(() => /* @__PURE__ */ new Map());
102
+ const schema = dataTable.schema;
103
+ const gridLayout = React.useMemo(() => computeTableLayout({
104
+ columnGroups,
105
+ schema
106
+ }, headerRowCount, gridContainerWidth, visibleColumnGroups, resizedColumnWidths), [
107
+ columnGroups,
108
+ schema,
109
+ gridContainerWidth,
110
+ headerRowCount,
111
+ visibleColumnGroups,
112
+ resizedColumnWidths
113
+ ]);
114
+ const getColumnWidth = React.useCallback((column) => gridLayout.columnXOffsets[column + 1] - gridLayout.columnXOffsets[column], [gridLayout]);
115
+ const { crossFilters, histogramFilter, mostFrequentValueFilter, requestFilteredColumnAggregation } = useCrossFilters(computationState, dispatchComputation, gridLayout);
116
+ const { orderByColumn, getSortDirection } = useDataTableOrdering(computationState, dataTable, dispatchComputation);
117
+ const [focusStore] = React.useState(() => new DataTableFocusStore());
118
+ const onMouseEnterCell = React.useCallback((event) => {
119
+ const tableRow = Number.parseInt(event.currentTarget.dataset["tableRow"]);
120
+ const tableCol = Number.parseInt(event.currentTarget.dataset["tableCol"]);
121
+ focusStore.setFocus(tableRow, tableCol);
122
+ }, [focusStore]);
123
+ const onMouseLeaveCell = React.useCallback((_event) => {
124
+ focusStore.setFocus(null, null);
125
+ }, [focusStore]);
126
+ const [cellDetail, setCellDetail] = React.useState(null);
127
+ const onClickCell = React.useCallback((event) => {
128
+ const visibleRow = Number.parseInt(event.currentTarget.dataset["visibleRow"]);
129
+ const fieldId = Number.parseInt(event.currentTarget.dataset["tableCol"]);
130
+ if (rowWindow == null) return;
131
+ const detail = cellDetailOf(rowWindow.table, rowWindow.formatter, visibleRow - rowWindow.offset, visibleRow, fieldId);
132
+ if (detail != null) setCellDetail(detail);
133
+ }, [rowWindow]);
134
+ const onNavigateCell = React.useCallback((delta) => {
135
+ const prev = cellDetail;
136
+ if (prev == null) return;
137
+ const visibleRow = prev.visibleRow + delta;
138
+ if (visibleRow < 0 || visibleRow >= dataRowCount) return;
139
+ const detail = rowWindow == null ? null : cellDetailOf(rowWindow.table, rowWindow.formatter, visibleRow - rowWindow.offset, visibleRow, prev.fieldId);
140
+ if (detail != null) {
141
+ setCellDetail(detail);
142
+ return;
143
+ }
144
+ readRows(visibleRow, 1).then((result) => {
145
+ const formatter = new ArrowTableFormatter(result.table.schema, result.table.batches, logger);
146
+ const read = cellDetailOf(result.table, formatter, visibleRow - result.offset, visibleRow, prev.fieldId);
147
+ if (read != null) setCellDetail((current) => current === prev ? read : current);
148
+ }, (error) => logger.warn("Failed to read the row of a cell", { error: stringifyError(error) }, "data_table"));
149
+ }, [
150
+ cellDetail,
151
+ rowWindow,
152
+ readRows,
153
+ dataRowCount,
154
+ logger
155
+ ]);
156
+ const gridData = React.useMemo(() => ({
157
+ window: rowWindow,
158
+ gridLayout,
159
+ hideRowHeader: true,
160
+ columnGroups: computationState.columnGroups,
161
+ onMouseEnter: onMouseEnterCell,
162
+ onMouseLeave: onMouseLeaveCell,
163
+ onClick: onClickCell,
164
+ focus: focusStore,
165
+ rightmostVisibleColumn: gridLayout.columnCount - 1,
166
+ matchingRows,
167
+ searchColumnIndexByGroup,
168
+ rowsFailed: rowsError != null
169
+ }), [
170
+ computationState.columnGroups,
171
+ rowWindow,
172
+ rowsError,
173
+ gridLayout,
174
+ matchingRows,
175
+ searchColumnIndexByGroup,
176
+ focusStore,
177
+ onMouseEnterCell,
178
+ onMouseLeaveCell,
179
+ onClickCell
180
+ ]);
181
+ const onCellsRendered = React.useCallback((_visibleCells, allCells) => {
182
+ setRenderedCells((prev) => {
183
+ if (prev.rowStart === allCells.rowStartIndex && prev.rowStop === allCells.rowStopIndex && prev.columnStart === allCells.columnStartIndex && prev.columnStop === allCells.columnStopIndex) return prev;
184
+ return {
185
+ rowStart: allCells.rowStartIndex,
186
+ rowStop: allCells.rowStopIndex,
187
+ columnStart: allCells.columnStartIndex,
188
+ columnStop: allCells.columnStopIndex
189
+ };
190
+ });
191
+ }, []);
192
+ const totalColumnsWidth = gridLayout.columnXOffsets[gridLayout.columnCount] ?? 0;
193
+ const firstColumnWidth = getColumnWidth(0);
194
+ const headerHeight = columnHeader === TableColumnHeader.WithColumnPlots ? 32 + plotsHeight : 32;
195
+ const scrollbarHeight = useScrollbarHeight();
196
+ const scrollbarsOverlay = useScrollbarsOverlay();
197
+ const horizontalScrollbarHeight = totalColumnsWidth > gridContainerWidth && !(scrollbarsOverlay && hasFooterRow) ? scrollbarHeight : 0;
198
+ const gridContainerHeight = props.fillHeight ? gridContainerSize?.height ?? 0 : computeGridHeight(totalRowCount, dataRowCount, headerHeight, horizontalScrollbarHeight, props.fitHeight ?? false, props.maxHeight, gridContainerSize?.height ?? 0, props.maxRows);
199
+ const firstRenderedColumn = gridLayout.columnCount > 1 ? Math.max(1, Math.min(renderedCells.columnStart, gridLayout.columnCount - 1)) : 1;
200
+ const lastRenderedColumn = gridLayout.columnCount > 1 ? Math.max(firstRenderedColumn, Math.min(renderedCells.columnStop, gridLayout.columnCount - 1)) : 0;
201
+ const renderedColumnCount = Math.max(0, lastRenderedColumn - firstRenderedColumn + 1);
202
+ const leftHeaderSpacerWidth = gridLayout.columnCount > 1 ? gridLayout.columnXOffsets[firstRenderedColumn] - firstColumnWidth : 0;
203
+ const rightHeaderSpacerWidth = lastRenderedColumn > 0 ? totalColumnsWidth - gridLayout.columnXOffsets[lastRenderedColumn + 1] : 0;
204
+ const nameCellProps = React.useMemo(() => ({
205
+ table: dataTable,
206
+ gridLayout,
207
+ dataFrame: computationState.dataFrame,
208
+ rightmostVisibleColumn: gridLayout.columnCount - 1,
209
+ getSortDirection,
210
+ onOrderByColumn: orderByColumn,
211
+ onShowTable: props.onShowTable
212
+ }), [
213
+ dataTable,
214
+ gridLayout,
215
+ computationState.dataFrame,
216
+ getSortDirection,
217
+ orderByColumn,
218
+ props.onShowTable
219
+ ]);
220
+ const selectionEpoch = computationState.filterTable?.version ?? computationState.version;
221
+ const dataSearchRequestId = computationState.dataSearchTable?.requestId ?? null;
222
+ const plotCellProps = React.useMemo(() => ({
223
+ gridLayout,
224
+ columnGroups: computationState.columnGroups,
225
+ columnAggregations: summaries.columnAggregates,
226
+ columnAggregationTasks: computationState.tasks.columnAggregationTasks,
227
+ filteredColumnAggregations: summaries.filteredColumnAggregates,
228
+ filteredColumnAggregationTasks: computationState.tasks.filteredColumnAggregationTasks,
229
+ filteredColumnAggregationOutdated: computationState.filteredColumnAggregatesOutdated,
230
+ tableAggregation: summaries.tableAggregation,
231
+ selectionEpoch,
232
+ dataSearchRequestId,
233
+ crossFilters,
234
+ isVisible: true,
235
+ rightmostVisibleColumn: gridLayout.columnCount - 1,
236
+ onRequestFilteredColumnAggregation: requestFilteredColumnAggregation,
237
+ onHistogramFilter: histogramFilter,
238
+ onBrushingChange: NOOP_BRUSHING,
239
+ onMostFrequentValueFilter: mostFrequentValueFilter
240
+ }), [
241
+ gridLayout,
242
+ computationState.columnGroups,
243
+ summaries,
244
+ computationState.tasks.columnAggregationTasks,
245
+ computationState.tasks.filteredColumnAggregationTasks,
246
+ computationState.filteredColumnAggregatesOutdated,
247
+ selectionEpoch,
248
+ dataSearchRequestId,
249
+ crossFilters,
250
+ requestFilteredColumnAggregation,
251
+ histogramFilter,
252
+ mostFrequentValueFilter
253
+ ]);
254
+ const portalContainers = useDataTablePortalContainers(gridApi);
255
+ const columnResize = useDataTableColumnResize(gridApi, gridLayout, dataTable, setResizedColumnWidths);
256
+ const totalDataHeight = dataRowCount * 26;
257
+ return /* @__PURE__ */ jsxs("div", {
258
+ className: classNames(root, props.className, {
259
+ [root_compact]: props.compact,
260
+ [root_more_rows]: hasFooterRow
261
+ }),
262
+ "data-electron-drag-region": "false",
263
+ style: {
264
+ ...props.cellBackground ? { "--data_table_bg": props.cellBackground } : {},
265
+ ...props.fitHeight ? { height: gridContainerHeight + footerRowCount * 23 } : {}
266
+ },
267
+ children: [
268
+ /* @__PURE__ */ jsxs("div", {
269
+ className: grid_container,
270
+ ref: gridContainerElement,
271
+ ...columnResize,
272
+ children: [
273
+ /* @__PURE__ */ jsx(Grid, {
274
+ gridRef: setGridApi,
275
+ style: {
276
+ width: gridContainerWidth,
277
+ height: gridContainerHeight,
278
+ overflowY: props.maxRows != null ? "hidden" : void 0
279
+ },
280
+ columnCount: gridLayout.columnCount,
281
+ columnWidth: getColumnWidth,
282
+ rowCount: dataRowCount,
283
+ rowHeight: 26,
284
+ onCellsRendered,
285
+ overscanCount: GRID_OVERSCAN_COUNT,
286
+ cellComponent: DataCell,
287
+ cellProps: gridData,
288
+ className: data_grid
289
+ }),
290
+ /* @__PURE__ */ jsx(DataTableStickyHeaders, {
291
+ container: portalContainers?.header ?? null,
292
+ totalWidth: totalColumnsWidth,
293
+ headerHeight,
294
+ firstColumnWidth,
295
+ leftSpacerWidth: leftHeaderSpacerWidth,
296
+ rightSpacerWidth: rightHeaderSpacerWidth,
297
+ firstRenderedColumn,
298
+ renderedColumnCount,
299
+ getColumnWidth,
300
+ columnHeader,
301
+ plotsHeight,
302
+ plotsCollapsed,
303
+ onTogglePlots: togglePlots,
304
+ nameCellProps,
305
+ plotCellProps
306
+ }),
307
+ /* @__PURE__ */ jsx(DataTableStickyColumn, {
308
+ container: portalContainers?.data ?? null,
309
+ firstColumnWidth,
310
+ totalDataHeight,
311
+ startRow: Math.max(0, renderedCells.rowStart),
312
+ stopRow: Math.min(dataRowCount - 1, renderedCells.rowStop),
313
+ gridData
314
+ })
315
+ ]
316
+ }),
317
+ rowsError != null && /* @__PURE__ */ jsx(TableFooterRow, {
318
+ label: `Failed to read the rows: ${rowsError}. Click to try again.`,
319
+ onClick: retryRows,
320
+ testId: "data-table-rows-failed"
321
+ }),
322
+ hiddenRowCount > 0 && /* @__PURE__ */ jsx(TableFooterRow, {
323
+ label: `${hiddenRowCount.toLocaleString()} more ${hiddenRowCount === 1 ? "row" : "rows"}`,
324
+ onClick: props.onShowMoreRows ?? props.onShowTable,
325
+ testId: "data-table-more-rows"
326
+ }),
327
+ showFewerRows != null && /* @__PURE__ */ jsx(TableFooterRow, {
328
+ label: "Show fewer rows",
329
+ onClick: showFewerRows,
330
+ testId: "data-table-fewer-rows"
331
+ }),
332
+ props.cellDetail && /* @__PURE__ */ jsx(props.cellDetail, {
333
+ isOpen: cellDetail != null,
334
+ onClose: () => setCellDetail(null),
335
+ formattedValue: cellDetail?.formattedValue ?? null,
336
+ structuredValue: cellDetail?.structuredValue ?? null,
337
+ columnName: cellDetail?.columnName ?? null,
338
+ dataRow: cellDetail?.visibleRow ?? 0,
339
+ maxRow: dataRowCount - 1,
340
+ onNavigate: onNavigateCell
341
+ })
342
+ ]
343
+ });
344
+ }
345
+ function cellDetailOf(table, formatter, row, visibleRow, fieldId) {
346
+ if (row < 0 || row >= table.numRows) return null;
347
+ const field = table.schema.fields[fieldId];
348
+ if (field == null) return null;
349
+ const isText = field.type.typeId === arrow.Type.Utf8 || field.type.typeId === arrow.Type.LargeUtf8;
350
+ const isStructured = isArrowStructuredType(field.type);
351
+ if (!isText && !isStructured) return null;
352
+ const formattedValue = formatter.getValue(row, fieldId);
353
+ const rawValue = isStructured ? table.getChildAt(fieldId)?.get(row) : null;
354
+ return {
355
+ visibleRow,
356
+ fieldId,
357
+ formattedValue,
358
+ structuredValue: rawValue == null ? null : arrowValueToJson(rawValue),
359
+ columnName: field.name ?? null
360
+ };
361
+ }
362
+ function TableFooterRow(props) {
363
+ if (props.onClick == null) return /* @__PURE__ */ jsx("div", {
364
+ className: more_rows,
365
+ style: { height: MORE_ROWS_HEIGHT },
366
+ "data-testid": props.testId,
367
+ children: props.label
368
+ });
369
+ return /* @__PURE__ */ jsx("button", {
370
+ type: "button",
371
+ className: classNames(more_rows, more_rows_clickable),
372
+ style: { height: MORE_ROWS_HEIGHT },
373
+ onClick: props.onClick,
374
+ "data-testid": props.testId,
375
+ children: props.label
376
+ });
377
+ }
378
+ export { COLUMN_HEADER_HEIGHT, DataTable, ROW_HEIGHT, TableColumnHeader, computeGridHeight, fittingRowCount, peekFormat, resolveComputationTables, useComputationTables };
@@ -0,0 +1,41 @@
1
+ var root = "dashql_root_jWkKoT";
2
+ var root_more_rows = "dashql_root_more_rows_w5qlLT";
3
+ var root_compact = "dashql_root_compact_I-tzLT";
4
+ var header_cell_name = "dashql_header_cell_name_GEtQya";
5
+ var header_cell_rightmost = "dashql_header_cell_rightmost_1JWMJe";
6
+ var grid_container = "dashql_grid_container_nrAIoP";
7
+ var more_rows = "dashql_more_rows_2ng0J5";
8
+ var more_rows_clickable = "dashql_more_rows_clickable_gXnkOt";
9
+ var column_resize_hover = "dashql_column_resize_hover_k7JEK7";
10
+ var data_grid = "dashql_data_grid_qzlw9F";
11
+ var sticky_header_portal = "dashql_sticky_header_portal_e21ld5";
12
+ var sticky_column_portal = "dashql_sticky_column_portal_LsXkAX";
13
+ var sticky_column_container = "dashql_sticky_column_container_RSWgjb";
14
+ var sticky_header_container = "dashql_sticky_header_container_8nz-iC";
15
+ var sticky_header_row = "dashql_sticky_header_row_k4jXSK";
16
+ var header_cell = "dashql_header_cell_k1wD7P";
17
+ var header_cell_clickable = "dashql_header_cell_clickable_MgOuEO";
18
+ var header_cell_actions = "dashql_header_cell_actions_7ZEjUb";
19
+ var header_corner_cell = "dashql_header_corner_cell_1SM_t4";
20
+ var plots_cell = "dashql_plots_cell_tKLgvS";
21
+ var plots_cell_rightmost = "dashql_plots_cell_rightmost_Qwapbw";
22
+ var plots_empty_cell = "dashql_plots_empty_cell_uHF1JJ";
23
+ var plots_no_summary_cell = "dashql_plots_no_summary_cell_Kcn03h";
24
+ var plots_no_summary_label = "dashql_plots_no_summary_label_QMlnhw";
25
+ var plots_progress = "dashql_plots_progress_Yhk4x0";
26
+ var plots_progress_spinner = "dashql_plots_progress_spinner_n8DYbU";
27
+ var plots_toggle = "dashql_plots_toggle_3vXAdD";
28
+ var plots_collapsed_cell = "dashql_plots_collapsed_cell_Zb3ndp";
29
+ var plots_corner_cell = "dashql_plots_corner_cell_T3tfrj";
30
+ var row_header_cell = "dashql_row_header_cell_Jmi9dz";
31
+ var data_cell = "dashql_data_cell_dmjbw0";
32
+ var data_cell_null = "dashql_data_cell_null_Lo4LHV";
33
+ var data_cell_rightmost = "dashql_data_cell_rightmost_Jbu5Yi";
34
+ var data_cell_focused_primary = "dashql_data_cell_focused_primary_wYX8aJ";
35
+ var data_cell_focused_secondary = "dashql_data_cell_focused_secondary_3AdBHa";
36
+ var data_cell_search_match = "dashql_data_cell_search_match_Ypa-yr";
37
+ var data_cell_text = "dashql_data_cell_text_vnDSPE";
38
+ var format_bean = "dashql_format_bean_y1cccz";
39
+ var data_cell_skeleton = "dashql_data_cell_skeleton_VIU2XN";
40
+ var data_cell_skeleton_bar = "dashql_data_cell_skeleton_bar_fKafAg";
41
+ export { column_resize_hover, data_cell, data_cell_focused_primary, data_cell_focused_secondary, data_cell_null, data_cell_rightmost, data_cell_search_match, data_cell_skeleton, data_cell_skeleton_bar, data_cell_text, data_grid, format_bean, grid_container, header_cell, header_cell_actions, header_cell_clickable, header_cell_name, header_cell_rightmost, header_corner_cell, more_rows, more_rows_clickable, plots_cell, plots_cell_rightmost, plots_collapsed_cell, plots_corner_cell, plots_empty_cell, plots_no_summary_cell, plots_no_summary_label, plots_progress, plots_progress_spinner, plots_toggle, root, root_compact, root_more_rows, row_header_cell, sticky_column_container, sticky_column_portal, sticky_header_container, sticky_header_portal, sticky_header_row };
@@ -0,0 +1,7 @@
1
+ export { HeaderNameCell, type HeaderNameCellProps } from './data_table_cell_header_name.js';
2
+ export { HeaderPlotsCell, type HeaderPlotsCellProps } from './data_table_cell_header_plots.js';
3
+ export { DataCell, type DataCellData } from './data_table_cell_data.js';
4
+ export declare enum TableColumnHeader {
5
+ OnlyColumnName = 0,
6
+ WithColumnPlots = 1
7
+ }
@@ -0,0 +1,9 @@
1
+ import { HeaderNameCell } from "./data_table_cell_header_name.js";
2
+ import { HeaderPlotsCell } from "./data_table_cell_header_plots.js";
3
+ import { DataCell } from "./data_table_cell_data.js";
4
+ var TableColumnHeader = /* @__PURE__ */ function(TableColumnHeader) {
5
+ TableColumnHeader[TableColumnHeader["OnlyColumnName"] = 0] = "OnlyColumnName";
6
+ TableColumnHeader[TableColumnHeader["WithColumnPlots"] = 1] = "WithColumnPlots";
7
+ return TableColumnHeader;
8
+ }({});
9
+ export { DataCell, HeaderNameCell, HeaderPlotsCell, TableColumnHeader };
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import type { CellComponentProps } from 'react-window';
3
+ import type { ComputationColumnGroup } from '@akohn/dashql';
4
+ import { DataTableLayout } from './data_table_layout.js';
5
+ import type { DataTableWindow } from './data_table_window.js';
6
+ import { DataTableFocusStore } from './data_table_focus.js';
7
+ export interface DataCellData {
8
+ columnGroups: ComputationColumnGroup[];
9
+ focus: DataTableFocusStore;
10
+ gridLayout: DataTableLayout;
11
+ hideRowHeader: boolean;
12
+ window: DataTableWindow | null;
13
+ rowsFailed: boolean;
14
+ rightmostVisibleColumn: number;
15
+ matchingRows: ReadonlyMap<number, number[]> | null;
16
+ searchColumnIndexByGroup: ReadonlyMap<number, number>;
17
+ onMouseEnter: (event: React.PointerEvent<HTMLDivElement>) => void;
18
+ onMouseLeave: (event: React.PointerEvent<HTMLDivElement>) => void;
19
+ onClick: (event: React.MouseEvent<HTMLDivElement>) => void;
20
+ }
21
+ export declare function DataCell(props: CellComponentProps<DataCellData>): React.ReactElement | null;
@@ -0,0 +1,99 @@
1
+ import { data_cell, data_cell_focused_primary, data_cell_focused_secondary, data_cell_null, data_cell_rightmost, data_cell_search_match, data_cell_text, format_bean, row_header_cell } from "./data_table.module.js";
2
+ import { Tag } from "../tag.js";
3
+ import { peekFormat } from "./format_peek.js";
4
+ import { CellFocus, useCellFocus } from "./data_table_focus.js";
5
+ import * as React from "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import * as arrow from "apache-arrow";
8
+ import { isArrowListType } from "@akohn/dashql/platform/compute/arrow_formatter";
9
+ var MAX_CELL_TEXT_LENGTH = 256;
10
+ function truncateCellText(text) {
11
+ return text.length > MAX_CELL_TEXT_LENGTH ? `${text.slice(0, MAX_CELL_TEXT_LENGTH)}…` : text;
12
+ }
13
+ var SKELETON_PULSE_MS = 1600;
14
+ function skeletonWidth(row, column) {
15
+ return 35 + (row * 7 + column * 13) % 5 * 10;
16
+ }
17
+ function DataCell(props) {
18
+ const inLayout = props.columnIndex < props.gridLayout.arrowFieldByColumnIndex.length;
19
+ const isHiddenRowHeader = props.columnIndex === 0 && props.hideRowHeader;
20
+ const fieldId = inLayout ? props.gridLayout.arrowFieldByColumnIndex[props.columnIndex] : -1;
21
+ const rowWindow = props.window;
22
+ const windowRow = rowWindow == null ? -1 : props.rowIndex - rowWindow.offset;
23
+ const loaded = rowWindow != null && windowRow >= 0 && windowRow < rowWindow.table.numRows;
24
+ const dataRow = loaded ? rowWindow.dataRows[windowRow] : -1;
25
+ const focus = useCellFocus(props.focus, inLayout && !isHiddenRowHeader && loaded ? dataRow : -1, fieldId);
26
+ const formatted = inLayout && !isHiddenRowHeader && loaded ? rowWindow.formatter.getValue(windowRow, fieldId) : null;
27
+ const peekText = inLayout && props.columnIndex !== 0 && props.gridLayout.isTextColumn[props.columnIndex] === 1;
28
+ const peekedFormat = React.useMemo(() => peekText ? peekFormat(formatted) : null, [peekText, formatted]);
29
+ if (!inLayout) return /* @__PURE__ */ jsx("div", { style: props.style });
30
+ if (isHiddenRowHeader) return null;
31
+ if (!loaded) return /* @__PURE__ */ jsx("div", {
32
+ className: props.columnIndex == 0 ? row_header_cell : data_cell,
33
+ style: props.style,
34
+ "data-table-col": fieldId,
35
+ "data-visible-row": props.rowIndex,
36
+ "data-loading": props.rowsFailed ? void 0 : "true",
37
+ children: !props.rowsFailed && /* @__PURE__ */ jsx("span", {
38
+ className: "dashql_data_cell_skeleton_VIU2XN",
39
+ children: /* @__PURE__ */ jsx("span", {
40
+ className: "dashql_data_cell_skeleton_bar_fKafAg",
41
+ style: {
42
+ width: `${skeletonWidth(props.rowIndex, props.columnIndex)}%`,
43
+ animationDelay: `${-(performance.now() % SKELETON_PULSE_MS)}ms`
44
+ }
45
+ })
46
+ })
47
+ });
48
+ const isRowFocused = focus !== CellFocus.None;
49
+ if (props.columnIndex == 0) {
50
+ const className = isRowFocused ? `${row_header_cell} ${data_cell_focused_secondary}` : row_header_cell;
51
+ return /* @__PURE__ */ jsx("div", {
52
+ className,
53
+ style: props.style,
54
+ children: formatted ?? ""
55
+ });
56
+ } else {
57
+ const isNull = formatted == null;
58
+ const displayText = isNull ? null : truncateCellText(formatted);
59
+ const isRightmost = props.columnIndex === props.rightmostVisibleColumn;
60
+ const searchColumnIndex = props.searchColumnIndexByGroup.get(props.gridLayout.columnGroupByColumnIndex[props.columnIndex]);
61
+ const isSearchMatch = searchColumnIndex != null && props.matchingRows?.get(dataRow + 1)?.includes(searchColumnIndex) === true;
62
+ let className;
63
+ if (isNull) className = `${data_cell} ${data_cell_null}`;
64
+ else className = data_cell;
65
+ if (isRowFocused) className += focus === CellFocus.Primary ? ` ${data_cell_focused_primary}` : ` ${data_cell_focused_secondary}`;
66
+ if (isRightmost) className += ` ${data_cell_rightmost}`;
67
+ if (isSearchMatch) className += ` ${data_cell_search_match}`;
68
+ const field = rowWindow.table.schema.fields[fieldId];
69
+ const canOpenDetail = field.type.typeId === arrow.Type.Utf8 || field.type.typeId === arrow.Type.LargeUtf8 || isArrowListType(field.type) || field.type.typeId === arrow.Type.Struct;
70
+ const hint = !isNull && isArrowListType(field.type) ? "array" : !isNull && field.type.typeId === arrow.Type.Struct ? "struct" : peekedFormat;
71
+ return /* @__PURE__ */ jsx("div", {
72
+ className,
73
+ style: props.style,
74
+ role: "gridcell",
75
+ "aria-label": isSearchMatch ? `${isNull ? "NULL" : displayText}${hint == null ? "" : `, ${hint}`}, search match` : void 0,
76
+ tabIndex: canOpenDetail ? 0 : -1,
77
+ "data-table-col": fieldId,
78
+ "data-table-row": dataRow,
79
+ "data-visible-row": props.rowIndex,
80
+ onMouseEnter: props.onMouseEnter,
81
+ onMouseLeave: props.onMouseLeave,
82
+ onClick: props.onClick,
83
+ onKeyDown: (event) => {
84
+ if (canOpenDetail && (event.key === "Enter" || event.key === " ")) {
85
+ event.preventDefault();
86
+ event.currentTarget.click();
87
+ }
88
+ },
89
+ children: hint != null ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
90
+ className: data_cell_text,
91
+ children: displayText
92
+ }), /* @__PURE__ */ jsx(Tag, {
93
+ className: format_bean,
94
+ children: hint
95
+ })] }) : isNull ? "NULL" : displayText
96
+ });
97
+ }
98
+ }
99
+ export { DataCell };
@@ -0,0 +1,17 @@
1
+ import * as arrow from 'apache-arrow';
2
+ import * as React from 'react';
3
+ import { DataTableLayout } from './data_table_layout.js';
4
+ export interface HeaderNameCellProps {
5
+ columnIndex: number;
6
+ style: React.CSSProperties;
7
+ table: arrow.Table;
8
+ gridLayout: DataTableLayout;
9
+ dataFrame: number | null;
10
+ rightmostVisibleColumn: number;
11
+ sortAscending: boolean | null;
12
+ onOrderByColumn: (col: number) => void;
13
+ onShowTable?: () => void;
14
+ }
15
+ declare function HeaderNameCellImpl(props: HeaderNameCellProps): React.ReactElement;
16
+ export declare const HeaderNameCell: React.MemoExoticComponent<typeof HeaderNameCellImpl>;
17
+ export {};
@@ -0,0 +1,73 @@
1
+ import { header_cell, header_cell_actions, header_cell_clickable, header_cell_name, header_cell_rightmost, header_corner_cell } from "./data_table.module.js";
2
+ import { classNames } from "../../dom/classnames.js";
3
+ import { ButtonSize, ButtonVariant, IconButton } from "../button.js";
4
+ import { arePropsEqualWithStyle } from "./memo_props.js";
5
+ import * as React from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import symbols from "../../svg_symbols.js";
8
+ function HeaderNameCellImpl(props) {
9
+ if (props.columnIndex >= props.gridLayout.arrowFieldByColumnIndex.length) return /* @__PURE__ */ jsx("div", { style: props.style });
10
+ const fieldId = props.gridLayout.arrowFieldByColumnIndex[props.columnIndex];
11
+ const fieldName = props.table.schema.fields[fieldId].name;
12
+ const isSorted = props.sortAscending != null;
13
+ const sortLabel = `Sort ${fieldName}; currently ${props.sortAscending == null ? "unsorted" : props.sortAscending ? "ascending" : "descending"}`;
14
+ const sortIcon = props.sortAscending === false ? "sort_desc_16" : "sort_asc_16";
15
+ const sortButtonVariant = isSorted ? ButtonVariant.Default : ButtonVariant.Invisible;
16
+ if (props.columnIndex == 0) return /* @__PURE__ */ jsx("div", {
17
+ className: classNames(header_corner_cell, { [header_cell_clickable]: props.onShowTable != null }),
18
+ style: props.style,
19
+ onClick: props.onShowTable,
20
+ children: /* @__PURE__ */ jsx("span", {
21
+ className: header_cell_actions,
22
+ children: /* @__PURE__ */ jsx(IconButton, {
23
+ variant: sortButtonVariant,
24
+ size: ButtonSize.Small,
25
+ "aria-label": sortLabel,
26
+ onClick: (e) => {
27
+ e.stopPropagation();
28
+ props.onOrderByColumn(fieldId);
29
+ },
30
+ disabled: props.dataFrame == null,
31
+ children: /* @__PURE__ */ jsx("svg", {
32
+ width: "16px",
33
+ height: "16px",
34
+ children: /* @__PURE__ */ jsx("use", { xlinkHref: `${symbols}#${sortIcon}` })
35
+ })
36
+ })
37
+ })
38
+ });
39
+ else {
40
+ const isRightmost = props.columnIndex === props.rightmostVisibleColumn;
41
+ return /* @__PURE__ */ jsxs("div", {
42
+ className: classNames(header_cell, {
43
+ [header_cell_rightmost]: isRightmost,
44
+ [header_cell_clickable]: props.onShowTable != null
45
+ }),
46
+ style: props.style,
47
+ onClick: props.onShowTable,
48
+ children: [/* @__PURE__ */ jsx("span", {
49
+ className: header_cell_name,
50
+ children: fieldName
51
+ }), /* @__PURE__ */ jsx("span", {
52
+ className: header_cell_actions,
53
+ children: /* @__PURE__ */ jsx(IconButton, {
54
+ variant: sortButtonVariant,
55
+ size: ButtonSize.Small,
56
+ "aria-label": sortLabel,
57
+ onClick: (e) => {
58
+ e.stopPropagation();
59
+ props.onOrderByColumn(fieldId);
60
+ },
61
+ disabled: props.dataFrame == null,
62
+ children: /* @__PURE__ */ jsx("svg", {
63
+ width: "16px",
64
+ height: "16px",
65
+ children: /* @__PURE__ */ jsx("use", { xlinkHref: `${symbols}#${sortIcon}` })
66
+ })
67
+ })
68
+ })]
69
+ });
70
+ }
71
+ }
72
+ var HeaderNameCell = React.memo(HeaderNameCellImpl, arePropsEqualWithStyle);
73
+ export { HeaderNameCell };