@adecore/database 0.53.2 → 0.54.0

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.
Files changed (108) hide show
  1. package/dist/KeyIcon.js +1 -1
  2. package/dist/connections/ConnectionForm.js +3 -3
  3. package/dist/connections/ConnectionManager.js +6 -6
  4. package/dist/connections/connection-config.d.ts +1 -1
  5. package/dist/connections/use-docker-containers.js +1 -1
  6. package/dist/console/DestructiveDialog.js +2 -2
  7. package/dist/console/HistoryPanel.js +4 -4
  8. package/dist/console/QueryConsole.js +6 -6
  9. package/dist/console/SchemaPicker.js +1 -1
  10. package/dist/console/SqlEditor.js +2 -2
  11. package/dist/console/StatementResultView.js +3 -3
  12. package/dist/console/TransactionControls.js +1 -1
  13. package/dist/ddl/diff.js +1 -1
  14. package/dist/designer/ColumnsEditor.js +3 -3
  15. package/dist/designer/DesignerView.js +5 -5
  16. package/dist/designer/ForeignKeysEditor.js +2 -2
  17. package/dist/designer/IndexesEditor.js +2 -2
  18. package/dist/designer/NamePicker.js +2 -2
  19. package/dist/designer/OptionsEditor.js +2 -2
  20. package/dist/designer/SqlPreview.js +2 -2
  21. package/dist/designer/TableDesigner.js +2 -2
  22. package/dist/designer/plan.d.ts +1 -1
  23. package/dist/explorer/DatabaseExplorer.js +5 -5
  24. package/dist/explorer/RowMenu.js +2 -2
  25. package/dist/explorer/TableDialog.js +2 -2
  26. package/dist/explorer/folders.d.ts +1 -1
  27. package/dist/explorer/use-explorer-loads.js +1 -1
  28. package/dist/grid/CellEditor.js +2 -2
  29. package/dist/grid/CopyAsMenu.js +1 -1
  30. package/dist/grid/DataGrid.js +6 -6
  31. package/dist/grid/EnumPicker.js +2 -2
  32. package/dist/grid/GridHeaderCell.js +3 -3
  33. package/dist/grid/GridRowView.js +3 -3
  34. package/dist/grid/RecordView.js +5 -5
  35. package/dist/grid/ValueDock.js +2 -2
  36. package/dist/grid/column-layout.js +1 -1
  37. package/dist/structure/StructureView.js +4 -4
  38. package/dist/table/CommandField.js +2 -2
  39. package/dist/table/ImportDialog.js +3 -3
  40. package/dist/table/TableStatusBar.js +2 -2
  41. package/dist/table/TableToolbar.js +2 -2
  42. package/dist/table/TableView.js +4 -4
  43. package/dist/table/layout-store.js +1 -1
  44. package/dist/table/useLoaded.js +1 -1
  45. package/dist/table/useTableTransfer.d.ts +1 -1
  46. package/dist/table/useTableTransfer.js +1 -1
  47. package/dist/testing/fake.d.ts +1 -1
  48. package/dist/use-popup-press.js +1 -1
  49. package/dist/value/ValueEditor.js +6 -5
  50. package/dist/value/ValuePanel.js +1 -1
  51. package/dist/workbench/DatabaseWorkbench.js +4 -4
  52. package/dist/workbench/DesignerTab.js +1 -1
  53. package/package.json +8 -7
  54. package/src/DatabaseProvider.tsx +1 -1
  55. package/src/KeyIcon.tsx +1 -1
  56. package/src/connections/ConnectionForm.tsx +3 -3
  57. package/src/connections/ConnectionManager.tsx +8 -8
  58. package/src/connections/EngineIcon.tsx +1 -1
  59. package/src/connections/connection-config.ts +1 -1
  60. package/src/connections/use-docker-containers.ts +1 -1
  61. package/src/console/DestructiveDialog.tsx +4 -4
  62. package/src/console/HistoryPanel.tsx +5 -5
  63. package/src/console/QueryConsole.tsx +6 -6
  64. package/src/console/SchemaPicker.tsx +1 -1
  65. package/src/console/SqlEditor.tsx +2 -2
  66. package/src/console/StatementResultView.tsx +4 -4
  67. package/src/console/TransactionControls.tsx +2 -2
  68. package/src/ddl/diff.ts +1 -1
  69. package/src/designer/ColumnsEditor.tsx +4 -4
  70. package/src/designer/DesignerView.tsx +29 -10
  71. package/src/designer/ForeignKeysEditor.tsx +2 -2
  72. package/src/designer/IndexesEditor.tsx +2 -2
  73. package/src/designer/NamePicker.tsx +3 -3
  74. package/src/designer/OptionsEditor.tsx +3 -3
  75. package/src/designer/SqlPreview.tsx +4 -4
  76. package/src/designer/TableDesigner.tsx +2 -2
  77. package/src/designer/plan.ts +1 -1
  78. package/src/explorer/DatabaseExplorer.tsx +11 -7
  79. package/src/explorer/RowMenu.tsx +2 -2
  80. package/src/explorer/TableDialog.tsx +2 -2
  81. package/src/explorer/folders.ts +1 -1
  82. package/src/explorer/use-explorer-loads.ts +1 -1
  83. package/src/grid/CellEditor.tsx +2 -2
  84. package/src/grid/CopyAsMenu.tsx +1 -1
  85. package/src/grid/DataGrid.tsx +14 -12
  86. package/src/grid/EnumPicker.tsx +2 -2
  87. package/src/grid/GridHeaderCell.tsx +3 -3
  88. package/src/grid/GridRowView.tsx +3 -3
  89. package/src/grid/RecordView.tsx +20 -6
  90. package/src/grid/ValueDock.tsx +2 -2
  91. package/src/grid/column-layout.ts +1 -1
  92. package/src/structure/StructureView.tsx +9 -7
  93. package/src/table/CommandField.tsx +2 -2
  94. package/src/table/ImportDialog.tsx +7 -7
  95. package/src/table/TableStatusBar.tsx +3 -3
  96. package/src/table/TableToolbar.tsx +4 -4
  97. package/src/table/TableView.tsx +7 -7
  98. package/src/table/layout-store.ts +1 -2
  99. package/src/table/references.ts +1 -1
  100. package/src/table/useLoaded.ts +1 -1
  101. package/src/table/useTableTransfer.ts +2 -2
  102. package/src/testing/fake.ts +1 -1
  103. package/src/use-database-resources.ts +1 -1
  104. package/src/use-popup-press.ts +1 -1
  105. package/src/value/ValueEditor.tsx +15 -6
  106. package/src/value/ValuePanel.tsx +2 -2
  107. package/src/workbench/DatabaseWorkbench.tsx +5 -5
  108. package/src/workbench/DesignerTab.tsx +1 -1
