@sqlrooms/data-table 0.24.25 → 0.24.27
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/ColumnTypeBadge.js
CHANGED
|
@@ -3,7 +3,7 @@ import { cn } from '@sqlrooms/ui';
|
|
|
3
3
|
/**∏
|
|
4
4
|
* A badge that displays the type of a database table column.
|
|
5
5
|
*/
|
|
6
|
-
export const ColumnTypeBadge = ({ className, columnType, typeCategory }) => (_jsx("div", { title: String(columnType), className: cn('py-0.25 w-[55px] flex-shrink-0 overflow-hidden text-ellipsis rounded-sm px-1 text-center text-[9px]', 'cursor-default lowercase', {
|
|
6
|
+
export const ColumnTypeBadge = ({ className, columnType, typeCategory }) => (_jsx("div", { title: String(columnType), className: cn('py-0.25 w-[55px] flex-shrink-0 overflow-hidden text-ellipsis rounded-sm px-1 text-center text-[9px]', 'cursor-default whitespace-nowrap lowercase', {
|
|
7
7
|
'bg-gray-200 text-gray-500 dark:bg-gray-700 dark:text-gray-400': !typeCategory,
|
|
8
8
|
'bg-blue-100 text-blue-500 dark:bg-blue-900 dark:text-blue-400': typeCategory === 'string',
|
|
9
9
|
'bg-green-100 text-green-500 dark:bg-green-900 dark:text-green-400': typeCategory === 'number',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColumnTypeBadge.js","sourceRoot":"","sources":["../src/ColumnTypeBadge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAGhC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAIvB,CAAC,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAC,EAAE,EAAE,CAAC,CAC9C,cACE,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,EACzB,SAAS,EAAE,EAAE,CACX,qGAAqG,EACrG,
|
|
1
|
+
{"version":3,"file":"ColumnTypeBadge.js","sourceRoot":"","sources":["../src/ColumnTypeBadge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,EAAE,EAAC,MAAM,cAAc,CAAC;AAGhC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAIvB,CAAC,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAC,EAAE,EAAE,CAAC,CAC9C,cACE,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,EACzB,SAAS,EAAE,EAAE,CACX,qGAAqG,EACrG,4CAA4C,EAC5C;QACE,+DAA+D,EAC7D,CAAC,YAAY;QACf,+DAA+D,EAC7D,YAAY,KAAK,QAAQ;QAC3B,mEAAmE,EACjE,YAAY,KAAK,QAAQ;QAC3B,uEAAuE,EACrE,YAAY,KAAK,UAAU;QAC7B,2DAA2D,EACzD,YAAY,KAAK,SAAS;QAC5B,uEAAuE,EACrE,YAAY,KAAK,QAAQ,IAAI,YAAY,KAAK,UAAU;QAC1D,uEAAuE,EACrE,YAAY,KAAK,MAAM,IAAI,YAAY,KAAK,QAAQ;KACvD,EACD,SAAS,CACV,YAEA,MAAM,CAAC,UAAU,CAAC,GACf,CACP,CAAC","sourcesContent":["import {ColumnTypeCategory} from '@sqlrooms/duckdb';\nimport {cn} from '@sqlrooms/ui';\nimport {FC} from 'react';\n\n/**∏\n * A badge that displays the type of a database table column.\n */\nexport const ColumnTypeBadge: FC<{\n className?: string;\n columnType: unknown;\n typeCategory?: ColumnTypeCategory;\n}> = ({className, columnType, typeCategory}) => (\n <div\n title={String(columnType)}\n className={cn(\n 'py-0.25 w-[55px] flex-shrink-0 overflow-hidden text-ellipsis rounded-sm px-1 text-center text-[9px]',\n 'cursor-default whitespace-nowrap lowercase',\n {\n 'bg-gray-200 text-gray-500 dark:bg-gray-700 dark:text-gray-400':\n !typeCategory,\n 'bg-blue-100 text-blue-500 dark:bg-blue-900 dark:text-blue-400':\n typeCategory === 'string',\n 'bg-green-100 text-green-500 dark:bg-green-900 dark:text-green-400':\n typeCategory === 'number',\n 'bg-yellow-100 text-yellow-500 dark:bg-yellow-900 dark:text-yellow-400':\n typeCategory === 'datetime',\n 'bg-red-100 text-red-500 dark:bg-red-900 dark:text-red-400':\n typeCategory === 'boolean',\n 'bg-orange-100 text-orange-400 dark:bg-orange-900 dark:text-orange-400':\n typeCategory === 'binary' || typeCategory === 'geometry',\n 'bg-purple-100 text-purple-500 dark:bg-purple-900 dark:text-purple-400':\n typeCategory === 'json' || typeCategory === 'struct',\n },\n className,\n )}\n >\n {String(columnType)}\n </div>\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableModal.d.ts","sourceRoot":"","sources":["../src/DataTableModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,wBAAwB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,QAAA,MAAM,cAAc,EAAE,EAAE,CACtB;IACE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,UAAU,EAAE,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;CAClE,GAAG,CACA;IACE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,GACD;IACE,UAAU,EAAE,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;CACrC,CACJ,
|
|
1
|
+
{"version":3,"file":"DataTableModal.d.ts","sourceRoot":"","sources":["../src/DataTableModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,wBAAwB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,EAAE,EAAC,MAAM,OAAO,CAAC;AAEzB,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,QAAA,MAAM,cAAc,EAAE,EAAE,CACtB;IACE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,UAAU,EAAE,IAAI,CAAC,wBAAwB,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;CAClE,GAAG,CACA;IACE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,GACD;IACE,UAAU,EAAE,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;CACrC,CACJ,CAsCF,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/DataTableModal.js
CHANGED
|
@@ -30,7 +30,7 @@ import { DataTableArrowPaginated } from './DataTableArrowPaginated';
|
|
|
30
30
|
*/
|
|
31
31
|
const DataTableModal = (props) => {
|
|
32
32
|
const { className, title, tableModal } = props;
|
|
33
|
-
return (_jsx(Dialog, { open: tableModal.isOpen, onOpenChange: (isOpen) => !isOpen && tableModal.onClose(), children: _jsxs(DialogContent, { className: cn('h-[80vh] max-w-[75vw]', className), "aria-describedby": "data-table-modal", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: title ?? '' }), _jsx(DialogDescription, { className: "hidden", children: title })] }), _jsx("div", { className: "bg-muted flex-1 overflow-hidden", children: tableModal.isOpen && (_jsx(_Fragment, { children: 'query' in props && props.query ? (_jsx(QueryDataTable, { query: props.query })) : 'arrowTable' in props && props.arrowTable ? (_jsx(DataTableArrowPaginated, { table: props.arrowTable })) : (_jsx("div", { className: "p-4 text-xs", children: "No data" })) })) }), _jsx(DialogFooter, { children: _jsx(Button, { variant: "outline", onClick: tableModal.onClose, children: "Close" }) })] }) }));
|
|
33
|
+
return (_jsx(Dialog, { open: tableModal.isOpen, onOpenChange: (isOpen) => !isOpen && tableModal.onClose(), children: _jsxs(DialogContent, { className: cn('h-[80vh] max-w-[75vw]', className), "aria-describedby": "data-table-modal", onClick: (e) => e.stopPropagation(), children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: title ?? '' }), _jsx(DialogDescription, { className: "hidden", children: title })] }), _jsx("div", { className: "bg-muted flex-1 overflow-hidden", children: tableModal.isOpen && (_jsx(_Fragment, { children: 'query' in props && props.query ? (_jsx(QueryDataTable, { query: props.query })) : 'arrowTable' in props && props.arrowTable ? (_jsx(DataTableArrowPaginated, { table: props.arrowTable })) : (_jsx("div", { className: "p-4 text-xs", children: "No data" })) })) }), _jsx(DialogFooter, { children: _jsx(Button, { variant: "outline", onClick: tableModal.onClose, children: "Close" }) })] }) }));
|
|
34
34
|
};
|
|
35
35
|
export default DataTableModal;
|
|
36
36
|
//# sourceMappingURL=DataTableModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTableModal.js","sourceRoot":"","sources":["../src/DataTableModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,EAAE,EACF,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,GAEZ,MAAM,cAAc,CAAC;AAEtB,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,cAAc,GAahB,CAAC,KAAK,EAAE,EAAE;IACZ,MAAM,EAAC,SAAS,EAAE,KAAK,EAAE,UAAU,EAAC,GAAG,KAAK,CAAC;IAC7C,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAE,UAAU,CAAC,MAAM,EACvB,YAAY,EAAE,CAAC,MAAe,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,UAAU,CAAC,OAAO,EAAE,YAElE,MAAC,aAAa,IACZ,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,SAAS,CAAC,sBAChC,kBAAkB,aAEnC,MAAC,YAAY,eACX,KAAC,WAAW,cAAE,KAAK,IAAI,EAAE,GAAe,EACxC,KAAC,iBAAiB,IAAC,SAAS,EAAC,QAAQ,YAAE,KAAK,GAAqB,IACpD,EACf,cAAK,SAAS,EAAC,iCAAiC,YAC7C,UAAU,CAAC,MAAM,IAAI,CACpB,4BACG,OAAO,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CACjC,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,CACvC,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAC9C,KAAC,uBAAuB,IAAC,KAAK,EAAE,KAAK,CAAC,UAAU,GAAI,CACrD,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,aAAa,wBAAc,CAC3C,GACA,CACJ,GACG,EACN,KAAC,YAAY,cACX,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,UAAU,CAAC,OAAO,sBAE5C,GACI,IACD,GACT,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n Button,\n cn,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n UseDisclosureReturnValue,\n} from '@sqlrooms/ui';\nimport {FC} from 'react';\nimport QueryDataTable from './QueryDataTable';\nimport * as arrow from 'apache-arrow';\nimport {DataTableArrowPaginated} from './DataTableArrowPaginated';\n\n/**\n * A modal component for displaying a table with data from a SQL query.\n *\n * @component\n * @param props - Component props\n * @param props.title - The title of the table\n * @param props.query - The SQL query to execute and display in the table\n * @param props.tableModal - An object containing the modal's open state and close function\n *\n * @example\n * ```tsx\n * import { useState } from 'react';\n * import { DataTableModal } from '@sqlrooms/data-table';\n *\n * const MyComponent = () => {\n * const tableModal = useDisclosure();\n * return (\n * <DataTableModal\n * title=\"Users\"\n * query=\"SELECT * FROM users LIMIT 10\"\n * tableModal={tableModal}\n * />\n * );\n * };\n * ```\n */\nconst DataTableModal: FC<\n {\n className?: string;\n title: string | undefined;\n tableModal: Pick<UseDisclosureReturnValue, 'isOpen' | 'onClose'>;\n } & (\n | {\n query: string | undefined;\n }\n | {\n arrowTable: arrow.Table | undefined;\n }\n )\n> = (props) => {\n const {className, title, tableModal} = props;\n return (\n <Dialog\n open={tableModal.isOpen}\n onOpenChange={(isOpen: boolean) => !isOpen && tableModal.onClose()}\n >\n <DialogContent\n className={cn('h-[80vh] max-w-[75vw]', className)}\n aria-describedby=\"data-table-modal\"\n >\n <DialogHeader>\n <DialogTitle>{title ?? ''}</DialogTitle>\n <DialogDescription className=\"hidden\">{title}</DialogDescription>\n </DialogHeader>\n <div className=\"bg-muted flex-1 overflow-hidden\">\n {tableModal.isOpen && (\n <>\n {'query' in props && props.query ? (\n <QueryDataTable query={props.query} />\n ) : 'arrowTable' in props && props.arrowTable ? (\n <DataTableArrowPaginated table={props.arrowTable} />\n ) : (\n <div className=\"p-4 text-xs\">No data</div>\n )}\n </>\n )}\n </div>\n <DialogFooter>\n <Button variant=\"outline\" onClick={tableModal.onClose}>\n Close\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n};\n\nexport default DataTableModal;\n"]}
|
|
1
|
+
{"version":3,"file":"DataTableModal.js","sourceRoot":"","sources":["../src/DataTableModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,EAAE,EACF,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,GAEZ,MAAM,cAAc,CAAC;AAEtB,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,cAAc,GAahB,CAAC,KAAK,EAAE,EAAE;IACZ,MAAM,EAAC,SAAS,EAAE,KAAK,EAAE,UAAU,EAAC,GAAG,KAAK,CAAC;IAC7C,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAE,UAAU,CAAC,MAAM,EACvB,YAAY,EAAE,CAAC,MAAe,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,UAAU,CAAC,OAAO,EAAE,YAElE,MAAC,aAAa,IACZ,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,SAAS,CAAC,sBAChC,kBAAkB,EACnC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,aAEnC,MAAC,YAAY,eACX,KAAC,WAAW,cAAE,KAAK,IAAI,EAAE,GAAe,EACxC,KAAC,iBAAiB,IAAC,SAAS,EAAC,QAAQ,YAAE,KAAK,GAAqB,IACpD,EACf,cAAK,SAAS,EAAC,iCAAiC,YAC7C,UAAU,CAAC,MAAM,IAAI,CACpB,4BACG,OAAO,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CACjC,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,CACvC,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAC9C,KAAC,uBAAuB,IAAC,KAAK,EAAE,KAAK,CAAC,UAAU,GAAI,CACrD,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,aAAa,wBAAc,CAC3C,GACA,CACJ,GACG,EACN,KAAC,YAAY,cACX,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,UAAU,CAAC,OAAO,sBAE5C,GACI,IACD,GACT,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n Button,\n cn,\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n UseDisclosureReturnValue,\n} from '@sqlrooms/ui';\nimport {FC} from 'react';\nimport QueryDataTable from './QueryDataTable';\nimport * as arrow from 'apache-arrow';\nimport {DataTableArrowPaginated} from './DataTableArrowPaginated';\n\n/**\n * A modal component for displaying a table with data from a SQL query.\n *\n * @component\n * @param props - Component props\n * @param props.title - The title of the table\n * @param props.query - The SQL query to execute and display in the table\n * @param props.tableModal - An object containing the modal's open state and close function\n *\n * @example\n * ```tsx\n * import { useState } from 'react';\n * import { DataTableModal } from '@sqlrooms/data-table';\n *\n * const MyComponent = () => {\n * const tableModal = useDisclosure();\n * return (\n * <DataTableModal\n * title=\"Users\"\n * query=\"SELECT * FROM users LIMIT 10\"\n * tableModal={tableModal}\n * />\n * );\n * };\n * ```\n */\nconst DataTableModal: FC<\n {\n className?: string;\n title: string | undefined;\n tableModal: Pick<UseDisclosureReturnValue, 'isOpen' | 'onClose'>;\n } & (\n | {\n query: string | undefined;\n }\n | {\n arrowTable: arrow.Table | undefined;\n }\n )\n> = (props) => {\n const {className, title, tableModal} = props;\n return (\n <Dialog\n open={tableModal.isOpen}\n onOpenChange={(isOpen: boolean) => !isOpen && tableModal.onClose()}\n >\n <DialogContent\n className={cn('h-[80vh] max-w-[75vw]', className)}\n aria-describedby=\"data-table-modal\"\n onClick={(e) => e.stopPropagation()}\n >\n <DialogHeader>\n <DialogTitle>{title ?? ''}</DialogTitle>\n <DialogDescription className=\"hidden\">{title}</DialogDescription>\n </DialogHeader>\n <div className=\"bg-muted flex-1 overflow-hidden\">\n {tableModal.isOpen && (\n <>\n {'query' in props && props.query ? (\n <QueryDataTable query={props.query} />\n ) : 'arrowTable' in props && props.arrowTable ? (\n <DataTableArrowPaginated table={props.arrowTable} />\n ) : (\n <div className=\"p-4 text-xs\">No data</div>\n )}\n </>\n )}\n </div>\n <DialogFooter>\n <Button variant=\"outline\" onClick={tableModal.onClose}>\n Close\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n};\n\nexport default DataTableModal;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/data-table",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.27",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@sqlrooms/duckdb": "0.24.
|
|
22
|
-
"@sqlrooms/ui": "0.24.
|
|
23
|
-
"@sqlrooms/utils": "0.24.
|
|
21
|
+
"@sqlrooms/duckdb": "0.24.27",
|
|
22
|
+
"@sqlrooms/ui": "0.24.27",
|
|
23
|
+
"@sqlrooms/utils": "0.24.27",
|
|
24
24
|
"@tanstack/react-table": "^8.21.3",
|
|
25
25
|
"@tanstack/table-core": "^8.21.3",
|
|
26
26
|
"lucide-react": "^0.503.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"typecheck": "tsc --noEmit",
|
|
39
39
|
"typedoc": "typedoc"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "08930bf5d6cade37b50d3999735063d367e857f7"
|
|
42
42
|
}
|