@sqlrooms/sql-editor 0.27.0-rc.0 → 0.27.0-rc.1
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/README.md +0 -4
- package/dist/components/QueryResultLimitSelect.d.ts +26 -0
- package/dist/components/QueryResultLimitSelect.d.ts.map +1 -0
- package/dist/components/QueryResultLimitSelect.js +19 -0
- package/dist/components/QueryResultLimitSelect.js.map +1 -0
- package/dist/components/QueryResultPanel.d.ts +3 -0
- package/dist/components/QueryResultPanel.d.ts.map +1 -1
- package/dist/components/QueryResultPanel.js +5 -10
- package/dist/components/QueryResultPanel.js.map +1 -1
- package/dist/components/SqlQueryPreview.d.ts +28 -0
- package/dist/components/SqlQueryPreview.d.ts.map +1 -0
- package/dist/components/SqlQueryPreview.js +55 -0
- package/dist/components/SqlQueryPreview.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -90,8 +90,6 @@ export const {roomStore, useRoomStore} = createRoomStore<RoomConfig, RoomState>(
|
|
|
90
90
|
...createRoomShellSlice<RoomConfig>({
|
|
91
91
|
config: {
|
|
92
92
|
title: 'SQL Workspace',
|
|
93
|
-
// ... other room config
|
|
94
|
-
...createDefaultSqlEditorConfig(),
|
|
95
93
|
},
|
|
96
94
|
})(set, get, store),
|
|
97
95
|
|
|
@@ -204,8 +202,6 @@ export const {roomStore, useRoomStore} = createRoomStore<RoomConfig, RoomState>(
|
|
|
204
202
|
...createRoomShellSlice<RoomConfig>({
|
|
205
203
|
config: {
|
|
206
204
|
title: 'SQL Workspace',
|
|
207
|
-
// ... other room config
|
|
208
|
-
...createDefaultSqlEditorConfig(),
|
|
209
205
|
},
|
|
210
206
|
})(set, get, store),
|
|
211
207
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface QueryResultLimitSelectProps {
|
|
3
|
+
/**
|
|
4
|
+
* Current limit value
|
|
5
|
+
*/
|
|
6
|
+
value: number;
|
|
7
|
+
/**
|
|
8
|
+
* Callback when limit changes
|
|
9
|
+
*/
|
|
10
|
+
onChange: (limit: number) => void;
|
|
11
|
+
/**
|
|
12
|
+
* Available limit options
|
|
13
|
+
* @default [100, 500, 1000, 5000, 10000]
|
|
14
|
+
*/
|
|
15
|
+
options?: number[];
|
|
16
|
+
/**
|
|
17
|
+
* Custom class name
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reusable dropdown for selecting query result limits.
|
|
23
|
+
* Used in QueryResultPanel and SqlQueryPreview.
|
|
24
|
+
*/
|
|
25
|
+
export declare const QueryResultLimitSelect: React.FC<QueryResultLimitSelectProps>;
|
|
26
|
+
//# sourceMappingURL=QueryResultLimitSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryResultLimitSelect.d.ts","sourceRoot":"","sources":["../../src/components/QueryResultLimitSelect.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAgB,MAAM,OAAO,CAAC;AAErC,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAiCxE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn, Select, SelectContent, SelectItem, SelectTrigger, } from '@sqlrooms/ui';
|
|
3
|
+
import { formatCount } from '@sqlrooms/utils';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Reusable dropdown for selecting query result limits.
|
|
7
|
+
* Used in QueryResultPanel and SqlQueryPreview.
|
|
8
|
+
*/
|
|
9
|
+
export const QueryResultLimitSelect = ({ value, onChange, options = [100, 500, 1000, 5000, 10000], className, }) => {
|
|
10
|
+
// Ensure current value is in options list
|
|
11
|
+
const limitOptions = useMemo(() => {
|
|
12
|
+
if (!options.includes(value)) {
|
|
13
|
+
return [value, ...options].sort((a, b) => a - b);
|
|
14
|
+
}
|
|
15
|
+
return options;
|
|
16
|
+
}, [options, value]);
|
|
17
|
+
return (_jsxs(Select, { value: value.toString(), onValueChange: (v) => onChange(parseInt(v)), children: [_jsx(SelectTrigger, { className: cn('h-6 w-fit', className), children: _jsx("div", { className: "text-xs text-gray-500", children: `Limit results to ${formatCount(value)} rows` }) }), _jsx(SelectContent, { children: limitOptions.map((limit) => (_jsx(SelectItem, { value: limit.toString(), children: `${formatCount(limit)} rows` }, limit))) })] }));
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=QueryResultLimitSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryResultLimitSelect.js","sourceRoot":"","sources":["../../src/components/QueryResultLimitSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,EAAE,EACF,MAAM,EACN,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAc,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAsBrC;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAA0C,CAAC,EAC5E,KAAK,EACL,QAAQ,EACR,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EACvC,SAAS,GACV,EAAE,EAAE;IACH,0CAA0C;IAC1C,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE;QAChC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,KAAK,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,MAAC,MAAM,IACL,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,EACvB,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,aAE3C,KAAC,aAAa,IAAC,SAAS,EAAE,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC,YAClD,cAAK,SAAS,EAAC,uBAAuB,YACnC,oBAAoB,WAAW,CAAC,KAAK,CAAC,OAAO,GAC1C,GACQ,EAChB,KAAC,aAAa,cACX,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAC3B,KAAC,UAAU,IAAa,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,YAC5C,GAAG,WAAW,CAAC,KAAK,CAAC,OAAO,IADd,KAAK,CAET,CACd,CAAC,GACY,IACT,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n cn,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n} from '@sqlrooms/ui';\nimport {formatCount} from '@sqlrooms/utils';\nimport React, {useMemo} from 'react';\n\nexport interface QueryResultLimitSelectProps {\n /**\n * Current limit value\n */\n value: number;\n /**\n * Callback when limit changes\n */\n onChange: (limit: number) => void;\n /**\n * Available limit options\n * @default [100, 500, 1000, 5000, 10000]\n */\n options?: number[];\n /**\n * Custom class name\n */\n className?: string;\n}\n\n/**\n * Reusable dropdown for selecting query result limits.\n * Used in QueryResultPanel and SqlQueryPreview.\n */\nexport const QueryResultLimitSelect: React.FC<QueryResultLimitSelectProps> = ({\n value,\n onChange,\n options = [100, 500, 1000, 5000, 10000],\n className,\n}) => {\n // Ensure current value is in options list\n const limitOptions = useMemo(() => {\n if (!options.includes(value)) {\n return [value, ...options].sort((a, b) => a - b);\n }\n return options;\n }, [options, value]);\n\n return (\n <Select\n value={value.toString()}\n onValueChange={(v) => onChange(parseInt(v))}\n >\n <SelectTrigger className={cn('h-6 w-fit', className)}>\n <div className=\"text-xs text-gray-500\">\n {`Limit results to ${formatCount(value)} rows`}\n </div>\n </SelectTrigger>\n <SelectContent>\n {limitOptions.map((limit) => (\n <SelectItem key={limit} value={limit.toString()}>\n {`${formatCount(limit)} rows`}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n );\n};\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ArrowDataTableValueFormatter } from '@sqlrooms/data-table';
|
|
1
2
|
import type { Row } from '@tanstack/react-table';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
export interface QueryResultPanelProps {
|
|
@@ -26,6 +27,8 @@ export interface QueryResultPanelProps {
|
|
|
26
27
|
* Receives the current query and error text.
|
|
27
28
|
*/
|
|
28
29
|
onAskAiAboutError?: (query: string, error: string) => void;
|
|
30
|
+
/** Custom value formatter for arrow data */
|
|
31
|
+
formatValue?: ArrowDataTableValueFormatter;
|
|
29
32
|
}
|
|
30
33
|
export declare const QueryResultPanel: React.FC<QueryResultPanelProps>;
|
|
31
34
|
//# sourceMappingURL=QueryResultPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryResultPanel.d.ts","sourceRoot":"","sources":["../../src/components/QueryResultPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QueryResultPanel.d.ts","sourceRoot":"","sources":["../../src/components/QueryResultPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,4BAA4B,EAAC,MAAM,sBAAsB,CAAC;AACzG,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,uBAAuB,CAAC;AAG/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,WAAW,qBAAqB;IACpC,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACnD,wFAAwF;IACxF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAClB,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;KAC9C,KAAK,IAAI,CAAC;IACX;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE;QACxB,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;KAC9C,KAAK,IAAI,CAAC;IACX;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,4CAA4C;IAC5C,WAAW,CAAC,EAAE,4BAA4B,CAAC;CAC5C;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA6H5D,CAAC"}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { DataTablePaginated, useArrowDataTable } from '@sqlrooms/data-table';
|
|
3
|
-
import { cn,
|
|
3
|
+
import { cn, SpinnerPane, Button } from '@sqlrooms/ui';
|
|
4
4
|
import { formatCount } from '@sqlrooms/utils';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { isQueryWithResult, useStoreWithSqlEditor } from '../SqlEditorSlice';
|
|
7
7
|
import { MessageCircleQuestion } from 'lucide-react';
|
|
8
|
-
|
|
8
|
+
import { QueryResultLimitSelect } from './QueryResultLimitSelect';
|
|
9
|
+
export const QueryResultPanel = ({ className, renderActions, fontSize = 'text-xs', onRowClick, onRowDoubleClick, onAskAiAboutError, formatValue, }) => {
|
|
9
10
|
const queryResult = useStoreWithSqlEditor((s) => s.sqlEditor.queryResult);
|
|
10
11
|
const getCurrentQuery = useStoreWithSqlEditor((s) => s.sqlEditor.getCurrentQuery);
|
|
11
12
|
const setQueryResultLimit = useStoreWithSqlEditor((s) => s.sqlEditor.setQueryResultLimit);
|
|
12
13
|
const queryResultLimit = useStoreWithSqlEditor((s) => s.sqlEditor.queryResultLimit);
|
|
13
14
|
const queryResultLimitOptions = useStoreWithSqlEditor((s) => s.sqlEditor.queryResultLimitOptions);
|
|
14
|
-
const
|
|
15
|
-
if (!queryResultLimitOptions.includes(queryResultLimit)) {
|
|
16
|
-
return [queryResultLimit, ...queryResultLimitOptions];
|
|
17
|
-
}
|
|
18
|
-
return queryResultLimitOptions;
|
|
19
|
-
}, [queryResultLimitOptions, queryResultLimit]);
|
|
20
|
-
const arrowTableData = useArrowDataTable(isQueryWithResult(queryResult) ? queryResult.result : undefined);
|
|
15
|
+
const arrowTableData = useArrowDataTable(isQueryWithResult(queryResult) ? queryResult.result : undefined, { formatValue });
|
|
21
16
|
const handleAskAiAboutError = React.useCallback(() => {
|
|
22
17
|
if (queryResult?.status === 'error' && onAskAiAboutError) {
|
|
23
18
|
const currentQuery = getCurrentQuery();
|
|
@@ -38,7 +33,7 @@ export const QueryResultPanel = ({ className, renderActions, fontSize = 'text-xs
|
|
|
38
33
|
return (_jsxs("div", { className: "relative h-full w-full overflow-auto p-5", children: [onAskAiAboutError && (_jsx(Button, { variant: "ghost", size: "icon", className: "absolute right-2 top-2 h-8 w-8", onClick: handleAskAiAboutError, title: "Ask AI for help", children: _jsx(MessageCircleQuestion, { className: "h-4 w-4" }) })), _jsx("pre", { className: cn('whitespace-pre-wrap text-xs leading-tight text-red-500', onAskAiAboutError && 'pr-12'), children: queryResult.error })] }));
|
|
39
34
|
}
|
|
40
35
|
if (queryResult?.status === 'success') {
|
|
41
|
-
return (_jsx("div", { className: cn('relative flex h-full w-full flex-grow flex-col overflow-hidden', className), children: isQueryWithResult(queryResult) ? (_jsxs("div", { className: "flex h-full w-full flex-col", children: [_jsx(DataTablePaginated, { ...arrowTableData, className: "flex-grow overflow-hidden", fontSize: fontSize, isFetching: false, onRowClick: onRowClick, onRowDoubleClick: onRowDoubleClick }), _jsxs("div", { className: "bg-background flex w-full items-center gap-2 px-4 py-1", children: [queryResult.result ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "font-mono text-xs", children: `${formatCount(queryResult.result.numRows ?? 0)} rows` }),
|
|
36
|
+
return (_jsx("div", { className: cn('relative flex h-full w-full flex-grow flex-col overflow-hidden', className), children: isQueryWithResult(queryResult) ? (_jsxs("div", { className: "flex h-full w-full flex-col", children: [_jsx(DataTablePaginated, { ...arrowTableData, className: "flex-grow overflow-hidden", fontSize: fontSize, isFetching: false, onRowClick: onRowClick, onRowDoubleClick: onRowDoubleClick }), _jsxs("div", { className: "bg-background flex w-full items-center gap-2 px-4 py-1", children: [queryResult.result ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "font-mono text-xs", children: `${formatCount(queryResult.result.numRows ?? 0)} rows` }), _jsx(QueryResultLimitSelect, { value: queryResultLimit, onChange: setQueryResultLimit, options: queryResultLimitOptions })] })) : null, _jsx("div", { className: "flex-1" }), renderActions
|
|
42
37
|
? renderActions(queryResult.lastQueryStatement)
|
|
43
38
|
: undefined] })] })) : (_jsx("pre", { className: "p-4 text-xs leading-tight text-green-500", children: "Successfully executed query" })) }));
|
|
44
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryResultPanel.js","sourceRoot":"","sources":["../../src/components/QueryResultPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"QueryResultPanel.js","sourceRoot":"","sources":["../../src/components/QueryResultPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAA+B,MAAM,sBAAsB,CAAC;AAEzG,OAAO,EAAC,EAAE,EAAE,WAAW,EAAE,MAAM,EAAC,MAAM,cAAc,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,iBAAiB,EAAE,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAC,qBAAqB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAgChE,MAAM,CAAC,MAAM,gBAAgB,GAAoC,CAAC,EAChE,SAAS,EACT,aAAa,EACb,QAAQ,GAAG,SAAS,EACpB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC1E,MAAM,eAAe,GAAG,qBAAqB,CAC3C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,eAAe,CACnC,CAAC;IACF,MAAM,mBAAmB,GAAG,qBAAqB,CAC/C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,mBAAmB,CACvC,CAAC;IACF,MAAM,gBAAgB,GAAG,qBAAqB,CAC5C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,gBAAgB,CACpC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} from '@sqlrooms/data-table';\nimport type {Row} from '@tanstack/react-table';\nimport {cn, SpinnerPane, Button} from '@sqlrooms/ui';\nimport {formatCount} from '@sqlrooms/utils';\nimport React from 'react';\nimport {isQueryWithResult, useStoreWithSqlEditor} from '../SqlEditorSlice';\nimport {MessageCircleQuestion} from 'lucide-react';\nimport {QueryResultLimitSelect} from './QueryResultLimitSelect';\n\nexport interface QueryResultPanelProps {\n /** Custom class name for styling */\n className?: string;\n /** Custom actions to render in the query result panel */\n renderActions?: (query: string) => React.ReactNode;\n /** Custom font size for the table e.g. text-xs, text-sm, text-md, text-lg, text-base */\n fontSize?: string;\n /**\n * Called when a row in the results table is clicked.\n */\n onRowClick?: (args: {\n row: Row<any>;\n event: React.MouseEvent<HTMLTableRowElement>;\n }) => void;\n /**\n * Called when a row in the results table is double-clicked.\n */\n onRowDoubleClick?: (args: {\n row: Row<any>;\n event: React.MouseEvent<HTMLTableRowElement>;\n }) => void;\n /**\n * Called when the \"Ask AI\" button is clicked on an error message.\n * Receives the current query and error text.\n */\n onAskAiAboutError?: (query: string, error: string) => void;\n /** Custom value formatter for arrow data */\n formatValue?: ArrowDataTableValueFormatter;\n}\n\nexport const QueryResultPanel: React.FC<QueryResultPanelProps> = ({\n className,\n renderActions,\n fontSize = 'text-xs',\n onRowClick,\n onRowDoubleClick,\n onAskAiAboutError,\n formatValue,\n}) => {\n const queryResult = useStoreWithSqlEditor((s) => s.sqlEditor.queryResult);\n const getCurrentQuery = useStoreWithSqlEditor(\n (s) => s.sqlEditor.getCurrentQuery,\n );\n const setQueryResultLimit = useStoreWithSqlEditor(\n (s) => s.sqlEditor.setQueryResultLimit,\n );\n const queryResultLimit = useStoreWithSqlEditor(\n (s) => s.sqlEditor.queryResultLimit,\n );\n const queryResultLimitOptions = useStoreWithSqlEditor(\n (s) => s.sqlEditor.queryResultLimitOptions,\n );\n\n const arrowTableData = useArrowDataTable(\n isQueryWithResult(queryResult) ? queryResult.result : undefined,\n {formatValue},\n );\n\n const handleAskAiAboutError = React.useCallback(() => {\n if (queryResult?.status === 'error' && onAskAiAboutError) {\n const currentQuery = getCurrentQuery();\n const errorText = queryResult.error;\n onAskAiAboutError(currentQuery, errorText);\n }\n }, [queryResult, getCurrentQuery, onAskAiAboutError]);\n\n if (!queryResult) {\n return null;\n }\n\n if (queryResult?.status === 'loading') {\n return <SpinnerPane h=\"100%\" />;\n }\n\n if (queryResult?.status === 'aborted') {\n return (\n <div className=\"p-5 font-mono text-xs leading-tight text-red-500\">\n Query was aborted\n </div>\n );\n }\n if (queryResult?.status === 'error') {\n return (\n <div className=\"relative h-full w-full overflow-auto p-5\">\n {onAskAiAboutError && (\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"absolute right-2 top-2 h-8 w-8\"\n onClick={handleAskAiAboutError}\n title=\"Ask AI for help\"\n >\n <MessageCircleQuestion className=\"h-4 w-4\" />\n </Button>\n )}\n <pre\n className={cn(\n 'whitespace-pre-wrap text-xs leading-tight text-red-500',\n onAskAiAboutError && 'pr-12',\n )}\n >\n {queryResult.error}\n </pre>\n </div>\n );\n }\n\n if (queryResult?.status === 'success') {\n return (\n <div\n className={cn(\n 'relative flex h-full w-full flex-grow flex-col overflow-hidden',\n className,\n )}\n >\n {isQueryWithResult(queryResult) ? (\n <div className=\"flex h-full w-full flex-col\">\n <DataTablePaginated\n {...arrowTableData}\n className=\"flex-grow overflow-hidden\"\n fontSize={fontSize}\n isFetching={false}\n onRowClick={onRowClick}\n onRowDoubleClick={onRowDoubleClick}\n />\n <div className=\"bg-background flex w-full items-center gap-2 px-4 py-1\">\n {queryResult.result ? (\n <>\n <div className=\"font-mono text-xs\">\n {`${formatCount(queryResult.result.numRows ?? 0)} rows`}\n </div>\n\n <QueryResultLimitSelect\n value={queryResultLimit}\n onChange={setQueryResultLimit}\n options={queryResultLimitOptions}\n />\n </>\n ) : null}\n <div className=\"flex-1\" />\n {renderActions\n ? renderActions(queryResult.lastQueryStatement)\n : undefined}\n </div>\n </div>\n ) : (\n <pre className=\"p-4 text-xs leading-tight text-green-500\">\n Successfully executed query\n </pre>\n )}\n </div>\n );\n }\n\n return null;\n};\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SqlQueryPreviewProps {
|
|
3
|
+
/**
|
|
4
|
+
* The SQL query to preview
|
|
5
|
+
*/
|
|
6
|
+
query: string;
|
|
7
|
+
/**
|
|
8
|
+
* Custom class name
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Default limit for results
|
|
13
|
+
* @default 100
|
|
14
|
+
*/
|
|
15
|
+
defaultLimit?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Options for the limit dropdown
|
|
18
|
+
* @default [100, 500, 1000]
|
|
19
|
+
*/
|
|
20
|
+
limitOptions?: number[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* SQL query preview component with validation and results display.
|
|
24
|
+
* Only allows single SELECT statements.
|
|
25
|
+
* Displays results without pagination (just limited rows).
|
|
26
|
+
*/
|
|
27
|
+
export declare const SqlQueryPreview: React.FC<SqlQueryPreviewProps>;
|
|
28
|
+
//# sourceMappingURL=SqlQueryPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqlQueryPreview.d.ts","sourceRoot":"","sources":["../../src/components/SqlQueryPreview.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAG/C,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAuF1D,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DataTablePaginated, useArrowDataTable } from '@sqlrooms/data-table';
|
|
3
|
+
import { makeLimitQuery, separateLastStatement, useSql } from '@sqlrooms/duckdb';
|
|
4
|
+
import { cn } from '@sqlrooms/ui';
|
|
5
|
+
import { AlertCircle } from 'lucide-react';
|
|
6
|
+
import { useMemo, useState } from 'react';
|
|
7
|
+
import { QueryResultLimitSelect } from './QueryResultLimitSelect';
|
|
8
|
+
/**
|
|
9
|
+
* SQL query preview component with validation and results display.
|
|
10
|
+
* Only allows single SELECT statements.
|
|
11
|
+
* Displays results without pagination (just limited rows).
|
|
12
|
+
*/
|
|
13
|
+
export const SqlQueryPreview = ({ query, className, defaultLimit = 100, limitOptions = [100, 500, 1000], }) => {
|
|
14
|
+
const [limit, setLimit] = useState(defaultLimit);
|
|
15
|
+
// Validate and prepare query
|
|
16
|
+
const { limitedQuery, error } = useMemo(() => {
|
|
17
|
+
if (!query.trim()) {
|
|
18
|
+
return { limitedQuery: '', error: null };
|
|
19
|
+
}
|
|
20
|
+
const { precedingStatements, lastStatement } = separateLastStatement(query);
|
|
21
|
+
// Only allow single statements
|
|
22
|
+
if (precedingStatements.length > 0) {
|
|
23
|
+
return {
|
|
24
|
+
limitedQuery: '',
|
|
25
|
+
error: 'Only single SELECT statements are allowed for preview',
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// Apply limit to the query
|
|
29
|
+
const limited = makeLimitQuery(lastStatement, {
|
|
30
|
+
limit,
|
|
31
|
+
sanitize: true,
|
|
32
|
+
});
|
|
33
|
+
return { limitedQuery: limited, error: null };
|
|
34
|
+
}, [query, limit]);
|
|
35
|
+
// Execute query
|
|
36
|
+
const queryResult = useSql({
|
|
37
|
+
query: limitedQuery,
|
|
38
|
+
enabled: !!limitedQuery,
|
|
39
|
+
});
|
|
40
|
+
const arrowTableData = useArrowDataTable(queryResult.data?.arrowTable);
|
|
41
|
+
// Show error if validation failed
|
|
42
|
+
if (error) {
|
|
43
|
+
return (_jsxs("div", { className: cn('flex items-center gap-2 p-3 text-red-500', className), children: [_jsx(AlertCircle, { className: "h-4 w-4 flex-shrink-0" }), _jsx("span", { className: "text-xs", children: error })] }));
|
|
44
|
+
}
|
|
45
|
+
// Don't render if no query
|
|
46
|
+
if (!limitedQuery) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
// Show query error
|
|
50
|
+
if (queryResult.error) {
|
|
51
|
+
return (_jsx("div", { className: cn('p-3', className), children: _jsx("pre", { className: "text-xs leading-tight text-red-500", children: queryResult.error?.message ?? 'Unknown error' }) }));
|
|
52
|
+
}
|
|
53
|
+
return (_jsx("div", { className: cn('flex h-full flex-col', className), children: _jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: _jsx(DataTablePaginated, { ...arrowTableData, fontSize: "text-xs", isFetching: queryResult.isLoading, footerActions: _jsx(QueryResultLimitSelect, { value: limit, onChange: setLimit, options: limitOptions }) }) }) }));
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=SqlQueryPreview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqlQueryPreview.js","sourceRoot":"","sources":["../../src/components/SqlQueryPreview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAC,cAAc,EAAE,qBAAqB,EAAE,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAChC,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AACzC,OAAc,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAuBhE;;;;GAIG;AACH,MAAM,CAAC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AS,EAAE,EAAE,CAAC,0CAA0C,EAAE,SAAS,CAAC,aAEpE,KAAC,WAAW,IAAC,SAAS,EAAC,uBAAuB,GAAG,EACjD,eAAM,SAAS,EAAC,SAAS,YAAE,KAAK,GAAQ,IACpC,CACP,CAAC;IACJ,CAAC;IAED,2BAA2B;IAC3B,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mBAAmB;IACnB,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,OAAO,CACL,cAAK,SAAS,EAAE,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,YAClC,cAAK,SAAS,EAAC,oCAAoC,YAChD,WAAW,CAAC,KAAK,EAAE,OAAO,IAAI,eAAe,GAC1C,GACF,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,cAAK,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,YACnD,cAAK,SAAS,EAAC,gCAAgC,YAC7C,KAAC,kBAAkB,OACb,cAAc,EAClB,QAAQ,EAAC,SAAS,EAClB,UAAU,EAAE,WAAW,CAAC,SAAS,EACjC,aAAa,EACX,KAAC,sBAAsB,IACrB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,YAAY,GACrB,GAEJ,GACE,GACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {DataTablePaginated, useArrowDataTable} from '@sqlrooms/data-table';\nimport {makeLimitQuery, separateLastStatement, useSql} from '@sqlrooms/duckdb';\nimport {cn} from '@sqlrooms/ui';\nimport {AlertCircle} from 'lucide-react';\nimport React, {useMemo, useState} from 'react';\nimport {QueryResultLimitSelect} from './QueryResultLimitSelect';\n\nexport interface SqlQueryPreviewProps {\n /**\n * The SQL query to preview\n */\n query: string;\n /**\n * Custom class name\n */\n className?: string;\n /**\n * Default limit for results\n * @default 100\n */\n defaultLimit?: number;\n /**\n * Options for the limit dropdown\n * @default [100, 500, 1000]\n */\n limitOptions?: number[];\n}\n\n/**\n * SQL query preview component with validation and results display.\n * Only allows single SELECT statements.\n * Displays results without pagination (just limited rows).\n */\nexport const SqlQueryPreview: React.FC<SqlQueryPreviewProps> = ({\n query,\n className,\n defaultLimit = 100,\n limitOptions = [100, 500, 1000],\n}) => {\n const [limit, setLimit] = useState(defaultLimit);\n\n // Validate and prepare query\n const {limitedQuery, error} = useMemo(() => {\n if (!query.trim()) {\n return {limitedQuery: '', error: null};\n }\n\n const {precedingStatements, lastStatement} = separateLastStatement(query);\n\n // Only allow single statements\n if (precedingStatements.length > 0) {\n return {\n limitedQuery: '',\n error: 'Only single SELECT statements are allowed for preview',\n };\n }\n\n // Apply limit to the query\n const limited = makeLimitQuery(lastStatement, {\n limit,\n sanitize: true,\n });\n\n return {limitedQuery: limited, error: null};\n }, [query, limit]);\n\n // Execute query\n const queryResult = useSql({\n query: limitedQuery,\n enabled: !!limitedQuery,\n });\n\n const arrowTableData = useArrowDataTable(queryResult.data?.arrowTable);\n\n // Show error if validation failed\n if (error) {\n return (\n <div\n className={cn('flex items-center gap-2 p-3 text-red-500', className)}\n >\n <AlertCircle className=\"h-4 w-4 flex-shrink-0\" />\n <span className=\"text-xs\">{error}</span>\n </div>\n );\n }\n\n // Don't render if no query\n if (!limitedQuery) {\n return null;\n }\n\n // Show query error\n if (queryResult.error) {\n return (\n <div className={cn('p-3', className)}>\n <pre className=\"text-xs leading-tight text-red-500\">\n {queryResult.error?.message ?? 'Unknown error'}\n </pre>\n </div>\n );\n }\n\n return (\n <div className={cn('flex h-full flex-col', className)}>\n <div className=\"min-h-0 flex-1 overflow-hidden\">\n <DataTablePaginated\n {...arrowTableData}\n fontSize=\"text-xs\"\n isFetching={queryResult.isLoading}\n footerActions={\n <QueryResultLimitSelect\n value={limit}\n onChange={setLimit}\n options={limitOptions}\n />\n }\n />\n </div>\n </div>\n );\n};\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -24,5 +24,9 @@ export type { QueryEditorPanelProps } from './components/QueryEditorPanel';
|
|
|
24
24
|
export { QueryEditorPanelActions } from './components/QueryEditorPanelActions';
|
|
25
25
|
export { QueryEditorPanelTabsList } from './components/QueryEditorPanelTabsList';
|
|
26
26
|
export { QueryEditorPanelEditor } from './components/QueryEditorPanelEditor';
|
|
27
|
+
export { QueryResultLimitSelect } from './components/QueryResultLimitSelect';
|
|
28
|
+
export type { QueryResultLimitSelectProps } from './components/QueryResultLimitSelect';
|
|
29
|
+
export { SqlQueryPreview } from './components/SqlQueryPreview';
|
|
30
|
+
export type { SqlQueryPreviewProps } from './components/SqlQueryPreview';
|
|
27
31
|
export { SqlEditorSliceConfig, createDefaultSqlEditorConfig, } from '@sqlrooms/sql-editor-config';
|
|
28
32
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EACV,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC;AACjD,YAAY,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AACtD,YAAY,EAAC,WAAW,EAAE,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,YAAY,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,mBAAmB,EAAC,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AAC;AAClD,YAAY,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AACrE,YAAY,EAAC,wBAAwB,EAAC,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC/D,YAAY,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,YAAY,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC/D,YAAY,EAAC,qBAAqB,EAAC,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAC,uBAAuB,EAAC,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAC3E,YAAY,EAAC,2BAA2B,EAAC,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAC7D,YAAY,EAAC,oBAAoB,EAAC,MAAM,8BAA8B,CAAC;AAIvE,OAAO,EACL,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,8 @@ export { QueryEditorPanel } from './components/QueryEditorPanel';
|
|
|
16
16
|
export { QueryEditorPanelActions } from './components/QueryEditorPanelActions';
|
|
17
17
|
export { QueryEditorPanelTabsList } from './components/QueryEditorPanelTabsList';
|
|
18
18
|
export { QueryEditorPanelEditor } from './components/QueryEditorPanelEditor';
|
|
19
|
+
export { QueryResultLimitSelect } from './components/QueryResultLimitSelect';
|
|
20
|
+
export { SqlQueryPreview } from './components/SqlQueryPreview';
|
|
19
21
|
// Re-export from @sqlrooms/sql-editor-config
|
|
20
22
|
// Values also export their corresponding types automatically (Zod pattern)
|
|
21
23
|
export { SqlEditorSliceConfig, createDefaultSqlEditorConfig, } from '@sqlrooms/sql-editor-config';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAK1E,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAC,uBAAuB,EAAC,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAE3E,6CAA6C;AAC7C,2EAA2E;AAC3E,OAAO,EACL,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\nexport {default as CreateTableModal} from './components/CreateTableModal';\nexport type {\n CreateTableModalProps,\n CreateTableFormInitialValues,\n} from './components/CreateTableModal';\nexport {default as SqlEditor} from './SqlEditor';\nexport type {SqlEditorProps} from './SqlEditor';\nexport {default as SqlEditorModal} from './SqlEditorModal';\nexport {createSqlEditorSlice} from './SqlEditorSlice';\nexport type {QueryResult, SqlEditorSliceState} from './SqlEditorSlice';\nexport {SqlQueryDataSourcesPanel} from './components/SqlQueryDataSourcesPanel';\nexport {SqlMonacoEditor} from './SqlMonacoEditor';\nexport type {SqlMonacoEditorProps} from './SqlMonacoEditor';\nexport {TableStructurePanel} from './components/TableStructurePanel';\nexport type {TableStructurePanelProps} from './components/TableStructurePanel';\nexport {QueryResultPanel} from './components/QueryResultPanel';\nexport type {QueryResultPanelProps} from './components/QueryResultPanel';\nexport {SqlEditorHeader} from './components/SqlEditorHeader';\nexport type {SqlEditorHeaderProps} from './components/SqlEditorHeader';\nexport {\n SqlReferenceButton,\n SqlReferenceButtonContent,\n} from './components/SqlReferenceButton';\nexport {QueryEditorPanel} from './components/QueryEditorPanel';\nexport type {QueryEditorPanelProps} from './components/QueryEditorPanel';\nexport {QueryEditorPanelActions} from './components/QueryEditorPanelActions';\nexport {QueryEditorPanelTabsList} from './components/QueryEditorPanelTabsList';\nexport {QueryEditorPanelEditor} from './components/QueryEditorPanelEditor';\n\n// Re-export from @sqlrooms/sql-editor-config\n// Values also export their corresponding types automatically (Zod pattern)\nexport {\n SqlEditorSliceConfig,\n createDefaultSqlEditorConfig,\n} from '@sqlrooms/sql-editor-config';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAK1E,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EACL,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAE/D,OAAO,EAAC,uBAAuB,EAAC,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAC,sBAAsB,EAAC,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAC;AAG7D,6CAA6C;AAC7C,2EAA2E;AAC3E,OAAO,EACL,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC","sourcesContent":["/**\n * {@include ../README.md}\n * @packageDocumentation\n */\nexport {default as CreateTableModal} from './components/CreateTableModal';\nexport type {\n CreateTableModalProps,\n CreateTableFormInitialValues,\n} from './components/CreateTableModal';\nexport {default as SqlEditor} from './SqlEditor';\nexport type {SqlEditorProps} from './SqlEditor';\nexport {default as SqlEditorModal} from './SqlEditorModal';\nexport {createSqlEditorSlice} from './SqlEditorSlice';\nexport type {QueryResult, SqlEditorSliceState} from './SqlEditorSlice';\nexport {SqlQueryDataSourcesPanel} from './components/SqlQueryDataSourcesPanel';\nexport {SqlMonacoEditor} from './SqlMonacoEditor';\nexport type {SqlMonacoEditorProps} from './SqlMonacoEditor';\nexport {TableStructurePanel} from './components/TableStructurePanel';\nexport type {TableStructurePanelProps} from './components/TableStructurePanel';\nexport {QueryResultPanel} from './components/QueryResultPanel';\nexport type {QueryResultPanelProps} from './components/QueryResultPanel';\nexport {SqlEditorHeader} from './components/SqlEditorHeader';\nexport type {SqlEditorHeaderProps} from './components/SqlEditorHeader';\nexport {\n SqlReferenceButton,\n SqlReferenceButtonContent,\n} from './components/SqlReferenceButton';\nexport {QueryEditorPanel} from './components/QueryEditorPanel';\nexport type {QueryEditorPanelProps} from './components/QueryEditorPanel';\nexport {QueryEditorPanelActions} from './components/QueryEditorPanelActions';\nexport {QueryEditorPanelTabsList} from './components/QueryEditorPanelTabsList';\nexport {QueryEditorPanelEditor} from './components/QueryEditorPanelEditor';\nexport {QueryResultLimitSelect} from './components/QueryResultLimitSelect';\nexport type {QueryResultLimitSelectProps} from './components/QueryResultLimitSelect';\nexport {SqlQueryPreview} from './components/SqlQueryPreview';\nexport type {SqlQueryPreviewProps} from './components/SqlQueryPreview';\n\n// Re-export from @sqlrooms/sql-editor-config\n// Values also export their corresponding types automatically (Zod pattern)\nexport {\n SqlEditorSliceConfig,\n createDefaultSqlEditorConfig,\n} from '@sqlrooms/sql-editor-config';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/sql-editor",
|
|
3
|
-
"version": "0.27.0-rc.
|
|
3
|
+
"version": "0.27.0-rc.1",
|
|
4
4
|
"author": "SQLRooms Contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"@hookform/resolvers": "^5.0.0",
|
|
30
30
|
"@monaco-editor/react": "^4.7.0",
|
|
31
31
|
"@paralleldrive/cuid2": "^3.0.0",
|
|
32
|
-
"@sqlrooms/data-table": "0.27.0-rc.
|
|
33
|
-
"@sqlrooms/duckdb": "0.27.0-rc.
|
|
34
|
-
"@sqlrooms/monaco-editor": "0.27.0-rc.
|
|
35
|
-
"@sqlrooms/room-shell": "0.27.0-rc.
|
|
36
|
-
"@sqlrooms/schema-tree": "0.27.0-rc.
|
|
37
|
-
"@sqlrooms/sql-editor-config": "0.27.0-rc.
|
|
38
|
-
"@sqlrooms/ui": "0.27.0-rc.
|
|
39
|
-
"@sqlrooms/utils": "0.27.0-rc.
|
|
32
|
+
"@sqlrooms/data-table": "0.27.0-rc.1",
|
|
33
|
+
"@sqlrooms/duckdb": "0.27.0-rc.1",
|
|
34
|
+
"@sqlrooms/monaco-editor": "0.27.0-rc.1",
|
|
35
|
+
"@sqlrooms/room-shell": "0.27.0-rc.1",
|
|
36
|
+
"@sqlrooms/schema-tree": "0.27.0-rc.1",
|
|
37
|
+
"@sqlrooms/sql-editor-config": "0.27.0-rc.1",
|
|
38
|
+
"@sqlrooms/ui": "0.27.0-rc.1",
|
|
39
|
+
"@sqlrooms/utils": "0.27.0-rc.1",
|
|
40
40
|
"@tanstack/react-table": "^8.21.3",
|
|
41
41
|
"d3-dsv": "^3.0.1",
|
|
42
42
|
"file-saver": "^2.0.5",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"@types/react": "^19.1.13",
|
|
59
59
|
"@types/react-dom": "^19.1.9"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "392da9702a049dc3d57fa467bbbf52bf2db7ffd1"
|
|
62
62
|
}
|