@sqlrooms/schema-tree 0.27.0-rc.2 → 0.27.0-rc.4

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 +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,CAgCA,CAAC"}
1
+ {"version":3,"file":"ColumnTreeNode.d.ts","sourceRoot":"","sources":["../../src/nodes/ColumnTreeNode.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAGlD,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,CA4BA,CAAC"}
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.
3
3
  import { ColumnTypeBadge } from '@sqlrooms/data-table';
4
+ import { cn } from '@sqlrooms/ui';
4
5
  import { CopyIcon } from 'lucide-react';
5
6
  import { BaseTreeNode } from './BaseTreeNode';
6
7
  import { TreeNodeActionsMenu, TreeNodeActionsMenuItem, } from './TreeNodeActionsMenu';
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: "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] })] }));
10
+ return (_jsxs(BaseTreeNode, { asChild: true, className: cn(className), nodeObject: nodeObject, children: [_jsxs("div", { className: "relative flex w-full items-center space-x-2", children: [_jsx(ColumnTypeBadge, { className: "flex opacity-60", 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,uBAAuB,CAAC;AAC/B,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAEhC,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,IACX,OAAO,QACP,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,EACpC,UAAU,EAAE,UAAU,aAEtB,eAAK,SAAS,EAAC,6CAA6C,aAC1D,KAAC,eAAe,IACd,SAAS,EAAC,YAAY,EACtB,UAAU,EAAE,UAAU,CAAC,UAAU,EACjC,YAAY,EAAE,UAAU,CAAC,kBAAkB,GAC3C,EACF,eACE,SAAS,EAAC,oCAAoC,EAC9C,KAAK,EAAE,UAAU,CAAC,IAAI,YAErB,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 {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
+ {"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,EAAE,EAAC,MAAM,cAAc,CAAC;AAChC,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,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,EAAE,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,UAAU,aACpE,eAAK,SAAS,EAAC,6CAA6C,aAC1D,KAAC,eAAe,IACd,SAAS,EAAC,iBAAiB,EAC3B,UAAU,EAAE,UAAU,CAAC,UAAU,EACjC,YAAY,EAAE,UAAU,CAAC,kBAAkB,GAC3C,EACF,eACE,SAAS,EAAC,oCAAoC,EAC9C,KAAK,EAAE,UAAU,CAAC,IAAI,YAErB,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 {ColumnTypeBadge} from '@sqlrooms/data-table';\nimport {ColumnNodeObject} from '@sqlrooms/duckdb';\nimport {cn} from '@sqlrooms/ui';\nimport {CopyIcon} from 'lucide-react';\nimport {FC} from 'react';\nimport {BaseTreeNode} from './BaseTreeNode';\nimport {\n TreeNodeActionsMenu,\n TreeNodeActionsMenuItem,\n} from './TreeNodeActionsMenu';\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 asChild className={cn(className)} nodeObject={nodeObject}>\n <div className=\"relative flex w-full items-center space-x-2\">\n <ColumnTypeBadge\n className=\"flex opacity-60\"\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":"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,CA+CA,CAAC"}
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,EAAK,aAAa,EAAC,MAAM,cAAc,CAAC;AAG/C,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,CAqDA,CAAC"}
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  // Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.
3
3
  import { DataTableModal } from '@sqlrooms/data-table';
4
4
  import { makeQualifiedTableName } from '@sqlrooms/duckdb';
5
- import { useDisclosure } from '@sqlrooms/ui';
5
+ import { cn, useDisclosure } from '@sqlrooms/ui';
6
6
  import { formatCount } from '@sqlrooms/utils';
7
7
  import { CopyIcon, EyeIcon, TableIcon, ViewIcon } from 'lucide-react';
8
8
  import { BaseTreeNode } from './BaseTreeNode';
@@ -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 min-w-0 flex-1 items-center gap-2 overflow-hidden", children: [_jsx("span", { className: "max-w-[70%] shrink-0 truncate", title: name, children: name }), rowCount !== undefined && rowCount > 0 && (_jsxs("span", { className: "text-muted-foreground/50 ml-auto truncate whitespace-nowrap 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 min-w-0 flex-1 items-center gap-2 overflow-hidden", children: [_jsx("span", { className: cn('shrink-0 truncate', rowCount !== undefined && rowCount > 0 && 'max-w-[70%]'), title: name, children: name }), rowCount !== undefined && rowCount > 0 && (_jsxs("span", { className: "text-muted-foreground/50 ml-auto mr-1 truncate whitespace-nowrap 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,EAAE,MAAM,EAAC,GAAG,UAAU,CAAC;IACzD,MAAM,kBAAkB,GAAG,sBAAsB,CAAC;QAChD,QAAQ;QACR,MAAM;QACN,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;IACH,OAAO,CACL,8BACG,cAAc,IAAI,CACjB,MAAC,uBAAuB,IACtB,OAAO,EAAE,GAAG,EAAE;oBACZ,cAAc,CAAC,MAAM,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,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 min-w-0 flex-1 items-center gap-2 overflow-hidden\">\n <span className=\"max-w-[70%] shrink-0 truncate\" title={name}>\n {name}\n </span>\n {rowCount !== undefined && rowCount > 0 && (\n <span className=\"text-muted-foreground/50 ml-auto truncate whitespace-nowrap 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"]}
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,EAAE,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,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AG,CAC5D,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,wBAAwB,GAAG,CAC7D,EACD,eAAK,SAAS,EAAC,wDAAwD,aACrE,eACE,SAAS,EAAE,EAAE,CACX,mBAAmB,EACnB,QAAQ,KAAK,SAAS,IAAI,QAAQ,GAAG,CAAC,IAAI,aAAa,CACxD,EACD,KAAK,EAAE,IAAI,YAEV,IAAI,GACA,EACN,QAAQ,KAAK,SAAS,IAAI,QAAQ,GAAG,CAAC,IAAI,CACzC,gBAAM,SAAS,EAAC,0EAA0E,aACvF,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 {cn, 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 min-w-0 flex-1 items-center gap-2 overflow-hidden\">\n <span\n className={cn(\n 'shrink-0 truncate',\n rowCount !== undefined && rowCount > 0 && 'max-w-[70%]',\n )}\n title={name}\n >\n {name}\n </span>\n {rowCount !== undefined && rowCount > 0 && (\n <span className=\"text-muted-foreground/50 ml-auto mr-1 truncate whitespace-nowrap 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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeActionsMenu.d.ts","sourceRoot":"","sources":["../../src/nodes/TreeNodeActionsMenu.tsx"],"names":[],"mappings":"AASA,OAAO,EAGL,EAAE,EAEF,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAGf,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAgB5D,CAAC;AAEF,eAAO,MAAM,uBAAuB;;0GAoBlC,CAAC"}
1
+ {"version":3,"file":"TreeNodeActionsMenu.d.ts","sourceRoot":"","sources":["../../src/nodes/TreeNodeActionsMenu.tsx"],"names":[],"mappings":"AAUA,OAAO,EAGL,EAAE,EAEF,iBAAiB,EAClB,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAgB5D,CAAC;AAEF,eAAO,MAAM,uBAAuB;;0GAoBlC,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Copyright 2022 Foursquare Labs, Inc. All Rights Reserved.
3
- import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, cn, } from '@sqlrooms/ui';
4
- import { forwardRef, } from 'react';
3
+ import { cn, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '@sqlrooms/ui';
5
4
  import { EllipsisVerticalIcon } from 'lucide-react';
5
+ import { forwardRef, } from 'react';
6
6
  /**
7
7
  * Component that renders a tree node "more actions" menu.
8
8
  * The menu items are passed as children.
@@ -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] 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 })] }) }));
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: "bg-muted text-muted-foreground hover:text-foreground 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;
@@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AC;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"]}
1
+ {"version":3,"file":"TreeNodeActionsMenu.js","sourceRoot":"","sources":["../../src/nodes/TreeNodeActionsMenu.tsx"],"names":[],"mappings":";AAAA,4DAA4D;AAE5D,OAAO,EACL,EAAE,EACF,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAIL,UAAU,GAEX,MAAM,OAAO,CAAC;AAMf;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAiC,CAAC,KAAK,EAAE,EAAE;IACzE,MAAM,EAAC,QAAQ,EAAC,GAAG,KAAK,CAAC;IACzB,OAAO,CACL,cAAK,SAAS,EAAC,kFAAkF,YAC/F,MAAC,YAAY,eACX,KAAC,mBAAmB,IAAC,OAAO,kBAC1B,cAAK,SAAS,EAAC,qIAAqI,YAClJ,KAAC,oBAAoB,IAAC,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,qBAAqB,GAAG,GAChE,GACc,EACtB,KAAC,mBAAmB,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,QAAQ,YAC7C,QAAQ,GACW,IACT,GACX,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAG/C,CAAC,EAAC,SAAS,EAAE,GAAG,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 cn,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '@sqlrooms/ui';\nimport {EllipsisVerticalIcon} from 'lucide-react';\nimport {\n ComponentPropsWithoutRef,\n ElementRef,\n FC,\n forwardRef,\n PropsWithChildren,\n} from '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=\"bg-muted text-muted-foreground hover:text-foreground 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.27.0-rc.2",
3
+ "version": "0.27.0-rc.4",
4
4
  "author": "SQLRooms Contributors",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,10 +25,10 @@
25
25
  "typedoc": "typedoc"
26
26
  },
27
27
  "dependencies": {
28
- "@sqlrooms/data-table": "0.27.0-rc.2",
29
- "@sqlrooms/duckdb": "0.27.0-rc.2",
30
- "@sqlrooms/ui": "0.27.0-rc.2",
31
- "@sqlrooms/utils": "0.27.0-rc.2",
28
+ "@sqlrooms/data-table": "0.27.0-rc.4",
29
+ "@sqlrooms/duckdb": "0.27.0-rc.4",
30
+ "@sqlrooms/ui": "0.27.0-rc.4",
31
+ "@sqlrooms/utils": "0.27.0-rc.4",
32
32
  "lucide-react": "^0.556.0"
33
33
  },
34
34
  "peerDependencies": {
@@ -39,5 +39,5 @@
39
39
  "@types/react": "^19.1.13",
40
40
  "@types/react-dom": "^19.1.9"
41
41
  },
42
- "gitHead": "eec06537352a9e760de21d7bcc77d9aa2db2a5ec"
42
+ "gitHead": "892408d49720d1fb195308029674894ae059969d"
43
43
  }