@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/es/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./chunk-BRKEJJFQ.js";
|
|
11
11
|
|
|
12
12
|
// src/controllers/boards-ui.controller.ts
|
|
13
|
-
import { Disposable, ICommandService as
|
|
13
|
+
import { Disposable, ICommandService as ICommandService9, Inject, toDisposable } from "@univerjs/core";
|
|
14
14
|
import {
|
|
15
15
|
BuiltInUIPart,
|
|
16
16
|
ComponentManager,
|
|
@@ -159,6 +159,47 @@ var BoardAlignRightIcon = createSvgIcon(
|
|
|
159
159
|
var BoardGridIcon = createSvgIcon(
|
|
160
160
|
/* @__PURE__ */ jsx("path", { d: "M2.5 5.5H13.5M2.5 10.5H13.5M5.5 2.5V13.5M10.5 2.5V13.5" })
|
|
161
161
|
);
|
|
162
|
+
var BoardEyeOffIcon = createSvgIcon(
|
|
163
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
164
|
+
/* @__PURE__ */ jsx("path", { d: "M2.2 2.2L13.8 13.8" }),
|
|
165
|
+
/* @__PURE__ */ 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" }),
|
|
166
|
+
/* @__PURE__ */ 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" })
|
|
167
|
+
] })
|
|
168
|
+
);
|
|
169
|
+
var BoardEyeRevealIcon = createSvgIcon(
|
|
170
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
171
|
+
/* @__PURE__ */ 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" }),
|
|
172
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "2.2" })
|
|
173
|
+
] })
|
|
174
|
+
);
|
|
175
|
+
var BoardSpotlightIcon = createSvgIcon(
|
|
176
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
177
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "2.4" }),
|
|
178
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "5.4", strokeDasharray: "2.2 2" }),
|
|
179
|
+
/* @__PURE__ */ jsx("path", { d: "M8 1.5V3M8 13V14.5M1.5 8H3M13 8H14.5" })
|
|
180
|
+
] })
|
|
181
|
+
);
|
|
182
|
+
var BoardFollowIcon = createSvgIcon(
|
|
183
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
184
|
+
/* @__PURE__ */ jsx("circle", { cx: "6.2", cy: "5.4", r: "2.2" }),
|
|
185
|
+
/* @__PURE__ */ 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" }),
|
|
186
|
+
/* @__PURE__ */ jsx("path", { d: "M10.5 6.8H14M14 6.8L12.2 5M14 6.8L12.2 8.6" })
|
|
187
|
+
] })
|
|
188
|
+
);
|
|
189
|
+
var BoardTrophyRankIcon = createSvgIcon(
|
|
190
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
191
|
+
/* @__PURE__ */ 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" }),
|
|
192
|
+
/* @__PURE__ */ jsx("path", { d: "M5 4H3.2C3.2 6 4 6.8 5 7M11 4H12.8C12.8 6 12 6.8 11 7" }),
|
|
193
|
+
/* @__PURE__ */ jsx("path", { d: "M8 9.8V12.8M5.4 12.8H10.6" })
|
|
194
|
+
] })
|
|
195
|
+
);
|
|
196
|
+
var BoardDocUploadIcon = createSvgIcon(
|
|
197
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
198
|
+
/* @__PURE__ */ jsx("path", { d: "M4 2.2H9.8L12.8 5.2V13.8H4V2.2Z" }),
|
|
199
|
+
/* @__PURE__ */ jsx("path", { d: "M9.6 2.2V5.4H12.8" }),
|
|
200
|
+
/* @__PURE__ */ jsx("path", { d: "M8.4 11.4V7.2M8.4 7.2L6.6 9M8.4 7.2L10.2 9" })
|
|
201
|
+
] })
|
|
202
|
+
);
|
|
162
203
|
var BOARD_ICON_MAP = {
|
|
163
204
|
BoardSelectIcon,
|
|
164
205
|
BoardHandIcon,
|
|
@@ -185,7 +226,13 @@ var BOARD_ICON_MAP = {
|
|
|
185
226
|
BoardAlignLeftIcon,
|
|
186
227
|
BoardAlignCenterIcon,
|
|
187
228
|
BoardAlignRightIcon,
|
|
188
|
-
BoardGridIcon
|
|
229
|
+
BoardGridIcon,
|
|
230
|
+
BoardEyeOffIcon,
|
|
231
|
+
BoardEyeRevealIcon,
|
|
232
|
+
BoardSpotlightIcon,
|
|
233
|
+
BoardFollowIcon,
|
|
234
|
+
BoardTrophyRankIcon,
|
|
235
|
+
BoardDocUploadIcon
|
|
189
236
|
};
|
|
190
237
|
|
|
191
238
|
// src/operations/board-ui.operation.ts
|
|
@@ -234,6 +281,24 @@ var OpenBoardMermaidModalOperation = {
|
|
|
234
281
|
return true;
|
|
235
282
|
}
|
|
236
283
|
};
|
|
284
|
+
var OpenBoardVotingModalOperation = {
|
|
285
|
+
id: "boards-ui.operation.open-voting-modal",
|
|
286
|
+
type: CommandType.OPERATION,
|
|
287
|
+
handler: (accessor, params) => {
|
|
288
|
+
const selService = accessor.get(IBoardSelectionService);
|
|
289
|
+
selService.setVotingModalOpen(params?.open ?? true);
|
|
290
|
+
return true;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
var OpenBoardDocImportModalOperation = {
|
|
294
|
+
id: "boards-ui.operation.open-doc-import-modal",
|
|
295
|
+
type: CommandType.OPERATION,
|
|
296
|
+
handler: (accessor, params) => {
|
|
297
|
+
const selService = accessor.get(IBoardSelectionService);
|
|
298
|
+
selService.setDocImportModalOpen(params?.open ?? true);
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
};
|
|
237
302
|
var SetBoardToolOperation = {
|
|
238
303
|
id: "boards-ui.operation.set-tool",
|
|
239
304
|
type: CommandType.OPERATION,
|
|
@@ -388,14 +453,19 @@ import {
|
|
|
388
453
|
AddMindmapChildCommand,
|
|
389
454
|
AddMindmapSiblingCommand,
|
|
390
455
|
buildShapeSvgPath,
|
|
456
|
+
CastBoardSessionVoteCommand,
|
|
391
457
|
computeBoardBounds as computeBoardBounds2,
|
|
392
458
|
computeBoardConnectorPath,
|
|
393
459
|
DeleteBoardElementsCommand,
|
|
394
460
|
getElementPortPoint,
|
|
395
461
|
IBoardSelectionService as IBoardSelectionService2,
|
|
396
462
|
isMindmapNodeCollapsedHidden,
|
|
463
|
+
isStickyMaskedForViewer,
|
|
397
464
|
resolveStickyPalette,
|
|
465
|
+
RevealPrivateBrainstormCommand,
|
|
398
466
|
SetBoardViewportCommand as SetBoardViewportCommand2,
|
|
467
|
+
StartPrivateBrainstormCommand,
|
|
468
|
+
StopPrivateBrainstormCommand,
|
|
399
469
|
UpdateBoardElementsCommand,
|
|
400
470
|
VoteBoardStickyCommand
|
|
401
471
|
} from "@yudaocode/univer-boards";
|
|
@@ -464,6 +534,18 @@ var BoardsInfiniteCanvas = () => {
|
|
|
464
534
|
selectionService.getPresentationState()
|
|
465
535
|
);
|
|
466
536
|
const timer = useObservable(selectionService.timer$, selectionService.getTimerState());
|
|
537
|
+
const currentUserId = useObservable(
|
|
538
|
+
selectionService.currentUserId$,
|
|
539
|
+
selectionService.getCurrentUserId()
|
|
540
|
+
);
|
|
541
|
+
const collaborators = useObservable(
|
|
542
|
+
selectionService.collaborators$,
|
|
543
|
+
selectionService.getCollaborators()
|
|
544
|
+
);
|
|
545
|
+
const spotlight = useObservable(
|
|
546
|
+
selectionService.spotlight$,
|
|
547
|
+
selectionService.getSpotlightState()
|
|
548
|
+
);
|
|
467
549
|
const stageRef = useRef(null);
|
|
468
550
|
const [spacePressed, setSpacePressed] = useState(false);
|
|
469
551
|
const [hoveredElementId, setHoveredElementId] = useState(null);
|
|
@@ -543,13 +625,14 @@ var BoardsInfiniteCanvas = () => {
|
|
|
543
625
|
const screenToBoard = useCallback(
|
|
544
626
|
(clientX, clientY) => {
|
|
545
627
|
const rect = stageRef.current?.getBoundingClientRect() ?? { left: 0, top: 0 };
|
|
546
|
-
const
|
|
628
|
+
const rawVp = currentSnap?.viewport ?? { panX: 0, panY: 0, zoom: 1 };
|
|
629
|
+
const vp = selectionService.resolveEffectiveViewport(rawVp);
|
|
547
630
|
return {
|
|
548
631
|
x: (clientX - rect.left - vp.panX) / vp.zoom,
|
|
549
632
|
y: (clientY - rect.top - vp.panY) / vp.zoom
|
|
550
633
|
};
|
|
551
634
|
},
|
|
552
|
-
[currentSnap?.viewport]
|
|
635
|
+
[currentSnap?.viewport, selectionService]
|
|
553
636
|
);
|
|
554
637
|
const effectiveElementsMap = useMemo(() => {
|
|
555
638
|
if (!currentSnap) return {};
|
|
@@ -578,8 +661,14 @@ var BoardsInfiniteCanvas = () => {
|
|
|
578
661
|
return /* @__PURE__ */ jsx2("div", { className: "yudao-boards-canvas-empty", "data-testid": "boards-canvas-empty", children: "\u6B63\u5728\u51C6\u5907\u65E0\u9650\u534F\u4F5C\u767D\u677F\u753B\u5E03..." });
|
|
579
662
|
}
|
|
580
663
|
const unitId = unit.getUnitId();
|
|
581
|
-
const
|
|
664
|
+
const effectiveViewport = selectionService.resolveEffectiveViewport(currentSnap.viewport);
|
|
665
|
+
const { panX, panY, zoom } = effectiveViewport;
|
|
582
666
|
const framesOrdered = unit.getFramesOrdered();
|
|
667
|
+
const brainstorm = currentSnap.brainstorm;
|
|
668
|
+
const votingSession = currentSnap.votingSession;
|
|
669
|
+
const mySessionVotes = votingSession?.votesByUser[currentUserId] ?? [];
|
|
670
|
+
const remainingSessionVotes = votingSession ? Math.max(0, votingSession.maxVotesPerUser - mySessionVotes.length) : 0;
|
|
671
|
+
const isHostingSpotlight = spotlight.spotlightHostId === currentUserId;
|
|
583
672
|
const orderedElements = (currentSnap.elementOrder.length ? currentSnap.elementOrder : Object.keys(currentSnap.elements)).map((id) => effectiveElementsMap[id]).filter((el) => Boolean(el && !el.hidden));
|
|
584
673
|
const visibleMindmaps = orderedElements.filter(
|
|
585
674
|
(el) => el.type === "mindmap" && !isMindmapNodeCollapsedHidden(el, effectiveElementsMap)
|
|
@@ -619,6 +708,9 @@ var BoardsInfiniteCanvas = () => {
|
|
|
619
708
|
selectionService.setEditingElement(null);
|
|
620
709
|
};
|
|
621
710
|
const startInlineEdit = (el) => {
|
|
711
|
+
if (el.type === "sticky" && isStickyMaskedForViewer(el, currentSnap.brainstorm, currentUserId)) {
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
622
714
|
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 : "";
|
|
623
715
|
setEditingDraft(initial);
|
|
624
716
|
selectionService.setEditingElement(el.id);
|
|
@@ -676,7 +768,11 @@ var BoardsInfiniteCanvas = () => {
|
|
|
676
768
|
y: Math.round(boardPt.y - 40)
|
|
677
769
|
};
|
|
678
770
|
if (activeTool === "shape") extra.shapeType = activeShapeType;
|
|
679
|
-
if (activeTool === "sticky")
|
|
771
|
+
if (activeTool === "sticky") {
|
|
772
|
+
extra.color = activeStickyColor;
|
|
773
|
+
extra.authorId = currentUserId;
|
|
774
|
+
extra.author = selectionService.getCurrentUserName();
|
|
775
|
+
}
|
|
680
776
|
commandService.syncExecuteCommand(AddBoardElementsCommand.id, {
|
|
681
777
|
unitId,
|
|
682
778
|
element: {
|
|
@@ -1310,6 +1406,124 @@ var BoardsInfiniteCanvas = () => {
|
|
|
1310
1406
|
}
|
|
1311
1407
|
)
|
|
1312
1408
|
] }),
|
|
1409
|
+
/* @__PURE__ */ jsxs2("div", { className: "yudao-boards-workshop-group", "data-testid": "boards-workshop-controls", children: [
|
|
1410
|
+
!brainstorm?.active ? /* @__PURE__ */ jsxs2(
|
|
1411
|
+
"button",
|
|
1412
|
+
{
|
|
1413
|
+
type: "button",
|
|
1414
|
+
className: "yudao-boards-top-btn",
|
|
1415
|
+
"data-testid": "boards-brainstorm-start",
|
|
1416
|
+
title: "\u5F00\u542F\u79C1\u5BC6\u5171\u521B\uFF1A\u63ED\u6653\u524D\u4EC5\u81EA\u5DF1\u53EF\u89C1\u672C\u4EBA\u4FBF\u7B7E",
|
|
1417
|
+
onClick: () => commandService.syncExecuteCommand(StartPrivateBrainstormCommand.id, {
|
|
1418
|
+
unitId,
|
|
1419
|
+
facilitatorId: currentUserId
|
|
1420
|
+
}),
|
|
1421
|
+
children: [
|
|
1422
|
+
/* @__PURE__ */ jsx2(BoardEyeOffIcon, {}),
|
|
1423
|
+
/* @__PURE__ */ jsx2("span", { children: "\u79C1\u5BC6\u5171\u521B" })
|
|
1424
|
+
]
|
|
1425
|
+
}
|
|
1426
|
+
) : !brainstorm.revealed ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1427
|
+
/* @__PURE__ */ jsxs2(
|
|
1428
|
+
"button",
|
|
1429
|
+
{
|
|
1430
|
+
type: "button",
|
|
1431
|
+
className: "yudao-boards-top-btn is-active",
|
|
1432
|
+
"data-testid": "boards-brainstorm-reveal",
|
|
1433
|
+
title: "\u5411\u5168\u5458\u7EDF\u4E00\u63ED\u793A\u6240\u6709\u79C1\u5BC6\u4FBF\u7B7E",
|
|
1434
|
+
onClick: () => commandService.syncExecuteCommand(RevealPrivateBrainstormCommand.id, {
|
|
1435
|
+
unitId
|
|
1436
|
+
}),
|
|
1437
|
+
children: [
|
|
1438
|
+
/* @__PURE__ */ jsx2(BoardEyeRevealIcon, {}),
|
|
1439
|
+
/* @__PURE__ */ jsx2("span", { children: "\u7EDF\u4E00\u63ED\u793A" })
|
|
1440
|
+
]
|
|
1441
|
+
}
|
|
1442
|
+
),
|
|
1443
|
+
/* @__PURE__ */ jsx2(
|
|
1444
|
+
"button",
|
|
1445
|
+
{
|
|
1446
|
+
type: "button",
|
|
1447
|
+
className: "yudao-boards-top-btn",
|
|
1448
|
+
"data-testid": "boards-brainstorm-stop",
|
|
1449
|
+
onClick: () => commandService.syncExecuteCommand(StopPrivateBrainstormCommand.id, {
|
|
1450
|
+
unitId
|
|
1451
|
+
}),
|
|
1452
|
+
children: /* @__PURE__ */ jsx2("span", { children: "\u7ED3\u675F" })
|
|
1453
|
+
}
|
|
1454
|
+
)
|
|
1455
|
+
] }) : /* @__PURE__ */ jsxs2(
|
|
1456
|
+
"button",
|
|
1457
|
+
{
|
|
1458
|
+
type: "button",
|
|
1459
|
+
className: "yudao-boards-top-btn",
|
|
1460
|
+
"data-testid": "boards-brainstorm-stop",
|
|
1461
|
+
onClick: () => commandService.syncExecuteCommand(StopPrivateBrainstormCommand.id, {
|
|
1462
|
+
unitId
|
|
1463
|
+
}),
|
|
1464
|
+
children: [
|
|
1465
|
+
/* @__PURE__ */ jsx2(BoardEyeRevealIcon, {}),
|
|
1466
|
+
/* @__PURE__ */ jsx2("span", { children: "\u5DF2\u63ED\u793A\xB7\u9000\u51FA" })
|
|
1467
|
+
]
|
|
1468
|
+
}
|
|
1469
|
+
),
|
|
1470
|
+
/* @__PURE__ */ jsxs2(
|
|
1471
|
+
"button",
|
|
1472
|
+
{
|
|
1473
|
+
type: "button",
|
|
1474
|
+
className: `yudao-boards-top-btn ${votingSession?.active ? "is-active" : ""}`,
|
|
1475
|
+
"data-testid": "boards-voting-open",
|
|
1476
|
+
onClick: () => commandService.syncExecuteCommand(OpenBoardVotingModalOperation.id, { open: true }),
|
|
1477
|
+
children: [
|
|
1478
|
+
/* @__PURE__ */ jsx2(BoardTrophyRankIcon, {}),
|
|
1479
|
+
/* @__PURE__ */ jsx2("span", { children: votingSession?.active ? `\u6295\u7968\xB7\u5269${remainingSessionVotes}\u7968` : "\u9650\u989D\u6295\u7968" })
|
|
1480
|
+
]
|
|
1481
|
+
}
|
|
1482
|
+
)
|
|
1483
|
+
] }),
|
|
1484
|
+
/* @__PURE__ */ jsxs2("div", { className: "yudao-boards-presence-group", "data-testid": "boards-presence-bar", children: [
|
|
1485
|
+
collaborators.map((collab) => {
|
|
1486
|
+
const isFollowing = spotlight.followingUserId === collab.userId;
|
|
1487
|
+
return /* @__PURE__ */ jsxs2(
|
|
1488
|
+
"button",
|
|
1489
|
+
{
|
|
1490
|
+
type: "button",
|
|
1491
|
+
className: `yudao-boards-collab-pill ${isFollowing ? "is-following" : ""}`,
|
|
1492
|
+
"data-testid": `boards-collab-pill-${collab.userId}`,
|
|
1493
|
+
title: `\u70B9\u51FB\u8DDF\u968F ${collab.userName} \u7684\u89C6\u89D2 (Follow)`,
|
|
1494
|
+
onClick: () => selectionService.setFollowingUser(isFollowing ? null : collab.userId),
|
|
1495
|
+
children: [
|
|
1496
|
+
/* @__PURE__ */ jsx2(
|
|
1497
|
+
"span",
|
|
1498
|
+
{
|
|
1499
|
+
className: "yudao-boards-collab-avatar",
|
|
1500
|
+
style: { backgroundColor: collab.color || "#2563EB" },
|
|
1501
|
+
children: (collab.userName || collab.userId).slice(0, 1).toUpperCase()
|
|
1502
|
+
}
|
|
1503
|
+
),
|
|
1504
|
+
/* @__PURE__ */ jsx2("span", { children: collab.userName }),
|
|
1505
|
+
/* @__PURE__ */ jsx2(BoardFollowIcon, {}),
|
|
1506
|
+
/* @__PURE__ */ jsx2("span", { className: "yudao-boards-collab-follow-tag", children: isFollowing ? "\u8DDF\u968F\u4E2D" : "\u8DDF\u968F\u89C6\u89D2" })
|
|
1507
|
+
]
|
|
1508
|
+
},
|
|
1509
|
+
collab.userId
|
|
1510
|
+
);
|
|
1511
|
+
}),
|
|
1512
|
+
/* @__PURE__ */ jsxs2(
|
|
1513
|
+
"button",
|
|
1514
|
+
{
|
|
1515
|
+
type: "button",
|
|
1516
|
+
className: `yudao-boards-top-btn ${isHostingSpotlight ? "is-active" : ""}`,
|
|
1517
|
+
"data-testid": "boards-spotlight-me",
|
|
1518
|
+
title: "\u5E7F\u64AD\u4E3B\u8BB2\u89C6\u89D2\uFF0C\u5F15\u5BFC\u5168\u5458\u805A\u7126\u5F53\u524D\u753B\u9762 (Spotlight)",
|
|
1519
|
+
onClick: () => selectionService.setSpotlightHost(isHostingSpotlight ? null : currentUserId),
|
|
1520
|
+
children: [
|
|
1521
|
+
/* @__PURE__ */ jsx2(BoardSpotlightIcon, {}),
|
|
1522
|
+
/* @__PURE__ */ jsx2("span", { children: isHostingSpotlight ? "\u805A\u7126\u4E3B\u8BB2\u4E2D" : "\u5168\u5458\u805A\u7126\u6211" })
|
|
1523
|
+
]
|
|
1524
|
+
}
|
|
1525
|
+
)
|
|
1526
|
+
] }),
|
|
1313
1527
|
/* @__PURE__ */ jsxs2("div", { className: "yudao-boards-timer-group", "data-testid": "boards-workshop-timer", children: [
|
|
1314
1528
|
/* @__PURE__ */ jsx2(BoardTimerIcon, {}),
|
|
1315
1529
|
/* @__PURE__ */ jsx2("span", { className: "yudao-boards-timer-clock", children: formatCountdown(timer.remainingSec) }),
|
|
@@ -1804,6 +2018,33 @@ var BoardsInfiniteCanvas = () => {
|
|
|
1804
2018
|
el.type === "sticky" && (() => {
|
|
1805
2019
|
const sticky = el;
|
|
1806
2020
|
const pal = resolveStickyPalette(sticky.color);
|
|
2021
|
+
const isMasked = isStickyMaskedForViewer(sticky, brainstorm, currentUserId);
|
|
2022
|
+
if (isMasked) {
|
|
2023
|
+
return /* @__PURE__ */ jsx2(
|
|
2024
|
+
"div",
|
|
2025
|
+
{
|
|
2026
|
+
className: "yudao-boards-sticky-card is-masked",
|
|
2027
|
+
"data-testid": `sticky-masked-${sticky.id}`,
|
|
2028
|
+
style: {
|
|
2029
|
+
backgroundColor: pal.fill,
|
|
2030
|
+
borderColor: pal.border,
|
|
2031
|
+
color: pal.text
|
|
2032
|
+
},
|
|
2033
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "yudao-boards-sticky-privacy-mask", children: [
|
|
2034
|
+
/* @__PURE__ */ jsxs2("div", { className: "yudao-boards-sticky-blur-bars", "aria-hidden": "true", children: [
|
|
2035
|
+
/* @__PURE__ */ jsx2("span", {}),
|
|
2036
|
+
/* @__PURE__ */ jsx2("span", {}),
|
|
2037
|
+
/* @__PURE__ */ jsx2("span", {})
|
|
2038
|
+
] }),
|
|
2039
|
+
/* @__PURE__ */ jsxs2("div", { className: "yudao-boards-sticky-mask-badge", children: [
|
|
2040
|
+
/* @__PURE__ */ jsx2(BoardEyeOffIcon, {}),
|
|
2041
|
+
/* @__PURE__ */ jsx2("span", { children: "\u601D\u8003\u8F93\u5165\u4E2D \xB7 \u5F85\u63ED\u793A" })
|
|
2042
|
+
] })
|
|
2043
|
+
] })
|
|
2044
|
+
}
|
|
2045
|
+
);
|
|
2046
|
+
}
|
|
2047
|
+
const authorLabel = brainstorm?.hideAuthorNames ? "\u533F\u540D\u5171\u521B" : sticky.author ?? "";
|
|
1807
2048
|
return /* @__PURE__ */ jsxs2(
|
|
1808
2049
|
"div",
|
|
1809
2050
|
{
|
|
@@ -1825,7 +2066,7 @@ var BoardsInfiniteCanvas = () => {
|
|
|
1825
2066
|
}
|
|
1826
2067
|
) : /* @__PURE__ */ jsx2("div", { className: "yudao-boards-sticky-text", children: sticky.text }),
|
|
1827
2068
|
/* @__PURE__ */ jsxs2("div", { className: "yudao-boards-sticky-footer", children: [
|
|
1828
|
-
/* @__PURE__ */ jsx2("span", { className: "yudao-boards-sticky-author", children:
|
|
2069
|
+
/* @__PURE__ */ jsx2("span", { className: "yudao-boards-sticky-author", children: authorLabel }),
|
|
1829
2070
|
/* @__PURE__ */ jsxs2(
|
|
1830
2071
|
"button",
|
|
1831
2072
|
{
|
|
@@ -1836,10 +2077,18 @@ var BoardsInfiniteCanvas = () => {
|
|
|
1836
2077
|
onPointerDown: (e) => e.stopPropagation(),
|
|
1837
2078
|
onClick: (e) => {
|
|
1838
2079
|
e.stopPropagation();
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
2080
|
+
if (votingSession?.active) {
|
|
2081
|
+
commandService.syncExecuteCommand(CastBoardSessionVoteCommand.id, {
|
|
2082
|
+
unitId,
|
|
2083
|
+
elementId: sticky.id,
|
|
2084
|
+
voterId: currentUserId
|
|
2085
|
+
});
|
|
2086
|
+
} else {
|
|
2087
|
+
commandService.syncExecuteCommand(VoteBoardStickyCommand.id, {
|
|
2088
|
+
unitId,
|
|
2089
|
+
elementId: sticky.id
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
1843
2092
|
},
|
|
1844
2093
|
children: [
|
|
1845
2094
|
/* @__PURE__ */ jsx2(BoardVoteThumbIcon, {}),
|
|
@@ -2068,6 +2317,36 @@ var BoardsInfiniteCanvas = () => {
|
|
|
2068
2317
|
},
|
|
2069
2318
|
pin.id
|
|
2070
2319
|
)),
|
|
2320
|
+
collaborators.map((collab) => {
|
|
2321
|
+
if (!collab.cursor || collab.userId === currentUserId) return null;
|
|
2322
|
+
return /* @__PURE__ */ jsxs2(
|
|
2323
|
+
"div",
|
|
2324
|
+
{
|
|
2325
|
+
className: "yudao-boards-remote-cursor",
|
|
2326
|
+
style: { left: collab.cursor.x, top: collab.cursor.y },
|
|
2327
|
+
children: [
|
|
2328
|
+
/* @__PURE__ */ jsx2("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx2(
|
|
2329
|
+
"path",
|
|
2330
|
+
{
|
|
2331
|
+
d: "M1.5 1.5L12.5 6.2L7.4 7.6L5.8 12.6L1.5 1.5Z",
|
|
2332
|
+
fill: collab.color || "#2563EB",
|
|
2333
|
+
stroke: "#FFFFFF",
|
|
2334
|
+
strokeWidth: "1.2"
|
|
2335
|
+
}
|
|
2336
|
+
) }),
|
|
2337
|
+
/* @__PURE__ */ jsx2(
|
|
2338
|
+
"span",
|
|
2339
|
+
{
|
|
2340
|
+
className: "yudao-boards-remote-cursor-tag",
|
|
2341
|
+
style: { backgroundColor: collab.color || "#2563EB" },
|
|
2342
|
+
children: collab.userName
|
|
2343
|
+
}
|
|
2344
|
+
)
|
|
2345
|
+
]
|
|
2346
|
+
},
|
|
2347
|
+
`cursor-${collab.userId}`
|
|
2348
|
+
);
|
|
2349
|
+
}),
|
|
2071
2350
|
marqueeBox && /* @__PURE__ */ jsx2(
|
|
2072
2351
|
"div",
|
|
2073
2352
|
{
|
|
@@ -2851,12 +3130,13 @@ import {
|
|
|
2851
3130
|
DeleteBoardElementsCommand as DeleteBoardElementsCommand3,
|
|
2852
3131
|
IBoardSelectionService as IBoardSelectionService5,
|
|
2853
3132
|
importCsvToBoardStickies,
|
|
3133
|
+
ImportDocumentPagesToBoardCommand,
|
|
2854
3134
|
ImportMermaidToBoardCommand,
|
|
2855
3135
|
MERMAID_PRESET_TEMPLATES,
|
|
2856
3136
|
ReplaceBoardSnapshotCommand,
|
|
2857
3137
|
SetBoardViewportCommand as SetBoardViewportCommand4
|
|
2858
3138
|
} from "@yudaocode/univer-boards";
|
|
2859
|
-
import { useState as useState2 } from "react";
|
|
3139
|
+
import { useRef as useRef2, useState as useState2 } from "react";
|
|
2860
3140
|
import { of as of4 } from "rxjs";
|
|
2861
3141
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2862
3142
|
var BoardsLeftSidebar = () => {
|
|
@@ -2881,6 +3161,7 @@ var BoardsLeftSidebar = () => {
|
|
|
2881
3161
|
);
|
|
2882
3162
|
const [activeTab, setActiveTab] = useState2("frames");
|
|
2883
3163
|
const [csvInput, setCsvInput] = useState2("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");
|
|
3164
|
+
const quickDocInputRef = useRef2(null);
|
|
2884
3165
|
const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
|
|
2885
3166
|
if (!currentSnap || !unit) {
|
|
2886
3167
|
return /* @__PURE__ */ jsx5("div", { className: "yudao-boards-left-sidebar yudao-boards-empty", children: "\u672A\u6302\u8F7D\u767D\u677F\u5B9E\u4F8B" });
|
|
@@ -2926,6 +3207,23 @@ var BoardsLeftSidebar = () => {
|
|
|
2926
3207
|
});
|
|
2927
3208
|
}
|
|
2928
3209
|
};
|
|
3210
|
+
const handleQuickDocUpload = async (e) => {
|
|
3211
|
+
const file = e.target.files?.[0];
|
|
3212
|
+
if (!file) return;
|
|
3213
|
+
try {
|
|
3214
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
3215
|
+
const ok = await commandService.executeCommand(ImportDocumentPagesToBoardCommand.id, {
|
|
3216
|
+
unitId: unit.getUnitId(),
|
|
3217
|
+
fileBytes: bytes,
|
|
3218
|
+
fileName: file.name
|
|
3219
|
+
});
|
|
3220
|
+
if (ok) {
|
|
3221
|
+
commandService.syncExecuteCommand(FitBoardToScreenOperation.id);
|
|
3222
|
+
}
|
|
3223
|
+
} finally {
|
|
3224
|
+
if (e.target) e.target.value = "";
|
|
3225
|
+
}
|
|
3226
|
+
};
|
|
2929
3227
|
return /* @__PURE__ */ jsxs5("aside", { className: "yudao-boards-left-sidebar", "data-testid": "boards-left-sidebar", children: [
|
|
2930
3228
|
/* @__PURE__ */ jsxs5("div", { className: "yudao-boards-sidebar-tabs", children: [
|
|
2931
3229
|
/* @__PURE__ */ jsxs5(
|
|
@@ -2960,7 +3258,7 @@ var BoardsLeftSidebar = () => {
|
|
|
2960
3258
|
type: "button",
|
|
2961
3259
|
className: activeTab === "templates" ? "is-active" : "",
|
|
2962
3260
|
onClick: () => setActiveTab("templates"),
|
|
2963
|
-
children: "\u6A21\u677F
|
|
3261
|
+
children: "\u6A21\u677F/\u5BFC\u5165"
|
|
2964
3262
|
}
|
|
2965
3263
|
)
|
|
2966
3264
|
] }),
|
|
@@ -3053,6 +3351,41 @@ var BoardsLeftSidebar = () => {
|
|
|
3053
3351
|
]
|
|
3054
3352
|
}
|
|
3055
3353
|
),
|
|
3354
|
+
/* @__PURE__ */ jsxs5(
|
|
3355
|
+
"button",
|
|
3356
|
+
{
|
|
3357
|
+
type: "button",
|
|
3358
|
+
className: "yudao-boards-secondary-block-btn",
|
|
3359
|
+
"data-testid": "boards-sidebar-import-doc",
|
|
3360
|
+
onClick: () => commandService.syncExecuteCommand(OpenBoardDocImportModalOperation.id, { open: true }),
|
|
3361
|
+
children: [
|
|
3362
|
+
/* @__PURE__ */ jsx5(BoardDocUploadIcon, {}),
|
|
3363
|
+
" \u5BFC\u5165 PDF / PPTX \u62C6\u9875\u4E0A\u5899"
|
|
3364
|
+
]
|
|
3365
|
+
}
|
|
3366
|
+
),
|
|
3367
|
+
/* @__PURE__ */ jsx5(
|
|
3368
|
+
"input",
|
|
3369
|
+
{
|
|
3370
|
+
ref: quickDocInputRef,
|
|
3371
|
+
type: "file",
|
|
3372
|
+
accept: ".pdf,.pptx,application/pdf,application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
3373
|
+
style: { display: "none" },
|
|
3374
|
+
onChange: (ev) => void handleQuickDocUpload(ev)
|
|
3375
|
+
}
|
|
3376
|
+
),
|
|
3377
|
+
/* @__PURE__ */ jsxs5(
|
|
3378
|
+
"button",
|
|
3379
|
+
{
|
|
3380
|
+
type: "button",
|
|
3381
|
+
className: "yudao-boards-secondary-block-btn",
|
|
3382
|
+
onClick: () => quickDocInputRef.current?.click(),
|
|
3383
|
+
children: [
|
|
3384
|
+
/* @__PURE__ */ jsx5(BoardDocUploadIcon, {}),
|
|
3385
|
+
" \u5FEB\u901F\u9009\u62E9\u672C\u5730 PDF / PPTX \u6587\u4EF6"
|
|
3386
|
+
]
|
|
3387
|
+
}
|
|
3388
|
+
),
|
|
3056
3389
|
/* @__PURE__ */ jsx5(
|
|
3057
3390
|
"button",
|
|
3058
3391
|
{
|
|
@@ -3107,28 +3440,22 @@ var BoardsLeftSidebar = () => {
|
|
|
3107
3440
|
] });
|
|
3108
3441
|
};
|
|
3109
3442
|
|
|
3110
|
-
// src/views/modals/
|
|
3443
|
+
// src/views/modals/BoardsDocImportModal.tsx
|
|
3111
3444
|
import { ICommandService as ICommandService6, IUniverInstanceService as IUniverInstanceService6, UniverInstanceType as UniverInstanceType6 } from "@univerjs/core";
|
|
3112
3445
|
import { useDependency as useDependency5, useObservable as useObservable5 } from "@univerjs/ui";
|
|
3113
3446
|
import {
|
|
3114
|
-
createDefaultBoardUnitData,
|
|
3115
|
-
detectMermaidDiagramType,
|
|
3116
|
-
exportBoardToMermaid,
|
|
3117
|
-
exportBoardToSvg,
|
|
3118
3447
|
IBoardSelectionService as IBoardSelectionService6,
|
|
3119
|
-
|
|
3120
|
-
MERMAID_PRESET_TEMPLATES as MERMAID_PRESET_TEMPLATES2,
|
|
3121
|
-
parseMermaidToBoardElements
|
|
3448
|
+
ImportDocumentPagesToBoardCommand as ImportDocumentPagesToBoardCommand2
|
|
3122
3449
|
} from "@yudaocode/univer-boards";
|
|
3123
|
-
import {
|
|
3450
|
+
import { useRef as useRef3, useState as useState3 } from "react";
|
|
3124
3451
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3125
|
-
var
|
|
3452
|
+
var BoardsDocImportModal = ({ forceOpen }) => {
|
|
3126
3453
|
const instanceService = useDependency5(IUniverInstanceService6);
|
|
3127
3454
|
const commandService = useDependency5(ICommandService6);
|
|
3128
3455
|
const selectionService = useDependency5(IBoardSelectionService6);
|
|
3129
3456
|
const isOpen = useObservable5(
|
|
3130
|
-
selectionService.
|
|
3131
|
-
selectionService.
|
|
3457
|
+
selectionService.docImportModalOpen$,
|
|
3458
|
+
selectionService.isDocImportModalOpen()
|
|
3132
3459
|
);
|
|
3133
3460
|
const unit = useObservable5(
|
|
3134
3461
|
() => instanceService.getCurrentTypeOfUnit$(UniverInstanceType6.UNIVER_BOARD),
|
|
@@ -3136,9 +3463,176 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3136
3463
|
false,
|
|
3137
3464
|
[instanceService]
|
|
3138
3465
|
);
|
|
3139
|
-
const
|
|
3466
|
+
const fileInputRef = useRef3(null);
|
|
3467
|
+
const [columns, setColumns] = useState3(3);
|
|
3140
3468
|
const [replaceExisting, setReplaceExisting] = useState3(false);
|
|
3141
|
-
const [
|
|
3469
|
+
const [busy, setBusy] = useState3(false);
|
|
3470
|
+
const [statusMessage, setStatusMessage] = useState3("");
|
|
3471
|
+
if (!isOpen && !forceOpen) return null;
|
|
3472
|
+
const handleClose = () => {
|
|
3473
|
+
selectionService.setDocImportModalOpen(false);
|
|
3474
|
+
setStatusMessage("");
|
|
3475
|
+
};
|
|
3476
|
+
const handleFileChange = async (e) => {
|
|
3477
|
+
const file = e.target.files?.[0];
|
|
3478
|
+
if (!file || !unit) return;
|
|
3479
|
+
setBusy(true);
|
|
3480
|
+
setStatusMessage(`\u6B63\u5728\u89E3\u6790 ${file.name}...`);
|
|
3481
|
+
try {
|
|
3482
|
+
const ab = await file.arrayBuffer();
|
|
3483
|
+
const bytes = new Uint8Array(ab);
|
|
3484
|
+
const ok = await commandService.executeCommand(ImportDocumentPagesToBoardCommand2.id, {
|
|
3485
|
+
unitId: unit.getUnitId(),
|
|
3486
|
+
fileBytes: bytes,
|
|
3487
|
+
fileName: file.name,
|
|
3488
|
+
columns,
|
|
3489
|
+
replaceExisting
|
|
3490
|
+
});
|
|
3491
|
+
if (ok) {
|
|
3492
|
+
commandService.syncExecuteCommand(FitBoardToScreenOperation.id);
|
|
3493
|
+
selectionService.setDocImportModalOpen(false);
|
|
3494
|
+
setStatusMessage("");
|
|
3495
|
+
} else {
|
|
3496
|
+
setStatusMessage("\u672A\u80FD\u8BC6\u522B\u6709\u6548\u7684 PDF \u6216 PPTX \u9875\u9762\u7ED3\u6784\uFF0C\u8BF7\u68C0\u67E5\u6587\u4EF6\u683C\u5F0F\u3002");
|
|
3497
|
+
}
|
|
3498
|
+
} catch (err) {
|
|
3499
|
+
setStatusMessage(err instanceof Error ? err.message : "\u6587\u6863\u89E3\u6790\u5931\u8D25");
|
|
3500
|
+
} finally {
|
|
3501
|
+
setBusy(false);
|
|
3502
|
+
if (e.target) {
|
|
3503
|
+
e.target.value = "";
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
};
|
|
3507
|
+
return /* @__PURE__ */ jsx6(
|
|
3508
|
+
"div",
|
|
3509
|
+
{
|
|
3510
|
+
className: "yudao-boards-modal-backdrop",
|
|
3511
|
+
"data-testid": "boards-doc-import-modal",
|
|
3512
|
+
onClick: handleClose,
|
|
3513
|
+
children: /* @__PURE__ */ jsxs6(
|
|
3514
|
+
"div",
|
|
3515
|
+
{
|
|
3516
|
+
className: "yudao-boards-doc-import-dialog",
|
|
3517
|
+
onClick: (e) => e.stopPropagation(),
|
|
3518
|
+
children: [
|
|
3519
|
+
/* @__PURE__ */ jsxs6("header", { className: "yudao-boards-mermaid-header", children: [
|
|
3520
|
+
/* @__PURE__ */ jsxs6("div", { className: "yudao-boards-mermaid-title", children: [
|
|
3521
|
+
/* @__PURE__ */ jsx6(BoardDocUploadIcon, {}),
|
|
3522
|
+
/* @__PURE__ */ jsx6("span", { children: "\u5BFC\u5165 PDF / PPTX \u62C6\u9875\u4E0A\u5899\u5DE5\u4F5C\u53F0" })
|
|
3523
|
+
] }),
|
|
3524
|
+
/* @__PURE__ */ jsx6(
|
|
3525
|
+
"button",
|
|
3526
|
+
{
|
|
3527
|
+
type: "button",
|
|
3528
|
+
className: "yudao-boards-btn-ghost",
|
|
3529
|
+
onClick: handleClose,
|
|
3530
|
+
children: "\u5173\u95ED"
|
|
3531
|
+
}
|
|
3532
|
+
)
|
|
3533
|
+
] }),
|
|
3534
|
+
/* @__PURE__ */ jsxs6("div", { className: "yudao-boards-doc-import-body", children: [
|
|
3535
|
+
/* @__PURE__ */ jsxs6("p", { className: "yudao-boards-doc-desc", children: [
|
|
3536
|
+
"\u652F\u6301\u5C06\u591A\u9875\u6F14\u793A\u6587\u7A3F\uFF08",
|
|
3537
|
+
/* @__PURE__ */ jsx6("code", { children: ".pptx" }),
|
|
3538
|
+
"\uFF09\u6216\u65B9\u6848\u8BC4\u5BA1\u6587\u6863\uFF08",
|
|
3539
|
+
/* @__PURE__ */ jsx6("code", { children: ".pdf" }),
|
|
3540
|
+
"\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"
|
|
3541
|
+
] }),
|
|
3542
|
+
/* @__PURE__ */ jsxs6("div", { className: "yudao-boards-doc-options", children: [
|
|
3543
|
+
/* @__PURE__ */ jsxs6("div", { className: "yudao-boards-voting-field", children: [
|
|
3544
|
+
/* @__PURE__ */ jsx6("span", { children: "\u5E73\u94FA\u7F51\u683C\u5217\u6570" }),
|
|
3545
|
+
/* @__PURE__ */ jsx6("div", { className: "yudao-boards-quota-pills", children: [2, 3, 4].map((colCount) => /* @__PURE__ */ jsxs6(
|
|
3546
|
+
"button",
|
|
3547
|
+
{
|
|
3548
|
+
type: "button",
|
|
3549
|
+
className: `yudao-boards-preset-pill ${columns === colCount ? "is-selected" : ""}`,
|
|
3550
|
+
onClick: () => setColumns(colCount),
|
|
3551
|
+
children: [
|
|
3552
|
+
"\u6BCF\u884C ",
|
|
3553
|
+
colCount,
|
|
3554
|
+
" \u9875"
|
|
3555
|
+
]
|
|
3556
|
+
},
|
|
3557
|
+
colCount
|
|
3558
|
+
)) })
|
|
3559
|
+
] }),
|
|
3560
|
+
/* @__PURE__ */ jsxs6("label", { className: "yudao-boards-checkbox-label", children: [
|
|
3561
|
+
/* @__PURE__ */ jsx6(
|
|
3562
|
+
"input",
|
|
3563
|
+
{
|
|
3564
|
+
type: "checkbox",
|
|
3565
|
+
checked: replaceExisting,
|
|
3566
|
+
onChange: (e) => setReplaceExisting(e.target.checked)
|
|
3567
|
+
}
|
|
3568
|
+
),
|
|
3569
|
+
/* @__PURE__ */ jsx6("span", { children: "\u62C6\u9875\u4E0A\u5899\u524D\u6E05\u7A7A\u5F53\u524D\u753B\u5E03\u539F\u6709\u5143\u7D20" })
|
|
3570
|
+
] })
|
|
3571
|
+
] }),
|
|
3572
|
+
/* @__PURE__ */ jsx6(
|
|
3573
|
+
"input",
|
|
3574
|
+
{
|
|
3575
|
+
ref: fileInputRef,
|
|
3576
|
+
type: "file",
|
|
3577
|
+
accept: ".pdf,.pptx,application/pdf,application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
3578
|
+
"data-testid": "boards-doc-file-input",
|
|
3579
|
+
style: { display: "none" },
|
|
3580
|
+
onChange: (ev) => void handleFileChange(ev)
|
|
3581
|
+
}
|
|
3582
|
+
),
|
|
3583
|
+
/* @__PURE__ */ jsxs6(
|
|
3584
|
+
"div",
|
|
3585
|
+
{
|
|
3586
|
+
className: "yudao-boards-upload-dropzone",
|
|
3587
|
+
onClick: () => fileInputRef.current?.click(),
|
|
3588
|
+
children: [
|
|
3589
|
+
/* @__PURE__ */ jsx6(BoardDocUploadIcon, {}),
|
|
3590
|
+
/* @__PURE__ */ jsx6("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" }),
|
|
3591
|
+
/* @__PURE__ */ jsx6("span", { children: "\u7EAF\u524D\u7AEF\u6D41\u5F0F\u89E3\u6790 \xB7 \u81EA\u52A8\u751F\u6210\u6709\u5E8F\u8BC4\u5BA1\u753B\u6846\u5E8F\u5217" })
|
|
3592
|
+
]
|
|
3593
|
+
}
|
|
3594
|
+
),
|
|
3595
|
+
statusMessage && /* @__PURE__ */ jsx6("div", { className: "yudao-boards-hint-box", children: statusMessage })
|
|
3596
|
+
] })
|
|
3597
|
+
]
|
|
3598
|
+
}
|
|
3599
|
+
)
|
|
3600
|
+
}
|
|
3601
|
+
);
|
|
3602
|
+
};
|
|
3603
|
+
|
|
3604
|
+
// src/views/modals/BoardsMermaidModal.tsx
|
|
3605
|
+
import { ICommandService as ICommandService7, IUniverInstanceService as IUniverInstanceService7, UniverInstanceType as UniverInstanceType7 } from "@univerjs/core";
|
|
3606
|
+
import { useDependency as useDependency6, useObservable as useObservable6 } from "@univerjs/ui";
|
|
3607
|
+
import {
|
|
3608
|
+
createDefaultBoardUnitData,
|
|
3609
|
+
detectMermaidDiagramType,
|
|
3610
|
+
exportBoardToMermaid,
|
|
3611
|
+
exportBoardToSvg,
|
|
3612
|
+
IBoardSelectionService as IBoardSelectionService7,
|
|
3613
|
+
ImportMermaidToBoardCommand as ImportMermaidToBoardCommand2,
|
|
3614
|
+
MERMAID_PRESET_TEMPLATES as MERMAID_PRESET_TEMPLATES2,
|
|
3615
|
+
parseMermaidToBoardElements
|
|
3616
|
+
} from "@yudaocode/univer-boards";
|
|
3617
|
+
import { useMemo as useMemo2, useState as useState4 } from "react";
|
|
3618
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3619
|
+
var BoardsMermaidModal = ({ forceOpen }) => {
|
|
3620
|
+
const instanceService = useDependency6(IUniverInstanceService7);
|
|
3621
|
+
const commandService = useDependency6(ICommandService7);
|
|
3622
|
+
const selectionService = useDependency6(IBoardSelectionService7);
|
|
3623
|
+
const isOpen = useObservable6(
|
|
3624
|
+
selectionService.mermaidModalOpen$,
|
|
3625
|
+
selectionService.isMermaidModalOpen()
|
|
3626
|
+
);
|
|
3627
|
+
const unit = useObservable6(
|
|
3628
|
+
() => instanceService.getCurrentTypeOfUnit$(UniverInstanceType7.UNIVER_BOARD),
|
|
3629
|
+
instanceService.getCurrentUnitOfType(UniverInstanceType7.UNIVER_BOARD),
|
|
3630
|
+
false,
|
|
3631
|
+
[instanceService]
|
|
3632
|
+
);
|
|
3633
|
+
const [code, setCode] = useState4(MERMAID_PRESET_TEMPLATES2[0].code);
|
|
3634
|
+
const [replaceExisting, setReplaceExisting] = useState4(false);
|
|
3635
|
+
const [reverseKind, setReverseKind] = useState4("auto");
|
|
3142
3636
|
const previewInfo = useMemo2(() => {
|
|
3143
3637
|
try {
|
|
3144
3638
|
const elements = parseMermaidToBoardElements(code, { originX: 40, originY: 40 });
|
|
@@ -3201,24 +3695,24 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3201
3695
|
});
|
|
3202
3696
|
setCode(generated);
|
|
3203
3697
|
};
|
|
3204
|
-
return /* @__PURE__ */
|
|
3698
|
+
return /* @__PURE__ */ jsx7(
|
|
3205
3699
|
"div",
|
|
3206
3700
|
{
|
|
3207
3701
|
className: "yudao-boards-modal-backdrop",
|
|
3208
3702
|
"data-testid": "boards-mermaid-modal",
|
|
3209
3703
|
onClick: handleClose,
|
|
3210
|
-
children: /* @__PURE__ */
|
|
3704
|
+
children: /* @__PURE__ */ jsxs7(
|
|
3211
3705
|
"div",
|
|
3212
3706
|
{
|
|
3213
3707
|
className: "yudao-boards-mermaid-dialog",
|
|
3214
3708
|
onClick: (e) => e.stopPropagation(),
|
|
3215
3709
|
children: [
|
|
3216
|
-
/* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3218
|
-
/* @__PURE__ */
|
|
3219
|
-
/* @__PURE__ */
|
|
3710
|
+
/* @__PURE__ */ jsxs7("header", { className: "yudao-boards-mermaid-header", children: [
|
|
3711
|
+
/* @__PURE__ */ jsxs7("div", { className: "yudao-boards-mermaid-title", children: [
|
|
3712
|
+
/* @__PURE__ */ jsx7(BoardMermaidIcon, {}),
|
|
3713
|
+
/* @__PURE__ */ jsx7("span", { children: "Mermaid \u6D41\u7A0B\u56FE\u4E0E\u67B6\u6784\u4EE3\u7801\u53CC\u5411\u4E92\u8F6C\u5DE5\u4F5C\u53F0" })
|
|
3220
3714
|
] }),
|
|
3221
|
-
/* @__PURE__ */
|
|
3715
|
+
/* @__PURE__ */ jsx7(
|
|
3222
3716
|
"button",
|
|
3223
3717
|
{
|
|
3224
3718
|
type: "button",
|
|
@@ -3228,9 +3722,9 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3228
3722
|
}
|
|
3229
3723
|
)
|
|
3230
3724
|
] }),
|
|
3231
|
-
/* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3233
|
-
MERMAID_PRESET_TEMPLATES2.map((tpl) => /* @__PURE__ */
|
|
3725
|
+
/* @__PURE__ */ jsxs7("div", { className: "yudao-boards-mermaid-presets", children: [
|
|
3726
|
+
/* @__PURE__ */ jsx7("span", { className: "yudao-boards-presets-label", children: "\u573A\u666F\u6A21\u677F\uFF1A" }),
|
|
3727
|
+
MERMAID_PRESET_TEMPLATES2.map((tpl) => /* @__PURE__ */ jsx7(
|
|
3234
3728
|
"button",
|
|
3235
3729
|
{
|
|
3236
3730
|
type: "button",
|
|
@@ -3242,32 +3736,32 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3242
3736
|
tpl.key
|
|
3243
3737
|
))
|
|
3244
3738
|
] }),
|
|
3245
|
-
/* @__PURE__ */
|
|
3246
|
-
/* @__PURE__ */
|
|
3247
|
-
/* @__PURE__ */
|
|
3248
|
-
/* @__PURE__ */
|
|
3739
|
+
/* @__PURE__ */ jsxs7("div", { className: "yudao-boards-mermaid-split", children: [
|
|
3740
|
+
/* @__PURE__ */ jsxs7("div", { className: "yudao-boards-mermaid-editor-pane", children: [
|
|
3741
|
+
/* @__PURE__ */ jsxs7("div", { className: "yudao-boards-pane-toolbar", children: [
|
|
3742
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
3249
3743
|
"Mermaid DSL \u6E90\u7801 (",
|
|
3250
3744
|
previewInfo.detectedType,
|
|
3251
3745
|
")"
|
|
3252
3746
|
] }),
|
|
3253
|
-
/* @__PURE__ */
|
|
3254
|
-
/* @__PURE__ */
|
|
3747
|
+
/* @__PURE__ */ jsxs7("div", { className: "yudao-boards-reverse-bar", children: [
|
|
3748
|
+
/* @__PURE__ */ jsxs7(
|
|
3255
3749
|
"select",
|
|
3256
3750
|
{
|
|
3257
3751
|
value: reverseKind,
|
|
3258
3752
|
onChange: (e) => setReverseKind(e.target.value),
|
|
3259
3753
|
className: "yudao-boards-select-sm",
|
|
3260
3754
|
children: [
|
|
3261
|
-
/* @__PURE__ */
|
|
3262
|
-
/* @__PURE__ */
|
|
3263
|
-
/* @__PURE__ */
|
|
3264
|
-
/* @__PURE__ */
|
|
3265
|
-
/* @__PURE__ */
|
|
3266
|
-
/* @__PURE__ */
|
|
3755
|
+
/* @__PURE__ */ jsx7("option", { value: "auto", children: "\u81EA\u52A8\u8BC6\u522B\u56FE\u7C7B\u578B" }),
|
|
3756
|
+
/* @__PURE__ */ jsx7("option", { value: "flowchart", children: "flowchart TD" }),
|
|
3757
|
+
/* @__PURE__ */ jsx7("option", { value: "erDiagram", children: "erDiagram" }),
|
|
3758
|
+
/* @__PURE__ */ jsx7("option", { value: "classDiagram", children: "classDiagram" }),
|
|
3759
|
+
/* @__PURE__ */ jsx7("option", { value: "mindmap", children: "mindmap" }),
|
|
3760
|
+
/* @__PURE__ */ jsx7("option", { value: "sequenceDiagram", children: "sequenceDiagram" })
|
|
3267
3761
|
]
|
|
3268
3762
|
}
|
|
3269
3763
|
),
|
|
3270
|
-
/* @__PURE__ */
|
|
3764
|
+
/* @__PURE__ */ jsx7(
|
|
3271
3765
|
"button",
|
|
3272
3766
|
{
|
|
3273
3767
|
type: "button",
|
|
@@ -3279,7 +3773,7 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3279
3773
|
)
|
|
3280
3774
|
] })
|
|
3281
3775
|
] }),
|
|
3282
|
-
/* @__PURE__ */
|
|
3776
|
+
/* @__PURE__ */ jsx7(
|
|
3283
3777
|
"textarea",
|
|
3284
3778
|
{
|
|
3285
3779
|
className: "yudao-boards-mermaid-textarea",
|
|
@@ -3290,10 +3784,10 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3290
3784
|
}
|
|
3291
3785
|
)
|
|
3292
3786
|
] }),
|
|
3293
|
-
/* @__PURE__ */
|
|
3294
|
-
/* @__PURE__ */
|
|
3295
|
-
/* @__PURE__ */
|
|
3296
|
-
/* @__PURE__ */
|
|
3787
|
+
/* @__PURE__ */ jsxs7("div", { className: "yudao-boards-mermaid-preview-pane", children: [
|
|
3788
|
+
/* @__PURE__ */ jsxs7("div", { className: "yudao-boards-pane-toolbar", children: [
|
|
3789
|
+
/* @__PURE__ */ jsx7("span", { children: "\u5B9E\u65F6\u539F\u751F\u8282\u70B9\u5E03\u5C40\u9884\u89C8" }),
|
|
3790
|
+
/* @__PURE__ */ jsxs7("span", { className: "yudao-boards-preview-stats", "data-testid": "mermaid-node-stats", children: [
|
|
3297
3791
|
"\u5171 ",
|
|
3298
3792
|
previewInfo.elements.length,
|
|
3299
3793
|
" \u4E2A\u539F\u751F\u5143\u7D20\uFF08\u8282\u70B9 ",
|
|
@@ -3306,7 +3800,7 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3306
3800
|
"\uFF09"
|
|
3307
3801
|
] })
|
|
3308
3802
|
] }),
|
|
3309
|
-
/* @__PURE__ */
|
|
3803
|
+
/* @__PURE__ */ jsx7("div", { className: "yudao-boards-mermaid-svg-stage", children: previewInfo.error ? /* @__PURE__ */ jsx7("div", { className: "yudao-boards-error-text", children: previewInfo.error }) : /* @__PURE__ */ jsx7(
|
|
3310
3804
|
"div",
|
|
3311
3805
|
{
|
|
3312
3806
|
className: "yudao-boards-svg-preview-inner",
|
|
@@ -3315,9 +3809,9 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3315
3809
|
) })
|
|
3316
3810
|
] })
|
|
3317
3811
|
] }),
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
/* @__PURE__ */
|
|
3320
|
-
/* @__PURE__ */
|
|
3812
|
+
/* @__PURE__ */ jsxs7("footer", { className: "yudao-boards-mermaid-footer", children: [
|
|
3813
|
+
/* @__PURE__ */ jsxs7("label", { className: "yudao-boards-checkbox-label", children: [
|
|
3814
|
+
/* @__PURE__ */ jsx7(
|
|
3321
3815
|
"input",
|
|
3322
3816
|
{
|
|
3323
3817
|
type: "checkbox",
|
|
@@ -3325,11 +3819,11 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3325
3819
|
onChange: (e) => setReplaceExisting(e.target.checked)
|
|
3326
3820
|
}
|
|
3327
3821
|
),
|
|
3328
|
-
/* @__PURE__ */
|
|
3822
|
+
/* @__PURE__ */ jsx7("span", { children: "\u63D2\u5165\u524D\u6E05\u7A7A\u5F53\u524D\u753B\u5E03\u539F\u6709\u5143\u7D20" })
|
|
3329
3823
|
] }),
|
|
3330
|
-
/* @__PURE__ */
|
|
3331
|
-
/* @__PURE__ */
|
|
3332
|
-
/* @__PURE__ */
|
|
3824
|
+
/* @__PURE__ */ jsxs7("div", { className: "yudao-boards-footer-actions", children: [
|
|
3825
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: "yudao-boards-btn-ghost", onClick: handleClose, children: "\u53D6\u6D88" }),
|
|
3826
|
+
/* @__PURE__ */ jsxs7(
|
|
3333
3827
|
"button",
|
|
3334
3828
|
{
|
|
3335
3829
|
type: "button",
|
|
@@ -3353,10 +3847,348 @@ var BoardsMermaidModal = ({ forceOpen }) => {
|
|
|
3353
3847
|
);
|
|
3354
3848
|
};
|
|
3355
3849
|
|
|
3850
|
+
// src/views/modals/BoardsVotingModal.tsx
|
|
3851
|
+
import { ICommandService as ICommandService8, IUniverInstanceService as IUniverInstanceService8, UniverInstanceType as UniverInstanceType8 } from "@univerjs/core";
|
|
3852
|
+
import { useDependency as useDependency7, useObservable as useObservable7 } from "@univerjs/ui";
|
|
3853
|
+
import {
|
|
3854
|
+
CastBoardSessionVoteCommand as CastBoardSessionVoteCommand2,
|
|
3855
|
+
computeBoardVotingLeaderboard,
|
|
3856
|
+
EndBoardVotingSessionCommand,
|
|
3857
|
+
IBoardSelectionService as IBoardSelectionService8,
|
|
3858
|
+
isStickyMaskedForViewer as isStickyMaskedForViewer2,
|
|
3859
|
+
resolveStickyPalette as resolveStickyPalette2,
|
|
3860
|
+
SetBoardViewportCommand as SetBoardViewportCommand5,
|
|
3861
|
+
StartBoardVotingSessionCommand
|
|
3862
|
+
} from "@yudaocode/univer-boards";
|
|
3863
|
+
import { useMemo as useMemo3, useState as useState5 } from "react";
|
|
3864
|
+
import { of as of5 } from "rxjs";
|
|
3865
|
+
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3866
|
+
var QUOTA_PRESETS = [3, 5, 10];
|
|
3867
|
+
var BoardsVotingModal = ({ forceOpen }) => {
|
|
3868
|
+
const instanceService = useDependency7(IUniverInstanceService8);
|
|
3869
|
+
const commandService = useDependency7(ICommandService8);
|
|
3870
|
+
const selectionService = useDependency7(IBoardSelectionService8);
|
|
3871
|
+
const isOpen = useObservable7(
|
|
3872
|
+
selectionService.votingModalOpen$,
|
|
3873
|
+
selectionService.isVotingModalOpen()
|
|
3874
|
+
);
|
|
3875
|
+
const currentUserId = useObservable7(
|
|
3876
|
+
selectionService.currentUserId$,
|
|
3877
|
+
selectionService.getCurrentUserId()
|
|
3878
|
+
);
|
|
3879
|
+
const unit = useObservable7(
|
|
3880
|
+
() => instanceService.getCurrentTypeOfUnit$(UniverInstanceType8.UNIVER_BOARD),
|
|
3881
|
+
instanceService.getCurrentUnitOfType(UniverInstanceType8.UNIVER_BOARD),
|
|
3882
|
+
false,
|
|
3883
|
+
[instanceService]
|
|
3884
|
+
);
|
|
3885
|
+
const snapshot = useObservable7(
|
|
3886
|
+
() => unit ? unit.snapshotChanged$ : of5(null),
|
|
3887
|
+
unit ? unit.getSnapshot() : null,
|
|
3888
|
+
false,
|
|
3889
|
+
[unit]
|
|
3890
|
+
);
|
|
3891
|
+
const [sessionTitle, setSessionTitle] = useState5("\u56E2\u961F\u65B9\u6848\u4F18\u5148\u7EA7\u6295\u7968");
|
|
3892
|
+
const [quota, setQuota] = useState5(5);
|
|
3893
|
+
const [targetFrameId, setTargetFrameId] = useState5("");
|
|
3894
|
+
const [allowMultiplePerSticky, setAllowMultiplePerSticky] = useState5(true);
|
|
3895
|
+
const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
|
|
3896
|
+
const leaderboard = useMemo3(() => {
|
|
3897
|
+
if (!currentSnap) return [];
|
|
3898
|
+
const activeTargetFrame = currentSnap.votingSession?.targetFrameId || targetFrameId || void 0;
|
|
3899
|
+
return computeBoardVotingLeaderboard(currentSnap, {
|
|
3900
|
+
targetFrameId: activeTargetFrame
|
|
3901
|
+
});
|
|
3902
|
+
}, [currentSnap, targetFrameId]);
|
|
3903
|
+
if (!isOpen && !forceOpen || !currentSnap || !unit) {
|
|
3904
|
+
return null;
|
|
3905
|
+
}
|
|
3906
|
+
const unitId = unit.getUnitId();
|
|
3907
|
+
const frames = unit.getFramesOrdered();
|
|
3908
|
+
const session = currentSnap.votingSession;
|
|
3909
|
+
const isActive = Boolean(session?.active);
|
|
3910
|
+
const myVotedIds = session?.votesByUser[currentUserId] ?? [];
|
|
3911
|
+
const remainingVotes = session ? Math.max(0, session.maxVotesPerUser - myVotedIds.length) : quota;
|
|
3912
|
+
const maxVoteCount = Math.max(1, ...leaderboard.map((item) => item.voteCount));
|
|
3913
|
+
const totalVotesCast = leaderboard.reduce((acc, item) => acc + item.voteCount, 0);
|
|
3914
|
+
const handleClose = () => {
|
|
3915
|
+
selectionService.setVotingModalOpen(false);
|
|
3916
|
+
};
|
|
3917
|
+
const handleStartSession = () => {
|
|
3918
|
+
commandService.syncExecuteCommand(StartBoardVotingSessionCommand.id, {
|
|
3919
|
+
unitId,
|
|
3920
|
+
title: sessionTitle.trim() || "\u56E2\u961F\u65B9\u6848\u4F18\u5148\u7EA7\u6295\u7968",
|
|
3921
|
+
maxVotesPerUser: quota,
|
|
3922
|
+
allowMultiplePerSticky,
|
|
3923
|
+
...targetFrameId ? { targetFrameId } : {}
|
|
3924
|
+
});
|
|
3925
|
+
};
|
|
3926
|
+
const handleEndSession = () => {
|
|
3927
|
+
commandService.syncExecuteCommand(EndBoardVotingSessionCommand.id, { unitId });
|
|
3928
|
+
};
|
|
3929
|
+
const handleCastVote = (elementId, unvote = false) => {
|
|
3930
|
+
commandService.syncExecuteCommand(CastBoardSessionVoteCommand2.id, {
|
|
3931
|
+
unitId,
|
|
3932
|
+
elementId,
|
|
3933
|
+
voterId: currentUserId,
|
|
3934
|
+
unvote
|
|
3935
|
+
});
|
|
3936
|
+
};
|
|
3937
|
+
const handlePanToSticky = (elementId) => {
|
|
3938
|
+
const el = currentSnap.elements[elementId];
|
|
3939
|
+
if (!el) return;
|
|
3940
|
+
const stageW = 1080;
|
|
3941
|
+
const stageH = 680;
|
|
3942
|
+
const zoom = 1.05;
|
|
3943
|
+
const centerX = el.x + el.width / 2;
|
|
3944
|
+
const centerY = el.y + el.height / 2;
|
|
3945
|
+
const panX = Math.round(stageW / 2 - centerX * zoom);
|
|
3946
|
+
const panY = Math.round(stageH / 2 - centerY * zoom);
|
|
3947
|
+
commandService.syncExecuteCommand(SetBoardViewportCommand5.id, {
|
|
3948
|
+
unitId,
|
|
3949
|
+
viewport: { panX, panY, zoom }
|
|
3950
|
+
});
|
|
3951
|
+
selectionService.selectElements([elementId]);
|
|
3952
|
+
selectionService.setVotingModalOpen(false);
|
|
3953
|
+
};
|
|
3954
|
+
return /* @__PURE__ */ jsx8(
|
|
3955
|
+
"div",
|
|
3956
|
+
{
|
|
3957
|
+
className: "yudao-boards-modal-backdrop",
|
|
3958
|
+
"data-testid": "boards-voting-modal",
|
|
3959
|
+
onClick: handleClose,
|
|
3960
|
+
children: /* @__PURE__ */ jsxs8(
|
|
3961
|
+
"div",
|
|
3962
|
+
{
|
|
3963
|
+
className: "yudao-boards-voting-dialog",
|
|
3964
|
+
onClick: (e) => e.stopPropagation(),
|
|
3965
|
+
children: [
|
|
3966
|
+
/* @__PURE__ */ jsxs8("header", { className: "yudao-boards-mermaid-header", children: [
|
|
3967
|
+
/* @__PURE__ */ jsxs8("div", { className: "yudao-boards-mermaid-title", children: [
|
|
3968
|
+
/* @__PURE__ */ jsx8(BoardTrophyRankIcon, {}),
|
|
3969
|
+
/* @__PURE__ */ jsx8("span", { children: "\u4F1A\u8BAE\u9650\u989D\u6295\u7968\u4E0E\u5F97\u7968\u6392\u884C\u699C\u6C47\u603B\u9762\u677F" })
|
|
3970
|
+
] }),
|
|
3971
|
+
/* @__PURE__ */ jsx8(
|
|
3972
|
+
"button",
|
|
3973
|
+
{
|
|
3974
|
+
type: "button",
|
|
3975
|
+
className: "yudao-boards-btn-ghost",
|
|
3976
|
+
onClick: handleClose,
|
|
3977
|
+
children: "\u5173\u95ED"
|
|
3978
|
+
}
|
|
3979
|
+
)
|
|
3980
|
+
] }),
|
|
3981
|
+
/* @__PURE__ */ jsx8("div", { className: "yudao-boards-voting-config-bar", children: !isActive ? /* @__PURE__ */ jsxs8("div", { className: "yudao-boards-voting-setup-row", children: [
|
|
3982
|
+
/* @__PURE__ */ jsxs8("label", { className: "yudao-boards-voting-field", children: [
|
|
3983
|
+
/* @__PURE__ */ jsx8("span", { children: "\u8BAE\u9898\u540D\u79F0" }),
|
|
3984
|
+
/* @__PURE__ */ jsx8(
|
|
3985
|
+
"input",
|
|
3986
|
+
{
|
|
3987
|
+
type: "text",
|
|
3988
|
+
value: sessionTitle,
|
|
3989
|
+
onChange: (e) => setSessionTitle(e.target.value),
|
|
3990
|
+
placeholder: "\u8F93\u5165\u672C\u8F6E\u6295\u7968\u4E3B\u9898"
|
|
3991
|
+
}
|
|
3992
|
+
)
|
|
3993
|
+
] }),
|
|
3994
|
+
/* @__PURE__ */ jsxs8("div", { className: "yudao-boards-voting-field", children: [
|
|
3995
|
+
/* @__PURE__ */ jsx8("span", { children: "\u6BCF\u4EBA\u7968\u6570\u4E0A\u9650" }),
|
|
3996
|
+
/* @__PURE__ */ jsx8("div", { className: "yudao-boards-quota-pills", children: QUOTA_PRESETS.map((n) => /* @__PURE__ */ jsxs8(
|
|
3997
|
+
"button",
|
|
3998
|
+
{
|
|
3999
|
+
type: "button",
|
|
4000
|
+
"data-testid": `voting-quota-${n}`,
|
|
4001
|
+
className: `yudao-boards-preset-pill ${quota === n ? "is-selected" : ""}`,
|
|
4002
|
+
onClick: () => setQuota(n),
|
|
4003
|
+
children: [
|
|
4004
|
+
n,
|
|
4005
|
+
" \u7968"
|
|
4006
|
+
]
|
|
4007
|
+
},
|
|
4008
|
+
n
|
|
4009
|
+
)) })
|
|
4010
|
+
] }),
|
|
4011
|
+
/* @__PURE__ */ jsxs8("label", { className: "yudao-boards-voting-field", children: [
|
|
4012
|
+
/* @__PURE__ */ jsx8("span", { children: "\u9650\u5B9A\u753B\u6846" }),
|
|
4013
|
+
/* @__PURE__ */ jsxs8(
|
|
4014
|
+
"select",
|
|
4015
|
+
{
|
|
4016
|
+
value: targetFrameId,
|
|
4017
|
+
onChange: (e) => setTargetFrameId(e.target.value),
|
|
4018
|
+
"data-testid": "voting-target-frame",
|
|
4019
|
+
children: [
|
|
4020
|
+
/* @__PURE__ */ jsx8("option", { value: "", children: "\u5168\u90E8\u753B\u5E03\u4FBF\u7B7E" }),
|
|
4021
|
+
frames.map((f) => /* @__PURE__ */ jsx8("option", { value: f.id, children: f.title }, f.id))
|
|
4022
|
+
]
|
|
4023
|
+
}
|
|
4024
|
+
)
|
|
4025
|
+
] }),
|
|
4026
|
+
/* @__PURE__ */ jsxs8("label", { className: "yudao-boards-checkbox-label", children: [
|
|
4027
|
+
/* @__PURE__ */ jsx8(
|
|
4028
|
+
"input",
|
|
4029
|
+
{
|
|
4030
|
+
type: "checkbox",
|
|
4031
|
+
checked: allowMultiplePerSticky,
|
|
4032
|
+
onChange: (e) => setAllowMultiplePerSticky(e.target.checked)
|
|
4033
|
+
}
|
|
4034
|
+
),
|
|
4035
|
+
/* @__PURE__ */ jsx8("span", { children: "\u5355\u5F20\u53EF\u6295\u591A\u7968" })
|
|
4036
|
+
] }),
|
|
4037
|
+
/* @__PURE__ */ jsxs8(
|
|
4038
|
+
"button",
|
|
4039
|
+
{
|
|
4040
|
+
type: "button",
|
|
4041
|
+
className: "yudao-boards-btn-primary",
|
|
4042
|
+
"data-testid": "voting-start-btn",
|
|
4043
|
+
onClick: handleStartSession,
|
|
4044
|
+
children: [
|
|
4045
|
+
"\u5F00\u542F\u9650\u989D\u6295\u7968 (",
|
|
4046
|
+
quota,
|
|
4047
|
+
" \u7968/\u4EBA)"
|
|
4048
|
+
]
|
|
4049
|
+
}
|
|
4050
|
+
)
|
|
4051
|
+
] }) : /* @__PURE__ */ jsxs8("div", { className: "yudao-boards-voting-active-banner", "data-testid": "voting-active-banner", children: [
|
|
4052
|
+
/* @__PURE__ */ jsxs8("div", { className: "yudao-boards-voting-active-info", children: [
|
|
4053
|
+
/* @__PURE__ */ jsx8(BoardVoteThumbIcon, {}),
|
|
4054
|
+
/* @__PURE__ */ jsx8("strong", { children: session?.title }),
|
|
4055
|
+
/* @__PURE__ */ jsxs8("span", { className: "yudao-boards-quota-badge", "data-testid": "voting-remaining-badge", children: [
|
|
4056
|
+
"\u5269\u4F59\u53EF\u6295 ",
|
|
4057
|
+
remainingVotes,
|
|
4058
|
+
" / ",
|
|
4059
|
+
session?.maxVotesPerUser,
|
|
4060
|
+
" \u7968"
|
|
4061
|
+
] }),
|
|
4062
|
+
session?.targetFrameId && currentSnap.elements[session.targetFrameId] && /* @__PURE__ */ jsxs8("span", { className: "yudao-boards-tag", children: [
|
|
4063
|
+
"\u9650\u5B9A\u753B\u6846\uFF1A",
|
|
4064
|
+
currentSnap.elements[session.targetFrameId].title
|
|
4065
|
+
] })
|
|
4066
|
+
] }),
|
|
4067
|
+
/* @__PURE__ */ jsx8(
|
|
4068
|
+
"button",
|
|
4069
|
+
{
|
|
4070
|
+
type: "button",
|
|
4071
|
+
className: "yudao-boards-btn-ghost is-danger-outline",
|
|
4072
|
+
"data-testid": "voting-end-btn",
|
|
4073
|
+
onClick: handleEndSession,
|
|
4074
|
+
children: "\u7ED3\u675F\u672C\u8F6E\u6295\u7968\u5E76\u5B9A\u699C"
|
|
4075
|
+
}
|
|
4076
|
+
)
|
|
4077
|
+
] }) }),
|
|
4078
|
+
/* @__PURE__ */ jsxs8("div", { className: "yudao-boards-voting-leaderboard", "data-testid": "boards-voting-leaderboard", children: [
|
|
4079
|
+
/* @__PURE__ */ jsxs8("div", { className: "yudao-boards-pane-toolbar", children: [
|
|
4080
|
+
/* @__PURE__ */ jsxs8("span", { children: [
|
|
4081
|
+
"\u5F97\u7968\u6392\u884C\u699C\u6C47\u603B\u9762\u677F\uFF08\u5171 ",
|
|
4082
|
+
leaderboard.length,
|
|
4083
|
+
" \u5F20\u5019\u9009\u4FBF\u7B7E\uFF09"
|
|
4084
|
+
] }),
|
|
4085
|
+
/* @__PURE__ */ jsxs8("span", { children: [
|
|
4086
|
+
"\u7D2F\u8BA1\u603B\u7968\u6570\uFF1A",
|
|
4087
|
+
totalVotesCast,
|
|
4088
|
+
" \u7968"
|
|
4089
|
+
] })
|
|
4090
|
+
] }),
|
|
4091
|
+
leaderboard.length === 0 ? /* @__PURE__ */ jsx8("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__ */ jsx8("div", { className: "yudao-boards-rank-list", children: leaderboard.map((entry) => {
|
|
4092
|
+
const pal = resolveStickyPalette2(entry.color);
|
|
4093
|
+
const rawSticky = currentSnap.elements[entry.elementId];
|
|
4094
|
+
const masked = rawSticky ? isStickyMaskedForViewer2(rawSticky, currentSnap.brainstorm, currentUserId) : false;
|
|
4095
|
+
const displayText = masked ? "\u601D\u8003\u8F93\u5165\u4E2D \xB7 \u5F85\u63ED\u793A" : entry.text;
|
|
4096
|
+
const barWidthPct = entry.voteCount > 0 ? Math.max(6, Math.round(entry.voteCount / maxVoteCount * 100)) : 0;
|
|
4097
|
+
const myCountOnSticky = myVotedIds.filter((id) => id === entry.elementId).length;
|
|
4098
|
+
return /* @__PURE__ */ jsxs8(
|
|
4099
|
+
"div",
|
|
4100
|
+
{
|
|
4101
|
+
className: `yudao-boards-rank-row ${entry.rank <= 3 && entry.voteCount > 0 ? "is-top-rank" : ""}`,
|
|
4102
|
+
"data-testid": `voting-rank-row-${entry.elementId}`,
|
|
4103
|
+
children: [
|
|
4104
|
+
/* @__PURE__ */ jsxs8("div", { className: `yudao-boards-rank-num is-rank-${Math.min(4, entry.rank)}`, children: [
|
|
4105
|
+
"#",
|
|
4106
|
+
entry.rank
|
|
4107
|
+
] }),
|
|
4108
|
+
/* @__PURE__ */ jsx8(
|
|
4109
|
+
"span",
|
|
4110
|
+
{
|
|
4111
|
+
className: "yudao-boards-rank-swatch",
|
|
4112
|
+
style: { backgroundColor: pal.fill, borderColor: pal.border }
|
|
4113
|
+
}
|
|
4114
|
+
),
|
|
4115
|
+
/* @__PURE__ */ jsxs8("div", { className: "yudao-boards-rank-main", children: [
|
|
4116
|
+
/* @__PURE__ */ jsxs8("div", { className: "yudao-boards-rank-title-line", children: [
|
|
4117
|
+
/* @__PURE__ */ jsx8("span", { className: "yudao-boards-rank-text", children: displayText }),
|
|
4118
|
+
entry.frameTitle && /* @__PURE__ */ jsx8("span", { className: "yudao-boards-rank-frame-tag", children: entry.frameTitle })
|
|
4119
|
+
] }),
|
|
4120
|
+
/* @__PURE__ */ jsx8("div", { className: "yudao-boards-rank-bar-track", children: /* @__PURE__ */ jsx8(
|
|
4121
|
+
"div",
|
|
4122
|
+
{
|
|
4123
|
+
className: "yudao-boards-rank-bar-fill",
|
|
4124
|
+
style: { width: `${barWidthPct}%` }
|
|
4125
|
+
}
|
|
4126
|
+
) })
|
|
4127
|
+
] }),
|
|
4128
|
+
/* @__PURE__ */ jsxs8("div", { className: "yudao-boards-rank-score", children: [
|
|
4129
|
+
/* @__PURE__ */ jsx8("strong", { children: entry.voteCount }),
|
|
4130
|
+
/* @__PURE__ */ jsx8("span", { children: "\u7968" })
|
|
4131
|
+
] }),
|
|
4132
|
+
/* @__PURE__ */ jsxs8("div", { className: "yudao-boards-rank-actions", children: [
|
|
4133
|
+
isActive && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
4134
|
+
/* @__PURE__ */ jsx8(
|
|
4135
|
+
"button",
|
|
4136
|
+
{
|
|
4137
|
+
type: "button",
|
|
4138
|
+
className: "yudao-boards-mini-btn is-primary",
|
|
4139
|
+
disabled: remainingVotes <= 0,
|
|
4140
|
+
"data-testid": `voting-cast-${entry.elementId}`,
|
|
4141
|
+
onClick: () => handleCastVote(entry.elementId, false),
|
|
4142
|
+
children: "+1 \u6295\u7968"
|
|
4143
|
+
}
|
|
4144
|
+
),
|
|
4145
|
+
myCountOnSticky > 0 && /* @__PURE__ */ jsxs8(
|
|
4146
|
+
"button",
|
|
4147
|
+
{
|
|
4148
|
+
type: "button",
|
|
4149
|
+
className: "yudao-boards-mini-btn",
|
|
4150
|
+
"data-testid": `voting-unvote-${entry.elementId}`,
|
|
4151
|
+
onClick: () => handleCastVote(entry.elementId, true),
|
|
4152
|
+
children: [
|
|
4153
|
+
"\u64A4\u56DE (",
|
|
4154
|
+
myCountOnSticky,
|
|
4155
|
+
")"
|
|
4156
|
+
]
|
|
4157
|
+
}
|
|
4158
|
+
)
|
|
4159
|
+
] }),
|
|
4160
|
+
/* @__PURE__ */ jsx8(
|
|
4161
|
+
"button",
|
|
4162
|
+
{
|
|
4163
|
+
type: "button",
|
|
4164
|
+
className: "yudao-boards-mini-btn",
|
|
4165
|
+
"data-testid": `voting-pan-${entry.elementId}`,
|
|
4166
|
+
onClick: () => handlePanToSticky(entry.elementId),
|
|
4167
|
+
children: "\u5B9A\u4F4D\u4FBF\u7B7E"
|
|
4168
|
+
}
|
|
4169
|
+
)
|
|
4170
|
+
] })
|
|
4171
|
+
]
|
|
4172
|
+
},
|
|
4173
|
+
entry.elementId
|
|
4174
|
+
);
|
|
4175
|
+
}) })
|
|
4176
|
+
] })
|
|
4177
|
+
]
|
|
4178
|
+
}
|
|
4179
|
+
)
|
|
4180
|
+
}
|
|
4181
|
+
);
|
|
4182
|
+
};
|
|
4183
|
+
|
|
3356
4184
|
// src/views/modals/BoardsModalsHost.tsx
|
|
3357
|
-
import { jsx as
|
|
4185
|
+
import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3358
4186
|
var BoardsModalsHost = () => {
|
|
3359
|
-
return /* @__PURE__ */
|
|
4187
|
+
return /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
4188
|
+
/* @__PURE__ */ jsx9(BoardsMermaidModal, {}),
|
|
4189
|
+
/* @__PURE__ */ jsx9(BoardsVotingModal, {}),
|
|
4190
|
+
/* @__PURE__ */ jsx9(BoardsDocImportModal, {})
|
|
4191
|
+
] });
|
|
3360
4192
|
};
|
|
3361
4193
|
|
|
3362
4194
|
// src/controllers/menu.schema.ts
|
|
@@ -3369,7 +4201,7 @@ import {
|
|
|
3369
4201
|
} from "@univerjs/ui";
|
|
3370
4202
|
import {
|
|
3371
4203
|
AddBoardElementsCommand as AddBoardElementsCommand3,
|
|
3372
|
-
IBoardSelectionService as
|
|
4204
|
+
IBoardSelectionService as IBoardSelectionService9
|
|
3373
4205
|
} from "@yudaocode/univer-boards";
|
|
3374
4206
|
import { map } from "rxjs";
|
|
3375
4207
|
var BOARDS_RIBBON_TAB = "ribbon.boards";
|
|
@@ -3399,7 +4231,7 @@ function makeSimpleMenuBtn(config) {
|
|
|
3399
4231
|
});
|
|
3400
4232
|
}
|
|
3401
4233
|
var BoardSelectToolMenuFactory = (accessor) => {
|
|
3402
|
-
const sel = accessor.get(
|
|
4234
|
+
const sel = accessor.get(IBoardSelectionService9);
|
|
3403
4235
|
return {
|
|
3404
4236
|
id: "boards-ui.menu.tool-select",
|
|
3405
4237
|
commandId: SetBoardToolOperation.id,
|
|
@@ -3412,7 +4244,7 @@ var BoardSelectToolMenuFactory = (accessor) => {
|
|
|
3412
4244
|
};
|
|
3413
4245
|
};
|
|
3414
4246
|
var BoardHandToolMenuFactory = (accessor) => {
|
|
3415
|
-
const sel = accessor.get(
|
|
4247
|
+
const sel = accessor.get(IBoardSelectionService9);
|
|
3416
4248
|
return {
|
|
3417
4249
|
id: "boards-ui.menu.tool-hand",
|
|
3418
4250
|
commandId: SetBoardToolOperation.id,
|
|
@@ -3622,6 +4454,8 @@ var BoardsUIController = class extends Disposable {
|
|
|
3622
4454
|
const ops = [
|
|
3623
4455
|
ToggleBoardInspectorOperation,
|
|
3624
4456
|
OpenBoardMermaidModalOperation,
|
|
4457
|
+
OpenBoardVotingModalOperation,
|
|
4458
|
+
OpenBoardDocImportModalOperation,
|
|
3625
4459
|
SetBoardToolOperation,
|
|
3626
4460
|
StartBoardPresentationOperation,
|
|
3627
4461
|
FitBoardToScreenOperation,
|
|
@@ -3651,7 +4485,7 @@ var BoardsUIController = class extends Disposable {
|
|
|
3651
4485
|
}
|
|
3652
4486
|
};
|
|
3653
4487
|
BoardsUIController = __decorateClass([
|
|
3654
|
-
__decorateParam(1,
|
|
4488
|
+
__decorateParam(1, ICommandService9),
|
|
3655
4489
|
__decorateParam(2, IMenuManagerService),
|
|
3656
4490
|
__decorateParam(3, IUIPartsService),
|
|
3657
4491
|
__decorateParam(4, ISidebarService2),
|
|
@@ -3667,7 +4501,7 @@ import {
|
|
|
3667
4501
|
LocaleService,
|
|
3668
4502
|
LocaleType,
|
|
3669
4503
|
Plugin,
|
|
3670
|
-
UniverInstanceType as
|
|
4504
|
+
UniverInstanceType as UniverInstanceType9
|
|
3671
4505
|
} from "@univerjs/core";
|
|
3672
4506
|
import { UniverRenderEnginePlugin } from "@univerjs/engine-render";
|
|
3673
4507
|
import { UniverBoardsPlugin } from "@yudaocode/univer-boards";
|
|
@@ -3696,20 +4530,21 @@ var UniverBoardsUIPlugin = class extends Plugin {
|
|
|
3696
4530
|
};
|
|
3697
4531
|
UniverBoardsUIPlugin.pluginName = UNIVER_BOARDS_UI_PLUGIN_NAME;
|
|
3698
4532
|
UniverBoardsUIPlugin.packageName = "@yudaocode/univer-boards-ui";
|
|
3699
|
-
UniverBoardsUIPlugin.type =
|
|
4533
|
+
UniverBoardsUIPlugin.type = UniverInstanceType9.UNIVER_BOARD;
|
|
3700
4534
|
UniverBoardsUIPlugin = __decorateClass([
|
|
3701
4535
|
DependentOn(UniverRenderEnginePlugin, UniverBoardsPlugin),
|
|
3702
4536
|
__decorateParam(1, Inject2(Injector))
|
|
3703
4537
|
], UniverBoardsUIPlugin);
|
|
3704
4538
|
|
|
3705
4539
|
// src/index.ts
|
|
3706
|
-
var VERSION = "1.6.
|
|
4540
|
+
var VERSION = "1.6.219";
|
|
3707
4541
|
export {
|
|
3708
4542
|
BOARDS_RIBBON_GROUP,
|
|
3709
4543
|
BOARDS_RIBBON_TAB,
|
|
3710
4544
|
BOARD_ICON_MAP,
|
|
3711
4545
|
BOARD_INSPECTOR_COMPONENT_KEY,
|
|
3712
4546
|
BOARD_INSPECTOR_SIDEBAR_ID,
|
|
4547
|
+
BoardsDocImportModal,
|
|
3713
4548
|
BoardsInfiniteCanvas,
|
|
3714
4549
|
BoardsInspectorPanel,
|
|
3715
4550
|
BoardsLeftSidebar,
|
|
@@ -3717,9 +4552,12 @@ export {
|
|
|
3717
4552
|
BoardsModalsHost,
|
|
3718
4553
|
BoardsStatusBar,
|
|
3719
4554
|
BoardsUIController,
|
|
4555
|
+
BoardsVotingModal,
|
|
3720
4556
|
ExportBoardFileOperation,
|
|
3721
4557
|
FitBoardToScreenOperation,
|
|
4558
|
+
OpenBoardDocImportModalOperation,
|
|
3722
4559
|
OpenBoardMermaidModalOperation,
|
|
4560
|
+
OpenBoardVotingModalOperation,
|
|
3723
4561
|
SetBoardToolOperation,
|
|
3724
4562
|
StartBoardPresentationOperation,
|
|
3725
4563
|
ToggleBoardInspectorOperation,
|