@arbidocs/blocks 0.5.183 → 0.5.184
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/ConnectedCallDock-CF7KF5KM.cjs +1 -1
- package/dist/ConnectedCallRoom-NQOE2RYD.cjs +1 -1
- package/dist/{ConnectedNativeDocxComparison-3KTHPCMT.cjs → ConnectedNativeDocxComparison-2YMF257D.cjs} +6 -6
- package/dist/{ConnectedNativeDocxComparison-3KTHPCMT.cjs.map → ConnectedNativeDocxComparison-2YMF257D.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-LUM6WE7F.cjs → ConnectedStreamedWordArtifact-3K5WTQMZ.cjs} +6 -6
- package/dist/{ConnectedStreamedWordArtifact-LUM6WE7F.cjs.map → ConnectedStreamedWordArtifact-3K5WTQMZ.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-NKCKBY3P.cjs → DocumentReviewCard-3NNHDWG3.cjs} +14 -14
- package/dist/{DocumentReviewCard-NKCKBY3P.cjs.map → DocumentReviewCard-3NNHDWG3.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-T4SOKUKO.cjs → FilesViewerDialog-OKLWGMIO.cjs} +17 -17
- package/dist/{FilesViewerDialog-T4SOKUKO.cjs.map → FilesViewerDialog-OKLWGMIO.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-QT63XYII.cjs → WorkspaceTableView-LGDLG3TX.cjs} +7 -7
- package/dist/{WorkspaceTableView-QT63XYII.cjs.map → WorkspaceTableView-LGDLG3TX.cjs.map} +1 -1
- package/dist/agents/index.cjs +163 -163
- package/dist/calls/index.cjs +21 -21
- package/dist/chat/index.cjs +5 -5
- package/dist/{chunk-4TCOUQMC.cjs → chunk-3J4R2QFL.cjs} +3 -3
- package/dist/{chunk-4TCOUQMC.cjs.map → chunk-3J4R2QFL.cjs.map} +1 -1
- package/dist/{chunk-W5UGKUV7.cjs → chunk-66IOCKWS.cjs} +124 -31
- package/dist/chunk-66IOCKWS.cjs.map +1 -0
- package/dist/{chunk-L3MYUPSH.cjs → chunk-6AFAYGJW.cjs} +5 -5
- package/dist/{chunk-L3MYUPSH.cjs.map → chunk-6AFAYGJW.cjs.map} +1 -1
- package/dist/{chunk-SFAAOEQE.cjs → chunk-6RYDZ2PS.cjs} +3 -3
- package/dist/{chunk-SFAAOEQE.cjs.map → chunk-6RYDZ2PS.cjs.map} +1 -1
- package/dist/{chunk-7QZXHSQX.cjs → chunk-7YALMXGZ.cjs} +26 -6
- package/dist/chunk-7YALMXGZ.cjs.map +1 -0
- package/dist/{chunk-WIQDXRRB.cjs → chunk-E4CSBOXP.cjs} +28 -28
- package/dist/{chunk-WIQDXRRB.cjs.map → chunk-E4CSBOXP.cjs.map} +1 -1
- package/dist/{chunk-J4X3LYGC.cjs → chunk-EBRD3IUG.cjs} +4 -4
- package/dist/{chunk-J4X3LYGC.cjs.map → chunk-EBRD3IUG.cjs.map} +1 -1
- package/dist/{chunk-A4HOEGDI.cjs → chunk-ER55JOJV.cjs} +4 -4
- package/dist/{chunk-A4HOEGDI.cjs.map → chunk-ER55JOJV.cjs.map} +1 -1
- package/dist/{chunk-A7MGQMOV.cjs → chunk-H4N6BZNU.cjs} +3 -3
- package/dist/{chunk-A7MGQMOV.cjs.map → chunk-H4N6BZNU.cjs.map} +1 -1
- package/dist/{chunk-KHZEFLQC.cjs → chunk-HUAABZ2C.cjs} +51 -4
- package/dist/chunk-HUAABZ2C.cjs.map +1 -0
- package/dist/{chunk-YYMCN76N.cjs → chunk-IM6R7DRQ.cjs} +5 -5
- package/dist/{chunk-YYMCN76N.cjs.map → chunk-IM6R7DRQ.cjs.map} +1 -1
- package/dist/{chunk-LYDSETR7.cjs → chunk-JEHGTPS2.cjs} +3 -3
- package/dist/{chunk-LYDSETR7.cjs.map → chunk-JEHGTPS2.cjs.map} +1 -1
- package/dist/{chunk-3YPVXIFF.cjs → chunk-K2XLEOGQ.cjs} +4 -4
- package/dist/{chunk-3YPVXIFF.cjs.map → chunk-K2XLEOGQ.cjs.map} +1 -1
- package/dist/{chunk-DWUWPF2A.cjs → chunk-LQ5XVFLV.cjs} +58 -58
- package/dist/{chunk-DWUWPF2A.cjs.map → chunk-LQ5XVFLV.cjs.map} +1 -1
- package/dist/{chunk-I5LXJLO5.cjs → chunk-MZPBZSKS.cjs} +3 -3
- package/dist/{chunk-I5LXJLO5.cjs.map → chunk-MZPBZSKS.cjs.map} +1 -1
- package/dist/{chunk-ZTLPUUZB.cjs → chunk-OQWJXM4V.cjs} +6 -6
- package/dist/{chunk-ZTLPUUZB.cjs.map → chunk-OQWJXM4V.cjs.map} +1 -1
- package/dist/{chunk-UFDUDQYT.cjs → chunk-PUCYBYBY.cjs} +1712 -71
- package/dist/chunk-PUCYBYBY.cjs.map +1 -0
- package/dist/{chunk-4H5DPHZ2.cjs → chunk-Q6DU3DZC.cjs} +4 -4
- package/dist/{chunk-4H5DPHZ2.cjs.map → chunk-Q6DU3DZC.cjs.map} +1 -1
- package/dist/{chunk-H3C5BY2H.cjs → chunk-QCFX535U.cjs} +4 -4
- package/dist/{chunk-H3C5BY2H.cjs.map → chunk-QCFX535U.cjs.map} +1 -1
- package/dist/{chunk-AZP4ABNL.cjs → chunk-QTGWH6Z2.cjs} +4 -4
- package/dist/{chunk-AZP4ABNL.cjs.map → chunk-QTGWH6Z2.cjs.map} +1 -1
- package/dist/{chunk-HYULUR6E.cjs → chunk-QYPCNB7P.cjs} +29 -29
- package/dist/{chunk-HYULUR6E.cjs.map → chunk-QYPCNB7P.cjs.map} +1 -1
- package/dist/{chunk-6VIS6B3O.cjs → chunk-UVMOUOFD.cjs} +28 -28
- package/dist/{chunk-6VIS6B3O.cjs.map → chunk-UVMOUOFD.cjs.map} +1 -1
- package/dist/{chunk-7ARRFRQR.cjs → chunk-UXWPJ6I5.cjs} +36 -36
- package/dist/{chunk-7ARRFRQR.cjs.map → chunk-UXWPJ6I5.cjs.map} +1 -1
- package/dist/{chunk-NGT3P5ZG.cjs → chunk-VD3HI5RF.cjs} +6 -7
- package/dist/chunk-VD3HI5RF.cjs.map +1 -0
- package/dist/{chunk-LIAC6O7W.cjs → chunk-ZVTLEBFG.cjs} +4 -4
- package/dist/{chunk-LIAC6O7W.cjs.map → chunk-ZVTLEBFG.cjs.map} +1 -1
- package/dist/connect/docx.cjs +9 -9
- package/dist/connect/index.cjs +1396 -1190
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +14 -14
- package/dist/connection/databases/ConnectedSourcesEditor.d.ts +4 -0
- package/dist/connection/databases/ConnectedSourcesEditor.js +126 -0
- package/dist/connection/databases/ConnectedSourcesEditor.js.map +7 -0
- package/dist/connection/databases/sourceCells.d.ts +14 -0
- package/dist/connection/databases/sourceCells.js +40 -0
- package/dist/connection/databases/sourceCells.js.map +7 -0
- package/dist/connection/databases/useApiDatabaseSource.js +35 -11
- package/dist/connection/databases/useApiDatabaseSource.js.map +2 -2
- package/dist/connection/databases/useDatabaseCellSources.d.ts +8 -1
- package/dist/connection/databases/useDatabaseCellSources.js +40 -5
- package/dist/connection/databases/useDatabaseCellSources.js.map +2 -2
- package/dist/connection/databases/wireColumns.d.ts +17 -0
- package/dist/connection/databases/wireColumns.js +22 -0
- package/dist/connection/databases/wireColumns.js.map +7 -0
- package/dist/connection/facts/documentPickerGroups.d.ts +3 -0
- package/dist/connection/facts/documentPickerGroups.js +21 -0
- package/dist/connection/facts/documentPickerGroups.js.map +7 -0
- package/dist/connection/facts/factsSource.js +2 -17
- package/dist/connection/facts/factsSource.js.map +2 -2
- package/dist/connection/facts/useFactComposer.js +6 -60
- package/dist/connection/facts/useFactComposer.js.map +2 -2
- package/dist/connection/facts/usePassageCollection.d.ts +21 -0
- package/dist/connection/facts/usePassageCollection.js +72 -0
- package/dist/connection/facts/usePassageCollection.js.map +7 -0
- package/dist/connection/pages/TableViewBlock.js +2 -6
- package/dist/connection/pages/TableViewBlock.js.map +2 -2
- package/dist/connection/tags/ConnectedTagsPage.js +4 -1
- package/dist/connection/tags/ConnectedTagsPage.js.map +2 -2
- package/dist/databases/DatabaseFilterMenu.d.ts +1 -1
- package/dist/databases/DatabaseFilterMenu.js +4 -3
- package/dist/databases/DatabaseFilterMenu.js.map +2 -2
- package/dist/databases/DatabaseRowDetail.js +18 -2
- package/dist/databases/DatabaseRowDetail.js.map +2 -2
- package/dist/databases/databaseColumns.js +7 -2
- package/dist/databases/databaseColumns.js.map +2 -2
- package/dist/databases/index.cjs +128 -131
- package/dist/databases/index.d.ts +1 -1
- package/dist/databases/index.js.map +2 -2
- package/dist/databases/linkCells.d.ts +37 -1
- package/dist/databases/linkCells.js +17 -2
- package/dist/databases/linkCells.js.map +2 -2
- package/dist/embed/index.cjs +18 -18
- package/dist/facts/index.cjs +52 -54
- package/dist/facts/index.cjs.map +1 -1
- package/dist/files/index.cjs +220 -220
- package/dist/home/index.cjs +9 -9
- package/dist/index.cjs +785 -786
- package/dist/index.cjs.map +1 -1
- package/dist/pages/index.cjs +24 -25
- package/dist/pages/index.cjs.map +1 -1
- package/dist/settings/index.cjs +136 -136
- package/dist/site/index.cjs +10 -11
- package/dist/studio/index.cjs +4 -5
- package/dist/studio/index.cjs.map +1 -1
- package/dist/timeline/index.cjs +12 -13
- package/dist/workflow-canvas/index.cjs +26 -26
- package/dist/workspaces/index.cjs +5 -5
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/dist/chunk-7QZXHSQX.cjs.map +0 -1
- package/dist/chunk-GXJW5EK5.cjs +0 -102
- package/dist/chunk-GXJW5EK5.cjs.map +0 -1
- package/dist/chunk-I24N4OSB.cjs +0 -57
- package/dist/chunk-I24N4OSB.cjs.map +0 -1
- package/dist/chunk-KHZEFLQC.cjs.map +0 -1
- package/dist/chunk-NGT3P5ZG.cjs.map +0 -1
- package/dist/chunk-UFDUDQYT.cjs.map +0 -1
- package/dist/chunk-VBD4RJOL.cjs +0 -1640
- package/dist/chunk-VBD4RJOL.cjs.map +0 -1
- package/dist/chunk-W5UGKUV7.cjs.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import { getUserDisplayName } from "@arbidocs/react/ui";
|
|
2
|
+
import { createElement, useCallback, useMemo } from "react";
|
|
3
|
+
import { getEntityColor, getUserDisplayName } from "@arbidocs/react/ui";
|
|
4
4
|
import {
|
|
5
5
|
rowTitle
|
|
6
6
|
} from "../../databases/index.js";
|
|
7
7
|
import { useBlocksEnvironment } from "../../provider/environment.js";
|
|
8
|
-
import { useArbiSessionState, useWorkspaces } from "@arbidocs/react";
|
|
8
|
+
import { useArbiSessionState, useCreateTag, useTags, useWorkspaces } from "@arbidocs/react";
|
|
9
9
|
import { useDocuments, useSearchDatabaseRows } from "@arbidocs/react";
|
|
10
|
+
import { ConnectedSourcesEditor } from "./ConnectedSourcesEditor.js";
|
|
10
11
|
const UNTITLED = "Untitled";
|
|
11
|
-
function useDatabaseCellSources(databases) {
|
|
12
|
+
function useDatabaseCellSources(databases, needs = {}) {
|
|
12
13
|
const workspaceId = useArbiSessionState((state) => state.workspaceId);
|
|
13
14
|
const { data: workspaces } = useWorkspaces();
|
|
14
15
|
const workspace = workspaces?.find((candidate) => candidate.external_id === workspaceId);
|
|
@@ -40,14 +41,48 @@ function useDatabaseCellSources(databases) {
|
|
|
40
41
|
return rows.map((row) => ({ id: row.id, label: rowTitle(row, columns) || UNTITLED }));
|
|
41
42
|
};
|
|
42
43
|
}, [databases, searchDatabaseRows]);
|
|
44
|
+
const wantLabels = needs.labels === true;
|
|
45
|
+
const { data: tags } = useTags(void 0, { enabled: wantLabels });
|
|
46
|
+
const createTag = useCreateTag();
|
|
47
|
+
const createTagAsync = createTag.mutateAsync;
|
|
48
|
+
const labelOptions = useMemo(
|
|
49
|
+
() => (tags ?? []).map((t) => ({
|
|
50
|
+
id: t.external_id,
|
|
51
|
+
name: t.name,
|
|
52
|
+
color: getEntityColor(t.external_id, "medium"),
|
|
53
|
+
kind: t.kind
|
|
54
|
+
})).sort((a, b) => a.name.localeCompare(b.name)),
|
|
55
|
+
[tags]
|
|
56
|
+
);
|
|
57
|
+
const labels = useMemo(
|
|
58
|
+
() => wantLabels ? {
|
|
59
|
+
options: labelOptions,
|
|
60
|
+
onCreate: async (name) => {
|
|
61
|
+
const created = await createTagAsync({
|
|
62
|
+
name,
|
|
63
|
+
tagType: { type: "checkbox", options: [] },
|
|
64
|
+
shared: true
|
|
65
|
+
});
|
|
66
|
+
return created?.external_id;
|
|
67
|
+
}
|
|
68
|
+
} : void 0,
|
|
69
|
+
[wantLabels, labelOptions, createTagAsync]
|
|
70
|
+
);
|
|
71
|
+
const wantSources = needs.sources === true;
|
|
72
|
+
const renderSourcesEditor = useCallback(
|
|
73
|
+
(props) => createElement(ConnectedSourcesEditor, { key: props.rowId, ...props }),
|
|
74
|
+
[]
|
|
75
|
+
);
|
|
43
76
|
return useMemo(
|
|
44
77
|
() => ({
|
|
45
78
|
members,
|
|
46
79
|
documents: documentOptions,
|
|
47
80
|
searchRows,
|
|
81
|
+
labels,
|
|
82
|
+
renderSourcesEditor: wantSources ? renderSourcesEditor : void 0,
|
|
48
83
|
onOpenDocument: (documentId) => openDocument(documentId)
|
|
49
84
|
}),
|
|
50
|
-
[members, documentOptions, searchRows, openDocument]
|
|
85
|
+
[members, documentOptions, searchRows, labels, wantSources, renderSourcesEditor, openDocument]
|
|
51
86
|
);
|
|
52
87
|
}
|
|
53
88
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/connection/databases/useDatabaseCellSources.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The choices of a database's person, document and relation cells, and what a document chip does:\n * the open workspace's members, its documents, a server search of a related database's rows, and\n * opening a document in the viewer.\n */\nimport { useMemo } from 'react'\nimport { getUserDisplayName } from '@arbidocs/react/ui'\nimport {\n rowTitle,\n type DatabaseCellSources,\n type DatabaseColumnView,\n type DatabasePickOption,\n} from '../../databases'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useArbiSessionState, useWorkspaces } from '@arbidocs/react'\nimport { useDocuments, useSearchDatabaseRows, type Database } from '@arbidocs/react'\n\nconst UNTITLED = 'Untitled'\n\n/**\n * @param databases the databases a relation can point at (their first column titles a row).\n */\nexport function useDatabaseCellSources(databases: Database[] | undefined): DatabaseCellSources {\n const workspaceId = useArbiSessionState((state) => state.workspaceId)\n const { data: workspaces } = useWorkspaces()\n const workspace = workspaces?.find((candidate) => candidate.external_id === workspaceId)\n const { data: documents } = useDocuments()\n const { openDocument } = useBlocksEnvironment()\n const searchDatabaseRows = useSearchDatabaseRows()\n\n const members = useMemo<DatabasePickOption[]>(\n () =>\n (workspace?.users ?? []).map((wu) => ({\n id: wu.user.external_id,\n label: getUserDisplayName(wu.user),\n description: wu.user.email,\n })),\n [workspace?.users]\n )\n\n const documentOptions = useMemo<DatabasePickOption[]>(\n () =>\n (documents ?? []).map((d) => ({\n id: d.external_id,\n label: d.file_name || d.external_id,\n })),\n [documents]\n )\n\n const searchRows = useMemo(() => {\n const columnsOf = new Map<string, DatabaseColumnView[]>(\n (databases ?? []).map((d) => [d.id, d.columns as DatabaseColumnView[]])\n )\n return async (databaseId: string, q: string): Promise<DatabasePickOption[]> => {\n const columns = columnsOf.get(databaseId) ?? []\n const rows = await searchDatabaseRows(databaseId, q)\n return rows.map((row) => ({ id: row.id, label: rowTitle(row, columns) || UNTITLED }))\n }\n }, [databases, searchDatabaseRows])\n\n return useMemo(\n () => ({\n members,\n documents: documentOptions,\n searchRows,\n onOpenDocument: (documentId: string) => openDocument(documentId),\n }),\n [members, documentOptions, searchRows, openDocument]\n )\n}\n"],
|
|
5
|
-
"mappings": ";AAKA,SAAS,eAAe;
|
|
4
|
+
"sourcesContent": ["/**\n * The choices of a database's person, document and relation cells, and what a document chip does:\n * the open workspace's members, its documents, a server search of a related database's rows, and\n * opening a document in the viewer.\n */\nimport { createElement, useCallback, useMemo } from 'react'\nimport { getEntityColor, getUserDisplayName } from '@arbidocs/react/ui'\nimport {\n rowTitle,\n type DatabaseCellSources,\n type DatabaseColumnView,\n type DatabaseLabelOption,\n type DatabasePickOption,\n type DatabaseSourcesEditorProps,\n} from '../../databases'\nimport { useBlocksEnvironment } from '../../provider/environment'\nimport { useArbiSessionState, useCreateTag, useTags, useWorkspaces } from '@arbidocs/react'\nimport { useDocuments, useSearchDatabaseRows, type Database } from '@arbidocs/react'\nimport { ConnectedSourcesEditor } from './ConnectedSourcesEditor'\n\nconst UNTITLED = 'Untitled'\n\n/** What a database's cells need beyond people, documents and related rows. */\nexport interface CellSourceNeeds {\n /** The database has label columns: the workspace's tags are read (not otherwise). */\n labels?: boolean\n /** The database has source columns: its row page edits them (documents and passages). */\n sources?: boolean\n}\n\n/**\n * @param databases the databases a relation can point at (their first column titles a row).\n */\nexport function useDatabaseCellSources(\n databases: Database[] | undefined,\n needs: CellSourceNeeds = {}\n): DatabaseCellSources {\n const workspaceId = useArbiSessionState((state) => state.workspaceId)\n const { data: workspaces } = useWorkspaces()\n const workspace = workspaces?.find((candidate) => candidate.external_id === workspaceId)\n const { data: documents } = useDocuments()\n const { openDocument } = useBlocksEnvironment()\n const searchDatabaseRows = useSearchDatabaseRows()\n\n const members = useMemo<DatabasePickOption[]>(\n () =>\n (workspace?.users ?? []).map((wu) => ({\n id: wu.user.external_id,\n label: getUserDisplayName(wu.user),\n description: wu.user.email,\n })),\n [workspace?.users]\n )\n\n const documentOptions = useMemo<DatabasePickOption[]>(\n () =>\n (documents ?? []).map((d) => ({\n id: d.external_id,\n label: d.file_name || d.external_id,\n })),\n [documents]\n )\n\n const searchRows = useMemo(() => {\n const columnsOf = new Map<string, DatabaseColumnView[]>(\n (databases ?? []).map((d) => [d.id, d.columns as DatabaseColumnView[]])\n )\n return async (databaseId: string, q: string): Promise<DatabasePickOption[]> => {\n const columns = columnsOf.get(databaseId) ?? []\n const rows = await searchDatabaseRows(databaseId, q)\n return rows.map((row) => ({ id: row.id, label: rowTitle(row, columns) || UNTITLED }))\n }\n }, [databases, searchDatabaseRows])\n\n // The workspace's tags, only for a database with a label column (no other request is made).\n const wantLabels = needs.labels === true\n const { data: tags } = useTags(undefined, { enabled: wantLabels })\n const createTag = useCreateTag()\n const createTagAsync = createTag.mutateAsync\n const labelOptions = useMemo<DatabaseLabelOption[]>(\n () =>\n (tags ?? [])\n .map((t) => ({\n id: t.external_id,\n name: t.name,\n color: getEntityColor(t.external_id, 'medium'),\n kind: t.kind,\n }))\n .sort((a, b) => a.name.localeCompare(b.name)),\n [tags]\n )\n const labels = useMemo(\n () =>\n wantLabels\n ? {\n options: labelOptions,\n onCreate: async (name: string) => {\n const created = await createTagAsync({\n name,\n tagType: { type: 'checkbox', options: [] },\n shared: true,\n })\n return created?.external_id\n },\n }\n : undefined,\n [wantLabels, labelOptions, createTagAsync]\n )\n\n const wantSources = needs.sources === true\n const renderSourcesEditor = useCallback(\n (props: DatabaseSourcesEditorProps) =>\n createElement(ConnectedSourcesEditor, { key: props.rowId, ...props }),\n []\n )\n\n return useMemo(\n () => ({\n members,\n documents: documentOptions,\n searchRows,\n labels,\n renderSourcesEditor: wantSources ? renderSourcesEditor : undefined,\n onOpenDocument: (documentId: string) => openDocument(documentId),\n }),\n [members, documentOptions, searchRows, labels, wantSources, renderSourcesEditor, openDocument]\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAKA,SAAS,eAAe,aAAa,eAAe;AACpD,SAAS,gBAAgB,0BAA0B;AACnD;AAAA,EACE;AAAA,OAMK;AACP,SAAS,4BAA4B;AACrC,SAAS,qBAAqB,cAAc,SAAS,qBAAqB;AAC1E,SAAS,cAAc,6BAA4C;AACnE,SAAS,8BAA8B;AAEvC,MAAM,WAAW;AAaV,SAAS,uBACd,WACA,QAAyB,CAAC,GACL;AACrB,QAAM,cAAc,oBAAoB,CAAC,UAAU,MAAM,WAAW;AACpE,QAAM,EAAE,MAAM,WAAW,IAAI,cAAc;AAC3C,QAAM,YAAY,YAAY,KAAK,CAAC,cAAc,UAAU,gBAAgB,WAAW;AACvF,QAAM,EAAE,MAAM,UAAU,IAAI,aAAa;AACzC,QAAM,EAAE,aAAa,IAAI,qBAAqB;AAC9C,QAAM,qBAAqB,sBAAsB;AAEjD,QAAM,UAAU;AAAA,IACd,OACG,WAAW,SAAS,CAAC,GAAG,IAAI,CAAC,QAAQ;AAAA,MACpC,IAAI,GAAG,KAAK;AAAA,MACZ,OAAO,mBAAmB,GAAG,IAAI;AAAA,MACjC,aAAa,GAAG,KAAK;AAAA,IACvB,EAAE;AAAA,IACJ,CAAC,WAAW,KAAK;AAAA,EACnB;AAEA,QAAM,kBAAkB;AAAA,IACtB,OACG,aAAa,CAAC,GAAG,IAAI,CAAC,OAAO;AAAA,MAC5B,IAAI,EAAE;AAAA,MACN,OAAO,EAAE,aAAa,EAAE;AAAA,IAC1B,EAAE;AAAA,IACJ,CAAC,SAAS;AAAA,EACZ;AAEA,QAAM,aAAa,QAAQ,MAAM;AAC/B,UAAM,YAAY,IAAI;AAAA,OACnB,aAAa,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAA+B,CAAC;AAAA,IACxE;AACA,WAAO,OAAO,YAAoB,MAA6C;AAC7E,YAAM,UAAU,UAAU,IAAI,UAAU,KAAK,CAAC;AAC9C,YAAM,OAAO,MAAM,mBAAmB,YAAY,CAAC;AACnD,aAAO,KAAK,IAAI,CAAC,SAAS,EAAE,IAAI,IAAI,IAAI,OAAO,SAAS,KAAK,OAAO,KAAK,SAAS,EAAE;AAAA,IACtF;AAAA,EACF,GAAG,CAAC,WAAW,kBAAkB,CAAC;AAGlC,QAAM,aAAa,MAAM,WAAW;AACpC,QAAM,EAAE,MAAM,KAAK,IAAI,QAAQ,QAAW,EAAE,SAAS,WAAW,CAAC;AACjE,QAAM,YAAY,aAAa;AAC/B,QAAM,iBAAiB,UAAU;AACjC,QAAM,eAAe;AAAA,IACnB,OACG,QAAQ,CAAC,GACP,IAAI,CAAC,OAAO;AAAA,MACX,IAAI,EAAE;AAAA,MACN,MAAM,EAAE;AAAA,MACR,OAAO,eAAe,EAAE,aAAa,QAAQ;AAAA,MAC7C,MAAM,EAAE;AAAA,IACV,EAAE,EACD,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;AAAA,IAChD,CAAC,IAAI;AAAA,EACP;AACA,QAAM,SAAS;AAAA,IACb,MACE,aACI;AAAA,MACE,SAAS;AAAA,MACT,UAAU,OAAO,SAAiB;AAChC,cAAM,UAAU,MAAM,eAAe;AAAA,UACnC;AAAA,UACA,SAAS,EAAE,MAAM,YAAY,SAAS,CAAC,EAAE;AAAA,UACzC,QAAQ;AAAA,QACV,CAAC;AACD,eAAO,SAAS;AAAA,MAClB;AAAA,IACF,IACA;AAAA,IACN,CAAC,YAAY,cAAc,cAAc;AAAA,EAC3C;AAEA,QAAM,cAAc,MAAM,YAAY;AACtC,QAAM,sBAAsB;AAAA,IAC1B,CAAC,UACC,cAAc,wBAAwB,EAAE,KAAK,MAAM,OAAO,GAAG,MAAM,CAAC;AAAA,IACtE,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,qBAAqB,cAAc,sBAAsB;AAAA,MACzD,gBAAgB,CAAC,eAAuB,aAAa,UAAU;AAAA,IACjE;AAAA,IACA,CAAC,SAAS,iBAAiB,YAAY,QAAQ,aAAa,qBAAqB,YAAY;AAAA,EAC/F;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two wire types the kit shows under its own names: a `tag` column is the kit's `label`, and a
|
|
3
|
+
* `source` column is its `source`. The mapping lives here, between the API's columns and the
|
|
4
|
+
* blocks' (and nowhere else), until the generated client schema carries the types.
|
|
5
|
+
*/
|
|
6
|
+
import { type DatabaseColumnType } from '../../databases';
|
|
7
|
+
/** The kit's name for a wire type; `undefined` for a type the kit does not know (shown read-only). */
|
|
8
|
+
export declare function kitTypeOf(wireType: string): DatabaseColumnType | undefined;
|
|
9
|
+
/** The wire type of a column the person adds. */
|
|
10
|
+
export declare function wireTypeFor(type: DatabaseColumnType): string;
|
|
11
|
+
/**
|
|
12
|
+
* The types the column picker offers, from what the deployment lists. Without `tag` and `source`
|
|
13
|
+
* it is the original ten (a "Sources" column is then a `document` column). With `source`, a new
|
|
14
|
+
* Sources column holds cited passages too, so it replaces the plain document column in the list
|
|
15
|
+
* (existing document columns keep working); with `tag` the picker adds Labels.
|
|
16
|
+
*/
|
|
17
|
+
export declare function offeredColumnTypes(supported: readonly string[]): DatabaseColumnType[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { DATABASE_COLUMN_TYPES } from "../../databases/index.js";
|
|
3
|
+
function kitTypeOf(wireType) {
|
|
4
|
+
if (wireType === "tag") return "label";
|
|
5
|
+
if (wireType === "source") return "source";
|
|
6
|
+
return DATABASE_COLUMN_TYPES.includes(wireType) ? wireType : void 0;
|
|
7
|
+
}
|
|
8
|
+
function wireTypeFor(type) {
|
|
9
|
+
return type === "label" ? "tag" : type;
|
|
10
|
+
}
|
|
11
|
+
function offeredColumnTypes(supported) {
|
|
12
|
+
const types = DATABASE_COLUMN_TYPES.map(
|
|
13
|
+
(t) => t === "document" && supported.includes("source") ? "source" : t
|
|
14
|
+
);
|
|
15
|
+
return supported.includes("tag") ? [...types, "label"] : types;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
kitTypeOf,
|
|
19
|
+
offeredColumnTypes,
|
|
20
|
+
wireTypeFor
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=wireColumns.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/connection/databases/wireColumns.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The two wire types the kit shows under its own names: a `tag` column is the kit's `label`, and a\n * `source` column is its `source`. The mapping lives here, between the API's columns and the\n * blocks' (and nowhere else), until the generated client schema carries the types.\n */\nimport { DATABASE_COLUMN_TYPES, type DatabaseColumnType } from '../../databases'\n\n/** The kit's name for a wire type; `undefined` for a type the kit does not know (shown read-only). */\nexport function kitTypeOf(wireType: string): DatabaseColumnType | undefined {\n if (wireType === 'tag') return 'label'\n if (wireType === 'source') return 'source'\n return (DATABASE_COLUMN_TYPES as readonly string[]).includes(wireType)\n ? (wireType as DatabaseColumnType)\n : undefined\n}\n\n/** The wire type of a column the person adds. */\nexport function wireTypeFor(type: DatabaseColumnType): string {\n return type === 'label' ? 'tag' : type\n}\n\n/**\n * The types the column picker offers, from what the deployment lists. Without `tag` and `source`\n * it is the original ten (a \"Sources\" column is then a `document` column). With `source`, a new\n * Sources column holds cited passages too, so it replaces the plain document column in the list\n * (existing document columns keep working); with `tag` the picker adds Labels.\n */\nexport function offeredColumnTypes(supported: readonly string[]): DatabaseColumnType[] {\n const types = DATABASE_COLUMN_TYPES.map((t) =>\n t === 'document' && supported.includes('source') ? ('source' as const) : t\n )\n return supported.includes('tag') ? [...types, 'label'] : types\n}\n"],
|
|
5
|
+
"mappings": ";AAKA,SAAS,6BAAsD;AAGxD,SAAS,UAAU,UAAkD;AAC1E,MAAI,aAAa,MAAO,QAAO;AAC/B,MAAI,aAAa,SAAU,QAAO;AAClC,SAAQ,sBAA4C,SAAS,QAAQ,IAChE,WACD;AACN;AAGO,SAAS,YAAY,MAAkC;AAC5D,SAAO,SAAS,UAAU,QAAQ;AACpC;AAQO,SAAS,mBAAmB,WAAoD;AACrF,QAAM,QAAQ,sBAAsB;AAAA,IAAI,CAAC,MACvC,MAAM,cAAc,UAAU,SAAS,QAAQ,IAAK,WAAqB;AAAA,EAC3E;AACA,SAAO,UAAU,SAAS,KAAK,IAAI,CAAC,GAAG,OAAO,OAAO,IAAI;AAC3D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { getDocumentTitle, isImageDocument } from "@arbidocs/react/ui";
|
|
3
|
+
function documentPickerGroups(documents) {
|
|
4
|
+
return [
|
|
5
|
+
{
|
|
6
|
+
id: "all",
|
|
7
|
+
heading: "In this workspace",
|
|
8
|
+
docs: documents.filter((d) => !d.parent_ext_id).map((d) => ({
|
|
9
|
+
id: d.external_id,
|
|
10
|
+
title: getDocumentTitle(d, d.file_name ?? void 0),
|
|
11
|
+
fileName: d.file_name,
|
|
12
|
+
pages: isImageDocument(d) ? null : d.n_pages ?? null,
|
|
13
|
+
tokens: isImageDocument(d) ? null : d.tokens ?? null
|
|
14
|
+
})).sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase()))
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
documentPickerGroups
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=documentPickerGroups.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/connection/facts/documentPickerGroups.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The document picker's choices for citing sources: the workspace's documents (extracted child\n * documents are reached through their parent, so a document is never listed twice).\n */\nimport { getDocumentTitle, isImageDocument } from '@arbidocs/react/ui'\nimport type { PickerGroup } from '../../settings/DocumentPicker'\nimport type { ConnectedDocument } from '../workspaceData'\n\nexport function documentPickerGroups(documents: readonly ConnectedDocument[]): PickerGroup[] {\n return [\n {\n id: 'all',\n heading: 'In this workspace',\n docs: documents\n .filter((d) => !d.parent_ext_id)\n .map((d) => ({\n id: d.external_id,\n title: getDocumentTitle(d, d.file_name ?? undefined),\n fileName: d.file_name,\n pages: isImageDocument(d) ? null : (d.n_pages ?? null),\n tokens: isImageDocument(d) ? null : (d.tokens ?? null),\n }))\n .sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase())),\n },\n ]\n}\n"],
|
|
5
|
+
"mappings": ";AAIA,SAAS,kBAAkB,uBAAuB;AAI3C,SAAS,qBAAqB,WAAwD;AAC3F,SAAO;AAAA,IACL;AAAA,MACE,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,MAAM,UACH,OAAO,CAAC,MAAM,CAAC,EAAE,aAAa,EAC9B,IAAI,CAAC,OAAO;AAAA,QACX,IAAI,EAAE;AAAA,QACN,OAAO,iBAAiB,GAAG,EAAE,aAAa,MAAS;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ,OAAO,gBAAgB,CAAC,IAAI,OAAQ,EAAE,WAAW;AAAA,QACjD,QAAQ,gBAAgB,CAAC,IAAI,OAAQ,EAAE,UAAU;AAAA,MACnD,EAAE,EACD,KAAK,CAAC,GAAG,MAAM,EAAE,MAAM,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC,CAAC;AAAA,IAC9E;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
getEntityColor,
|
|
24
24
|
getEntityLabel,
|
|
25
25
|
getUserDisplayName,
|
|
26
|
-
isImageDocument,
|
|
27
26
|
markdownToPlainText
|
|
28
27
|
} from "@arbidocs/react/ui";
|
|
29
28
|
import { refusalReason } from "@arbidocs/sdk/browser";
|
|
@@ -53,6 +52,7 @@ import { ConnectedExportDialog } from "../export/ConnectedExportDialog.js";
|
|
|
53
52
|
import { ConnectedFieldsManagerPanel } from "../files/fields/ConnectedFieldsManagerPanel.js";
|
|
54
53
|
import { openFieldsManagerIn } from "../files/fields/fields-manager-panel.js";
|
|
55
54
|
import { useConnectedDocuments } from "../workspaceData.js";
|
|
55
|
+
import { documentPickerGroups } from "./documentPickerGroups.js";
|
|
56
56
|
import { ConnectedFactsSmartSearch } from "./ConnectedFactsSmartSearch.js";
|
|
57
57
|
import { FactMarkdownEditor } from "./FactMarkdownEditor.js";
|
|
58
58
|
import {
|
|
@@ -1119,22 +1119,7 @@ function FactsRowPage({
|
|
|
1119
1119
|
documents.filter((d) => wanted.has(d.external_id)).map((d) => [d.external_id, d])
|
|
1120
1120
|
);
|
|
1121
1121
|
}, [composer.draftCitations, documents]);
|
|
1122
|
-
const pickerGroups = useMemo(
|
|
1123
|
-
() => [
|
|
1124
|
-
{
|
|
1125
|
-
id: "all",
|
|
1126
|
-
heading: "In this workspace",
|
|
1127
|
-
docs: documents.filter((d) => !d.parent_ext_id).map((d) => ({
|
|
1128
|
-
id: d.external_id,
|
|
1129
|
-
title: getDocumentTitle(d, d.file_name ?? void 0),
|
|
1130
|
-
fileName: d.file_name,
|
|
1131
|
-
pages: isImageDocument(d) ? null : d.n_pages ?? null,
|
|
1132
|
-
tokens: isImageDocument(d) ? null : d.tokens ?? null
|
|
1133
|
-
})).sort((a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase()))
|
|
1134
|
-
}
|
|
1135
|
-
],
|
|
1136
|
-
[documents]
|
|
1137
|
-
);
|
|
1122
|
+
const pickerGroups = useMemo(() => documentPickerGroups(documents), [documents]);
|
|
1138
1123
|
if (!composer.composing) return null;
|
|
1139
1124
|
const fact = composer.editingId ? byId.get(composer.editingId) : void 0;
|
|
1140
1125
|
if (fact) shown.current = { session: composer.composerSession, row: rowOf(fact) };
|