@akohn/dashql-react 0.0.20-dev.873.gb84ef9086 → 0.0.20-dev.908.gd791a771f

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.
@@ -32,6 +32,8 @@ export interface DataTableProps {
32
32
  type Props = DataTableProps;
33
33
  export declare const COLUMN_HEADER_HEIGHT = 32;
34
34
  export declare const ROW_HEIGHT = 26;
35
- export declare function computeGridHeight(baseRowCount: number, visibleRowCount: number, headerHeight: number, scrollbarHeight: number, fitHeight: boolean, maxHeight?: number, measuredHeight?: number, maxRows?: number): number;
36
- export declare function fittingRowCount(height: number): number;
35
+ export declare const TOUCH_ROW_HEIGHT = 36;
36
+ export declare function useDataTableRowHeight(): number;
37
+ export declare function computeGridHeight(baseRowCount: number, visibleRowCount: number, headerHeight: number, scrollbarHeight: number, fitHeight: boolean, maxHeight?: number, measuredHeight?: number, maxRows?: number, rowHeight?: number): number;
38
+ export declare function fittingRowCount(height: number, rowHeight?: number): number;
37
39
  export declare const DataTable: React.MemoExoticComponent<(props: Props) => React.JSX.Element | null>;
@@ -8,12 +8,14 @@ import { useObservedSize } from "../size_observer.js";
8
8
  import { useLogger } from "../../logger.js";
9
9
  import { DataCell } from "./data_table_cell_data.js";
10
10
  import { useScrollbarHeight, useScrollbarsOverlay } from "../../dom/scrollbar.js";
11
+ import { useMediaQuery } from "../../dom/media_query.js";
11
12
  import { useDataTableOrdering } from "./data_table_ordering.js";
12
13
  import { useDataTablePortalContainers } from "./data_table_portals.js";
13
14
  import { useDataTableColumnResize } from "./data_table_column_resize.js";
14
15
  import { DataTableStickyColumn, DataTableStickyHeaders } from "./data_table_sticky_views.js";
15
16
  import { DataTableFocusStore } from "./data_table_focus.js";
16
17
  import { useDataTableWindow } from "./data_table_window.js";
18
+ import { DataTableRowDetail, rowDetailOf } from "./data_table_row_detail.js";
17
19
  import { peekFormat } from "./format_peek.js";
18
20
  import * as React from "react";
19
21
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -28,15 +30,19 @@ var COLUMN_HEADER_HEIGHT = 32;
28
30
  var COLUMN_HEADER_PLOTS_HEIGHT = 76;
29
31
  var COLUMN_HEADER_PLOTS_COLLAPSED_HEIGHT = 18;
30
32
  var ROW_HEIGHT = 26;
33
+ var TOUCH_ROW_HEIGHT = 36;
34
+ function useDataTableRowHeight() {
35
+ return useMediaQuery("(pointer: coarse)") ? 36 : 26;
36
+ }
31
37
  var MORE_ROWS_HEIGHT = 24;
32
38
  var GRID_OVERSCAN_COUNT = 10;
33
- function computeGridHeight(baseRowCount, visibleRowCount, headerHeight, scrollbarHeight, fitHeight, maxHeight, measuredHeight = 0, maxRows) {
34
- const contentHeight = headerHeight + visibleRowCount * 26 + scrollbarHeight;
35
- if (fitHeight) return Math.min(headerHeight + (maxRows == null ? baseRowCount : Math.min(baseRowCount, maxRows)) * 26 + scrollbarHeight, maxHeight ?? Number.POSITIVE_INFINITY);
39
+ function computeGridHeight(baseRowCount, visibleRowCount, headerHeight, scrollbarHeight, fitHeight, maxHeight, measuredHeight = 0, maxRows, rowHeight = 26) {
40
+ const contentHeight = headerHeight + visibleRowCount * rowHeight + scrollbarHeight;
41
+ if (fitHeight) return Math.min(headerHeight + (maxRows == null ? baseRowCount : Math.min(baseRowCount, maxRows)) * rowHeight + scrollbarHeight, maxHeight ?? Number.POSITIVE_INFINITY);
36
42
  return maxRows != null ? contentHeight : Math.max(measuredHeight, MIN_GRID_HEIGHT);
37
43
  }
38
- function fittingRowCount(height) {
39
- return Math.max(1, Math.ceil((height - 32) / 26));
44
+ function fittingRowCount(height, rowHeight = 26) {
45
+ return Math.max(1, Math.ceil((height - 32) / rowHeight));
40
46
  }
41
47
  var DataTable = React.memo((props) => {
42
48
  const tables = useComputationTables(props.model.computation, props.model.tables);
@@ -87,6 +93,7 @@ function DataTableGrid(props) {
87
93
  });
88
94
  const { window: rowWindow, rows: totalRowCount, error: rowsError, retry: retryRows } = useDataTableWindow(props.model, renderedCells.rowStart, renderedCells.rowStop);
89
95
  const readRows = props.model.readRows;
96
+ const rowHeight = useDataTableRowHeight();
90
97
  const dataRowCount = props.maxRows != null ? Math.min(totalRowCount, props.maxRows) : totalRowCount;
91
98
  const hiddenRowCount = totalRowCount - dataRowCount;
92
99
  const showFewerRows = hiddenRowCount === 0 ? props.onShowFewerRows : void 0;
@@ -153,6 +160,32 @@ function DataTableGrid(props) {
153
160
  dataRowCount,
154
161
  logger
155
162
  ]);
163
+ const [rowDetail, setRowDetail] = React.useState(null);
164
+ const showRow = React.useCallback((visibleRow) => {
165
+ if (visibleRow < 0 || visibleRow >= dataRowCount) return;
166
+ const detail = rowWindow == null ? null : rowDetailOf(rowWindow.table, rowWindow.formatter, gridLayout, visibleRow - rowWindow.offset, visibleRow);
167
+ if (detail != null) {
168
+ setRowDetail(detail);
169
+ return;
170
+ }
171
+ readRows(visibleRow, 1).then((result) => {
172
+ const formatter = new ArrowTableFormatter(result.table.schema, result.table.batches, logger);
173
+ const read = rowDetailOf(result.table, formatter, gridLayout, visibleRow - result.offset, visibleRow);
174
+ if (read != null) setRowDetail(read);
175
+ }, (error) => logger.warn("Failed to read a row", { error: stringifyError(error) }, "data_table"));
176
+ }, [
177
+ rowWindow,
178
+ gridLayout,
179
+ readRows,
180
+ dataRowCount,
181
+ logger
182
+ ]);
183
+ const onClickRowHeader = React.useCallback((event) => {
184
+ showRow(Number.parseInt(event.currentTarget.dataset["visibleRow"]));
185
+ }, [showRow]);
186
+ const navigateRow = React.useCallback((delta) => {
187
+ if (rowDetail != null) showRow(rowDetail.visibleRow + delta);
188
+ }, [rowDetail, showRow]);
156
189
  const gridData = React.useMemo(() => ({
157
190
  window: rowWindow,
158
191
  gridLayout,
@@ -161,6 +194,7 @@ function DataTableGrid(props) {
161
194
  onMouseEnter: onMouseEnterCell,
162
195
  onMouseLeave: onMouseLeaveCell,
163
196
  onClick: onClickCell,
197
+ onClickRowHeader,
164
198
  focus: focusStore,
165
199
  rightmostVisibleColumn: gridLayout.columnCount - 1,
166
200
  matchingRows,
@@ -176,7 +210,8 @@ function DataTableGrid(props) {
176
210
  focusStore,
177
211
  onMouseEnterCell,
178
212
  onMouseLeaveCell,
179
- onClickCell
213
+ onClickCell,
214
+ onClickRowHeader
180
215
  ]);
181
216
  const onCellsRendered = React.useCallback((_visibleCells, allCells) => {
182
217
  setRenderedCells((prev) => {
@@ -195,7 +230,7 @@ function DataTableGrid(props) {
195
230
  const scrollbarHeight = useScrollbarHeight();
196
231
  const scrollbarsOverlay = useScrollbarsOverlay();
197
232
  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);
233
+ const gridContainerHeight = props.fillHeight ? gridContainerSize?.height ?? 0 : computeGridHeight(totalRowCount, dataRowCount, headerHeight, horizontalScrollbarHeight, props.fitHeight ?? false, props.maxHeight, gridContainerSize?.height ?? 0, props.maxRows, rowHeight);
199
234
  const firstRenderedColumn = gridLayout.columnCount > 1 ? Math.max(1, Math.min(renderedCells.columnStart, gridLayout.columnCount - 1)) : 1;
200
235
  const lastRenderedColumn = gridLayout.columnCount > 1 ? Math.max(firstRenderedColumn, Math.min(renderedCells.columnStop, gridLayout.columnCount - 1)) : 0;
201
236
  const renderedColumnCount = Math.max(0, lastRenderedColumn - firstRenderedColumn + 1);
@@ -251,7 +286,7 @@ function DataTableGrid(props) {
251
286
  ]);
252
287
  const portalContainers = useDataTablePortalContainers(gridApi);
253
288
  const columnResize = useDataTableColumnResize(gridApi, gridLayout, dataTable, setResizedColumnWidths);
254
- const totalDataHeight = dataRowCount * 26;
289
+ const totalDataHeight = dataRowCount * rowHeight;
255
290
  return /* @__PURE__ */ jsxs("div", {
256
291
  className: classNames(root, props.className, {
257
292
  [root_compact]: props.compact,
@@ -275,7 +310,7 @@ function DataTableGrid(props) {
275
310
  columnCount: gridLayout.columnCount,
276
311
  columnWidth: getColumnWidth,
277
312
  rowCount: dataRowCount,
278
- rowHeight: 26,
313
+ rowHeight,
279
314
  onCellsRendered,
280
315
  overscanCount: GRID_OVERSCAN_COUNT,
281
316
  cellComponent: DataCell,
@@ -301,6 +336,7 @@ function DataTableGrid(props) {
301
336
  }),
302
337
  /* @__PURE__ */ jsx(DataTableStickyColumn, {
303
338
  container: portalContainers?.data ?? null,
339
+ rowHeight,
304
340
  firstColumnWidth,
305
341
  totalDataHeight,
306
342
  startRow: Math.max(0, renderedCells.rowStart),
@@ -333,6 +369,12 @@ function DataTableGrid(props) {
333
369
  dataRow: cellDetail?.visibleRow ?? 0,
334
370
  maxRow: dataRowCount - 1,
335
371
  onNavigate: onNavigateCell
372
+ }),
373
+ rowDetail != null && /* @__PURE__ */ jsx(DataTableRowDetail, {
374
+ detail: rowDetail,
375
+ rowCount: dataRowCount,
376
+ onNavigate: navigateRow,
377
+ onClose: () => setRowDetail(null)
336
378
  })
337
379
  ]
338
380
  });
@@ -370,4 +412,4 @@ function TableFooterRow(props) {
370
412
  children: props.label
371
413
  });
372
414
  }
373
- export { COLUMN_HEADER_HEIGHT, DataTable, ROW_HEIGHT, TableColumnHeader, computeGridHeight, fittingRowCount, peekFormat, resolveComputationTables, useComputationTables };
415
+ export { COLUMN_HEADER_HEIGHT, DataTable, ROW_HEIGHT, TOUCH_ROW_HEIGHT, TableColumnHeader, computeGridHeight, fittingRowCount, peekFormat, resolveComputationTables, useComputationTables, useDataTableRowHeight };
@@ -17,5 +17,6 @@ export interface DataCellData {
17
17
  onMouseEnter: (event: React.PointerEvent<HTMLDivElement>) => void;
18
18
  onMouseLeave: (event: React.PointerEvent<HTMLDivElement>) => void;
19
19
  onClick: (event: React.MouseEvent<HTMLDivElement>) => void;
20
+ onClickRowHeader: (event: React.MouseEvent<HTMLDivElement>) => void;
20
21
  }
21
22
  export declare function DataCell(props: CellComponentProps<DataCellData>): React.ReactElement | null;
@@ -51,6 +51,10 @@ function DataCell(props) {
51
51
  return /* @__PURE__ */ jsx("div", {
52
52
  className,
53
53
  style: props.style,
54
+ "data-visible-row": props.rowIndex,
55
+ "data-testid": "data-table-row-number",
56
+ title: "Show the fields of the row",
57
+ onClick: props.onClickRowHeader,
54
58
  children: formatted ?? ""
55
59
  });
56
60
  } else {
@@ -0,0 +1,22 @@
1
+ import * as arrow from 'apache-arrow';
2
+ import * as React from 'react';
3
+ import { type ArrowTableFormatter } from '@akohn/dashql/platform/compute/arrow_formatter';
4
+ import type { DataTableLayout } from './data_table_layout.js';
5
+ export interface RowDetailField {
6
+ name: string;
7
+ type: string;
8
+ value: string | null;
9
+ }
10
+ export interface RowDetail {
11
+ visibleRow: number;
12
+ fields: RowDetailField[];
13
+ }
14
+ export declare function rowDetailOf(table: arrow.Table, formatter: ArrowTableFormatter, layout: DataTableLayout, row: number, visibleRow: number): RowDetail | null;
15
+ interface Props {
16
+ detail: RowDetail;
17
+ rowCount: number;
18
+ onNavigate: (delta: number) => void;
19
+ onClose: () => void;
20
+ }
21
+ export declare function DataTableRowDetail(props: Props): React.ReactElement;
22
+ export {};
@@ -0,0 +1,68 @@
1
+ import { field, fields, name, type, value, value_null } from "./data_table_row_detail.module.js";
2
+ import { ButtonSize, ButtonVariant, IconButton } from "../button.js";
3
+ import { Sheet } from "../sheet.js";
4
+ import { ChevronDownIcon, ChevronUpIcon } from "../symbol_icon.js";
5
+ import "react";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { dataTypeToString } from "@akohn/dashql/platform/compute/arrow_formatter";
8
+ function rowDetailOf(table, formatter, layout, row, visibleRow) {
9
+ if (row < 0 || row >= table.numRows) return null;
10
+ const fields = [];
11
+ for (let column = 1; column < layout.arrowFieldByColumnIndex.length; ++column) {
12
+ const fieldId = layout.arrowFieldByColumnIndex[column];
13
+ const field = table.schema.fields[fieldId];
14
+ if (field == null) continue;
15
+ fields.push({
16
+ name: field.name,
17
+ type: dataTypeToString(field.type),
18
+ value: formatter.getValue(row, fieldId)
19
+ });
20
+ }
21
+ return {
22
+ visibleRow,
23
+ fields
24
+ };
25
+ }
26
+ function DataTableRowDetail(props) {
27
+ const { detail, rowCount, onNavigate } = props;
28
+ return /* @__PURE__ */ jsx(Sheet, {
29
+ title: `Row ${detail.visibleRow + 1} of ${rowCount}`,
30
+ onClose: props.onClose,
31
+ "data-testid": "data-table-row-detail",
32
+ actions: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(IconButton, {
33
+ size: ButtonSize.Small,
34
+ variant: ButtonVariant.Invisible,
35
+ "aria-label": "Previous row",
36
+ "data-testid": "data-table-row-previous",
37
+ disabled: detail.visibleRow <= 0,
38
+ onClick: () => onNavigate(-1),
39
+ children: /* @__PURE__ */ jsx(ChevronUpIcon, { size: 16 })
40
+ }), /* @__PURE__ */ jsx(IconButton, {
41
+ size: ButtonSize.Small,
42
+ variant: ButtonVariant.Invisible,
43
+ "aria-label": "Next row",
44
+ "data-testid": "data-table-row-next",
45
+ disabled: detail.visibleRow >= rowCount - 1,
46
+ onClick: () => onNavigate(1),
47
+ children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: 16 })
48
+ })] }),
49
+ children: /* @__PURE__ */ jsx("dl", {
50
+ className: fields,
51
+ children: detail.fields.map((field$1, index) => /* @__PURE__ */ jsxs("div", {
52
+ className: field,
53
+ "data-testid": "data-table-row-field",
54
+ children: [/* @__PURE__ */ jsxs("dt", {
55
+ className: name,
56
+ children: [field$1.name, /* @__PURE__ */ jsx("span", {
57
+ className: type,
58
+ children: field$1.type
59
+ })]
60
+ }), /* @__PURE__ */ jsx("dd", {
61
+ className: field$1.value == null ? `${value} ${value_null}` : value,
62
+ children: field$1.value ?? "null"
63
+ })]
64
+ }, index))
65
+ })
66
+ });
67
+ }
68
+ export { DataTableRowDetail, rowDetailOf };
@@ -0,0 +1,7 @@
1
+ var fields = "dashql_fields_jOg5bq";
2
+ var field = "dashql_field_D9hR7-";
3
+ var name = "dashql_name_GCEkkk";
4
+ var type = "dashql_type_9zm-Uu";
5
+ var value = "dashql_value_ZkMNpe";
6
+ var value_null = "dashql_value_null_Ypwy0D";
7
+ export { field, fields, name, type, value, value_null };
@@ -25,6 +25,7 @@ export declare const DataTableStickyHeaders: React.MemoExoticComponent<(props: S
25
25
  interface StickyColumnProps {
26
26
  container: DataTablePortalContainers['data'] | null;
27
27
  firstColumnWidth: number;
28
+ rowHeight: number;
28
29
  totalDataHeight: number;
29
30
  startRow: number;
30
31
  stopRow: number;
@@ -137,10 +137,10 @@ var DataTableStickyColumn = React.memo((props) => {
137
137
  return /* @__PURE__ */ jsx("div", {
138
138
  style: {
139
139
  position: "absolute",
140
- top: rowIndex * 26,
140
+ top: rowIndex * props.rowHeight,
141
141
  left: 0,
142
142
  width: props.firstColumnWidth,
143
- height: 26,
143
+ height: props.rowHeight,
144
144
  pointerEvents: "auto"
145
145
  },
146
146
  children: /* @__PURE__ */ jsx(StickyRowHeaderCell, {
@@ -149,7 +149,7 @@ var DataTableStickyColumn = React.memo((props) => {
149
149
  columnIndex: 0,
150
150
  style: {
151
151
  width: props.firstColumnWidth,
152
- height: 26
152
+ height: props.rowHeight
153
153
  },
154
154
  ...props.gridData,
155
155
  hideRowHeader: false
@@ -1,7 +1,7 @@
1
1
  import { panel, panel_body } from "./query_result_header.module.js";
2
2
  import { TabHeader } from "../tab_header.js";
3
3
  import { QueryStatusPlaceholder } from "../card_placeholder.js";
4
- import { fittingRowCount } from "../data_table/data_table.js";
4
+ import { fittingRowCount, useDataTableRowHeight } from "../data_table/data_table.js";
5
5
  import { formatBytes } from "../../format/format.js";
6
6
  import { useResultRowCounts } from "./query_result_toolbar.js";
7
7
  import * as React from "react";
@@ -58,7 +58,8 @@ function QueryResultPanel(props) {
58
58
  observer.observe(body);
59
59
  return () => observer.disconnect();
60
60
  }, []);
61
- const maxRows = bodyHeight == null ? 0 : fittingRowCount(bodyHeight);
61
+ const rowHeight = useDataTableRowHeight();
62
+ const maxRows = bodyHeight == null ? 0 : fittingRowCount(bodyHeight, rowHeight);
62
63
  return /* @__PURE__ */ jsxs("div", {
63
64
  className: panel,
64
65
  children: [props.query != null && props.header(maxRows), /* @__PURE__ */ jsx("div", {
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ export interface SheetProps {
3
+ title: React.ReactNode;
4
+ 'aria-label'?: string;
5
+ onClose: () => void;
6
+ actions?: React.ReactNode;
7
+ returnFocusRef?: React.RefObject<HTMLElement | null>;
8
+ 'data-testid'?: string;
9
+ children?: React.ReactNode;
10
+ }
11
+ export declare function Sheet(props: SheetProps): React.ReactElement;
@@ -0,0 +1,65 @@
1
+ import { backdrop, body, grabber, header, sheet, title } from "./sheet.module.js";
2
+ import { ButtonSize, ButtonVariant, IconButton } from "./button.js";
3
+ import { Portal } from "./portal.js";
4
+ import { useOverlay } from "./overlay.js";
5
+ import { XIcon } from "./symbol_icon.js";
6
+ import { useFocusTrap } from "../dom/focus.js";
7
+ import * as React from "react";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ function Sheet(props) {
10
+ const closeRef = React.useRef(null);
11
+ const titleId = React.useId();
12
+ const overlayRef = useOverlay({
13
+ onEscape: props.onClose,
14
+ onClickOutside: props.onClose,
15
+ returnFocusRef: props.returnFocusRef,
16
+ initialFocusRef: closeRef
17
+ });
18
+ useFocusTrap({
19
+ containerRef: overlayRef,
20
+ initialFocusRef: closeRef
21
+ });
22
+ return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
23
+ className: backdrop,
24
+ "aria-hidden": "true"
25
+ }), /* @__PURE__ */ jsxs("section", {
26
+ ref: overlayRef,
27
+ className: sheet,
28
+ role: "dialog",
29
+ "aria-modal": "true",
30
+ "aria-label": props["aria-label"],
31
+ "aria-labelledby": props["aria-label"] == null ? titleId : void 0,
32
+ "data-testid": props["data-testid"],
33
+ children: [
34
+ /* @__PURE__ */ jsx("div", {
35
+ className: grabber,
36
+ "aria-hidden": "true"
37
+ }),
38
+ /* @__PURE__ */ jsxs("header", {
39
+ className: header,
40
+ children: [
41
+ /* @__PURE__ */ jsx("h2", {
42
+ id: titleId,
43
+ className: title,
44
+ children: props.title
45
+ }),
46
+ props.actions,
47
+ /* @__PURE__ */ jsx(IconButton, {
48
+ ref: closeRef,
49
+ size: ButtonSize.Small,
50
+ variant: ButtonVariant.Invisible,
51
+ "aria-label": "Close",
52
+ "data-testid": "sheet-close",
53
+ onClick: props.onClose,
54
+ children: /* @__PURE__ */ jsx(XIcon, { size: 16 })
55
+ })
56
+ ]
57
+ }),
58
+ /* @__PURE__ */ jsx("div", {
59
+ className: body,
60
+ children: props.children
61
+ })
62
+ ]
63
+ })] }) });
64
+ }
65
+ export { Sheet };
@@ -0,0 +1,7 @@
1
+ var backdrop = "dashql_backdrop_xwtinJ";
2
+ var sheet = "dashql_sheet_8NBFjE";
3
+ var grabber = "dashql_grabber_yGY3Hp";
4
+ var header = "dashql_header_ukD2PQ";
5
+ var title = "dashql_title_W6n0mX";
6
+ var body = "dashql_body_52dHaX";
7
+ export { backdrop, body, grabber, header, sheet, title };
@@ -1,2 +1,5 @@
1
1
  export declare function useMediaQuery(query: string): boolean;
2
- export declare const PHONE_WIDTH_QUERY = "(max-width: 600px)";
2
+ export declare const EXPANDED_WIDTH = 840;
3
+ export declare const NARROW_CONTAINER_WIDTH = 600;
4
+ export declare const COMPACT_WIDTH_QUERY = "(max-width: 839px)";
5
+ export declare const EXPANDED_WIDTH_QUERY = "(min-width: 840px)";
@@ -11,5 +11,8 @@ function useMediaQuery(query) {
11
11
  }, [query]);
12
12
  return matches;
13
13
  }
14
- var PHONE_WIDTH_QUERY = "(max-width: 600px)";
15
- export { PHONE_WIDTH_QUERY, useMediaQuery };
14
+ var EXPANDED_WIDTH = 840;
15
+ var NARROW_CONTAINER_WIDTH = 600;
16
+ var COMPACT_WIDTH_QUERY = `(max-width: 839px)`;
17
+ var EXPANDED_WIDTH_QUERY = `(min-width: 840px)`;
18
+ export { COMPACT_WIDTH_QUERY, EXPANDED_WIDTH, EXPANDED_WIDTH_QUERY, NARROW_CONTAINER_WIDTH, useMediaQuery };
package/dist/style.css CHANGED
@@ -100,9 +100,11 @@
100
100
 
101
101
  /* The shade behind an overlay, the first child of its portal. It lets clicks through so an outside click still
102
102
  reaches the page and closes the overlay. Without a z-index it paints below the overlay that follows it. */
103
+ /* Both stay clear of a bar at the bottom of the window that the host keeps usable, e.g. the views of a phone
104
+ (`--nav_bar_bottom_height`, 0 without one) */
103
105
  .dashql_backdrop_E1GccU {
104
106
  position: fixed;
105
- inset: 0;
107
+ inset: 0 0 var(--nav_bar_bottom_height, 0px) 0;
106
108
  pointer-events: none;
107
109
  background-color: var(--color_backdrop);
108
110
  animation: dashql_backdrop-fade-in_VEK_J1 200ms ease-out;
@@ -118,7 +120,7 @@
118
120
  top: 0;
119
121
  left: 0;
120
122
  width: 100vw;
121
- height: 100vh;
123
+ height: calc(100dvh - var(--nav_bar_bottom_height, 0px));
122
124
  display: flex;
123
125
  align-items: center;
124
126
  justify-content: center;
@@ -193,6 +195,21 @@
193
195
  max-height: calc(100vh - var(--nav_bar_top_height, 0px) - 32px);
194
196
  margin-top: var(--nav_bar_top_height, 0px);
195
197
  }
198
+
199
+ /* A compact window has no room for the inset: an expanded overlay fills it below the top bar, with the rounded top
200
+ corners of the card of the page below the bar */
201
+ @media only screen and (max-width: 839px) {
202
+ .dashql_overlay_TjPFFF.dashql_expanded_M5TUAX {
203
+ width: 100vw;
204
+ height: calc(100dvh - var(--nav_bar_top_height, 0px) - var(--nav_bar_bottom_height, 0px));
205
+ max-width: 100vw;
206
+ max-height: calc(100dvh - var(--nav_bar_top_height, 0px) - var(--nav_bar_bottom_height, 0px));
207
+ border-width: 0;
208
+ border-radius: var(--border_radius) var(--border_radius) 0 0;
209
+ padding-bottom: env(safe-area-inset-bottom, 0px);
210
+ box-sizing: border-box;
211
+ }
212
+ }
196
213
  /*
197
214
  Styles from here: https://github.com/primer/react/blob/main/packages/react/src/Button/styles.ts
198
215
  The colors are the tokens of the theme (dashql-react/styles/tokens.css) in the roles of the Primer button colors.
@@ -956,7 +973,9 @@
956
973
  vertical-align: top;
957
974
  }
958
975
 
976
+ /* The number of a row opens the detail of the row */
959
977
  .dashql_row_header_cell_Jmi9dz {
978
+ cursor: pointer;
960
979
  background-color: var(--data_table_bg, var(--color_bg_card));
961
980
  border-right: 1px solid var(--color_border);
962
981
  border-bottom: 1px solid var(--color_border);
@@ -1343,6 +1362,145 @@
1343
1362
  border-color: var(--tag_outline_border_color, var(--color_border));
1344
1363
  color: var(--tag_outline_color, var(--color_fg_muted));
1345
1364
  }
1365
+ /* The fields of a row in the sheet: the name with its type, the value below it, a line between the fields */
1366
+ .dashql_fields_jOg5bq {
1367
+ margin: 0;
1368
+ }
1369
+
1370
+ .dashql_field_D9hR7- {
1371
+ display: grid;
1372
+ grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
1373
+ column-gap: 12px;
1374
+ align-items: baseline;
1375
+ padding: 8px 0;
1376
+ border-bottom: 1px solid var(--color_border_muted);
1377
+ }
1378
+
1379
+ .dashql_name_GCEkkk {
1380
+ display: flex;
1381
+ flex-direction: column;
1382
+ min-width: 0;
1383
+ overflow-wrap: anywhere;
1384
+ color: var(--color_fg_muted);
1385
+ font-size: var(--font_size_small);
1386
+ }
1387
+
1388
+ .dashql_type_9zm-Uu {
1389
+ color: var(--color_fg_subtle);
1390
+ font-size: var(--font_size_micro);
1391
+ }
1392
+
1393
+ .dashql_value_ZkMNpe {
1394
+ margin: 0;
1395
+ min-width: 0;
1396
+ overflow-wrap: anywhere;
1397
+ white-space: pre-wrap;
1398
+ font-size: var(--font_size_body);
1399
+ font-variant-numeric: tabular-nums;
1400
+ }
1401
+
1402
+ .dashql_value_null_Ypwy0D {
1403
+ color: var(--color_fg_subtle);
1404
+ font-style: italic;
1405
+ }
1406
+ /* A sheet over the page, see sheet.tsx. Above the drawer of the workbench and below the completion list. */
1407
+ .dashql_backdrop_xwtinJ {
1408
+ position: fixed;
1409
+ /* Clear of a bar at the bottom of the window that the host keeps usable (`--nav_bar_bottom_height`) */
1410
+ inset: 0 0 var(--nav_bar_bottom_height, 0px) 0;
1411
+ z-index: 1200;
1412
+ background: var(--color_backdrop);
1413
+ }
1414
+
1415
+ /* At the right edge of a wider window, as high as the window */
1416
+ .dashql_sheet_8NBFjE {
1417
+ position: fixed;
1418
+ z-index: 1201;
1419
+ top: 8px;
1420
+ right: 8px;
1421
+ bottom: 8px;
1422
+ width: min(400px, calc(100vw - 16px));
1423
+ display: grid;
1424
+ grid-template-rows: 0 auto minmax(0, 1fr);
1425
+ border: 1px solid var(--color_border);
1426
+ border-radius: var(--border_radius);
1427
+ background: var(--color_bg_card);
1428
+ box-shadow: var(--shadow_extra_large);
1429
+ overflow: hidden;
1430
+ animation: dashql_sheet-in-side_dC01y4 160ms cubic-bezier(0.33, 1, 0.68, 1);
1431
+ }
1432
+
1433
+ .dashql_grabber_yGY3Hp {
1434
+ display: none;
1435
+ }
1436
+
1437
+ .dashql_header_ukD2PQ {
1438
+ display: flex;
1439
+ align-items: center;
1440
+ gap: 4px;
1441
+ min-width: 0;
1442
+ min-height: 44px;
1443
+ padding: 0 8px 0 16px;
1444
+ border-bottom: 1px solid var(--color_border_muted);
1445
+ }
1446
+
1447
+ .dashql_title_W6n0mX {
1448
+ flex: 1 1 auto;
1449
+ min-width: 0;
1450
+ margin: 0;
1451
+ overflow: hidden;
1452
+ text-overflow: ellipsis;
1453
+ white-space: nowrap;
1454
+ font-size: var(--font_size_title);
1455
+ font-weight: 600;
1456
+ }
1457
+
1458
+ .dashql_body_52dHaX {
1459
+ min-height: 0;
1460
+ overflow: auto;
1461
+ padding: 8px 16px 16px;
1462
+ }
1463
+
1464
+ /* From the bottom of a compact window, at most as high as most of the window, above the home indicator */
1465
+ @media only screen and (max-width: 839px) {
1466
+ .dashql_sheet_8NBFjE {
1467
+ top: auto;
1468
+ right: 0;
1469
+ bottom: var(--nav_bar_bottom_height, 0px);
1470
+ left: 0;
1471
+ width: auto;
1472
+ max-height: 85dvh;
1473
+ grid-template-rows: 14px auto minmax(0, 1fr);
1474
+ border-width: 1px 0 0;
1475
+ border-radius: 16px 16px 0 0;
1476
+ padding-bottom: env(safe-area-inset-bottom, 0px);
1477
+ animation-name: dashql_sheet-in-bottom_SVKPYP;
1478
+ }
1479
+
1480
+ .dashql_grabber_yGY3Hp {
1481
+ display: block;
1482
+ justify-self: center;
1483
+ align-self: end;
1484
+ width: 36px;
1485
+ height: 5px;
1486
+ border-radius: 3px;
1487
+ background: var(--color_border);
1488
+ }
1489
+ }
1490
+
1491
+ @keyframes dashql_sheet-in-side_dC01y4 {
1492
+ from { transform: translateX(16px); opacity: 0; }
1493
+ to { transform: none; opacity: 1; }
1494
+ }
1495
+
1496
+ @keyframes dashql_sheet-in-bottom_SVKPYP {
1497
+ from { transform: translateY(24px); opacity: 0; }
1498
+ to { transform: none; opacity: 1; }
1499
+ }
1500
+
1501
+ @media (prefers-reduced-motion: reduce) {
1502
+ .dashql_sheet_8NBFjE { animation: none; }
1503
+ }
1346
1504
  /* The content of a Deferred fills its box, a single grid cell stretches it like the parent would */
1347
1505
  .dashql_root_TwILJ0 {
1348
1506
  position: relative;
@@ -1,3 +1,3 @@
1
- import type * as arrow from 'apache-arrow';
1
+ import * as arrow from 'apache-arrow';
2
2
  export declare const CHART_ROWS = 10000;
3
3
  export declare function arrowTableToRows(table: arrow.Table): Record<string, unknown>[];
@@ -1,9 +1,15 @@
1
+ import * as arrow from "apache-arrow";
1
2
  var CHART_ROWS = 1e4;
3
+ function decimalToNumber(value, scale) {
4
+ if (!(value instanceof Uint32Array)) return value;
5
+ return arrow.util.bigNumToNumber(value, scale);
6
+ }
2
7
  function arrowRowToObject(row, fields) {
3
8
  const obj = {};
4
9
  for (const field of fields) {
5
10
  const value = row[field.name];
6
- if (typeof value === "bigint") obj[field.name] = Number(value);
11
+ if (arrow.DataType.isDecimal(field.type)) obj[field.name] = decimalToNumber(value, field.type.scale);
12
+ else if (typeof value === "bigint") obj[field.name] = Number(value);
7
13
  else if (value instanceof Date) obj[field.name] = value.toISOString();
8
14
  else obj[field.name] = value;
9
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akohn/dashql-react",
3
- "version": "0.0.20-dev.873.gb84ef9086",
3
+ "version": "0.0.20-dev.908.gd791a771f",
4
4
  "description": "DashQL in React: the hooks of the runtime of @akohn/dashql, the models that components show, the components, and the design tokens, fonts and icons of DashQL",
5
5
  "type": "module",
6
6
  "license": "MPL-2.0",
@@ -33,7 +33,7 @@
33
33
  "react-window": "^2.5.3"
34
34
  },
35
35
  "peerDependencies": {
36
- "@akohn/dashql": "0.0.20-dev.873.gb84ef9086",
36
+ "@akohn/dashql": "0.0.20-dev.908.gd791a771f",
37
37
  "apache-arrow": "^21.2.0",
38
38
  "react": "^19.3.1",
39
39
  "react-dom": "^19.3.1",
@@ -193,6 +193,10 @@
193
193
  "types": "./dist/components/segmented_control.d.ts",
194
194
  "import": "./dist/components/segmented_control.js"
195
195
  },
196
+ "./components/sheet": {
197
+ "types": "./dist/components/sheet.d.ts",
198
+ "import": "./dist/components/sheet.js"
199
+ },
196
200
  "./components/size_observer": {
197
201
  "types": "./dist/components/size_observer.d.ts",
198
202
  "import": "./dist/components/size_observer.js"