@quantumwake/terminal-ux-dashboard-components 0.1.5 → 0.1.7
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/dist/index.cjs +28 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -16
- package/dist/index.js.map +1 -1
- package/package.json +15 -11
package/dist/index.cjs
CHANGED
|
@@ -10,10 +10,13 @@ var heatmap = require('@nivo/heatmap');
|
|
|
10
10
|
var PivotTableUI = require('react-pivottable/PivotTableUI');
|
|
11
11
|
require('react-pivottable/pivottable.css');
|
|
12
12
|
var lucideReact = require('lucide-react');
|
|
13
|
+
var CodeMirror = require('@uiw/react-codemirror');
|
|
14
|
+
var langSql = require('@codemirror/lang-sql');
|
|
13
15
|
|
|
14
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
17
|
|
|
16
18
|
var PivotTableUI__default = /*#__PURE__*/_interopDefault(PivotTableUI);
|
|
19
|
+
var CodeMirror__default = /*#__PURE__*/_interopDefault(CodeMirror);
|
|
17
20
|
|
|
18
21
|
// src/context/DashboardContext.tsx
|
|
19
22
|
var DashboardContext = react.createContext(null);
|
|
@@ -675,12 +678,24 @@ function SqlConsole({ columns = [], stateId, defaultColumnsOpen = false, default
|
|
|
675
678
|
setSql(defaultSql);
|
|
676
679
|
void run(defaultSql);
|
|
677
680
|
}, [stateId, autoRun, defaultSql]);
|
|
678
|
-
const
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
}
|
|
681
|
+
const runRef = react.useRef(() => {
|
|
682
|
+
});
|
|
683
|
+
runRef.current = () => {
|
|
684
|
+
void run();
|
|
683
685
|
};
|
|
686
|
+
const schemaKey = columns.map((c) => c.name).join(",");
|
|
687
|
+
const extensions = react.useMemo(
|
|
688
|
+
() => [
|
|
689
|
+
langSql.sql({ schema: { data: columns.map((c) => c.name) }, upperCaseKeywords: true }),
|
|
690
|
+
CodeMirror.EditorView.lineWrapping,
|
|
691
|
+
CodeMirror.Prec.highest(CodeMirror.keymap.of([{ key: "Mod-Enter", run: () => {
|
|
692
|
+
runRef.current();
|
|
693
|
+
return true;
|
|
694
|
+
} }]))
|
|
695
|
+
],
|
|
696
|
+
[schemaKey]
|
|
697
|
+
// eslint-disable-line react-hooks/exhaustive-deps
|
|
698
|
+
);
|
|
684
699
|
const resultColumns = result?.columns || [];
|
|
685
700
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col h-full", children: [
|
|
686
701
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `border-b ${theme.border} bg-midnight-elevated p-3 shrink-0`, children: [
|
|
@@ -704,15 +719,16 @@ function SqlConsole({ columns = [], stateId, defaultColumnsOpen = false, default
|
|
|
704
719
|
)
|
|
705
720
|
] }),
|
|
706
721
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
707
|
-
|
|
722
|
+
CodeMirror__default.default,
|
|
708
723
|
{
|
|
709
724
|
value: sql,
|
|
710
|
-
onChange:
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
placeholder: "SELECT ... FROM data"
|
|
725
|
+
onChange: setSql,
|
|
726
|
+
extensions,
|
|
727
|
+
theme: "dark",
|
|
728
|
+
basicSetup: { lineNumbers: false, foldGutter: false, highlightActiveLine: false },
|
|
729
|
+
height: "120px",
|
|
730
|
+
placeholder: "SELECT ... FROM data",
|
|
731
|
+
className: "border border-midnight-border text-sm overflow-hidden focus-within:border-midnight-accent"
|
|
716
732
|
}
|
|
717
733
|
),
|
|
718
734
|
columns.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2", children: [
|