@arbidocs/blocks 0.4.86 → 0.4.88
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/activity/NotificationRelevanceControls.d.ts +47 -0
- package/dist/activity/WorkspaceActivityList.d.ts +34 -0
- package/dist/activity/index.d.ts +3 -0
- package/dist/activity/workspace-activity.d.ts +46 -0
- package/dist/agents/index.cjs +290 -286
- package/dist/agents/index.js +5 -5
- package/dist/agents/tasks/TaskActivityTimeline.d.ts +5 -0
- package/dist/agents/tasks/index.d.ts +1 -1
- package/dist/{chunk-2EI7NCUA.cjs → chunk-2CFW2ELM.cjs} +8 -2
- package/dist/chunk-2CFW2ELM.cjs.map +1 -0
- package/dist/{chunk-7YUFMNFW.cjs → chunk-2ZDFVRGV.cjs} +5 -13
- package/dist/chunk-2ZDFVRGV.cjs.map +1 -0
- package/dist/{chunk-RZUMQM7W.cjs → chunk-5XZU64E2.cjs} +190 -2
- package/dist/chunk-5XZU64E2.cjs.map +1 -0
- package/dist/{chunk-R26OHONI.js → chunk-6S5FLMWG.js} +83 -72
- package/dist/chunk-6S5FLMWG.js.map +1 -0
- package/dist/chunk-6XS5IJ5R.cjs +43 -0
- package/dist/chunk-6XS5IJ5R.cjs.map +1 -0
- package/dist/chunk-BX62HJZU.js +41 -0
- package/dist/chunk-BX62HJZU.js.map +1 -0
- package/dist/{chunk-IHYVK6F7.cjs → chunk-FNEL2BYV.cjs} +49 -235
- package/dist/chunk-FNEL2BYV.cjs.map +1 -0
- package/dist/{chunk-AFSOUS5X.cjs → chunk-N26CXGXC.cjs} +83 -72
- package/dist/chunk-N26CXGXC.cjs.map +1 -0
- package/dist/{chunk-X23U6QEJ.js → chunk-NXWKMKZY.js} +581 -217
- package/dist/chunk-NXWKMKZY.js.map +1 -0
- package/dist/{chunk-WRSBM6QN.cjs → chunk-UCAYNE44.cjs} +587 -214
- package/dist/chunk-UCAYNE44.cjs.map +1 -0
- package/dist/{chunk-A24C6BNA.js → chunk-UDLMLU6T.js} +3 -3
- package/dist/{chunk-A24C6BNA.js.map → chunk-UDLMLU6T.js.map} +1 -1
- package/dist/{chunk-S2NFD4QV.js → chunk-UZV27QLC.js} +8 -192
- package/dist/chunk-UZV27QLC.js.map +1 -0
- package/dist/{chunk-OPA2Y6YZ.js → chunk-W2R7YVFM.js} +5 -13
- package/dist/chunk-W2R7YVFM.js.map +1 -0
- package/dist/{chunk-TZR36PPP.cjs → chunk-YFPIJUV3.cjs} +5 -5
- package/dist/{chunk-TZR36PPP.cjs.map → chunk-YFPIJUV3.cjs.map} +1 -1
- package/dist/{chunk-KHY4PYU7.js → chunk-YX466FWL.js} +189 -4
- package/dist/chunk-YX466FWL.js.map +1 -0
- package/dist/{chunk-YU2KUMGE.js → chunk-ZX2VPMBJ.js} +8 -2
- package/dist/chunk-ZX2VPMBJ.js.map +1 -0
- package/dist/connect/docx.cjs +6 -6
- package/dist/connect/docx.js +4 -4
- package/dist/connect/index.cjs +118 -26
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +2 -0
- package/dist/connect/index.js +98 -9
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/ConnectedNotificationRelevance.d.ts +16 -0
- package/dist/connection/ConnectedWorkspaceActivity.d.ts +11 -0
- package/dist/docx/NativeDocxEditor.d.ts +4 -2
- package/dist/docx/StreamedWordArtifact.d.ts +9 -6
- package/dist/docx/index.cjs +15 -15
- package/dist/docx/index.js +3 -3
- package/dist/facts/index.cjs +6 -6
- package/dist/facts/index.js +3 -3
- package/dist/files/index.cjs +3 -22
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.js +3 -21
- package/dist/files/index.js.map +1 -1
- package/dist/files/views/TagFormParts.d.ts +0 -8
- package/dist/files/views/index.d.ts +1 -1
- package/dist/home/index.cjs +1 -1
- package/dist/home/index.js +1 -1
- package/dist/index.cjs +563 -431
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +113 -22
- package/dist/index.js.map +1 -1
- package/dist/settings/index.cjs +3 -3
- package/dist/settings/index.js +1 -1
- package/dist/shell/FilterInput.d.ts +3 -1
- package/dist/shell/index.cjs +5 -5
- package/dist/shell/index.js +2 -2
- package/dist/studio/index.cjs +1 -1
- package/dist/studio/index.js +1 -1
- package/dist/tags/TagDetail.d.ts +14 -2
- package/dist/tags/TagTable.d.ts +20 -11
- package/dist/tags/TagsNav.d.ts +28 -4
- package/dist/tags/index.d.ts +1 -1
- package/dist/tags/tagTableModel.d.ts +10 -2
- package/dist/workflow-canvas/index.cjs +48 -48
- package/dist/workflow-canvas/index.js +5 -5
- package/package.json +4 -4
- package/dist/chunk-2EI7NCUA.cjs.map +0 -1
- package/dist/chunk-7YUFMNFW.cjs.map +0 -1
- package/dist/chunk-AFSOUS5X.cjs.map +0 -1
- package/dist/chunk-AINNADMT.cjs +0 -62
- package/dist/chunk-AINNADMT.cjs.map +0 -1
- package/dist/chunk-FT5FFXSJ.js +0 -60
- package/dist/chunk-FT5FFXSJ.js.map +0 -1
- package/dist/chunk-IHYVK6F7.cjs.map +0 -1
- package/dist/chunk-KHY4PYU7.js.map +0 -1
- package/dist/chunk-OPA2Y6YZ.js.map +0 -1
- package/dist/chunk-R26OHONI.js.map +0 -1
- package/dist/chunk-RZUMQM7W.cjs.map +0 -1
- package/dist/chunk-S2NFD4QV.js.map +0 -1
- package/dist/chunk-WRSBM6QN.cjs.map +0 -1
- package/dist/chunk-X23U6QEJ.js.map +0 -1
- package/dist/chunk-YU2KUMGE.js.map +0 -1
|
@@ -1,10 +1,290 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { taskActivityHeadline, DEFAULT_TASK_ACTIVITY_LABELS } from './chunk-YX466FWL.js';
|
|
3
|
+
import { BellOff, BellRing, Bell, Activity, ArrowUp, ArrowDown, X, Plus, Loader2, ArrowUpRight, ChevronDown, SlidersHorizontal, Download, FileDown, Workflow, FileText, MessageSquare, Lightbulb, MessagesSquare } from 'lucide-react';
|
|
4
|
+
import { cn, Button, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuItem, Input, Checkbox } from '@arbidocs/react/ui';
|
|
5
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
6
|
import { useState, useEffect, useMemo } from 'react';
|
|
3
|
-
import { ArrowUp, ArrowDown, X, Plus, Loader2, SlidersHorizontal, Download, FileDown, AlertTriangle, FileText, Lightbulb, MessagesSquare } from 'lucide-react';
|
|
4
|
-
import { Input, cn, Button, Checkbox } from '@arbidocs/react/ui';
|
|
5
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
7
|
import { zipSync, strToU8 } from 'fflate';
|
|
7
8
|
|
|
9
|
+
// src/activity/workspace-activity.ts
|
|
10
|
+
function workspaceActivityTarget(item) {
|
|
11
|
+
switch (item.source) {
|
|
12
|
+
case "thread":
|
|
13
|
+
case "message":
|
|
14
|
+
return item.conversation_ext_id ? {
|
|
15
|
+
kind: "thread",
|
|
16
|
+
conversationId: item.conversation_ext_id,
|
|
17
|
+
...item.message_ext_id ? { messageId: item.message_ext_id } : {}
|
|
18
|
+
} : null;
|
|
19
|
+
case "document":
|
|
20
|
+
if (!item.document_ext_id) return null;
|
|
21
|
+
return item.kind !== "document_uploaded" && item.version ? { kind: "document", documentId: item.document_ext_id, version: item.version } : { kind: "document", documentId: item.document_ext_id };
|
|
22
|
+
case "workflow":
|
|
23
|
+
return item.workflow_ext_id ? {
|
|
24
|
+
kind: "workflow",
|
|
25
|
+
workflowId: item.workflow_ext_id,
|
|
26
|
+
...item.conversation_ext_id ? { conversationId: item.conversation_ext_id } : {}
|
|
27
|
+
} : null;
|
|
28
|
+
default:
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
var quoted = (name, fallback) => name ? `\u201C${name}\u201D` : fallback;
|
|
33
|
+
function workspaceActivityHeadline(item) {
|
|
34
|
+
const thread = quoted(item.conversation_title, "a thread");
|
|
35
|
+
const document = quoted(item.document_name, "a document");
|
|
36
|
+
switch (item.kind) {
|
|
37
|
+
case "message_posted":
|
|
38
|
+
return `Posted in ${thread}`;
|
|
39
|
+
case "document_uploaded":
|
|
40
|
+
return `Uploaded ${document}`;
|
|
41
|
+
case "document_version":
|
|
42
|
+
return item.version ? `Saved version ${item.version} of ${document}` : `Saved a new version of ${document}`;
|
|
43
|
+
case "document_signed":
|
|
44
|
+
return `Signed ${document}`;
|
|
45
|
+
case "workflow_run": {
|
|
46
|
+
const run2 = `Ran ${quoted(item.workflow_name, "a workflow")}`;
|
|
47
|
+
return item.status ? `${run2} (${item.status.replace(/_/g, " ")})` : run2;
|
|
48
|
+
}
|
|
49
|
+
default: {
|
|
50
|
+
const headline = taskActivityHeadline(
|
|
51
|
+
{ kind: item.kind, detail: item.detail },
|
|
52
|
+
DEFAULT_TASK_ACTIVITY_LABELS
|
|
53
|
+
);
|
|
54
|
+
return `${headline} in ${thread}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
var DEFAULT_WORKSPACE_ACTIVITY_LABELS = {
|
|
59
|
+
empty: "Nothing has happened in this workspace yet.",
|
|
60
|
+
loading: "Loading activity\u2026",
|
|
61
|
+
error: "Could not load the activity.",
|
|
62
|
+
loadMore: "Show older",
|
|
63
|
+
loadingMore: "Loading\u2026",
|
|
64
|
+
retry: "Retry",
|
|
65
|
+
system: "ARBI"
|
|
66
|
+
};
|
|
67
|
+
var ICONS = {
|
|
68
|
+
thread: /* @__PURE__ */ jsx(Activity, { className: "size-4", "aria-hidden": true }),
|
|
69
|
+
message: /* @__PURE__ */ jsx(MessageSquare, { className: "size-4", "aria-hidden": true }),
|
|
70
|
+
document: /* @__PURE__ */ jsx(FileText, { className: "size-4", "aria-hidden": true }),
|
|
71
|
+
workflow: /* @__PURE__ */ jsx(Workflow, { className: "size-4", "aria-hidden": true })
|
|
72
|
+
};
|
|
73
|
+
var localTime = (iso) => new Date(iso).toLocaleString();
|
|
74
|
+
function WorkspaceActivityList({
|
|
75
|
+
items,
|
|
76
|
+
isLoading,
|
|
77
|
+
isError,
|
|
78
|
+
hasMore,
|
|
79
|
+
isLoadingMore,
|
|
80
|
+
onLoadMore,
|
|
81
|
+
onRetry,
|
|
82
|
+
onOpen,
|
|
83
|
+
nameOf,
|
|
84
|
+
formatTime = localTime,
|
|
85
|
+
labels,
|
|
86
|
+
className,
|
|
87
|
+
testId = "workspace-activity"
|
|
88
|
+
}) {
|
|
89
|
+
const l = { ...DEFAULT_WORKSPACE_ACTIVITY_LABELS, ...labels };
|
|
90
|
+
if (isLoading)
|
|
91
|
+
return /* @__PURE__ */ jsx("p", { className: cn("p-3 text-sm text-muted-foreground", className), "data-testid": testId, children: l.loading });
|
|
92
|
+
if (isError && items.length === 0)
|
|
93
|
+
return /* @__PURE__ */ jsxs(
|
|
94
|
+
"div",
|
|
95
|
+
{
|
|
96
|
+
className: cn("flex items-center gap-2 p-3 text-sm text-muted-foreground", className),
|
|
97
|
+
"data-testid": testId,
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ jsx("span", { role: "alert", children: l.error }),
|
|
100
|
+
onRetry && /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: onRetry, children: l.retry })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
if (items.length === 0)
|
|
105
|
+
return /* @__PURE__ */ jsx("p", { className: cn("p-3 text-sm text-muted-foreground", className), "data-testid": testId, children: l.empty });
|
|
106
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col", className), "data-testid": testId, children: [
|
|
107
|
+
/* @__PURE__ */ jsx("ul", { className: "divide-y divide-border", "data-testid": `${testId}-list`, children: items.map((item) => {
|
|
108
|
+
const target = workspaceActivityTarget(item);
|
|
109
|
+
const actor = item.actor_ext_id ? nameOf?.(item.actor_ext_id) ?? null : l.system;
|
|
110
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
111
|
+
/* @__PURE__ */ jsx("span", { className: "mt-0.5 shrink-0 text-muted-foreground", children: ICONS[item.source] }),
|
|
112
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0 flex-1 text-sm", children: [
|
|
113
|
+
actor && /* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
114
|
+
actor,
|
|
115
|
+
" "
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: workspaceActivityHeadline(item) })
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
"time",
|
|
121
|
+
{
|
|
122
|
+
dateTime: item.created_at,
|
|
123
|
+
className: "shrink-0 text-xs tabular-nums text-muted-foreground",
|
|
124
|
+
children: formatTime(item.created_at)
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
] });
|
|
128
|
+
return /* @__PURE__ */ jsx(
|
|
129
|
+
"li",
|
|
130
|
+
{
|
|
131
|
+
"data-testid": `${testId}-item-${item.external_id}`,
|
|
132
|
+
"data-kind": item.kind,
|
|
133
|
+
children: target && onOpen ? /* @__PURE__ */ jsx(
|
|
134
|
+
"button",
|
|
135
|
+
{
|
|
136
|
+
type: "button",
|
|
137
|
+
className: "flex w-full items-start gap-3 px-3 py-2 text-left hover:bg-accent focus-visible:bg-accent focus-visible:outline-none",
|
|
138
|
+
onClick: () => onOpen(target, item),
|
|
139
|
+
children: body
|
|
140
|
+
}
|
|
141
|
+
) : /* @__PURE__ */ jsx("div", { className: "flex items-start gap-3 px-3 py-2", children: body })
|
|
142
|
+
},
|
|
143
|
+
item.external_id
|
|
144
|
+
);
|
|
145
|
+
}) }),
|
|
146
|
+
hasMore && onLoadMore && /* @__PURE__ */ jsx("div", { className: "flex justify-center p-2", children: /* @__PURE__ */ jsx(
|
|
147
|
+
Button,
|
|
148
|
+
{
|
|
149
|
+
size: "sm",
|
|
150
|
+
variant: "ghost",
|
|
151
|
+
disabled: isLoadingMore,
|
|
152
|
+
onClick: onLoadMore,
|
|
153
|
+
"data-testid": `${testId}-load-more`,
|
|
154
|
+
children: isLoadingMore ? l.loadingMore : l.loadMore
|
|
155
|
+
}
|
|
156
|
+
) })
|
|
157
|
+
] });
|
|
158
|
+
}
|
|
159
|
+
var DEFAULT_WORKSPACE_NOTIFICATION_MENU_LABELS = {
|
|
160
|
+
trigger: "Workspace notifications",
|
|
161
|
+
heading: "Notify me about",
|
|
162
|
+
default: "What involves me",
|
|
163
|
+
defaultHint: "Mentions, assignments and replies to my threads",
|
|
164
|
+
following: "Everything",
|
|
165
|
+
followingHint: "Follow every thread, upload and run",
|
|
166
|
+
muted: "Nothing",
|
|
167
|
+
mutedHint: "Mute the workspace, mentions included",
|
|
168
|
+
activity: "Workspace activity"
|
|
169
|
+
};
|
|
170
|
+
var LEVEL_ICON = { default: Bell, following: BellRing, muted: BellOff };
|
|
171
|
+
function WorkspaceNotificationMenu({
|
|
172
|
+
level,
|
|
173
|
+
onLevelChange,
|
|
174
|
+
disabled,
|
|
175
|
+
onOpenActivity,
|
|
176
|
+
labels,
|
|
177
|
+
className,
|
|
178
|
+
testId = "workspace-notification-menu"
|
|
179
|
+
}) {
|
|
180
|
+
const l = { ...DEFAULT_WORKSPACE_NOTIFICATION_MENU_LABELS, ...labels };
|
|
181
|
+
const Icon = LEVEL_ICON[level];
|
|
182
|
+
const options = [
|
|
183
|
+
{ value: "default", title: l.default, hint: l.defaultHint },
|
|
184
|
+
{ value: "following", title: l.following, hint: l.followingHint },
|
|
185
|
+
{ value: "muted", title: l.muted, hint: l.mutedHint }
|
|
186
|
+
];
|
|
187
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
188
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
189
|
+
Button,
|
|
190
|
+
{
|
|
191
|
+
size: "icon",
|
|
192
|
+
variant: "ghost",
|
|
193
|
+
className: cn("size-7 shrink-0 pointer-coarse:size-11", className),
|
|
194
|
+
"aria-label": l.trigger,
|
|
195
|
+
title: l.trigger,
|
|
196
|
+
"data-testid": testId,
|
|
197
|
+
"data-level": level,
|
|
198
|
+
children: /* @__PURE__ */ jsx(Icon, { className: cn("size-4", level === "muted" && "text-muted-foreground") })
|
|
199
|
+
}
|
|
200
|
+
) }),
|
|
201
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", className: "w-72", children: [
|
|
202
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: l.heading }),
|
|
203
|
+
/* @__PURE__ */ jsx(
|
|
204
|
+
DropdownMenuRadioGroup,
|
|
205
|
+
{
|
|
206
|
+
value: level,
|
|
207
|
+
onValueChange: (value) => {
|
|
208
|
+
if (value !== level) onLevelChange(value);
|
|
209
|
+
},
|
|
210
|
+
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
211
|
+
DropdownMenuRadioItem,
|
|
212
|
+
{
|
|
213
|
+
value: option.value,
|
|
214
|
+
disabled,
|
|
215
|
+
"data-testid": `${testId}-${option.value}`,
|
|
216
|
+
children: /* @__PURE__ */ jsxs("span", { className: "flex flex-col", children: [
|
|
217
|
+
/* @__PURE__ */ jsx("span", { children: option.title }),
|
|
218
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: option.hint })
|
|
219
|
+
] })
|
|
220
|
+
},
|
|
221
|
+
option.value
|
|
222
|
+
))
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
onOpenActivity && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
226
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
227
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onSelect: onOpenActivity, "data-testid": `${testId}-activity`, children: [
|
|
228
|
+
/* @__PURE__ */ jsx(Activity, { className: "mr-2 size-4", "aria-hidden": true }),
|
|
229
|
+
l.activity
|
|
230
|
+
] })
|
|
231
|
+
] })
|
|
232
|
+
] })
|
|
233
|
+
] });
|
|
234
|
+
}
|
|
235
|
+
var DEFAULT_THREAD_FOLLOW_LABELS = {
|
|
236
|
+
follow: "Follow thread",
|
|
237
|
+
unfollow: "Unfollow thread"
|
|
238
|
+
};
|
|
239
|
+
function ThreadFollowMenuItem({
|
|
240
|
+
following,
|
|
241
|
+
onFollowingChange,
|
|
242
|
+
disabled,
|
|
243
|
+
labels,
|
|
244
|
+
testId = "thread-follow-item"
|
|
245
|
+
}) {
|
|
246
|
+
const l = { ...DEFAULT_THREAD_FOLLOW_LABELS, ...labels };
|
|
247
|
+
const Icon = following ? BellOff : BellRing;
|
|
248
|
+
return /* @__PURE__ */ jsxs(
|
|
249
|
+
DropdownMenuItem,
|
|
250
|
+
{
|
|
251
|
+
disabled,
|
|
252
|
+
onSelect: () => onFollowingChange(!following),
|
|
253
|
+
"data-testid": testId,
|
|
254
|
+
"data-following": following,
|
|
255
|
+
children: [
|
|
256
|
+
/* @__PURE__ */ jsx(Icon, { className: "mr-2 size-4", "aria-hidden": true }),
|
|
257
|
+
following ? l.unfollow : l.follow
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
function ThreadFollowButton({
|
|
263
|
+
following,
|
|
264
|
+
onFollowingChange,
|
|
265
|
+
disabled,
|
|
266
|
+
labels,
|
|
267
|
+
testId = "thread-follow-button"
|
|
268
|
+
}) {
|
|
269
|
+
const l = { ...DEFAULT_THREAD_FOLLOW_LABELS, ...labels };
|
|
270
|
+
const label = following ? l.unfollow : l.follow;
|
|
271
|
+
return /* @__PURE__ */ jsx(
|
|
272
|
+
Button,
|
|
273
|
+
{
|
|
274
|
+
size: "icon",
|
|
275
|
+
variant: "ghost",
|
|
276
|
+
className: "size-8 shrink-0",
|
|
277
|
+
"aria-label": label,
|
|
278
|
+
"aria-pressed": following,
|
|
279
|
+
title: label,
|
|
280
|
+
disabled,
|
|
281
|
+
onClick: () => onFollowingChange(!following),
|
|
282
|
+
"data-testid": testId,
|
|
283
|
+
children: following ? /* @__PURE__ */ jsx(BellRing, { className: "size-4 text-primary" }) : /* @__PURE__ */ jsx(Bell, { className: "size-4" })
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
|
|
8
288
|
// src/tags/tagTableModel.ts
|
|
9
289
|
var NO_LINKS = {
|
|
10
290
|
docs: [],
|
|
@@ -20,10 +300,16 @@ var isGap = (row) => {
|
|
|
20
300
|
const l = rowLinks(row);
|
|
21
301
|
return l.doc_count + l.fact_count + l.thread_count === 0;
|
|
22
302
|
};
|
|
303
|
+
function linkedTagIds(value) {
|
|
304
|
+
if (typeof value === "string") return value ? [value] : [];
|
|
305
|
+
return Array.isArray(value) ? value.filter((id) => typeof id === "string") : [];
|
|
306
|
+
}
|
|
23
307
|
function cellText(value, column, nameOf) {
|
|
24
308
|
if (value === void 0 || value === null || value === "") return "";
|
|
25
309
|
if (column.type === "checkbox") return value ? "Yes" : "No";
|
|
26
310
|
if (column.type === "person" && typeof value === "string") return nameOf?.(value) ?? value;
|
|
311
|
+
if (column.type === "tag")
|
|
312
|
+
return linkedTagIds(value).map((id) => nameOf?.(id) ?? id).join(", ");
|
|
27
313
|
if (Array.isArray(value)) return value.map(String).join(", ");
|
|
28
314
|
return String(value);
|
|
29
315
|
}
|
|
@@ -94,7 +380,8 @@ var DEFAULT_TAG_COLUMNS_EDITOR_LABELS = {
|
|
|
94
380
|
document: "Document",
|
|
95
381
|
relation: "Relation",
|
|
96
382
|
lookup: "Lookup",
|
|
97
|
-
rollup: "Rollup"
|
|
383
|
+
rollup: "Rollup",
|
|
384
|
+
tag: "Link to tags"
|
|
98
385
|
}
|
|
99
386
|
};
|
|
100
387
|
var TYPES = ["text", "number", "date", "checkbox", "select", "person"];
|
|
@@ -108,7 +395,7 @@ var toWrite = (d) => ({
|
|
|
108
395
|
...d.id ? { id: d.id } : {},
|
|
109
396
|
name: d.name.trim(),
|
|
110
397
|
type: d.type,
|
|
111
|
-
options: d.type === "select" ? d.options.split(",").map((o) => o.trim()).filter(Boolean) : null
|
|
398
|
+
options: d.type === "tag" ? d.options.split(",").map((o) => o.trim()).filter(Boolean) : d.type === "select" ? d.options.split(",").map((o) => o.trim()).filter(Boolean) : null
|
|
112
399
|
});
|
|
113
400
|
function TagColumnsEditor({
|
|
114
401
|
columns,
|
|
@@ -271,7 +558,7 @@ function TagColumnsEditor({
|
|
|
271
558
|
}
|
|
272
559
|
var DEFAULT_TAG_TABLE_LABELS = {
|
|
273
560
|
row: "Item",
|
|
274
|
-
evidence: "
|
|
561
|
+
evidence: "Tagged items",
|
|
275
562
|
documents: "{count} documents",
|
|
276
563
|
facts: "{count} facts",
|
|
277
564
|
threads: "{count} threads",
|
|
@@ -280,9 +567,6 @@ var DEFAULT_TAG_TABLE_LABELS = {
|
|
|
280
567
|
thread: "1 thread",
|
|
281
568
|
untitledThread: "Untitled thread",
|
|
282
569
|
more: "+{count} more",
|
|
283
|
-
gap: "No evidence",
|
|
284
|
-
gapsOnly: "Show gaps only",
|
|
285
|
-
gapCount: "{count} without evidence",
|
|
286
570
|
addRow: "Add row",
|
|
287
571
|
addRowPlaceholder: "Name of the new row",
|
|
288
572
|
add: "Add",
|
|
@@ -296,25 +580,41 @@ var DEFAULT_TAG_TABLE_LABELS = {
|
|
|
296
580
|
yes: "Yes",
|
|
297
581
|
editColumns: "Columns"
|
|
298
582
|
};
|
|
299
|
-
var ROW_LABEL_WIDTH = "w-[
|
|
583
|
+
var ROW_LABEL_WIDTH = "w-[11rem]";
|
|
584
|
+
var EVIDENCE_WIDTH = "w-[14rem]";
|
|
300
585
|
var ROW_LABEL = "line-clamp-3 whitespace-normal break-words";
|
|
301
586
|
function TagTableCell({
|
|
302
587
|
row,
|
|
303
588
|
column,
|
|
304
589
|
people,
|
|
590
|
+
tags,
|
|
591
|
+
onOpenTag,
|
|
305
592
|
onChange,
|
|
306
593
|
l,
|
|
307
594
|
testId
|
|
308
595
|
}) {
|
|
309
596
|
const value = cellValue(row, column);
|
|
310
|
-
const nameOf = (id) => people?.find((p) => p.value === id)?.label;
|
|
597
|
+
const nameOf = (id) => (column.type === "tag" ? tags : people)?.find((p) => p.value === id)?.label;
|
|
311
598
|
const shown = cellText(value, column, nameOf);
|
|
312
599
|
const [draft, setDraft] = useState(shown);
|
|
313
600
|
useEffect(() => setDraft(cellText(value, column)), [value, column]);
|
|
314
601
|
const set = (next) => void onChange?.(row.external_id, column.id, next);
|
|
602
|
+
if (column.type === "tag")
|
|
603
|
+
return /* @__PURE__ */ jsx(
|
|
604
|
+
TagLinkCell,
|
|
605
|
+
{
|
|
606
|
+
row,
|
|
607
|
+
column,
|
|
608
|
+
tags,
|
|
609
|
+
onOpenTag,
|
|
610
|
+
onChange: onChange ? set : void 0,
|
|
611
|
+
l,
|
|
612
|
+
testId
|
|
613
|
+
}
|
|
614
|
+
);
|
|
315
615
|
if (!onChange)
|
|
316
616
|
return /* @__PURE__ */ jsx("span", { className: "block truncate", title: shown, "data-testid": testId, children: shown || /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: l.choose }) });
|
|
317
|
-
const field = "h-8 w-full min-w-
|
|
617
|
+
const field = "h-8 w-full min-w-0 rounded-md border border-transparent bg-transparent px-1.5 text-sm hover:border-input focus:border-input focus:bg-background focus:outline-none";
|
|
318
618
|
switch (column.type) {
|
|
319
619
|
case "checkbox":
|
|
320
620
|
return /* @__PURE__ */ jsx(
|
|
@@ -332,7 +632,7 @@ function TagTableCell({
|
|
|
332
632
|
return /* @__PURE__ */ jsxs(
|
|
333
633
|
"select",
|
|
334
634
|
{
|
|
335
|
-
className: cn(field, "
|
|
635
|
+
className: cn(field, "pr-6"),
|
|
336
636
|
value: typeof value === "string" ? value : "",
|
|
337
637
|
onChange: (e) => set(e.target.value || null),
|
|
338
638
|
"aria-label": `${row.name}: ${column.name}`,
|
|
@@ -352,7 +652,7 @@ function TagTableCell({
|
|
|
352
652
|
return /* @__PURE__ */ jsx(
|
|
353
653
|
"input",
|
|
354
654
|
{
|
|
355
|
-
className: cn(field, "
|
|
655
|
+
className: cn(field, "pr-6"),
|
|
356
656
|
type: column.type === "number" ? "number" : column.type === "date" ? "date" : "text",
|
|
357
657
|
value: column.type === "date" ? draft.slice(0, 10) : draft,
|
|
358
658
|
onChange: (e) => setDraft(e.target.value),
|
|
@@ -368,6 +668,95 @@ function TagTableCell({
|
|
|
368
668
|
}
|
|
369
669
|
}
|
|
370
670
|
}
|
|
671
|
+
function TagLinkCell({
|
|
672
|
+
row,
|
|
673
|
+
column,
|
|
674
|
+
tags,
|
|
675
|
+
onOpenTag,
|
|
676
|
+
onChange,
|
|
677
|
+
l,
|
|
678
|
+
testId
|
|
679
|
+
}) {
|
|
680
|
+
const ids = linkedTagIds(cellValue(row, column));
|
|
681
|
+
const kinds = column.options ?? [];
|
|
682
|
+
const options = (tags ?? []).filter(
|
|
683
|
+
(t) => t.value !== row.external_id && (kinds.length === 0 || kinds.includes(t.kind))
|
|
684
|
+
);
|
|
685
|
+
const label = (id) => tags?.find((t) => t.value === id)?.label ?? id;
|
|
686
|
+
const chips = ids.map(
|
|
687
|
+
(id) => onOpenTag ? /* @__PURE__ */ jsx(
|
|
688
|
+
"button",
|
|
689
|
+
{
|
|
690
|
+
type: "button",
|
|
691
|
+
onClick: () => onOpenTag(id),
|
|
692
|
+
className: "inline-flex min-w-0 max-w-full items-center truncate rounded-md border border-border px-1.5 py-0.5 text-xs hover:border-primary/40 hover:text-primary",
|
|
693
|
+
"data-testid": `${testId}-link-${id}`,
|
|
694
|
+
children: label(id)
|
|
695
|
+
},
|
|
696
|
+
id
|
|
697
|
+
) : /* @__PURE__ */ jsx(
|
|
698
|
+
"span",
|
|
699
|
+
{
|
|
700
|
+
className: "inline-flex min-w-0 max-w-full truncate rounded-md border border-border px-1.5 py-0.5 text-xs",
|
|
701
|
+
"data-testid": `${testId}-link-${id}`,
|
|
702
|
+
children: label(id)
|
|
703
|
+
},
|
|
704
|
+
id
|
|
705
|
+
)
|
|
706
|
+
);
|
|
707
|
+
if (!onChange)
|
|
708
|
+
return /* @__PURE__ */ jsx("span", { className: "flex min-w-0 flex-wrap gap-1", "data-testid": testId, children: chips.length ? chips : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: l.choose }) });
|
|
709
|
+
const current = ids[0];
|
|
710
|
+
return (
|
|
711
|
+
// Wraps: in a narrow column the name breaks between words and the picker moves below it.
|
|
712
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-wrap items-center gap-x-1 py-1", children: [
|
|
713
|
+
current && (onOpenTag ? /* @__PURE__ */ jsxs(
|
|
714
|
+
"button",
|
|
715
|
+
{
|
|
716
|
+
type: "button",
|
|
717
|
+
onClick: () => onOpenTag(current),
|
|
718
|
+
className: "max-w-full rounded px-1 text-left text-sm break-words hover:text-primary hover:underline focus-visible:ring-2 focus-visible:ring-ring",
|
|
719
|
+
"aria-label": `Open ${label(current)}`,
|
|
720
|
+
title: `Open ${label(current)}`,
|
|
721
|
+
"data-testid": `${testId}-open`,
|
|
722
|
+
children: [
|
|
723
|
+
label(current),
|
|
724
|
+
/* @__PURE__ */ jsx(ArrowUpRight, { className: "ml-0.5 inline size-3.5 align-[-2px] text-muted-foreground" })
|
|
725
|
+
]
|
|
726
|
+
}
|
|
727
|
+
) : /* @__PURE__ */ jsx("span", { className: "max-w-full px-1 text-sm break-words", children: label(current) })),
|
|
728
|
+
/* @__PURE__ */ jsxs(
|
|
729
|
+
"span",
|
|
730
|
+
{
|
|
731
|
+
className: cn(
|
|
732
|
+
"relative inline-flex h-6 shrink-0 items-center rounded text-muted-foreground hover:bg-muted hover:text-foreground focus-within:ring-2 focus-within:ring-ring",
|
|
733
|
+
current ? "w-6 justify-center" : "min-w-0 flex-1 gap-1 px-1 text-sm"
|
|
734
|
+
),
|
|
735
|
+
title: current ? `${column.name}: ${label(current)}` : void 0,
|
|
736
|
+
children: [
|
|
737
|
+
!current && /* @__PURE__ */ jsx("span", { className: "truncate", children: l.choose }),
|
|
738
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "size-3.5 shrink-0" }),
|
|
739
|
+
/* @__PURE__ */ jsxs(
|
|
740
|
+
"select",
|
|
741
|
+
{
|
|
742
|
+
className: "absolute inset-0 h-full w-full cursor-pointer opacity-0",
|
|
743
|
+
value: current ?? "",
|
|
744
|
+
onChange: (e) => onChange(e.target.value ? [e.target.value] : null),
|
|
745
|
+
"aria-label": `${row.name}: ${column.name}`,
|
|
746
|
+
"data-testid": testId,
|
|
747
|
+
children: [
|
|
748
|
+
/* @__PURE__ */ jsx("option", { value: "", children: l.choose }),
|
|
749
|
+
options.map((t) => /* @__PURE__ */ jsx("option", { value: t.value, children: t.label }, t.value)),
|
|
750
|
+
current && !options.some((t) => t.value === current) && /* @__PURE__ */ jsx("option", { value: current, children: label(current) })
|
|
751
|
+
]
|
|
752
|
+
}
|
|
753
|
+
)
|
|
754
|
+
]
|
|
755
|
+
}
|
|
756
|
+
)
|
|
757
|
+
] })
|
|
758
|
+
);
|
|
759
|
+
}
|
|
371
760
|
var countText = (count2, one, many) => count2 === 1 ? one : count2 ? many.replace("{count}", String(count2)) : null;
|
|
372
761
|
function Evidence({
|
|
373
762
|
row,
|
|
@@ -378,27 +767,15 @@ function Evidence({
|
|
|
378
767
|
onOpenRow,
|
|
379
768
|
testId
|
|
380
769
|
}) {
|
|
381
|
-
if (isGap(row))
|
|
382
|
-
return /* @__PURE__ */ jsxs(
|
|
383
|
-
"span",
|
|
384
|
-
{
|
|
385
|
-
className: "inline-flex items-center gap-1 rounded-full bg-amber-500/15 px-2 py-0.5 text-xs font-medium text-amber-700 dark:text-amber-300",
|
|
386
|
-
"data-testid": `${testId}-gap`,
|
|
387
|
-
children: [
|
|
388
|
-
/* @__PURE__ */ jsx(AlertTriangle, { className: "size-3" }),
|
|
389
|
-
" ",
|
|
390
|
-
l.gap
|
|
391
|
-
]
|
|
392
|
-
}
|
|
393
|
-
);
|
|
770
|
+
if (isGap(row)) return null;
|
|
394
771
|
const links = rowLinks(row);
|
|
395
772
|
const docs = links.docs ?? [];
|
|
396
773
|
const facts = links.facts ?? [];
|
|
397
774
|
const threads = links.threads ?? [];
|
|
398
775
|
const more = links.doc_count - docs.length + (links.fact_count - facts.length) + (links.thread_count - threads.length);
|
|
399
|
-
const chip = "inline-flex max-w-
|
|
400
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1", "data-testid": testId, children: [
|
|
401
|
-
/* @__PURE__ */ jsx("span", { className: "mr-1 text-xs text-muted-foreground", children: [
|
|
776
|
+
const chip = "inline-flex min-w-0 max-w-full items-center gap-1 truncate rounded-md border border-border px-1.5 py-0.5 text-xs hover:border-primary/40 hover:text-primary disabled:hover:border-border disabled:hover:text-inherit";
|
|
777
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-1", "data-testid": testId, children: [
|
|
778
|
+
/* @__PURE__ */ jsx("span", { className: "mr-1 w-full text-xs text-muted-foreground", children: [
|
|
402
779
|
countText(links.doc_count, l.document, l.documents),
|
|
403
780
|
countText(links.fact_count, l.fact, l.facts),
|
|
404
781
|
countText(links.thread_count, l.thread, l.threads)
|
|
@@ -476,6 +853,8 @@ function TagTable({
|
|
|
476
853
|
onExport,
|
|
477
854
|
onDownload,
|
|
478
855
|
people,
|
|
856
|
+
tags,
|
|
857
|
+
onOpenTag,
|
|
479
858
|
actions,
|
|
480
859
|
labels,
|
|
481
860
|
className,
|
|
@@ -485,12 +864,9 @@ function TagTable({
|
|
|
485
864
|
const columns = useMemo(() => table?.columns ?? [], [table]);
|
|
486
865
|
const rows = table?.rows ?? [];
|
|
487
866
|
const [editingColumns, setEditingColumns] = useState(false);
|
|
488
|
-
const gaps = rows.filter(isGap).length;
|
|
489
|
-
const [gapsOnly, setGapsOnly] = useState(false);
|
|
490
867
|
const [name, setName] = useState("");
|
|
491
868
|
const [adding, setAdding] = useState(false);
|
|
492
869
|
const [exporting, setExporting] = useState(false);
|
|
493
|
-
const shown = gapsOnly ? rows.filter(isGap) : rows;
|
|
494
870
|
const add = async () => {
|
|
495
871
|
const n = name.trim();
|
|
496
872
|
if (!n || !onAddRow) return;
|
|
@@ -503,76 +879,58 @@ function TagTable({
|
|
|
503
879
|
}
|
|
504
880
|
};
|
|
505
881
|
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-3", className), "data-testid": testId, children: [
|
|
506
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
disabled: exporting || rows.length === 0,
|
|
559
|
-
onClick: async () => {
|
|
560
|
-
setExporting(true);
|
|
561
|
-
try {
|
|
562
|
-
await onExport();
|
|
563
|
-
} finally {
|
|
564
|
-
setExporting(false);
|
|
565
|
-
}
|
|
566
|
-
},
|
|
567
|
-
"data-testid": `${testId}-export`,
|
|
568
|
-
children: [
|
|
569
|
-
exporting ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(FileDown, { className: "size-4" }),
|
|
570
|
-
exporting ? l.exporting : l.export
|
|
571
|
-
]
|
|
572
|
-
}
|
|
573
|
-
)
|
|
574
|
-
] })
|
|
575
|
-
] }),
|
|
882
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "ml-auto flex flex-wrap items-center gap-2", children: [
|
|
883
|
+
actions,
|
|
884
|
+
onChangeColumns && /* @__PURE__ */ jsxs(
|
|
885
|
+
Button,
|
|
886
|
+
{
|
|
887
|
+
variant: "outline",
|
|
888
|
+
size: "sm",
|
|
889
|
+
"aria-pressed": editingColumns,
|
|
890
|
+
onClick: () => setEditingColumns((v) => !v),
|
|
891
|
+
"data-testid": `${testId}-edit-columns`,
|
|
892
|
+
children: [
|
|
893
|
+
/* @__PURE__ */ jsx(SlidersHorizontal, { className: "size-4" }),
|
|
894
|
+
l.editColumns
|
|
895
|
+
]
|
|
896
|
+
}
|
|
897
|
+
),
|
|
898
|
+
onDownload && /* @__PURE__ */ jsxs(
|
|
899
|
+
Button,
|
|
900
|
+
{
|
|
901
|
+
variant: "outline",
|
|
902
|
+
size: "sm",
|
|
903
|
+
disabled: rows.length === 0,
|
|
904
|
+
onClick: () => void onDownload(),
|
|
905
|
+
"data-testid": `${testId}-download`,
|
|
906
|
+
children: [
|
|
907
|
+
/* @__PURE__ */ jsx(Download, { className: "size-4" }),
|
|
908
|
+
l.download
|
|
909
|
+
]
|
|
910
|
+
}
|
|
911
|
+
),
|
|
912
|
+
onExport && /* @__PURE__ */ jsxs(
|
|
913
|
+
Button,
|
|
914
|
+
{
|
|
915
|
+
variant: "outline",
|
|
916
|
+
size: "sm",
|
|
917
|
+
disabled: exporting || rows.length === 0,
|
|
918
|
+
onClick: async () => {
|
|
919
|
+
setExporting(true);
|
|
920
|
+
try {
|
|
921
|
+
await onExport();
|
|
922
|
+
} finally {
|
|
923
|
+
setExporting(false);
|
|
924
|
+
}
|
|
925
|
+
},
|
|
926
|
+
"data-testid": `${testId}-export`,
|
|
927
|
+
children: [
|
|
928
|
+
exporting ? /* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsx(FileDown, { className: "size-4" }),
|
|
929
|
+
exporting ? l.exporting : l.export
|
|
930
|
+
]
|
|
931
|
+
}
|
|
932
|
+
)
|
|
933
|
+
] }) }),
|
|
576
934
|
editingColumns && onChangeColumns && /* @__PURE__ */ jsx(
|
|
577
935
|
TagColumnsEditor,
|
|
578
936
|
{
|
|
@@ -586,116 +944,6 @@ function TagTable({
|
|
|
586
944
|
testId: `${testId}-columns`
|
|
587
945
|
}
|
|
588
946
|
),
|
|
589
|
-
isLoading ? /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
590
|
-
/* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }),
|
|
591
|
-
" ",
|
|
592
|
-
l.loading
|
|
593
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "overflow-x-auto rounded-lg border border-border", children: [
|
|
594
|
-
/* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-sm", "data-testid": `${testId}-table`, children: [
|
|
595
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-muted/40", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
596
|
-
/* @__PURE__ */ jsx(
|
|
597
|
-
"th",
|
|
598
|
-
{
|
|
599
|
-
className: cn(
|
|
600
|
-
ROW_LABEL_WIDTH,
|
|
601
|
-
"sticky left-0 z-10 bg-muted/40 px-3 py-2 text-left font-medium"
|
|
602
|
-
),
|
|
603
|
-
children: l.row
|
|
604
|
-
}
|
|
605
|
-
),
|
|
606
|
-
columns.map((c) => /* @__PURE__ */ jsx(
|
|
607
|
-
"th",
|
|
608
|
-
{
|
|
609
|
-
className: "px-3 py-2 text-left font-medium",
|
|
610
|
-
"data-testid": `${testId}-column-${c.id}`,
|
|
611
|
-
children: c.name
|
|
612
|
-
},
|
|
613
|
-
c.id
|
|
614
|
-
)),
|
|
615
|
-
/* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left font-medium", children: l.evidence })
|
|
616
|
-
] }) }),
|
|
617
|
-
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
618
|
-
shown.map((row) => {
|
|
619
|
-
const id = row.external_id;
|
|
620
|
-
const gap = isGap(row);
|
|
621
|
-
return /* @__PURE__ */ jsxs(
|
|
622
|
-
"tr",
|
|
623
|
-
{
|
|
624
|
-
className: cn("border-t border-border align-top", gap && "bg-amber-500/5"),
|
|
625
|
-
"data-gap": gap || void 0,
|
|
626
|
-
"data-testid": `${testId}-row-${id}`,
|
|
627
|
-
children: [
|
|
628
|
-
/* @__PURE__ */ jsx(
|
|
629
|
-
"th",
|
|
630
|
-
{
|
|
631
|
-
scope: "row",
|
|
632
|
-
className: cn(
|
|
633
|
-
ROW_LABEL_WIDTH,
|
|
634
|
-
"sticky left-0 z-10 px-3 py-2 text-left font-medium",
|
|
635
|
-
gap ? "bg-amber-50 dark:bg-amber-950" : "bg-background",
|
|
636
|
-
gap && "border-l-2 border-l-amber-500"
|
|
637
|
-
),
|
|
638
|
-
children: onOpenRow ? /* @__PURE__ */ jsx(
|
|
639
|
-
"button",
|
|
640
|
-
{
|
|
641
|
-
type: "button",
|
|
642
|
-
className: cn(ROW_LABEL, "text-left hover:text-primary hover:underline"),
|
|
643
|
-
title: row.name,
|
|
644
|
-
onClick: () => onOpenRow(id),
|
|
645
|
-
"data-testid": `${testId}-row-${id}-label`,
|
|
646
|
-
children: row.name
|
|
647
|
-
}
|
|
648
|
-
) : /* @__PURE__ */ jsx(
|
|
649
|
-
"span",
|
|
650
|
-
{
|
|
651
|
-
className: ROW_LABEL,
|
|
652
|
-
title: row.name,
|
|
653
|
-
"data-testid": `${testId}-row-${id}-label`,
|
|
654
|
-
children: row.name
|
|
655
|
-
}
|
|
656
|
-
)
|
|
657
|
-
}
|
|
658
|
-
),
|
|
659
|
-
columns.map((c) => /* @__PURE__ */ jsx("td", { className: "px-1.5 py-1", children: /* @__PURE__ */ jsx(
|
|
660
|
-
TagTableCell,
|
|
661
|
-
{
|
|
662
|
-
row,
|
|
663
|
-
column: c,
|
|
664
|
-
people,
|
|
665
|
-
onChange: onChangeValue,
|
|
666
|
-
l,
|
|
667
|
-
testId: `${testId}-cell-${id}-${c.id}`
|
|
668
|
-
}
|
|
669
|
-
) }, c.id)),
|
|
670
|
-
/* @__PURE__ */ jsx("td", { className: "px-3 py-2", children: /* @__PURE__ */ jsx(
|
|
671
|
-
Evidence,
|
|
672
|
-
{
|
|
673
|
-
row,
|
|
674
|
-
l,
|
|
675
|
-
onOpenDocument,
|
|
676
|
-
onOpenFact,
|
|
677
|
-
onOpenThread,
|
|
678
|
-
onOpenRow,
|
|
679
|
-
testId: `${testId}-evidence-${id}`
|
|
680
|
-
}
|
|
681
|
-
) })
|
|
682
|
-
]
|
|
683
|
-
},
|
|
684
|
-
id
|
|
685
|
-
);
|
|
686
|
-
}),
|
|
687
|
-
shown.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
|
|
688
|
-
"td",
|
|
689
|
-
{
|
|
690
|
-
colSpan: columns.length + 2,
|
|
691
|
-
className: "px-3 py-6 text-center text-sm text-muted-foreground",
|
|
692
|
-
children: l.empty
|
|
693
|
-
}
|
|
694
|
-
) })
|
|
695
|
-
] })
|
|
696
|
-
] }),
|
|
697
|
-
columns.length === 0 && rows.length > 0 && /* @__PURE__ */ jsx("p", { className: "border-t border-border px-3 py-2 text-xs text-muted-foreground", children: l.noColumns })
|
|
698
|
-
] }),
|
|
699
947
|
onAddRow && /* @__PURE__ */ jsxs(
|
|
700
948
|
"form",
|
|
701
949
|
{
|
|
@@ -732,7 +980,123 @@ function TagTable({
|
|
|
732
980
|
)
|
|
733
981
|
]
|
|
734
982
|
}
|
|
735
|
-
)
|
|
983
|
+
),
|
|
984
|
+
isLoading ? /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
985
|
+
/* @__PURE__ */ jsx(Loader2, { className: "size-4 animate-spin" }),
|
|
986
|
+
" ",
|
|
987
|
+
l.loading
|
|
988
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "overflow-x-auto rounded-lg border border-border", children: [
|
|
989
|
+
/* @__PURE__ */ jsxs(
|
|
990
|
+
"table",
|
|
991
|
+
{
|
|
992
|
+
className: "w-full min-w-[36rem] table-fixed border-collapse text-sm",
|
|
993
|
+
"data-testid": `${testId}-table`,
|
|
994
|
+
children: [
|
|
995
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-muted/40", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
996
|
+
/* @__PURE__ */ jsx(
|
|
997
|
+
"th",
|
|
998
|
+
{
|
|
999
|
+
className: cn(
|
|
1000
|
+
ROW_LABEL_WIDTH,
|
|
1001
|
+
"sticky left-0 z-10 bg-muted/40 px-3 py-2 text-left font-medium"
|
|
1002
|
+
),
|
|
1003
|
+
children: l.row
|
|
1004
|
+
}
|
|
1005
|
+
),
|
|
1006
|
+
columns.map((c) => /* @__PURE__ */ jsx(
|
|
1007
|
+
"th",
|
|
1008
|
+
{
|
|
1009
|
+
className: "truncate px-3 py-2 text-left font-medium",
|
|
1010
|
+
title: c.name,
|
|
1011
|
+
"data-testid": `${testId}-column-${c.id}`,
|
|
1012
|
+
children: c.name
|
|
1013
|
+
},
|
|
1014
|
+
c.id
|
|
1015
|
+
)),
|
|
1016
|
+
/* @__PURE__ */ jsx("th", { className: cn(EVIDENCE_WIDTH, "px-3 py-2 text-left font-medium"), children: l.evidence })
|
|
1017
|
+
] }) }),
|
|
1018
|
+
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
1019
|
+
rows.map((row) => {
|
|
1020
|
+
const id = row.external_id;
|
|
1021
|
+
return /* @__PURE__ */ jsxs(
|
|
1022
|
+
"tr",
|
|
1023
|
+
{
|
|
1024
|
+
className: "border-t border-border align-top",
|
|
1025
|
+
"data-testid": `${testId}-row-${id}`,
|
|
1026
|
+
children: [
|
|
1027
|
+
/* @__PURE__ */ jsx(
|
|
1028
|
+
"th",
|
|
1029
|
+
{
|
|
1030
|
+
scope: "row",
|
|
1031
|
+
className: cn(
|
|
1032
|
+
ROW_LABEL_WIDTH,
|
|
1033
|
+
"sticky left-0 z-10 bg-background px-3 py-2 text-left font-medium"
|
|
1034
|
+
),
|
|
1035
|
+
children: onOpenRow ? /* @__PURE__ */ jsx(
|
|
1036
|
+
"button",
|
|
1037
|
+
{
|
|
1038
|
+
type: "button",
|
|
1039
|
+
className: cn(ROW_LABEL, "text-left hover:text-primary hover:underline"),
|
|
1040
|
+
title: row.name,
|
|
1041
|
+
onClick: () => onOpenRow(id),
|
|
1042
|
+
"data-testid": `${testId}-row-${id}-label`,
|
|
1043
|
+
children: row.name
|
|
1044
|
+
}
|
|
1045
|
+
) : /* @__PURE__ */ jsx(
|
|
1046
|
+
"span",
|
|
1047
|
+
{
|
|
1048
|
+
className: ROW_LABEL,
|
|
1049
|
+
title: row.name,
|
|
1050
|
+
"data-testid": `${testId}-row-${id}-label`,
|
|
1051
|
+
children: row.name
|
|
1052
|
+
}
|
|
1053
|
+
)
|
|
1054
|
+
}
|
|
1055
|
+
),
|
|
1056
|
+
columns.map((c) => /* @__PURE__ */ jsx("td", { className: "px-1.5 py-1", children: /* @__PURE__ */ jsx(
|
|
1057
|
+
TagTableCell,
|
|
1058
|
+
{
|
|
1059
|
+
row,
|
|
1060
|
+
column: c,
|
|
1061
|
+
people,
|
|
1062
|
+
tags,
|
|
1063
|
+
onOpenTag,
|
|
1064
|
+
onChange: onChangeValue,
|
|
1065
|
+
l,
|
|
1066
|
+
testId: `${testId}-cell-${id}-${c.id}`
|
|
1067
|
+
}
|
|
1068
|
+
) }, c.id)),
|
|
1069
|
+
/* @__PURE__ */ jsx("td", { className: "min-w-0 px-3 py-2", children: /* @__PURE__ */ jsx(
|
|
1070
|
+
Evidence,
|
|
1071
|
+
{
|
|
1072
|
+
row,
|
|
1073
|
+
l,
|
|
1074
|
+
onOpenDocument,
|
|
1075
|
+
onOpenFact,
|
|
1076
|
+
onOpenThread,
|
|
1077
|
+
onOpenRow,
|
|
1078
|
+
testId: `${testId}-evidence-${id}`
|
|
1079
|
+
}
|
|
1080
|
+
) })
|
|
1081
|
+
]
|
|
1082
|
+
},
|
|
1083
|
+
id
|
|
1084
|
+
);
|
|
1085
|
+
}),
|
|
1086
|
+
rows.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
|
|
1087
|
+
"td",
|
|
1088
|
+
{
|
|
1089
|
+
colSpan: columns.length + 2,
|
|
1090
|
+
className: "px-3 py-6 text-center text-sm text-muted-foreground",
|
|
1091
|
+
children: l.empty
|
|
1092
|
+
}
|
|
1093
|
+
) })
|
|
1094
|
+
] })
|
|
1095
|
+
]
|
|
1096
|
+
}
|
|
1097
|
+
),
|
|
1098
|
+
columns.length === 0 && rows.length > 0 && /* @__PURE__ */ jsx("p", { className: "border-t border-border px-3 py-2 text-xs text-muted-foreground", children: l.noColumns })
|
|
1099
|
+
] })
|
|
736
1100
|
] });
|
|
737
1101
|
}
|
|
738
1102
|
var DOCX_MIME_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
@@ -875,6 +1239,6 @@ function tagTableDocx(table, options) {
|
|
|
875
1239
|
});
|
|
876
1240
|
}
|
|
877
1241
|
|
|
878
|
-
export { DEFAULT_TAG_COLUMNS_EDITOR_LABELS, DEFAULT_TAG_TABLE_DOCX_LABELS, DEFAULT_TAG_TABLE_LABELS, DOCX_MIME_TYPE, TAG_TABLE_DOCX_LANDSCAPE_AFTER, TagColumnsEditor, TagTable, TagTableCell, cellText, cellValue, fieldWrites, isGap, parseCell, rowLinks, tagTableDocumentXml, tagTableDocx, tagTableMarkdown };
|
|
879
|
-
//# sourceMappingURL=chunk-
|
|
880
|
-
//# sourceMappingURL=chunk-
|
|
1242
|
+
export { DEFAULT_TAG_COLUMNS_EDITOR_LABELS, DEFAULT_TAG_TABLE_DOCX_LABELS, DEFAULT_TAG_TABLE_LABELS, DEFAULT_THREAD_FOLLOW_LABELS, DEFAULT_WORKSPACE_ACTIVITY_LABELS, DEFAULT_WORKSPACE_NOTIFICATION_MENU_LABELS, DOCX_MIME_TYPE, TAG_TABLE_DOCX_LANDSCAPE_AFTER, TagColumnsEditor, TagTable, TagTableCell, ThreadFollowButton, ThreadFollowMenuItem, WorkspaceActivityList, WorkspaceNotificationMenu, cellText, cellValue, fieldWrites, isGap, parseCell, rowLinks, tagTableDocumentXml, tagTableDocx, tagTableMarkdown, workspaceActivityHeadline, workspaceActivityTarget };
|
|
1243
|
+
//# sourceMappingURL=chunk-NXWKMKZY.js.map
|
|
1244
|
+
//# sourceMappingURL=chunk-NXWKMKZY.js.map
|