@@ -1,4 +1,5 @@
1
- import type { ReactNode, Ref } from 'react';
1
+ import { Button, ButtonGroup, Icon, IconButton, Menu, Separator } from '@adecore/ui';
2
+ import { formatNumber } from '@adecore/ui/format';
2
3
  import clsx from 'clsx';
3
4
  import {
4
5
  ChevronsLeft,
@@ -15,13 +16,12 @@ import {
15
16
  Trash2,
16
17
  Undo2
17
18
  } from 'lucide-react';
19
+ import type { ReactNode, Ref } from 'react';
18
20
  import { useTranslation } from 'react-i18next';
19
- import { Button, ButtonGroup, Icon, IconButton, Menu, Separator } from '@adecore/ui';
20
- import { formatNumber } from '@adecore/ui/format';
21
21
  import { EXPORT_FORMATS } from '../export-formats.ts';
22
22
  import type { Engine, FileFormat } from '../protocol/index.ts';
23
- import { CommandField } from './CommandField.tsx';
24
23
  import type { Chip, CommandColumn } from './command-field.ts';
24
+ import { CommandField } from './CommandField.tsx';
25
25
  import { PAGE_SIZES, type PageBounds } from './paging.ts';
26
26
 
27
27
  /* The menu of export and import; present only when the app can show file dialogs. */
@@ -1,8 +1,3 @@
1
- import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode, type Ref } from 'react';
2
- import clsx from 'clsx';
3
- import { ArrowDownWideNarrow, ArrowUpRight, Check, CircleAlert, CopyPlus, Download, Filter, FilterX, RefreshCw, Trash2, Undo2 } from 'lucide-react';
4
- import type { TFunction } from 'i18next';
5
- import { useTranslation } from 'react-i18next';
6
1
  import {
7
2
  Banner,
8
3
  Button,
@@ -19,13 +14,18 @@ import {
19
14
  Spinner
20
15
  } from '@adecore/ui';
21
16
  import { formatNumber } from '@adecore/ui/format';
22
- import { DatabaseRequestError, type Connection } from '../client/types.ts';
17
+ import clsx from 'clsx';
18
+ import type { TFunction } from 'i18next';
19
+ import { ArrowDownWideNarrow, ArrowUpRight, Check, CircleAlert, CopyPlus, Download, Filter, FilterX, RefreshCw, Trash2, Undo2 } from 'lucide-react';
20
+ import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type ReactNode, type Ref } from 'react';
21
+ import { useTranslation } from 'react-i18next';
23
22
  import { useDatabaseAction, useDatabaseClient, useDatabaseFiles, useDatabaseNotice, useDatabaseStorage } from '../client-context.ts';
