datajunction-ui 0.0.98 → 0.0.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datajunction-ui",
3
- "version": "0.0.98",
3
+ "version": "0.0.100",
4
4
  "description": "DataJunction UI",
5
5
  "module": "src/index.tsx",
6
6
  "repository": {
@@ -1,4 +1,4 @@
1
- import { useState, useCallback, useMemo, useEffect, memo } from 'react';
1
+ import { useState, useCallback, useMemo, useEffect, useRef, memo } from 'react';
2
2
  import { Light as SyntaxHighlighter } from 'react-syntax-highlighter';
3
3
  import { foundation } from 'react-syntax-highlighter/src/styles/hljs';
4
4
  import sql from 'react-syntax-highlighter/dist/esm/languages/hljs/sql';
@@ -125,7 +125,7 @@ function detectChartConfig(columns, rows) {
125
125
  return null;
126
126
  }
127
127
 
128
- const MAX_GROUP_VALUES = 7;
128
+ const MAX_GROUP_VALUES = 50;
129
129
 
130
130
  function buildPivotedData(rows, columns, xCol, groupByCol, metricCols) {
131
131
  const xIdx = xCol.idx;
@@ -234,6 +234,7 @@ function KpiCards({ rows, metricCols }) {
234
234
  const CHART_MARGIN = { top: 8, right: 24, left: 8, bottom: 40 };
235
235
  const AXIS_TICK = { fontSize: 11, fill: '#64748b' };
236
236
  const TOOLTIP_STYLE = { fontSize: 12, border: '1px solid #e2e8f0' };
237
+ const TOOLTIP_WRAPPER_STYLE = { zIndex: 9999 };
237
238
 
238
239
  const Chart = memo(function Chart({
239
240
  type,
@@ -262,7 +263,10 @@ const Chart = memo(function Chart({
262
263
  interval={xInterval}
263
264
  />
264
265
  <YAxis tickFormatter={formatYAxis} tick={AXIS_TICK} width={60} />
265
- <Tooltip contentStyle={TOOLTIP_STYLE} />
266
+ <Tooltip
267
+ contentStyle={TOOLTIP_STYLE}
268
+ wrapperStyle={TOOLTIP_WRAPPER_STYLE}
269
+ />
266
270
  {keys.map((key, i) => (
267
271
  <Line
268
272
  key={key}
@@ -413,6 +417,38 @@ export function ResultsView({
413
417
  const [sortDirection, setSortDirection] = useState('asc');
414
418
  const [activeTab, setActiveTab] = useState('table');
415
419
 
420
+ // Resizable SQL pane height (px); null = use CSS default
421
+ const [sqlPaneHeight, setSqlPaneHeight] = useState(null);
422
+ const resultsPanesRef = useRef(null);
423
+
424
+ const handleSqlResizerMouseDown = useCallback(
425
+ e => {
426
+ e.preventDefault();
427
+ const container = resultsPanesRef.current;
428
+ if (!container) return;
429
+ const startY = e.clientY;
430
+ const startHeight = sqlPaneHeight ?? container.offsetHeight * 0.333;
431
+
432
+ const onMouseMove = moveEvent => {
433
+ const delta = moveEvent.clientY - startY;
434
+ const newHeight = Math.max(
435
+ 80,
436
+ Math.min(container.offsetHeight * 0.8, startHeight + delta),
437
+ );
438
+ setSqlPaneHeight(newHeight);
439
+ };
440
+
441
+ const onMouseUp = () => {
442
+ document.removeEventListener('mousemove', onMouseMove);
443
+ document.removeEventListener('mouseup', onMouseUp);
444
+ };
445
+
446
+ document.addEventListener('mousemove', onMouseMove);
447
+ document.addEventListener('mouseup', onMouseUp);
448
+ },
449
+ [sqlPaneHeight],
450
+ );
451
+
416
452
  const handleCopySql = useCallback(() => {
417
453
  if (sqlQuery) {
418
454
  navigator.clipboard.writeText(sqlQuery);
@@ -520,9 +556,16 @@ export function ResultsView({
520
556
  </div>
521
557
 
522
558
  {/* Two-pane layout: SQL (top) + Results (bottom) */}
523
- <div className="results-panes">
559
+ <div className="results-panes" ref={resultsPanesRef}>
524
560
  {/* SQL Pane */}
525
- <div className="sql-pane">
561
+ <div
562
+ className="sql-pane"
563
+ style={
564
+ sqlPaneHeight != null
565
+ ? { flex: `0 0 ${sqlPaneHeight}px`, maxHeight: sqlPaneHeight }
566
+ : undefined
567
+ }
568
+ >
526
569
  <div className="sql-pane-header">
527
570
  <span className="sql-pane-title">SQL Query</span>
528
571
  {cubeName && (
@@ -585,6 +628,13 @@ export function ResultsView({
585
628
  </div>
586
629
  </div>
587
630
 
631
+ {/* Horizontal resizer between SQL and results panes */}
632
+ <div
633
+ className="horizontal-resizer"
634
+ onMouseDown={handleSqlResizerMouseDown}
635
+ title="Drag to resize"
636
+ />
637
+
588
638
  {/* Results Pane */}
589
639
  <div className="results-pane">
590
640
  {loading ? (