@adecore/database 0.62.1 → 0.63.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 (231) hide show
  1. package/README.md +1 -1
  2. package/dist/DatabaseProvider.d.ts +1 -1
  3. package/dist/client/types.js +0 -1
  4. package/dist/client-context.d.ts +3 -2
  5. package/dist/connections/EngineIcon.d.ts +2 -1
  6. package/dist/connections/docker.js +0 -3
  7. package/dist/connections/use-docker-containers.d.ts +2 -1
  8. package/dist/console/DestructiveDialog.d.ts +2 -1
  9. package/dist/console/HistoryPanel.d.ts +2 -1
  10. package/dist/console/QueryConsole.js +0 -3
  11. package/dist/console/SchemaPicker.d.ts +2 -1
  12. package/dist/console/StatementResultView.d.ts +2 -1
  13. package/dist/console/TransactionControls.d.ts +2 -1
  14. package/dist/console/labels.js +0 -1
  15. package/dist/console/useConsoleHistory.d.ts +2 -1
  16. package/dist/ddl/alter-sqlite.js +0 -1
  17. package/dist/ddl/alter.js +0 -1
  18. package/dist/ddl/column.d.ts +2 -1
  19. package/dist/ddl/column.js +0 -1
  20. package/dist/ddl/create.d.ts +2 -1
  21. package/dist/ddl/create.js +0 -2
  22. package/dist/ddl/dialect.js +0 -1
  23. package/dist/ddl/diff.d.ts +4 -3
  24. package/dist/ddl/diff.js +0 -3
  25. package/dist/ddl/draft.js +0 -2
  26. package/dist/ddl/parse.js +0 -4
  27. package/dist/designer/ColumnsEditor.js +0 -1
  28. package/dist/designer/DesignerView.js +0 -1
  29. package/dist/designer/ForeignKeysEditor.d.ts +2 -1
  30. package/dist/designer/NamePicker.d.ts +2 -1
  31. package/dist/designer/SqlPreview.d.ts +2 -1
  32. package/dist/designer/SqlPreview.js +0 -2
  33. package/dist/designer/TableDesigner.js +0 -1
  34. package/dist/designer/edit.js +0 -1
  35. package/dist/designer/plan.js +0 -1
  36. package/dist/explorer/DatabaseExplorer.js +0 -1
  37. package/dist/explorer/RowMenu.d.ts +2 -1
  38. package/dist/explorer/TableDialog.d.ts +2 -1
  39. package/dist/explorer/tree.d.ts +11 -13
  40. package/dist/explorer/tree.js +3 -16
  41. package/dist/explorer/use-explorer-loads.d.ts +2 -1
  42. package/dist/explorer/use-explorer-loads.js +0 -2
  43. package/dist/explorer/use-stored-expansion.d.ts +1 -1
  44. package/dist/grid/CellEditor.d.ts +2 -1
  45. package/dist/grid/CellEditor.js +0 -1
  46. package/dist/grid/CopyAsMenu.d.ts +2 -1
  47. package/dist/grid/DataGrid.js +1 -1
  48. package/dist/grid/EnumPicker.d.ts +2 -1
  49. package/dist/grid/GridHeaderCell.js +0 -3
  50. package/dist/grid/GridRowView.d.ts +3 -2
  51. package/dist/grid/GridRowView.js +1 -0
  52. package/dist/grid/ValueDock.d.ts +2 -3
  53. package/dist/grid/ValueDock.js +2 -3
  54. package/dist/grid/aggregates.d.ts +2 -1
  55. package/dist/grid/cell-range.d.ts +2 -1
  56. package/dist/grid/cell-range.js +0 -2
  57. package/dist/grid/column-layout.d.ts +2 -1
  58. package/dist/grid/column-layout.js +0 -1
  59. package/dist/grid/column-selection.js +0 -1
  60. package/dist/grid/column-view.js +0 -2
  61. package/dist/grid/copy-formats.d.ts +2 -1
  62. package/dist/grid/display.d.ts +3 -2
  63. package/dist/grid/display.js +0 -5
  64. package/dist/grid/edit-value.js +0 -1
  65. package/dist/grid/enum-type.js +0 -1
  66. package/dist/grid/focused-value.js +0 -1
  67. package/dist/grid/layout.d.ts +2 -2
  68. package/dist/grid/layout.js +1 -9
  69. package/dist/grid/navigation.d.ts +2 -1
  70. package/dist/grid/navigation.js +0 -1
  71. package/dist/grid/row-selection.d.ts +3 -2
  72. package/dist/grid/sort.js +0 -2
  73. package/dist/grid/types.js +0 -1
  74. package/dist/grid/whole-cells.d.ts +2 -1
  75. package/dist/host/helper-path.d.ts +1 -0
  76. package/dist/host/helper-path.js +3 -1
  77. package/dist/host/host.js +0 -4
  78. package/dist/host/index.d.ts +1 -1
  79. package/dist/host/index.js +1 -1
  80. package/dist/host/spawn.js +0 -1
  81. package/dist/index.d.ts +1 -1
  82. package/dist/number-notation.d.ts +1 -0
  83. package/dist/number-notation.js +1 -0
  84. package/dist/sql-split.d.ts +3 -2
  85. package/dist/structure/StructureView.js +0 -1
  86. package/dist/table/CommandField.d.ts +2 -1
  87. package/dist/table/ImportDialog.d.ts +2 -1
  88. package/dist/table/ImportDialog.js +0 -3
  89. package/dist/{grid → table}/RecordView.d.ts +3 -2
  90. package/dist/{grid → table}/RecordView.js +5 -6
  91. package/dist/table/TableStatusBar.d.ts +2 -1
  92. package/dist/table/TableStatusBar.js +0 -1
  93. package/dist/table/TableToolbar.d.ts +2 -1
  94. package/dist/table/TableToolbar.js +0 -1
  95. package/dist/table/TableView.d.ts +0 -1
  96. package/dist/table/TableView.js +2 -3
  97. package/dist/table/command-field.d.ts +4 -5
  98. package/dist/table/command-field.js +2 -11
  99. package/dist/table/grid-rows.d.ts +3 -2
  100. package/dist/table/grid-rows.js +0 -1
  101. package/dist/table/import-mapping.js +0 -2
  102. package/dist/table/layout-store.d.ts +0 -1
  103. package/dist/table/layout-store.js +1 -1
  104. package/dist/table/paging.js +0 -1
  105. package/dist/table/pending.d.ts +1 -2
  106. package/dist/table/pending.js +1 -6
  107. package/dist/table/useStoredLayout.d.ts +2 -2
  108. package/dist/table/useStoredLayout.js +1 -1
  109. package/dist/table/useTableTransfer.d.ts +4 -3
  110. package/dist/table/useTableTransfer.js +0 -2
  111. package/dist/testing/fake.js +0 -3
  112. package/dist/value/ValueEditor.d.ts +2 -1
  113. package/dist/value/ValueEditor.js +0 -4
  114. package/dist/value/ValuePanel.js +0 -1
  115. package/dist/value/draft.d.ts +2 -1
  116. package/dist/value/draft.js +0 -1
  117. package/dist/value/hex.d.ts +2 -2
  118. package/dist/value/hex.js +1 -2
  119. package/dist/value/json.d.ts +2 -1
  120. package/dist/value/json.js +0 -1
  121. package/dist/value/views.d.ts +0 -1
  122. package/dist/value/views.js +1 -3
  123. package/dist/workbench/DatabaseWorkbench.js +0 -2
  124. package/dist/workbench/DesignerTab.d.ts +2 -1
  125. package/dist/workbench/TableTab.d.ts +2 -1
  126. package/dist/workbench/tabs.d.ts +3 -2
  127. package/dist/workbench/tabs.js +0 -3
  128. package/package.json +9 -10
  129. package/src/DatabaseProvider.tsx +1 -1
  130. package/src/client/types.ts +0 -2
  131. package/src/client-context.ts +2 -2
  132. package/src/connections/EngineIcon.tsx +1 -1
  133. package/src/connections/docker.ts +0 -3
  134. package/src/connections/use-docker-containers.ts +1 -1
  135. package/src/console/DestructiveDialog.tsx +1 -1
  136. package/src/console/HistoryPanel.tsx +1 -1
  137. package/src/console/QueryConsole.tsx +0 -3
  138. package/src/console/SchemaPicker.tsx +1 -1
  139. package/src/console/StatementResultView.tsx +1 -1
  140. package/src/console/TransactionControls.tsx +1 -1
  141. package/src/console/destructive.ts +0 -1
  142. package/src/console/labels.ts +0 -1
  143. package/src/console/useConsoleHistory.ts +1 -1
  144. package/src/ddl/alter-sqlite.ts +0 -1
  145. package/src/ddl/alter.ts +0 -1
  146. package/src/ddl/column.ts +1 -2
  147. package/src/ddl/create.ts +1 -3
  148. package/src/ddl/dialect.ts +0 -1
  149. package/src/ddl/diff.ts +3 -6
  150. package/src/ddl/draft.ts +0 -2
  151. package/src/ddl/parse.ts +0 -4
  152. package/src/designer/ColumnsEditor.tsx +0 -2
  153. package/src/designer/DesignerView.tsx +0 -5
  154. package/src/designer/ForeignKeysEditor.tsx +1 -1
  155. package/src/designer/NamePicker.tsx +1 -3
  156. package/src/designer/SqlPreview.tsx +1 -3
  157. package/src/designer/TableDesigner.tsx +0 -2
  158. package/src/designer/edit.ts +0 -2
  159. package/src/designer/editor-props.ts +0 -1
  160. package/src/designer/plan.ts +0 -2
  161. package/src/explorer/DatabaseExplorer.tsx +0 -1
  162. package/src/explorer/RowMenu.tsx +1 -1
  163. package/src/explorer/TableDialog.tsx +1 -1
  164. package/src/explorer/expansion.ts +0 -1
  165. package/src/explorer/table-statements.ts +0 -1
  166. package/src/explorer/tree.ts +13 -31
  167. package/src/explorer/use-explorer-loads.ts +1 -4
  168. package/src/explorer/use-stored-expansion.ts +1 -2
  169. package/src/grid/CellEditor.tsx +1 -2
  170. package/src/grid/CopyAsMenu.tsx +1 -1
  171. package/src/grid/DataGrid.tsx +2 -4
  172. package/src/grid/EnumPicker.tsx +1 -2
  173. package/src/grid/GridHeaderCell.tsx +0 -3
  174. package/src/grid/GridRowView.tsx +3 -4
  175. package/src/grid/ValueDock.tsx +3 -6
  176. package/src/grid/aggregates.ts +1 -2
  177. package/src/grid/cell-range.ts +1 -3
  178. package/src/grid/column-layout.ts +1 -2
  179. package/src/grid/column-selection.ts +0 -1
  180. package/src/grid/column-view.ts +0 -2
  181. package/src/grid/copy-formats.ts +1 -2
  182. package/src/grid/display.ts +2 -9
  183. package/src/grid/edit-value.ts +0 -1
  184. package/src/grid/enum-type.ts +0 -1
  185. package/src/grid/focused-value.ts +0 -1
  186. package/src/grid/layout.ts +2 -12
  187. package/src/grid/navigation.ts +1 -3
  188. package/src/grid/row-selection.ts +2 -2
  189. package/src/grid/sort.ts +0 -2
  190. package/src/grid/types.ts +0 -5
  191. package/src/grid/whole-cells.ts +1 -2
  192. package/src/host/helper-path.ts +4 -1
  193. package/src/host/host.ts +0 -6
  194. package/src/host/index.ts +1 -1
  195. package/src/host/spawn.ts +0 -2
  196. package/src/host/types.ts +0 -3
  197. package/src/index.ts +1 -1
  198. package/src/number-notation.ts +2 -0
  199. package/src/protocol/connection.ts +0 -2
  200. package/src/protocol/errors.ts +0 -3
  201. package/src/protocol/messages.ts +0 -1
  202. package/src/protocol/schema.ts +0 -2
  203. package/src/protocol/values.ts +0 -2
  204. package/src/sql-split.ts +2 -2
  205. package/src/structure/StructureView.tsx +0 -1
  206. package/src/table/CommandField.tsx +1 -1
  207. package/src/table/ImportDialog.tsx +1 -7
  208. package/src/{grid → table}/RecordView.tsx +9 -12
  209. package/src/table/TableStatusBar.tsx +1 -3
  210. package/src/table/TableToolbar.tsx +1 -6
  211. package/src/table/TableView.tsx +2 -4
  212. package/src/table/command-field.ts +5 -14
  213. package/src/table/grid-rows.ts +2 -3
  214. package/src/table/import-mapping.ts +0 -2
  215. package/src/table/layout-store.ts +1 -2
  216. package/src/table/paging.ts +0 -1
  217. package/src/table/pending.ts +2 -9
  218. package/src/table/references.ts +0 -1
  219. package/src/table/useStoredLayout.ts +2 -4
  220. package/src/table/useTableTransfer.ts +3 -8
  221. package/src/testing/fake.ts +0 -5
  222. package/src/value/ValueEditor.tsx +1 -5
  223. package/src/value/ValuePanel.tsx +0 -1
  224. package/src/value/draft.ts +1 -2
  225. package/src/value/hex.ts +2 -3
  226. package/src/value/json.ts +1 -2
  227. package/src/value/views.ts +1 -4
  228. package/src/workbench/DatabaseWorkbench.tsx +0 -2
  229. package/src/workbench/DesignerTab.tsx +1 -2
  230. package/src/workbench/TableTab.tsx +1 -1
  231. package/src/workbench/tabs.ts +2 -7
