@adecore/database 0.53.3 → 0.54.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/KeyIcon.js +1 -1
- package/dist/connections/ConnectionForm.js +3 -3
- package/dist/connections/ConnectionManager.js +6 -6
- package/dist/connections/connection-config.d.ts +1 -1
- package/dist/connections/use-docker-containers.js +1 -1
- package/dist/console/DestructiveDialog.js +2 -2
- package/dist/console/HistoryPanel.js +4 -4
- package/dist/console/QueryConsole.js +6 -6
- package/dist/console/SchemaPicker.js +1 -1
- package/dist/console/SqlEditor.js +2 -2
- package/dist/console/StatementResultView.js +3 -3
- package/dist/console/TransactionControls.js +1 -1
- package/dist/ddl/diff.js +1 -1
- package/dist/designer/ColumnsEditor.js +3 -3
- package/dist/designer/DesignerView.js +5 -5
- package/dist/designer/ForeignKeysEditor.js +2 -2
- package/dist/designer/IndexesEditor.js +2 -2
- package/dist/designer/NamePicker.js +2 -2
- package/dist/designer/OptionsEditor.js +2 -2
- package/dist/designer/SqlPreview.js +2 -2
- package/dist/designer/TableDesigner.js +2 -2
- package/dist/designer/plan.d.ts +1 -1
- package/dist/explorer/DatabaseExplorer.js +5 -5
- package/dist/explorer/RowMenu.js +2 -2
- package/dist/explorer/TableDialog.js +2 -2
- package/dist/explorer/folders.d.ts +1 -1
- package/dist/explorer/use-explorer-loads.js +1 -1
- package/dist/grid/CellEditor.js +2 -2
- package/dist/grid/CopyAsMenu.js +1 -1
- package/dist/grid/DataGrid.js +6 -6
- package/dist/grid/EnumPicker.js +2 -2
- package/dist/grid/GridHeaderCell.js +3 -3
- package/dist/grid/GridRowView.js +3 -3
- package/dist/grid/RecordView.js +5 -5
- package/dist/grid/ValueDock.js +2 -2
- package/dist/grid/column-layout.js +1 -1
- package/dist/structure/StructureView.js +4 -4
- package/dist/table/CommandField.js +2 -2
- package/dist/table/ImportDialog.js +3 -3
- package/dist/table/TableStatusBar.js +2 -2
- package/dist/table/TableToolbar.js +2 -2
- package/dist/table/TableView.js +4 -4
- package/dist/table/layout-store.js +1 -1
- package/dist/table/useLoaded.js +1 -1
- package/dist/table/useTableTransfer.d.ts +1 -1
- package/dist/table/useTableTransfer.js +1 -1
- package/dist/testing/fake.d.ts +1 -1
- package/dist/use-popup-press.js +1 -1
- package/dist/value/ValueEditor.js +6 -5
- package/dist/value/ValuePanel.js +1 -1
- package/dist/workbench/DatabaseWorkbench.js +4 -4
- package/dist/workbench/DesignerTab.js +1 -1
- package/package.json +8 -7
- package/src/DatabaseProvider.tsx +1 -1
- package/src/KeyIcon.tsx +1 -1
- package/src/connections/ConnectionForm.tsx +3 -3
- package/src/connections/ConnectionManager.tsx +8 -8
- package/src/connections/EngineIcon.tsx +1 -1
- package/src/connections/connection-config.ts +1 -1
- package/src/connections/use-docker-containers.ts +1 -1
- package/src/console/DestructiveDialog.tsx +4 -4
- package/src/console/HistoryPanel.tsx +5 -5
- package/src/console/QueryConsole.tsx +6 -6
- package/src/console/SchemaPicker.tsx +1 -1
- package/src/console/SqlEditor.tsx +2 -2
- package/src/console/StatementResultView.tsx +4 -4
- package/src/console/TransactionControls.tsx +2 -2
- package/src/ddl/diff.ts +1 -1
- package/src/designer/ColumnsEditor.tsx +4 -4
- package/src/designer/DesignerView.tsx +29 -10
- package/src/designer/ForeignKeysEditor.tsx +2 -2
- package/src/designer/IndexesEditor.tsx +2 -2
- package/src/designer/NamePicker.tsx +3 -3
- package/src/designer/OptionsEditor.tsx +3 -3
- package/src/designer/SqlPreview.tsx +4 -4
- package/src/designer/TableDesigner.tsx +2 -2
- package/src/designer/plan.ts +1 -1
- package/src/explorer/DatabaseExplorer.tsx +11 -7
- package/src/explorer/RowMenu.tsx +2 -2
- package/src/explorer/TableDialog.tsx +2 -2
- package/src/explorer/folders.ts +1 -1
- package/src/explorer/use-explorer-loads.ts +1 -1
- package/src/grid/CellEditor.tsx +2 -2
- package/src/grid/CopyAsMenu.tsx +1 -1
- package/src/grid/DataGrid.tsx +14 -12
- package/src/grid/EnumPicker.tsx +2 -2
- package/src/grid/GridHeaderCell.tsx +3 -3
- package/src/grid/GridRowView.tsx +3 -3
- package/src/grid/RecordView.tsx +20 -6
- package/src/grid/ValueDock.tsx +2 -2
- package/src/grid/column-layout.ts +1 -1
- package/src/structure/StructureView.tsx +9 -7
- package/src/table/CommandField.tsx +2 -2
- package/src/table/ImportDialog.tsx +7 -7
- package/src/table/TableStatusBar.tsx +3 -3
- package/src/table/TableToolbar.tsx +4 -4
- package/src/table/TableView.tsx +7 -7
- package/src/table/layout-store.ts +1 -2
- package/src/table/references.ts +1 -1
- package/src/table/useLoaded.ts +1 -1
- package/src/table/useTableTransfer.ts +2 -2
- package/src/testing/fake.ts +1 -1
- package/src/use-database-resources.ts +1 -1
- package/src/use-popup-press.ts +1 -1
- package/src/value/ValueEditor.tsx +15 -6
- package/src/value/ValuePanel.tsx +2 -2
- package/src/workbench/DatabaseWorkbench.tsx +5 -5
- package/src/workbench/DesignerTab.tsx +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Button, Pill, Switch, Tooltip } from '@adecore/ui';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
+
import type { Ref } from 'react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Button, Pill, Switch, Tooltip } from '@adecore/ui';
|
|
5
5
|
|
|
6
6
|
export type TransactionMode = 'auto' | 'manual';
|
|
7
7
|
|
package/src/ddl/diff.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { sameList } from '../same-list.ts';
|
|
1
2
|
import { sameDefinition } from './column.ts';
|
|
2
3
|
import type { Dialect } from './dialect.ts';
|
|
3
4
|
import type { ColumnDraft, ForeignKeyDraft, IndexDraft, TableDraft } from './draft.ts';
|
|
4
5
|
import type { TableOptions } from './parse.ts';
|
|
5
|
-
import { sameList } from '../same-list.ts';
|
|
6
6
|
|
|
7
7
|
export interface KeptColumn {
|
|
8
8
|
readonly original: ColumnDraft;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Button, ButtonGroup, Checkbox, EmptyState, Icon, IconButton, Input, Pill } from '@adecore/ui';
|
|
2
|
+
import { formatNumber } from '@adecore/ui/format';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
4
|
import { ArrowDown, ArrowUp, KeyRound, Plus, Trash2 } from 'lucide-react';
|
|
5
|
+
import { useId } from 'react';
|
|
4
6
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Button, ButtonGroup, Checkbox, EmptyState, Icon, IconButton, Input, Pill } from '@adecore/ui';
|
|
6
|
-
import { formatNumber } from '@adecore/ui/format';
|
|
7
7
|
import { typeSuggestionsOf, type ColumnDraft } from '../ddl/index.ts';
|
|
8
|
-
import type { EditorProps } from './editor-props.ts';
|
|
9
8
|
import { addColumn, moveColumn, patchColumn, removeColumn, togglePrimaryKey } from './edit.ts';
|
|
9
|
+
import type { EditorProps } from './editor-props.ts';
|
|
10
10
|
|
|
11
11
|
const TH = 'sticky top-0 z-10 h-7 bg-surface px-2 text-left text-xs font-medium whitespace-nowrap text-text-faint';
|
|
12
12
|
const TD = 'border-t border-border-soft px-2 py-1 align-middle';
|
|
@@ -1,16 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
Banner,
|
|
3
|
+
Button,
|
|
4
|
+
DisabledReason,
|
|
5
|
+
Field,
|
|
6
|
+
Icon,
|
|
7
|
+
Input,
|
|
8
|
+
PromptDialog,
|
|
9
|
+
ScrollArea,
|
|
10
|
+
Separator,
|
|
11
|
+
Tabs,
|
|
12
|
+
isApplePlatform,
|
|
13
|
+
matchesShortcut,
|
|
14
|
+
shortcut
|
|
15
|
+
} from '@adecore/ui';
|
|
16
|
+
import { formatNumber } from '@adecore/ui/format';
|
|
2
17
|
import clsx from 'clsx';
|
|
3
18
|
import { CircleAlert, Lock, Undo2 } from 'lucide-react';
|
|
19
|
+
import type { KeyboardEvent, ReactNode, Ref } from 'react';
|
|
4
20
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Banner, Button, DisabledReason, Field, Icon, Input, PromptDialog, Separator, Tabs, isApplePlatform, matchesShortcut, shortcut } from '@adecore/ui';
|
|
6
|
-
import { formatNumber } from '@adecore/ui/format';
|
|
7
21
|
import { CODE_TEXT } from '../code-text.ts';
|
|
8
22
|
import type { Dialect, TableDraft } from '../ddl/index.ts';
|
|
9
23
|
import { ColumnsEditor } from './ColumnsEditor.tsx';
|
|
24
|
+
import { renameTable } from './edit.ts';
|
|
10
25
|
import { ForeignKeysEditor } from './ForeignKeysEditor.tsx';
|
|
11
26
|
import { IndexesEditor } from './IndexesEditor.tsx';
|
|
12
27
|
import { OptionsEditor } from './OptionsEditor.tsx';
|
|
13
|
-
import { renameTable } from './edit.ts';
|
|
14
28
|
import { scriptOf, type Plan } from './plan.ts';
|
|
15
29
|
import { SqlPreview } from './SqlPreview.tsx';
|
|
16
30
|
|
|
@@ -151,13 +165,13 @@ export function DesignerView({
|
|
|
151
165
|
</Tabs.Tab>
|
|
152
166
|
<Tabs.Tab value="options">{t('designer.tabs.options')}</Tabs.Tab>
|
|
153
167
|
</Tabs.List>
|
|
154
|
-
<Tabs.Panel value="columns"
|
|
168
|
+
<Tabs.Panel value="columns" render={<ScrollArea axis="both" />} className="grow">
|
|
155
169
|
<ColumnsEditor draft={draft} dialect={dialect} disabled={disabled} onChange={onChange} />
|
|
156
170
|
</Tabs.Panel>
|
|
157
|
-
<Tabs.Panel value="indexes"
|
|
171
|
+
<Tabs.Panel value="indexes" render={<ScrollArea axis="both" />} className="grow">
|
|
158
172
|
<IndexesEditor draft={draft} dialect={dialect} disabled={disabled} onChange={onChange} />
|
|
159
173
|
</Tabs.Panel>
|
|
160
|
-
<Tabs.Panel value="foreignKeys"
|
|
174
|
+
<Tabs.Panel value="foreignKeys" render={<ScrollArea axis="both" />} className="grow">
|
|
161
175
|
<ForeignKeysEditor
|
|
162
176
|
draft={draft}
|
|
163
177
|
dialect={dialect}
|
|
@@ -168,7 +182,7 @@ export function DesignerView({
|
|
|
168
182
|
onChange={onChange}
|
|
169
183
|
/>
|
|
170
184
|
</Tabs.Panel>
|
|
171
|
-
<Tabs.Panel value="options"
|
|
185
|
+
<Tabs.Panel value="options" render={<ScrollArea axis="both" />} className="grow">
|
|
172
186
|
<OptionsEditor draft={draft} dialect={dialect} disabled={disabled} onChange={onChange} />
|
|
173
187
|
</Tabs.Panel>
|
|
174
188
|
</Tabs.Root>
|
|
@@ -188,9 +202,14 @@ export function DesignerView({
|
|
|
188
202
|
}}
|
|
189
203
|
>
|
|
190
204
|
{plan.destructive && <p className="mt-3 text-xs text-status-error">{t('designer.confirm.destructive')}</p>}
|
|
191
|
-
<
|
|
205
|
+
<ScrollArea
|
|
206
|
+
axis="both"
|
|
207
|
+
render={<pre />}
|
|
208
|
+
className="mt-3 max-h-64 rounded-md bg-surface-sunken"
|
|
209
|
+
viewportClassName={clsx(CODE_TEXT, 'p-2 whitespace-pre text-text select-text')}
|
|
210
|
+
>
|
|
192
211
|
{scriptOf(plan.statements)}
|
|
193
|
-
</
|
|
212
|
+
</ScrollArea>
|
|
194
213
|
</PromptDialog>
|
|
195
214
|
</div>
|
|
196
215
|
);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { Button, EmptyState, Field, Icon, IconButton, Input, Select, Spinner, type SelectItem } from '@adecore/ui';
|
|
1
2
|
import clsx from 'clsx';
|
|
2
3
|
import { Plus, Trash2 } from 'lucide-react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Button, EmptyState, Field, Icon, IconButton, Input, Select, Spinner, type SelectItem } from '@adecore/ui';
|
|
5
5
|
import { FOREIGN_KEY_ACTIONS } from '../ddl/index.ts';
|
|
6
|
+
import { addForeignKey, patchForeignKey, removeForeignKey, setReferencedTable, toggleForeignKeyColumn } from './edit.ts';
|
|
6
7
|
import type { EditorProps } from './editor-props.ts';
|
|
7
8
|
import { NamePicker } from './NamePicker.tsx';
|
|
8
|
-
import { addForeignKey, patchForeignKey, removeForeignKey, setReferencedTable, toggleForeignKeyColumn } from './edit.ts';
|
|
9
9
|
|
|
10
10
|
export interface ForeignKeysEditorProps extends EditorProps {
|
|
11
11
|
schema: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { Button, Checkbox, EmptyState, Icon, IconButton, Input } from '@adecore/ui';
|
|
1
2
|
import clsx from 'clsx';
|
|
2
3
|
import { Plus, Trash2 } from 'lucide-react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import {
|
|
5
|
+
import { addIndex, patchIndex, removeIndex, toggleIndexColumn } from './edit.ts';
|
|
5
6
|
import type { EditorProps } from './editor-props.ts';
|
|
6
7
|
import { NamePicker } from './NamePicker.tsx';
|
|
7
|
-
import { addIndex, patchIndex, removeIndex, toggleIndexColumn } from './edit.ts';
|
|
8
8
|
|
|
9
9
|
/* The indexes of the table other than its primary key, each over columns picked from the draft. */
|
|
10
10
|
export function IndexesEditor({ draft, disabled, onChange, className, ref }: EditorProps) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Ref } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
1
|
import { Button } from '@adecore/ui';
|
|
5
2
|
import { formatNumber } from '@adecore/ui/format';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import type { Ref } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
6
|
|
|
7
7
|
export interface NamePickerProps {
|
|
8
8
|
/* Every name that can be picked, in the order to show them. */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Field, Input, Switch, TextArea } from '@adecore/ui';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
+
import { useId } from 'react';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Field, Input, Switch, TextArea } from '@adecore/ui';
|
|
5
5
|
import { MYSQL_CHARSETS, MYSQL_ENGINES, collationSuggestionsOf } from '../ddl/index.ts';
|
|
6
|
-
import type { EditorProps } from './editor-props.ts';
|
|
7
6
|
import { patchOptions } from './edit.ts';
|
|
7
|
+
import type { EditorProps } from './editor-props.ts';
|
|
8
8
|
|
|
9
9
|
/* The options of a table, which differ per engine: a storage engine and character set on MySQL, rowid and strict typing on SQLite. */
|
|
10
10
|
export function OptionsEditor({ draft, dialect, disabled, onChange, className, ref }: EditorProps) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Button, Icon, ScrollArea, copyText } from '@adecore/ui';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { Copy } from 'lucide-react';
|
|
4
|
+
import type { Ref } from 'react';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Button, Icon, copyText } from '@adecore/ui';
|
|
6
6
|
import { CODE_TEXT } from '../code-text.ts';
|
|
7
7
|
import type { DraftProblem } from '../ddl/index.ts';
|
|
8
8
|
import { scriptOf, type Plan } from './plan.ts';
|
|
@@ -38,7 +38,7 @@ export function SqlPreview({ plan, className, ref }: SqlPreviewProps) {
|
|
|
38
38
|
{t('designer.copy')}
|
|
39
39
|
</Button>
|
|
40
40
|
</div>
|
|
41
|
-
<
|
|
41
|
+
<ScrollArea axis="both" className="max-h-48 min-h-12" viewportClassName="px-3 pb-3 select-text">
|
|
42
42
|
{plan.problems.length > 0 ? (
|
|
43
43
|
<ul className="flex flex-col gap-1 text-xs text-status-error">
|
|
44
44
|
{plan.problems.map((problem, i) => (
|
|
@@ -52,7 +52,7 @@ export function SqlPreview({ plan, className, ref }: SqlPreviewProps) {
|
|
|
52
52
|
) : (
|
|
53
53
|
<pre className={clsx(CODE_TEXT, 'whitespace-pre text-text')}>{script}</pre>
|
|
54
54
|
)}
|
|
55
|
-
</
|
|
55
|
+
</ScrollArea>
|
|
56
56
|
</section>
|
|
57
57
|
);
|
|
58
58
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Banner, Button, Spinner, messageOf } from '@adecore/ui';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { CircleAlert, RefreshCw } from 'lucide-react';
|
|
4
|
+
import { useMemo, useRef, useState, type ReactNode, type Ref } from 'react';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Banner, Button, Spinner, messageOf } from '@adecore/ui';
|
|
6
6
|
import { useDatabaseAction, useDatabaseClient } from '../client-context.ts';
|
|
7
7
|
import type { Connection, ExecuteResult } from '../client/types.ts';
|
|
8
8
|
import { dialectOf, draftOf, emptyDraft, type Dialect, type TableDraft } from '../ddl/index.ts';
|
package/src/designer/plan.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TableStructure } from '../protocol/index.ts';
|
|
2
1
|
import { alterTableSql, createTableSql, dropsColumns, draftOf, validateDraft, type Dialect, type DraftProblem, type TableDraft } from '../ddl/index.ts';
|
|
2
|
+
import type { TableStructure } from '../protocol/index.ts';
|
|
3
3
|
|
|
4
4
|
/* What applying a draft would do. */
|
|
5
5
|
export interface Plan {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Button, ContextMenu, EmptyState, Icon, Input, ScrollArea, Spinner, Tooltip, Tree } from '@adecore/ui';
|
|
2
|
+
import { formatNumber } from '@adecore/ui/format';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
4
|
import { CircleAlert, Columns2, Database, Eye, Folder, KeyRound, ListOrdered, Lock, Search, ShieldCheck, Table, Zap, type LucideIcon } from 'lucide-react';
|
|
5
|
+
import { useEffect, useRef, useState, type DragEvent, type KeyboardEvent, type MouseEvent, type ReactNode, type Ref } from 'react';
|
|
4
6
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Button, ContextMenu, EmptyState, Icon, Input, Spinner, Tooltip, Tree } from '@adecore/ui';
|
|
6
|
-
import { formatNumber } from '@adecore/ui/format';
|
|
7
7
|
import type { ExplorerSelection } from '../actions.ts';
|
|
8
8
|
import { useDatabaseAction, useDatabaseClient } from '../client-context.ts';
|
|
9
9
|
import type { Connection, TableRef } from '../client/types.ts';
|
|
10
|
-
import type { TableKind } from '../protocol/index.ts';
|
|
11
|
-
import { EngineIcon } from '../connections/EngineIcon.tsx';
|
|
12
10
|
import { keyLabelOf, type ColumnKeys } from '../column-keys.ts';
|
|
11
|
+
import { EngineIcon } from '../connections/EngineIcon.tsx';
|
|
13
12
|
import { KeyIcon } from '../KeyIcon.tsx';
|
|
13
|
+
import type { TableKind } from '../protocol/index.ts';
|
|
14
14
|
import { usePopupPress } from '../use-popup-press.ts';
|
|
15
15
|
import type { ExplorerFolder } from './folders.ts';
|
|
16
16
|
import { RowMenu } from './RowMenu.tsx';
|
|
@@ -360,9 +360,13 @@ export function DatabaseExplorer({
|
|
|
360
360
|
) : rows.length === 0 ? (
|
|
361
361
|
<EmptyState icon={Search}>{t('explorer.noMatches', { query: filter.trim() })}</EmptyState>
|
|
362
362
|
) : (
|
|
363
|
-
<
|
|
363
|
+
<ScrollArea
|
|
364
|
+
render={<Tree.Root aria-label={t('explorer.label')} overflow="scroll" onKeyDown={onKeyDown} />}
|
|
365
|
+
className="grow"
|
|
366
|
+
viewportClassName="pt-2"
|
|
367
|
+
>
|
|
364
368
|
{rows.map(renderRow)}
|
|
365
|
-
</
|
|
369
|
+
</ScrollArea>
|
|
366
370
|
)}
|
|
367
371
|
{request !== null && <TableDialog request={request} onClose={() => setRequest(null)} onDone={finish} />}
|
|
368
372
|
</div>
|
package/src/explorer/RowMenu.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContextMenu, copyText, Icon } from '@adecore/ui';
|
|
2
2
|
import {
|
|
3
3
|
Copy,
|
|
4
4
|
Eraser,
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
Unplug,
|
|
15
15
|
type LucideIcon
|
|
16
16
|
} from 'lucide-react';
|
|
17
|
+
import { Fragment, type ReactNode } from 'react';
|
|
17
18
|
import { useTranslation } from 'react-i18next';
|
|
18
|
-
import { ContextMenu, copyText, Icon } from '@adecore/ui';
|
|
19
19
|
import type { DatabaseAction } from '../actions.ts';
|
|
20
20
|
import { useDatabaseAction, useDatabaseClient } from '../client-context.ts';
|
|
21
21
|
import type { Connection, TableRef } from '../client/types.ts';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useTranslation } from 'react-i18next';
|
|
2
1
|
import { PromptDialog } from '@adecore/ui';
|
|
3
|
-
import {
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
4
3
|
import { useDatabaseClient } from '../client-context.ts';
|
|
5
4
|
import type { Connection, TableRef } from '../client/types.ts';
|
|
5
|
+
import { dialectOf } from '../ddl/index.ts';
|
|
6
6
|
import type { TableKind } from '../protocol/index.ts';
|
|
7
7
|
import { statementOf, type TableChange } from './table-statements.ts';
|
|
8
8
|
|
package/src/explorer/folders.ts
CHANGED
|
@@ -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
|
import { useDatabaseClient } from '../client-context.ts';
|
|
4
4
|
import type { Connection, SchemaChange } from '../client/types.ts';
|
|
5
5
|
import type { SchemaInfo, TableInfo, TableStructure } from '../protocol/index.ts';
|
package/src/grid/CellEditor.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useEffect, useRef, type KeyboardEvent } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
1
|
import { Input } from '@adecore/ui';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useEffect, useRef, type KeyboardEvent } from 'react';
|
|
4
4
|
import { CODE_TEXT } from '../code-text.ts';
|
|
5
5
|
|
|
6
6
|
export type EditMove = 'next' | 'previous';
|
package/src/grid/CopyAsMenu.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ContextMenu, Icon } from '@adecore/ui';
|
|
1
2
|
import { Braces, Copy, Database, FileSpreadsheet, Table2, type LucideIcon } from 'lucide-react';
|
|
2
3
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { ContextMenu, Icon } from '@adecore/ui';
|
|
4
4
|
import type { CopyFormat } from './copy-formats.ts';
|
|
5
5
|
|
|
6
6
|
const ICONS: Record<CopyFormat, LucideIcon> = { tsv: Table2, csv: FileSpreadsheet, json: Braces, sql: Database };
|
package/src/grid/DataGrid.tsx
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { ContextMenu, copyText, EDIT_SHORTCUTS, Icon, isApplePlatform, isModHeld, Kbd, ScrollArea, useContentSize } from '@adecore/ui';
|
|
2
|
+
import { formatNumber } from '@adecore/ui/format';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { Ban, Copy, RotateCcw } from 'lucide-react';
|
|
1
5
|
import {
|
|
2
6
|
useCallback,
|
|
3
7
|
useEffect,
|
|
@@ -11,20 +15,17 @@ import {
|
|
|
11
15
|
type ReactNode,
|
|
12
16
|
type Ref
|
|
13
17
|
} from 'react';
|
|
14
|
-
import clsx from 'clsx';
|
|
15
|
-
import { Ban, Copy, RotateCcw } from 'lucide-react';
|
|
16
18
|
import { useTranslation } from 'react-i18next';
|
|
17
|
-
import { ContextMenu, copyText, EDIT_SHORTCUTS, Icon, isApplePlatform, isModHeld, Kbd, useContentSize } from '@adecore/ui';
|
|
18
|
-
import { formatNumber } from '@adecore/ui/format';
|
|
19
19
|
import type { DatabaseNotice } from '../actions.ts';
|
|
20
|
-
import type { EditValue, Value } from '../protocol/index.ts';
|
|
21
20
|
import { assignRef } from '../assign-ref.ts';
|
|
22
|
-
import type { SqlTarget } from '../sql.ts';
|
|
23
21
|
import { useNumberNotation } from '../client-context.ts';
|
|
24
|
-
import {
|
|
22
|
+
import type { EditValue, Value } from '../protocol/index.ts';
|
|
23
|
+
import type { SqlTarget } from '../sql.ts';
|
|
25
24
|
import { useDatabaseResources } from '../use-database-resources.ts';
|
|
25
|
+
import { usePopupPress } from '../use-popup-press.ts';
|
|
26
26
|
import { useStableCallback } from '../use-stable-callback.ts';
|
|
27
27
|
import type { RangeBlock } from './aggregates.ts';
|
|
28
|
+
import { cellIdOf } from './cell-id.ts';
|
|
28
29
|
import { fullRect, rectBetween, rectContains } from './cell-range.ts';
|
|
29
30
|
import type { EditMove } from './CellEditor.tsx';
|
|
30
31
|
import { captureLayout, restoreLayout, sameLayout, type GridLayout } from './column-layout.ts';
|
|
@@ -36,7 +37,6 @@ import { columnNotation, cellView, copyTextOf, isPreview, type CellView, type Nu
|
|
|
36
37
|
import { draftOf, parseDraft } from './edit-value.ts';
|
|
37
38
|
import { parseEnumType } from './enum-type.ts';
|
|
38
39
|
import { GridHeaderCell, type HeaderActions } from './GridHeaderCell.tsx';
|
|
39
|
-
import { cellIdOf } from './cell-id.ts';
|
|
40
40
|
import { GridRowView, PINNED_GROUP, type CellEdit, type RowActions, type RowLook } from './GridRowView.tsx';
|
|
41
41
|
import {
|
|
42
42
|
clampColumnWidth,
|
|
@@ -836,8 +836,9 @@ export function DataGrid({
|
|
|
836
836
|
};
|
|
837
837
|
|
|
838
838
|
return (
|
|
839
|
-
<
|
|
840
|
-
|
|
839
|
+
<ScrollArea
|
|
840
|
+
axis="both"
|
|
841
|
+
viewportRef={attach}
|
|
841
842
|
role="grid"
|
|
842
843
|
aria-label={label}
|
|
843
844
|
aria-rowcount={rows.length + 1}
|
|
@@ -846,7 +847,8 @@ export function DataGrid({
|
|
|
846
847
|
pickedColumns.length > 0 ? headerId(pickedColumns[0]!) : focusCell === null ? undefined : cellId(focusCell.row, focusCell.column)
|
|
847
848
|
}
|
|
848
849
|
tabIndex={0}
|
|
849
|
-
className={clsx('
|
|
850
|
+
className={clsx('flex-1 bg-surface text-text', className)}
|
|
851
|
+
viewportClassName="group/grid relative outline-none"
|
|
850
852
|
onKeyDown={handleKeyDown}
|
|
851
853
|
onScroll={(event) => setScrolledBlock(scrollBlock(event.currentTarget.scrollTop - HEADER_HEIGHT))}
|
|
852
854
|
>
|
|
@@ -900,6 +902,6 @@ export function DataGrid({
|
|
|
900
902
|
</ContextMenu.Root>
|
|
901
903
|
{rows.length === 0 && empty !== undefined && <div className="sticky left-0 w-fit px-4 py-6 text-xs text-text-muted">{empty}</div>}
|
|
902
904
|
</div>
|
|
903
|
-
</
|
|
905
|
+
</ScrollArea>
|
|
904
906
|
);
|
|
905
907
|
}
|
package/src/grid/EnumPicker.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Icon, Menu } from '@adecore/ui';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { Ban, ChevronDown } from 'lucide-react';
|
|
4
|
+
import { useRef, useState, type Ref } from 'react';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Icon, Menu } from '@adecore/ui';
|
|
6
6
|
import { CODE_TEXT } from '../code-text.ts';
|
|
7
7
|
import { joinMembers, membersOf, type EnumType } from './enum-type.ts';
|
|
8
8
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColumnResizeHandle, ContextMenu, copyText, Icon, IconButton, isApplePlatform, isModHeld, Menu, Tooltip, useColumnResize } from '@adecore/ui';
|
|
2
|
+
import { formatNumber } from '@adecore/ui/format';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
4
|
import { ArrowDown, ArrowUp, ArrowUpDown, ChevronDown, Copy, Eye, EyeOff, Pin, PinOff } from 'lucide-react';
|
|
5
|
+
import { useRef, type MouseEvent, type PointerEvent } from 'react';
|
|
4
6
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { ColumnResizeHandle, ContextMenu, copyText, Icon, IconButton, isApplePlatform, isModHeld, Menu, Tooltip, useColumnResize } from '@adecore/ui';
|
|
6
|
-
import { formatNumber } from '@adecore/ui/format';
|
|
7
7
|
import { CODE_TEXT } from '../code-text.ts';
|
|
8
8
|
import { keyLabelOf } from '../column-keys.ts';
|
|
9
9
|
import { KeyIcon } from '../KeyIcon.tsx';
|
package/src/grid/GridRowView.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { memo, type MouseEvent, type PointerEvent } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
1
|
import { Spinner } from '@adecore/ui';
|
|
4
2
|
import { formatNumber } from '@adecore/ui/format';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { memo, type MouseEvent, type PointerEvent } from 'react';
|
|
5
5
|
import { CODE_TEXT } from '../code-text.ts';
|
|
6
|
-
import { CellEditor, type EditMove } from './CellEditor.tsx';
|
|
7
6
|
import { cellIdOf } from './cell-id.ts';
|
|
7
|
+
import { CellEditor, type EditMove } from './CellEditor.tsx';
|
|
8
8
|
import { columnNotation, cellView, type CellView, type NumberNotation } from './display.ts';
|
|
9
9
|
import type { EnumType } from './enum-type.ts';
|
|
10
10
|
import { EnumPicker } from './EnumPicker.tsx';
|
package/src/grid/RecordView.tsx
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ButtonGroup,
|
|
3
|
+
ContextMenu,
|
|
4
|
+
copyText,
|
|
5
|
+
EDIT_SHORTCUTS,
|
|
6
|
+
Icon,
|
|
7
|
+
IconButton,
|
|
8
|
+
Input,
|
|
9
|
+
isApplePlatform,
|
|
10
|
+
isModHeld,
|
|
11
|
+
Kbd,
|
|
12
|
+
ScrollArea,
|
|
13
|
+
shortcut,
|
|
14
|
+
Spinner
|
|
15
|
+
} from '@adecore/ui';
|
|
16
|
+
import { formatNumber } from '@adecore/ui/format';
|
|
2
17
|
import clsx from 'clsx';
|
|
3
18
|
import { ArrowUpRight, Ban, ChevronDown, ChevronUp, Copy, Maximize2, Minimize2, RotateCcw, X } from 'lucide-react';
|
|
19
|
+
import { useEffect, useMemo, useRef, useState, type KeyboardEvent, type Ref } from 'react';
|
|
4
20
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { ButtonGroup, ContextMenu, copyText, EDIT_SHORTCUTS, Icon, IconButton, Input, isApplePlatform, isModHeld, Kbd, shortcut, Spinner } from '@adecore/ui';
|
|
6
|
-
import { formatNumber } from '@adecore/ui/format';
|
|
7
21
|
import { useNumberNotation } from '../client-context.ts';
|
|
8
22
|
import { CODE_TEXT } from '../code-text.ts';
|
|
9
23
|
import type { EditValue, Value } from '../protocol/index.ts';
|
|
10
|
-
import { ValueEditor } from '../value/ValueEditor.tsx';
|
|
11
24
|
import { isNumericKind } from '../sql.ts';
|
|
25
|
+
import { ValueEditor } from '../value/ValueEditor.tsx';
|
|
12
26
|
import { columnNotation, cellView, copyTextOf, isPreview, numeralText, type NumberNotation } from './display.ts';
|
|
13
27
|
import { draftOf, parseDraft } from './edit-value.ts';
|
|
14
28
|
import { parseEnumType } from './enum-type.ts';
|
|
@@ -243,7 +257,7 @@ export function RecordView({
|
|
|
243
257
|
{row === undefined ? (
|
|
244
258
|
<p className="px-4 py-6 text-xs text-text-muted">{empty}</p>
|
|
245
259
|
) : (
|
|
246
|
-
<
|
|
260
|
+
<ScrollArea role="group" aria-label={label} className="flex-1" viewportClassName="py-1">
|
|
247
261
|
{columns.map((column, position) => {
|
|
248
262
|
const cell = row.cells[position] ?? null;
|
|
249
263
|
const enumType = enumTypes[position] ?? null;
|
|
@@ -365,7 +379,7 @@ export function RecordView({
|
|
|
365
379
|
</ContextMenu.Root>
|
|
366
380
|
);
|
|
367
381
|
})}
|
|
368
|
-
</
|
|
382
|
+
</ScrollArea>
|
|
369
383
|
)}
|
|
370
384
|
</div>
|
|
371
385
|
);
|
package/src/grid/ValueDock.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useRef, useState, type ReactNode, type Ref } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
1
|
import { ColumnResizeHandle, useColumnResize } from '@adecore/ui';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useRef, useState, type ReactNode, type Ref } from 'react';
|
|
4
4
|
import { assignRef } from '../assign-ref.ts';
|
|
5
5
|
|
|
6
6
|
export const VALUE_PANEL_WIDTH = 320;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { sameList } from '../same-list.ts';
|
|
1
2
|
import type { ColumnView } from './column-view.ts';
|
|
2
3
|
import { MAX_RESIZED_WIDTH, MIN_COLUMN_WIDTH } from './layout.ts';
|
|
3
|
-
import { sameList } from '../same-list.ts';
|
|
4
4
|
|
|
5
5
|
/* What a person did to the columns of a grid, by column name so it outlives a change of the column order. */
|
|
6
6
|
export interface GridLayout {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Banner, Button, EmptyState, Icon, Pill, ScrollArea, Separator, Spinner, Tabs, copyText, messageOf } from '@adecore/ui';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { CircleAlert, Copy, KeyRound, Link2 } from 'lucide-react';
|
|
4
|
+
import { useEffect, useState, type ReactNode, type Ref } from 'react';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Banner, Button, EmptyState, Icon, Pill, Separator, Spinner, Tabs, copyText, messageOf } from '@adecore/ui';
|
|
6
6
|
import { useDatabaseClient } from '../client-context.ts';
|
|
7
7
|
import type { Connection } from '../client/types.ts';
|
|
8
8
|
import { CODE_TEXT } from '../code-text.ts';
|
|
@@ -121,16 +121,16 @@ export function StructureTabs({ structure, start }: { structure: TableStructure;
|
|
|
121
121
|
</Tabs.Tab>
|
|
122
122
|
<Tabs.Tab value="ddl">{t('structure.ddl')}</Tabs.Tab>
|
|
123
123
|
</Tabs.List>
|
|
124
|
-
<Tabs.Panel value="columns"
|
|
124
|
+
<Tabs.Panel value="columns" render={<ScrollArea axis="both" />} className="grow">
|
|
125
125
|
<ColumnsTable structure={structure} />
|
|
126
126
|
</Tabs.Panel>
|
|
127
|
-
<Tabs.Panel value="indexes"
|
|
127
|
+
<Tabs.Panel value="indexes" render={<ScrollArea axis="both" />} className="grow">
|
|
128
128
|
<IndexesTable indexes={structure.indexes} />
|
|
129
129
|
</Tabs.Panel>
|
|
130
|
-
<Tabs.Panel value="foreignKeys"
|
|
130
|
+
<Tabs.Panel value="foreignKeys" render={<ScrollArea axis="both" />} className="grow">
|
|
131
131
|
<ForeignKeysTable foreignKeys={structure.foreignKeys} />
|
|
132
132
|
</Tabs.Panel>
|
|
133
|
-
<Tabs.Panel value="ddl"
|
|
133
|
+
<Tabs.Panel value="ddl" render={<ScrollArea axis="both" />} className="grow">
|
|
134
134
|
<Ddl ddl={structure.ddl} />
|
|
135
135
|
</Tabs.Panel>
|
|
136
136
|
</Tabs.Root>
|
|
@@ -290,7 +290,9 @@ function Ddl({ ddl }: { ddl: string | null }) {
|
|
|
290
290
|
<Icon icon={Copy} size={12} />
|
|
291
291
|
{t('structure.copy')}
|
|
292
292
|
</Button>
|
|
293
|
-
<pre
|
|
293
|
+
<ScrollArea axis="x" render={<pre />} viewportClassName={clsx(CODE_TEXT, 'p-3 pr-24 whitespace-pre text-text select-text')}>
|
|
294
|
+
{ddl}
|
|
295
|
+
</ScrollArea>
|
|
294
296
|
</div>
|
|
295
297
|
);
|
|
296
298
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Icon, IconButton, Kbd, KEY_SHORTCUTS, Keys, Menu, shortcut } from '@adecore/ui';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { ArrowDown, ArrowDownWideNarrow, ArrowRightToLine, ArrowUp, Code, Filter, Search, X, type LucideIcon } from 'lucide-react';
|
|
4
|
+
import { useId, useImperativeHandle, useMemo, useRef, useState, type KeyboardEvent, type Ref } from 'react';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Icon, IconButton, Kbd, KEY_SHORTCUTS, Keys, Menu, shortcut } from '@adecore/ui';
|
|
6
6
|
import type { Engine } from '../protocol/index.ts';
|
|
7
7
|
import {
|
|
8
8
|
addChip,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Button, Dialog, FormError, ScrollArea, Select, Spinner, Switch } from '@adecore/ui';
|
|
2
|
+
import { formatNumber } from '@adecore/ui/format';
|
|
2
3
|
import clsx from 'clsx';
|
|
4
|
+
import type { Ref } from 'react';
|
|
3
5
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Button, Dialog, FormError, Select, Spinner, Switch } from '@adecore/ui';
|
|
5
|
-
import { formatNumber } from '@adecore/ui/format';
|
|
6
6
|
import type { ColumnInfo } from '../protocol/index.ts';
|
|
7
7
|
import { hasMapping } from './import-mapping.ts';
|
|
8
8
|
|
|
@@ -73,7 +73,7 @@ export function ImportForm({
|
|
|
73
73
|
</div>
|
|
74
74
|
{sample !== null && (
|
|
75
75
|
<>
|
|
76
|
-
<
|
|
76
|
+
<ScrollArea viewportClassName="grid grid-cols-2 items-center gap-x-3 gap-y-1.5">
|
|
77
77
|
<span className="text-xs text-text-faint">{t('table.import.fileColumn')}</span>
|
|
78
78
|
<span className="text-xs text-text-faint">{t('table.import.tableColumn')}</span>
|
|
79
79
|
{sample.columns.map((name, index) => (
|
|
@@ -87,12 +87,12 @@ export function ImportForm({
|
|
|
87
87
|
onChange={(value) => onMappingChange(index, value === SKIP ? null : (tableColumns[Number(value)]?.name ?? null))}
|
|
88
88
|
/>
|
|
89
89
|
))}
|
|
90
|
-
</
|
|
90
|
+
</ScrollArea>
|
|
91
91
|
<div className="flex flex-col gap-1">
|
|
92
92
|
<span className="text-xs text-text-faint">
|
|
93
93
|
{t('table.import.preview', { count: formatNumber(Math.min(sample.rows.length, PREVIEW_ROWS)) })}
|
|
94
94
|
</span>
|
|
95
|
-
<
|
|
95
|
+
<ScrollArea axis="both" className="max-h-48 rounded-lg border border-border">
|
|
96
96
|
<table className="w-full border-collapse text-left font-mono text-code">
|
|
97
97
|
<thead className="sticky top-0 bg-surface-raised">
|
|
98
98
|
<tr>
|
|
@@ -115,7 +115,7 @@ export function ImportForm({
|
|
|
115
115
|
))}
|
|
116
116
|
</tbody>
|
|
117
117
|
</table>
|
|
118
|
-
</
|
|
118
|
+
</ScrollArea>
|
|
119
119
|
</div>
|
|
120
120
|
</>
|
|
121
121
|
)}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Button, ButtonGroup, IconButton, Spinner, Tooltip } from '@adecore/ui';
|
|
2
|
+
import { formatDecimal, formatNumber, formatRounded } from '@adecore/ui/format';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
4
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
5
|
+
import type { Ref } from 'react';
|
|
4
6
|
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { Button, ButtonGroup, IconButton, Spinner, Tooltip } from '@adecore/ui';
|
|
6
|
-
import { formatDecimal, formatNumber, formatRounded } from '@adecore/ui/format';
|
|
7
7
|
import { useNumberNotation } from '../client-context.ts';
|
|
8
8
|
import type { Aggregates } from '../grid/aggregates.ts';
|
|
9
9
|
import { numeralText } from '../grid/display.ts';
|