23
+ import { DatabaseRequestError, type Connection } from '../client/types.ts';
24
24
  import { aggregateBlock, blockSize, type RangeBlock } from '../grid/aggregates.ts';
25
25
  import { DataGrid } from '../grid/DataGrid.tsx';
26
+ import { RecordView } from '../grid/RecordView.tsx';
26
27
  import type { GridSort } from '../grid/sort.ts';
27
28
  import type { ColumnRequest, FocusedCell, FocusRequest, GridMenuContext } from '../grid/types.ts';
28
- import { RecordView } from '../grid/RecordView.tsx';
29
29
  import { ValueDock } from '../grid/ValueDock.tsx';
30
30
  import { valueOfCell, type EditValue, type RowChange, type TableStructure, type Value } from '../protocol/index.ts';
31
31
  import type { SqlTarget } from '../sql.ts';
@@ -1,3 +1,4 @@
1
+ import { isRecord } from '@adecore/utils/record';
1
2
  import type { GridLayout } from '../grid/column-layout.ts';
2
3
  import type { StoredFilter } from './command-field.ts';
3
4
  import { PAGE_SIZES } from './paging.ts';
@@ -23,8 +24,6 @@ export const layoutStorageKey = (connectionId: string, schema: string, table: st
23
24
 
24
25
  const isStringList = (value: unknown): value is string[] => Array.isArray(value) && value.every((item) => typeof item === 'string');
25
26
 
26
- const isRecord = (value: unknown): value is Record<string, unknown> => value !== null && typeof value === 'object' && !Array.isArray(value);
27
-
28
27
  const isStoredFilter = (value: unknown): value is StoredFilter =>
29
28
  isRecord(value) && typeof value.text === 'string' && typeof value.sql === 'string' && value.sql.trim() !== '';
30
29
 
@@ -1,5 +1,5 @@
1
- import { wholeValueOf } from '../grid/focused-value.ts';
2
1
  import type { Shown } from '../grid/display.ts';
2
+ import { wholeValueOf } from '../grid/focused-value.ts';
3
3
  import type { Engine, ForeignKeyInfo, ValueKind } from '../protocol/index.ts';
4
4
  import { matchCondition, type ColumnMatch } from '../sql.ts';
5
5
 
@@ -1,5 +1,5 @@
1
- import { useEffect, useRef, useState } from 'react';
2
1
  import { messageOf } from '@adecore/ui';
2
+ import { useEffect, useRef, useState } from 'react';
3
3
 
4
4
  export interface Loaded<T> {
5
5
  /* The last value that arrived; stays while the next one loads, so a page does not vanish under a reload. */
@@ -1,10 +1,10 @@
1
- import { useEffect, useRef, useState } from 'react';
2
1
  import { messageOf } from '@adecore/ui';
2
+ import { useEffect, useRef, useState } from 'react';
3
3
  import type { DatabaseFiles } from '../actions.ts';
4
4
  import { isCancelled, type DatabaseClient, type DatabaseSession } from '../client/types.ts';
5
5
  import type { FileFormat, TableStructure } from '../protocol/index.ts';
6
- import type { ImportSample } from './ImportDialog.tsx';
7
6
  import { formatOfPath, importableColumns, mapColumn, matchColumns, type ImportFormat } from './import-mapping.ts';
7
+ import type { ImportSample } from './ImportDialog.tsx';
8
8
 
9
9
  /* What the strip over the table says about an export or an import. */
10
10
  export type TransferNotice =
@@ -1,3 +1,4 @@
1
+ import type { DatabaseTransport } from '../client/types.ts';
1
2
  import type {
2
3
  Cell,
3
4
  CheckInfo,
@@ -20,7 +21,6 @@ import type {
20
21
  TriggerInfo,
21
22
  Value
22
23
  } from '../protocol/index.ts';
23
- import type { DatabaseTransport } from '../client/types.ts';
24
24
 
25
25
  export interface FakeTable {
26
26
  /* `table` when left out. A view cannot be edited. */
@@ -1,6 +1,6 @@
1
+ import type { i18n as I18n } from 'i18next';
1
2
  import { useState } from 'react';
2
3
  import { useTranslation } from 'react-i18next';
3
- import type { i18n as I18n } from 'i18next';
4
4
  import { addDatabaseResources } from './locales.ts';
5
5
 
6
6
  /* Adds the package's words to the i18next the app's `UIProvider` was given. In render, as `UIProvider` does, so the first view already reads them. */
@@ -1,5 +1,5 @@
1
- import { useEffect, useRef } from 'react';
2
1
  import { isInFloatingLayer } from '@adecore/ui';
2
+ import { useEffect, useRef } from 'react';
3
3
 
4
4
  /*
5
5
  * Catches the click that follows a press in a popup, menu or dialog. When a popup closes on that
@@ -1,7 +1,3 @@
1
- import { useMemo, useState, type KeyboardEvent, type ReactNode } from 'react';
2
- import clsx from 'clsx';
3
- import { Copy, Ellipsis, WrapText } from 'lucide-react';
4
- import { useTranslation } from 'react-i18next';
5
1
  import {
6
2
  Button,
7
3
  ButtonGroup,
@@ -12,11 +8,16 @@ import {
12
8
  KEY_SHORTCUTS,
13
9
  matchesShortcut,
14
10
  Menu,
11
+ ScrollArea,
15
12
  Segmented,
16
13
  TextArea,
17
14
  Tooltip
18
15
  } from '@adecore/ui';
19
16
  import { formatBytes, formatNumber } from '@adecore/ui/format';
17
+ import clsx from 'clsx';
18
+ import { Copy, Ellipsis, WrapText } from 'lucide-react';
19
+ import { useMemo, useState, type KeyboardEvent, type ReactNode } from 'react';
20
+ import { useTranslation } from 'react-i18next';
20
21
  import { CODE_TEXT } from '../code-text.ts';
21
22
  import type { GridColumn } from '../grid/types.ts';
22
23
  import type { EditValue, Value } from '../protocol/index.ts';
@@ -26,7 +27,8 @@ import { renderView, sizeOf, viewsOf, type Rendered, type ViewId } from './views
26
27
 
27
28
  const WRAPPING_VIEWS: ReadonlySet<ViewId> = new Set(['text', 'formatted', 'utf8']);
28
29
 
29
- const READING = `min-h-0 flex-1 overflow-auto rounded-lg border border-border bg-surface p-2 ${CODE_TEXT} text-text`;
30
+ const READING_FRAME = 'flex-1 rounded-lg border border-border bg-surface';
31
+ const READING = `p-2 ${CODE_TEXT} text-text`;
30
32
 
31
33
  export interface ValueEditorProps {
32
34
  column: GridColumn;
@@ -132,7 +134,14 @@ export function ValueEditor({ column, value, editable, onCommit }: ValueEditorPr
132
134
 
133
135
  return (
134
136
  <>
135
- <pre className={clsx(READING, wrapped ? 'break-words whitespace-pre-wrap' : 'whitespace-pre')}>{content.text}</pre>
137
+ <ScrollArea
138
+ axis={wrapped ? 'y' : 'both'}
139
+ render={<pre />}
140
+ className={READING_FRAME}
141
+ viewportClassName={clsx(READING, wrapped ? 'break-words whitespace-pre-wrap' : 'whitespace-pre')}
142
+ >
143
+ {content.text}
144
+ </ScrollArea>
136
145
  {content.truncated && (
137
146
  <p className="shrink-0 text-xs text-text-faint">
138
147
  {t('value.dumpTruncated', { shown: formatNumber(content.truncated.shown), total: formatNumber(content.truncated.total) })}
@@ -1,8 +1,8 @@
1
- import type { Ref } from 'react';
1
+ import { EmptyState, IconButton, PanelHeader } from '@adecore/ui';
2
2
  import clsx from 'clsx';
3
3
  import { MousePointerClick, X } from 'lucide-react';
4
+ import type { Ref } from 'react';
4
5
  import { useTranslation } from 'react-i18next';
5
- import { EmptyState, IconButton, PanelHeader } from '@adecore/ui';
6
6
  import type { GridColumn } from '../grid/types.ts';
7
7
  import type { EditValue, Value } from '../protocol/index.ts';
8
8
  import { ValueEditor } from './ValueEditor.tsx';
@@ -1,7 +1,3 @@
1
- import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type Ref } from 'react';
2
- import clsx from 'clsx';
3
- import { PencilRuler, Settings2, SquareTerminal, Table, TableProperties, type LucideIcon } from 'lucide-react';
4
- import { useTranslation } from 'react-i18next';
5
1
  import {
6
2
  Button,
7
3
  CloseButton,
@@ -19,12 +15,16 @@ import {
19
15
  useColumnResize
20
16
  } from '@adecore/ui';
21
17
  import { formatNumber } from '@adecore/ui/format';
22
- import { DatabaseProvider } from '../DatabaseProvider.tsx';
18
+ import clsx from 'clsx';
19
+ import { PencilRuler, Settings2, SquareTerminal, Table, TableProperties, type LucideIcon } from 'lucide-react';
20
+ import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type Ref } from 'react';
21
+ import { useTranslation } from 'react-i18next';
23
22
  import type { DatabaseAction, ExplorerSelection } from '../actions.ts';
24
23
  import { useDatabaseAction, useDatabaseStorage } from '../client-context.ts';
25
24
  import type { Connection } from '../client/types.ts';
26
25
  import { ConnectionManager } from '../connections/ConnectionManager.tsx';
27
26
  import { QueryConsole } from '../console/QueryConsole.tsx';
27
+ import { DatabaseProvider } from '../DatabaseProvider.tsx';
28
28
  import { DatabaseExplorer } from '../explorer/DatabaseExplorer.tsx';
29
29
  import { useStableCallback } from '../use-stable-callback.ts';
30
30
  import { DesignerTab } from './DesignerTab.tsx';
@@ -1,7 +1,7 @@
1
- import { DatabaseProvider } from '../DatabaseProvider.tsx';
2
1
  import type { DatabaseAction } from '../actions.ts';
3
2
  import { useDatabaseAction, useDatabaseClient, useDatabaseFiles, useDatabaseStorage, useNumberNotation } from '../client-context.ts';
4
3
  import type { Connection } from '../client/types.ts';
4
+ import { DatabaseProvider } from '../DatabaseProvider.tsx';
5
5
  import { TableDesigner } from '../designer/TableDesigner.tsx';
6
6
  import { useStableCallback } from '../use-stable-callback.ts';
7
7
  import type { WorkbenchTab } from './tabs.ts';