@arbidocs/blocks 0.4.77 → 0.4.79
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/agents/index.cjs +287 -275
- package/dist/agents/index.js +3 -3
- package/dist/agents/tasks/WorkflowThreadStrip.d.ts +9 -4
- package/dist/agents/workflows/StepBarFrame.d.ts +75 -0
- package/dist/agents/workflows/WorkflowRunner.d.ts +5 -1
- package/dist/agents/workflows/WorkflowStepBar.d.ts +9 -11
- package/dist/agents/workflows/index.d.ts +2 -0
- package/dist/agents/workflows/stepWindow.d.ts +59 -0
- package/dist/chat/ChatPage.d.ts +1 -1
- package/dist/chat/chat-page-types.d.ts +5 -0
- package/dist/chat/index.cjs +124 -124
- package/dist/chat/index.js +2 -2
- package/dist/{chunk-JFUN4D7D.cjs → chunk-3YET6D5E.cjs} +150 -146
- package/dist/chunk-3YET6D5E.cjs.map +1 -0
- package/dist/{chunk-B3WCKBJ7.cjs → chunk-5XVWGJ2H.cjs} +3 -3
- package/dist/{chunk-B3WCKBJ7.cjs.map → chunk-5XVWGJ2H.cjs.map} +1 -1
- package/dist/{chunk-34UW6XUQ.js → chunk-6GXF62XN.js} +566 -171
- package/dist/chunk-6GXF62XN.js.map +1 -0
- package/dist/{chunk-HEVVT6IT.js → chunk-BMOL5DN6.js} +126 -122
- package/dist/chunk-BMOL5DN6.js.map +1 -0
- package/dist/chunk-CWAZNXC5.js +441 -0
- package/dist/chunk-CWAZNXC5.js.map +1 -0
- package/dist/{chunk-NIP5BOP7.js → chunk-EWSEQEPL.js} +5 -4
- package/dist/chunk-EWSEQEPL.js.map +1 -0
- package/dist/{chunk-UEU23PTW.js → chunk-ICBAFX5B.js} +3 -3
- package/dist/{chunk-UEU23PTW.js.map → chunk-ICBAFX5B.js.map} +1 -1
- package/dist/{chunk-EKIUMNCN.cjs → chunk-IF6VAYIA.cjs} +5 -5
- package/dist/{chunk-EKIUMNCN.cjs.map → chunk-IF6VAYIA.cjs.map} +1 -1
- package/dist/chunk-MLAHDAN5.cjs +450 -0
- package/dist/chunk-MLAHDAN5.cjs.map +1 -0
- package/dist/{chunk-HOD6OM7L.cjs → chunk-MP6FK43E.cjs} +5 -4
- package/dist/chunk-MP6FK43E.cjs.map +1 -0
- package/dist/{chunk-GJV2G4FC.js → chunk-O35LRB3P.js} +3 -3
- package/dist/{chunk-GJV2G4FC.js.map → chunk-O35LRB3P.js.map} +1 -1
- package/dist/{chunk-GTXOV7IJ.cjs → chunk-XMBYDLZQ.cjs} +4 -4
- package/dist/{chunk-GTXOV7IJ.cjs.map → chunk-XMBYDLZQ.cjs.map} +1 -1
- package/dist/{chunk-OEM5ARVM.js → chunk-XQDM6T6C.js} +3 -3
- package/dist/{chunk-OEM5ARVM.js.map → chunk-XQDM6T6C.js.map} +1 -1
- package/dist/{chunk-3XR3IEGU.cjs → chunk-YGUKTFKW.cjs} +572 -167
- package/dist/chunk-YGUKTFKW.cjs.map +1 -0
- package/dist/connect/index.cjs +233 -77
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +2 -0
- package/dist/connect/index.js +191 -37
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedTagMatrix.d.ts +20 -0
- package/dist/connection/ConnectedWorkflowRunner.d.ts +13 -1
- package/dist/connection/WorkflowRunThread.d.ts +21 -0
- package/dist/databases/ColumnConfigFields.d.ts +68 -0
- package/dist/databases/DatabaseColumnDialog.d.ts +27 -2
- package/dist/databases/DatabaseTable.d.ts +8 -1
- package/dist/databases/PickCellEditor.d.ts +21 -0
- package/dist/databases/column-types.d.ts +73 -9
- package/dist/databases/databaseColumns.d.ts +4 -0
- package/dist/databases/index.cjs +758 -27
- package/dist/databases/index.cjs.map +1 -1
- package/dist/databases/index.d.ts +4 -1
- package/dist/databases/index.js +745 -31
- package/dist/databases/index.js.map +1 -1
- package/dist/databases/linkCells.d.ts +48 -0
- package/dist/files/index.cjs +2 -2
- package/dist/files/index.js +2 -2
- package/dist/index.cjs +624 -579
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/settings/index.cjs +35 -35
- package/dist/settings/index.js +3 -3
- package/dist/studio/index.cjs +3 -3
- package/dist/studio/index.js +2 -2
- package/dist/tags/TagMatrix.d.ts +64 -0
- package/dist/tags/index.d.ts +3 -0
- package/dist/tags/tagMatrixModel.d.ts +39 -0
- package/dist/workflow-canvas/index.cjs +46 -46
- package/dist/workflow-canvas/index.js +3 -3
- package/dist/workspaces/index.cjs +1 -1
- package/dist/workspaces/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-34UW6XUQ.js.map +0 -1
- package/dist/chunk-3XR3IEGU.cjs.map +0 -1
- package/dist/chunk-HEVVT6IT.js.map +0 -1
- package/dist/chunk-HOD6OM7L.cjs.map +0 -1
- package/dist/chunk-JFUN4D7D.cjs.map +0 -1
- package/dist/chunk-NIP5BOP7.js.map +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `TagMatrix` bound to the connection: a parent label's children from `useTagMatrix`, cells saved
|
|
3
|
+
* with `useUpdateTagFields`, "Add row" creating a child label, the workspace's people for person
|
|
4
|
+
* columns, and the export filed in the workspace as a Markdown document (its id goes to
|
|
5
|
+
* `onExported`, so a host can open it or send it for signature).
|
|
6
|
+
*/
|
|
7
|
+
import { type TagMatrixProps } from '../tags/TagMatrix';
|
|
8
|
+
export interface ConnectedTagMatrixProps extends Pick<TagMatrixProps, 'onOpenDocument' | 'onOpenFact' | 'onOpenRow' | 'actions' | 'labels' | 'className' | 'testId'> {
|
|
9
|
+
/** The parent label whose children are the rows (`tag-…`). */
|
|
10
|
+
parentId: string;
|
|
11
|
+
/** How many documents and facts each row lists (the rest are counted). Default 3. */
|
|
12
|
+
linksLimit?: number;
|
|
13
|
+
/** The exported document's title; default the parent label's name. */
|
|
14
|
+
exportTitle?: string;
|
|
15
|
+
/** The snapshot was filed: its document id. Absent: no export button. */
|
|
16
|
+
onExported?: (documentId: string) => void;
|
|
17
|
+
/** Read only: no cell edits, no "Add row". */
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function ConnectedTagMatrix({ parentId, linksLimit, exportTitle, onExported, readOnly, ...props }: ConnectedTagMatrixProps): import("react").JSX.Element;
|
|
@@ -12,6 +12,10 @@ import { type UseWorkflowThreadOptions } from './useWorkflowThread';
|
|
|
12
12
|
import { type WorkflowRunnerDialogLabels } from './WorkflowRunnerDialogs';
|
|
13
13
|
export interface ConnectedWorkflowRunnerLabels {
|
|
14
14
|
notify: string;
|
|
15
|
+
/** An agent step's answer, in the thread layout: a link to it in the thread. */
|
|
16
|
+
showInThread: string;
|
|
17
|
+
/** The thread layout's panel toggle, when the panel folds (a narrow container). */
|
|
18
|
+
currentStep: string;
|
|
15
19
|
/** A finished step whose answer is still being fetched. */
|
|
16
20
|
loadingAnswer: string;
|
|
17
21
|
notified: string;
|
|
@@ -39,7 +43,15 @@ export interface ConnectedWorkflowRunnerProps extends Omit<WorkflowRunnerProps,
|
|
|
39
43
|
*/
|
|
40
44
|
actions?: Pick<WorkflowRunnerActions, 'sign' | 'openRedline' | 'openReview'>;
|
|
41
45
|
dialogLabels?: Partial<WorkflowRunnerDialogLabels>;
|
|
46
|
+
/**
|
|
47
|
+
* `thread` (default): once the run has its thread, the page is that thread, live (follow-ups,
|
|
48
|
+
* answers with their sources, documents), with the step bar on top and the current step in a
|
|
49
|
+
* compact panel beside it; steps' answers link to their message instead of being repeated.
|
|
50
|
+
* Before the thread exists (the first form), and with `guided`, it is the stepper: one step at
|
|
51
|
+
* a time, each answer shown in full.
|
|
52
|
+
*/
|
|
53
|
+
layout?: 'thread' | 'guided';
|
|
42
54
|
}
|
|
43
|
-
export declare function ConnectedWorkflowRunner({ workflow, options, onOpenConversation, emptyHint, connectedLabels, onOpenDocument, onOpenDraft, onOpenMessage, actions: hostActions, dialogLabels, testIdPrefix, ...runnerProps }: ConnectedWorkflowRunnerProps): import("react").JSX.Element;
|
|
55
|
+
export declare function ConnectedWorkflowRunner({ workflow, options, onOpenConversation, emptyHint, connectedLabels, onOpenDocument, onOpenDraft, onOpenMessage, actions: hostActions, dialogLabels, layout, testIdPrefix, ...runnerProps }: ConnectedWorkflowRunnerProps): import("react").JSX.Element;
|
|
44
56
|
/** A document's processing status as the upload step shows it; unknown stays unknown. */
|
|
45
57
|
export declare function fileStatus(status: string | null | undefined): WorkflowRunnerFile['status'];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A workflow run's thread, live and interactive: the blocks `ChatPage` held to the run's one
|
|
3
|
+
* conversation (people ask follow-ups, see the answers and their sources, open documents), with
|
|
4
|
+
* the current step's panel beside it (`aside`). Step messages show as their step's chip.
|
|
5
|
+
*/
|
|
6
|
+
import { type ReactNode } from 'react';
|
|
7
|
+
import type { ChatCitationTarget, ChatPageLabels } from '../chat/chat-page-types';
|
|
8
|
+
export interface WorkflowRunThreadProps {
|
|
9
|
+
conversationId: string;
|
|
10
|
+
workspaceId: string | undefined;
|
|
11
|
+
/** The current step's panel. */
|
|
12
|
+
aside?: ReactNode;
|
|
13
|
+
/** A step's title by id (step messages show it). */
|
|
14
|
+
stepTitle?: (stepId: string) => string | undefined;
|
|
15
|
+
/** Scroll to and mark this message (a step's answer). */
|
|
16
|
+
targetMessageId?: string;
|
|
17
|
+
onOpenCitation?: (target: ChatCitationTarget) => void;
|
|
18
|
+
labels?: Partial<ChatPageLabels>;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function WorkflowRunThread({ conversationId, workspaceId, aside, stepTitle, targetMessageId, onOpenCitation, labels, className, }: WorkflowRunThreadProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type DatabaseColumnView, type DatabaseRollupOp, type DatabaseSummaryView } from './column-types';
|
|
2
|
+
export interface ColumnConfigLabels {
|
|
3
|
+
relatedDatabase: string;
|
|
4
|
+
pickDatabase: string;
|
|
5
|
+
noDatabases: string;
|
|
6
|
+
targetFixed: string;
|
|
7
|
+
thisDatabase: string;
|
|
8
|
+
showOnTarget: (target: string) => string;
|
|
9
|
+
showOnTargetHint: string;
|
|
10
|
+
pairName: string;
|
|
11
|
+
pairNamePlaceholder: (name: string) => string;
|
|
12
|
+
pairedWith: (target: string) => string;
|
|
13
|
+
oneWay: string;
|
|
14
|
+
relation: string;
|
|
15
|
+
pickRelation: string;
|
|
16
|
+
noRelations: string;
|
|
17
|
+
lookupColumn: string;
|
|
18
|
+
pickColumn: string;
|
|
19
|
+
noColumns: string;
|
|
20
|
+
rollupOp: string;
|
|
21
|
+
rollupColumn: string;
|
|
22
|
+
noNumberColumns: string;
|
|
23
|
+
ops: Record<DatabaseRollupOp, string>;
|
|
24
|
+
}
|
|
25
|
+
export declare const DEFAULT_COLUMN_CONFIG_LABELS: ColumnConfigLabels;
|
|
26
|
+
export interface RelationDraft {
|
|
27
|
+
database_id: string;
|
|
28
|
+
two_way: boolean;
|
|
29
|
+
pair_name: string;
|
|
30
|
+
}
|
|
31
|
+
export interface LookupDraft {
|
|
32
|
+
relation: string;
|
|
33
|
+
column: string;
|
|
34
|
+
}
|
|
35
|
+
export interface RollupDraft {
|
|
36
|
+
relation: string;
|
|
37
|
+
column: string;
|
|
38
|
+
op: DatabaseRollupOp;
|
|
39
|
+
}
|
|
40
|
+
export declare function RelationFields({ draft, onChange, databases, databaseId, databaseName, editing, column, labels, }: {
|
|
41
|
+
draft: RelationDraft;
|
|
42
|
+
onChange: (draft: RelationDraft) => void;
|
|
43
|
+
databases: DatabaseSummaryView[];
|
|
44
|
+
databaseId?: string;
|
|
45
|
+
databaseName?: string;
|
|
46
|
+
editing: boolean;
|
|
47
|
+
column?: DatabaseColumnView | null;
|
|
48
|
+
labels: ColumnConfigLabels;
|
|
49
|
+
}): import("react").JSX.Element;
|
|
50
|
+
/** The relation columns of this database, and the columns of a relation's target. */
|
|
51
|
+
export declare function relationColumnsOf(columns: DatabaseColumnView[]): DatabaseColumnView[];
|
|
52
|
+
export declare function targetColumnsOf(relationId: string, columns: DatabaseColumnView[], databases: DatabaseSummaryView[], databaseId?: string): DatabaseColumnView[];
|
|
53
|
+
export declare function LookupFields({ draft, onChange, columns, databases, databaseId, labels, }: {
|
|
54
|
+
draft: LookupDraft;
|
|
55
|
+
onChange: (draft: LookupDraft) => void;
|
|
56
|
+
columns: DatabaseColumnView[];
|
|
57
|
+
databases: DatabaseSummaryView[];
|
|
58
|
+
databaseId?: string;
|
|
59
|
+
labels: ColumnConfigLabels;
|
|
60
|
+
}): import("react").JSX.Element;
|
|
61
|
+
export declare function RollupFields({ draft, onChange, columns, databases, databaseId, labels, }: {
|
|
62
|
+
draft: RollupDraft;
|
|
63
|
+
onChange: (draft: RollupDraft) => void;
|
|
64
|
+
columns: DatabaseColumnView[];
|
|
65
|
+
databases: DatabaseSummaryView[];
|
|
66
|
+
databaseId?: string;
|
|
67
|
+
labels: ColumnConfigLabels;
|
|
68
|
+
}): import("react").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type DatabaseColumnType, type DatabaseColumnTypeLabels, type DatabaseColumnView } from './column-types';
|
|
1
|
+
import { type DatabaseColumnType, type DatabaseColumnTypeLabels, type DatabaseColumnView, type DatabaseRollupOp, type DatabaseSummaryView } from './column-types';
|
|
2
|
+
import { type ColumnConfigLabels } from './ColumnConfigFields';
|
|
2
3
|
export interface DatabaseColumnDialogLabels {
|
|
3
4
|
addTitle: string;
|
|
4
5
|
editTitle: string;
|
|
@@ -25,12 +26,35 @@ export interface DatabaseColumnDraft {
|
|
|
25
26
|
name: string;
|
|
26
27
|
type: DatabaseColumnType;
|
|
27
28
|
options: string[] | null;
|
|
29
|
+
/** A new relation column's target (and paired column). Absent when editing: it cannot change. */
|
|
30
|
+
relation?: {
|
|
31
|
+
database_id: string;
|
|
32
|
+
two_way: boolean;
|
|
33
|
+
pair_name?: string | null;
|
|
34
|
+
} | null;
|
|
35
|
+
lookup?: {
|
|
36
|
+
relation: string;
|
|
37
|
+
column: string;
|
|
38
|
+
} | null;
|
|
39
|
+
rollup?: {
|
|
40
|
+
relation: string;
|
|
41
|
+
column?: string | null;
|
|
42
|
+
op: DatabaseRollupOp;
|
|
43
|
+
} | null;
|
|
28
44
|
}
|
|
29
45
|
export interface DatabaseColumnDialogProps {
|
|
30
46
|
open: boolean;
|
|
31
47
|
onOpenChange: (open: boolean) => void;
|
|
32
48
|
/** The column being edited; omit to add one. */
|
|
33
49
|
column?: DatabaseColumnView | null;
|
|
50
|
+
/** The database the column belongs to (relations to it are marked "this database"). */
|
|
51
|
+
databaseId?: string;
|
|
52
|
+
/** Its name: the default name of a two-way relation's paired column. */
|
|
53
|
+
databaseName?: string;
|
|
54
|
+
/** Its columns: lookups and rollups read through one of its relation columns. */
|
|
55
|
+
columns?: DatabaseColumnView[];
|
|
56
|
+
/** The databases a relation can link to (this workspace's), with their columns. */
|
|
57
|
+
databases?: DatabaseSummaryView[];
|
|
34
58
|
onSave: (draft: DatabaseColumnDraft) => void;
|
|
35
59
|
/** Delete the column (editing only). */
|
|
36
60
|
onDelete?: () => void;
|
|
@@ -39,5 +63,6 @@ export interface DatabaseColumnDialogProps {
|
|
|
39
63
|
error?: string | null;
|
|
40
64
|
labels?: Partial<DatabaseColumnDialogLabels>;
|
|
41
65
|
typeLabels?: Partial<DatabaseColumnTypeLabels>;
|
|
66
|
+
configLabels?: Partial<ColumnConfigLabels>;
|
|
42
67
|
}
|
|
43
|
-
export declare function DatabaseColumnDialog({ open, onOpenChange, column, onSave, onDelete, isSaving, error, labels, typeLabels, }: DatabaseColumnDialogProps): import("react").JSX.Element;
|
|
68
|
+
export declare function DatabaseColumnDialog({ open, onOpenChange, column, databaseId, databaseName, columns, databases, onSave, onDelete, isSaving, error, labels, typeLabels, configLabels, }: DatabaseColumnDialogProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type GridViewProps } from '../files/GridView';
|
|
2
2
|
import { type DatabaseColumnLabels } from './databaseColumns';
|
|
3
3
|
import type { DatabaseColumnView, DatabaseRowView } from './column-types';
|
|
4
|
+
import type { DatabaseCellSources } from './linkCells';
|
|
4
5
|
export interface DatabaseTableLabels {
|
|
5
6
|
newRow: string;
|
|
6
7
|
emptyTitle: string;
|
|
@@ -18,6 +19,12 @@ export interface DatabaseTableProps {
|
|
|
18
19
|
onAddRow?: () => void;
|
|
19
20
|
onAddColumn?: () => void;
|
|
20
21
|
onEditColumn?: (column: DatabaseColumnView) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Choices for person, document and relation cells (workspace members, documents, a search of
|
|
24
|
+
* the related database's rows) and what a document chip opens. Keep it stable (memoise it): the
|
|
25
|
+
* columns are rebuilt when it changes.
|
|
26
|
+
*/
|
|
27
|
+
sources?: DatabaseCellSources;
|
|
21
28
|
/** Ticked rows (for a bulk delete). With it, rows show a checkbox. */
|
|
22
29
|
onSelectionChange?: (rows: DatabaseRowView[]) => void;
|
|
23
30
|
selected?: DatabaseRowView[];
|
|
@@ -35,4 +42,4 @@ export interface DatabaseTableProps {
|
|
|
35
42
|
gridProps?: Partial<Omit<GridViewProps<DatabaseRowView>, 'items' | 'columnDefs' | 'getItemId'>>;
|
|
36
43
|
testId?: string;
|
|
37
44
|
}
|
|
38
|
-
export declare function DatabaseTable({ columns, rows, onCellChange, onAddRow, onAddColumn, onEditColumn, onSelectionChange, selected, readOnly, isFiltered, isLoading, locale, gridId, height, labels, columnLabels, gridProps, testId, }: DatabaseTableProps): import("react").JSX.Element;
|
|
45
|
+
export declare function DatabaseTable({ columns, rows, onCellChange, onAddRow, onAddColumn, onEditColumn, sources, onSelectionChange, selected, readOnly, isFiltered, isLoading, locale, gridId, height, labels, columnLabels, gridProps, testId, }: DatabaseTableProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CustomCellEditorProps } from 'ag-grid-react';
|
|
2
|
+
import { type DatabaseRowView } from './column-types';
|
|
3
|
+
import { type DatabasePickOption } from './linkCells';
|
|
4
|
+
export interface PickCellEditorLabels {
|
|
5
|
+
searchPlaceholder: string;
|
|
6
|
+
noMatches: string;
|
|
7
|
+
searching: string;
|
|
8
|
+
clear: string;
|
|
9
|
+
done: string;
|
|
10
|
+
remove: (label: string) => string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_PICK_CELL_EDITOR_LABELS: PickCellEditorLabels;
|
|
13
|
+
export interface PickCellEditorParams {
|
|
14
|
+
kind: 'person' | 'document' | 'relation';
|
|
15
|
+
/** A fixed list of choices, filtered as the user types. */
|
|
16
|
+
options?: DatabasePickOption[];
|
|
17
|
+
/** Choices from the server for a search (instead of `options`). */
|
|
18
|
+
search?: (q: string) => Promise<DatabasePickOption[]>;
|
|
19
|
+
labels?: Partial<PickCellEditorLabels>;
|
|
20
|
+
}
|
|
21
|
+
export declare function PickCellEditor(props: CustomCellEditorProps<DatabaseRowView> & PickCellEditorParams): import("react").JSX.Element;
|
|
@@ -2,24 +2,63 @@
|
|
|
2
2
|
* Databases: the shapes the blocks read, and the per-type rules for showing and editing a cell.
|
|
3
3
|
*
|
|
4
4
|
* A database is a user-defined table (a client database, billing records). Its columns are typed:
|
|
5
|
-
* `text`, `number`, `date`, `checkbox`
|
|
6
|
-
* (
|
|
7
|
-
*
|
|
5
|
+
* `text`, `number`, `date`, `checkbox` and `select` hold a value; `person` holds a workspace member's
|
|
6
|
+
* id (`usr-…`); `document` and `relation` hold lists of ids (documents of the workspace, rows of the
|
|
7
|
+
* target database); `lookup` (the values of a column of the related rows) and `rollup` (a number
|
|
8
|
+
* measured over them) are computed by the server and never written. The server checks and
|
|
9
|
+
* normalises every cell (dates arrive as ISO `YYYY-MM-DD` or a full timestamp, numbers as numbers, a
|
|
10
|
+
* select as one of its options) and names every id a row refers to in the row's `titles`, so the
|
|
11
|
+
* blocks only format for display and turn an editor's value into what the API takes.
|
|
8
12
|
*/
|
|
9
|
-
export type DatabaseColumnType = 'text' | 'number' | 'date' | 'checkbox' | 'select';
|
|
13
|
+
export type DatabaseColumnType = 'text' | 'number' | 'date' | 'checkbox' | 'select' | 'person' | 'document' | 'relation' | 'lookup' | 'rollup';
|
|
10
14
|
/** Every type, in the order a type picker lists them. */
|
|
11
15
|
export declare const DATABASE_COLUMN_TYPES: DatabaseColumnType[];
|
|
16
|
+
/** Types whose cells the server computes from a relation: shown, never edited. */
|
|
17
|
+
export declare const COMPUTED_COLUMN_TYPES: ReadonlySet<DatabaseColumnType>;
|
|
18
|
+
/** Types whose cells are lists of ids (written as a list that replaces the cell's links). */
|
|
19
|
+
export declare const LINK_COLUMN_TYPES: ReadonlySet<DatabaseColumnType>;
|
|
20
|
+
export declare const isComputedColumn: (column: Pick<DatabaseColumnView, "type">) => boolean;
|
|
21
|
+
export type DatabaseRollupOp = 'count' | 'sum' | 'avg' | 'min' | 'max';
|
|
22
|
+
export declare const DATABASE_ROLLUP_OPS: DatabaseRollupOp[];
|
|
23
|
+
/**
|
|
24
|
+
* A relation column's target. A `two_way` column has a paired column on the target database
|
|
25
|
+
* (`pair_column_id`) showing the same links from the other side; `reverse` marks the paired side.
|
|
26
|
+
*/
|
|
27
|
+
export interface DatabaseRelationView {
|
|
28
|
+
database_id: string;
|
|
29
|
+
two_way?: boolean;
|
|
30
|
+
pair_column_id?: string | null;
|
|
31
|
+
reverse?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** A lookup: `column` of the target database, read through this database's `relation` column. */
|
|
34
|
+
export interface DatabaseLookupView {
|
|
35
|
+
relation: string;
|
|
36
|
+
column: string;
|
|
37
|
+
}
|
|
38
|
+
/** A rollup: `op` over the rows linked through `relation` (`column`: a number column, not for count). */
|
|
39
|
+
export interface DatabaseRollupView {
|
|
40
|
+
relation: string;
|
|
41
|
+
column?: string | null;
|
|
42
|
+
op?: DatabaseRollupOp;
|
|
43
|
+
}
|
|
12
44
|
/** A column as the blocks read it (the API's `DatabaseColumn`). */
|
|
13
45
|
export interface DatabaseColumnView {
|
|
14
46
|
id: string;
|
|
15
47
|
name: string;
|
|
16
48
|
type: DatabaseColumnType;
|
|
17
49
|
options?: string[] | null;
|
|
50
|
+
relation?: DatabaseRelationView | null;
|
|
51
|
+
lookup?: DatabaseLookupView | null;
|
|
52
|
+
rollup?: DatabaseRollupView | null;
|
|
18
53
|
}
|
|
19
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* A row as the blocks read it: cell values keyed by column id; an empty cell is absent. `titles`
|
|
56
|
+
* names every person, document and related row the cells refer to (id → display name).
|
|
57
|
+
*/
|
|
20
58
|
export interface DatabaseRowView {
|
|
21
59
|
id: string;
|
|
22
60
|
values: Record<string, unknown>;
|
|
61
|
+
titles?: Record<string, string>;
|
|
23
62
|
}
|
|
24
63
|
/** A database as a list shows it (the API's `DatabaseRead`). */
|
|
25
64
|
export interface DatabaseSummaryView {
|
|
@@ -38,21 +77,46 @@ export interface DatabaseColumnTypeLabels {
|
|
|
38
77
|
date: string;
|
|
39
78
|
checkbox: string;
|
|
40
79
|
select: string;
|
|
80
|
+
person: string;
|
|
81
|
+
document: string;
|
|
82
|
+
relation: string;
|
|
83
|
+
lookup: string;
|
|
84
|
+
rollup: string;
|
|
41
85
|
}
|
|
42
86
|
export declare const DEFAULT_DATABASE_COLUMN_TYPE_LABELS: DatabaseColumnTypeLabels;
|
|
43
87
|
export declare function optionTone(option: string): string;
|
|
88
|
+
/** A cell as a list: a list cell as is, a single value as a list of one, an empty cell as none. */
|
|
89
|
+
export declare function cellList(value: unknown): unknown[];
|
|
90
|
+
/** The ids a person, document or relation cell holds. */
|
|
91
|
+
export declare function cellIds(value: unknown): string[];
|
|
92
|
+
/** An id's display name from the row's titles (the id itself when the server could not name it). */
|
|
93
|
+
export declare function titleOf(id: string, titles?: Record<string, string>): string;
|
|
94
|
+
/** Two cell values, as the API stores them, are the same (lists compare item by item). */
|
|
95
|
+
export declare function sameCellValue(a: unknown, b: unknown): boolean;
|
|
44
96
|
/**
|
|
45
97
|
* A stored date for display. A bare `YYYY-MM-DD` is a calendar day: it is shown from its own
|
|
46
98
|
* components, never through a time zone (which would move it a day for viewers west of UTC).
|
|
47
99
|
*/
|
|
48
100
|
export declare function formatDateValue(value: string, locale?: string): string;
|
|
49
101
|
export declare function formatNumberValue(value: number, locale?: string): string;
|
|
50
|
-
/**
|
|
51
|
-
|
|
102
|
+
/**
|
|
103
|
+
* One value of a lookup cell, whose type is the looked-up column's: an id reads as its title, a
|
|
104
|
+
* number and an ISO date as their own column would show them.
|
|
105
|
+
*/
|
|
106
|
+
export declare function formatLookupValue(value: unknown, titles?: Record<string, string>, locale?: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* A cell as text: what a cell shows, what search and copy see. Checkboxes read as Yes/No; people,
|
|
109
|
+
* documents and related rows by their titles (the row's `titles`), lists joined with commas.
|
|
110
|
+
*/
|
|
111
|
+
export declare function formatCell(value: unknown, type: DatabaseColumnType, locale?: string, titles?: Record<string, string>): string;
|
|
52
112
|
/**
|
|
53
113
|
* An editor's value as the API takes it. Empty becomes `null` (which empties the cell); everything
|
|
54
114
|
* else goes as typed and the server checks it, so a bad value comes back as a 422 naming the column.
|
|
115
|
+
* A document or relation cell goes as its list of ids (which replaces the cell's links).
|
|
55
116
|
*/
|
|
56
117
|
export declare function toApiValue(value: unknown, type: DatabaseColumnType): unknown;
|
|
57
|
-
/**
|
|
58
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Sort comparator for a column's stored values: empty cells last, then by type. People, documents,
|
|
120
|
+
* related rows and lookups sort by what they show, so pass each row's titles.
|
|
121
|
+
*/
|
|
122
|
+
export declare function compareCells(a: unknown, b: unknown, type: DatabaseColumnType, titlesA?: Record<string, string>, titlesB?: Record<string, string>): number;
|
|
@@ -2,10 +2,12 @@ import type { ColDef } from 'ag-grid-community';
|
|
|
2
2
|
import { Type } from 'lucide-react';
|
|
3
3
|
import { type DatabaseColumnType, type DatabaseColumnView, type DatabaseRowView } from './column-types';
|
|
4
4
|
import { SelectChip } from './SelectChip';
|
|
5
|
+
import { type DatabaseCellSources } from './linkCells';
|
|
5
6
|
export { SelectChip };
|
|
6
7
|
export interface DatabaseColumnLabels {
|
|
7
8
|
addColumn: string;
|
|
8
9
|
columnSettings: (name: string) => string;
|
|
10
|
+
computed: string;
|
|
9
11
|
}
|
|
10
12
|
export declare const DEFAULT_DATABASE_COLUMN_LABELS: DatabaseColumnLabels;
|
|
11
13
|
/** colId of the trailing "add a column" column (never a database column id). */
|
|
@@ -18,6 +20,8 @@ export interface DatabaseColumnOptions {
|
|
|
18
20
|
onEditColumn?: (column: DatabaseColumnView) => void;
|
|
19
21
|
/** Add a column (the trailing "+" header). */
|
|
20
22
|
onAddColumn?: () => void;
|
|
23
|
+
/** Choices for person, document and relation cells, and what a document chip opens. */
|
|
24
|
+
sources?: DatabaseCellSources;
|
|
21
25
|
/** Locale for numbers and dates. */
|
|
22
26
|
locale?: string;
|
|
23
27
|
labels?: Partial<DatabaseColumnLabels>;
|