@arbidocs/blocks 0.5.183 → 0.5.185
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 → ConnectedCallDock-CKJUL7HZ.cjs} +5 -5
- package/dist/{ConnectedCallDock-CF7KF5KM.cjs.map → ConnectedCallDock-CKJUL7HZ.cjs.map} +1 -1
- package/dist/{ConnectedCallRoom-NQOE2RYD.cjs → ConnectedCallRoom-CDOGHVES.cjs} +5 -5
- package/dist/{ConnectedCallRoom-NQOE2RYD.cjs.map → ConnectedCallRoom-CDOGHVES.cjs.map} +1 -1
- package/dist/{ConnectedMailInviteCard-DDGB4LLC.cjs → ConnectedMailInviteCard-ZNBHPFKF.cjs} +8 -8
- package/dist/{ConnectedMailInviteCard-DDGB4LLC.cjs.map → ConnectedMailInviteCard-ZNBHPFKF.cjs.map} +1 -1
- package/dist/{ConnectedNativeDocxComparison-3KTHPCMT.cjs → ConnectedNativeDocxComparison-YP7SASIP.cjs} +8 -8
- package/dist/{ConnectedNativeDocxComparison-3KTHPCMT.cjs.map → ConnectedNativeDocxComparison-YP7SASIP.cjs.map} +1 -1
- package/dist/{ConnectedPresentation-LNDESKYE.cjs → ConnectedPresentation-RFUH3MXL.cjs} +10 -10
- package/dist/{ConnectedPresentation-LNDESKYE.cjs.map → ConnectedPresentation-RFUH3MXL.cjs.map} +1 -1
- package/dist/{ConnectedSlidesTab-SYDDGJWM.cjs → ConnectedSlidesTab-CCJWFSCX.cjs} +10 -10
- package/dist/{ConnectedSlidesTab-SYDDGJWM.cjs.map → ConnectedSlidesTab-CCJWFSCX.cjs.map} +1 -1
- package/dist/{ConnectedStreamedWordArtifact-LUM6WE7F.cjs → ConnectedStreamedWordArtifact-GVVIWKFH.cjs} +8 -8
- package/dist/{ConnectedStreamedWordArtifact-LUM6WE7F.cjs.map → ConnectedStreamedWordArtifact-GVVIWKFH.cjs.map} +1 -1
- package/dist/{DocumentReviewCard-NKCKBY3P.cjs → DocumentReviewCard-QD6VVDAE.cjs} +3 -3
- package/dist/{DocumentReviewCard-NKCKBY3P.cjs.map → DocumentReviewCard-QD6VVDAE.cjs.map} +1 -1
- package/dist/{FilesViewerDialog-T4SOKUKO.cjs → FilesViewerDialog-S5KRHOFU.cjs} +15 -15
- package/dist/{FilesViewerDialog-T4SOKUKO.cjs.map → FilesViewerDialog-S5KRHOFU.cjs.map} +1 -1
- package/dist/{WorkspaceTableView-QT63XYII.cjs → WorkspaceTableView-TPL6EWXL.cjs} +3 -3
- package/dist/{WorkspaceTableView-QT63XYII.cjs.map → WorkspaceTableView-TPL6EWXL.cjs.map} +1 -1
- package/dist/agents/index.cjs +175 -175
- package/dist/{ai-CTJWECJ5.cjs → ai-6K5DTBLO.cjs} +16 -16
- package/dist/ai-6K5DTBLO.cjs.map +1 -0
- package/dist/{avatar-renderer-OZKS2BSF.cjs → avatar-renderer-FTY24TKC.cjs} +97 -62
- package/dist/avatar-renderer-FTY24TKC.cjs.map +1 -0
- package/dist/calls/connected/CallAvatarMedia.d.ts +1 -1
- package/dist/calls/connected/CallAvatarMedia.js +9 -4
- package/dist/calls/connected/CallAvatarMedia.js.map +2 -2
- package/dist/calls/connected/CallPeoplePicker.js +5 -2
- package/dist/calls/connected/CallPeoplePicker.js.map +2 -2
- package/dist/calls/connected/ConnectedCallRoom.js +24 -0
- package/dist/calls/connected/ConnectedCallRoom.js.map +2 -2
- package/dist/calls/connected/DmCallButton.d.ts +2 -1
- package/dist/calls/connected/DmCallButton.js +10 -3
- package/dist/calls/connected/DmCallButton.js.map +2 -2
- package/dist/calls/connected/OwnedAgentCallButton.d.ts +2 -1
- package/dist/calls/connected/OwnedAgentCallButton.js +5 -2
- package/dist/calls/connected/OwnedAgentCallButton.js.map +2 -2
- package/dist/calls/connected/avatar-framing.d.ts +6 -1
- package/dist/calls/connected/avatar-framing.js +39 -11
- package/dist/calls/connected/avatar-framing.js.map +3 -3
- package/dist/calls/connected/avatar-renderer.js +21 -9
- package/dist/calls/connected/avatar-renderer.js.map +2 -2
- package/dist/calls/connected/call-media-state.js +1 -1
- package/dist/calls/connected/call-media-state.js.map +2 -2
- package/dist/calls/connected/call-people.d.ts +2 -1
- package/dist/calls/connected/call-people.js +11 -1
- package/dist/calls/connected/call-people.js.map +2 -2
- package/dist/calls/index.cjs +22 -22
- package/dist/{chunk-KHZEFLQC.cjs → chunk-26KJYXYH.cjs} +52 -5
- package/dist/chunk-26KJYXYH.cjs.map +1 -0
- package/dist/{chunk-HH5MKRBL.cjs → chunk-2EDVEP2X.cjs} +6 -6
- package/dist/{chunk-HH5MKRBL.cjs.map → chunk-2EDVEP2X.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-ZTLPUUZB.cjs → chunk-6IABKQKX.cjs} +6 -6
- package/dist/{chunk-ZTLPUUZB.cjs.map → chunk-6IABKQKX.cjs.map} +1 -1
- package/dist/{chunk-OHWYQI3B.cjs → chunk-7KUTY4N5.cjs} +9 -9
- package/dist/{chunk-OHWYQI3B.cjs.map → chunk-7KUTY4N5.cjs.map} +1 -1
- package/dist/{chunk-HHZDURXN.cjs → chunk-AS2FZ2T7.cjs} +3 -3
- package/dist/{chunk-HHZDURXN.cjs.map → chunk-AS2FZ2T7.cjs.map} +1 -1
- package/dist/{chunk-3YPVXIFF.cjs → chunk-CF3WPB7T.cjs} +4 -4
- package/dist/{chunk-3YPVXIFF.cjs.map → chunk-CF3WPB7T.cjs.map} +1 -1
- package/dist/{chunk-DWUWPF2A.cjs → chunk-EEB63QUE.cjs} +8 -8
- package/dist/{chunk-DWUWPF2A.cjs.map → chunk-EEB63QUE.cjs.map} +1 -1
- package/dist/{chunk-AZP4ABNL.cjs → chunk-EYOZNVQK.cjs} +4 -4
- package/dist/{chunk-AZP4ABNL.cjs.map → chunk-EYOZNVQK.cjs.map} +1 -1
- package/dist/{chunk-A4HOEGDI.cjs → chunk-FAFA56ZL.cjs} +4 -4
- package/dist/{chunk-A4HOEGDI.cjs.map → chunk-FAFA56ZL.cjs.map} +1 -1
- package/dist/{chunk-XKXKEVHH.cjs → chunk-HPIB5YRV.cjs} +5 -5
- package/dist/{chunk-XKXKEVHH.cjs.map → chunk-HPIB5YRV.cjs.map} +1 -1
- package/dist/{chunk-WIQDXRRB.cjs → chunk-HS626TSS.cjs} +5 -5
- package/dist/{chunk-WIQDXRRB.cjs.map → chunk-HS626TSS.cjs.map} +1 -1
- 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-HYULUR6E.cjs → chunk-L6WEKQTV.cjs} +28 -28
- package/dist/{chunk-HYULUR6E.cjs.map → chunk-L6WEKQTV.cjs.map} +1 -1
- package/dist/{chunk-3EIO4ZH5.cjs → chunk-LUOL7TEY.cjs} +6 -6
- package/dist/{chunk-3EIO4ZH5.cjs.map → chunk-LUOL7TEY.cjs.map} +1 -1
- package/dist/{chunk-LRBX4VIG.cjs → chunk-PDKTW4L2.cjs} +5 -5
- package/dist/{chunk-LRBX4VIG.cjs.map → chunk-PDKTW4L2.cjs.map} +1 -1
- package/dist/{chunk-UFDUDQYT.cjs → chunk-QU3OCUVF.cjs} +1712 -71
- package/dist/chunk-QU3OCUVF.cjs.map +1 -0
- package/dist/{chunk-7GVKG3G4.cjs → chunk-R27P7TYW.cjs} +4 -4
- package/dist/{chunk-7GVKG3G4.cjs.map → chunk-R27P7TYW.cjs.map} +1 -1
- package/dist/{chunk-4H5DPHZ2.cjs → chunk-RDEUBZ3Z.cjs} +8 -8
- package/dist/{chunk-4H5DPHZ2.cjs.map → chunk-RDEUBZ3Z.cjs.map} +1 -1
- package/dist/{chunk-I5LXJLO5.cjs → chunk-TW5AGCHR.cjs} +31 -9
- package/dist/chunk-TW5AGCHR.cjs.map +1 -0
- package/dist/{chunk-5FSULBPE.cjs → chunk-U2T66I7C.cjs} +3 -3
- package/dist/{chunk-5FSULBPE.cjs.map → chunk-U2T66I7C.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-4TCOUQMC.cjs → chunk-WQMIBHSQ.cjs} +6 -6
- package/dist/{chunk-4TCOUQMC.cjs.map → chunk-WQMIBHSQ.cjs.map} +1 -1
- package/dist/{chunk-TX7Y4A6T.cjs → chunk-X5PH6PM7.cjs} +38 -9
- package/dist/chunk-X5PH6PM7.cjs.map +1 -0
- package/dist/{chunk-7QZXHSQX.cjs → chunk-ZKXZKIPE.cjs} +27 -7
- package/dist/chunk-ZKXZKIPE.cjs.map +1 -0
- package/dist/connect/docx.cjs +11 -11
- package/dist/connect/index.cjs +767 -553
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +6 -6
- package/dist/connection/ConnectedAgentChatPanel.js +1 -1
- package/dist/connection/ConnectedAgentChatPanel.js.map +2 -2
- package/dist/connection/ConnectedAgentCreator.js +12 -4
- package/dist/connection/ConnectedAgentCreator.js.map +2 -2
- 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/messenger/ConnectedChatThread.js +1 -1
- package/dist/connection/messenger/ConnectedChatThread.js.map +2 -2
- package/dist/connection/pages/TableViewBlock.js +2 -6
- package/dist/connection/pages/TableViewBlock.js.map +2 -2
- package/dist/connection/settings-page/featuresSection.js +1 -1
- package/dist/connection/settings-page/featuresSection.js.map +1 -1
- 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 +129 -132
- 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 +13 -13
- package/dist/facts/index.cjs +53 -55
- package/dist/facts/index.cjs.map +1 -1
- package/dist/index.cjs +240 -241
- package/dist/index.cjs.map +1 -1
- package/dist/pages/index.cjs +25 -26
- package/dist/pages/index.cjs.map +1 -1
- package/dist/settings/index.cjs +9 -9
- package/dist/site/index.cjs +10 -11
- package/dist/studio/index.cjs +10 -11
- package/dist/studio/index.cjs.map +1 -1
- package/dist/timeline/index.cjs +12 -13
- package/dist/workflow-canvas/index.cjs +19 -19
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/record/render-take.py +5 -0
- package/dist/ai-CTJWECJ5.cjs.map +0 -1
- package/dist/avatar-renderer-OZKS2BSF.cjs.map +0 -1
- 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-I5LXJLO5.cjs.map +0 -1
- package/dist/chunk-KHZEFLQC.cjs.map +0 -1
- package/dist/chunk-NGT3P5ZG.cjs.map +0 -1
- package/dist/chunk-TX7Y4A6T.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,42 +1,716 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunk26KJYXYH_cjs = require('./chunk-26KJYXYH.cjs');
|
|
5
|
+
var chunkGISMY7J7_cjs = require('./chunk-GISMY7J7.cjs');
|
|
6
|
+
var chunkV5P5MRSR_cjs = require('./chunk-V5P5MRSR.cjs');
|
|
6
7
|
var chunkSNUBQMIS_cjs = require('./chunk-SNUBQMIS.cjs');
|
|
7
8
|
var chunkLIJB6XOR_cjs = require('./chunk-LIJB6XOR.cjs');
|
|
8
9
|
var chunkU46OGRCO_cjs = require('./chunk-U46OGRCO.cjs');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
10
|
+
var chunk66IOCKWS_cjs = require('./chunk-66IOCKWS.cjs');
|
|
11
|
+
var chunkZVEW3JBT_cjs = require('./chunk-ZVEW3JBT.cjs');
|
|
12
|
+
var chunkPPCATBOY_cjs = require('./chunk-PPCATBOY.cjs');
|
|
13
|
+
var chunkPLIF5CUV_cjs = require('./chunk-PLIF5CUV.cjs');
|
|
14
|
+
var lucideReact = require('lucide-react');
|
|
12
15
|
var ui = require('@arbidocs/react/ui');
|
|
16
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
13
17
|
var react = require('react');
|
|
14
|
-
var lucideReact = require('lucide-react');
|
|
15
18
|
|
|
19
|
+
var isId = (v) => typeof v === "string" && v.trim() !== "";
|
|
20
|
+
var asList = (v) => Array.isArray(v) ? v : [];
|
|
21
|
+
var labelIds = (v) => asList(v).filter(isId);
|
|
22
|
+
var citations = (v) => asList(v).filter(
|
|
23
|
+
(c) => typeof c === "object" && c !== null && isId(c.doc_ext_id)
|
|
24
|
+
);
|
|
25
|
+
var nameOf = (id, row) => row.titles?.[id] ?? id;
|
|
26
|
+
var byText = (a, b) => a.localeCompare(b, void 0, { sensitivity: "base", numeric: true });
|
|
27
|
+
var emptiesLast = (ea, eb) => ea !== eb ? ea ? 1 : -1 : ea ? 0 : void 0;
|
|
28
|
+
var labelNames = (v, row) => labelIds(v).map((id) => nameOf(id, row)).join("; ");
|
|
29
|
+
var pagesOf = (c) => {
|
|
30
|
+
const pages = [];
|
|
31
|
+
for (const chunk of c.chunks ?? [])
|
|
32
|
+
if (typeof chunk.page === "number" && !pages.includes(chunk.page)) pages.push(chunk.page);
|
|
33
|
+
return pages;
|
|
34
|
+
};
|
|
35
|
+
var sameCitation = (a, b) => {
|
|
36
|
+
if (a.doc_ext_id !== b.doc_ext_id || (a.version ?? null) !== (b.version ?? null)) return false;
|
|
37
|
+
const ca = a.chunks ?? [];
|
|
38
|
+
const cb = b.chunks ?? [];
|
|
39
|
+
return ca.length === cb.length && ca.every((c, i) => c.chunk_id === cb[i].chunk_id && (c.page ?? null) === (cb[i].page ?? null));
|
|
40
|
+
};
|
|
41
|
+
var labelKit = {
|
|
42
|
+
icon: lucideReact.Tags,
|
|
43
|
+
width: 200,
|
|
44
|
+
labelKey: "label",
|
|
45
|
+
empty: (v) => labelIds(v).length === 0,
|
|
46
|
+
same: (a, b) => {
|
|
47
|
+
const sa = new Set(labelIds(a));
|
|
48
|
+
const sb = new Set(labelIds(b));
|
|
49
|
+
return sa.size === sb.size && [...sa].every((id) => sb.has(id));
|
|
50
|
+
},
|
|
51
|
+
format: (v, row) => labelNames(v, row),
|
|
52
|
+
toApi: (v) => {
|
|
53
|
+
const ids = [...new Set(labelIds(v))];
|
|
54
|
+
return ids.length > 0 ? ids : null;
|
|
55
|
+
},
|
|
56
|
+
compare: (a, b, ra, rb) => emptiesLast(labelKit.empty(a), labelKit.empty(b)) ?? byText(labelNames(a, ra), labelNames(b, rb)),
|
|
57
|
+
filterOps: ["contains", "neq", "empty", "not_empty"],
|
|
58
|
+
filterInput: "label",
|
|
59
|
+
canEditInGrid: (_c, s) => Boolean(s?.labels)
|
|
60
|
+
};
|
|
61
|
+
var sourceKit = {
|
|
62
|
+
icon: lucideReact.BookMarked,
|
|
63
|
+
width: 240,
|
|
64
|
+
labelKey: "source",
|
|
65
|
+
empty: (v) => citations(v).length === 0,
|
|
66
|
+
same: (a, b) => {
|
|
67
|
+
const la = citations(a);
|
|
68
|
+
const lb = citations(b);
|
|
69
|
+
return la.length === lb.length && la.every((c, i) => sameCitation(c, lb[i]));
|
|
70
|
+
},
|
|
71
|
+
format: (v, row) => citations(v).map((c) => {
|
|
72
|
+
const pages = pagesOf(c);
|
|
73
|
+
const name = nameOf(c.doc_ext_id, row);
|
|
74
|
+
return pages.length > 0 ? `${name} (${pages.map((p) => `p.${p}`).join(", ")})` : name;
|
|
75
|
+
}).join("; "),
|
|
76
|
+
toApi: (v) => {
|
|
77
|
+
const kept = citations(v);
|
|
78
|
+
return kept.length > 0 ? kept : null;
|
|
79
|
+
},
|
|
80
|
+
compare: (a, b, ra, rb) => {
|
|
81
|
+
const empty = emptiesLast(sourceKit.empty(a), sourceKit.empty(b));
|
|
82
|
+
if (empty !== void 0) return empty;
|
|
83
|
+
const ca = citations(a);
|
|
84
|
+
const cb = citations(b);
|
|
85
|
+
if (ca.length !== cb.length) return ca.length - cb.length;
|
|
86
|
+
return byText(nameOf(ca[0].doc_ext_id, ra), nameOf(cb[0].doc_ext_id, rb));
|
|
87
|
+
},
|
|
88
|
+
filterOps: ["contains", "empty", "not_empty"],
|
|
89
|
+
filterInput: "document",
|
|
90
|
+
canEditInGrid: () => false
|
|
91
|
+
};
|
|
92
|
+
var COLUMN_KITS = {
|
|
93
|
+
label: labelKit,
|
|
94
|
+
source: sourceKit
|
|
95
|
+
};
|
|
96
|
+
function kitOf(type) {
|
|
97
|
+
return type === "label" || type === "source" ? COLUMN_KITS[type] : void 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/databases/column-types.ts
|
|
101
|
+
var DATABASE_COLUMN_TYPES = [
|
|
102
|
+
"text",
|
|
103
|
+
"number",
|
|
104
|
+
"date",
|
|
105
|
+
"checkbox",
|
|
106
|
+
"select",
|
|
107
|
+
"person",
|
|
108
|
+
"document",
|
|
109
|
+
"relation",
|
|
110
|
+
"lookup",
|
|
111
|
+
"rollup"
|
|
112
|
+
];
|
|
113
|
+
var COMPUTED_COLUMN_TYPES = /* @__PURE__ */ new Set([
|
|
114
|
+
"lookup",
|
|
115
|
+
"rollup"
|
|
116
|
+
]);
|
|
117
|
+
var LINK_COLUMN_TYPES = /* @__PURE__ */ new Set([
|
|
118
|
+
"document",
|
|
119
|
+
"relation"
|
|
120
|
+
]);
|
|
121
|
+
var isComputedColumn = (column) => COMPUTED_COLUMN_TYPES.has(column.type);
|
|
122
|
+
var DATABASE_ROLLUP_OPS = ["count", "sum", "avg", "min", "max"];
|
|
123
|
+
var DEFAULT_DATABASE_COLUMN_TYPE_LABELS = {
|
|
124
|
+
text: "Text",
|
|
125
|
+
number: "Number",
|
|
126
|
+
date: "Date",
|
|
127
|
+
checkbox: "Checkbox",
|
|
128
|
+
select: "Select",
|
|
129
|
+
person: "Person",
|
|
130
|
+
// The same name as a `source` column: both hold a row's sources. A `document` column holds the
|
|
131
|
+
// documents; a `source` column also holds the passages cited in each.
|
|
132
|
+
document: "Sources",
|
|
133
|
+
relation: "Relation",
|
|
134
|
+
lookup: "Lookup",
|
|
135
|
+
rollup: "Rollup",
|
|
136
|
+
label: "Labels",
|
|
137
|
+
source: "Sources"
|
|
138
|
+
};
|
|
139
|
+
var OPTION_TONES = [
|
|
140
|
+
"bg-blue-bg text-blue-text",
|
|
141
|
+
"bg-green-bg text-green-text",
|
|
142
|
+
"bg-yellow-bg text-yellow-text",
|
|
143
|
+
"bg-purple-bg text-purple-text",
|
|
144
|
+
"bg-red-bg text-red-text",
|
|
145
|
+
"bg-gray-bg text-gray-text"
|
|
146
|
+
];
|
|
147
|
+
function optionTone(option) {
|
|
148
|
+
let hash = 0;
|
|
149
|
+
for (const ch of option.toLowerCase()) hash = hash * 31 + ch.charCodeAt(0) >>> 0;
|
|
150
|
+
return OPTION_TONES[hash % OPTION_TONES.length];
|
|
151
|
+
}
|
|
152
|
+
var isEmpty = (value) => value === null || value === void 0 || typeof value === "string" && value.trim() === "" || Array.isArray(value) && value.length === 0;
|
|
153
|
+
function cellList(value) {
|
|
154
|
+
if (isEmpty(value)) return [];
|
|
155
|
+
return Array.isArray(value) ? value.filter((v) => !isEmpty(v)) : [value];
|
|
156
|
+
}
|
|
157
|
+
function cellIds(value) {
|
|
158
|
+
return cellList(value).filter((v) => typeof v === "string");
|
|
159
|
+
}
|
|
160
|
+
function titleOf(id, titles) {
|
|
161
|
+
return titles?.[id] ?? id;
|
|
162
|
+
}
|
|
163
|
+
function sameCellValue(a, b, type) {
|
|
164
|
+
const kit = type ? kitOf(type) : void 0;
|
|
165
|
+
if (kit) return kit.same(a, b);
|
|
166
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
167
|
+
const la = cellList(a);
|
|
168
|
+
const lb = cellList(b);
|
|
169
|
+
return la.length === lb.length && la.every((v, i) => v === lb[i]);
|
|
170
|
+
}
|
|
171
|
+
return (a ?? null) === (b ?? null);
|
|
172
|
+
}
|
|
173
|
+
var kitRow = (titles) => ({
|
|
174
|
+
id: "",
|
|
175
|
+
values: {},
|
|
176
|
+
titles
|
|
177
|
+
});
|
|
178
|
+
var kitColumn = (type) => ({ id: "", name: "", type });
|
|
179
|
+
function formatDateValue(value, locale) {
|
|
180
|
+
const day = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
|
|
181
|
+
if (day) {
|
|
182
|
+
const [, y, m, d] = day;
|
|
183
|
+
return new Date(Date.UTC(+y, +m - 1, +d)).toLocaleDateString(locale, { timeZone: "UTC" });
|
|
184
|
+
}
|
|
185
|
+
const at = new Date(value);
|
|
186
|
+
return Number.isNaN(at.getTime()) ? value : at.toLocaleString(locale);
|
|
187
|
+
}
|
|
188
|
+
function formatNumberValue(value, locale) {
|
|
189
|
+
return value.toLocaleString(locale, { maximumFractionDigits: 6 });
|
|
190
|
+
}
|
|
191
|
+
var ISO_DATE = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
192
|
+
function formatLookupValue(value, titles, locale) {
|
|
193
|
+
if (isEmpty(value)) return "";
|
|
194
|
+
if (typeof value === "number") return formatNumberValue(value, locale);
|
|
195
|
+
if (typeof value === "boolean") return value ? "Yes" : "No";
|
|
196
|
+
if (typeof value === "string") {
|
|
197
|
+
if (titles?.[value] !== void 0) return titles[value];
|
|
198
|
+
if (ISO_DATE.test(value)) return formatDateValue(value, locale);
|
|
199
|
+
}
|
|
200
|
+
return String(value);
|
|
201
|
+
}
|
|
202
|
+
var NAMED_TYPES = /* @__PURE__ */ new Set([
|
|
203
|
+
"person",
|
|
204
|
+
"document",
|
|
205
|
+
"relation"
|
|
206
|
+
]);
|
|
207
|
+
function formatCell(value, type, locale, titles) {
|
|
208
|
+
if (isEmpty(value)) return "";
|
|
209
|
+
const kit = kitOf(type);
|
|
210
|
+
if (kit) return kit.format(value, kitRow(titles), kitColumn(type));
|
|
211
|
+
if ((type === "number" || type === "rollup") && typeof value === "number")
|
|
212
|
+
return formatNumberValue(value, locale);
|
|
213
|
+
if (type === "date" && typeof value === "string") return formatDateValue(value, locale);
|
|
214
|
+
if (type === "checkbox") return value ? "Yes" : "No";
|
|
215
|
+
if (NAMED_TYPES.has(type))
|
|
216
|
+
return cellIds(value).map((id) => titleOf(id, titles)).join(", ");
|
|
217
|
+
if (type === "lookup")
|
|
218
|
+
return cellList(value).map((v) => formatLookupValue(v, titles, locale)).join(", ");
|
|
219
|
+
return String(value);
|
|
220
|
+
}
|
|
221
|
+
function toApiValue(value, type) {
|
|
222
|
+
if (isEmpty(value)) return null;
|
|
223
|
+
const kit = kitOf(type);
|
|
224
|
+
if (kit) return kit.toApi(value);
|
|
225
|
+
if (LINK_COLUMN_TYPES.has(type)) return cellIds(value);
|
|
226
|
+
if (type === "checkbox") return Boolean(value);
|
|
227
|
+
if (type === "date" && value instanceof Date) {
|
|
228
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
229
|
+
return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}`;
|
|
230
|
+
}
|
|
231
|
+
if (type === "number" && typeof value === "string") {
|
|
232
|
+
const n = Number(value.replace(/,/g, ""));
|
|
233
|
+
return Number.isFinite(n) ? n : value;
|
|
234
|
+
}
|
|
235
|
+
return value;
|
|
236
|
+
}
|
|
237
|
+
function compareCells(a, b, type, titlesA, titlesB) {
|
|
238
|
+
const ea = isEmpty(a);
|
|
239
|
+
const eb = isEmpty(b);
|
|
240
|
+
if (ea || eb) return ea === eb ? 0 : ea ? 1 : -1;
|
|
241
|
+
const kit = kitOf(type);
|
|
242
|
+
if (kit) return kit.compare(a, b, kitRow(titlesA), kitRow(titlesB));
|
|
243
|
+
if (type === "number" || type === "checkbox" || type === "rollup") return Number(a) - Number(b);
|
|
244
|
+
const shown = NAMED_TYPES.has(type) || type === "lookup";
|
|
245
|
+
const ta = shown ? formatCell(a, type, void 0, titlesA) : String(a);
|
|
246
|
+
const tb = shown ? formatCell(b, type, void 0, titlesB) : String(b);
|
|
247
|
+
return ta.localeCompare(tb, void 0, { sensitivity: "base", numeric: true });
|
|
248
|
+
}
|
|
249
|
+
function rowTitle(row, columns, locale) {
|
|
250
|
+
const first = columns[0];
|
|
251
|
+
return first ? formatCell(row.values[first.id], first.type, locale, row.titles) : "";
|
|
252
|
+
}
|
|
253
|
+
function labelSourceFor(labels, column) {
|
|
254
|
+
if (!labels) return void 0;
|
|
255
|
+
const kinds = column.options?.length ? column.options : ["label"];
|
|
256
|
+
if (!labels.options.some((o) => o.kind)) return labels;
|
|
257
|
+
return {
|
|
258
|
+
options: labels.options.filter((o) => !o.kind || kinds.includes(o.kind)),
|
|
259
|
+
onCreate: kinds.includes("label") ? labels.onCreate : async () => void 0
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
var CHIP = "inline-flex h-[22px] min-w-0 max-w-[14rem] shrink-0 items-center gap-1 rounded-md border border-border bg-muted/50 px-1.5 text-xs text-foreground";
|
|
263
|
+
function initials(name) {
|
|
264
|
+
const parts = name.trim().split(/\s+/).filter(Boolean);
|
|
265
|
+
const letters = parts.length > 1 ? parts[0][0] + parts[parts.length - 1][0] : name.slice(0, 2);
|
|
266
|
+
return letters.toUpperCase();
|
|
267
|
+
}
|
|
268
|
+
function PersonChip({ name }) {
|
|
269
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex min-w-0 items-center gap-1.5 text-sm", children: [
|
|
270
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
271
|
+
"span",
|
|
272
|
+
{
|
|
273
|
+
"aria-hidden": true,
|
|
274
|
+
className: "flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-[10px] font-medium text-muted-foreground",
|
|
275
|
+
children: initials(name)
|
|
276
|
+
}
|
|
277
|
+
),
|
|
278
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: name })
|
|
279
|
+
] });
|
|
280
|
+
}
|
|
281
|
+
function LinkChip({
|
|
282
|
+
label,
|
|
283
|
+
kind,
|
|
284
|
+
onOpen,
|
|
285
|
+
testId,
|
|
286
|
+
openLabel,
|
|
287
|
+
className,
|
|
288
|
+
suffix
|
|
289
|
+
}) {
|
|
290
|
+
const Icon = kind === "document" ? lucideReact.FileText : lucideReact.ArrowUpRight;
|
|
291
|
+
const full = suffix ? `${label} ${suffix}` : label;
|
|
292
|
+
const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
293
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-3 shrink-0 text-muted-foreground", "aria-hidden": true }),
|
|
294
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: label }),
|
|
295
|
+
suffix && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 tabular-nums text-muted-foreground", "data-slot": "chip-suffix", children: ` ${suffix}` })
|
|
296
|
+
] });
|
|
297
|
+
if (!onOpen) {
|
|
298
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: ui.cn(CHIP, className), title: full, "data-testid": testId, children: body });
|
|
299
|
+
}
|
|
300
|
+
const stop = (e) => e.stopPropagation();
|
|
301
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
302
|
+
"button",
|
|
303
|
+
{
|
|
304
|
+
type: "button",
|
|
305
|
+
title: full,
|
|
306
|
+
"aria-label": openLabel,
|
|
307
|
+
"data-testid": testId,
|
|
308
|
+
onClick: (e) => {
|
|
309
|
+
e.stopPropagation();
|
|
310
|
+
onOpen();
|
|
311
|
+
},
|
|
312
|
+
onDoubleClick: stop,
|
|
313
|
+
onMouseDown: stop,
|
|
314
|
+
className: ui.cn(CHIP, "hover:bg-muted hover:underline", className),
|
|
315
|
+
children: body
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
function ChipRow({ children, wrap }) {
|
|
320
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
321
|
+
"span",
|
|
322
|
+
{
|
|
323
|
+
className: ui.cn(
|
|
324
|
+
"flex min-w-0 items-center gap-1",
|
|
325
|
+
wrap ? "flex-wrap py-0.5" : "h-full overflow-hidden"
|
|
326
|
+
),
|
|
327
|
+
children
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
function PersonCell({ value, titles }) {
|
|
332
|
+
const [id] = cellIds(value);
|
|
333
|
+
return id ? /* @__PURE__ */ jsxRuntime.jsx(PersonChip, { name: titleOf(id, titles) }) : null;
|
|
334
|
+
}
|
|
335
|
+
function LinkChipsCell({
|
|
336
|
+
value,
|
|
337
|
+
titles,
|
|
338
|
+
kind,
|
|
339
|
+
onOpenDocument,
|
|
340
|
+
wrap
|
|
341
|
+
}) {
|
|
342
|
+
const ids = cellIds(value);
|
|
343
|
+
if (ids.length === 0) return null;
|
|
344
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ChipRow, { wrap, children: ids.map((id) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
345
|
+
LinkChip,
|
|
346
|
+
{
|
|
347
|
+
label: titleOf(id, titles),
|
|
348
|
+
kind,
|
|
349
|
+
testId: `database-chip-${id}`,
|
|
350
|
+
onOpen: kind === "document" && onOpenDocument ? () => onOpenDocument(id) : void 0
|
|
351
|
+
},
|
|
352
|
+
id
|
|
353
|
+
)) });
|
|
354
|
+
}
|
|
355
|
+
function LookupCell({
|
|
356
|
+
value,
|
|
357
|
+
titles,
|
|
358
|
+
locale,
|
|
359
|
+
wrap
|
|
360
|
+
}) {
|
|
361
|
+
const values = cellList(value);
|
|
362
|
+
if (values.length === 0) return null;
|
|
363
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ChipRow, { wrap, children: values.map((v, i) => {
|
|
364
|
+
const text = formatLookupValue(v, titles, locale);
|
|
365
|
+
const key = `${i}-${text}`;
|
|
366
|
+
if (typeof v === "string" && /^doc-/.test(v))
|
|
367
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LinkChip, { label: text, kind: "document" }, key);
|
|
368
|
+
if (typeof v === "string" && /^dbr-/.test(v))
|
|
369
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LinkChip, { label: text, kind: "relation" }, key);
|
|
370
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
371
|
+
"span",
|
|
372
|
+
{
|
|
373
|
+
title: text,
|
|
374
|
+
className: "inline-flex h-[22px] min-w-0 max-w-[14rem] shrink-0 items-center truncate rounded-md bg-muted/60 px-1.5 text-xs text-foreground",
|
|
375
|
+
children: text
|
|
376
|
+
},
|
|
377
|
+
key
|
|
378
|
+
);
|
|
379
|
+
}) });
|
|
380
|
+
}
|
|
381
|
+
var MAX_SHOWN = 50;
|
|
382
|
+
var SEARCH_DEBOUNCE_MS = 200;
|
|
383
|
+
var DEFAULT_PICK_CELL_EDITOR_LABELS = {
|
|
384
|
+
searchPlaceholder: "Search\u2026",
|
|
385
|
+
noMatches: "No matches",
|
|
386
|
+
searching: "Searching\u2026",
|
|
387
|
+
clear: "Clear",
|
|
388
|
+
done: "Done",
|
|
389
|
+
remove: (label) => `Remove ${label}`
|
|
390
|
+
};
|
|
391
|
+
function useChoices(query, options, search) {
|
|
392
|
+
const [found, setFound] = react.useState([]);
|
|
393
|
+
const [loading, setLoading] = react.useState(Boolean(search));
|
|
394
|
+
react.useEffect(() => {
|
|
395
|
+
if (!search) return;
|
|
396
|
+
let live = true;
|
|
397
|
+
setLoading(true);
|
|
398
|
+
const t = setTimeout(
|
|
399
|
+
() => {
|
|
400
|
+
search(query.trim()).then((rows) => live && setFound(rows)).catch(() => live && setFound([])).finally(() => live && setLoading(false));
|
|
401
|
+
},
|
|
402
|
+
query ? SEARCH_DEBOUNCE_MS : 0
|
|
403
|
+
);
|
|
404
|
+
return () => {
|
|
405
|
+
live = false;
|
|
406
|
+
clearTimeout(t);
|
|
407
|
+
};
|
|
408
|
+
}, [query, search]);
|
|
409
|
+
const filtered = react.useMemo(() => {
|
|
410
|
+
if (search) return found.slice(0, MAX_SHOWN);
|
|
411
|
+
const q = query.trim().toLowerCase();
|
|
412
|
+
const all = options ?? [];
|
|
413
|
+
const hits = q ? all.filter(
|
|
414
|
+
(o) => o.label.toLowerCase().includes(q) || (o.description ?? "").toLowerCase().includes(q)
|
|
415
|
+
) : all;
|
|
416
|
+
return hits.slice(0, MAX_SHOWN);
|
|
417
|
+
}, [found, options, query, search]);
|
|
418
|
+
return { choices: filtered, loading: Boolean(search) && loading };
|
|
419
|
+
}
|
|
420
|
+
function PickCellEditor(props) {
|
|
421
|
+
const { value, onValueChange, stopEditing, data, kind, options, search } = props;
|
|
422
|
+
const l = { ...DEFAULT_PICK_CELL_EDITOR_LABELS, ...props.labels };
|
|
423
|
+
const multiple = kind !== "person";
|
|
424
|
+
const [chosen, setChosen] = react.useState(() => cellIds(value));
|
|
425
|
+
const [query, setQuery] = react.useState("");
|
|
426
|
+
const [active, setActive] = react.useState(0);
|
|
427
|
+
const input = react.useRef(null);
|
|
428
|
+
const { choices, loading } = useChoices(query, options, search);
|
|
429
|
+
const names = react.useRef({ ...data?.titles ?? {} });
|
|
430
|
+
for (const o of options ?? []) names.current[o.id] ??= o.label;
|
|
431
|
+
for (const o of choices) names.current[o.id] = o.label;
|
|
432
|
+
const nameOf2 = (id) => names.current[id] ?? id;
|
|
433
|
+
react.useEffect(() => input.current?.focus(), []);
|
|
434
|
+
react.useEffect(() => setActive(0), [query]);
|
|
435
|
+
const commit = (ids) => {
|
|
436
|
+
setChosen(ids);
|
|
437
|
+
if (data) {
|
|
438
|
+
const titles = { ...data.titles ?? {} };
|
|
439
|
+
for (const id of ids) titles[id] ??= nameOf2(id);
|
|
440
|
+
data.titles = titles;
|
|
441
|
+
}
|
|
442
|
+
onValueChange(multiple ? ids : ids[0] ?? null);
|
|
443
|
+
};
|
|
444
|
+
const close = () => setTimeout(() => stopEditing(), 0);
|
|
445
|
+
const toggle = (id) => {
|
|
446
|
+
if (!multiple) {
|
|
447
|
+
commit([id]);
|
|
448
|
+
close();
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
commit(chosen.includes(id) ? chosen.filter((x) => x !== id) : [...chosen, id]);
|
|
452
|
+
};
|
|
453
|
+
const onKeyDown = (e) => {
|
|
454
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
455
|
+
e.preventDefault();
|
|
456
|
+
e.stopPropagation();
|
|
457
|
+
if (choices.length === 0) return;
|
|
458
|
+
const step = e.key === "ArrowDown" ? 1 : -1;
|
|
459
|
+
setActive((i) => (i + step + choices.length) % choices.length);
|
|
460
|
+
} else if (e.key === "Enter") {
|
|
461
|
+
e.preventDefault();
|
|
462
|
+
e.stopPropagation();
|
|
463
|
+
const pick = choices[active];
|
|
464
|
+
if (pick) toggle(pick.id);
|
|
465
|
+
else if (multiple) close();
|
|
466
|
+
} else if (e.key === "Backspace" && multiple && !query && chosen.length > 0) {
|
|
467
|
+
commit(chosen.slice(0, -1));
|
|
468
|
+
} else if (e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Home" || e.key === "End") {
|
|
469
|
+
e.stopPropagation();
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
473
|
+
"div",
|
|
474
|
+
{
|
|
475
|
+
"data-testid": "database-pick-editor",
|
|
476
|
+
className: "flex w-72 flex-col rounded-md border border-border bg-popover shadow-md",
|
|
477
|
+
children: [
|
|
478
|
+
multiple && chosen.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1 border-b border-border p-1.5", children: chosen.map((id) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex min-w-0 items-center", children: [
|
|
479
|
+
/* @__PURE__ */ jsxRuntime.jsx(LinkChip, { label: nameOf2(id), kind: kind === "document" ? "document" : "relation" }),
|
|
480
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
481
|
+
"button",
|
|
482
|
+
{
|
|
483
|
+
type: "button",
|
|
484
|
+
"aria-label": l.remove(nameOf2(id)),
|
|
485
|
+
onClick: () => commit(chosen.filter((x) => x !== id)),
|
|
486
|
+
"data-testid": `database-pick-remove-${id}`,
|
|
487
|
+
className: "rounded p-0.5 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
488
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3" })
|
|
489
|
+
}
|
|
490
|
+
)
|
|
491
|
+
] }, id)) }),
|
|
492
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 border-b border-border px-2", children: [
|
|
493
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "size-3.5 shrink-0 text-muted-foreground", "aria-hidden": true }),
|
|
494
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
495
|
+
"input",
|
|
496
|
+
{
|
|
497
|
+
ref: input,
|
|
498
|
+
value: query,
|
|
499
|
+
placeholder: l.searchPlaceholder,
|
|
500
|
+
onChange: (e) => setQuery(e.target.value),
|
|
501
|
+
onKeyDown,
|
|
502
|
+
"data-testid": "database-pick-search",
|
|
503
|
+
className: "h-8 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
504
|
+
}
|
|
505
|
+
),
|
|
506
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-3.5 animate-spin text-muted-foreground" })
|
|
507
|
+
] }),
|
|
508
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { role: "listbox", "aria-multiselectable": multiple, className: "max-h-64 overflow-y-auto p-1", children: [
|
|
509
|
+
choices.map((o, i) => {
|
|
510
|
+
const isChosen = chosen.includes(o.id);
|
|
511
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
512
|
+
"button",
|
|
513
|
+
{
|
|
514
|
+
type: "button",
|
|
515
|
+
role: "option",
|
|
516
|
+
"aria-selected": isChosen,
|
|
517
|
+
onMouseEnter: () => setActive(i),
|
|
518
|
+
onClick: () => toggle(o.id),
|
|
519
|
+
"data-testid": `database-pick-option-${o.id}`,
|
|
520
|
+
className: ui.cn(
|
|
521
|
+
"flex w-full items-center gap-2 rounded px-2 py-1 text-left text-sm",
|
|
522
|
+
i === active && "bg-muted"
|
|
523
|
+
),
|
|
524
|
+
children: [
|
|
525
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
526
|
+
kind === "person" ? /* @__PURE__ */ jsxRuntime.jsx(PersonChip, { name: o.label }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: o.label }),
|
|
527
|
+
o.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs text-muted-foreground", children: o.description })
|
|
528
|
+
] }),
|
|
529
|
+
isChosen && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-3.5 shrink-0" })
|
|
530
|
+
]
|
|
531
|
+
},
|
|
532
|
+
o.id
|
|
533
|
+
);
|
|
534
|
+
}),
|
|
535
|
+
choices.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "px-2 py-1.5 text-sm text-muted-foreground", children: loading ? l.searching : l.noMatches })
|
|
536
|
+
] }),
|
|
537
|
+
(multiple || chosen.length > 0) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end border-t border-border p-1", children: !multiple ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
538
|
+
"button",
|
|
539
|
+
{
|
|
540
|
+
type: "button",
|
|
541
|
+
onClick: () => {
|
|
542
|
+
commit([]);
|
|
543
|
+
close();
|
|
544
|
+
},
|
|
545
|
+
"data-testid": "database-pick-clear",
|
|
546
|
+
className: "rounded px-2 py-1 text-sm text-muted-foreground hover:bg-muted",
|
|
547
|
+
children: l.clear
|
|
548
|
+
}
|
|
549
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
550
|
+
"button",
|
|
551
|
+
{
|
|
552
|
+
type: "button",
|
|
553
|
+
onClick: close,
|
|
554
|
+
"data-testid": "database-pick-done",
|
|
555
|
+
className: "rounded px-2 py-1 text-sm font-medium hover:bg-muted",
|
|
556
|
+
children: l.done
|
|
557
|
+
}
|
|
558
|
+
) })
|
|
559
|
+
]
|
|
560
|
+
}
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
var optionTestId = (id) => `database-label-option-${id}`;
|
|
564
|
+
function LabelsCell({ value, titles, labels, onChange, rowHeight }) {
|
|
565
|
+
const ids = cellIds(value);
|
|
566
|
+
if (labels && onChange) {
|
|
567
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
568
|
+
chunk26KJYXYH_cjs.FactLabelsCell,
|
|
569
|
+
{
|
|
570
|
+
options: labels.options,
|
|
571
|
+
selectedIds: ids,
|
|
572
|
+
onChange,
|
|
573
|
+
onCreate: labels.onCreate,
|
|
574
|
+
rowHeight,
|
|
575
|
+
compact: true,
|
|
576
|
+
testIds: { option: optionTestId }
|
|
577
|
+
}
|
|
578
|
+
);
|
|
579
|
+
}
|
|
580
|
+
if (ids.length === 0) return null;
|
|
581
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
582
|
+
"div",
|
|
583
|
+
{
|
|
584
|
+
className: rowHeight === void 0 ? "flex min-w-0 flex-wrap items-center gap-1" : "flex min-w-0 flex-wrap content-start gap-1 overflow-hidden",
|
|
585
|
+
style: rowHeight === void 0 ? void 0 : { maxHeight: chunk26KJYXYH_cjs.labelChipsMaxHeight(rowHeight, true) },
|
|
586
|
+
title: rowHeight === void 0 ? void 0 : ids.map((id) => titleOf(id, titles)).join(", "),
|
|
587
|
+
children: ids.map((id) => /* @__PURE__ */ jsxRuntime.jsx(chunk26KJYXYH_cjs.LabelChip, { name: titleOf(id, titles), color: ui.getEntityColor(id, "medium") }, id))
|
|
588
|
+
}
|
|
589
|
+
);
|
|
590
|
+
}
|
|
16
591
|
function LabelsField({ testId, ...cell }) {
|
|
17
592
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18
593
|
"div",
|
|
19
594
|
{
|
|
20
595
|
"data-testid": testId,
|
|
21
596
|
className: "flex min-h-8 min-w-0 items-center rounded-md border border-input bg-card px-2 py-1",
|
|
22
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
597
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(LabelsCell, { ...cell, rowHeight: 160 })
|
|
23
598
|
}
|
|
24
599
|
);
|
|
25
600
|
}
|
|
601
|
+
|
|
602
|
+
// src/databases/sourcesOverflow.ts
|
|
603
|
+
function hiddenAfterRows(tops, rows = 1) {
|
|
604
|
+
const shown = [...new Set(tops)].sort((a, b) => a - b)[rows - 1];
|
|
605
|
+
if (shown === void 0) return 0;
|
|
606
|
+
return tops.filter((top) => top > shown).length;
|
|
607
|
+
}
|
|
608
|
+
var CHIP_HEIGHT = 22;
|
|
609
|
+
var CHIP_GAP = 4;
|
|
610
|
+
var CELL_PAD_Y = 16;
|
|
611
|
+
var defaultMoreLabel = (count) => `${count} more: open the row`;
|
|
612
|
+
var citationKey = (cites, index) => {
|
|
613
|
+
const c = cites[index];
|
|
614
|
+
return `${c.doc_ext_id}:${c.version ?? ""}:${index}`;
|
|
615
|
+
};
|
|
616
|
+
var citationTestId = (cites, index) => {
|
|
617
|
+
const id = cites[index].doc_ext_id;
|
|
618
|
+
return cites.findIndex((c) => c.doc_ext_id === id) < index ? `${id}-${index}` : id;
|
|
619
|
+
};
|
|
620
|
+
function citationsOf(value) {
|
|
621
|
+
return cellList(value).filter(
|
|
622
|
+
(v) => typeof v === "object" && v !== null && typeof v.doc_ext_id === "string"
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
var MORE_CHIP = "inline-flex h-[22px] shrink-0 items-center rounded-md border border-border bg-muted/50 px-1.5 text-xs text-muted-foreground";
|
|
626
|
+
function SourcesCell({
|
|
627
|
+
value,
|
|
628
|
+
titles,
|
|
629
|
+
onOpen,
|
|
630
|
+
openLabel,
|
|
631
|
+
moreLabel = defaultMoreLabel,
|
|
632
|
+
rowHeight
|
|
633
|
+
}) {
|
|
634
|
+
const cites = citationsOf(value);
|
|
635
|
+
const chips = cites.map((c) => {
|
|
636
|
+
const count = c.chunks?.length ?? 0;
|
|
637
|
+
return { name: titleOf(c.doc_ext_id, titles), count: count > 0 ? `(${count})` : void 0 };
|
|
638
|
+
});
|
|
639
|
+
const names = chips.map((chip) => chip.count ? `${chip.name} ${chip.count}` : chip.name);
|
|
640
|
+
const rows = rowHeight === void 0 ? 1 : Math.max(1, Math.floor((rowHeight - CELL_PAD_Y + CHIP_GAP) / (CHIP_HEIGHT + CHIP_GAP)));
|
|
641
|
+
const row = react.useRef(null);
|
|
642
|
+
const [hidden, setHidden] = react.useState(0);
|
|
643
|
+
const signature = cites.map((c) => c.doc_ext_id).join("|");
|
|
644
|
+
react.useLayoutEffect(() => {
|
|
645
|
+
const el = row.current;
|
|
646
|
+
if (!el) return;
|
|
647
|
+
const measure = () => {
|
|
648
|
+
const next = hiddenAfterRows(
|
|
649
|
+
Array.from(el.children, (child) => child.offsetTop),
|
|
650
|
+
rows
|
|
651
|
+
);
|
|
652
|
+
setHidden((prev) => prev === next ? prev : next);
|
|
653
|
+
};
|
|
654
|
+
measure();
|
|
655
|
+
return chunkPPCATBOY_cjs.observeResize(el, measure);
|
|
656
|
+
}, [signature, titles, rows]);
|
|
657
|
+
if (cites.length === 0) return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2013" });
|
|
658
|
+
const more = hidden > 0 ? names.slice(-hidden).join("\n") : void 0;
|
|
659
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full min-w-0 items-center gap-1", children: [
|
|
660
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
661
|
+
"div",
|
|
662
|
+
{
|
|
663
|
+
ref: row,
|
|
664
|
+
className: "flex min-w-0 flex-1 flex-wrap content-start gap-1 overflow-hidden",
|
|
665
|
+
style: { maxHeight: rows * CHIP_HEIGHT + (rows - 1) * CHIP_GAP },
|
|
666
|
+
children: cites.map((c, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
667
|
+
LinkChip,
|
|
668
|
+
{
|
|
669
|
+
kind: "document",
|
|
670
|
+
label: chips[i].name,
|
|
671
|
+
suffix: chips[i].count,
|
|
672
|
+
onOpen,
|
|
673
|
+
openLabel: onOpen && openLabel ? openLabel(names[i]) : void 0,
|
|
674
|
+
testId: `database-source-chip-${citationTestId(cites, i)}`,
|
|
675
|
+
className: "max-w-full"
|
|
676
|
+
},
|
|
677
|
+
citationKey(cites, i)
|
|
678
|
+
))
|
|
679
|
+
}
|
|
680
|
+
),
|
|
681
|
+
hidden > 0 && (onOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
682
|
+
"button",
|
|
683
|
+
{
|
|
684
|
+
type: "button",
|
|
685
|
+
title: more,
|
|
686
|
+
"aria-label": moreLabel(hidden),
|
|
687
|
+
"data-testid": "database-source-more",
|
|
688
|
+
onClick: (e) => {
|
|
689
|
+
e.stopPropagation();
|
|
690
|
+
onOpen();
|
|
691
|
+
},
|
|
692
|
+
onDoubleClick: (e) => e.stopPropagation(),
|
|
693
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
694
|
+
className: `${MORE_CHIP} hover:bg-muted`,
|
|
695
|
+
children: `+${hidden}`
|
|
696
|
+
}
|
|
697
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", { title: more, "data-testid": "database-source-more", className: MORE_CHIP, children: `+${hidden}` }))
|
|
698
|
+
] });
|
|
699
|
+
}
|
|
26
700
|
var sourceTestId = (docId) => `database-source-${docId}`;
|
|
27
701
|
function SourcesField({ value, titles, onOpenDocument, testId }) {
|
|
28
|
-
const cites =
|
|
702
|
+
const cites = citationsOf(value);
|
|
29
703
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": testId, className: "flex min-w-0 flex-col gap-2", children: cites.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: "No sources" }) : cites.map((c, i) => {
|
|
30
704
|
const count = c.chunks?.length ?? 0;
|
|
31
705
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
-
|
|
706
|
+
chunk26KJYXYH_cjs.FactSourceGroup,
|
|
33
707
|
{
|
|
34
|
-
docId:
|
|
708
|
+
docId: citationTestId(cites, i),
|
|
35
709
|
document: /* @__PURE__ */ jsxRuntime.jsx(
|
|
36
|
-
|
|
710
|
+
LinkChip,
|
|
37
711
|
{
|
|
38
712
|
kind: "document",
|
|
39
|
-
label:
|
|
713
|
+
label: titleOf(c.doc_ext_id, titles),
|
|
40
714
|
onOpen: onOpenDocument ? () => onOpenDocument(c.doc_ext_id) : void 0
|
|
41
715
|
}
|
|
42
716
|
),
|
|
@@ -45,10 +719,607 @@ function SourcesField({ value, titles, onOpenDocument, testId }) {
|
|
|
45
719
|
labels: { wholeDocument: "Whole document" },
|
|
46
720
|
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "px-2 text-xs text-muted-foreground", children: count === 1 ? "1 passage" : `${count} passages` })
|
|
47
721
|
},
|
|
48
|
-
|
|
722
|
+
citationKey(cites, i)
|
|
49
723
|
);
|
|
50
724
|
}) });
|
|
51
725
|
}
|
|
726
|
+
function DateSpanField({ value, onCommit, idPrefix }) {
|
|
727
|
+
const baseline = chunkGISMY7J7_cjs.factDateSpanToFields(value.start, value.end, value.timezone);
|
|
728
|
+
const [draft, setDraft] = react.useState(baseline);
|
|
729
|
+
react.useEffect(
|
|
730
|
+
() => setDraft(chunkGISMY7J7_cjs.factDateSpanToFields(value.start, value.end, value.timezone)),
|
|
731
|
+
[value.start, value.end, value.timezone]
|
|
732
|
+
);
|
|
733
|
+
const cancelled = react.useRef(false);
|
|
734
|
+
const commit = () => {
|
|
735
|
+
if (cancelled.current) {
|
|
736
|
+
cancelled.current = false;
|
|
737
|
+
setDraft(baseline);
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
if (JSON.stringify(draft) === JSON.stringify(baseline)) return;
|
|
741
|
+
const span = chunkGISMY7J7_cjs.factDateFieldsToSpan(draft);
|
|
742
|
+
onCommit({ start: span.date, end: span.date_end, timezone: span.timezone });
|
|
743
|
+
};
|
|
744
|
+
return (
|
|
745
|
+
// The popover is drawn elsewhere on the page, but its keys still pass through here.
|
|
746
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
747
|
+
"div",
|
|
748
|
+
{
|
|
749
|
+
onKeyDownCapture: (e) => {
|
|
750
|
+
if (e.key === "Escape") cancelled.current = true;
|
|
751
|
+
},
|
|
752
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
753
|
+
chunk26KJYXYH_cjs.FactDateInput,
|
|
754
|
+
{
|
|
755
|
+
value: draft,
|
|
756
|
+
onChange: setDraft,
|
|
757
|
+
idPrefix,
|
|
758
|
+
onOpenChange: (open) => {
|
|
759
|
+
if (open) cancelled.current = false;
|
|
760
|
+
else commit();
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
)
|
|
764
|
+
}
|
|
765
|
+
)
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
var TYPED_DATE = /^\d{4}(-\d{2})?(-\d{2})?$/;
|
|
769
|
+
var DEFAULT_DATE_SPAN_EDITOR_LABELS = {
|
|
770
|
+
edit: (name) => `Edit ${name}`,
|
|
771
|
+
invalid: "Enter a date as YYYY, YYYY-MM or YYYY-MM-DD.",
|
|
772
|
+
placeholder: "YYYY, YYYY-MM or YYYY-MM-DD"
|
|
773
|
+
};
|
|
774
|
+
var startText = (value, end, timezone) => {
|
|
775
|
+
const start = typeof value === "string" ? value : value?.start;
|
|
776
|
+
if (typeof start !== "string") return "";
|
|
777
|
+
return chunkGISMY7J7_cjs.factDateSpanToFields(start, end, timezone).date || start.slice(0, 10);
|
|
778
|
+
};
|
|
779
|
+
var typedTime = (typed) => Date.parse(`${typed}${"-01-01".slice(typed.length - 4)}`);
|
|
780
|
+
var textOf = (v) => typeof v === "string" && v ? v : null;
|
|
781
|
+
function DateSpanCellEditor({
|
|
782
|
+
value,
|
|
783
|
+
data,
|
|
784
|
+
endColumnId,
|
|
785
|
+
timezoneColumnId,
|
|
786
|
+
labels,
|
|
787
|
+
columnName = "",
|
|
788
|
+
onValueChange,
|
|
789
|
+
stopEditing
|
|
790
|
+
}) {
|
|
791
|
+
const l = { ...DEFAULT_DATE_SPAN_EDITOR_LABELS, ...labels };
|
|
792
|
+
const [original] = react.useState(value);
|
|
793
|
+
const [storedEnd] = react.useState(
|
|
794
|
+
() => textOf(endColumnId ? data?.values[endColumnId] : value?.end)
|
|
795
|
+
);
|
|
796
|
+
const [storedZone] = react.useState(
|
|
797
|
+
() => textOf(
|
|
798
|
+
timezoneColumnId ? data?.values[timezoneColumnId] : value?.timezone
|
|
799
|
+
)
|
|
800
|
+
);
|
|
801
|
+
const [opened] = react.useState(() => startText(value, storedEnd, storedZone));
|
|
802
|
+
const [text, setText] = react.useState(opened);
|
|
803
|
+
const [invalid, setInvalid] = react.useState(false);
|
|
804
|
+
const input = react.useRef(null);
|
|
805
|
+
react.useEffect(() => input.current?.focus(), []);
|
|
806
|
+
const spanFor = (typed) => {
|
|
807
|
+
if (!typed) return { start: null, end: null, timezone: null };
|
|
808
|
+
const keep = storedEnd !== null && typedTime(typed) <= Date.parse(storedEnd);
|
|
809
|
+
return { start: typed, end: keep ? storedEnd : null, timezone: keep ? storedZone : null };
|
|
810
|
+
};
|
|
811
|
+
const follow = (next) => {
|
|
812
|
+
const typed = next.trim();
|
|
813
|
+
if ((!typed || TYPED_DATE.test(typed)) && typed !== opened) {
|
|
814
|
+
onValueChange(spanFor(typed));
|
|
815
|
+
} else {
|
|
816
|
+
onValueChange(original);
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
const onKeyDown = (e) => {
|
|
820
|
+
if (e.key === "Escape") {
|
|
821
|
+
e.stopPropagation();
|
|
822
|
+
stopEditing(true);
|
|
823
|
+
} else if (e.key === "Enter") {
|
|
824
|
+
e.preventDefault();
|
|
825
|
+
e.stopPropagation();
|
|
826
|
+
const typed = text.trim();
|
|
827
|
+
if (typed && !TYPED_DATE.test(typed)) {
|
|
828
|
+
setInvalid(true);
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
if (typed === opened) {
|
|
832
|
+
stopEditing(true);
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
setTimeout(() => stopEditing(), 0);
|
|
836
|
+
}
|
|
837
|
+
};
|
|
838
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative h-full", children: [
|
|
839
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
840
|
+
ui.Input,
|
|
841
|
+
{
|
|
842
|
+
ref: input,
|
|
843
|
+
value: text,
|
|
844
|
+
"aria-label": l.edit(columnName),
|
|
845
|
+
"aria-invalid": invalid,
|
|
846
|
+
"aria-describedby": invalid ? "database-date-span-error" : void 0,
|
|
847
|
+
placeholder: l.placeholder,
|
|
848
|
+
onChange: (e) => {
|
|
849
|
+
setText(e.target.value);
|
|
850
|
+
follow(e.target.value);
|
|
851
|
+
setInvalid(false);
|
|
852
|
+
},
|
|
853
|
+
onKeyDown,
|
|
854
|
+
className: "h-full rounded-none",
|
|
855
|
+
"data-testid": "database-date-span-editor"
|
|
856
|
+
}
|
|
857
|
+
),
|
|
858
|
+
invalid && /* @__PURE__ */ jsxRuntime.jsx(
|
|
859
|
+
"p",
|
|
860
|
+
{
|
|
861
|
+
id: "database-date-span-error",
|
|
862
|
+
role: "alert",
|
|
863
|
+
className: "absolute left-0 top-full z-10 rounded-sm border bg-popover px-2 py-1 text-xs text-destructive shadow-md",
|
|
864
|
+
children: l.invalid
|
|
865
|
+
}
|
|
866
|
+
)
|
|
867
|
+
] });
|
|
868
|
+
}
|
|
869
|
+
function SelectChip({ value }) {
|
|
870
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
871
|
+
"span",
|
|
872
|
+
{
|
|
873
|
+
className: ui.cn(
|
|
874
|
+
"inline-flex max-w-full items-center truncate rounded-md px-2 py-0.5 text-xs font-medium",
|
|
875
|
+
optionTone(value)
|
|
876
|
+
),
|
|
877
|
+
children: value
|
|
878
|
+
}
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
function SelectCellEditor(props) {
|
|
882
|
+
const { value, onValueChange, stopEditing, options, clearLabel = "Clear" } = props;
|
|
883
|
+
const items = [...options, null];
|
|
884
|
+
const [active, setActive] = react.useState(() => Math.max(0, options.indexOf(String(value ?? ""))));
|
|
885
|
+
const list = react.useRef(null);
|
|
886
|
+
react.useEffect(() => list.current?.focus(), []);
|
|
887
|
+
const pick = (option) => {
|
|
888
|
+
onValueChange(option);
|
|
889
|
+
setTimeout(() => stopEditing(), 0);
|
|
890
|
+
};
|
|
891
|
+
const onKeyDown = (e) => {
|
|
892
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
893
|
+
e.preventDefault();
|
|
894
|
+
e.stopPropagation();
|
|
895
|
+
const step = e.key === "ArrowDown" ? 1 : -1;
|
|
896
|
+
setActive((i) => (i + step + items.length) % items.length);
|
|
897
|
+
} else if (e.key === "Enter") {
|
|
898
|
+
e.preventDefault();
|
|
899
|
+
e.stopPropagation();
|
|
900
|
+
pick(items[active]);
|
|
901
|
+
}
|
|
902
|
+
};
|
|
903
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
904
|
+
"div",
|
|
905
|
+
{
|
|
906
|
+
ref: list,
|
|
907
|
+
role: "listbox",
|
|
908
|
+
tabIndex: -1,
|
|
909
|
+
onKeyDown,
|
|
910
|
+
"data-testid": "database-select-editor",
|
|
911
|
+
className: "flex min-w-44 flex-col gap-0.5 rounded-md border border-border bg-popover p-1 shadow-md outline-none",
|
|
912
|
+
children: items.map((option, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
913
|
+
"button",
|
|
914
|
+
{
|
|
915
|
+
type: "button",
|
|
916
|
+
role: "option",
|
|
917
|
+
"aria-selected": option === value,
|
|
918
|
+
onMouseEnter: () => setActive(i),
|
|
919
|
+
onClick: () => pick(option),
|
|
920
|
+
"data-testid": option === null ? "database-select-clear" : `database-select-option-${option}`,
|
|
921
|
+
className: ui.cn(
|
|
922
|
+
"flex items-center gap-2 rounded px-2 py-1 text-left text-sm",
|
|
923
|
+
i === active && "bg-muted"
|
|
924
|
+
),
|
|
925
|
+
children: [
|
|
926
|
+
option === null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: clearLabel }) : /* @__PURE__ */ jsxRuntime.jsx(SelectChip, { value: option }),
|
|
927
|
+
option !== null && option === value && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "ml-auto size-3.5" })
|
|
928
|
+
]
|
|
929
|
+
},
|
|
930
|
+
option ?? "__clear"
|
|
931
|
+
))
|
|
932
|
+
}
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
var DEFAULT_DATABASE_COLUMN_LABELS = {
|
|
936
|
+
addColumn: "Add a column",
|
|
937
|
+
columnSettings: (name) => `${name} column settings`,
|
|
938
|
+
computed: "Computed from a relation (read-only)",
|
|
939
|
+
openRow: "Open row",
|
|
940
|
+
dateSpanEditor: DEFAULT_DATE_SPAN_EDITOR_LABELS,
|
|
941
|
+
openRowFromSource: (title) => `${title}: open the row`
|
|
942
|
+
};
|
|
943
|
+
var ADD_COLUMN_COL_ID = "__add_column";
|
|
944
|
+
var OPEN_ROW_COL_ID = "__open_row";
|
|
945
|
+
var ROW_ACTIONS_COL_ID = "__row_actions";
|
|
946
|
+
var COLUMN_TYPE_ICONS = {
|
|
947
|
+
text: lucideReact.Type,
|
|
948
|
+
number: lucideReact.Hash,
|
|
949
|
+
date: lucideReact.CalendarDays,
|
|
950
|
+
checkbox: lucideReact.CheckSquare,
|
|
951
|
+
select: lucideReact.ChevronDown,
|
|
952
|
+
person: lucideReact.UserRound,
|
|
953
|
+
document: COLUMN_KITS.source.icon,
|
|
954
|
+
relation: lucideReact.ArrowUpRight,
|
|
955
|
+
lookup: lucideReact.Search,
|
|
956
|
+
rollup: lucideReact.Sigma,
|
|
957
|
+
label: COLUMN_KITS.label.icon,
|
|
958
|
+
source: COLUMN_KITS.source.icon
|
|
959
|
+
};
|
|
960
|
+
var WIDTHS = {
|
|
961
|
+
text: 220,
|
|
962
|
+
number: 130,
|
|
963
|
+
date: 140,
|
|
964
|
+
checkbox: 110,
|
|
965
|
+
select: 160,
|
|
966
|
+
person: 180,
|
|
967
|
+
document: 240,
|
|
968
|
+
relation: 240,
|
|
969
|
+
lookup: 200,
|
|
970
|
+
rollup: 130,
|
|
971
|
+
label: COLUMN_KITS.label.width,
|
|
972
|
+
source: COLUMN_KITS.source.width
|
|
973
|
+
};
|
|
974
|
+
function HeaderLabel({
|
|
975
|
+
dbColumn: column,
|
|
976
|
+
onEdit,
|
|
977
|
+
settingsLabel: label,
|
|
978
|
+
computedLabel
|
|
979
|
+
}) {
|
|
980
|
+
const Icon = COLUMN_TYPE_ICONS[column.type];
|
|
981
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "group/dbh flex min-w-0 items-center gap-1.5", children: [
|
|
982
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-3.5 shrink-0 text-muted-foreground", "aria-hidden": true }),
|
|
983
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-[12.5px] font-medium", children: column.name }),
|
|
984
|
+
isComputedColumn(column) && /* @__PURE__ */ jsxRuntime.jsx("span", { title: computedLabel, "data-testid": `database-column-computed-${column.id}`, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lock, { className: "size-3 shrink-0 text-muted-foreground/70", "aria-label": computedLabel }) }),
|
|
985
|
+
onEdit && /* @__PURE__ */ jsxRuntime.jsx(
|
|
986
|
+
"button",
|
|
987
|
+
{
|
|
988
|
+
type: "button",
|
|
989
|
+
"aria-label": label,
|
|
990
|
+
title: label,
|
|
991
|
+
"data-testid": `database-column-settings-${column.id}`,
|
|
992
|
+
onClick: (e) => {
|
|
993
|
+
e.stopPropagation();
|
|
994
|
+
onEdit();
|
|
995
|
+
},
|
|
996
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
997
|
+
className: "ml-auto rounded p-0.5 text-muted-foreground opacity-0 hover:bg-muted hover:text-foreground focus-visible:opacity-100 group-hover/dbh:opacity-100",
|
|
998
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "size-3.5" })
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] });
|
|
1002
|
+
}
|
|
1003
|
+
function AddColumnHeader({ addLabel, onAddColumn }) {
|
|
1004
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1005
|
+
"button",
|
|
1006
|
+
{
|
|
1007
|
+
type: "button",
|
|
1008
|
+
"aria-label": addLabel,
|
|
1009
|
+
title: addLabel,
|
|
1010
|
+
"data-testid": "database-add-column",
|
|
1011
|
+
onClick: onAddColumn,
|
|
1012
|
+
className: "flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
1013
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" })
|
|
1014
|
+
}
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
function columnWidth(column) {
|
|
1018
|
+
const header = Math.round(column.name.length * 8) + 76 + (isComputedColumn(column) ? 16 : 0);
|
|
1019
|
+
return Math.min(320, Math.max(WIDTHS[column.type], header));
|
|
1020
|
+
}
|
|
1021
|
+
var positive = (n) => typeof n === "number" && Number.isFinite(n) && n > 0 ? n : void 0;
|
|
1022
|
+
function sizing(column) {
|
|
1023
|
+
const grow = positive(column.grow);
|
|
1024
|
+
if (grow !== void 0) {
|
|
1025
|
+
return { flex: grow, minWidth: positive(column.minWidth) ?? columnWidth(column) };
|
|
1026
|
+
}
|
|
1027
|
+
return {
|
|
1028
|
+
width: positive(column.width) ?? columnWidth(column),
|
|
1029
|
+
minWidth: positive(column.minWidth) ?? 90
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
function canEditColumn(column, sources) {
|
|
1033
|
+
if (isComputedColumn(column) || column.locked) return false;
|
|
1034
|
+
const kit = kitOf(column.type);
|
|
1035
|
+
if (kit) return kit.canEditInGrid(column, sources);
|
|
1036
|
+
if (column.type === "person") return Boolean(sources?.members);
|
|
1037
|
+
if (column.type === "document") return Boolean(sources?.documents);
|
|
1038
|
+
if (column.type === "relation") return Boolean(sources?.searchRows && column.relation);
|
|
1039
|
+
return true;
|
|
1040
|
+
}
|
|
1041
|
+
function editorFor(column, sources, dateSpanLabels) {
|
|
1042
|
+
if (kitOf(column.type)) return {};
|
|
1043
|
+
const pick = (params) => ({
|
|
1044
|
+
cellEditor: PickCellEditor,
|
|
1045
|
+
cellEditorPopup: true,
|
|
1046
|
+
cellEditorParams: params
|
|
1047
|
+
});
|
|
1048
|
+
switch (column.type) {
|
|
1049
|
+
case "number":
|
|
1050
|
+
return { cellEditor: "agNumberCellEditor", cellEditorParams: { showStepperButtons: false } };
|
|
1051
|
+
case "date":
|
|
1052
|
+
return column.span ? {
|
|
1053
|
+
cellEditor: DateSpanCellEditor,
|
|
1054
|
+
cellEditorParams: {
|
|
1055
|
+
endColumnId: column.span.endColumnId,
|
|
1056
|
+
timezoneColumnId: column.span.timezoneColumnId,
|
|
1057
|
+
labels: dateSpanLabels,
|
|
1058
|
+
columnName: column.name
|
|
1059
|
+
}
|
|
1060
|
+
} : { cellEditor: "agDateStringCellEditor" };
|
|
1061
|
+
case "checkbox":
|
|
1062
|
+
return { cellEditor: "agCheckboxCellEditor" };
|
|
1063
|
+
case "select":
|
|
1064
|
+
return {
|
|
1065
|
+
cellEditor: SelectCellEditor,
|
|
1066
|
+
cellEditorPopup: true,
|
|
1067
|
+
cellEditorParams: { options: column.options ?? [] }
|
|
1068
|
+
};
|
|
1069
|
+
case "person":
|
|
1070
|
+
return pick({ kind: "person", options: sources?.members ?? [] });
|
|
1071
|
+
case "document":
|
|
1072
|
+
return pick({ kind: "document", options: sources?.documents ?? [] });
|
|
1073
|
+
case "relation": {
|
|
1074
|
+
const target = column.relation?.database_id;
|
|
1075
|
+
const searchRows = sources?.searchRows;
|
|
1076
|
+
return pick({
|
|
1077
|
+
kind: "relation",
|
|
1078
|
+
search: target && searchRows ? (q) => searchRows(target, q) : void 0
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
case "lookup":
|
|
1082
|
+
case "rollup":
|
|
1083
|
+
return {};
|
|
1084
|
+
default:
|
|
1085
|
+
return { cellEditor: "agTextCellEditor" };
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
var EMPTY_ROW = { id: "", values: {} };
|
|
1089
|
+
var asText = (v) => typeof v === "string" && v ? v : null;
|
|
1090
|
+
function rendererFor(column, locale, sources, readOnly, isCellEditable, onOpenRow, l) {
|
|
1091
|
+
const kit = kitOf(column.type);
|
|
1092
|
+
if (kit) {
|
|
1093
|
+
const valueFormatter = (p) => kit.format(p.value, p.data ?? EMPTY_ROW, column);
|
|
1094
|
+
if (column.type === "label") {
|
|
1095
|
+
const editableFor = (row) => !readOnly && column.editIn !== "row" && canEditColumn(column, sources) && (!row || !isCellEditable || isCellEditable(row, column));
|
|
1096
|
+
return {
|
|
1097
|
+
valueFormatter,
|
|
1098
|
+
cellRenderer: (p) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1099
|
+
LabelsCell,
|
|
1100
|
+
{
|
|
1101
|
+
value: p.value,
|
|
1102
|
+
titles: p.data?.titles,
|
|
1103
|
+
labels: labelSourceFor(sources?.labels, column),
|
|
1104
|
+
onChange: editableFor(p.data) ? (ids) => p.node.setDataValue(column.id, ids) : void 0,
|
|
1105
|
+
rowHeight: p.node?.rowHeight ?? void 0
|
|
1106
|
+
}
|
|
1107
|
+
)
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
return {
|
|
1111
|
+
valueFormatter,
|
|
1112
|
+
cellRenderer: (p) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1113
|
+
SourcesCell,
|
|
1114
|
+
{
|
|
1115
|
+
value: p.value,
|
|
1116
|
+
titles: p.data?.titles,
|
|
1117
|
+
openLabel: l.openRowFromSource,
|
|
1118
|
+
onOpen: onOpenRow && p.data ? () => onOpenRow(p.data, { focusColumn: column.id }) : void 0,
|
|
1119
|
+
rowHeight: p.node?.rowHeight ?? void 0
|
|
1120
|
+
}
|
|
1121
|
+
)
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
switch (column.type) {
|
|
1125
|
+
case "checkbox":
|
|
1126
|
+
return {
|
|
1127
|
+
cellRenderer: "agCheckboxCellRenderer",
|
|
1128
|
+
cellClass: "flex items-center justify-center"
|
|
1129
|
+
};
|
|
1130
|
+
case "select":
|
|
1131
|
+
return {
|
|
1132
|
+
cellRenderer: (p) => typeof p.value === "string" && p.value ? /* @__PURE__ */ jsxRuntime.jsx(SelectChip, { value: p.value }) : null
|
|
1133
|
+
};
|
|
1134
|
+
case "number":
|
|
1135
|
+
return {
|
|
1136
|
+
cellClass: "cell-numeric",
|
|
1137
|
+
valueFormatter: (p) => formatCell(p.value, "number", locale)
|
|
1138
|
+
};
|
|
1139
|
+
case "rollup":
|
|
1140
|
+
return {
|
|
1141
|
+
cellClass: "cell-numeric text-muted-foreground",
|
|
1142
|
+
valueFormatter: (p) => formatCell(p.value, "rollup", locale)
|
|
1143
|
+
};
|
|
1144
|
+
case "date": {
|
|
1145
|
+
const span = column.span;
|
|
1146
|
+
if (span)
|
|
1147
|
+
return {
|
|
1148
|
+
valueFormatter: (p) => typeof p.value === "string" && p.value ? chunk66IOCKWS_cjs.formatSpan(
|
|
1149
|
+
p.value,
|
|
1150
|
+
asText(p.data?.values[span.endColumnId]),
|
|
1151
|
+
span.timezoneColumnId ? asText(p.data?.values[span.timezoneColumnId]) : null
|
|
1152
|
+
) : ""
|
|
1153
|
+
};
|
|
1154
|
+
return {
|
|
1155
|
+
valueFormatter: (p) => formatCell(p.value, "date", locale)
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
case "person":
|
|
1159
|
+
return {
|
|
1160
|
+
cellRenderer: (p) => /* @__PURE__ */ jsxRuntime.jsx(PersonCell, { value: p.value, titles: p.data?.titles })
|
|
1161
|
+
};
|
|
1162
|
+
case "document":
|
|
1163
|
+
case "relation":
|
|
1164
|
+
return {
|
|
1165
|
+
cellRenderer: (p) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1166
|
+
LinkChipsCell,
|
|
1167
|
+
{
|
|
1168
|
+
value: p.value,
|
|
1169
|
+
titles: p.data?.titles,
|
|
1170
|
+
kind: column.type === "document" ? "document" : "relation",
|
|
1171
|
+
onOpenDocument: sources?.onOpenDocument
|
|
1172
|
+
}
|
|
1173
|
+
)
|
|
1174
|
+
};
|
|
1175
|
+
case "lookup":
|
|
1176
|
+
return {
|
|
1177
|
+
cellRenderer: (p) => /* @__PURE__ */ jsxRuntime.jsx(LookupCell, { value: p.value, titles: p.data?.titles, locale })
|
|
1178
|
+
};
|
|
1179
|
+
default:
|
|
1180
|
+
return { cellClass: "database-cell-text" };
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
function setSpan(row, columnId, span, newValue) {
|
|
1184
|
+
if ((typeof newValue === "string" || newValue === null) && sameCellValue(asText(newValue), row.values[columnId] ?? null)) {
|
|
1185
|
+
return false;
|
|
1186
|
+
}
|
|
1187
|
+
const next = typeof newValue === "object" && newValue !== null ? newValue : { start: asText(newValue), end: null, timezone: null };
|
|
1188
|
+
const writes = [
|
|
1189
|
+
[columnId, next.start],
|
|
1190
|
+
[span.endColumnId, next.end],
|
|
1191
|
+
...span.timezoneColumnId ? [[span.timezoneColumnId, next.timezone]] : []
|
|
1192
|
+
];
|
|
1193
|
+
const changed = writes.filter(([id, v]) => !sameCellValue(v, row.values[id] ?? null));
|
|
1194
|
+
if (changed.length === 0) return false;
|
|
1195
|
+
row.values = { ...row.values, ...Object.fromEntries(writes) };
|
|
1196
|
+
return true;
|
|
1197
|
+
}
|
|
1198
|
+
function createDatabaseColumns(columns, options = {}) {
|
|
1199
|
+
const {
|
|
1200
|
+
readOnly,
|
|
1201
|
+
onEditColumn,
|
|
1202
|
+
onAddColumn,
|
|
1203
|
+
onOpenRow,
|
|
1204
|
+
locale,
|
|
1205
|
+
sources,
|
|
1206
|
+
isCellEditable,
|
|
1207
|
+
renderRowActions
|
|
1208
|
+
} = options;
|
|
1209
|
+
const l = { ...DEFAULT_DATABASE_COLUMN_LABELS, ...options.labels };
|
|
1210
|
+
const openRow = onOpenRow && columns.length > 0 ? [
|
|
1211
|
+
{
|
|
1212
|
+
colId: OPEN_ROW_COL_ID,
|
|
1213
|
+
headerName: "",
|
|
1214
|
+
width: 40,
|
|
1215
|
+
minWidth: 40,
|
|
1216
|
+
maxWidth: 40,
|
|
1217
|
+
resizable: false,
|
|
1218
|
+
sortable: false,
|
|
1219
|
+
editable: false,
|
|
1220
|
+
suppressMovable: true,
|
|
1221
|
+
// Pinned: the button stays in view however far the table scrolls.
|
|
1222
|
+
pinned: "left",
|
|
1223
|
+
lockPinned: true,
|
|
1224
|
+
lockPosition: "left",
|
|
1225
|
+
cellClass: "flex items-center justify-center !px-0",
|
|
1226
|
+
valueGetter: () => null,
|
|
1227
|
+
cellRenderer: (p) => p.data ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1228
|
+
"button",
|
|
1229
|
+
{
|
|
1230
|
+
type: "button",
|
|
1231
|
+
"aria-label": l.openRow,
|
|
1232
|
+
title: l.openRow,
|
|
1233
|
+
"data-testid": `database-open-row-${p.data.id}`,
|
|
1234
|
+
onClick: (e) => {
|
|
1235
|
+
e.stopPropagation();
|
|
1236
|
+
if (p.data) onOpenRow(p.data);
|
|
1237
|
+
},
|
|
1238
|
+
onDoubleClick: (e) => e.stopPropagation(),
|
|
1239
|
+
className: "flex size-6 items-center justify-center rounded text-muted-foreground/70 hover:bg-muted hover:text-foreground",
|
|
1240
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize2, { className: "size-3.5" })
|
|
1241
|
+
}
|
|
1242
|
+
) : null
|
|
1243
|
+
}
|
|
1244
|
+
] : [];
|
|
1245
|
+
const defs = columns.map((column) => {
|
|
1246
|
+
const gridEditable = !readOnly && !kitOf(column.type) && column.editIn !== "row" && canEditColumn(column, sources);
|
|
1247
|
+
return {
|
|
1248
|
+
colId: column.id,
|
|
1249
|
+
headerName: column.name,
|
|
1250
|
+
...sizing(column),
|
|
1251
|
+
resizable: true,
|
|
1252
|
+
sortable: true,
|
|
1253
|
+
editable: isCellEditable ? (p) => gridEditable && (!p.data || isCellEditable(p.data, column)) : gridEditable,
|
|
1254
|
+
// The grid's own type inference must not second-guess the database's column type.
|
|
1255
|
+
cellDataType: false,
|
|
1256
|
+
headerComponentParams: {
|
|
1257
|
+
innerHeaderComponent: HeaderLabel,
|
|
1258
|
+
innerHeaderComponentParams: {
|
|
1259
|
+
dbColumn: column,
|
|
1260
|
+
settingsLabel: l.columnSettings(column.name),
|
|
1261
|
+
computedLabel: l.computed,
|
|
1262
|
+
onEdit: !readOnly && onEditColumn ? () => onEditColumn(column) : void 0
|
|
1263
|
+
}
|
|
1264
|
+
},
|
|
1265
|
+
// An empty checkbox reads as unticked (not indeterminate).
|
|
1266
|
+
valueGetter: (p) => column.type === "checkbox" ? p.data?.values[column.id] === true : p.data?.values[column.id] ?? null,
|
|
1267
|
+
// Edits land in the row's values as the API would store them; the host saves them in
|
|
1268
|
+
// onCellValueChanged and puts the server's normalised row back.
|
|
1269
|
+
valueSetter: (p) => {
|
|
1270
|
+
if (!p.data) return false;
|
|
1271
|
+
const span = column.span;
|
|
1272
|
+
if (span) return setSpan(p.data, column.id, span, p.newValue);
|
|
1273
|
+
const next = toApiValue(p.newValue, column.type);
|
|
1274
|
+
if (sameCellValue(next, p.oldValue, column.type)) return false;
|
|
1275
|
+
p.data.values = { ...p.data.values, [column.id]: next };
|
|
1276
|
+
return true;
|
|
1277
|
+
},
|
|
1278
|
+
comparator: (a, b, nodeA, nodeB) => compareCells(a, b, column.type, nodeA?.data?.titles, nodeB?.data?.titles),
|
|
1279
|
+
getQuickFilterText: (p) => formatCell(p.value, column.type, locale, p.data?.titles),
|
|
1280
|
+
...editorFor(column, sources, l.dateSpanEditor),
|
|
1281
|
+
...rendererFor(column, locale, sources, readOnly, isCellEditable, onOpenRow, l)
|
|
1282
|
+
};
|
|
1283
|
+
});
|
|
1284
|
+
defs.unshift(...openRow);
|
|
1285
|
+
if (renderRowActions && columns.length > 0) {
|
|
1286
|
+
defs.push({
|
|
1287
|
+
colId: ROW_ACTIONS_COL_ID,
|
|
1288
|
+
headerName: "",
|
|
1289
|
+
width: 40,
|
|
1290
|
+
minWidth: 40,
|
|
1291
|
+
maxWidth: 40,
|
|
1292
|
+
resizable: false,
|
|
1293
|
+
sortable: false,
|
|
1294
|
+
editable: false,
|
|
1295
|
+
suppressMovable: true,
|
|
1296
|
+
pinned: "right",
|
|
1297
|
+
lockPinned: true,
|
|
1298
|
+
cellClass: "flex items-center justify-center !px-0",
|
|
1299
|
+
valueGetter: () => null,
|
|
1300
|
+
cellRenderer: (p) => p.data ? renderRowActions(p.data) : null
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
if (!readOnly && onAddColumn) {
|
|
1304
|
+
defs.push({
|
|
1305
|
+
colId: ADD_COLUMN_COL_ID,
|
|
1306
|
+
width: 52,
|
|
1307
|
+
minWidth: 52,
|
|
1308
|
+
maxWidth: 52,
|
|
1309
|
+
resizable: false,
|
|
1310
|
+
sortable: false,
|
|
1311
|
+
editable: false,
|
|
1312
|
+
suppressMovable: true,
|
|
1313
|
+
// Pinned: on a wide table the add button stays in view instead of scrolling off the right.
|
|
1314
|
+
pinned: "right",
|
|
1315
|
+
lockPinned: true,
|
|
1316
|
+
headerComponent: AddColumnHeader,
|
|
1317
|
+
headerComponentParams: { addLabel: l.addColumn, onAddColumn },
|
|
1318
|
+
valueGetter: () => null
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
return defs;
|
|
1322
|
+
}
|
|
52
1323
|
var DEFAULT_COLUMN_CONFIG_LABELS = {
|
|
53
1324
|
relatedDatabase: "Related database",
|
|
54
1325
|
pickDatabase: "Pick a database",
|
|
@@ -92,7 +1363,7 @@ function ColumnSelect({
|
|
|
92
1363
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { value: value || void 0, onValueChange: onChange, children: [
|
|
93
1364
|
/* @__PURE__ */ jsxRuntime.jsx(ui.SelectTrigger, { "data-testid": testId, children: /* @__PURE__ */ jsxRuntime.jsx(ui.SelectValue, { placeholder }) }),
|
|
94
1365
|
/* @__PURE__ */ jsxRuntime.jsx(ui.SelectContent, { children: columns.map((c) => {
|
|
95
|
-
const Icon =
|
|
1366
|
+
const Icon = COLUMN_TYPE_ICONS[c.type];
|
|
96
1367
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: c.id, "data-testid": `${testId}-${c.id}`, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
97
1368
|
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4 text-muted-foreground" }),
|
|
98
1369
|
c.name
|
|
@@ -110,16 +1381,16 @@ function RelationFields({
|
|
|
110
1381
|
column,
|
|
111
1382
|
labels
|
|
112
1383
|
}) {
|
|
113
|
-
const
|
|
1384
|
+
const nameOf2 = (id) => databases.find((d) => d.id === id)?.name ?? (id === databaseId ? labels.thisDatabase : id);
|
|
114
1385
|
if (editing && column?.relation) {
|
|
115
|
-
const target2 =
|
|
1386
|
+
const target2 = nameOf2(column.relation.database_id);
|
|
116
1387
|
return /* @__PURE__ */ jsxRuntime.jsxs(Field, { label: labels.relatedDatabase, hint: labels.targetFixed, children: [
|
|
117
1388
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", "data-testid": "database-column-relation-target", children: target2 }),
|
|
118
1389
|
/* @__PURE__ */ jsxRuntime.jsx(Hint, { children: column.relation.two_way ? labels.pairedWith(target2) : labels.oneWay })
|
|
119
1390
|
] });
|
|
120
1391
|
}
|
|
121
1392
|
if (databases.length === 0) return /* @__PURE__ */ jsxRuntime.jsx(Hint, { children: labels.noDatabases });
|
|
122
|
-
const target = draft.database_id ?
|
|
1393
|
+
const target = draft.database_id ? nameOf2(draft.database_id) : "";
|
|
123
1394
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
124
1395
|
/* @__PURE__ */ jsxRuntime.jsx(Field, { label: labels.relatedDatabase, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
125
1396
|
ui.Select,
|
|
@@ -193,7 +1464,7 @@ function LookupFields({
|
|
|
193
1464
|
if (relations.length === 0)
|
|
194
1465
|
return /* @__PURE__ */ jsxRuntime.jsx(Hint, { testId: "database-column-no-relations", children: labels.noRelations });
|
|
195
1466
|
const shown = targetColumnsOf(draft.relation, columns, databases, databaseId).filter(
|
|
196
|
-
(c) => !
|
|
1467
|
+
(c) => !isComputedColumn(c) && c.type !== "label" && c.type !== "source"
|
|
197
1468
|
);
|
|
198
1469
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
199
1470
|
/* @__PURE__ */ jsxRuntime.jsx(Field, { label: labels.relation, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -251,7 +1522,7 @@ function RollupFields({
|
|
|
251
1522
|
onValueChange: (op) => onChange({ ...draft, op }),
|
|
252
1523
|
children: [
|
|
253
1524
|
/* @__PURE__ */ jsxRuntime.jsx(ui.SelectTrigger, { "data-testid": "database-column-rollup-op", children: /* @__PURE__ */ jsxRuntime.jsx(ui.SelectValue, {}) }),
|
|
254
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.SelectContent, { children:
|
|
1525
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.SelectContent, { children: DATABASE_ROLLUP_OPS.map((op) => /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: op, "data-testid": `database-column-rollup-op-${op}`, children: labels.ops[op] }, op)) })
|
|
255
1526
|
]
|
|
256
1527
|
}
|
|
257
1528
|
) }),
|
|
@@ -281,7 +1552,7 @@ var DEFAULT_DATABASE_ROW_DETAIL_LABELS = {
|
|
|
281
1552
|
submit: "Submit",
|
|
282
1553
|
addField: "New field"
|
|
283
1554
|
};
|
|
284
|
-
var
|
|
1555
|
+
var asText2 = (v) => typeof v === "string" && v ? v : null;
|
|
285
1556
|
function DraftInput({
|
|
286
1557
|
value,
|
|
287
1558
|
type,
|
|
@@ -399,12 +1670,12 @@ function DatabaseRowDetail({
|
|
|
399
1670
|
testId = "database-row-detail"
|
|
400
1671
|
}) {
|
|
401
1672
|
const l = { ...DEFAULT_DATABASE_ROW_DETAIL_LABELS, ...labels };
|
|
402
|
-
const title = ownTitle ?? (row ?
|
|
1673
|
+
const title = ownTitle ?? (row ? rowTitle(row, columns, locale) || l.untitled : "");
|
|
403
1674
|
const commit = (column, value, extra) => {
|
|
404
1675
|
if (!row || !onChange) return;
|
|
405
|
-
const next =
|
|
406
|
-
const siblingsSame = !extra || Object.entries(extra).every(([id, v]) =>
|
|
407
|
-
if (
|
|
1676
|
+
const next = toApiValue(value, column.type);
|
|
1677
|
+
const siblingsSame = !extra || Object.entries(extra).every(([id, v]) => sameCellValue(v ?? null, row.values[id] ?? null));
|
|
1678
|
+
if (sameCellValue(next, row.values[column.id], column.type) && siblingsSame) return;
|
|
408
1679
|
if (extra) onChange(row, column.id, next, extra);
|
|
409
1680
|
else onChange(row, column.id, next);
|
|
410
1681
|
};
|
|
@@ -412,28 +1683,28 @@ function DatabaseRowDetail({
|
|
|
412
1683
|
if (!row) return null;
|
|
413
1684
|
const value = row.values[column.id];
|
|
414
1685
|
const id = `${testId}-input-${column.id}`;
|
|
415
|
-
const editable = !readOnly && Boolean(onChange) &&
|
|
1686
|
+
const editable = !readOnly && Boolean(onChange) && canEditColumn(column, sources);
|
|
416
1687
|
const span = column.type === "date" ? column.span : void 0;
|
|
417
1688
|
const display = () => {
|
|
418
1689
|
switch (column.type) {
|
|
419
1690
|
case "label":
|
|
420
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1691
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LabelsCell, { value, titles: row.titles });
|
|
421
1692
|
case "date": {
|
|
422
|
-
const text = span ?
|
|
1693
|
+
const text = span ? chunk66IOCKWS_cjs.formatSpan(
|
|
423
1694
|
typeof value === "string" ? value : null,
|
|
424
|
-
|
|
425
|
-
span.timezoneColumnId ?
|
|
426
|
-
) :
|
|
1695
|
+
asText2(row.values[span.endColumnId]),
|
|
1696
|
+
span.timezoneColumnId ? asText2(row.values[span.timezoneColumnId]) : null
|
|
1697
|
+
) : formatCell(value, column.type, locale, row.titles);
|
|
427
1698
|
return text ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "break-words", children: text }) : null;
|
|
428
1699
|
}
|
|
429
1700
|
case "select":
|
|
430
|
-
return typeof value === "string" && value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1701
|
+
return typeof value === "string" && value ? /* @__PURE__ */ jsxRuntime.jsx(SelectChip, { value }) : null;
|
|
431
1702
|
case "person":
|
|
432
|
-
return
|
|
1703
|
+
return cellIds(value).length ? /* @__PURE__ */ jsxRuntime.jsx(PersonCell, { value, titles: row.titles }) : null;
|
|
433
1704
|
case "document":
|
|
434
1705
|
case "relation":
|
|
435
|
-
return
|
|
436
|
-
|
|
1706
|
+
return cellIds(value).length ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1707
|
+
LinkChipsCell,
|
|
437
1708
|
{
|
|
438
1709
|
value,
|
|
439
1710
|
titles: row.titles,
|
|
@@ -443,14 +1714,24 @@ function DatabaseRowDetail({
|
|
|
443
1714
|
}
|
|
444
1715
|
) : null;
|
|
445
1716
|
case "lookup":
|
|
446
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1717
|
+
return /* @__PURE__ */ jsxRuntime.jsx(LookupCell, { value, titles: row.titles, locale, wrap: true });
|
|
447
1718
|
default: {
|
|
448
|
-
const text =
|
|
1719
|
+
const text = formatCell(value, column.type, locale, row.titles);
|
|
449
1720
|
return text ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "break-words", children: text }) : null;
|
|
450
1721
|
}
|
|
451
1722
|
}
|
|
452
1723
|
};
|
|
453
1724
|
if (column.type === "source") {
|
|
1725
|
+
const editSources = sources?.renderSourcesEditor;
|
|
1726
|
+
if (editSources && !readOnly && onChange && !column.locked) {
|
|
1727
|
+
return editSources({
|
|
1728
|
+
testId: id,
|
|
1729
|
+
value: citationsOf(value),
|
|
1730
|
+
titles: row.titles,
|
|
1731
|
+
rowId: row.id,
|
|
1732
|
+
onChange: (next) => commit(column, next)
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
454
1735
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
455
1736
|
SourcesField,
|
|
456
1737
|
{
|
|
@@ -468,9 +1749,9 @@ function DatabaseRowDetail({
|
|
|
468
1749
|
{
|
|
469
1750
|
className: ui.cn(
|
|
470
1751
|
"flex min-h-8 min-w-0 items-center py-1 text-sm",
|
|
471
|
-
|
|
1752
|
+
isComputedColumn(column) && "text-muted-foreground"
|
|
472
1753
|
),
|
|
473
|
-
title:
|
|
1754
|
+
title: isComputedColumn(column) ? l.computed : void 0,
|
|
474
1755
|
"data-testid": id,
|
|
475
1756
|
children: shown ?? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "\u2014" })
|
|
476
1757
|
}
|
|
@@ -494,20 +1775,20 @@ function DatabaseRowDetail({
|
|
|
494
1775
|
testId: id,
|
|
495
1776
|
value,
|
|
496
1777
|
titles: row.titles,
|
|
497
|
-
labels: sources.labels,
|
|
1778
|
+
labels: labelSourceFor(sources.labels, column),
|
|
498
1779
|
onChange: (ids) => commit(column, ids)
|
|
499
1780
|
}
|
|
500
1781
|
) : null;
|
|
501
1782
|
case "date":
|
|
502
1783
|
if (span) {
|
|
503
1784
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
504
|
-
|
|
1785
|
+
DateSpanField,
|
|
505
1786
|
{
|
|
506
1787
|
idPrefix: id,
|
|
507
1788
|
value: {
|
|
508
|
-
start:
|
|
509
|
-
end:
|
|
510
|
-
timezone: span.timezoneColumnId ?
|
|
1789
|
+
start: asText2(value),
|
|
1790
|
+
end: asText2(row.values[span.endColumnId]),
|
|
1791
|
+
timezone: span.timezoneColumnId ? asText2(row.values[span.timezoneColumnId]) : null
|
|
511
1792
|
},
|
|
512
1793
|
onCommit: (v) => commit(column, v.start, {
|
|
513
1794
|
[span.endColumnId]: v.end,
|
|
@@ -540,7 +1821,7 @@ function DatabaseRowDetail({
|
|
|
540
1821
|
label: column.name,
|
|
541
1822
|
testId: id,
|
|
542
1823
|
onCommit: (next) => commit(column, next),
|
|
543
|
-
renderEditor: (editor) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1824
|
+
renderEditor: (editor) => /* @__PURE__ */ jsxRuntime.jsx(SelectCellEditor, { ...editor, value, options: column.options ?? [] })
|
|
544
1825
|
}
|
|
545
1826
|
);
|
|
546
1827
|
case "person":
|
|
@@ -557,7 +1838,7 @@ function DatabaseRowDetail({
|
|
|
557
1838
|
testId: id,
|
|
558
1839
|
onCommit: (next) => commit(column, next),
|
|
559
1840
|
renderEditor: (editor) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
560
|
-
|
|
1841
|
+
PickCellEditor,
|
|
561
1842
|
{
|
|
562
1843
|
...editor,
|
|
563
1844
|
value,
|
|
@@ -578,7 +1859,7 @@ function DatabaseRowDetail({
|
|
|
578
1859
|
if (row) {
|
|
579
1860
|
for (const column of columns) {
|
|
580
1861
|
if (column.type !== "document") continue;
|
|
581
|
-
for (const id of
|
|
1862
|
+
for (const id of cellIds(row.values[column.id])) {
|
|
582
1863
|
documents.set(id, [...documents.get(id) ?? [], column.name]);
|
|
583
1864
|
}
|
|
584
1865
|
}
|
|
@@ -623,7 +1904,7 @@ function DatabaseRowDetail({
|
|
|
623
1904
|
),
|
|
624
1905
|
/* @__PURE__ */ jsxRuntime.jsxs(chunkU46OGRCO_cjs.DetailSection, { title: l.fields, testId: `${testId}-fields`, children: [
|
|
625
1906
|
/* @__PURE__ */ jsxRuntime.jsx(chunkU46OGRCO_cjs.DetailFields, { children: columns.map((column) => {
|
|
626
|
-
const Icon =
|
|
1907
|
+
const Icon = COLUMN_TYPE_ICONS[column.type];
|
|
627
1908
|
const own = row ? renderField?.(column, row) : void 0;
|
|
628
1909
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
629
1910
|
chunkU46OGRCO_cjs.DetailField,
|
|
@@ -661,7 +1942,7 @@ function DatabaseRowDetail({
|
|
|
661
1942
|
onClick: openDocument ? () => openDocument(id) : void 0,
|
|
662
1943
|
testId: `${testId}-doc-${id}`,
|
|
663
1944
|
children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "min-w-0 flex-1", children: [
|
|
664
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate font-medium", children:
|
|
1945
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate font-medium", children: titleOf(id, row?.titles) }),
|
|
665
1946
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-xs text-muted-foreground", children: via.join(", ") })
|
|
666
1947
|
] })
|
|
667
1948
|
},
|
|
@@ -671,6 +1952,324 @@ function DatabaseRowDetail({
|
|
|
671
1952
|
}
|
|
672
1953
|
);
|
|
673
1954
|
}
|
|
1955
|
+
var escapeHtml = (text) => text.replace(/[&<>"']/g, (ch) => `&#${ch.charCodeAt(0)};`);
|
|
1956
|
+
var DEFAULT_DATABASE_TABLE_LABELS = {
|
|
1957
|
+
newRow: "New row",
|
|
1958
|
+
emptyTitle: "No rows yet",
|
|
1959
|
+
emptyMessage: "Add a row, or import a spreadsheet.",
|
|
1960
|
+
noColumnsTitle: "No columns yet",
|
|
1961
|
+
noColumnsMessage: "Add a column to start.",
|
|
1962
|
+
noMatches: "No rows match your search or filters."
|
|
1963
|
+
};
|
|
1964
|
+
function regrowAfterDrag(event) {
|
|
1965
|
+
if (!event.finished || event.source !== "uiColumnResized") return;
|
|
1966
|
+
const grid = event.api;
|
|
1967
|
+
if (grid.isDestroyed()) return;
|
|
1968
|
+
const dragged = new Set((event.columns ?? []).map((column) => column.getColId()));
|
|
1969
|
+
const state = (grid.getColumns() ?? []).flatMap((column) => {
|
|
1970
|
+
const flex = dragged.has(column.getColId()) ? null : column.getFlex();
|
|
1971
|
+
return flex ? [{ colId: column.getColId(), flex }] : [];
|
|
1972
|
+
});
|
|
1973
|
+
if (state.length > 0) grid.applyColumnState({ state, applyOrder: false });
|
|
1974
|
+
}
|
|
1975
|
+
function DatabaseTable({
|
|
1976
|
+
columns,
|
|
1977
|
+
rows,
|
|
1978
|
+
onCellChange,
|
|
1979
|
+
onAddRow,
|
|
1980
|
+
onAddColumn,
|
|
1981
|
+
onEditColumn,
|
|
1982
|
+
onOpenRow,
|
|
1983
|
+
isCellEditable,
|
|
1984
|
+
renderRowActions,
|
|
1985
|
+
getRowTestId,
|
|
1986
|
+
getCellTestId,
|
|
1987
|
+
testIds,
|
|
1988
|
+
sources,
|
|
1989
|
+
onSelectionChange,
|
|
1990
|
+
selected,
|
|
1991
|
+
readOnly = false,
|
|
1992
|
+
isFiltered = false,
|
|
1993
|
+
isLoading,
|
|
1994
|
+
locale,
|
|
1995
|
+
gridId,
|
|
1996
|
+
rowHeight = 38,
|
|
1997
|
+
height = "100%",
|
|
1998
|
+
labels,
|
|
1999
|
+
columnLabels,
|
|
2000
|
+
gridProps,
|
|
2001
|
+
testId,
|
|
2002
|
+
revealRowId,
|
|
2003
|
+
onRevealed,
|
|
2004
|
+
openRowId = null
|
|
2005
|
+
}) {
|
|
2006
|
+
const l = { ...DEFAULT_DATABASE_TABLE_LABELS, ...labels };
|
|
2007
|
+
const latest = react.useRef({
|
|
2008
|
+
onEditColumn,
|
|
2009
|
+
onAddColumn,
|
|
2010
|
+
onOpenRow,
|
|
2011
|
+
isCellEditable,
|
|
2012
|
+
renderRowActions,
|
|
2013
|
+
getRowTestId,
|
|
2014
|
+
getCellTestId,
|
|
2015
|
+
columns,
|
|
2016
|
+
openRowId
|
|
2017
|
+
});
|
|
2018
|
+
latest.current = {
|
|
2019
|
+
onEditColumn,
|
|
2020
|
+
onAddColumn,
|
|
2021
|
+
onOpenRow,
|
|
2022
|
+
isCellEditable,
|
|
2023
|
+
renderRowActions,
|
|
2024
|
+
getRowTestId,
|
|
2025
|
+
getCellTestId,
|
|
2026
|
+
columns,
|
|
2027
|
+
openRowId
|
|
2028
|
+
};
|
|
2029
|
+
const hasCellEditable = !!isCellEditable;
|
|
2030
|
+
const hasRowActions = !!renderRowActions;
|
|
2031
|
+
const hasEditColumn = !!onEditColumn;
|
|
2032
|
+
const hasAddColumn = !!onAddColumn;
|
|
2033
|
+
const hasOpenRow = !!onOpenRow;
|
|
2034
|
+
const editColumn = react.useMemo(
|
|
2035
|
+
() => hasEditColumn ? (column) => latest.current.onEditColumn?.(column) : void 0,
|
|
2036
|
+
[hasEditColumn]
|
|
2037
|
+
);
|
|
2038
|
+
const addColumn = react.useMemo(
|
|
2039
|
+
() => hasAddColumn ? () => latest.current.onAddColumn?.() : void 0,
|
|
2040
|
+
[hasAddColumn]
|
|
2041
|
+
);
|
|
2042
|
+
const openRow = react.useMemo(
|
|
2043
|
+
() => hasOpenRow ? (row, options) => options ? latest.current.onOpenRow?.(row, options) : latest.current.onOpenRow?.(row) : void 0,
|
|
2044
|
+
[hasOpenRow]
|
|
2045
|
+
);
|
|
2046
|
+
const cellEditable = react.useMemo(
|
|
2047
|
+
() => hasCellEditable ? (row, column) => latest.current.isCellEditable?.(row, column) ?? true : void 0,
|
|
2048
|
+
[hasCellEditable]
|
|
2049
|
+
);
|
|
2050
|
+
const rowActions = react.useMemo(
|
|
2051
|
+
() => hasRowActions ? (row) => latest.current.renderRowActions?.(row) : void 0,
|
|
2052
|
+
[hasRowActions]
|
|
2053
|
+
);
|
|
2054
|
+
const rowTestId = react.useCallback(
|
|
2055
|
+
(row) => latest.current.getRowTestId?.(row) ?? `database-row-${row.id}`,
|
|
2056
|
+
[]
|
|
2057
|
+
);
|
|
2058
|
+
const cellTestId = react.useCallback(
|
|
2059
|
+
(columnId, row) => latest.current.getCellTestId?.(columnId, row) ?? `database-cell-${row.id}-${columnId}`,
|
|
2060
|
+
[]
|
|
2061
|
+
);
|
|
2062
|
+
const latestSources = react.useRef(sources);
|
|
2063
|
+
latestSources.current = sources;
|
|
2064
|
+
const hasSources = !!sources;
|
|
2065
|
+
const hasSearchRows = !!sources?.searchRows;
|
|
2066
|
+
const hasOpenDocument = !!sources?.onOpenDocument;
|
|
2067
|
+
const hasLabels = !!sources?.labels;
|
|
2068
|
+
const members = sources?.members;
|
|
2069
|
+
const documents = sources?.documents;
|
|
2070
|
+
const labelOptions = sources?.labels?.options;
|
|
2071
|
+
const contentKey = react.useMemo(
|
|
2072
|
+
() => JSON.stringify([columns, members, documents, labelOptions]),
|
|
2073
|
+
[columns, members, documents, labelOptions]
|
|
2074
|
+
);
|
|
2075
|
+
const multiline = rowHeight >= chunkV5P5MRSR_cjs.rowHeightForLines(2);
|
|
2076
|
+
const columnDefs = react.useMemo(
|
|
2077
|
+
() => createDatabaseColumns(columns, {
|
|
2078
|
+
readOnly,
|
|
2079
|
+
onEditColumn: editColumn,
|
|
2080
|
+
onAddColumn: addColumn,
|
|
2081
|
+
onOpenRow: openRow,
|
|
2082
|
+
isCellEditable: cellEditable,
|
|
2083
|
+
renderRowActions: rowActions,
|
|
2084
|
+
sources: sources && {
|
|
2085
|
+
members: sources.members,
|
|
2086
|
+
documents: sources.documents,
|
|
2087
|
+
labels: hasLabels ? {
|
|
2088
|
+
options: sources.labels.options,
|
|
2089
|
+
onCreate: (name) => latestSources.current.labels.onCreate(name)
|
|
2090
|
+
} : void 0,
|
|
2091
|
+
searchRows: hasSearchRows ? (databaseId, q) => latestSources.current.searchRows(databaseId, q) : void 0,
|
|
2092
|
+
onOpenDocument: hasOpenDocument ? (documentId) => latestSources.current?.onOpenDocument?.(documentId) : void 0
|
|
2093
|
+
},
|
|
2094
|
+
locale,
|
|
2095
|
+
labels: columnLabels
|
|
2096
|
+
}),
|
|
2097
|
+
// `columns` and `sources` are read through `contentKey` (and the latest callbacks).
|
|
2098
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2099
|
+
[
|
|
2100
|
+
contentKey,
|
|
2101
|
+
hasSources,
|
|
2102
|
+
hasSearchRows,
|
|
2103
|
+
hasOpenDocument,
|
|
2104
|
+
hasLabels,
|
|
2105
|
+
readOnly,
|
|
2106
|
+
editColumn,
|
|
2107
|
+
addColumn,
|
|
2108
|
+
openRow,
|
|
2109
|
+
cellEditable,
|
|
2110
|
+
rowActions,
|
|
2111
|
+
locale,
|
|
2112
|
+
columnLabels
|
|
2113
|
+
]
|
|
2114
|
+
);
|
|
2115
|
+
const noColumns = columns.length === 0;
|
|
2116
|
+
const emptyState = {
|
|
2117
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Table2, { className: "size-8 text-muted-foreground" }),
|
|
2118
|
+
title: l.noColumnsTitle,
|
|
2119
|
+
message: readOnly ? void 0 : l.noColumnsMessage,
|
|
2120
|
+
action: !readOnly && onAddColumn ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: onAddColumn, "data-testid": "database-empty-add-column", className: "gap-1.5", children: [
|
|
2121
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }),
|
|
2122
|
+
columnLabels?.addColumn ?? DEFAULT_DATABASE_COLUMN_LABELS.addColumn
|
|
2123
|
+
] }) : void 0
|
|
2124
|
+
};
|
|
2125
|
+
const noRowsText = isFiltered ? l.noMatches : readOnly ? l.emptyTitle : `${l.emptyTitle}. ${l.emptyMessage}`;
|
|
2126
|
+
const api = react.useRef(null);
|
|
2127
|
+
const knownColumns = react.useRef(null);
|
|
2128
|
+
react.useEffect(() => {
|
|
2129
|
+
const ids = new Set(columns.map((c) => c.id));
|
|
2130
|
+
const added = knownColumns.current ? columns.filter((c) => !knownColumns.current.has(c.id)) : [];
|
|
2131
|
+
knownColumns.current = ids;
|
|
2132
|
+
const last = added[added.length - 1];
|
|
2133
|
+
if (last && api.current) {
|
|
2134
|
+
const grid = api.current;
|
|
2135
|
+
setTimeout(() => grid.ensureColumnVisible(last.id, "end"), 0);
|
|
2136
|
+
}
|
|
2137
|
+
}, [columns]);
|
|
2138
|
+
const onRevealedRef = react.useRef(onRevealed);
|
|
2139
|
+
onRevealedRef.current = onRevealed;
|
|
2140
|
+
react.useEffect(() => {
|
|
2141
|
+
if (!revealRowId) return;
|
|
2142
|
+
const flash = setTimeout(() => {
|
|
2143
|
+
const grid = api.current;
|
|
2144
|
+
const node = grid?.getRowNode?.(revealRowId);
|
|
2145
|
+
if (grid && node) {
|
|
2146
|
+
grid.ensureNodeVisible(node, "middle");
|
|
2147
|
+
grid.flashCells({ rowNodes: [node] });
|
|
2148
|
+
}
|
|
2149
|
+
}, 300);
|
|
2150
|
+
const done = setTimeout(() => onRevealedRef.current?.(), 3e3);
|
|
2151
|
+
return () => {
|
|
2152
|
+
clearTimeout(flash);
|
|
2153
|
+
clearTimeout(done);
|
|
2154
|
+
};
|
|
2155
|
+
}, [revealRowId, rows.length]);
|
|
2156
|
+
const openRowOf = (row, columnId) => {
|
|
2157
|
+
if (row && latest.current.columns.find((c) => c.id === columnId)?.editIn === "row")
|
|
2158
|
+
latest.current.onOpenRow?.(row, { focusColumn: columnId });
|
|
2159
|
+
};
|
|
2160
|
+
const clickRowOf = (row, columnId) => {
|
|
2161
|
+
if (!row) return;
|
|
2162
|
+
const column = latest.current.columns.find((c) => c.id === columnId);
|
|
2163
|
+
if (!column) return;
|
|
2164
|
+
if (column.editIn === "row") return latest.current.onOpenRow?.(row, { focusColumn: columnId });
|
|
2165
|
+
const open = latest.current.openRowId;
|
|
2166
|
+
const plain = column.type !== "checkbox" && column.type !== "label" && column.type !== "source";
|
|
2167
|
+
if (open && open !== row.id && plain) latest.current.onOpenRow?.(row);
|
|
2168
|
+
};
|
|
2169
|
+
const shownOpenRow = react.useRef(null);
|
|
2170
|
+
react.useEffect(() => {
|
|
2171
|
+
const grid = api.current;
|
|
2172
|
+
const before = shownOpenRow.current;
|
|
2173
|
+
shownOpenRow.current = openRowId;
|
|
2174
|
+
if (!grid || grid.isDestroyed() || before === openRowId) return;
|
|
2175
|
+
const rowNodes = [before, openRowId].map((id) => id ? grid.getRowNode(id) : void 0).filter((node) => !!node);
|
|
2176
|
+
if (rowNodes.length) grid.redrawRows({ rowNodes });
|
|
2177
|
+
}, [openRowId]);
|
|
2178
|
+
const shownRowHeight = react.useRef(rowHeight);
|
|
2179
|
+
react.useEffect(() => {
|
|
2180
|
+
const grid = api.current;
|
|
2181
|
+
const before = shownRowHeight.current;
|
|
2182
|
+
shownRowHeight.current = rowHeight;
|
|
2183
|
+
if (before === rowHeight || !grid || grid.isDestroyed()) return;
|
|
2184
|
+
const sized = latest.current.columns.filter((c) => c.type === "label" || c.type === "source").map((c) => c.id);
|
|
2185
|
+
if (sized.length > 0) grid.refreshCells({ columns: sized, force: true });
|
|
2186
|
+
}, [rowHeight]);
|
|
2187
|
+
const handleCellValueChanged = (event) => {
|
|
2188
|
+
const columnId = event.column.getColId();
|
|
2189
|
+
if (!event.data || !onCellChange) return;
|
|
2190
|
+
const value = event.data.values[columnId] ?? null;
|
|
2191
|
+
const span = columns.find((c) => c.id === columnId)?.span;
|
|
2192
|
+
if (!span) return onCellChange(event.data, columnId, value);
|
|
2193
|
+
const extra = {
|
|
2194
|
+
[span.endColumnId]: event.data.values[span.endColumnId] ?? null
|
|
2195
|
+
};
|
|
2196
|
+
if (span.timezoneColumnId) {
|
|
2197
|
+
extra[span.timezoneColumnId] = event.data.values[span.timezoneColumnId] ?? null;
|
|
2198
|
+
}
|
|
2199
|
+
onCellChange(event.data, columnId, value, extra);
|
|
2200
|
+
};
|
|
2201
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2202
|
+
"div",
|
|
2203
|
+
{
|
|
2204
|
+
className: ui.cn(
|
|
2205
|
+
"database-table flex h-full min-h-0 flex-col",
|
|
2206
|
+
multiline && "database-table--multiline"
|
|
2207
|
+
),
|
|
2208
|
+
"data-testid": chunkPLIF5CUV_cjs.testIdOr(testId, { testId: "database-table" }),
|
|
2209
|
+
children: [
|
|
2210
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2211
|
+
chunkZVEW3JBT_cjs.GridView,
|
|
2212
|
+
{
|
|
2213
|
+
testId: testIds?.grid ?? "database-grid",
|
|
2214
|
+
items: rows,
|
|
2215
|
+
columnDefs,
|
|
2216
|
+
getItemId: (row) => row.id,
|
|
2217
|
+
getRowTestId: rowTestId,
|
|
2218
|
+
getCellTestId: cellTestId,
|
|
2219
|
+
isLoading,
|
|
2220
|
+
emptyState,
|
|
2221
|
+
showEmpty: noColumns,
|
|
2222
|
+
gridId,
|
|
2223
|
+
height,
|
|
2224
|
+
rowHeight,
|
|
2225
|
+
selection: onSelectionChange ? { mode: "multiple", selected: selected ?? [], onSelectionChange, controlled: true } : void 0,
|
|
2226
|
+
onCellValueChanged: handleCellValueChanged,
|
|
2227
|
+
...gridProps,
|
|
2228
|
+
onGridReady: (params) => {
|
|
2229
|
+
api.current = params.api;
|
|
2230
|
+
gridProps?.onGridReady?.(params);
|
|
2231
|
+
},
|
|
2232
|
+
gridOptions: {
|
|
2233
|
+
overlayNoRowsTemplate: `<span class="text-sm text-muted-foreground">${escapeHtml(noRowsText)}</span>`,
|
|
2234
|
+
singleClickEdit: false,
|
|
2235
|
+
stopEditingWhenCellsLoseFocus: true,
|
|
2236
|
+
enterNavigatesVerticallyAfterEdit: true,
|
|
2237
|
+
undoRedoCellEditing: false,
|
|
2238
|
+
rowClassRules: {
|
|
2239
|
+
"database-row-open": (p) => !!p.data && p.data.id === latest.current.openRowId
|
|
2240
|
+
},
|
|
2241
|
+
onCellClicked: (event) => clickRowOf(event.data, event.column.getColId()),
|
|
2242
|
+
onCellDoubleClicked: (event) => openRowOf(event.data, event.column.getColId()),
|
|
2243
|
+
onCellKeyDown: (event) => {
|
|
2244
|
+
if ("column" in event && event.event instanceof KeyboardEvent && event.event.key === "Enter")
|
|
2245
|
+
openRowOf(event.data, event.column.getColId());
|
|
2246
|
+
},
|
|
2247
|
+
...gridProps?.gridOptions,
|
|
2248
|
+
onColumnResized: (event) => {
|
|
2249
|
+
gridProps?.gridOptions?.onColumnResized?.(event);
|
|
2250
|
+
regrowAfterDrag(event);
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
) }),
|
|
2255
|
+
!readOnly && onAddRow && columns.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border px-2 py-1", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2256
|
+
ui.Button,
|
|
2257
|
+
{
|
|
2258
|
+
variant: "ghost",
|
|
2259
|
+
size: "sm",
|
|
2260
|
+
onClick: onAddRow,
|
|
2261
|
+
"data-testid": testIds?.addRow ?? "database-add-row",
|
|
2262
|
+
className: "gap-1.5 text-muted-foreground",
|
|
2263
|
+
children: [
|
|
2264
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }),
|
|
2265
|
+
l.newRow
|
|
2266
|
+
]
|
|
2267
|
+
}
|
|
2268
|
+
) })
|
|
2269
|
+
]
|
|
2270
|
+
}
|
|
2271
|
+
);
|
|
2272
|
+
}
|
|
674
2273
|
var DEFAULT_DATABASE_FILTER_MENU_LABELS = {
|
|
675
2274
|
...chunkLIJB6XOR_cjs.DEFAULT_CONDITIONS_LABELS,
|
|
676
2275
|
filterField: "Column",
|
|
@@ -710,17 +2309,17 @@ function DatabaseFilterMenu({
|
|
|
710
2309
|
const canClear = filters.length > 0 || (extraCount ?? 0) > 0 && Boolean(onClearExtra);
|
|
711
2310
|
const contentRef = react.useRef(null);
|
|
712
2311
|
const hint = extraSummary ? filters.length > 0 && l.conditions ? `${extraSummary}, ${l.conditions(filters.length)}` : extraSummary : void 0;
|
|
713
|
-
const
|
|
2312
|
+
const labelSource = sources?.labels;
|
|
714
2313
|
const documents = sources?.documents;
|
|
715
2314
|
const fields = react.useMemo(
|
|
716
2315
|
() => columns.map((c) => {
|
|
717
|
-
const kit =
|
|
2316
|
+
const kit = kitOf(c.type);
|
|
718
2317
|
const base = { id: c.id, label: c.name, type: c.type };
|
|
719
2318
|
if (!kit) return base;
|
|
720
|
-
const valueOptions = kit.filterInput === "label" ?
|
|
2319
|
+
const valueOptions = kit.filterInput === "label" ? labelSourceFor(labelSource, c)?.options.map((o) => ({ id: o.id, label: o.name })) : documents?.map((d) => ({ id: d.id, label: d.label }));
|
|
721
2320
|
return { ...base, ops: kit.filterOps, valueOptions };
|
|
722
2321
|
}),
|
|
723
|
-
[columns,
|
|
2322
|
+
[columns, labelSource, documents]
|
|
724
2323
|
);
|
|
725
2324
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Popover, { children: [
|
|
726
2325
|
/* @__PURE__ */ jsxRuntime.jsx(ui.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1106,7 +2705,7 @@ function DatabaseColumnDialog({
|
|
|
1106
2705
|
open,
|
|
1107
2706
|
onOpenChange,
|
|
1108
2707
|
column,
|
|
1109
|
-
types =
|
|
2708
|
+
types = DATABASE_COLUMN_TYPES,
|
|
1110
2709
|
databaseId,
|
|
1111
2710
|
databaseName,
|
|
1112
2711
|
columns = NO_COLUMNS,
|
|
@@ -1120,7 +2719,7 @@ function DatabaseColumnDialog({
|
|
|
1120
2719
|
configLabels
|
|
1121
2720
|
}) {
|
|
1122
2721
|
const l = { ...DEFAULT_DATABASE_COLUMN_DIALOG_LABELS, ...labels };
|
|
1123
|
-
const tl = { ...
|
|
2722
|
+
const tl = { ...DEFAULT_DATABASE_COLUMN_TYPE_LABELS, ...typeLabels };
|
|
1124
2723
|
const cl = { ...DEFAULT_COLUMN_CONFIG_LABELS, ...configLabels };
|
|
1125
2724
|
const editing = Boolean(column);
|
|
1126
2725
|
const [name, setName] = react.useState("");
|
|
@@ -1237,7 +2836,7 @@ function DatabaseColumnDialog({
|
|
|
1237
2836
|
children: [
|
|
1238
2837
|
/* @__PURE__ */ jsxRuntime.jsx(ui.SelectTrigger, { "data-testid": "database-column-type", children: /* @__PURE__ */ jsxRuntime.jsx(ui.SelectValue, {}) }),
|
|
1239
2838
|
/* @__PURE__ */ jsxRuntime.jsx(ui.SelectContent, { children: offered.map((t) => {
|
|
1240
|
-
const Icon =
|
|
2839
|
+
const Icon = COLUMN_TYPE_ICONS[t];
|
|
1241
2840
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: t, "data-testid": `database-column-type-${t}`, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
1242
2841
|
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4 text-muted-foreground" }),
|
|
1243
2842
|
tl[t]
|
|
@@ -1251,7 +2850,7 @@ function DatabaseColumnDialog({
|
|
|
1251
2850
|
type === "select" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
1252
2851
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "database-column-option", children: l.options }),
|
|
1253
2852
|
options.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1.5", "data-testid": "database-column-options", children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
|
|
1254
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2853
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectChip, { value: option }),
|
|
1255
2854
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1256
2855
|
"button",
|
|
1257
2856
|
{
|
|
@@ -1473,7 +3072,7 @@ function DatabaseCard({
|
|
|
1473
3072
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: l.rows(database.row_count) }),
|
|
1474
3073
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: l.columns(database.columns.length) }),
|
|
1475
3074
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-auto flex items-center gap-1", "aria-hidden": true, children: database.columns.slice(0, 6).map((c) => {
|
|
1476
|
-
const Icon =
|
|
3075
|
+
const Icon = COLUMN_TYPE_ICONS[c.type];
|
|
1477
3076
|
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-3.5" }, c.id);
|
|
1478
3077
|
}) })
|
|
1479
3078
|
] })
|
|
@@ -1702,7 +3301,7 @@ var GANTT_LAYOUT = {
|
|
|
1702
3301
|
// src/databases/layouts/rowsToTimelineItems.ts
|
|
1703
3302
|
var BARE_DAY = /^\d{4}-\d{2}-\d{2}$/;
|
|
1704
3303
|
function cellText(value) {
|
|
1705
|
-
const [first] =
|
|
3304
|
+
const [first] = cellList(value);
|
|
1706
3305
|
if (first === void 0) return void 0;
|
|
1707
3306
|
if (typeof first === "string") return first.trim();
|
|
1708
3307
|
return null;
|
|
@@ -1716,11 +3315,11 @@ function colorsOf(row, column) {
|
|
|
1716
3315
|
if (!column) return null;
|
|
1717
3316
|
const value = row.values[column.id];
|
|
1718
3317
|
if (column.type === "label") {
|
|
1719
|
-
const colors =
|
|
3318
|
+
const colors = cellIds(value).slice(0, 3).map((id) => ui.getEntityColor(id, "medium"));
|
|
1720
3319
|
return colors.length ? colors : null;
|
|
1721
3320
|
}
|
|
1722
3321
|
if (column.type === "select") {
|
|
1723
|
-
const option =
|
|
3322
|
+
const option = formatCell(value, column.type);
|
|
1724
3323
|
return option ? [optionColor(option)] : null;
|
|
1725
3324
|
}
|
|
1726
3325
|
return null;
|
|
@@ -1740,26 +3339,26 @@ function rowsToTimelineItems(rows, columns, settings) {
|
|
|
1740
3339
|
const title = columns.find((c) => c.id === settings.titleColumn) ?? columns[0];
|
|
1741
3340
|
const color = columns.find((c) => c.id === settings.colorColumn);
|
|
1742
3341
|
for (const row of rows) {
|
|
1743
|
-
const
|
|
1744
|
-
if (
|
|
3342
|
+
const startText2 = cellText(row.values[start.id]);
|
|
3343
|
+
if (startText2 === void 0 || startText2 === "") {
|
|
1745
3344
|
result.undated.push(row);
|
|
1746
3345
|
continue;
|
|
1747
3346
|
}
|
|
1748
3347
|
const endText = end ? cellText(row.values[end.id]) : void 0;
|
|
1749
3348
|
const hasEnd = endText !== void 0 && endText !== "";
|
|
1750
|
-
if (
|
|
3349
|
+
if (startText2 === null || !chunk66IOCKWS_cjs.parseIso(startText2) || hasEnd && !(endText && chunk66IOCKWS_cjs.parseIso(endText))) {
|
|
1751
3350
|
result.invalid.push(row);
|
|
1752
3351
|
continue;
|
|
1753
3352
|
}
|
|
1754
|
-
let from =
|
|
3353
|
+
let from = startText2;
|
|
1755
3354
|
let to = hasEnd && endText ? endText : from;
|
|
1756
|
-
if (
|
|
3355
|
+
if (chunk66IOCKWS_cjs.parseIso(to) < chunk66IOCKWS_cjs.parseIso(from)) [from, to] = [to, from];
|
|
1757
3356
|
if (BARE_DAY.test(to)) to = `${to}T23:59:59.000Z`;
|
|
1758
3357
|
if (BARE_DAY.test(from)) from = `${from}T00:00:00.000Z`;
|
|
1759
3358
|
const colors = colorsOf(row, color);
|
|
1760
3359
|
result.items.push({
|
|
1761
3360
|
id: row.id,
|
|
1762
|
-
label:
|
|
3361
|
+
label: formatCell(row.values[title?.id ?? ""], title?.type ?? "text", void 0, row.titles) || row.id,
|
|
1763
3362
|
start: from,
|
|
1764
3363
|
end: to,
|
|
1765
3364
|
...colors ? { colors } : {},
|
|
@@ -1802,7 +3401,7 @@ function DatabaseCalendar({
|
|
|
1802
3401
|
}
|
|
1803
3402
|
}, [selectedId, items, testId]);
|
|
1804
3403
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: rootRef, className: "h-full min-w-0 border-t border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1805
|
-
|
|
3404
|
+
chunk66IOCKWS_cjs.TimelineCalendar,
|
|
1806
3405
|
{
|
|
1807
3406
|
items,
|
|
1808
3407
|
testId,
|
|
@@ -1845,7 +3444,7 @@ function DatabaseGantt({
|
|
|
1845
3444
|
className: "h-full min-w-0 border-t border-border [&_[data-testid$='-side-panel']]:hidden",
|
|
1846
3445
|
"data-testid": testId,
|
|
1847
3446
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1848
|
-
|
|
3447
|
+
chunk66IOCKWS_cjs.TimelineGantt,
|
|
1849
3448
|
{
|
|
1850
3449
|
items,
|
|
1851
3450
|
testId,
|
|
@@ -2024,7 +3623,7 @@ function DatabaseLayoutSwitcher({
|
|
|
2024
3623
|
)
|
|
2025
3624
|
] }),
|
|
2026
3625
|
showsZoom && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2027
|
-
|
|
3626
|
+
chunk66IOCKWS_cjs.TimelineZoomControl,
|
|
2028
3627
|
{
|
|
2029
3628
|
zoom: settings.zoom ?? 1,
|
|
2030
3629
|
onZoomChange: (zoom) => set({ zoom }),
|
|
@@ -2084,15 +3683,24 @@ function withUndatedFilter(filters, columnId) {
|
|
|
2084
3683
|
return [...filters, { column: columnId, op: "empty" }];
|
|
2085
3684
|
}
|
|
2086
3685
|
|
|
3686
|
+
exports.ADD_COLUMN_COL_ID = ADD_COLUMN_COL_ID;
|
|
2087
3687
|
exports.CALENDAR_LAYOUT = CALENDAR_LAYOUT;
|
|
3688
|
+
exports.COLUMN_TYPE_ICONS = COLUMN_TYPE_ICONS;
|
|
3689
|
+
exports.COMPUTED_COLUMN_TYPES = COMPUTED_COLUMN_TYPES;
|
|
3690
|
+
exports.DATABASE_COLUMN_TYPES = DATABASE_COLUMN_TYPES;
|
|
3691
|
+
exports.DATABASE_ROLLUP_OPS = DATABASE_ROLLUP_OPS;
|
|
2088
3692
|
exports.DEFAULT_COLUMN_CONFIG_LABELS = DEFAULT_COLUMN_CONFIG_LABELS;
|
|
2089
3693
|
exports.DEFAULT_DATABASE_COLUMN_DIALOG_LABELS = DEFAULT_DATABASE_COLUMN_DIALOG_LABELS;
|
|
3694
|
+
exports.DEFAULT_DATABASE_COLUMN_LABELS = DEFAULT_DATABASE_COLUMN_LABELS;
|
|
3695
|
+
exports.DEFAULT_DATABASE_COLUMN_TYPE_LABELS = DEFAULT_DATABASE_COLUMN_TYPE_LABELS;
|
|
2090
3696
|
exports.DEFAULT_DATABASE_FILTER_MENU_LABELS = DEFAULT_DATABASE_FILTER_MENU_LABELS;
|
|
2091
3697
|
exports.DEFAULT_DATABASE_LAYOUT_LABELS = DEFAULT_DATABASE_LAYOUT_LABELS;
|
|
2092
3698
|
exports.DEFAULT_DATABASE_LIST_LABELS = DEFAULT_DATABASE_LIST_LABELS;
|
|
2093
3699
|
exports.DEFAULT_DATABASE_ROW_DETAIL_LABELS = DEFAULT_DATABASE_ROW_DETAIL_LABELS;
|
|
3700
|
+
exports.DEFAULT_DATABASE_TABLE_LABELS = DEFAULT_DATABASE_TABLE_LABELS;
|
|
2094
3701
|
exports.DEFAULT_DATABASE_TOOLBAR_LABELS = DEFAULT_DATABASE_TOOLBAR_LABELS;
|
|
2095
3702
|
exports.DEFAULT_NEW_DATABASE_DIALOG_LABELS = DEFAULT_NEW_DATABASE_DIALOG_LABELS;
|
|
3703
|
+
exports.DEFAULT_PICK_CELL_EDITOR_LABELS = DEFAULT_PICK_CELL_EDITOR_LABELS;
|
|
2096
3704
|
exports.DatabaseCalendar = DatabaseCalendar;
|
|
2097
3705
|
exports.DatabaseColumnDialog = DatabaseColumnDialog;
|
|
2098
3706
|
exports.DatabaseFilterMenu = DatabaseFilterMenu;
|
|
@@ -2100,16 +3708,49 @@ exports.DatabaseGantt = DatabaseGantt;
|
|
|
2100
3708
|
exports.DatabaseLayoutSwitcher = DatabaseLayoutSwitcher;
|
|
2101
3709
|
exports.DatabaseList = DatabaseList;
|
|
2102
3710
|
exports.DatabaseRowDetail = DatabaseRowDetail;
|
|
3711
|
+
exports.DatabaseTable = DatabaseTable;
|
|
2103
3712
|
exports.DatabaseToolbar = DatabaseToolbar;
|
|
3713
|
+
exports.DateSpanCellEditor = DateSpanCellEditor;
|
|
3714
|
+
exports.DateSpanField = DateSpanField;
|
|
2104
3715
|
exports.GANTT_LAYOUT = GANTT_LAYOUT;
|
|
3716
|
+
exports.LINK_COLUMN_TYPES = LINK_COLUMN_TYPES;
|
|
3717
|
+
exports.LabelsCell = LabelsCell;
|
|
2105
3718
|
exports.LabelsField = LabelsField;
|
|
3719
|
+
exports.LinkChip = LinkChip;
|
|
3720
|
+
exports.LinkChipsCell = LinkChipsCell;
|
|
3721
|
+
exports.LookupCell = LookupCell;
|
|
2106
3722
|
exports.NewDatabaseDialog = NewDatabaseDialog;
|
|
3723
|
+
exports.OPEN_ROW_COL_ID = OPEN_ROW_COL_ID;
|
|
3724
|
+
exports.PersonCell = PersonCell;
|
|
3725
|
+
exports.PersonChip = PersonChip;
|
|
3726
|
+
exports.PickCellEditor = PickCellEditor;
|
|
3727
|
+
exports.ROW_ACTIONS_COL_ID = ROW_ACTIONS_COL_ID;
|
|
3728
|
+
exports.SelectCellEditor = SelectCellEditor;
|
|
3729
|
+
exports.SelectChip = SelectChip;
|
|
3730
|
+
exports.SourcesCell = SourcesCell;
|
|
2107
3731
|
exports.SourcesField = SourcesField;
|
|
2108
3732
|
exports.TABLE_LAYOUT = TABLE_LAYOUT;
|
|
3733
|
+
exports.canEditColumn = canEditColumn;
|
|
3734
|
+
exports.cellIds = cellIds;
|
|
3735
|
+
exports.cellList = cellList;
|
|
3736
|
+
exports.columnWidth = columnWidth;
|
|
3737
|
+
exports.compareCells = compareCells;
|
|
2109
3738
|
exports.completeFilters = completeFilters;
|
|
3739
|
+
exports.createDatabaseColumns = createDatabaseColumns;
|
|
3740
|
+
exports.formatCell = formatCell;
|
|
3741
|
+
exports.formatDateValue = formatDateValue;
|
|
3742
|
+
exports.formatLookupValue = formatLookupValue;
|
|
3743
|
+
exports.formatNumberValue = formatNumberValue;
|
|
3744
|
+
exports.isComputedColumn = isComputedColumn;
|
|
3745
|
+
exports.kitOf = kitOf;
|
|
3746
|
+
exports.optionTone = optionTone;
|
|
2110
3747
|
exports.resolveLayoutSettings = resolveLayoutSettings;
|
|
3748
|
+
exports.rowTitle = rowTitle;
|
|
2111
3749
|
exports.rowsToTimelineItems = rowsToTimelineItems;
|
|
3750
|
+
exports.sameCellValue = sameCellValue;
|
|
2112
3751
|
exports.storedLayoutAfter = storedLayoutAfter;
|
|
3752
|
+
exports.titleOf = titleOf;
|
|
3753
|
+
exports.toApiValue = toApiValue;
|
|
2113
3754
|
exports.withUndatedFilter = withUndatedFilter;
|
|
2114
|
-
//# sourceMappingURL=chunk-
|
|
2115
|
-
//# sourceMappingURL=chunk-
|
|
3755
|
+
//# sourceMappingURL=chunk-QU3OCUVF.cjs.map
|
|
3756
|
+
//# sourceMappingURL=chunk-QU3OCUVF.cjs.map
|