@sqlrooms/schema-tree 0.24.6 → 0.24.8
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TableNodeObject } from '@sqlrooms/duckdb';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { useDisclosure } from '@sqlrooms/ui';
|
|
4
|
-
export declare const defaultRenderTableNodeMenuItems: (nodeObject: TableNodeObject,
|
|
4
|
+
export declare const defaultRenderTableNodeMenuItems: (nodeObject: TableNodeObject, viewTableModal?: ReturnType<typeof useDisclosure>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare const TableTreeNode: FC<{
|
|
6
6
|
className?: string;
|
|
7
7
|
nodeObject: TableNodeObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAyB,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AACzB,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAQ3C,eAAO,MAAM,+BAA+B,GAC1C,YAAY,eAAe,EAC3B,
|
|
1
|
+
{"version":3,"file":"TableTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAyB,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AACzB,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAQ3C,eAAO,MAAM,+BAA+B,GAC1C,YAAY,eAAe,EAC3B,iBAAiB,UAAU,CAAC,OAAO,aAAa,CAAC,4CAgDlD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,eAAe,CAAC;IAC5B,eAAe,CAAC,EAAE,CAChB,UAAU,EAAE,eAAe,EAC3B,UAAU,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,KACzC,KAAK,CAAC,SAAS,CAAC;CACtB,CAkCA,CAAC"}
|
|
@@ -3,19 +3,19 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { makeQualifiedTableName } from '@sqlrooms/duckdb';
|
|
4
4
|
import { CopyIcon, EyeIcon, SquareTerminalIcon, TableIcon } from 'lucide-react';
|
|
5
5
|
import { useDisclosure } from '@sqlrooms/ui';
|
|
6
|
-
import DataTableModal from '@sqlrooms/data-table
|
|
6
|
+
import { DataTableModal } from '@sqlrooms/data-table';
|
|
7
7
|
import { BaseTreeNode } from './BaseTreeNode';
|
|
8
8
|
import { TreeNodeActionsMenu, TreeNodeActionsMenuItem, } from './TreeNodeActionsMenu';
|
|
9
|
-
export const defaultRenderTableNodeMenuItems = (nodeObject,
|
|
9
|
+
export const defaultRenderTableNodeMenuItems = (nodeObject, viewTableModal) => {
|
|
10
10
|
const { database, schema, name } = nodeObject;
|
|
11
11
|
const qualifiedTableName = makeQualifiedTableName({
|
|
12
12
|
database,
|
|
13
13
|
schema,
|
|
14
14
|
table: name,
|
|
15
15
|
});
|
|
16
|
-
return (_jsxs(_Fragment, { children: [_jsxs(TreeNodeActionsMenuItem, { onClick: () => {
|
|
17
|
-
|
|
18
|
-
}, children: [_jsx(EyeIcon, { width: "15px" }), "View table"] }), _jsxs(TreeNodeActionsMenuItem, { onClick: () => {
|
|
16
|
+
return (_jsxs(_Fragment, { children: [viewTableModal && (_jsxs(TreeNodeActionsMenuItem, { onClick: () => {
|
|
17
|
+
viewTableModal.onOpen();
|
|
18
|
+
}, children: [_jsx(EyeIcon, { width: "15px" }), "View table"] })), _jsxs(TreeNodeActionsMenuItem, { onClick: () => {
|
|
19
19
|
navigator.clipboard.writeText(qualifiedTableName.table);
|
|
20
20
|
}, children: [_jsx(CopyIcon, { width: "15px" }), "Copy table name"] }), _jsxs(TreeNodeActionsMenuItem, { onClick: () => {
|
|
21
21
|
navigator.clipboard.writeText(qualifiedTableName.toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableTreeNode.js","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":";AAAA,4DAA4D;AAE5D,OAAO,EAAC,sBAAsB,EAAkB,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,cAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"TableTreeNode.js","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":";AAAA,4DAA4D;AAE5D,OAAO,EAAC,sBAAsB,EAAkB,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,UAA2B,EAC3B,cAAiD,EACjD,EAAE;IACF,MAAM,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,UAAU,CAAC;IAC5C,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;QAChD,QAAQ;QACR,MAAM;QACN,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;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AAkB,EAAE,CAAC;IAEvD,OAAO,CACL,8BACE,MAAC,YAAY,IAAC,OAAO,QAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,aAChE,eAAK,SAAS,EAAC,oCAAoC,aACjD,KAAC,SAAS,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,wBAAwB,GAAG,EAC5D,eAAM,SAAS,EAAC,SAAS,YAAE,UAAU,CAAC,IAAI,GAAQ,IAC9C,EACN,KAAC,mBAAmB,cACjB,eAAe,CAAC,UAAU,EAAE,UAAU,CAAC,GACpB,IACT,EACf,KAAC,cAAc,IACb,KAAK,EAAE,kBAAkB,CAAC,KAAK,EAC/B,KAAK,EAAE,QAAQ,EACf,UAAU,EAAE,UAAU,GACtB,IACD,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.\n\nimport {makeQualifiedTableName, TableNodeObject} from '@sqlrooms/duckdb';\nimport {CopyIcon, EyeIcon, SquareTerminalIcon, TableIcon} from 'lucide-react';\nimport {FC} from 'react';\nimport {useDisclosure} from '@sqlrooms/ui';\nimport {DataTableModal} from '@sqlrooms/data-table';\nimport {BaseTreeNode} from './BaseTreeNode';\nimport {\n TreeNodeActionsMenu,\n TreeNodeActionsMenuItem,\n} from './TreeNodeActionsMenu';\n\nexport const defaultRenderTableNodeMenuItems = (\n nodeObject: TableNodeObject,\n viewTableModal?: ReturnType<typeof useDisclosure>,\n) => {\n const {database, schema, name} = nodeObject;\n const qualifiedTableName = makeQualifiedTableName({\n database,\n schema,\n table: name,\n });\n return (\n <>\n {viewTableModal && (\n <TreeNodeActionsMenuItem\n onClick={() => {\n viewTableModal.onOpen();\n }}\n >\n <EyeIcon width=\"15px\" />\n View table\n </TreeNodeActionsMenuItem>\n )}\n <TreeNodeActionsMenuItem\n onClick={() => {\n navigator.clipboard.writeText(qualifiedTableName.table);\n }}\n >\n <CopyIcon width=\"15px\" />\n Copy table name\n </TreeNodeActionsMenuItem>\n\n <TreeNodeActionsMenuItem\n onClick={() => {\n navigator.clipboard.writeText(qualifiedTableName.toString());\n }}\n >\n <CopyIcon width=\"15px\" />\n Copy qualified table name\n </TreeNodeActionsMenuItem>\n\n <TreeNodeActionsMenuItem\n onClick={() => {\n navigator.clipboard.writeText(`SELECT * FROM ${qualifiedTableName}`);\n }}\n >\n <SquareTerminalIcon width=\"15px\" />\n Copy SELECT query\n </TreeNodeActionsMenuItem>\n </>\n );\n};\n\nexport const TableTreeNode: FC<{\n className?: string;\n nodeObject: TableNodeObject;\n renderMenuItems?: (\n nodeObject: TableNodeObject,\n tableModal: ReturnType<typeof useDisclosure>,\n ) => React.ReactNode;\n}> = (props) => {\n const {\n className,\n nodeObject,\n renderMenuItems = defaultRenderTableNodeMenuItems,\n } = props;\n\n const tableModal = useDisclosure();\n const {database, schema, name} = nodeObject;\n const qualifiedTableName = makeQualifiedTableName({\n database,\n schema,\n table: name,\n });\n const sqlQuery = `SELECT * FROM ${qualifiedTableName}`;\n\n return (\n <>\n <BaseTreeNode asChild className={className} nodeObject={nodeObject}>\n <div className=\"flex w-full items-center space-x-2\">\n <TableIcon size=\"16px\" className=\"shrink-0 text-blue-500\" />\n <span className=\"text-sm\">{nodeObject.name}</span>\n </div>\n <TreeNodeActionsMenu>\n {renderMenuItems(nodeObject, tableModal)}\n </TreeNodeActionsMenu>\n </BaseTreeNode>\n <DataTableModal\n title={qualifiedTableName.table}\n query={sqlQuery}\n tableModal={tableModal}\n />\n </>\n );\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/schema-tree",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.8",
|
|
4
4
|
"author": "Ilya Boyandin <ilya@boyandin.me>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"typedoc": "typedoc"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@sqlrooms/data-table": "0.24.
|
|
28
|
-
"@sqlrooms/duckdb": "0.24.
|
|
29
|
-
"@sqlrooms/ui": "0.24.
|
|
27
|
+
"@sqlrooms/data-table": "0.24.8",
|
|
28
|
+
"@sqlrooms/duckdb": "0.24.8",
|
|
29
|
+
"@sqlrooms/ui": "0.24.8",
|
|
30
30
|
"lucide-react": "^0.474.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"@types/react": "^19.1.7",
|
|
38
38
|
"@types/react-dom": "^19.1.6"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "0052b4e350225495bcaf513e75307868e57364a0"
|
|
41
41
|
}
|