@sqlrooms/schema-tree 0.26.1-rc.7 → 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/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright 2025
|
|
3
|
+
Copyright 2025 SQLRooms Contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
|
@@ -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,CA+CA,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-
|
|
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 })] }));
|
|
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,EAAE,CAAC;gBAC1B,CAAC,aAED,KAAC,OAAO,IAAC,KAAK,EAAC,MAAM,GAAG,iBAEA,CAC3B,EACD,MAAC,uBAAuB,IAC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AAQ,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 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"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/schema-tree",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"author": "
|
|
3
|
+
"version": "0.27.0-rc.1",
|
|
4
|
+
"author": "SQLRooms Contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"typedoc": "typedoc"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sqlrooms/data-table": "0.
|
|
29
|
-
"@sqlrooms/duckdb": "0.
|
|
30
|
-
"@sqlrooms/ui": "0.
|
|
31
|
-
"@sqlrooms/utils": "0.
|
|
32
|
-
"lucide-react": "^0.
|
|
28
|
+
"@sqlrooms/data-table": "0.27.0-rc.1",
|
|
29
|
+
"@sqlrooms/duckdb": "0.27.0-rc.1",
|
|
30
|
+
"@sqlrooms/ui": "0.27.0-rc.1",
|
|
31
|
+
"@sqlrooms/utils": "0.27.0-rc.1",
|
|
32
|
+
"lucide-react": "^0.556.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=18",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"@types/react": "^19.1.13",
|
|
40
40
|
"@types/react-dom": "^19.1.9"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "392da9702a049dc3d57fa467bbbf52bf2db7ffd1"
|
|
43
43
|
}
|