@sqlrooms/schema-tree 0.26.0 → 0.26.1-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/dist/nodes/BaseTreeNode.js +1 -1
- package/dist/nodes/BaseTreeNode.js.map +1 -1
- package/dist/nodes/ColumnTreeNode.d.ts.map +1 -1
- package/dist/nodes/ColumnTreeNode.js +1 -1
- package/dist/nodes/ColumnTreeNode.js.map +1 -1
- package/dist/nodes/DatabaseTreeNode.d.ts.map +1 -1
- package/dist/nodes/DatabaseTreeNode.js +1 -1
- package/dist/nodes/DatabaseTreeNode.js.map +1 -1
- package/dist/nodes/SchemaTreeNode.d.ts.map +1 -1
- package/dist/nodes/SchemaTreeNode.js +1 -1
- package/dist/nodes/SchemaTreeNode.js.map +1 -1
- package/dist/nodes/TableTreeNode.d.ts.map +1 -1
- package/dist/nodes/TableTreeNode.js +1 -1
- package/dist/nodes/TableTreeNode.js.map +1 -1
- package/dist/nodes/TreeNodeActionsMenu.js +1 -1
- package/dist/nodes/TreeNodeActionsMenu.js.map +1 -1
- package/package.json +7 -7
|
@@ -3,6 +3,6 @@ import { cn, Slot } from '@sqlrooms/ui';
|
|
|
3
3
|
export function BaseTreeNode(props) {
|
|
4
4
|
const { className, asChild, children } = props;
|
|
5
5
|
const Comp = asChild ? Slot : 'div';
|
|
6
|
-
return (_jsx(Comp, { className: cn('hover:bg-foreground/10 h-[22px] w-full flex-grow cursor-pointer select-none rounded-sm p-[1px]', className), children: _jsx("div", { className: cn('group relative flex w-full items-center overflow-hidden', className), children: _jsx("div", { className: "absolute flex h-full w-full items-center", children: children }) }) }));
|
|
6
|
+
return (_jsx(Comp, { className: cn('hover:bg-foreground/10 h-[22px] w-full flex-grow cursor-pointer select-none rounded-sm p-[1px]', className), children: _jsx("div", { className: cn('group relative flex w-full items-center overflow-hidden', className), children: _jsx("div", { className: "absolute flex h-full w-full items-center whitespace-nowrap", children: children }) }) }));
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=BaseTreeNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseTreeNode.js","sourceRoot":"","sources":["../../src/nodes/BaseTreeNode.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,EAAE,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAGtC,MAAM,UAAU,YAAY,CAC1B,KAIE;IAEF,MAAM,EAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,GAAG,KAAK,CAAC;IAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACpC,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,gGAAgG,EAChG,SAAS,CACV,YAED,cACE,SAAS,EAAE,EAAE,CACX,yDAAyD,EACzD,SAAS,CACV,YAED,cAAK,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"BaseTreeNode.js","sourceRoot":"","sources":["../../src/nodes/BaseTreeNode.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,EAAE,EAAE,IAAI,EAAC,MAAM,cAAc,CAAC;AAGtC,MAAM,UAAU,YAAY,CAC1B,KAIE;IAEF,MAAM,EAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,GAAG,KAAK,CAAC;IAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACpC,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,EAAE,CACX,gGAAgG,EAChG,SAAS,CACV,YAED,cACE,SAAS,EAAE,EAAE,CACX,yDAAyD,EACzD,SAAS,CACV,YAED,cAAK,SAAS,EAAC,4DAA4D,YACxE,QAAQ,GACL,GACF,GACD,CACR,CAAC;AACJ,CAAC","sourcesContent":["import {cn, Slot} from '@sqlrooms/ui';\nimport {PropsWithChildren} from 'react';\n\nexport function BaseTreeNode<T>(\n props: PropsWithChildren<{\n className?: string;\n nodeObject: T;\n asChild?: boolean;\n }>,\n) {\n const {className, asChild, children} = props;\n const Comp = asChild ? Slot : 'div';\n return (\n <Comp\n className={cn(\n 'hover:bg-foreground/10 h-[22px] w-full flex-grow cursor-pointer select-none rounded-sm p-[1px]',\n className,\n )}\n >\n <div\n className={cn(\n 'group relative flex w-full items-center overflow-hidden',\n className,\n )}\n >\n <div className=\"absolute flex h-full w-full items-center whitespace-nowrap\">\n {children}\n </div>\n </div>\n </Comp>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/ColumnTreeNode.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAQzB,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACvC,
|
|
1
|
+
{"version":3,"file":"ColumnTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/ColumnTreeNode.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAQzB,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACvC,CAgCA,CAAC"}
|
|
@@ -7,6 +7,6 @@ import { TreeNodeActionsMenu, TreeNodeActionsMenuItem, } from './TreeNodeActions
|
|
|
7
7
|
import { cn } from '@sqlrooms/ui';
|
|
8
8
|
export const ColumnTreeNode = (props) => {
|
|
9
9
|
const { className, nodeObject, additionalMenuItems } = props;
|
|
10
|
-
return (_jsxs(BaseTreeNode, { asChild: true, className: cn(className, 'h-[18px]'), nodeObject: nodeObject, children: [_jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(ColumnTypeBadge, { className: "opacity-50", columnType: nodeObject.columnType, typeCategory: nodeObject.columnTypeCategory }), _jsx("span", { className: "text-xs", children: nodeObject.name })] }), _jsxs(TreeNodeActionsMenu, { children: [_jsxs(TreeNodeActionsMenuItem, { onClick: () => navigator.clipboard.writeText(nodeObject.name), children: [_jsx(CopyIcon, { width: "15px" }), "Copy column name"] }), additionalMenuItems] })] }));
|
|
10
|
+
return (_jsxs(BaseTreeNode, { asChild: true, className: cn(className, 'h-[18px]'), nodeObject: nodeObject, children: [_jsxs("div", { className: "relative flex w-full items-center space-x-2", children: [_jsx(ColumnTypeBadge, { className: "opacity-50", columnType: nodeObject.columnType, typeCategory: nodeObject.columnTypeCategory }), _jsx("span", { className: "truncate whitespace-nowrap text-xs", title: nodeObject.name, children: nodeObject.name })] }), _jsxs(TreeNodeActionsMenu, { children: [_jsxs(TreeNodeActionsMenuItem, { onClick: () => navigator.clipboard.writeText(nodeObject.name), children: [_jsx(CopyIcon, { width: "15px" }), "Copy column name"] }), additionalMenuItems] })] }));
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=ColumnTreeNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnTreeNode.js","sourceRoot":"","sources":["../../src/nodes/ColumnTreeNode.tsx"],"names":[],"mappings":";AAAA,4DAA4D;AAE5D,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,uBAAu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MAAC,mBAAmB,eAClB,MAAC,uBAAuB,IACtB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,aAE7D,KAAC,QAAQ,IAAC,KAAK,EAAC,MAAM,GAAG,wBAED,EACzB,mBAAmB,IACA,IACT,CAChB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.\n\nimport {ColumnTypeBadge} from '@sqlrooms/data-table';\nimport {ColumnNodeObject} from '@sqlrooms/duckdb';\nimport {CopyIcon} from 'lucide-react';\nimport {FC} from 'react';\nimport {BaseTreeNode} from './BaseTreeNode';\nimport {\n TreeNodeActionsMenu,\n TreeNodeActionsMenuItem,\n} from './TreeNodeActionsMenu';\nimport {cn} from '@sqlrooms/ui';\n\nexport const ColumnTreeNode: FC<{\n className?: string;\n nodeObject: ColumnNodeObject;\n additionalMenuItems?: React.ReactNode;\n}> = (props) => {\n const {className, nodeObject, additionalMenuItems} = props;\n return (\n <BaseTreeNode\n asChild\n className={cn(className, 'h-[18px]')}\n nodeObject={nodeObject}\n >\n <div className=\"relative flex w-full items-center space-x-2\">\n <ColumnTypeBadge\n className=\"opacity-50\"\n columnType={nodeObject.columnType}\n typeCategory={nodeObject.columnTypeCategory}\n />\n <span\n className=\"truncate whitespace-nowrap text-xs\"\n title={nodeObject.name}\n >\n {nodeObject.name}\n </span>\n </div>\n <TreeNodeActionsMenu>\n <TreeNodeActionsMenuItem\n onClick={() => navigator.clipboard.writeText(nodeObject.name)}\n >\n <CopyIcon width=\"15px\" />\n Copy column name\n </TreeNodeActionsMenuItem>\n {additionalMenuItems}\n </TreeNodeActionsMenu>\n </BaseTreeNode>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatabaseTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/DatabaseTreeNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAOzB,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACvC,
|
|
1
|
+
{"version":3,"file":"DatabaseTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/DatabaseTreeNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAOzB,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACvC,CAqBA,CAAC"}
|
|
@@ -4,6 +4,6 @@ import { BaseTreeNode } from './BaseTreeNode';
|
|
|
4
4
|
import { TreeNodeActionsMenu, TreeNodeActionsMenuItem, } from './TreeNodeActionsMenu';
|
|
5
5
|
export const DatabaseTreeNode = (props) => {
|
|
6
6
|
const { className, nodeObject, additionalMenuItems } = props;
|
|
7
|
-
return (_jsxs(BaseTreeNode, { asChild: true, className: className, nodeObject: nodeObject, children: [_jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(DatabaseIcon, { size: "16px", className: "shrink-0 text-green-500" }), _jsx("span", { children: nodeObject.name })] }), _jsxs(TreeNodeActionsMenu, { children: [_jsxs(TreeNodeActionsMenuItem, { onClick: () => navigator.clipboard.writeText(nodeObject.name), children: [_jsx(CopyIcon, { width: "15px" }), "Copy database name"] }), additionalMenuItems] })] }));
|
|
7
|
+
return (_jsxs(BaseTreeNode, { asChild: true, className: className, nodeObject: nodeObject, children: [_jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(DatabaseIcon, { size: "16px", className: "shrink-0 text-green-500" }), _jsx("span", { className: "truncate whitespace-nowrap", title: nodeObject.name, children: nodeObject.name })] }), _jsxs(TreeNodeActionsMenu, { children: [_jsxs(TreeNodeActionsMenuItem, { onClick: () => navigator.clipboard.writeText(nodeObject.name), children: [_jsx(CopyIcon, { width: "15px" }), "Copy database name"] }), additionalMenuItems] })] }));
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=DatabaseTreeNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatabaseTreeNode.js","sourceRoot":"","sources":["../../src/nodes/DatabaseTreeNode.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,gBAAgB,GAIxB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EAAC,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAC,GAAG,KAAK,CAAC;IAC3D,OAAO,CACL,MAAC,YAAY,IAAC,OAAO,QAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,aAChE,eAAK,SAAS,EAAC,oCAAoC,aACjD,KAAC,YAAY,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,yBAAyB,GAAG,EAChE,
|
|
1
|
+
{"version":3,"file":"DatabaseTreeNode.js","sourceRoot":"","sources":["../../src/nodes/DatabaseTreeNode.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAEpD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,gBAAgB,GAIxB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EAAC,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAC,GAAG,KAAK,CAAC;IAC3D,OAAO,CACL,MAAC,YAAY,IAAC,OAAO,QAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,aAChE,eAAK,SAAS,EAAC,oCAAoC,aACjD,KAAC,YAAY,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,yBAAyB,GAAG,EAChE,eAAM,SAAS,EAAC,4BAA4B,EAAC,KAAK,EAAE,UAAU,CAAC,IAAI,YAChE,UAAU,CAAC,IAAI,GACX,IACH,EACN,MAAC,mBAAmB,eAClB,MAAC,uBAAuB,IACtB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,aAE7D,KAAC,QAAQ,IAAC,KAAK,EAAC,MAAM,GAAG,0BAED,EACzB,mBAAmB,IACA,IACT,CAChB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.\n\nimport {DatabaseNodeObject} from '@sqlrooms/duckdb';\nimport {CopyIcon, DatabaseIcon} from 'lucide-react';\nimport {FC} from 'react';\nimport {BaseTreeNode} from './BaseTreeNode';\nimport {\n TreeNodeActionsMenu,\n TreeNodeActionsMenuItem,\n} from './TreeNodeActionsMenu';\n\nexport const DatabaseTreeNode: FC<{\n className?: string;\n nodeObject: DatabaseNodeObject;\n additionalMenuItems?: React.ReactNode;\n}> = (props) => {\n const {className, nodeObject, additionalMenuItems} = props;\n return (\n <BaseTreeNode asChild className={className} nodeObject={nodeObject}>\n <div className=\"flex w-full items-center space-x-2\">\n <DatabaseIcon size=\"16px\" className=\"shrink-0 text-green-500\" />\n <span className=\"truncate whitespace-nowrap\" title={nodeObject.name}>\n {nodeObject.name}\n </span>\n </div>\n <TreeNodeActionsMenu>\n <TreeNodeActionsMenuItem\n onClick={() => navigator.clipboard.writeText(nodeObject.name)}\n >\n <CopyIcon width=\"15px\" />\n Copy database name\n </TreeNodeActionsMenuItem>\n {additionalMenuItems}\n </TreeNodeActionsMenu>\n </BaseTreeNode>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/SchemaTreeNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAOzB,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACvC,
|
|
1
|
+
{"version":3,"file":"SchemaTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/SchemaTreeNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAOzB,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACvC,CAqBA,CAAC"}
|
|
@@ -4,6 +4,6 @@ import { BaseTreeNode } from './BaseTreeNode';
|
|
|
4
4
|
import { TreeNodeActionsMenu, TreeNodeActionsMenuItem, } from './TreeNodeActionsMenu';
|
|
5
5
|
export const SchemaTreeNode = (props) => {
|
|
6
6
|
const { className, nodeObject, additionalMenuItems } = props;
|
|
7
|
-
return (_jsxs(BaseTreeNode, { asChild: true, className: className, nodeObject: nodeObject, children: [_jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(FolderIcon, { size: "16px", className: "shrink-0 text-yellow-500" }), _jsx("span", { children: nodeObject.name })] }), _jsxs(TreeNodeActionsMenu, { children: [_jsxs(TreeNodeActionsMenuItem, { onClick: () => navigator.clipboard.writeText(nodeObject.name), children: [_jsx(CopyIcon, { width: "15px" }), "Copy schema name"] }), additionalMenuItems] })] }));
|
|
7
|
+
return (_jsxs(BaseTreeNode, { asChild: true, className: className, nodeObject: nodeObject, children: [_jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(FolderIcon, { size: "16px", className: "shrink-0 text-yellow-500" }), _jsx("span", { className: "truncate whitespace-nowrap", title: nodeObject.name, children: nodeObject.name })] }), _jsxs(TreeNodeActionsMenu, { children: [_jsxs(TreeNodeActionsMenuItem, { onClick: () => navigator.clipboard.writeText(nodeObject.name), children: [_jsx(CopyIcon, { width: "15px" }), "Copy schema name"] }), additionalMenuItems] })] }));
|
|
8
8
|
};
|
|
9
9
|
//# sourceMappingURL=SchemaTreeNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaTreeNode.js","sourceRoot":"","sources":["../../src/nodes/SchemaTreeNode.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAElD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,cAAc,GAItB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EAAC,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAC,GAAG,KAAK,CAAC;IAC3D,OAAO,CACL,MAAC,YAAY,IAAC,OAAO,QAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,aAChE,eAAK,SAAS,EAAC,oCAAoC,aACjD,KAAC,UAAU,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,0BAA0B,GAAG,EAC/D,
|
|
1
|
+
{"version":3,"file":"SchemaTreeNode.js","sourceRoot":"","sources":["../../src/nodes/SchemaTreeNode.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAElD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,cAAc,GAItB,CAAC,KAAK,EAAE,EAAE;IACb,MAAM,EAAC,SAAS,EAAE,UAAU,EAAE,mBAAmB,EAAC,GAAG,KAAK,CAAC;IAC3D,OAAO,CACL,MAAC,YAAY,IAAC,OAAO,QAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,aAChE,eAAK,SAAS,EAAC,oCAAoC,aACjD,KAAC,UAAU,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,0BAA0B,GAAG,EAC/D,eAAM,SAAS,EAAC,4BAA4B,EAAC,KAAK,EAAE,UAAU,CAAC,IAAI,YAChE,UAAU,CAAC,IAAI,GACX,IACH,EACN,MAAC,mBAAmB,eAClB,MAAC,uBAAuB,IACtB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,aAE7D,KAAC,QAAQ,IAAC,KAAK,EAAC,MAAM,GAAG,wBAED,EACzB,mBAAmB,IACA,IACT,CAChB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.\n\nimport {SchemaNodeObject} from '@sqlrooms/duckdb';\nimport {CopyIcon, FolderIcon} from 'lucide-react';\nimport {FC} from 'react';\nimport {BaseTreeNode} from './BaseTreeNode';\nimport {\n TreeNodeActionsMenu,\n TreeNodeActionsMenuItem,\n} from './TreeNodeActionsMenu';\n\nexport const SchemaTreeNode: FC<{\n className?: string;\n nodeObject: SchemaNodeObject;\n additionalMenuItems?: React.ReactNode;\n}> = (props) => {\n const {className, nodeObject, additionalMenuItems} = props;\n return (\n <BaseTreeNode asChild className={className} nodeObject={nodeObject}>\n <div className=\"flex w-full items-center space-x-2\">\n <FolderIcon size=\"16px\" className=\"shrink-0 text-yellow-500\" />\n <span className=\"truncate whitespace-nowrap\" title={nodeObject.name}>\n {nodeObject.name}\n </span>\n </div>\n <TreeNodeActionsMenu>\n <TreeNodeActionsMenuItem\n onClick={() => navigator.clipboard.writeText(nodeObject.name)}\n >\n <CopyIcon width=\"15px\" />\n Copy schema name\n </TreeNodeActionsMenuItem>\n {additionalMenuItems}\n </TreeNodeActionsMenu>\n </BaseTreeNode>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAyB,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAOzB,eAAO,MAAM,+BAA+B,GAC1C,YAAY,eAAe,EAC3B,iBAAiB,UAAU,CAAC,OAAO,aAAa,CAAC,4CA4DlD,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,
|
|
1
|
+
{"version":3,"file":"TableTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAyB,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAOzB,eAAO,MAAM,+BAA+B,GAC1C,YAAY,eAAe,EAC3B,iBAAiB,UAAU,CAAC,OAAO,aAAa,CAAC,4CA4DlD,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,CAkDA,CAAC"}
|
|
@@ -38,6 +38,6 @@ export const TableTreeNode = (props) => {
|
|
|
38
38
|
table: name,
|
|
39
39
|
});
|
|
40
40
|
const sqlQuery = `SELECT * FROM ${qualifiedTableName}`;
|
|
41
|
-
return (_jsxs(_Fragment, { children: [_jsxs(BaseTreeNode, { asChild: true, className: className, nodeObject: nodeObject, children: [_jsxs("div", { className: "relative flex w-full items-center space-x-2", children: [isView ? (_jsx(ViewIcon, { size: "16px", className: "shrink-0 text-blue-500" })) : (_jsx(TableIcon, { size: "16px", className: "shrink-0 text-blue-500" })), _jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { children: name }), rowCount !== undefined && (_jsxs("span", { className: "text-muted-foreground/50 ml-1 whitespace-nowrap pr-8 text-xs", children: [formatCount(rowCount), " ", rowCount === 1 ? 'row' : 'rows'] }))] })] }), _jsx(TreeNodeActionsMenu, { children: renderMenuItems(nodeObject, tableModal) })] }), _jsx(DataTableModal, { title: qualifiedTableName.table, query: sqlQuery, tableModal: tableModal })] }));
|
|
41
|
+
return (_jsxs(_Fragment, { children: [_jsxs(BaseTreeNode, { asChild: true, className: className, nodeObject: nodeObject, children: [_jsxs("div", { className: "relative flex w-full items-center space-x-2", children: [isView ? (_jsx(ViewIcon, { size: "16px", className: "shrink-0 text-blue-500" })) : (_jsx(TableIcon, { size: "16px", className: "shrink-0 text-blue-500" })), _jsxs("div", { className: "flex w-full items-center justify-between gap-2", children: [_jsx("span", { className: "min-w-[50px] max-w-[50%] truncate whitespace-nowrap", title: name, children: name }), rowCount !== undefined && rowCount > 0 && (_jsxs("span", { className: "text-muted-foreground/50 ml-1 max-w-[50%] truncate whitespace-nowrap pr-8 text-xs", children: [formatCount(rowCount), " ", rowCount === 1 ? 'row' : 'rows'] }))] })] }), _jsx(TreeNodeActionsMenu, { children: renderMenuItems(nodeObject, tableModal) })] }), _jsx(DataTableModal, { title: qualifiedTableName.table, query: sqlQuery, tableModal: tableModal })] }));
|
|
42
42
|
};
|
|
43
43
|
//# sourceMappingURL=TableTreeNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableTreeNode.js","sourceRoot":"","sources":["../../src/nodes/TableTreeNode.tsx"],"names":[],"mappings":";AAAA,4DAA4D;AAE5D,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,sBAAsB,EAAkB,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEpE,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,EAAE,GAAG,EAA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M,EAAC,SAAS,EAAC,wBAAwB,GAAG,CAC5D,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,wBAAwB,GAAG,CAC7D,EACD,eAAK,SAAS,EAAC,gDAAgD,aAC7D,eACE,SAAS,EAAC,qDAAqD,EAC/D,KAAK,EAAE,IAAI,YAEV,IAAI,GACA,EACN,QAAQ,KAAK,SAAS,IAAI,QAAQ,GAAG,CAAC,IAAI,CACzC,gBAAM,SAAS,EAAC,mFAAmF,aAChG,WAAW,CAAC,QAAQ,CAAC,OAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,IACnD,CACR,IACG,IACF,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 {DataTableModal} from '@sqlrooms/data-table';\nimport {makeQualifiedTableName, TableNodeObject} from '@sqlrooms/duckdb';\nimport {useDisclosure} from '@sqlrooms/ui';\nimport {formatCount} from '@sqlrooms/utils';\nimport {CopyIcon, EyeIcon, TableIcon, ViewIcon} from 'lucide-react';\nimport {FC} from 'react';\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, sql, isView} = 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 data\n </TreeNodeActionsMenuItem>\n )}\n <TreeNodeActionsMenuItem\n onClick={() => {\n navigator.clipboard.writeText(qualifiedTableName.table);\n }}\n >\n <CopyIcon width=\"15px\" />\n Copy {isView ? 'view' : 'table'} name\n </TreeNodeActionsMenuItem>\n\n <TreeNodeActionsMenuItem\n onClick={() => {\n navigator.clipboard.writeText(qualifiedTableName.toString());\n }}\n >\n <CopyIcon width=\"15px\" />\n Copy qualified {isView ? 'view' : 'table'} name\n </TreeNodeActionsMenuItem>\n\n <TreeNodeActionsMenuItem\n onClick={() => {\n navigator.clipboard.writeText(`SELECT * FROM ${qualifiedTableName}`);\n }}\n >\n <CopyIcon width=\"15px\" />\n Copy SELECT query\n </TreeNodeActionsMenuItem>\n\n <TreeNodeActionsMenuItem\n onClick={() => {\n if (sql) {\n navigator.clipboard.writeText(sql);\n }\n }}\n disabled={!sql}\n >\n <CopyIcon width=\"15px\" />\n Copy CREATE {isView ? 'VIEW' : 'TABLE'}\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, rowCount, isView} = 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=\"relative flex w-full items-center space-x-2\">\n {isView ? (\n <ViewIcon size=\"16px\" className=\"shrink-0 text-blue-500\" />\n ) : (\n <TableIcon size=\"16px\" className=\"shrink-0 text-blue-500\" />\n )}\n <div className=\"flex w-full items-center justify-between gap-2\">\n <span\n className=\"min-w-[50px] max-w-[50%] truncate whitespace-nowrap\"\n title={name}\n >\n {name}\n </span>\n {rowCount !== undefined && rowCount > 0 && (\n <span className=\"text-muted-foreground/50 ml-1 max-w-[50%] truncate whitespace-nowrap pr-8 text-xs\">\n {formatCount(rowCount)} {rowCount === 1 ? 'row' : 'rows'}\n </span>\n )}\n </div>\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"]}
|
|
@@ -15,7 +15,7 @@ import { EllipsisVerticalIcon } from 'lucide-react';
|
|
|
15
15
|
*/
|
|
16
16
|
export const TreeNodeActionsMenu = (props) => {
|
|
17
17
|
const { children } = props;
|
|
18
|
-
return (_jsx("div", { className: "absolute right-0 top-[1px] opacity-0 outline-none group-hover:opacity-100", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("div", { className: "hover:bg-foreground/
|
|
18
|
+
return (_jsx("div", { className: "absolute right-0 top-[1px] h-full opacity-0 outline-none group-hover:opacity-100", children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx("div", { className: "hover:bg-foreground/30 flex h-full w-7 items-center justify-center p-0 outline-none transition-colors", children: _jsx(EllipsisVerticalIcon, { size: "15px", className: "relative top-[-1px]" }) }) }), _jsx(DropdownMenuContent, { align: "start", side: "bottom", children: children })] }) }));
|
|
19
19
|
};
|
|
20
20
|
export const TreeNodeActionsMenuItem = forwardRef(({ className, ...props }, ref) => {
|
|
21
21
|
const { onClick } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeActionsMenu.js","sourceRoot":"","sources":["../../src/nodes/TreeNodeActionsMenu.tsx"],"names":[],"mappings":";AAAA,4DAA4D;AAE5D,O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AAG,KAAK,EAAC,EAAE,GAAG,EAAE,EAAE;IAC/B,MAAM,EAAC,OAAO,EAAC,GAAG,KAAK,CAAC;IACxB,OAAO,CACL,KAAC,gBAAgB,IACf,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,KACrC,KAAK,EACT,OAAO,EACL,OAAO;YACL,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE;gBACN,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,qCAAqC;gBAC5D,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC;YACH,CAAC,CAAC,SAAS,GAEf,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,uBAAuB,CAAC,WAAW,GAAG,yBAAyB,CAAC","sourcesContent":["// Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.\n\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n cn,\n} from '@sqlrooms/ui';\nimport {\n ComponentPropsWithoutRef,\n ElementRef,\n FC,\n forwardRef,\n PropsWithChildren,\n} from 'react';\nimport {EllipsisVerticalIcon} from 'lucide-react';\n\nexport type TreeNodeActionsMenuProps = PropsWithChildren<{\n className?: string;\n}>;\n\n/**\n * Component that renders a tree node \"more actions\" menu.\n * The menu items are passed as children.\n *\n * The menu is hidden by default and is shown when the user hovers over the node.\n * For this to work the parent element must have the `group` class.\n * It should also have classes `relative overflow-hidden`.\n *\n * @param children - The menu items.\n */\nexport const TreeNodeActionsMenu: FC<TreeNodeActionsMenuProps> = (props) => {\n const {children} = props;\n return (\n <div className=\"absolute right-0 top-[1px] h-full opacity-0 outline-none group-hover:opacity-100\">\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <div className=\"hover:bg-foreground/30 flex h-full w-7 items-center justify-center p-0 outline-none transition-colors\">\n <EllipsisVerticalIcon size=\"15px\" className=\"relative top-[-1px]\" />\n </div>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" side=\"bottom\">\n {children}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n};\n\nexport const TreeNodeActionsMenuItem = forwardRef<\n ElementRef<typeof DropdownMenuItem>,\n ComponentPropsWithoutRef<typeof DropdownMenuItem>\n>(({className, ...props}, ref) => {\n const {onClick} = props;\n return (\n <DropdownMenuItem\n ref={ref}\n className={cn('gap-2 text-xs', className)}\n {...props}\n onClick={\n onClick\n ? (evt) => {\n evt.stopPropagation(); // prevent the tree node from closing\n onClick(evt);\n }\n : undefined\n }\n />\n );\n});\nTreeNodeActionsMenuItem.displayName = 'TreeNodeActionsMenuItem';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/schema-tree",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.1-rc.1",
|
|
4
4
|
"author": "Ilya Boyandin <ilya@boyandin.me>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"typedoc": "typedoc"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@sqlrooms/data-table": "0.26.
|
|
28
|
-
"@sqlrooms/duckdb": "0.26.
|
|
29
|
-
"@sqlrooms/ui": "0.26.
|
|
30
|
-
"@sqlrooms/utils": "0.26.
|
|
31
|
-
"lucide-react": "^0.
|
|
27
|
+
"@sqlrooms/data-table": "0.26.1-rc.1",
|
|
28
|
+
"@sqlrooms/duckdb": "0.26.1-rc.1",
|
|
29
|
+
"@sqlrooms/ui": "0.26.1-rc.1",
|
|
30
|
+
"@sqlrooms/utils": "0.26.1-rc.1",
|
|
31
|
+
"lucide-react": "^0.555.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=18",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"@types/react": "^19.1.13",
|
|
39
39
|
"@types/react-dom": "^19.1.9"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "e41ac3e033289faaaab0c2dbce552f1a7d0aea2b"
|
|
42
42
|
}
|