@yudaocode/univer-boards-ui 1.6.218 → 1.6.219
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/README.md +4 -1
- package/lib/cjs/index.js +931 -107
- package/lib/cjs/index.js.map +1 -1
- package/lib/es/index.js +910 -72
- package/lib/es/index.js.map +1 -1
- package/lib/index.css +432 -11
- package/lib/types/index.d.ts +18 -2
- package/package.json +3 -3
package/lib/cjs/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __export(src_exports, {
|
|
|
34
34
|
BOARD_ICON_MAP: () => BOARD_ICON_MAP,
|
|
35
35
|
BOARD_INSPECTOR_COMPONENT_KEY: () => BOARD_INSPECTOR_COMPONENT_KEY,
|
|
36
36
|
BOARD_INSPECTOR_SIDEBAR_ID: () => BOARD_INSPECTOR_SIDEBAR_ID,
|
|
37
|
+
BoardsDocImportModal: () => BoardsDocImportModal,
|
|
37
38
|
BoardsInfiniteCanvas: () => BoardsInfiniteCanvas,
|
|
38
39
|
BoardsInspectorPanel: () => BoardsInspectorPanel,
|
|
39
40
|
BoardsLeftSidebar: () => BoardsLeftSidebar,
|
|
@@ -41,9 +42,12 @@ __export(src_exports, {
|
|
|
41
42
|
BoardsModalsHost: () => BoardsModalsHost,
|
|
42
43
|
BoardsStatusBar: () => BoardsStatusBar,
|
|
43
44
|
BoardsUIController: () => BoardsUIController,
|
|
45
|
+
BoardsVotingModal: () => BoardsVotingModal,
|
|
44
46
|
ExportBoardFileOperation: () => ExportBoardFileOperation,
|
|
45
47
|
FitBoardToScreenOperation: () => FitBoardToScreenOperation,
|
|
48
|
+
OpenBoardDocImportModalOperation: () => OpenBoardDocImportModalOperation,
|
|
46
49
|
OpenBoardMermaidModalOperation: () => OpenBoardMermaidModalOperation,
|
|
50
|
+
OpenBoardVotingModalOperation: () => OpenBoardVotingModalOperation,
|
|
47
51
|
SetBoardToolOperation: () => SetBoardToolOperation,
|
|
48
52
|
StartBoardPresentationOperation: () => StartBoardPresentationOperation,
|
|
49
53
|
ToggleBoardInspectorOperation: () => ToggleBoardInspectorOperation,
|
|
@@ -59,8 +63,8 @@ __export(src_exports, {
|
|
|
59
63
|
module.exports = __toCommonJS(src_exports);
|
|
60
64
|
|
|
61
65
|
// src/controllers/boards-ui.controller.ts
|
|
62
|
-
var
|
|
63
|
-
var
|
|
66
|
+
var import_core9 = require("@univerjs/core");
|
|
67
|
+
var import_ui10 = require("@univerjs/ui");
|
|
64
68
|
|
|
65
69
|
// src/icons/board-icons.tsx
|
|
66
70
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -201,6 +205,47 @@ var BoardAlignRightIcon = createSvgIcon(
|
|
|
201
205
|
var BoardGridIcon = createSvgIcon(
|
|
202
206
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 5.5H13.5M2.5 10.5H13.5M5.5 2.5V13.5M10.5 2.5V13.5" })
|
|
203
207
|
);
|
|
208
|
+
var BoardEyeOffIcon = createSvgIcon(
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.2 2.2L13.8 13.8" }),
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.6 6.7C6.1 7.2 6 8 6.4 8.7C6.8 9.4 7.6 9.6 8.3 9.3" }),
|
|
212
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4.1 4.4C2.9 5.3 2 6.6 1.6 8C2.6 11 5.1 12.8 8 12.8C9.3 12.8 10.5 12.4 11.5 11.7M6.3 3.4C6.8 3.3 7.4 3.2 8 3.2C10.9 3.2 13.4 5 14.4 8C14 9.1 13.4 10 12.7 10.7" })
|
|
213
|
+
] })
|
|
214
|
+
);
|
|
215
|
+
var BoardEyeRevealIcon = createSvgIcon(
|
|
216
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
217
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M1.6 8C2.7 5 5.2 3.2 8 3.2C10.8 3.2 13.3 5 14.4 8C13.3 11 10.8 12.8 8 12.8C5.2 12.8 2.7 11 1.6 8Z" }),
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "2.2" })
|
|
219
|
+
] })
|
|
220
|
+
);
|
|
221
|
+
var BoardSpotlightIcon = createSvgIcon(
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "2.4" }),
|
|
224
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "5.4", strokeDasharray: "2.2 2" }),
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 1.5V3M8 13V14.5M1.5 8H3M13 8H14.5" })
|
|
226
|
+
] })
|
|
227
|
+
);
|
|
228
|
+
var BoardFollowIcon = createSvgIcon(
|
|
229
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "6.2", cy: "5.4", r: "2.2" }),
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.4 13C2.4 10.9 4.1 9.4 6.2 9.4C8.3 9.4 10 10.9 10 13" }),
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10.5 6.8H14M14 6.8L12.2 5M14 6.8L12.2 8.6" })
|
|
233
|
+
] })
|
|
234
|
+
);
|
|
235
|
+
var BoardTrophyRankIcon = createSvgIcon(
|
|
236
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
237
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 2.6H11V6.8C11 8.5 9.7 9.8 8 9.8C6.3 9.8 5 8.5 5 6.8V2.6Z" }),
|
|
238
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 4H3.2C3.2 6 4 6.8 5 7M11 4H12.8C12.8 6 12 6.8 11 7" }),
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 9.8V12.8M5.4 12.8H10.6" })
|
|
240
|
+
] })
|
|
241
|
+
);
|
|
242
|
+
var BoardDocUploadIcon = createSvgIcon(
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 2.2H9.8L12.8 5.2V13.8H4V2.2Z" }),
|
|
245
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M9.6 2.2V5.4H12.8" }),
|
|
246
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8.4 11.4V7.2M8.4 7.2L6.6 9M8.4 7.2L10.2 9" })
|
|
247
|
+
] })
|
|
248
|
+
);
|
|
204
249
|
var BOARD_ICON_MAP = {
|
|
205
250
|
BoardSelectIcon,
|
|
206
251
|
BoardHandIcon,
|
|
@@ -227,7 +272,13 @@ var BOARD_ICON_MAP = {
|
|
|
227
272
|
BoardAlignLeftIcon,
|
|
228
273
|
BoardAlignCenterIcon,
|
|
229
274
|
BoardAlignRightIcon,
|
|
230
|
-
BoardGridIcon
|
|
275
|
+
BoardGridIcon,
|
|
276
|
+
BoardEyeOffIcon,
|
|
277
|
+
BoardEyeRevealIcon,
|
|
278
|
+
BoardSpotlightIcon,
|
|
279
|
+
BoardFollowIcon,
|
|
280
|
+
BoardTrophyRankIcon,
|
|
281
|
+
BoardDocUploadIcon
|
|
231
282
|
};
|
|
232
283
|
|
|
233
284
|
// src/operations/board-ui.operation.ts
|
|
@@ -266,6 +317,24 @@ var OpenBoardMermaidModalOperation = {
|
|
|
266
317
|
return true;
|
|
267
318
|
}
|
|
268
319
|
};
|
|
320
|
+
var OpenBoardVotingModalOperation = {
|
|
321
|
+
id: "boards-ui.operation.open-voting-modal",
|
|
322
|
+
type: import_core.CommandType.OPERATION,
|
|
323
|
+
handler: (accessor, params) => {
|
|
324
|
+
const selService = accessor.get(import_univer_boards.IBoardSelectionService);
|
|
325
|
+
selService.setVotingModalOpen(params?.open ?? true);
|
|
326
|
+
return true;
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
var OpenBoardDocImportModalOperation = {
|
|
330
|
+
id: "boards-ui.operation.open-doc-import-modal",
|
|
331
|
+
type: import_core.CommandType.OPERATION,
|
|
332
|
+
handler: (accessor, params) => {
|
|
333
|
+
const selService = accessor.get(import_univer_boards.IBoardSelectionService);
|
|
334
|
+
selService.setDocImportModalOpen(params?.open ?? true);
|
|
335
|
+
return true;
|
|
336
|
+
}
|
|
337
|
+
};
|
|
269
338
|
var SetBoardToolOperation = {
|
|
270
339
|
id: "boards-ui.operation.set-tool",
|
|
271
340
|
type: import_core.CommandType.OPERATION,
|
|
@@ -475,6 +544,18 @@ var BoardsInfiniteCanvas = () => {
|
|
|
475
544
|
selectionService.getPresentationState()
|
|
476
545
|
);
|
|
477
546
|
const timer = (0, import_ui2.useObservable)(selectionService.timer$, selectionService.getTimerState());
|
|
547
|
+
const currentUserId = (0, import_ui2.useObservable)(
|
|
548
|
+
selectionService.currentUserId$,
|
|
549
|
+
selectionService.getCurrentUserId()
|
|
550
|
+
);
|
|
551
|
+
const collaborators = (0, import_ui2.useObservable)(
|
|
552
|
+
selectionService.collaborators$,
|
|
553
|
+
selectionService.getCollaborators()
|
|
554
|
+
);
|
|
555
|
+
const spotlight = (0, import_ui2.useObservable)(
|
|
556
|
+
selectionService.spotlight$,
|
|
557
|
+
selectionService.getSpotlightState()
|
|
558
|
+
);
|
|
478
559
|
const stageRef = (0, import_react.useRef)(null);
|
|
479
560
|
const [spacePressed, setSpacePressed] = (0, import_react.useState)(false);
|
|
480
561
|
const [hoveredElementId, setHoveredElementId] = (0, import_react.useState)(null);
|
|
@@ -554,13 +635,14 @@ var BoardsInfiniteCanvas = () => {
|
|
|
554
635
|
const screenToBoard = (0, import_react.useCallback)(
|
|
555
636
|
(clientX, clientY) => {
|
|
556
637
|
const rect = stageRef.current?.getBoundingClientRect() ?? { left: 0, top: 0 };
|
|
557
|
-
const
|
|
638
|
+
const rawVp = currentSnap?.viewport ?? { panX: 0, panY: 0, zoom: 1 };
|
|
639
|
+
const vp = selectionService.resolveEffectiveViewport(rawVp);
|
|
558
640
|
return {
|
|
559
641
|
x: (clientX - rect.left - vp.panX) / vp.zoom,
|
|
560
642
|
y: (clientY - rect.top - vp.panY) / vp.zoom
|
|
561
643
|
};
|
|
562
644
|
},
|
|
563
|
-
[currentSnap?.viewport]
|
|
645
|
+
[currentSnap?.viewport, selectionService]
|
|
564
646
|
);
|
|
565
647
|
const effectiveElementsMap = (0, import_react.useMemo)(() => {
|
|
566
648
|
if (!currentSnap) return {};
|
|
@@ -589,8 +671,14 @@ var BoardsInfiniteCanvas = () => {
|
|
|
589
671
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-canvas-empty", "data-testid": "boards-canvas-empty", children: "\u6B63\u5728\u51C6\u5907\u65E0\u9650\u534F\u4F5C\u767D\u677F\u753B\u5E03..." });
|
|
590
672
|
}
|
|
591
673
|
const unitId = unit.getUnitId();
|
|
592
|
-
const
|
|
674
|
+
const effectiveViewport = selectionService.resolveEffectiveViewport(currentSnap.viewport);
|
|
675
|
+
const { panX, panY, zoom } = effectiveViewport;
|
|
593
676
|
const framesOrdered = unit.getFramesOrdered();
|
|
677
|
+
const brainstorm = currentSnap.brainstorm;
|
|
678
|
+
const votingSession = currentSnap.votingSession;
|
|
679
|
+
const mySessionVotes = votingSession?.votesByUser[currentUserId] ?? [];
|
|
680
|
+
const remainingSessionVotes = votingSession ? Math.max(0, votingSession.maxVotesPerUser - mySessionVotes.length) : 0;
|
|
681
|
+
const isHostingSpotlight = spotlight.spotlightHostId === currentUserId;
|
|
594
682
|
const orderedElements = (currentSnap.elementOrder.length ? currentSnap.elementOrder : Object.keys(currentSnap.elements)).map((id) => effectiveElementsMap[id]).filter((el) => Boolean(el && !el.hidden));
|
|
595
683
|
const visibleMindmaps = orderedElements.filter(
|
|
596
684
|
(el) => el.type === "mindmap" && !(0, import_univer_boards2.isMindmapNodeCollapsedHidden)(el, effectiveElementsMap)
|
|
@@ -630,6 +718,9 @@ var BoardsInfiniteCanvas = () => {
|
|
|
630
718
|
selectionService.setEditingElement(null);
|
|
631
719
|
};
|
|
632
720
|
const startInlineEdit = (el) => {
|
|
721
|
+
if (el.type === "sticky" && (0, import_univer_boards2.isStickyMaskedForViewer)(el, currentSnap.brainstorm, currentUserId)) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
633
724
|
const initial = el.type === "frame" || el.type === "swimlane" || el.type === "entityCard" || el.type === "chart" ? el.title : el.type === "sticky" || el.type === "shape" || el.type === "mindmap" || el.type === "text" ? el.text : "";
|
|
634
725
|
setEditingDraft(initial);
|
|
635
726
|
selectionService.setEditingElement(el.id);
|
|
@@ -687,7 +778,11 @@ var BoardsInfiniteCanvas = () => {
|
|
|
687
778
|
y: Math.round(boardPt.y - 40)
|
|
688
779
|
};
|
|
689
780
|
if (activeTool === "shape") extra.shapeType = activeShapeType;
|
|
690
|
-
if (activeTool === "sticky")
|
|
781
|
+
if (activeTool === "sticky") {
|
|
782
|
+
extra.color = activeStickyColor;
|
|
783
|
+
extra.authorId = currentUserId;
|
|
784
|
+
extra.author = selectionService.getCurrentUserName();
|
|
785
|
+
}
|
|
691
786
|
commandService.syncExecuteCommand(import_univer_boards2.AddBoardElementsCommand.id, {
|
|
692
787
|
unitId,
|
|
693
788
|
element: {
|
|
@@ -1321,6 +1416,124 @@ var BoardsInfiniteCanvas = () => {
|
|
|
1321
1416
|
}
|
|
1322
1417
|
)
|
|
1323
1418
|
] }),
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-workshop-group", "data-testid": "boards-workshop-controls", children: [
|
|
1420
|
+
!brainstorm?.active ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1421
|
+
"button",
|
|
1422
|
+
{
|
|
1423
|
+
type: "button",
|
|
1424
|
+
className: "yudao-boards-top-btn",
|
|
1425
|
+
"data-testid": "boards-brainstorm-start",
|
|
1426
|
+
title: "\u5F00\u542F\u79C1\u5BC6\u5171\u521B\uFF1A\u63ED\u6653\u524D\u4EC5\u81EA\u5DF1\u53EF\u89C1\u672C\u4EBA\u4FBF\u7B7E",
|
|
1427
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards2.StartPrivateBrainstormCommand.id, {
|
|
1428
|
+
unitId,
|
|
1429
|
+
facilitatorId: currentUserId
|
|
1430
|
+
}),
|
|
1431
|
+
children: [
|
|
1432
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardEyeOffIcon, {}),
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u79C1\u5BC6\u5171\u521B" })
|
|
1434
|
+
]
|
|
1435
|
+
}
|
|
1436
|
+
) : !brainstorm.revealed ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1438
|
+
"button",
|
|
1439
|
+
{
|
|
1440
|
+
type: "button",
|
|
1441
|
+
className: "yudao-boards-top-btn is-active",
|
|
1442
|
+
"data-testid": "boards-brainstorm-reveal",
|
|
1443
|
+
title: "\u5411\u5168\u5458\u7EDF\u4E00\u63ED\u793A\u6240\u6709\u79C1\u5BC6\u4FBF\u7B7E",
|
|
1444
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards2.RevealPrivateBrainstormCommand.id, {
|
|
1445
|
+
unitId
|
|
1446
|
+
}),
|
|
1447
|
+
children: [
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardEyeRevealIcon, {}),
|
|
1449
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u7EDF\u4E00\u63ED\u793A" })
|
|
1450
|
+
]
|
|
1451
|
+
}
|
|
1452
|
+
),
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1454
|
+
"button",
|
|
1455
|
+
{
|
|
1456
|
+
type: "button",
|
|
1457
|
+
className: "yudao-boards-top-btn",
|
|
1458
|
+
"data-testid": "boards-brainstorm-stop",
|
|
1459
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards2.StopPrivateBrainstormCommand.id, {
|
|
1460
|
+
unitId
|
|
1461
|
+
}),
|
|
1462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u7ED3\u675F" })
|
|
1463
|
+
}
|
|
1464
|
+
)
|
|
1465
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1466
|
+
"button",
|
|
1467
|
+
{
|
|
1468
|
+
type: "button",
|
|
1469
|
+
className: "yudao-boards-top-btn",
|
|
1470
|
+
"data-testid": "boards-brainstorm-stop",
|
|
1471
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards2.StopPrivateBrainstormCommand.id, {
|
|
1472
|
+
unitId
|
|
1473
|
+
}),
|
|
1474
|
+
children: [
|
|
1475
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardEyeRevealIcon, {}),
|
|
1476
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5DF2\u63ED\u793A\xB7\u9000\u51FA" })
|
|
1477
|
+
]
|
|
1478
|
+
}
|
|
1479
|
+
),
|
|
1480
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1481
|
+
"button",
|
|
1482
|
+
{
|
|
1483
|
+
type: "button",
|
|
1484
|
+
className: `yudao-boards-top-btn ${votingSession?.active ? "is-active" : ""}`,
|
|
1485
|
+
"data-testid": "boards-voting-open",
|
|
1486
|
+
onClick: () => commandService.syncExecuteCommand(OpenBoardVotingModalOperation.id, { open: true }),
|
|
1487
|
+
children: [
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardTrophyRankIcon, {}),
|
|
1489
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: votingSession?.active ? `\u6295\u7968\xB7\u5269${remainingSessionVotes}\u7968` : "\u9650\u989D\u6295\u7968" })
|
|
1490
|
+
]
|
|
1491
|
+
}
|
|
1492
|
+
)
|
|
1493
|
+
] }),
|
|
1494
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-presence-group", "data-testid": "boards-presence-bar", children: [
|
|
1495
|
+
collaborators.map((collab) => {
|
|
1496
|
+
const isFollowing = spotlight.followingUserId === collab.userId;
|
|
1497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1498
|
+
"button",
|
|
1499
|
+
{
|
|
1500
|
+
type: "button",
|
|
1501
|
+
className: `yudao-boards-collab-pill ${isFollowing ? "is-following" : ""}`,
|
|
1502
|
+
"data-testid": `boards-collab-pill-${collab.userId}`,
|
|
1503
|
+
title: `\u70B9\u51FB\u8DDF\u968F ${collab.userName} \u7684\u89C6\u89D2 (Follow)`,
|
|
1504
|
+
onClick: () => selectionService.setFollowingUser(isFollowing ? null : collab.userId),
|
|
1505
|
+
children: [
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1507
|
+
"span",
|
|
1508
|
+
{
|
|
1509
|
+
className: "yudao-boards-collab-avatar",
|
|
1510
|
+
style: { backgroundColor: collab.color || "#2563EB" },
|
|
1511
|
+
children: (collab.userName || collab.userId).slice(0, 1).toUpperCase()
|
|
1512
|
+
}
|
|
1513
|
+
),
|
|
1514
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: collab.userName }),
|
|
1515
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardFollowIcon, {}),
|
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-collab-follow-tag", children: isFollowing ? "\u8DDF\u968F\u4E2D" : "\u8DDF\u968F\u89C6\u89D2" })
|
|
1517
|
+
]
|
|
1518
|
+
},
|
|
1519
|
+
collab.userId
|
|
1520
|
+
);
|
|
1521
|
+
}),
|
|
1522
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1523
|
+
"button",
|
|
1524
|
+
{
|
|
1525
|
+
type: "button",
|
|
1526
|
+
className: `yudao-boards-top-btn ${isHostingSpotlight ? "is-active" : ""}`,
|
|
1527
|
+
"data-testid": "boards-spotlight-me",
|
|
1528
|
+
title: "\u5E7F\u64AD\u4E3B\u8BB2\u89C6\u89D2\uFF0C\u5F15\u5BFC\u5168\u5458\u805A\u7126\u5F53\u524D\u753B\u9762 (Spotlight)",
|
|
1529
|
+
onClick: () => selectionService.setSpotlightHost(isHostingSpotlight ? null : currentUserId),
|
|
1530
|
+
children: [
|
|
1531
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardSpotlightIcon, {}),
|
|
1532
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: isHostingSpotlight ? "\u805A\u7126\u4E3B\u8BB2\u4E2D" : "\u5168\u5458\u805A\u7126\u6211" })
|
|
1533
|
+
]
|
|
1534
|
+
}
|
|
1535
|
+
)
|
|
1536
|
+
] }),
|
|
1324
1537
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-timer-group", "data-testid": "boards-workshop-timer", children: [
|
|
1325
1538
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardTimerIcon, {}),
|
|
1326
1539
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-timer-clock", children: formatCountdown(timer.remainingSec) }),
|
|
@@ -1815,6 +2028,33 @@ var BoardsInfiniteCanvas = () => {
|
|
|
1815
2028
|
el.type === "sticky" && (() => {
|
|
1816
2029
|
const sticky = el;
|
|
1817
2030
|
const pal = (0, import_univer_boards2.resolveStickyPalette)(sticky.color);
|
|
2031
|
+
const isMasked = (0, import_univer_boards2.isStickyMaskedForViewer)(sticky, brainstorm, currentUserId);
|
|
2032
|
+
if (isMasked) {
|
|
2033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2034
|
+
"div",
|
|
2035
|
+
{
|
|
2036
|
+
className: "yudao-boards-sticky-card is-masked",
|
|
2037
|
+
"data-testid": `sticky-masked-${sticky.id}`,
|
|
2038
|
+
style: {
|
|
2039
|
+
backgroundColor: pal.fill,
|
|
2040
|
+
borderColor: pal.border,
|
|
2041
|
+
color: pal.text
|
|
2042
|
+
},
|
|
2043
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-sticky-privacy-mask", children: [
|
|
2044
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-sticky-blur-bars", "aria-hidden": "true", children: [
|
|
2045
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {}),
|
|
2046
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {}),
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {})
|
|
2048
|
+
] }),
|
|
2049
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-sticky-mask-badge", children: [
|
|
2050
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardEyeOffIcon, {}),
|
|
2051
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u601D\u8003\u8F93\u5165\u4E2D \xB7 \u5F85\u63ED\u793A" })
|
|
2052
|
+
] })
|
|
2053
|
+
] })
|
|
2054
|
+
}
|
|
2055
|
+
);
|
|
2056
|
+
}
|
|
2057
|
+
const authorLabel = brainstorm?.hideAuthorNames ? "\u533F\u540D\u5171\u521B" : sticky.author ?? "";
|
|
1818
2058
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1819
2059
|
"div",
|
|
1820
2060
|
{
|
|
@@ -1836,7 +2076,7 @@ var BoardsInfiniteCanvas = () => {
|
|
|
1836
2076
|
}
|
|
1837
2077
|
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-sticky-text", children: sticky.text }),
|
|
1838
2078
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-sticky-footer", children: [
|
|
1839
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-sticky-author", children:
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-sticky-author", children: authorLabel }),
|
|
1840
2080
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1841
2081
|
"button",
|
|
1842
2082
|
{
|
|
@@ -1847,10 +2087,18 @@ var BoardsInfiniteCanvas = () => {
|
|
|
1847
2087
|
onPointerDown: (e) => e.stopPropagation(),
|
|
1848
2088
|
onClick: (e) => {
|
|
1849
2089
|
e.stopPropagation();
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
2090
|
+
if (votingSession?.active) {
|
|
2091
|
+
commandService.syncExecuteCommand(import_univer_boards2.CastBoardSessionVoteCommand.id, {
|
|
2092
|
+
unitId,
|
|
2093
|
+
elementId: sticky.id,
|
|
2094
|
+
voterId: currentUserId
|
|
2095
|
+
});
|
|
2096
|
+
} else {
|
|
2097
|
+
commandService.syncExecuteCommand(import_univer_boards2.VoteBoardStickyCommand.id, {
|
|
2098
|
+
unitId,
|
|
2099
|
+
elementId: sticky.id
|
|
2100
|
+
});
|
|
2101
|
+
}
|
|
1854
2102
|
},
|
|
1855
2103
|
children: [
|
|
1856
2104
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardVoteThumbIcon, {}),
|
|
@@ -2079,6 +2327,36 @@ var BoardsInfiniteCanvas = () => {
|
|
|
2079
2327
|
},
|
|
2080
2328
|
pin.id
|
|
2081
2329
|
)),
|
|
2330
|
+
collaborators.map((collab) => {
|
|
2331
|
+
if (!collab.cursor || collab.userId === currentUserId) return null;
|
|
2332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2333
|
+
"div",
|
|
2334
|
+
{
|
|
2335
|
+
className: "yudao-boards-remote-cursor",
|
|
2336
|
+
style: { left: collab.cursor.x, top: collab.cursor.y },
|
|
2337
|
+
children: [
|
|
2338
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2339
|
+
"path",
|
|
2340
|
+
{
|
|
2341
|
+
d: "M1.5 1.5L12.5 6.2L7.4 7.6L5.8 12.6L1.5 1.5Z",
|
|
2342
|
+
fill: collab.color || "#2563EB",
|
|
2343
|
+
stroke: "#FFFFFF",
|
|
2344
|
+
strokeWidth: "1.2"
|
|
2345
|
+
}
|
|
2346
|
+
) }),
|
|
2347
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2348
|
+
"span",
|
|
2349
|
+
{
|
|
2350
|
+
className: "yudao-boards-remote-cursor-tag",
|
|
2351
|
+
style: { backgroundColor: collab.color || "#2563EB" },
|
|
2352
|
+
children: collab.userName
|
|
2353
|
+
}
|
|
2354
|
+
)
|
|
2355
|
+
]
|
|
2356
|
+
},
|
|
2357
|
+
`cursor-${collab.userId}`
|
|
2358
|
+
);
|
|
2359
|
+
}),
|
|
2082
2360
|
marqueeBox && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2083
2361
|
"div",
|
|
2084
2362
|
{
|
|
@@ -2867,6 +3145,7 @@ var BoardsLeftSidebar = () => {
|
|
|
2867
3145
|
);
|
|
2868
3146
|
const [activeTab, setActiveTab] = (0, import_react2.useState)("frames");
|
|
2869
3147
|
const [csvInput, setCsvInput] = (0, import_react2.useState)("text,color,author,votes\n\u7070\u5EA6\u7F51\u5173\u65E0\u635F\u5207\u6362,green,\u6797\u5DE5,3\n\u8865\u5145\u6162\u67E5\u8BE2\u7D22\u5F15\u5DE1\u68C0,yellow,\u9648\u5DE5,2");
|
|
3148
|
+
const quickDocInputRef = (0, import_react2.useRef)(null);
|
|
2870
3149
|
const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
|
|
2871
3150
|
if (!currentSnap || !unit) {
|
|
2872
3151
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-left-sidebar yudao-boards-empty", children: "\u672A\u6302\u8F7D\u767D\u677F\u5B9E\u4F8B" });
|
|
@@ -2912,6 +3191,23 @@ var BoardsLeftSidebar = () => {
|
|
|
2912
3191
|
});
|
|
2913
3192
|
}
|
|
2914
3193
|
};
|
|
3194
|
+
const handleQuickDocUpload = async (e) => {
|
|
3195
|
+
const file = e.target.files?.[0];
|
|
3196
|
+
if (!file) return;
|
|
3197
|
+
try {
|
|
3198
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
3199
|
+
const ok = await commandService.executeCommand(import_univer_boards5.ImportDocumentPagesToBoardCommand.id, {
|
|
3200
|
+
unitId: unit.getUnitId(),
|
|
3201
|
+
fileBytes: bytes,
|
|
3202
|
+
fileName: file.name
|
|
3203
|
+
});
|
|
3204
|
+
if (ok) {
|
|
3205
|
+
commandService.syncExecuteCommand(FitBoardToScreenOperation.id);
|
|
3206
|
+
}
|
|
3207
|
+
} finally {
|
|
3208
|
+
if (e.target) e.target.value = "";
|
|
3209
|
+
}
|
|
3210
|
+
};
|
|
2915
3211
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("aside", { className: "yudao-boards-left-sidebar", "data-testid": "boards-left-sidebar", children: [
|
|
2916
3212
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-sidebar-tabs", children: [
|
|
2917
3213
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
@@ -2946,7 +3242,7 @@ var BoardsLeftSidebar = () => {
|
|
|
2946
3242
|
type: "button",
|
|
2947
3243
|
className: activeTab === "templates" ? "is-active" : "",
|
|
2948
3244
|
onClick: () => setActiveTab("templates"),
|
|
2949
|
-
children: "\u6A21\u677F
|
|
3245
|
+
children: "\u6A21\u677F/\u5BFC\u5165"
|
|
2950
3246
|
}
|
|
2951
3247
|
)
|
|
2952
3248
|
] }),
|
|
@@ -3039,6 +3335,41 @@ var BoardsLeftSidebar = () => {
|
|
|
3039
3335
|
]
|
|
3040
3336
|
}
|
|
3041
3337
|
),
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3339
|
+
"button",
|
|
3340
|
+
{
|
|
3341
|
+
type: "button",
|
|
3342
|
+
className: "yudao-boards-secondary-block-btn",
|
|
3343
|
+
"data-testid": "boards-sidebar-import-doc",
|
|
3344
|
+
onClick: () => commandService.syncExecuteCommand(OpenBoardDocImportModalOperation.id, { open: true }),
|
|
3345
|
+
children: [
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardDocUploadIcon, {}),
|
|
3347
|
+
" \u5BFC\u5165 PDF / PPTX \u62C6\u9875\u4E0A\u5899"
|
|
3348
|
+
]
|
|
3349
|
+
}
|
|
3350
|
+
),
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3352
|
+
"input",
|
|
3353
|
+
{
|
|
3354
|
+
ref: quickDocInputRef,
|
|
3355
|
+
type: "file",
|
|
3356
|
+
accept: ".pdf,.pptx,application/pdf,application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
3357
|
+
style: { display: "none" },
|
|
3358
|
+
onChange: (ev) => void handleQuickDocUpload(ev)
|
|
3359
|
+
}
|
|
3360
|
+
),
|
|
3361
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3362
|
+
"button",
|
|
3363
|
+
{
|
|
3364
|
+
type: "button",
|
|
3365
|
+
className: "yudao-boards-secondary-block-btn",
|
|
3366
|
+
onClick: () => quickDocInputRef.current?.click(),
|
|
3367
|
+
children: [
|
|
3368
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardDocUploadIcon, {}),
|
|
3369
|
+
" \u5FEB\u901F\u9009\u62E9\u672C\u5730 PDF / PPTX \u6587\u4EF6"
|
|
3370
|
+
]
|
|
3371
|
+
}
|
|
3372
|
+
),
|
|
3042
3373
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3043
3374
|
"button",
|
|
3044
3375
|
{
|
|
@@ -3093,19 +3424,19 @@ var BoardsLeftSidebar = () => {
|
|
|
3093
3424
|
] });
|
|
3094
3425
|
};
|
|
3095
3426
|
|
|
3096
|
-
// src/views/modals/
|
|
3427
|
+
// src/views/modals/BoardsDocImportModal.tsx
|
|
3097
3428
|
var import_core6 = require("@univerjs/core");
|
|
3098
3429
|
var import_ui6 = require("@univerjs/ui");
|
|
3099
3430
|
var import_univer_boards6 = require("@yudaocode/univer-boards");
|
|
3100
3431
|
var import_react3 = require("react");
|
|
3101
3432
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3102
|
-
var
|
|
3433
|
+
var BoardsDocImportModal = ({ forceOpen }) => {
|
|
3103
3434
|
const instanceService = (0, import_ui6.useDependency)(import_core6.IUniverInstanceService);
|
|
3104
3435
|
const commandService = (0, import_ui6.useDependency)(import_core6.ICommandService);
|
|
3105
3436
|
const selectionService = (0, import_ui6.useDependency)(import_univer_boards6.IBoardSelectionService);
|
|
3106
3437
|
const isOpen = (0, import_ui6.useObservable)(
|
|
3107
|
-
selectionService.
|
|
3108
|
-
selectionService.
|
|
3438
|
+
selectionService.docImportModalOpen$,
|
|
3439
|
+
selectionService.isDocImportModalOpen()
|
|
3109
3440
|
);
|
|
3110
3441
|
const unit = (0, import_ui6.useObservable)(
|
|
3111
3442
|
() => instanceService.getCurrentTypeOfUnit$(import_core6.UniverInstanceType.UNIVER_BOARD),
|
|
@@ -3113,14 +3444,172 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3113
3444
|
false,
|
|
3114
3445
|
[instanceService]
|
|
3115
3446
|
);
|
|
3116
|
-
const
|
|
3447
|
+
const fileInputRef = (0, import_react3.useRef)(null);
|
|
3448
|
+
const [columns, setColumns] = (0, import_react3.useState)(3);
|
|
3117
3449
|
const [replaceExisting, setReplaceExisting] = (0, import_react3.useState)(false);
|
|
3118
|
-
const [
|
|
3119
|
-
const
|
|
3450
|
+
const [busy, setBusy] = (0, import_react3.useState)(false);
|
|
3451
|
+
const [statusMessage, setStatusMessage] = (0, import_react3.useState)("");
|
|
3452
|
+
if (!isOpen && !forceOpen) return null;
|
|
3453
|
+
const handleClose = () => {
|
|
3454
|
+
selectionService.setDocImportModalOpen(false);
|
|
3455
|
+
setStatusMessage("");
|
|
3456
|
+
};
|
|
3457
|
+
const handleFileChange = async (e) => {
|
|
3458
|
+
const file = e.target.files?.[0];
|
|
3459
|
+
if (!file || !unit) return;
|
|
3460
|
+
setBusy(true);
|
|
3461
|
+
setStatusMessage(`\u6B63\u5728\u89E3\u6790 ${file.name}...`);
|
|
3120
3462
|
try {
|
|
3121
|
-
const
|
|
3122
|
-
const
|
|
3123
|
-
const
|
|
3463
|
+
const ab = await file.arrayBuffer();
|
|
3464
|
+
const bytes = new Uint8Array(ab);
|
|
3465
|
+
const ok = await commandService.executeCommand(import_univer_boards6.ImportDocumentPagesToBoardCommand.id, {
|
|
3466
|
+
unitId: unit.getUnitId(),
|
|
3467
|
+
fileBytes: bytes,
|
|
3468
|
+
fileName: file.name,
|
|
3469
|
+
columns,
|
|
3470
|
+
replaceExisting
|
|
3471
|
+
});
|
|
3472
|
+
if (ok) {
|
|
3473
|
+
commandService.syncExecuteCommand(FitBoardToScreenOperation.id);
|
|
3474
|
+
selectionService.setDocImportModalOpen(false);
|
|
3475
|
+
setStatusMessage("");
|
|
3476
|
+
} else {
|
|
3477
|
+
setStatusMessage("\u672A\u80FD\u8BC6\u522B\u6709\u6548\u7684 PDF \u6216 PPTX \u9875\u9762\u7ED3\u6784\uFF0C\u8BF7\u68C0\u67E5\u6587\u4EF6\u683C\u5F0F\u3002");
|
|
3478
|
+
}
|
|
3479
|
+
} catch (err) {
|
|
3480
|
+
setStatusMessage(err instanceof Error ? err.message : "\u6587\u6863\u89E3\u6790\u5931\u8D25");
|
|
3481
|
+
} finally {
|
|
3482
|
+
setBusy(false);
|
|
3483
|
+
if (e.target) {
|
|
3484
|
+
e.target.value = "";
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
};
|
|
3488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3489
|
+
"div",
|
|
3490
|
+
{
|
|
3491
|
+
className: "yudao-boards-modal-backdrop",
|
|
3492
|
+
"data-testid": "boards-doc-import-modal",
|
|
3493
|
+
onClick: handleClose,
|
|
3494
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3495
|
+
"div",
|
|
3496
|
+
{
|
|
3497
|
+
className: "yudao-boards-doc-import-dialog",
|
|
3498
|
+
onClick: (e) => e.stopPropagation(),
|
|
3499
|
+
children: [
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { className: "yudao-boards-mermaid-header", children: [
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-mermaid-title", children: [
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BoardDocUploadIcon, {}),
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "\u5BFC\u5165 PDF / PPTX \u62C6\u9875\u4E0A\u5899\u5DE5\u4F5C\u53F0" })
|
|
3504
|
+
] }),
|
|
3505
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3506
|
+
"button",
|
|
3507
|
+
{
|
|
3508
|
+
type: "button",
|
|
3509
|
+
className: "yudao-boards-btn-ghost",
|
|
3510
|
+
onClick: handleClose,
|
|
3511
|
+
children: "\u5173\u95ED"
|
|
3512
|
+
}
|
|
3513
|
+
)
|
|
3514
|
+
] }),
|
|
3515
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-doc-import-body", children: [
|
|
3516
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "yudao-boards-doc-desc", children: [
|
|
3517
|
+
"\u652F\u6301\u5C06\u591A\u9875\u6F14\u793A\u6587\u7A3F\uFF08",
|
|
3518
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { children: ".pptx" }),
|
|
3519
|
+
"\uFF09\u6216\u65B9\u6848\u8BC4\u5BA1\u6587\u6863\uFF08",
|
|
3520
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("code", { children: ".pdf" }),
|
|
3521
|
+
"\uFF09\u81EA\u52A8\u6309\u9875\u62C6\u5206\u4E3A\u6709\u5E8F\u767D\u677F\u753B\u6846\uFF08Frame\uFF09\u77E9\u9635\u5E73\u94FA\u5230\u65E0\u9650\u753B\u5E03\uFF1APPTX \u5E7B\u706F\u7247\u81EA\u52A8\u8FD8\u539F\u4E3A\u53EF\u7F16\u8F91\u539F\u751F\u5F62\u72B6\u3001\u6587\u672C\u3001\u8868\u683C\u4E0E\u56FE\u7247\uFF0CPDF \u9875\u9762\u751F\u6210\u6807\u51C6\u8BC4\u5BA1\u753B\u6846\u4EE5\u4FBF\u76F4\u63A5\u8D34\u4FBF\u7B7E\u3001\u8FDE\u7EBF\u548C\u753B\u7B14\u5708\u9605\u3002"
|
|
3522
|
+
] }),
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-doc-options", children: [
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-voting-field", children: [
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "\u5E73\u94FA\u7F51\u683C\u5217\u6570" }),
|
|
3526
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "yudao-boards-quota-pills", children: [2, 3, 4].map((colCount) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3527
|
+
"button",
|
|
3528
|
+
{
|
|
3529
|
+
type: "button",
|
|
3530
|
+
className: `yudao-boards-preset-pill ${columns === colCount ? "is-selected" : ""}`,
|
|
3531
|
+
onClick: () => setColumns(colCount),
|
|
3532
|
+
children: [
|
|
3533
|
+
"\u6BCF\u884C ",
|
|
3534
|
+
colCount,
|
|
3535
|
+
" \u9875"
|
|
3536
|
+
]
|
|
3537
|
+
},
|
|
3538
|
+
colCount
|
|
3539
|
+
)) })
|
|
3540
|
+
] }),
|
|
3541
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "yudao-boards-checkbox-label", children: [
|
|
3542
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3543
|
+
"input",
|
|
3544
|
+
{
|
|
3545
|
+
type: "checkbox",
|
|
3546
|
+
checked: replaceExisting,
|
|
3547
|
+
onChange: (e) => setReplaceExisting(e.target.checked)
|
|
3548
|
+
}
|
|
3549
|
+
),
|
|
3550
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "\u62C6\u9875\u4E0A\u5899\u524D\u6E05\u7A7A\u5F53\u524D\u753B\u5E03\u539F\u6709\u5143\u7D20" })
|
|
3551
|
+
] })
|
|
3552
|
+
] }),
|
|
3553
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3554
|
+
"input",
|
|
3555
|
+
{
|
|
3556
|
+
ref: fileInputRef,
|
|
3557
|
+
type: "file",
|
|
3558
|
+
accept: ".pdf,.pptx,application/pdf,application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
3559
|
+
"data-testid": "boards-doc-file-input",
|
|
3560
|
+
style: { display: "none" },
|
|
3561
|
+
onChange: (ev) => void handleFileChange(ev)
|
|
3562
|
+
}
|
|
3563
|
+
),
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
3565
|
+
"div",
|
|
3566
|
+
{
|
|
3567
|
+
className: "yudao-boards-upload-dropzone",
|
|
3568
|
+
onClick: () => fileInputRef.current?.click(),
|
|
3569
|
+
children: [
|
|
3570
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BoardDocUploadIcon, {}),
|
|
3571
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: busy ? "\u6B63\u5728\u62C6\u9875\u5E73\u94FA\u81F3\u65E0\u9650\u753B\u5E03..." : "\u70B9\u51FB\u9009\u62E9\u672C\u5730 .PDF \u6216 .PPTX \u6587\u6863\u62C6\u9875\u4E0A\u5899" }),
|
|
3572
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "\u7EAF\u524D\u7AEF\u6D41\u5F0F\u89E3\u6790 \xB7 \u81EA\u52A8\u751F\u6210\u6709\u5E8F\u8BC4\u5BA1\u753B\u6846\u5E8F\u5217" })
|
|
3573
|
+
]
|
|
3574
|
+
}
|
|
3575
|
+
),
|
|
3576
|
+
statusMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "yudao-boards-hint-box", children: statusMessage })
|
|
3577
|
+
] })
|
|
3578
|
+
]
|
|
3579
|
+
}
|
|
3580
|
+
)
|
|
3581
|
+
}
|
|
3582
|
+
);
|
|
3583
|
+
};
|
|
3584
|
+
|
|
3585
|
+
// src/views/modals/BoardsMermaidModal.tsx
|
|
3586
|
+
var import_core7 = require("@univerjs/core");
|
|
3587
|
+
var import_ui7 = require("@univerjs/ui");
|
|
3588
|
+
var import_univer_boards7 = require("@yudaocode/univer-boards");
|
|
3589
|
+
var import_react4 = require("react");
|
|
3590
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3591
|
+
var BoardsMermaidModal = ({ forceOpen }) => {
|
|
3592
|
+
const instanceService = (0, import_ui7.useDependency)(import_core7.IUniverInstanceService);
|
|
3593
|
+
const commandService = (0, import_ui7.useDependency)(import_core7.ICommandService);
|
|
3594
|
+
const selectionService = (0, import_ui7.useDependency)(import_univer_boards7.IBoardSelectionService);
|
|
3595
|
+
const isOpen = (0, import_ui7.useObservable)(
|
|
3596
|
+
selectionService.mermaidModalOpen$,
|
|
3597
|
+
selectionService.isMermaidModalOpen()
|
|
3598
|
+
);
|
|
3599
|
+
const unit = (0, import_ui7.useObservable)(
|
|
3600
|
+
() => instanceService.getCurrentTypeOfUnit$(import_core7.UniverInstanceType.UNIVER_BOARD),
|
|
3601
|
+
instanceService.getCurrentUnitOfType(import_core7.UniverInstanceType.UNIVER_BOARD),
|
|
3602
|
+
false,
|
|
3603
|
+
[instanceService]
|
|
3604
|
+
);
|
|
3605
|
+
const [code, setCode] = (0, import_react4.useState)(import_univer_boards7.MERMAID_PRESET_TEMPLATES[0].code);
|
|
3606
|
+
const [replaceExisting, setReplaceExisting] = (0, import_react4.useState)(false);
|
|
3607
|
+
const [reverseKind, setReverseKind] = (0, import_react4.useState)("auto");
|
|
3608
|
+
const previewInfo = (0, import_react4.useMemo)(() => {
|
|
3609
|
+
try {
|
|
3610
|
+
const elements = (0, import_univer_boards7.parseMermaidToBoardElements)(code, { originX: 40, originY: 40 });
|
|
3611
|
+
const detectedType = (0, import_univer_boards7.detectMermaidDiagramType)(code);
|
|
3612
|
+
const tempSnap = (0, import_univer_boards7.createDefaultBoardUnitData)({
|
|
3124
3613
|
id: "mermaid-preview",
|
|
3125
3614
|
name: "Preview",
|
|
3126
3615
|
gridStyle: "dots",
|
|
@@ -3129,7 +3618,7 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3129
3618
|
elementOrder: elements.map((el) => el.id),
|
|
3130
3619
|
frameOrder: elements.filter((el) => el.type === "frame").map((el) => el.id)
|
|
3131
3620
|
});
|
|
3132
|
-
const svg = (0,
|
|
3621
|
+
const svg = (0, import_univer_boards7.exportBoardToSvg)(tempSnap, { padding: 28 });
|
|
3133
3622
|
const framesCount = elements.filter((e) => e.type === "frame").length;
|
|
3134
3623
|
const connectorsCount = elements.filter((e) => e.type === "connector").length;
|
|
3135
3624
|
const nodesCount = elements.length - framesCount - connectorsCount;
|
|
@@ -3160,7 +3649,7 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3160
3649
|
};
|
|
3161
3650
|
const handleParseAndInsert = () => {
|
|
3162
3651
|
if (!unit || !code.trim()) return;
|
|
3163
|
-
const ok = commandService.syncExecuteCommand(
|
|
3652
|
+
const ok = commandService.syncExecuteCommand(import_univer_boards7.ImportMermaidToBoardCommand.id, {
|
|
3164
3653
|
unitId: unit.getUnitId(),
|
|
3165
3654
|
mermaidCode: code,
|
|
3166
3655
|
originX: 120,
|
|
@@ -3173,29 +3662,29 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3173
3662
|
};
|
|
3174
3663
|
const handleReverseFromCanvas = () => {
|
|
3175
3664
|
if (!unit) return;
|
|
3176
|
-
const generated = (0,
|
|
3665
|
+
const generated = (0, import_univer_boards7.exportBoardToMermaid)(unit.save(), {
|
|
3177
3666
|
diagramType: reverseKind
|
|
3178
3667
|
});
|
|
3179
3668
|
setCode(generated);
|
|
3180
3669
|
};
|
|
3181
|
-
return /* @__PURE__ */ (0,
|
|
3670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3182
3671
|
"div",
|
|
3183
3672
|
{
|
|
3184
3673
|
className: "yudao-boards-modal-backdrop",
|
|
3185
3674
|
"data-testid": "boards-mermaid-modal",
|
|
3186
3675
|
onClick: handleClose,
|
|
3187
|
-
children: /* @__PURE__ */ (0,
|
|
3676
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
3188
3677
|
"div",
|
|
3189
3678
|
{
|
|
3190
3679
|
className: "yudao-boards-mermaid-dialog",
|
|
3191
3680
|
onClick: (e) => e.stopPropagation(),
|
|
3192
3681
|
children: [
|
|
3193
|
-
/* @__PURE__ */ (0,
|
|
3194
|
-
/* @__PURE__ */ (0,
|
|
3195
|
-
/* @__PURE__ */ (0,
|
|
3196
|
-
/* @__PURE__ */ (0,
|
|
3682
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("header", { className: "yudao-boards-mermaid-header", children: [
|
|
3683
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "yudao-boards-mermaid-title", children: [
|
|
3684
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BoardMermaidIcon, {}),
|
|
3685
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Mermaid \u6D41\u7A0B\u56FE\u4E0E\u67B6\u6784\u4EE3\u7801\u53CC\u5411\u4E92\u8F6C\u5DE5\u4F5C\u53F0" })
|
|
3197
3686
|
] }),
|
|
3198
|
-
/* @__PURE__ */ (0,
|
|
3687
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3199
3688
|
"button",
|
|
3200
3689
|
{
|
|
3201
3690
|
type: "button",
|
|
@@ -3205,9 +3694,9 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3205
3694
|
}
|
|
3206
3695
|
)
|
|
3207
3696
|
] }),
|
|
3208
|
-
/* @__PURE__ */ (0,
|
|
3209
|
-
/* @__PURE__ */ (0,
|
|
3210
|
-
|
|
3697
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "yudao-boards-mermaid-presets", children: [
|
|
3698
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "yudao-boards-presets-label", children: "\u573A\u666F\u6A21\u677F\uFF1A" }),
|
|
3699
|
+
import_univer_boards7.MERMAID_PRESET_TEMPLATES.map((tpl) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3211
3700
|
"button",
|
|
3212
3701
|
{
|
|
3213
3702
|
type: "button",
|
|
@@ -3219,32 +3708,32 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3219
3708
|
tpl.key
|
|
3220
3709
|
))
|
|
3221
3710
|
] }),
|
|
3222
|
-
/* @__PURE__ */ (0,
|
|
3223
|
-
/* @__PURE__ */ (0,
|
|
3224
|
-
/* @__PURE__ */ (0,
|
|
3225
|
-
/* @__PURE__ */ (0,
|
|
3711
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "yudao-boards-mermaid-split", children: [
|
|
3712
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "yudao-boards-mermaid-editor-pane", children: [
|
|
3713
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "yudao-boards-pane-toolbar", children: [
|
|
3714
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
3226
3715
|
"Mermaid DSL \u6E90\u7801 (",
|
|
3227
3716
|
previewInfo.detectedType,
|
|
3228
3717
|
")"
|
|
3229
3718
|
] }),
|
|
3230
|
-
/* @__PURE__ */ (0,
|
|
3231
|
-
/* @__PURE__ */ (0,
|
|
3719
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "yudao-boards-reverse-bar", children: [
|
|
3720
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
3232
3721
|
"select",
|
|
3233
3722
|
{
|
|
3234
3723
|
value: reverseKind,
|
|
3235
3724
|
onChange: (e) => setReverseKind(e.target.value),
|
|
3236
3725
|
className: "yudao-boards-select-sm",
|
|
3237
3726
|
children: [
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3240
|
-
/* @__PURE__ */ (0,
|
|
3241
|
-
/* @__PURE__ */ (0,
|
|
3242
|
-
/* @__PURE__ */ (0,
|
|
3243
|
-
/* @__PURE__ */ (0,
|
|
3727
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "auto", children: "\u81EA\u52A8\u8BC6\u522B\u56FE\u7C7B\u578B" }),
|
|
3728
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "flowchart", children: "flowchart TD" }),
|
|
3729
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "erDiagram", children: "erDiagram" }),
|
|
3730
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "classDiagram", children: "classDiagram" }),
|
|
3731
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "mindmap", children: "mindmap" }),
|
|
3732
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "sequenceDiagram", children: "sequenceDiagram" })
|
|
3244
3733
|
]
|
|
3245
3734
|
}
|
|
3246
3735
|
),
|
|
3247
|
-
/* @__PURE__ */ (0,
|
|
3736
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3248
3737
|
"button",
|
|
3249
3738
|
{
|
|
3250
3739
|
type: "button",
|
|
@@ -3256,7 +3745,7 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3256
3745
|
)
|
|
3257
3746
|
] })
|
|
3258
3747
|
] }),
|
|
3259
|
-
/* @__PURE__ */ (0,
|
|
3748
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3260
3749
|
"textarea",
|
|
3261
3750
|
{
|
|
3262
3751
|
className: "yudao-boards-mermaid-textarea",
|
|
@@ -3267,10 +3756,10 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3267
3756
|
}
|
|
3268
3757
|
)
|
|
3269
3758
|
] }),
|
|
3270
|
-
/* @__PURE__ */ (0,
|
|
3271
|
-
/* @__PURE__ */ (0,
|
|
3272
|
-
/* @__PURE__ */ (0,
|
|
3273
|
-
/* @__PURE__ */ (0,
|
|
3759
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "yudao-boards-mermaid-preview-pane", children: [
|
|
3760
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "yudao-boards-pane-toolbar", children: [
|
|
3761
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "\u5B9E\u65F6\u539F\u751F\u8282\u70B9\u5E03\u5C40\u9884\u89C8" }),
|
|
3762
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "yudao-boards-preview-stats", "data-testid": "mermaid-node-stats", children: [
|
|
3274
3763
|
"\u5171 ",
|
|
3275
3764
|
previewInfo.elements.length,
|
|
3276
3765
|
" \u4E2A\u539F\u751F\u5143\u7D20\uFF08\u8282\u70B9 ",
|
|
@@ -3283,7 +3772,7 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3283
3772
|
"\uFF09"
|
|
3284
3773
|
] })
|
|
3285
3774
|
] }),
|
|
3286
|
-
/* @__PURE__ */ (0,
|
|
3775
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "yudao-boards-mermaid-svg-stage", children: previewInfo.error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "yudao-boards-error-text", children: previewInfo.error }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3287
3776
|
"div",
|
|
3288
3777
|
{
|
|
3289
3778
|
className: "yudao-boards-svg-preview-inner",
|
|
@@ -3292,9 +3781,9 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3292
3781
|
) })
|
|
3293
3782
|
] })
|
|
3294
3783
|
] }),
|
|
3295
|
-
/* @__PURE__ */ (0,
|
|
3296
|
-
/* @__PURE__ */ (0,
|
|
3297
|
-
/* @__PURE__ */ (0,
|
|
3784
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("footer", { className: "yudao-boards-mermaid-footer", children: [
|
|
3785
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "yudao-boards-checkbox-label", children: [
|
|
3786
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3298
3787
|
"input",
|
|
3299
3788
|
{
|
|
3300
3789
|
type: "checkbox",
|
|
@@ -3302,11 +3791,11 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3302
3791
|
onChange: (e) => setReplaceExisting(e.target.checked)
|
|
3303
3792
|
}
|
|
3304
3793
|
),
|
|
3305
|
-
/* @__PURE__ */ (0,
|
|
3794
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "\u63D2\u5165\u524D\u6E05\u7A7A\u5F53\u524D\u753B\u5E03\u539F\u6709\u5143\u7D20" })
|
|
3306
3795
|
] }),
|
|
3307
|
-
/* @__PURE__ */ (0,
|
|
3308
|
-
/* @__PURE__ */ (0,
|
|
3309
|
-
/* @__PURE__ */ (0,
|
|
3796
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "yudao-boards-footer-actions", children: [
|
|
3797
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "yudao-boards-btn-ghost", onClick: handleClose, children: "\u53D6\u6D88" }),
|
|
3798
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
3310
3799
|
"button",
|
|
3311
3800
|
{
|
|
3312
3801
|
type: "button",
|
|
@@ -3330,20 +3819,349 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3330
3819
|
);
|
|
3331
3820
|
};
|
|
3332
3821
|
|
|
3822
|
+
// src/views/modals/BoardsVotingModal.tsx
|
|
3823
|
+
var import_core8 = require("@univerjs/core");
|
|
3824
|
+
var import_ui8 = require("@univerjs/ui");
|
|
3825
|
+
var import_univer_boards8 = require("@yudaocode/univer-boards");
|
|
3826
|
+
var import_react5 = require("react");
|
|
3827
|
+
var import_rxjs5 = require("rxjs");
|
|
3828
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3829
|
+
var QUOTA_PRESETS = [3, 5, 10];
|
|
3830
|
+
var BoardsVotingModal = ({ forceOpen }) => {
|
|
3831
|
+
const instanceService = (0, import_ui8.useDependency)(import_core8.IUniverInstanceService);
|
|
3832
|
+
const commandService = (0, import_ui8.useDependency)(import_core8.ICommandService);
|
|
3833
|
+
const selectionService = (0, import_ui8.useDependency)(import_univer_boards8.IBoardSelectionService);
|
|
3834
|
+
const isOpen = (0, import_ui8.useObservable)(
|
|
3835
|
+
selectionService.votingModalOpen$,
|
|
3836
|
+
selectionService.isVotingModalOpen()
|
|
3837
|
+
);
|
|
3838
|
+
const currentUserId = (0, import_ui8.useObservable)(
|
|
3839
|
+
selectionService.currentUserId$,
|
|
3840
|
+
selectionService.getCurrentUserId()
|
|
3841
|
+
);
|
|
3842
|
+
const unit = (0, import_ui8.useObservable)(
|
|
3843
|
+
() => instanceService.getCurrentTypeOfUnit$(import_core8.UniverInstanceType.UNIVER_BOARD),
|
|
3844
|
+
instanceService.getCurrentUnitOfType(import_core8.UniverInstanceType.UNIVER_BOARD),
|
|
3845
|
+
false,
|
|
3846
|
+
[instanceService]
|
|
3847
|
+
);
|
|
3848
|
+
const snapshot = (0, import_ui8.useObservable)(
|
|
3849
|
+
() => unit ? unit.snapshotChanged$ : (0, import_rxjs5.of)(null),
|
|
3850
|
+
unit ? unit.getSnapshot() : null,
|
|
3851
|
+
false,
|
|
3852
|
+
[unit]
|
|
3853
|
+
);
|
|
3854
|
+
const [sessionTitle, setSessionTitle] = (0, import_react5.useState)("\u56E2\u961F\u65B9\u6848\u4F18\u5148\u7EA7\u6295\u7968");
|
|
3855
|
+
const [quota, setQuota] = (0, import_react5.useState)(5);
|
|
3856
|
+
const [targetFrameId, setTargetFrameId] = (0, import_react5.useState)("");
|
|
3857
|
+
const [allowMultiplePerSticky, setAllowMultiplePerSticky] = (0, import_react5.useState)(true);
|
|
3858
|
+
const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
|
|
3859
|
+
const leaderboard = (0, import_react5.useMemo)(() => {
|
|
3860
|
+
if (!currentSnap) return [];
|
|
3861
|
+
const activeTargetFrame = currentSnap.votingSession?.targetFrameId || targetFrameId || void 0;
|
|
3862
|
+
return (0, import_univer_boards8.computeBoardVotingLeaderboard)(currentSnap, {
|
|
3863
|
+
targetFrameId: activeTargetFrame
|
|
3864
|
+
});
|
|
3865
|
+
}, [currentSnap, targetFrameId]);
|
|
3866
|
+
if (!isOpen && !forceOpen || !currentSnap || !unit) {
|
|
3867
|
+
return null;
|
|
3868
|
+
}
|
|
3869
|
+
const unitId = unit.getUnitId();
|
|
3870
|
+
const frames = unit.getFramesOrdered();
|
|
3871
|
+
const session = currentSnap.votingSession;
|
|
3872
|
+
const isActive = Boolean(session?.active);
|
|
3873
|
+
const myVotedIds = session?.votesByUser[currentUserId] ?? [];
|
|
3874
|
+
const remainingVotes = session ? Math.max(0, session.maxVotesPerUser - myVotedIds.length) : quota;
|
|
3875
|
+
const maxVoteCount = Math.max(1, ...leaderboard.map((item) => item.voteCount));
|
|
3876
|
+
const totalVotesCast = leaderboard.reduce((acc, item) => acc + item.voteCount, 0);
|
|
3877
|
+
const handleClose = () => {
|
|
3878
|
+
selectionService.setVotingModalOpen(false);
|
|
3879
|
+
};
|
|
3880
|
+
const handleStartSession = () => {
|
|
3881
|
+
commandService.syncExecuteCommand(import_univer_boards8.StartBoardVotingSessionCommand.id, {
|
|
3882
|
+
unitId,
|
|
3883
|
+
title: sessionTitle.trim() || "\u56E2\u961F\u65B9\u6848\u4F18\u5148\u7EA7\u6295\u7968",
|
|
3884
|
+
maxVotesPerUser: quota,
|
|
3885
|
+
allowMultiplePerSticky,
|
|
3886
|
+
...targetFrameId ? { targetFrameId } : {}
|
|
3887
|
+
});
|
|
3888
|
+
};
|
|
3889
|
+
const handleEndSession = () => {
|
|
3890
|
+
commandService.syncExecuteCommand(import_univer_boards8.EndBoardVotingSessionCommand.id, { unitId });
|
|
3891
|
+
};
|
|
3892
|
+
const handleCastVote = (elementId, unvote = false) => {
|
|
3893
|
+
commandService.syncExecuteCommand(import_univer_boards8.CastBoardSessionVoteCommand.id, {
|
|
3894
|
+
unitId,
|
|
3895
|
+
elementId,
|
|
3896
|
+
voterId: currentUserId,
|
|
3897
|
+
unvote
|
|
3898
|
+
});
|
|
3899
|
+
};
|
|
3900
|
+
const handlePanToSticky = (elementId) => {
|
|
3901
|
+
const el = currentSnap.elements[elementId];
|
|
3902
|
+
if (!el) return;
|
|
3903
|
+
const stageW = 1080;
|
|
3904
|
+
const stageH = 680;
|
|
3905
|
+
const zoom = 1.05;
|
|
3906
|
+
const centerX = el.x + el.width / 2;
|
|
3907
|
+
const centerY = el.y + el.height / 2;
|
|
3908
|
+
const panX = Math.round(stageW / 2 - centerX * zoom);
|
|
3909
|
+
const panY = Math.round(stageH / 2 - centerY * zoom);
|
|
3910
|
+
commandService.syncExecuteCommand(import_univer_boards8.SetBoardViewportCommand.id, {
|
|
3911
|
+
unitId,
|
|
3912
|
+
viewport: { panX, panY, zoom }
|
|
3913
|
+
});
|
|
3914
|
+
selectionService.selectElements([elementId]);
|
|
3915
|
+
selectionService.setVotingModalOpen(false);
|
|
3916
|
+
};
|
|
3917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3918
|
+
"div",
|
|
3919
|
+
{
|
|
3920
|
+
className: "yudao-boards-modal-backdrop",
|
|
3921
|
+
"data-testid": "boards-voting-modal",
|
|
3922
|
+
onClick: handleClose,
|
|
3923
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3924
|
+
"div",
|
|
3925
|
+
{
|
|
3926
|
+
className: "yudao-boards-voting-dialog",
|
|
3927
|
+
onClick: (e) => e.stopPropagation(),
|
|
3928
|
+
children: [
|
|
3929
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("header", { className: "yudao-boards-mermaid-header", children: [
|
|
3930
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-mermaid-title", children: [
|
|
3931
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BoardTrophyRankIcon, {}),
|
|
3932
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u4F1A\u8BAE\u9650\u989D\u6295\u7968\u4E0E\u5F97\u7968\u6392\u884C\u699C\u6C47\u603B\u9762\u677F" })
|
|
3933
|
+
] }),
|
|
3934
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3935
|
+
"button",
|
|
3936
|
+
{
|
|
3937
|
+
type: "button",
|
|
3938
|
+
className: "yudao-boards-btn-ghost",
|
|
3939
|
+
onClick: handleClose,
|
|
3940
|
+
children: "\u5173\u95ED"
|
|
3941
|
+
}
|
|
3942
|
+
)
|
|
3943
|
+
] }),
|
|
3944
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "yudao-boards-voting-config-bar", children: !isActive ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-voting-setup-row", children: [
|
|
3945
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "yudao-boards-voting-field", children: [
|
|
3946
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u8BAE\u9898\u540D\u79F0" }),
|
|
3947
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3948
|
+
"input",
|
|
3949
|
+
{
|
|
3950
|
+
type: "text",
|
|
3951
|
+
value: sessionTitle,
|
|
3952
|
+
onChange: (e) => setSessionTitle(e.target.value),
|
|
3953
|
+
placeholder: "\u8F93\u5165\u672C\u8F6E\u6295\u7968\u4E3B\u9898"
|
|
3954
|
+
}
|
|
3955
|
+
)
|
|
3956
|
+
] }),
|
|
3957
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-voting-field", children: [
|
|
3958
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u6BCF\u4EBA\u7968\u6570\u4E0A\u9650" }),
|
|
3959
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "yudao-boards-quota-pills", children: QUOTA_PRESETS.map((n) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3960
|
+
"button",
|
|
3961
|
+
{
|
|
3962
|
+
type: "button",
|
|
3963
|
+
"data-testid": `voting-quota-${n}`,
|
|
3964
|
+
className: `yudao-boards-preset-pill ${quota === n ? "is-selected" : ""}`,
|
|
3965
|
+
onClick: () => setQuota(n),
|
|
3966
|
+
children: [
|
|
3967
|
+
n,
|
|
3968
|
+
" \u7968"
|
|
3969
|
+
]
|
|
3970
|
+
},
|
|
3971
|
+
n
|
|
3972
|
+
)) })
|
|
3973
|
+
] }),
|
|
3974
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "yudao-boards-voting-field", children: [
|
|
3975
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u9650\u5B9A\u753B\u6846" }),
|
|
3976
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3977
|
+
"select",
|
|
3978
|
+
{
|
|
3979
|
+
value: targetFrameId,
|
|
3980
|
+
onChange: (e) => setTargetFrameId(e.target.value),
|
|
3981
|
+
"data-testid": "voting-target-frame",
|
|
3982
|
+
children: [
|
|
3983
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: "", children: "\u5168\u90E8\u753B\u5E03\u4FBF\u7B7E" }),
|
|
3984
|
+
frames.map((f) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("option", { value: f.id, children: f.title }, f.id))
|
|
3985
|
+
]
|
|
3986
|
+
}
|
|
3987
|
+
)
|
|
3988
|
+
] }),
|
|
3989
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: "yudao-boards-checkbox-label", children: [
|
|
3990
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3991
|
+
"input",
|
|
3992
|
+
{
|
|
3993
|
+
type: "checkbox",
|
|
3994
|
+
checked: allowMultiplePerSticky,
|
|
3995
|
+
onChange: (e) => setAllowMultiplePerSticky(e.target.checked)
|
|
3996
|
+
}
|
|
3997
|
+
),
|
|
3998
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u5355\u5F20\u53EF\u6295\u591A\u7968" })
|
|
3999
|
+
] }),
|
|
4000
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
4001
|
+
"button",
|
|
4002
|
+
{
|
|
4003
|
+
type: "button",
|
|
4004
|
+
className: "yudao-boards-btn-primary",
|
|
4005
|
+
"data-testid": "voting-start-btn",
|
|
4006
|
+
onClick: handleStartSession,
|
|
4007
|
+
children: [
|
|
4008
|
+
"\u5F00\u542F\u9650\u989D\u6295\u7968 (",
|
|
4009
|
+
quota,
|
|
4010
|
+
" \u7968/\u4EBA)"
|
|
4011
|
+
]
|
|
4012
|
+
}
|
|
4013
|
+
)
|
|
4014
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-voting-active-banner", "data-testid": "voting-active-banner", children: [
|
|
4015
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-voting-active-info", children: [
|
|
4016
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(BoardVoteThumbIcon, {}),
|
|
4017
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: session?.title }),
|
|
4018
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "yudao-boards-quota-badge", "data-testid": "voting-remaining-badge", children: [
|
|
4019
|
+
"\u5269\u4F59\u53EF\u6295 ",
|
|
4020
|
+
remainingVotes,
|
|
4021
|
+
" / ",
|
|
4022
|
+
session?.maxVotesPerUser,
|
|
4023
|
+
" \u7968"
|
|
4024
|
+
] }),
|
|
4025
|
+
session?.targetFrameId && currentSnap.elements[session.targetFrameId] && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "yudao-boards-tag", children: [
|
|
4026
|
+
"\u9650\u5B9A\u753B\u6846\uFF1A",
|
|
4027
|
+
currentSnap.elements[session.targetFrameId].title
|
|
4028
|
+
] })
|
|
4029
|
+
] }),
|
|
4030
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4031
|
+
"button",
|
|
4032
|
+
{
|
|
4033
|
+
type: "button",
|
|
4034
|
+
className: "yudao-boards-btn-ghost is-danger-outline",
|
|
4035
|
+
"data-testid": "voting-end-btn",
|
|
4036
|
+
onClick: handleEndSession,
|
|
4037
|
+
children: "\u7ED3\u675F\u672C\u8F6E\u6295\u7968\u5E76\u5B9A\u699C"
|
|
4038
|
+
}
|
|
4039
|
+
)
|
|
4040
|
+
] }) }),
|
|
4041
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-voting-leaderboard", "data-testid": "boards-voting-leaderboard", children: [
|
|
4042
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-pane-toolbar", children: [
|
|
4043
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { children: [
|
|
4044
|
+
"\u5F97\u7968\u6392\u884C\u699C\u6C47\u603B\u9762\u677F\uFF08\u5171 ",
|
|
4045
|
+
leaderboard.length,
|
|
4046
|
+
" \u5F20\u5019\u9009\u4FBF\u7B7E\uFF09"
|
|
4047
|
+
] }),
|
|
4048
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { children: [
|
|
4049
|
+
"\u7D2F\u8BA1\u603B\u7968\u6570\uFF1A",
|
|
4050
|
+
totalVotesCast,
|
|
4051
|
+
" \u7968"
|
|
4052
|
+
] })
|
|
4053
|
+
] }),
|
|
4054
|
+
leaderboard.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "yudao-boards-hint-box", style: { margin: 16 }, children: "\u5F53\u524D\u8303\u56F4\u5185\u6682\u65E0\u4FBF\u7B7E\uFF0C\u8BF7\u5148\u5728\u753B\u5E03\u4E2D\u521B\u5EFA\u8BA8\u8BBA\u4FBF\u7B7E\u3002" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "yudao-boards-rank-list", children: leaderboard.map((entry) => {
|
|
4055
|
+
const pal = (0, import_univer_boards8.resolveStickyPalette)(entry.color);
|
|
4056
|
+
const rawSticky = currentSnap.elements[entry.elementId];
|
|
4057
|
+
const masked = rawSticky ? (0, import_univer_boards8.isStickyMaskedForViewer)(rawSticky, currentSnap.brainstorm, currentUserId) : false;
|
|
4058
|
+
const displayText = masked ? "\u601D\u8003\u8F93\u5165\u4E2D \xB7 \u5F85\u63ED\u793A" : entry.text;
|
|
4059
|
+
const barWidthPct = entry.voteCount > 0 ? Math.max(6, Math.round(entry.voteCount / maxVoteCount * 100)) : 0;
|
|
4060
|
+
const myCountOnSticky = myVotedIds.filter((id) => id === entry.elementId).length;
|
|
4061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
4062
|
+
"div",
|
|
4063
|
+
{
|
|
4064
|
+
className: `yudao-boards-rank-row ${entry.rank <= 3 && entry.voteCount > 0 ? "is-top-rank" : ""}`,
|
|
4065
|
+
"data-testid": `voting-rank-row-${entry.elementId}`,
|
|
4066
|
+
children: [
|
|
4067
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `yudao-boards-rank-num is-rank-${Math.min(4, entry.rank)}`, children: [
|
|
4068
|
+
"#",
|
|
4069
|
+
entry.rank
|
|
4070
|
+
] }),
|
|
4071
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4072
|
+
"span",
|
|
4073
|
+
{
|
|
4074
|
+
className: "yudao-boards-rank-swatch",
|
|
4075
|
+
style: { backgroundColor: pal.fill, borderColor: pal.border }
|
|
4076
|
+
}
|
|
4077
|
+
),
|
|
4078
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-rank-main", children: [
|
|
4079
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-rank-title-line", children: [
|
|
4080
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "yudao-boards-rank-text", children: displayText }),
|
|
4081
|
+
entry.frameTitle && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "yudao-boards-rank-frame-tag", children: entry.frameTitle })
|
|
4082
|
+
] }),
|
|
4083
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "yudao-boards-rank-bar-track", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4084
|
+
"div",
|
|
4085
|
+
{
|
|
4086
|
+
className: "yudao-boards-rank-bar-fill",
|
|
4087
|
+
style: { width: `${barWidthPct}%` }
|
|
4088
|
+
}
|
|
4089
|
+
) })
|
|
4090
|
+
] }),
|
|
4091
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-rank-score", children: [
|
|
4092
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: entry.voteCount }),
|
|
4093
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "\u7968" })
|
|
4094
|
+
] }),
|
|
4095
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "yudao-boards-rank-actions", children: [
|
|
4096
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
4097
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4098
|
+
"button",
|
|
4099
|
+
{
|
|
4100
|
+
type: "button",
|
|
4101
|
+
className: "yudao-boards-mini-btn is-primary",
|
|
4102
|
+
disabled: remainingVotes <= 0,
|
|
4103
|
+
"data-testid": `voting-cast-${entry.elementId}`,
|
|
4104
|
+
onClick: () => handleCastVote(entry.elementId, false),
|
|
4105
|
+
children: "+1 \u6295\u7968"
|
|
4106
|
+
}
|
|
4107
|
+
),
|
|
4108
|
+
myCountOnSticky > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
4109
|
+
"button",
|
|
4110
|
+
{
|
|
4111
|
+
type: "button",
|
|
4112
|
+
className: "yudao-boards-mini-btn",
|
|
4113
|
+
"data-testid": `voting-unvote-${entry.elementId}`,
|
|
4114
|
+
onClick: () => handleCastVote(entry.elementId, true),
|
|
4115
|
+
children: [
|
|
4116
|
+
"\u64A4\u56DE (",
|
|
4117
|
+
myCountOnSticky,
|
|
4118
|
+
")"
|
|
4119
|
+
]
|
|
4120
|
+
}
|
|
4121
|
+
)
|
|
4122
|
+
] }),
|
|
4123
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4124
|
+
"button",
|
|
4125
|
+
{
|
|
4126
|
+
type: "button",
|
|
4127
|
+
className: "yudao-boards-mini-btn",
|
|
4128
|
+
"data-testid": `voting-pan-${entry.elementId}`,
|
|
4129
|
+
onClick: () => handlePanToSticky(entry.elementId),
|
|
4130
|
+
children: "\u5B9A\u4F4D\u4FBF\u7B7E"
|
|
4131
|
+
}
|
|
4132
|
+
)
|
|
4133
|
+
] })
|
|
4134
|
+
]
|
|
4135
|
+
},
|
|
4136
|
+
entry.elementId
|
|
4137
|
+
);
|
|
4138
|
+
}) })
|
|
4139
|
+
] })
|
|
4140
|
+
]
|
|
4141
|
+
}
|
|
4142
|
+
)
|
|
4143
|
+
}
|
|
4144
|
+
);
|
|
4145
|
+
};
|
|
4146
|
+
|
|
3333
4147
|
// src/views/modals/BoardsModalsHost.tsx
|
|
3334
|
-
var
|
|
4148
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3335
4149
|
var BoardsModalsHost = () => {
|
|
3336
|
-
return /* @__PURE__ */ (0,
|
|
4150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
4151
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BoardsMermaidModal, {}),
|
|
4152
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BoardsVotingModal, {}),
|
|
4153
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(BoardsDocImportModal, {})
|
|
4154
|
+
] });
|
|
3337
4155
|
};
|
|
3338
4156
|
|
|
3339
4157
|
// src/controllers/menu.schema.ts
|
|
3340
|
-
var
|
|
3341
|
-
var
|
|
3342
|
-
var
|
|
4158
|
+
var import_ui9 = require("@univerjs/ui");
|
|
4159
|
+
var import_univer_boards9 = require("@yudaocode/univer-boards");
|
|
4160
|
+
var import_rxjs6 = require("rxjs");
|
|
3343
4161
|
var BOARDS_RIBBON_TAB = "ribbon.boards";
|
|
3344
4162
|
var BOARDS_RIBBON_GROUP = "ribbon.boards.workshop";
|
|
3345
4163
|
var boardsRootMenuExtension = {
|
|
3346
|
-
[
|
|
4164
|
+
[import_ui9.MenuManagerPosition.RIBBON]: {
|
|
3347
4165
|
[BOARDS_RIBBON_TAB]: {
|
|
3348
4166
|
order: 2,
|
|
3349
4167
|
title: "boards.ribbon.boardTab",
|
|
@@ -3358,7 +4176,7 @@ function makeSimpleMenuBtn(config) {
|
|
|
3358
4176
|
return () => ({
|
|
3359
4177
|
id: config.id,
|
|
3360
4178
|
commandId: config.commandId ?? config.id,
|
|
3361
|
-
type:
|
|
4179
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
3362
4180
|
title: config.title,
|
|
3363
4181
|
label: config.label,
|
|
3364
4182
|
tooltip: config.title,
|
|
@@ -3367,40 +4185,40 @@ function makeSimpleMenuBtn(config) {
|
|
|
3367
4185
|
});
|
|
3368
4186
|
}
|
|
3369
4187
|
var BoardSelectToolMenuFactory = (accessor) => {
|
|
3370
|
-
const sel = accessor.get(
|
|
4188
|
+
const sel = accessor.get(import_univer_boards9.IBoardSelectionService);
|
|
3371
4189
|
return {
|
|
3372
4190
|
id: "boards-ui.menu.tool-select",
|
|
3373
4191
|
commandId: SetBoardToolOperation.id,
|
|
3374
|
-
type:
|
|
4192
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
3375
4193
|
title: "boards.ribbon.selectTool",
|
|
3376
4194
|
tooltip: "boards.ribbon.selectTool",
|
|
3377
4195
|
icon: "BoardSelectIcon",
|
|
3378
4196
|
params: { tool: "select" },
|
|
3379
|
-
activated$: sel.activeTool$.pipe((0,
|
|
4197
|
+
activated$: sel.activeTool$.pipe((0, import_rxjs6.map)((t) => t === "select"))
|
|
3380
4198
|
};
|
|
3381
4199
|
};
|
|
3382
4200
|
var BoardHandToolMenuFactory = (accessor) => {
|
|
3383
|
-
const sel = accessor.get(
|
|
4201
|
+
const sel = accessor.get(import_univer_boards9.IBoardSelectionService);
|
|
3384
4202
|
return {
|
|
3385
4203
|
id: "boards-ui.menu.tool-hand",
|
|
3386
4204
|
commandId: SetBoardToolOperation.id,
|
|
3387
|
-
type:
|
|
4205
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
3388
4206
|
title: "boards.ribbon.handTool",
|
|
3389
4207
|
tooltip: "boards.ribbon.handTool",
|
|
3390
4208
|
icon: "BoardHandIcon",
|
|
3391
4209
|
params: { tool: "hand" },
|
|
3392
|
-
activated$: sel.activeTool$.pipe((0,
|
|
4210
|
+
activated$: sel.activeTool$.pipe((0, import_rxjs6.map)((t) => t === "hand"))
|
|
3393
4211
|
};
|
|
3394
4212
|
};
|
|
3395
4213
|
var boardsMenuSchema = {
|
|
3396
|
-
[
|
|
4214
|
+
[import_ui9.RibbonStartGroup.FORMAT]: {
|
|
3397
4215
|
["boards-ui.menu.tool-select"]: { order: 0, menuItemFactory: BoardSelectToolMenuFactory },
|
|
3398
4216
|
["boards-ui.menu.tool-hand"]: { order: 1, menuItemFactory: BoardHandToolMenuFactory },
|
|
3399
4217
|
["boards-ui.menu.add-frame"]: {
|
|
3400
4218
|
order: 2,
|
|
3401
4219
|
menuItemFactory: makeSimpleMenuBtn({
|
|
3402
4220
|
id: "boards-ui.menu.add-frame",
|
|
3403
|
-
commandId:
|
|
4221
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
3404
4222
|
title: "boards.ribbon.insertFrame",
|
|
3405
4223
|
icon: "BoardFrameIcon",
|
|
3406
4224
|
params: { element: { type: "frame" } }
|
|
@@ -3410,7 +4228,7 @@ var boardsMenuSchema = {
|
|
|
3410
4228
|
order: 3,
|
|
3411
4229
|
menuItemFactory: makeSimpleMenuBtn({
|
|
3412
4230
|
id: "boards-ui.menu.add-sticky",
|
|
3413
|
-
commandId:
|
|
4231
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
3414
4232
|
title: "boards.ribbon.insertSticky",
|
|
3415
4233
|
icon: "BoardStickyIcon",
|
|
3416
4234
|
params: { element: { type: "sticky" } }
|
|
@@ -3420,7 +4238,7 @@ var boardsMenuSchema = {
|
|
|
3420
4238
|
order: 4,
|
|
3421
4239
|
menuItemFactory: makeSimpleMenuBtn({
|
|
3422
4240
|
id: "boards-ui.menu.add-shape",
|
|
3423
|
-
commandId:
|
|
4241
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
3424
4242
|
title: "boards.ribbon.insertShape",
|
|
3425
4243
|
icon: "BoardShapeIcon",
|
|
3426
4244
|
params: { element: { type: "shape" } }
|
|
@@ -3430,7 +4248,7 @@ var boardsMenuSchema = {
|
|
|
3430
4248
|
order: 5,
|
|
3431
4249
|
menuItemFactory: makeSimpleMenuBtn({
|
|
3432
4250
|
id: "boards-ui.menu.add-mindmap",
|
|
3433
|
-
commandId:
|
|
4251
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
3434
4252
|
title: "boards.ribbon.insertMindmap",
|
|
3435
4253
|
icon: "BoardMindmapIcon",
|
|
3436
4254
|
params: { element: { type: "mindmap" } }
|
|
@@ -3440,14 +4258,14 @@ var boardsMenuSchema = {
|
|
|
3440
4258
|
order: 6,
|
|
3441
4259
|
menuItemFactory: makeSimpleMenuBtn({
|
|
3442
4260
|
id: "boards-ui.menu.add-entity",
|
|
3443
|
-
commandId:
|
|
4261
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
3444
4262
|
title: "boards.ribbon.insertEntityCard",
|
|
3445
4263
|
icon: "BoardEntityCardIcon",
|
|
3446
4264
|
params: { element: { type: "entityCard" } }
|
|
3447
4265
|
})
|
|
3448
4266
|
}
|
|
3449
4267
|
},
|
|
3450
|
-
[
|
|
4268
|
+
[import_ui9.RibbonInsertGroup.MEDIA]: {
|
|
3451
4269
|
["boards-ui.menu.mermaid-studio"]: {
|
|
3452
4270
|
order: 1,
|
|
3453
4271
|
menuItemFactory: makeSimpleMenuBtn({
|
|
@@ -3463,7 +4281,7 @@ var boardsMenuSchema = {
|
|
|
3463
4281
|
order: 2,
|
|
3464
4282
|
menuItemFactory: makeSimpleMenuBtn({
|
|
3465
4283
|
id: "boards-ui.menu.insert-swimlane",
|
|
3466
|
-
commandId:
|
|
4284
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
3467
4285
|
title: "boards.ribbon.insertSwimlane",
|
|
3468
4286
|
icon: "BoardSwimlaneIcon",
|
|
3469
4287
|
params: { element: { type: "swimlane" } }
|
|
@@ -3523,7 +4341,7 @@ var boardsMenuSchema = {
|
|
|
3523
4341
|
})
|
|
3524
4342
|
}
|
|
3525
4343
|
},
|
|
3526
|
-
[
|
|
4344
|
+
[import_ui9.RibbonViewGroup.DISPLAY]: {
|
|
3527
4345
|
[FitBoardToScreenOperation.id]: {
|
|
3528
4346
|
order: 1,
|
|
3529
4347
|
menuItemFactory: makeSimpleMenuBtn({
|
|
@@ -3545,7 +4363,7 @@ var boardsMenuSchema = {
|
|
|
3545
4363
|
};
|
|
3546
4364
|
|
|
3547
4365
|
// src/controllers/boards-ui.controller.ts
|
|
3548
|
-
var BoardsUIController = class extends
|
|
4366
|
+
var BoardsUIController = class extends import_core9.Disposable {
|
|
3549
4367
|
constructor(_config, _commandService, _menuManagerService, _uiPartsService, _sidebarService, _componentManager, _iconManager) {
|
|
3550
4368
|
super();
|
|
3551
4369
|
this._config = _config;
|
|
@@ -3569,7 +4387,7 @@ var BoardsUIController = class extends import_core7.Disposable {
|
|
|
3569
4387
|
}
|
|
3570
4388
|
}, 100);
|
|
3571
4389
|
this.disposeWithMe(
|
|
3572
|
-
(0,
|
|
4390
|
+
(0, import_core9.toDisposable)(() => {
|
|
3573
4391
|
if (this._inspectorTimer !== null) {
|
|
3574
4392
|
clearTimeout(this._inspectorTimer);
|
|
3575
4393
|
this._inspectorTimer = null;
|
|
@@ -3590,6 +4408,8 @@ var BoardsUIController = class extends import_core7.Disposable {
|
|
|
3590
4408
|
const ops = [
|
|
3591
4409
|
ToggleBoardInspectorOperation,
|
|
3592
4410
|
OpenBoardMermaidModalOperation,
|
|
4411
|
+
OpenBoardVotingModalOperation,
|
|
4412
|
+
OpenBoardDocImportModalOperation,
|
|
3593
4413
|
SetBoardToolOperation,
|
|
3594
4414
|
StartBoardPresentationOperation,
|
|
3595
4415
|
FitBoardToScreenOperation,
|
|
@@ -3605,26 +4425,26 @@ var BoardsUIController = class extends import_core7.Disposable {
|
|
|
3605
4425
|
}
|
|
3606
4426
|
_initWorkbenchParts() {
|
|
3607
4427
|
this.disposeWithMe(
|
|
3608
|
-
this._uiPartsService.registerComponent(
|
|
4428
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.LEFT_SIDEBAR, () => BoardsLeftSidebar)
|
|
3609
4429
|
);
|
|
3610
4430
|
this.disposeWithMe(
|
|
3611
|
-
this._uiPartsService.registerComponent(
|
|
4431
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.CONTENT, () => BoardsInfiniteCanvas)
|
|
3612
4432
|
);
|
|
3613
4433
|
this.disposeWithMe(
|
|
3614
|
-
this._uiPartsService.registerComponent(
|
|
4434
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.FOOTER, () => BoardsStatusBar)
|
|
3615
4435
|
);
|
|
3616
4436
|
this.disposeWithMe(
|
|
3617
|
-
this._uiPartsService.registerComponent(
|
|
4437
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.GLOBAL, () => BoardsModalsHost)
|
|
3618
4438
|
);
|
|
3619
4439
|
}
|
|
3620
4440
|
};
|
|
3621
4441
|
BoardsUIController = __decorateClass([
|
|
3622
|
-
__decorateParam(1,
|
|
3623
|
-
__decorateParam(2,
|
|
3624
|
-
__decorateParam(3,
|
|
3625
|
-
__decorateParam(4,
|
|
3626
|
-
__decorateParam(5, (0,
|
|
3627
|
-
__decorateParam(6, (0,
|
|
4442
|
+
__decorateParam(1, import_core9.ICommandService),
|
|
4443
|
+
__decorateParam(2, import_ui10.IMenuManagerService),
|
|
4444
|
+
__decorateParam(3, import_ui10.IUIPartsService),
|
|
4445
|
+
__decorateParam(4, import_ui10.ISidebarService),
|
|
4446
|
+
__decorateParam(5, (0, import_core9.Inject)(import_ui10.ComponentManager)),
|
|
4447
|
+
__decorateParam(6, (0, import_core9.Inject)(import_ui10.IconManager))
|
|
3628
4448
|
], BoardsUIController);
|
|
3629
4449
|
|
|
3630
4450
|
// src/locale/en-US.ts
|
|
@@ -3704,21 +4524,21 @@ var zhCN = {
|
|
|
3704
4524
|
var zh_CN_default = zhCN;
|
|
3705
4525
|
|
|
3706
4526
|
// src/plugin.ts
|
|
3707
|
-
var
|
|
4527
|
+
var import_core10 = require("@univerjs/core");
|
|
3708
4528
|
var import_engine_render = require("@univerjs/engine-render");
|
|
3709
|
-
var
|
|
4529
|
+
var import_univer_boards10 = require("@yudaocode/univer-boards");
|
|
3710
4530
|
var UNIVER_BOARDS_UI_PLUGIN_NAME = "UNIVER_BOARDS_UI_PLUGIN";
|
|
3711
|
-
var UniverBoardsUIPlugin = class extends
|
|
4531
|
+
var UniverBoardsUIPlugin = class extends import_core10.Plugin {
|
|
3712
4532
|
constructor(_config = {}, _injector) {
|
|
3713
4533
|
super();
|
|
3714
4534
|
this._config = _config;
|
|
3715
4535
|
this._injector = _injector;
|
|
3716
4536
|
}
|
|
3717
4537
|
onStarting() {
|
|
3718
|
-
if (this._injector.has(
|
|
3719
|
-
this._injector.get(
|
|
3720
|
-
[
|
|
3721
|
-
[
|
|
4538
|
+
if (this._injector.has(import_core10.LocaleService)) {
|
|
4539
|
+
this._injector.get(import_core10.LocaleService).load({
|
|
4540
|
+
[import_core10.LocaleType.ZH_CN]: zh_CN_default,
|
|
4541
|
+
[import_core10.LocaleType.EN_US]: en_US_default
|
|
3722
4542
|
});
|
|
3723
4543
|
}
|
|
3724
4544
|
this._injector.add([
|
|
@@ -3732,14 +4552,14 @@ var UniverBoardsUIPlugin = class extends import_core8.Plugin {
|
|
|
3732
4552
|
};
|
|
3733
4553
|
UniverBoardsUIPlugin.pluginName = UNIVER_BOARDS_UI_PLUGIN_NAME;
|
|
3734
4554
|
UniverBoardsUIPlugin.packageName = "@yudaocode/univer-boards-ui";
|
|
3735
|
-
UniverBoardsUIPlugin.type =
|
|
4555
|
+
UniverBoardsUIPlugin.type = import_core10.UniverInstanceType.UNIVER_BOARD;
|
|
3736
4556
|
UniverBoardsUIPlugin = __decorateClass([
|
|
3737
|
-
(0,
|
|
3738
|
-
__decorateParam(1, (0,
|
|
4557
|
+
(0, import_core10.DependentOn)(import_engine_render.UniverRenderEnginePlugin, import_univer_boards10.UniverBoardsPlugin),
|
|
4558
|
+
__decorateParam(1, (0, import_core10.Inject)(import_core10.Injector))
|
|
3739
4559
|
], UniverBoardsUIPlugin);
|
|
3740
4560
|
|
|
3741
4561
|
// src/index.ts
|
|
3742
|
-
var VERSION = "1.6.
|
|
4562
|
+
var VERSION = "1.6.219";
|
|
3743
4563
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3744
4564
|
0 && (module.exports = {
|
|
3745
4565
|
BOARDS_RIBBON_GROUP,
|
|
@@ -3747,6 +4567,7 @@ var VERSION = "1.6.218";
|
|
|
3747
4567
|
BOARD_ICON_MAP,
|
|
3748
4568
|
BOARD_INSPECTOR_COMPONENT_KEY,
|
|
3749
4569
|
BOARD_INSPECTOR_SIDEBAR_ID,
|
|
4570
|
+
BoardsDocImportModal,
|
|
3750
4571
|
BoardsInfiniteCanvas,
|
|
3751
4572
|
BoardsInspectorPanel,
|
|
3752
4573
|
BoardsLeftSidebar,
|
|
@@ -3754,9 +4575,12 @@ var VERSION = "1.6.218";
|
|
|
3754
4575
|
BoardsModalsHost,
|
|
3755
4576
|
BoardsStatusBar,
|
|
3756
4577
|
BoardsUIController,
|
|
4578
|
+
BoardsVotingModal,
|
|
3757
4579
|
ExportBoardFileOperation,
|
|
3758
4580
|
FitBoardToScreenOperation,
|
|
4581
|
+
OpenBoardDocImportModalOperation,
|
|
3759
4582
|
OpenBoardMermaidModalOperation,
|
|
4583
|
+
OpenBoardVotingModalOperation,
|
|
3760
4584
|
SetBoardToolOperation,
|
|
3761
4585
|
StartBoardPresentationOperation,
|
|
3762
4586
|
ToggleBoardInspectorOperation,
|