package/dist/host/host.js CHANGED
@@ -12,7 +12,6 @@ class Failure extends Error {
12
12
  }
13
13
  const failure = (id, code, message) => ({ id, ok: false, error: { code, message } });
14
14
  const messageOf = (error) => (error instanceof Error ? error.message : String(error));
15
- /* `undefined` for a line that is not JSON. */
16
15
  const parseLine = (line) => {
17
16
  try {
18
17
  return JSON.parse(line);
@@ -34,7 +33,6 @@ const settleWithin = async (promises) => {
34
33
  clearTimeout(timer);
35
34
  }
36
35
  };
37
- /* Reads what the helper wrote for a request; anything that is not a response of the protocol becomes an `internal` error. */
38
36
  const normalize = (id, message) => {
39
37
  if (message.ok === true) {
40
38
  return { id, ok: true, result: message.result ?? null };
@@ -144,7 +142,6 @@ export const createDatabaseHost = (options) => {
144
142
  }
145
143
  return run;
146
144
  };
147
- /* Sends a message under a helper id of the host's own; the promise never rejects. */
148
145
  const dispatch = (run, method, params) => {
149
146
  const id = `h${++counter}`;
150
147
  const response = new Promise((resolve) => {
@@ -231,7 +228,6 @@ export const createDatabaseHost = (options) => {
231
228
  const sent = await dispatch(run, 'cancel', { request: target.helperId }).response;
232
229
  return { ...sent, id: request.id };
233
230
  };
234
- /* Remembers what a response changed about the sessions, then hands it back under the caller's id. */
235
231
  const settle = (request, owner, entry, run, response) => {
236
232
  if (request.method === 'close') {
237
233
  sessions.delete(request.params.session);
@@ -1,4 +1,4 @@
1
- export { helperPath, type HelperPathOptions } from './helper-path.ts';
1
+ export { helperFileName, helperPath, type HelperPathOptions } from './helper-path.ts';
2
2
  export { createDatabaseHost } from './host.ts';
3
3
  export { spawnHelper, type SpawnHelperOptions } from './spawn.ts';
4
4
  export type { DatabaseHost, DatabaseHostOptions, HelperProcess } from './types.ts';
@@ -1,4 +1,4 @@
1
- export { helperPath } from './helper-path.js';
1
+ export { helperFileName, helperPath } from './helper-path.js';
2
2
  export { createDatabaseHost } from './host.js';
3
3
  export { spawnHelper } from './spawn.js';
4
4
  export { parseRequest } from './validate.js';
@@ -34,7 +34,6 @@ const createLineSplitter = (onLine) => {
34
34
  }
35
35
  };
36
36
  };
37
- /* Runs the helper binary at `path`, speaking one JSON message per line over stdin and stdout. */
38
37
  export const spawnHelper = (path, options = {}) => {
39
38
  const lineListeners = [];
40
39
  const exitListeners = [];
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ export { DatabaseProvider, type DatabaseProviderProps } from './DatabaseProvider
13
13
  export { useDatabaseClient } from './client-context.ts';
14
14
  export { DataGrid, type DataGridProps } from './grid/DataGrid.tsx';
15
15
  export type { GridLayout } from './grid/column-layout.ts';
16
- export type { NumberNotation } from './grid/display.ts';
16
+ export type { NumberNotation } from './number-notation.ts';
17
17
  export type { GridSort } from './grid/sort.ts';
18
18
  export type { FocusedCell, GridColumn, GridMenuContext, GridRow, GridRowState } from './grid/types.ts';
19
19
  export { QueryConsole, type QueryConsoleProps } from './console/QueryConsole.tsx';
@@ -0,0 +1 @@
1
+ export type NumberNotation = 'database' | 'region';
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,10 @@
1
1
  import type { Engine } from './protocol/index.ts';
2
- export interface SqlToken {
2
+ interface SqlToken {
3
3
  readonly kind: 'word' | 'quoted' | 'comment' | 'punct' | 'semicolon';
4
4
  readonly start: number;
5
5
  readonly end: number;
6
6
  }
7
- export interface SqlStatement {
7
+ interface SqlStatement {
8
8
  readonly text: string;
9
9
  readonly start: number;
10
10
  readonly end: number;
@@ -13,3 +13,4 @@ export declare const tokenize: (text: string, engine: Engine) => SqlToken[];
13
13
  export declare const splitStatements: (text: string, engine: Engine) => SqlStatement[];
14
14
  export declare const statementAt: (text: string, offset: number, engine: Engine) => SqlStatement | null;
15
15
  export declare const firstKeyword: (text: string, engine: Engine) => string;
16
+ export {};
@@ -10,7 +10,6 @@ import { useSchemaChange } from '../use-schema-change.js';
10
10
  import { referenceOf } from './structure-text.js';
11
11
  const TH = 'sticky top-0 h-7 bg-surface px-3 text-left text-xs font-medium whitespace-nowrap text-text-faint';
12
12
  const TD = 'h-7 border-t border-border-soft px-3 text-xs whitespace-nowrap text-text select-text';
13
- /* The columns, indexes, foreign keys and DDL of one table or view. */
14
13
  export function StructureView({ connection, schema, table, toolbarStart, className, ref }) {
15
14
  const { t } = useTranslation('database');
16
15
  const client = useDatabaseClient();
@@ -1,7 +1,7 @@
1
1
  import { type Ref } from 'react';
2
2
  import type { Engine } from '../protocol/index.ts';
3
3
  import { type Chip, type CommandColumn } from './command-field.ts';
4
- export interface CommandFieldProps {
4
+ interface CommandFieldProps {
5
5
  chips: readonly Chip[];
6
6
  columns: readonly CommandColumn[];
7
7
  engine: Engine;
@@ -12,3 +12,4 @@ export interface CommandFieldProps {
12
12
  ref?: Ref<HTMLDivElement>;
13
13
  }
14
14
  export declare function CommandField({ chips, columns, engine, onChipsChange, onJumpToColumn, inputRef, className, ref }: CommandFieldProps): import("react").JSX.Element;
15
+ export {};
@@ -20,8 +20,9 @@ export interface ImportFormProps {
20
20
  ref?: Ref<HTMLDivElement>;
21
21
  }
22
22
  export declare function ImportForm({ path, tableColumns, sample, header, mapping, busy, error, onHeaderChange, onMappingChange, onImport, onCancel, className, ref }: ImportFormProps): import("react").JSX.Element;
23
- export interface ImportDialogProps extends ImportFormProps {
23
+ interface ImportDialogProps extends ImportFormProps {
24
24
  open: boolean;
25
25
  onOpenChange(open: boolean): void;
26
26
  }
27
27
  export declare function ImportDialog({ open, onOpenChange, ...form }: ImportDialogProps): import("react").JSX.Element;
28
+ export {};
@@ -4,10 +4,8 @@ import { formatNumber } from '@adecore/ui/format';
4
4
  import clsx from 'clsx';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { hasMapping } from './import-mapping.js';
7
- /* How many of the sampled rows the preview shows. */
8
7
  const PREVIEW_ROWS = 8;
9
8
  const SKIP = '-1';
10
- /* The body of the import dialog: how the file's columns map onto the table's, and a look at the rows. */
11
9
  export function ImportForm({ path, tableColumns, sample, header, mapping, busy, error, onHeaderChange, onMappingChange, onImport, onCancel, className, ref }) {
12
10
  const { t } = useTranslation('database');
13
11
  const items = [{ value: SKIP, label: t('table.import.skip') }, ...tableColumns.map((column, index) => ({ value: String(index), label: column.name }))];
@@ -21,7 +19,6 @@ export function ImportForm({ path, tableColumns, sample, header, mapping, busy,
21
19
  function MappingRow({ name, value, items, disabled, label, onChange }) {
22
20
  return (_jsxs(_Fragment, { children: [_jsx("span", { className: "truncate font-mono text-code text-text", children: name }), _jsx(Select, { size: "sm", className: "w-full", label: label, value: value, items: items, disabled: disabled, onValueChange: onChange })] }));
23
21
  }
24
- /* The import of a file into the table: pick how the columns map, look at the rows, confirm. */
25
22
  export function ImportDialog({ open, onOpenChange, ...form }) {
26
23
  const { t } = useTranslation('database');
27
24
  return (_jsx(Dialog.Root, { open: open, onOpenChange: (next) => !form.busy && onOpenChange(next), children: _jsxs(Dialog.Popup, { className: "flex max-h-[calc(100vh-96px)] w-[720px] max-w-[calc(100vw-48px)] flex-col p-5", children: [_jsx(Dialog.Title, { children: t('table.import.title') }), _jsx(Dialog.Description, { className: "mt-1 mb-4", children: t('table.import.description') }), _jsx(ImportForm, { ...form })] }) }));
@@ -1,7 +1,7 @@
1
1
  import { type Ref } from 'react';
2
+ import type { FocusedCell, GridColumn, GridRow } from '../grid/types.ts';
2
3
  import type { EditValue, Value } from '../protocol/index.ts';
3
- import type { FocusedCell, GridColumn, GridRow } from './types.ts';
4
- export interface RecordViewProps {
4
+ interface RecordViewProps {
5
5
  columns: readonly GridColumn[];
6
6
  rows: readonly GridRow[];
7
7
  index: number;
@@ -20,3 +20,4 @@ export interface RecordViewProps {
20
20
  ref?: Ref<HTMLDivElement>;
21
21
  }
22
22
  export declare function RecordView({ columns, rows, index, onIndexChange, focusedColumn, editable, onCommit, loadValue, onFocusedCellChange, onFollow, canFollow, onClose, label, empty, className, ref }: RecordViewProps): import("react").JSX.Element;
23
+ export {};
@@ -7,13 +7,13 @@ import { useEffect, useMemo, useRef, useState } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { useNumberNotation } from '../client-context.js';
9
9
  import { CODE_TEXT } from '../code-text.js';
10
+ import { columnNotation, cellView, copyTextOf, isPreview, numeralText } from '../grid/display.js';
11
+ import { draftOf, parseDraft } from '../grid/edit-value.js';
12
+ import { parseEnumType } from '../grid/enum-type.js';
13
+ import { EnumPicker } from '../grid/EnumPicker.js';
14
+ import { wholeValueOf } from '../grid/focused-value.js';
10
15
  import { isNumericKind } from '../sql.js';
11
16
  import { ValueEditor } from '../value/ValueEditor.js';
12
- import { columnNotation, cellView, copyTextOf, isPreview, numeralText } from './display.js';
13
- import { draftOf, parseDraft } from './edit-value.js';
14
- import { parseEnumType } from './enum-type.js';
15
- import { EnumPicker } from './EnumPicker.js';
16
- import { wholeValueOf } from './focused-value.js';
17
17
  const PREVIOUS_ROW = shortcut('Mod+ArrowUp');
18
18
  const NEXT_ROW = shortcut('Mod+ArrowDown');
19
19
  const textOf = (cell, kind, notation, readOnly) => {
@@ -150,7 +150,6 @@ export function RecordView({ columns, rows, index, onIndexChange, focusedColumn,
150
150
  }, value: active ? editing.draft : textOf(cell, column.kind, columnNotation(column, notation), !editableField), placeholder: placeholder, readOnly: !editableField || (preview && (!active || editing.loading)), className: clsx(CODE_TEXT, 'min-w-0 flex-1', row.state === 'deleted' && 'line-through'), onFocus: () => void beginEdit(position), onBlur: commitEdit, onChange: (event) => changeDraft(position, event.target.value), onKeyDown: (event) => handleKeyDown(event, position) }), active && editing.loading && _jsx(Spinner, { size: 12, label: t('grid.loadingValue'), className: "absolute right-2" })] }))] }), _jsxs(ContextMenu.Popup, { children: [_jsxs(ContextMenu.Item, { onClick: () => copyText(copyTextOf(cell)), children: [_jsx(Icon, { icon: Copy, size: 14 }), t('grid.copyValue'), _jsx(Kbd, { shortcut: EDIT_SHORTCUTS.copy })] }), editable && (_jsxs(_Fragment, { children: [_jsx(ContextMenu.Separator, {}), _jsxs(ContextMenu.Item, { disabled: !editableField || !nullable, onClick: () => commitValue(position, null), children: [_jsx(Icon, { icon: Ban, size: 14 }), t('grid.setNull')] }), _jsxs(ContextMenu.Item, { disabled: !editableField, onClick: () => commitValue(position, { kind: 'default' }), children: [_jsx(Icon, { icon: RotateCcw, size: 14 }), t('grid.setDefault')] })] }))] })] }, position));
151
151
  }) }))] }));
152
152
  }
153
- /* A field opened up to its whole value, fetched with `loadValue` when the row holds only a preview. */
154
153
  function WholeValue({ row, column, columns, editable, loadValue, onCommit }) {
155
154
  const { t } = useTranslation('database');
156
155
  const cell = row.cells[column] ?? null;
@@ -5,7 +5,7 @@ export interface SelectionFigures {
5
5
  readonly columns: readonly string[];
6
6
  readonly aggregates: Aggregates;
7
7
  }
8
- export interface TableStatusBarProps {
8
+ interface TableStatusBarProps {
9
9
  elapsedMs: number;
10
10
  bounds: PageBounds;
11
11
  counting: boolean;
@@ -17,3 +17,4 @@ export interface TableStatusBarProps {
17
17
  ref?: Ref<HTMLElement>;
18
18
  }
19
19
  export declare function TableStatusBar({ elapsedMs, bounds, counting, selection, onCount, onPrevious, onNext, className, ref }: TableStatusBarProps): import("react").JSX.Element;
20
+ export {};
@@ -6,7 +6,6 @@ import { ChevronLeft, ChevronRight } from 'lucide-react';
6
6
  import { useTranslation } from 'react-i18next';
7
7
  import { useNumberNotation } from '../client-context.js';
8
8
  import { numeralText } from '../grid/display.js';
9
- /* Which rows are on the page and how many there are, the way to the other pages, and the figures of the selected cells. */
10
9
  export function TableStatusBar({ elapsedMs, bounds, counting, selection, onCount, onPrevious, onNext, className, ref }) {
11
10
  const { t } = useTranslation('database');
12
11
  return (_jsxs("footer", { ref: ref, className: clsx('flex h-9 shrink-0 items-center gap-3 border-t border-border px-3 text-xs text-text-muted', className), children: [_jsxs("span", { className: "flex items-center gap-1 tabular-nums", children: [bounds.to === 0 ? t('table.noRows') : t('table.range', { from: formatNumber(bounds.from), to: formatNumber(bounds.to) }), bounds.to > 0 &&
@@ -2,7 +2,7 @@ import type { ReactNode, Ref } from 'react';
2
2
  import type { Engine, FileFormat } from '../protocol/index.ts';
3
3
  import type { Chip, CommandColumn } from './command-field.ts';
4
4
  import { type PageBounds } from './paging.ts';
5
- export interface TransferMenu {
5
+ interface TransferMenu {
6
6
  busy: boolean;
7
7
  onExport(format: FileFormat): void;
8
8
  onImport?(): void;
@@ -40,3 +40,4 @@ export interface TableToolbarProps {
40
40
  ref?: Ref<HTMLDivElement>;
41
41
  }
42
42
  export declare function TableToolbar({ start, refreshing, readOnlyReason, hasSelection, canRevertSelection, recordViewOpen, transfer, pendingCount, submitting, engine, chips, columns, pageSize, bounds, commandRef, onChipsChange, onJumpToColumn, onRefresh, onAddRow, onDeleteRows, onCloneRows, onRevertRows, onToggleRecordView, onPageSizeChange, onFirstPage, onLastPage, onSubmit, onRevert, className, ref }: TableToolbarProps): import("react").JSX.Element;
43
+ export {};
@@ -7,7 +7,6 @@ import { useTranslation } from 'react-i18next';
7
7
  import { EXPORT_FORMATS } from '../export-formats.js';
8
8
  import { CommandField } from './CommandField.js';
9
9
  import { PAGE_SIZES } from './paging.js';
10
- /* The command field for filtering, sorting and jumping to a column, refresh, add row, the submit of pending changes, and a menu of the rest. */
11
10
  export function TableToolbar({ start, refreshing, readOnlyReason, hasSelection, canRevertSelection, recordViewOpen = false, transfer, pendingCount, submitting, engine, chips, columns, pageSize, bounds, commandRef, onChipsChange, onJumpToColumn, onRefresh, onAddRow, onDeleteRows, onCloneRows, onRevertRows, onToggleRecordView, onPageSizeChange, onFirstPage, onLastPage, onSubmit, onRevert, className, ref }) {
12
11
  const { t } = useTranslation('database');
13
12
  const readOnly = readOnlyReason !== null;
@@ -1,6 +1,5 @@
1
1
  import { type ReactNode, type Ref } from 'react';
2
2
  import { type Connection } from '../client/types.ts';
3
- export declare const RECORD_WIDTH_KEY = "database:record-view";
4
3
  export interface TableViewProps {
5
4
  connection: Connection;
6
5
  schema: string;
@@ -9,7 +9,6 @@ import { useDatabaseAction, useDatabaseClient, useDatabaseFiles, useDatabaseNoti
9
9
  import { DatabaseRequestError } from '../client/types.js';
10
10
  import { aggregateBlock, blockSize } from '../grid/aggregates.js';
11
11
  import { DataGrid } from '../grid/DataGrid.js';
12
- import { RecordView } from '../grid/RecordView.js';
13
12
  import { ValueDock } from '../grid/ValueDock.js';
14
13
  import { valueOfCell } from '../protocol/index.js';
15
14
  import { parseStoredSize } from '../stored-size.js';
@@ -22,6 +21,7 @@ import { ImportDialog } from './ImportDialog.js';
22
21
  import { layoutStorageKey } from './layout-store.js';
23
22
  import { DEFAULT_PAGE_SIZE, lastPageOffset, pageBounds } from './paging.js';
24
23
  import { addInsertWith, describeKey, emptyPending, hasRowChanges, isPendingEmpty, markDeleted, pendingCount, removeInsert, revertRows, rowKeyOf, setEdit, setInsertValue, toRowChanges } from './pending.js';
24
+ import { RecordView } from './RecordView.js';
25
25
  import { foreignKeyOf, referenceOf } from './references.js';
26
26
  import { TableStatusBar } from './TableStatusBar.js';
27
27
  import { TableToolbar } from './TableToolbar.js';
@@ -29,7 +29,7 @@ import { useLoaded } from './useLoaded.js';
29
29
  import { useStoredLayout } from './useStoredLayout.js';
30
30
  import { useTableTransfer } from './useTableTransfer.js';
31
31
  /* Where the width of the record view is kept, in pixels, for every table. */
32
- export const RECORD_WIDTH_KEY = 'database:record-view';
32
+ const RECORD_WIDTH_KEY = 'database:record-view';
33
33
  const RECORD_WIDTH = 360;
34
34
  const NO_KEYS = new Set();
35
35
  const readOnlyReasonOf = (connection, structure, t) => {
@@ -44,7 +44,6 @@ const readOnlyReasonOf = (connection, structure, t) => {
44
44
  }
45
45
  return null;
46
46
  };
47
- /* What the strip over the table, or the app's notice, says of an export or an import. */
48
47
  const transferText = (found, t) => {
49
48
  switch (found.kind) {
50
49
  case 'exporting':
@@ -5,12 +5,12 @@ export interface FilterChip {
5
5
  readonly text: string;
6
6
  readonly sql: string;
7
7
  }
8
- export interface SortChip {
8
+ interface SortChip {
9
9
  readonly kind: 'sort';
10
10
  readonly column: string;
11
11
  readonly direction: SortDirection;
12
12
  }
13
- export interface OrderChip {
13
+ interface OrderChip {
14
14
  readonly kind: 'order';
15
15
  readonly text: string;
16
16
  }
@@ -30,8 +30,6 @@ export type Suggestion = {
30
30
  readonly kind: 'sql';
31
31
  readonly chip: FilterChip;
32
32
  };
33
- export declare const SUGGESTED_COLUMNS = 4;
34
- export declare const chipKey: (chip: Chip) => string;
35
33
  export declare const identifierText: (name: string) => string;
36
34
  export declare const chipsToWhere: (chips: readonly Chip[]) => string;
37
35
  export declare const chipsToOrderBy: (engine: Engine, chips: readonly Chip[]) => string;
@@ -43,7 +41,7 @@ export declare const removeChipAt: (chips: readonly Chip[], index: number) => Ch
43
41
  export declare const replaceChipAt: (chips: readonly Chip[], index: number, chip: Chip) => Chip[];
44
42
  export declare const filterChipsOf: (where: string, remembered?: readonly StoredFilter[]) => Chip[];
45
43
  export declare const sortChipsOf: (engine: Engine, orderBy: string) => Chip[];
46
- export interface ChipSource {
44
+ interface ChipSource {
47
45
  readonly where: string;
48
46
  readonly orderBy: string;
49
47
  readonly remembered?: readonly StoredFilter[];
@@ -55,3 +53,4 @@ export declare const shorten: (text: string, limit: number) => string;
55
53
  export declare const matchColumns: (columns: readonly CommandColumn[], typed: string, limit?: number) => CommandColumn[];
56
54
  export declare const suggest: (engine: Engine, text: string, columns: readonly CommandColumn[], limit?: number) => Suggestion[];
57
55
  export declare const filterStartText: (column: CommandColumn) => string;
56
+ export {};
@@ -1,6 +1,5 @@
1
1
  import { equalsCondition, findColumn, notEqualsCondition, orderByClause, parseOrderByLoose, quoteIdentifier, sqlLiteral } from '../sql.js';
2
- /* How many columns the suggestions list for what is typed. */
3
- export const SUGGESTED_COLUMNS = 4;
2
+ const SUGGESTED_COLUMNS = 4;
4
3
  const OR = /\bor\b/i;
5
4
  const BARE_NAME = /^[A-Za-z_][\w$]*$/;
6
5
  const WORD = /^(`(?:[^`]|``)+`|"(?:[^"]|"")+"|[A-Za-z_][\w$]*)\s*([\s\S]*)$/;
@@ -11,7 +10,7 @@ const BETWEEN = /^((?:NOT\s+)?BETWEEN)\s+([\s\S]+?)\s+AND\s+([\s\S]+)$/i;
11
10
  const IS_TEST = /^IS\s+(?:NOT\s+)?(?:NULL|TRUE|FALSE)$/i;
12
11
  /* A name being typed, or one that opened a quote. Whitespace after it means an operator is coming. */
13
12
  const NAME_BEING_TYPED = /^\s*(?:[\w$]*|[`"][^`"]*[`"]?)$/;
14
- export const chipKey = (chip) => (chip.kind === 'sort' ? `sort:${chip.column}` : `${chip.kind}:${chip.kind === 'filter' ? chip.sql : chip.text}`);
13
+ const chipKey = (chip) => (chip.kind === 'sort' ? `sort:${chip.column}` : `${chip.kind}:${chip.kind === 'filter' ? chip.sql : chip.text}`);
15
14
  const isFilter = (chip) => chip.kind === 'filter';
16
15
  const isSort = (chip) => chip.kind === 'sort';
17
16
  const sortChip = (sort) => ({ kind: 'sort', column: sort.column, direction: sort.direction });
@@ -39,19 +38,15 @@ export const chipsToOrderBy = (engine, chips) => chips
39
38
  .filter((part) => part !== '')
40
39
  .join(', ');
41
40
  export const sortsOf = (chips) => chips.filter(isSort).map(({ column, direction }) => ({ column, direction }));
42
- /* The sorts of a header menu replace every sort and raw ORDER BY, keeping the filters where they are. */
43
41
  export const withSorts = (chips, sorts) => [...chips.filter(isFilter), ...sorts.map(sortChip)];
44
- /* A column that is not sorted joins as ascending; one that is flips its direction where it stands. */
45
42
  export const toggleSort = (chips, column) => {
46
43
  if (!chips.some((chip) => isSort(chip) && chip.column === column)) {
47
44
  return [...chips, { kind: 'sort', column, direction: 'asc' }];
48
45
  }
49
46
  return chips.map((chip) => (isSort(chip) && chip.column === column ? { ...chip, direction: chip.direction === 'asc' ? 'desc' : 'asc' } : chip));
50
47
  };
51
- /* The same list when the chip is already in it. */
52
48
  export const addChip = (chips, chip) => chips.some((other) => chipKey(other) === chipKey(chip)) ? [...chips] : [...chips, chip];
53
49
  export const removeChipAt = (chips, index) => chips.filter((_, at) => at !== index);
54
- /* Puts the chip where another stood, dropping it if an equal one is already elsewhere in the list. */
55
50
  export const replaceChipAt = (chips, index, chip) => {
56
51
  const duplicate = chips.some((other, at) => at !== index && chipKey(other) === chipKey(chip));
57
52
  return duplicate ? removeChipAt(chips, index) : chips.map((other, at) => (at === index ? chip : other));
@@ -79,7 +74,6 @@ export const chipsFromQuery = (engine, { where, orderBy, remembered }) => [
79
74
  ...filterChipsOf(where, remembered),
80
75
  ...sortChipsOf(engine, orderBy)
81
76
  ];
82
- /* Whether quotes and parentheses close, outside of which an operand would swallow the rest of the text. */
83
77
  const isClosed = (operand) => {
84
78
  let quote = null;
85
79
  let depth = 0;
@@ -103,7 +97,6 @@ const isClosed = (operand) => {
103
97
  return quote === null && depth === 0;
104
98
  };
105
99
  const upper = (keyword) => keyword.replace(/\s+/g, ' ').toUpperCase();
106
- /* The operator and operands of a condition in the form the chip shows, or `null` when the text does not read as one. */
107
100
  const readOperation = (rest) => {
108
101
  const compare = COMPARE.exec(rest);
109
102
  if (compare !== null) {
@@ -144,7 +137,6 @@ export const cellChip = (engine, column, value, kind, exclude) => {
144
137
  const text = value === null ? `${name} IS ${exclude ? 'NOT ' : ''}NULL` : `${name} ${exclude ? '<>' : '='} ${sqlLiteral(engine, value, kind)}`;
145
138
  return { kind: 'filter', text, sql: exclude ? notEqualsCondition(engine, column, value, kind) : equalsCondition(engine, column, value, kind) };
146
139
  };
147
- /* Cuts a long text for a label, ending in an ellipsis. */
148
140
  export const shorten = (text, limit) => (text.length > limit ? `${text.slice(0, limit - 1)}…` : text);
149
141
  /* How well a name matches what is typed: 0 is the name itself, then its start, a word of it, anywhere in it; `null` is no match. */
150
142
  const rankOf = (name, token) => {
@@ -160,7 +152,6 @@ const rankOf = (name, token) => {
160
152
  }
161
153
  return lower.includes(token) ? 3 : null;
162
154
  };
163
- /* The columns that match a typed name, the closest first and in table order among equals. */
164
155
  export const matchColumns = (columns, typed, limit = SUGGESTED_COLUMNS) => {
165
156
  const token = typed.trim().replace(/^[`"]/, '').replace(/[`"]$/, '').toLowerCase();
166
157
  if (token === '') {
@@ -2,7 +2,7 @@ import { type Shown } from '../grid/display.ts';
2
2
  import { type GridColumn, type GridRow } from '../grid/types.ts';
3
3
  import type { EditValue, RowsResult, TableStructure } from '../protocol/index.ts';
4
4
  import { type PendingChanges } from './pending.ts';
5
- export type RowRef = {
5
+ type RowRef = {
6
6
  readonly kind: 'loaded';
7
7
  readonly index: number;
8
8
  } | {
@@ -13,7 +13,7 @@ export declare const loadedRowKey: (index: number) => string;
13
13
  export declare const insertedRowKey: (id: number) => string;
14
14
  export declare const parseRowKey: (key: string) => RowRef;
15
15
  export declare const buildGridColumns: (loaded: Pick<RowsResult, 'columns'>, structure: TableStructure | null) => GridColumn[];
16
- export interface GridRowsInput {
16
+ interface GridRowsInput {
17
17
  readonly structure: TableStructure | null;
18
18
  readonly loaded: Pick<RowsResult, 'columns' | 'rows'>;
19
19
  readonly pending: PendingChanges;
@@ -21,3 +21,4 @@ export interface GridRowsInput {
21
21
  }
22
22
  export declare const buildGridRows: ({ structure, loaded, pending, offset }: GridRowsInput) => GridRow[];
23
23
  export declare const cloneValues: (columns: readonly GridColumn[], cells: readonly Shown[]) => Record<string, EditValue>;
24
+ export {};
@@ -10,7 +10,6 @@ export const buildGridColumns = (loaded, structure) => {
10
10
  const infoOf = (name) => structure?.columns.find((info) => info.name === name);
11
11
  return loaded.columns.map((column) => gridColumnOf(column, infoOf(column.name), keys));
12
12
  };
13
- /* The loaded rows with their pending edits laid over them, then the rows waiting to be inserted. */
14
13
  export const buildGridRows = ({ structure, loaded, pending, offset }) => {
15
14
  const rows = loaded.rows.map((cells, index) => {
16
15
  const edits = pending.edits[index];
@@ -1,6 +1,5 @@
1
1
  /* The columns an import can fill. The server computes a generated column. */
2
2
  export const importableColumns = (columns) => columns.filter((column) => !column.generated);
3
- /* CSV or TSV by the extension of the path; CSV when it says neither. */
4
3
  export const formatOfPath = (path) => (/\.(tsv|tab)$/i.test(path) ? 'tsv' : 'csv');
5
4
  /*
6
5
  * The table column each file column goes to, as a name, or `null` for none. Names match without regard
@@ -24,5 +23,4 @@ export const matchColumns = (fileColumns, tableColumns, header) => {
24
23
  };
25
24
  /* Whether anything is mapped, since an import of nothing is no import. */
26
25
  export const hasMapping = (mapping) => mapping.some((column) => column !== null);
27
- /* Maps a file column to a table column, taking the table column from any other file column that had it. */
28
26
  export const mapColumn = (mapping, fileColumn, tableColumn) => mapping.map((current, index) => (index === fileColumn ? tableColumn : tableColumn !== null && current === tableColumn ? null : current));
@@ -1,6 +1,5 @@
1
1
  import type { GridLayout } from '../grid/column-layout.ts';
2
2
  import type { StoredFilter } from './command-field.ts';
3
- export declare const LAYOUT_VERSION = 1;
4
3
  export interface StoredLayout extends GridLayout {
5
4
  readonly pageSize: number | null;
6
5
  readonly where: string;
@@ -4,7 +4,7 @@ import { PAGE_SIZES } from './paging.js';
4
4
  * Bump when the shape changes; a stored value of another version is ignored rather than migrated. `filters`
5
5
  * came later without a bump, since `where` still says the same thing for a value without it.
6
6
  */
7
- export const LAYOUT_VERSION = 1;
7
+ const LAYOUT_VERSION = 1;
8
8
  export const EMPTY_LAYOUT = { widths: {}, hidden: [], pinned: [], pageSize: null, where: '', orderBy: '', filters: [] };
9
9
  export const layoutStorageKey = (connectionId, schema, table) => `database:table:${connectionId}:${schema}.${table}`;
10
10
  const isStringList = (value) => Array.isArray(value) && value.every((item) => typeof item === 'string');
@@ -16,5 +16,4 @@ export const pageBounds = (offset, rowCount, hasMore, counted) => {
16
16
  hasNext: counted === null ? hasMore : offset + rowCount < counted
17
17
  };
18
18
  };
19
- /* Where the last page starts, given how many rows the table has. */
20
19
  export const lastPageOffset = (total, pageSize) => (total <= 0 ? 0 : Math.floor((total - 1) / pageSize) * pageSize);
@@ -1,5 +1,5 @@
1
1
  import { type Cell, type EditValue, type RowChange, type RowKey, type RowsResult, type TableStructure } from '../protocol/index.ts';
2
- export interface InsertedRow {
2
+ interface InsertedRow {
3
3
  readonly id: number;
4
4
  readonly values: Readonly<Record<string, EditValue>>;
5
5
  }
@@ -11,7 +11,6 @@ export interface PendingChanges {
11
11
  export declare const emptyPending: PendingChanges;
12
12
  export declare const isPendingEmpty: (pending: PendingChanges) => boolean;
13
13
  export declare const pendingCount: (pending: PendingChanges) => number;
14
- export declare const valuesEqual: (left: EditValue | undefined, right: EditValue | undefined) => boolean;
15
14
  export declare const setEdit: (pending: PendingChanges, row: number, column: string, value: EditValue, original: Cell) => PendingChanges;
16
15
  export declare const addInsertWith: (pending: PendingChanges, values: Readonly<Record<string, EditValue>>) => PendingChanges;
17
16
  export declare const addInsert: (pending: PendingChanges) => PendingChanges;
@@ -3,7 +3,7 @@ export const emptyPending = { edits: {}, inserts: [], deletes: new Set() };
3
3
  export const isPendingEmpty = (pending) => Object.keys(pending.edits).length === 0 && pending.inserts.length === 0 && pending.deletes.size === 0;
4
4
  /* How many row changes a submit sends: an edited row that is also deleted counts once, as the delete. */
5
5
  export const pendingCount = (pending) => Object.keys(pending.edits).filter((row) => !pending.deletes.has(Number(row))).length + pending.inserts.length + pending.deletes.size;
6
- export const valuesEqual = (left, right) => {
6
+ const valuesEqual = (left, right) => {
7
7
  if (left === undefined || right === undefined) {
8
8
  return false;
9
9
  }
@@ -19,7 +19,6 @@ export const setEdit = (pending, row, column, value, original) => {
19
19
  const next = valuesEqual(value, valueOfCell(original)) ? kept : { ...kept, [column]: value };
20
20
  return { ...pending, edits: Object.keys(next).length === 0 ? others : { ...others, [row]: next } };
21
21
  };
22
- /* A new row to insert, filled in with `values`. */
23
22
  export const addInsertWith = (pending, values) => ({
24
23
  ...pending,
25
24
  inserts: [...pending.inserts, { id: pending.inserts.reduce((highest, row) => Math.max(highest, row.id), 0) + 1, values }]
@@ -34,19 +33,16 @@ export const markDeleted = (pending, rows) => ({
34
33
  ...pending,
35
34
  deletes: new Set([...pending.deletes, ...rows])
36
35
  });
37
- /* Takes back every change to one loaded row: its edits and its deletion. */
38
36
  export const revertRow = (pending, row) => {
39
37
  const { [row]: _dropped, ...edits } = pending.edits;
40
38
  const deletes = new Set(pending.deletes);
41
39
  deletes.delete(row);
42
40
  return { ...pending, edits, deletes };
43
41
  };
44
- /* Takes back every change to the given rows: the edits and deletion marks of the loaded ones, and the inserted ones altogether. */
45
42
  export const revertRows = (pending, rows) => {
46
43
  const reverted = rows.loaded.reduce(revertRow, pending);
47
44
  return { ...reverted, inserts: reverted.inserts.filter((row) => !rows.inserted.includes(row.id)) };
48
45
  };
49
- /* Whether any of the given rows has something to take back. */
50
46
  export const hasRowChanges = (pending, rows) => rows.loaded.some((row) => pending.edits[row] !== undefined || pending.deletes.has(row)) || pending.inserts.some((row) => rows.inserted.includes(row.id));
51
47
  /*
52
48
  * The key that picks out one loaded row, from its own values in the columns of the structure's row
@@ -96,7 +92,6 @@ const keyValueText = (value) => {
96
92
  }
97
93
  return typeof value === 'string' ? `'${value}'` : String(value);
98
94
  };
99
- /* A key as a person would write it in a WHERE: `id = 5, tenant = 'a'`. */
100
95
  export const describeKey = (key) => Object.entries(key)
101
96
  .map(([column, value]) => `${column} = ${keyValueText(value)}`)
102
97
  .join(', ');
@@ -1,8 +1,8 @@
1
1
  import type { DatabaseStorage } from '../actions.ts';
2
2
  import { type StoredLayout } from './layout-store.ts';
3
- export declare const STORE_DELAY_MS = 500;
4
- export interface StoredLayoutHandle {
3
+ interface StoredLayoutHandle {
5
4
  readonly stored: StoredLayout | null;
6
5
  remember(change: Partial<StoredLayout>): void;
7
6
  }
8
7
  export declare function useStoredLayout(storage: DatabaseStorage | undefined, key: string): StoredLayoutHandle;
8
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import { EMPTY_LAYOUT, parseStoredLayout, serializeLayout } from './layout-store.js';
3
3
  /* How long a change waits for the next before it is written, so a drag of a column edge is one write. */
4
- export const STORE_DELAY_MS = 500;
4
+ const STORE_DELAY_MS = 500;
5
5
  /*
6
6
  * The layout of one table's view in the app's storage. The hook reads it once, on mount, and writes it
7
7
  * back in the background, the last change included when the view unmounts.
@@ -17,7 +17,7 @@ export type TransferNotice = {
17
17
  readonly during: 'export' | 'import';
18
18
  readonly message: string;
19
19
  };
20
- export interface ImportDraft {
20
+ interface ImportDraft {
21
21
  readonly path: string;
22
22
  readonly format: ImportFormat;
23
23
  readonly header: boolean;
@@ -26,7 +26,7 @@ export interface ImportDraft {
26
26
  readonly busy: boolean;
27
27
  readonly error: string | null;
28
28
  }
29
- export interface TableTransferInput {
29
+ interface TableTransferInput {
30
30
  readonly client: DatabaseClient;
31
31
  readonly session: DatabaseSession;
32
32
  readonly files: DatabaseFiles | undefined;
@@ -38,7 +38,7 @@ export interface TableTransferInput {
38
38
  readonly onImported: () => void;
39
39
  readonly report?: (notice: TransferNotice) => void;
40
40
  }
41
- export interface TableTransfer {
41
+ interface TableTransfer {
42
42
  readonly notice: TransferNotice | null;
43
43
  readonly importDraft: ImportDraft | null;
44
44
  exportAs(format: FileFormat): void;
@@ -51,3 +51,4 @@ export interface TableTransfer {
51
51
  closeImport(): void;
52
52
  }
53
53
  export declare function useTableTransfer({ client, session, files, schema, table, structure, where, orderBy, onImported, report }: TableTransferInput): TableTransfer;
54
+ export {};
@@ -2,9 +2,7 @@ import { messageOf } from '@adecore/ui';
2
2
  import { useEffect, useRef, useState } from 'react';
3
3
  import { isCancelled } from '../client/types.js';
4
4
  import { formatOfPath, importableColumns, mapColumn, matchColumns } from './import-mapping.js';
5
- /* How long a finished export or import stays on the strip. */
6
5
  const NOTICE_MS = 8000;
7
- /* Export of the table as filtered, and import of a file into it, with the state both need between the dialogs and the strip. */
8
6
  export function useTableTransfer({ client, session, files, schema, table, structure, where, orderBy, onImported, report }) {
9
7
  const [notice, setNotice] = useState(null);
10
8
  const [importDraft, setImportDraft] = useState(null);
@@ -47,7 +47,6 @@ const findTable = (session, schema, name) => {
47
47
  }
48
48
  return table;
49
49
  };
50
- /* The columns that pick out one row: the primary key, or else the first unique index over columns that cannot be null. */
51
50
  const rowKeyOf = (table) => {
52
51
  if (table.primaryKey.length > 0) {
53
52
  return table.primaryKey;
@@ -94,7 +93,6 @@ const toRowsResult = (table, rows, offset, limit, cellLimit, budget) => {
94
93
  }
95
94
  return { columns: toResultColumns(table), rows: page, hasMore: rows.length > offset + limit, elapsedMs: 0 };
96
95
  };
97
- /* Evaluates the default of a column for a row an insert or an update leaves it out of. */
98
96
  const defaultOf = (column, table) => {
99
97
  if (column.autoIncrement) {
100
98
  const index = table.columns.indexOf(column);
@@ -198,7 +196,6 @@ const runStatement = (session, sql, limit, cellLimit, budget) => {
198
196
  throw error;
199
197
  }
200
198
  };
201
- /* Makes a schema the selected one, as a call that names `schema` does. */
202
199
  const selectSchema = (session, schema) => {
203
200
  if (schema === undefined) {
204
201
  return;
@@ -1,9 +1,10 @@
1
1
  import type { GridColumn } from '../grid/types.ts';
2
2
  import type { EditValue, Value } from '../protocol/index.ts';
3
- export interface ValueEditorProps {
3
+ interface ValueEditorProps {
4
4
  column: GridColumn;
5
5
  value: Value;
6
6
  editable: boolean;
7
7
  onCommit?(value: EditValue): void;
8
8
  }
9
9
  export declare function ValueEditor({ column, value, editable, onCommit }: ValueEditorProps): import("react").JSX.Element;
10
+ export {};