@yudaocode/univer-boards-ui 0.0.0-stage → 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/LICENSE +190 -0
- package/README.md +36 -2
- package/lib/cjs/index.js +4596 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/locale/en-US.js +62 -0
- package/lib/cjs/locale/en-US.js.map +1 -0
- package/lib/cjs/locale/zh-CN.js +62 -0
- package/lib/cjs/locale/zh-CN.js.map +1 -0
- package/lib/es/chunk-BRKEJJFQ.js +17 -0
- package/lib/es/chunk-BRKEJJFQ.js.map +1 -0
- package/lib/es/chunk-SILY2PSY.js +42 -0
- package/lib/es/chunk-SILY2PSY.js.map +1 -0
- package/lib/es/chunk-TCNVAOGG.js +42 -0
- package/lib/es/chunk-TCNVAOGG.js.map +1 -0
- package/lib/es/index.js +4573 -0
- package/lib/es/index.js.map +1 -0
- package/lib/es/locale/en-US.js +8 -0
- package/lib/es/locale/en-US.js.map +1 -0
- package/lib/es/locale/zh-CN.js +8 -0
- package/lib/es/locale/zh-CN.js.map +1 -0
- package/lib/index.css +1465 -0
- package/lib/types/index.d.ts +105 -0
- package/lib/types/locale/en-US.d.ts +37 -0
- package/lib/types/locale/zh-CN.d.ts +37 -0
- package/package.json +79 -3
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,4596 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
20
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
21
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22
|
+
if (decorator = decorators[i])
|
|
23
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
24
|
+
if (kind && result) __defProp(target, key, result);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
28
|
+
|
|
29
|
+
// src/index.ts
|
|
30
|
+
var src_exports = {};
|
|
31
|
+
__export(src_exports, {
|
|
32
|
+
BOARDS_RIBBON_GROUP: () => BOARDS_RIBBON_GROUP,
|
|
33
|
+
BOARDS_RIBBON_TAB: () => BOARDS_RIBBON_TAB,
|
|
34
|
+
BOARD_ICON_MAP: () => BOARD_ICON_MAP,
|
|
35
|
+
BOARD_INSPECTOR_COMPONENT_KEY: () => BOARD_INSPECTOR_COMPONENT_KEY,
|
|
36
|
+
BOARD_INSPECTOR_SIDEBAR_ID: () => BOARD_INSPECTOR_SIDEBAR_ID,
|
|
37
|
+
BoardsDocImportModal: () => BoardsDocImportModal,
|
|
38
|
+
BoardsInfiniteCanvas: () => BoardsInfiniteCanvas,
|
|
39
|
+
BoardsInspectorPanel: () => BoardsInspectorPanel,
|
|
40
|
+
BoardsLeftSidebar: () => BoardsLeftSidebar,
|
|
41
|
+
BoardsMermaidModal: () => BoardsMermaidModal,
|
|
42
|
+
BoardsModalsHost: () => BoardsModalsHost,
|
|
43
|
+
BoardsStatusBar: () => BoardsStatusBar,
|
|
44
|
+
BoardsUIController: () => BoardsUIController,
|
|
45
|
+
BoardsVotingModal: () => BoardsVotingModal,
|
|
46
|
+
ExportBoardFileOperation: () => ExportBoardFileOperation,
|
|
47
|
+
FitBoardToScreenOperation: () => FitBoardToScreenOperation,
|
|
48
|
+
OpenBoardDocImportModalOperation: () => OpenBoardDocImportModalOperation,
|
|
49
|
+
OpenBoardMermaidModalOperation: () => OpenBoardMermaidModalOperation,
|
|
50
|
+
OpenBoardVotingModalOperation: () => OpenBoardVotingModalOperation,
|
|
51
|
+
SetBoardToolOperation: () => SetBoardToolOperation,
|
|
52
|
+
StartBoardPresentationOperation: () => StartBoardPresentationOperation,
|
|
53
|
+
ToggleBoardInspectorOperation: () => ToggleBoardInspectorOperation,
|
|
54
|
+
UNIVER_BOARDS_UI_PLUGIN_NAME: () => UNIVER_BOARDS_UI_PLUGIN_NAME,
|
|
55
|
+
UniverBoardsUIPlugin: () => UniverBoardsUIPlugin,
|
|
56
|
+
VERSION: () => VERSION,
|
|
57
|
+
boardsMenuSchema: () => boardsMenuSchema,
|
|
58
|
+
boardsRootMenuExtension: () => boardsRootMenuExtension,
|
|
59
|
+
enUS: () => en_US_default,
|
|
60
|
+
openBoardInspectorSidebar: () => openBoardInspectorSidebar,
|
|
61
|
+
zhCN: () => zh_CN_default
|
|
62
|
+
});
|
|
63
|
+
module.exports = __toCommonJS(src_exports);
|
|
64
|
+
|
|
65
|
+
// src/controllers/boards-ui.controller.ts
|
|
66
|
+
var import_core9 = require("@univerjs/core");
|
|
67
|
+
var import_ui10 = require("@univerjs/ui");
|
|
68
|
+
|
|
69
|
+
// src/icons/board-icons.tsx
|
|
70
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
71
|
+
function createSvgIcon(children) {
|
|
72
|
+
return ({ className, style, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
+
"svg",
|
|
74
|
+
{
|
|
75
|
+
viewBox: "0 0 16 16",
|
|
76
|
+
width: "16",
|
|
77
|
+
height: "16",
|
|
78
|
+
fill: "none",
|
|
79
|
+
stroke: "currentColor",
|
|
80
|
+
strokeWidth: "1.4",
|
|
81
|
+
strokeLinecap: "round",
|
|
82
|
+
strokeLinejoin: "round",
|
|
83
|
+
className,
|
|
84
|
+
style: { display: "inline-block", verticalAlign: "middle", flexShrink: 0, ...style },
|
|
85
|
+
onClick,
|
|
86
|
+
children
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
var BoardSelectIcon = createSvgIcon(
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3.8 2.2L12.6 8.4L8.2 9.2L9.8 13.4L7.8 14.2L6.2 10L3.8 12.2V2.2Z" })
|
|
92
|
+
);
|
|
93
|
+
var BoardHandIcon = createSvgIcon(
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.2 7.5V3.5C6.2 2.9 6.6 2.5 7.1 2.5C7.6 2.5 8 2.9 8 3.5V7M8 3.2C8 2.7 8.4 2.2 8.9 2.2C9.4 2.2 9.8 2.7 9.8 3.2V7M9.8 3.8C9.8 3.3 10.2 2.9 10.7 2.9C11.2 2.9 11.6 3.3 11.6 3.8V8.2M11.6 5.2C12.1 5.2 12.5 5.6 12.5 6.1V10C12.5 12.2 10.8 13.8 8.6 13.8H7.4C5.6 13.8 4.4 12.7 3.7 11.2L2.8 9.2C2.5 8.6 2.8 8 3.4 7.8C4 7.6 4.6 7.9 5 8.5L5.8 9.6V4.5" })
|
|
95
|
+
);
|
|
96
|
+
var BoardFrameIcon = createSvgIcon(
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2 5H14M2 11H14M5 2V14M11 2V14" }) })
|
|
98
|
+
);
|
|
99
|
+
var BoardSwimlaneIcon = createSvgIcon(
|
|
100
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4" }),
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2 6H14M6 6V13.5M10 6V13.5" })
|
|
103
|
+
] })
|
|
104
|
+
);
|
|
105
|
+
var BoardStickyIcon = createSvgIcon(
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 2.5H13V10.5L10 13.5H3V2.5Z" }),
|
|
108
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 13.5V10.5H13" }),
|
|
109
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.2 6H10.8M5.2 8.6H8.6" })
|
|
110
|
+
] })
|
|
111
|
+
);
|
|
112
|
+
var BoardShapeIcon = createSvgIcon(
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2.2", y: "2.8", width: "7.5", height: "6.8", rx: "1.2" }),
|
|
115
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "10.8", cy: "10.4", r: "3" })
|
|
116
|
+
] })
|
|
117
|
+
);
|
|
118
|
+
var BoardConnectorIcon = createSvgIcon(
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "3.5", cy: "4", r: "1.5" }),
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12.5", cy: "12", r: "1.5" }),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 4H8.5V12H11" })
|
|
123
|
+
] })
|
|
124
|
+
);
|
|
125
|
+
var BoardInkIcon = createSvgIcon(
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M11.2 2.4L13.6 4.8L6.2 12.2L2.8 13.2L3.8 9.8L11.2 2.4Z" }),
|
|
128
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 14.3C5.2 13.6 7.8 14.7 11.2 13.7" })
|
|
129
|
+
] })
|
|
130
|
+
);
|
|
131
|
+
var BoardMindmapIcon = createSvgIcon(
|
|
132
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "6.2", width: "4.4", height: "3.6", rx: "1" }),
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "9.8", y: "2.5", width: "4.2", height: "3", rx: "0.8" }),
|
|
135
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "9.8", y: "10.5", width: "4.2", height: "3", rx: "0.8" }),
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.4 8C8 8 8 4 9.8 4M6.4 8C8 8 8 12 9.8 12" })
|
|
137
|
+
] })
|
|
138
|
+
);
|
|
139
|
+
var BoardEntityCardIcon = createSvgIcon(
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
141
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2.2", y: "2.2", width: "11.6", height: "11.6", rx: "1.5" }),
|
|
142
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.2 5.6H13.8M4.8 8.2H11.2M4.8 10.8H9.5" })
|
|
143
|
+
] })
|
|
144
|
+
);
|
|
145
|
+
var BoardChartTableIcon = createSvgIcon(
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
147
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4" }),
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.2 11V7.5M8 11V5.2M10.8 11V8.5" })
|
|
149
|
+
] })
|
|
150
|
+
);
|
|
151
|
+
var BoardCommentIcon = createSvgIcon(
|
|
152
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 3H13C13.6 3 14 3.4 14 4V10C14 10.6 13.6 11 13 11H6.5L3.2 13.6V11H3C2.4 11 2 10.6 2 10V4C2 3.4 2.4 3 3 3Z" })
|
|
153
|
+
);
|
|
154
|
+
var BoardMermaidIcon = createSvgIcon(
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
156
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4.8 4.5L2.2 8L4.8 11.5M11.2 4.5L13.8 8L11.2 11.5" }),
|
|
157
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8.8 3.2L7.2 12.8" })
|
|
158
|
+
] })
|
|
159
|
+
);
|
|
160
|
+
var BoardPlayTourIcon = createSvgIcon(
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("polygon", { points: "4.5,3 13,8 4.5,13" })
|
|
162
|
+
);
|
|
163
|
+
var BoardLaserIcon = createSvgIcon(
|
|
164
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
165
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "5", cy: "5", r: "2" }),
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.6 6.6L13.5 13.5M5 1.8V2.6M1.8 5H2.6M8.2 5H7.4M5 8.2V7.4" })
|
|
167
|
+
] })
|
|
168
|
+
);
|
|
169
|
+
var BoardTimerIcon = createSvgIcon(
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
171
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8.8", r: "5" }),
|
|
172
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.2 2.2H9.8M8 6.2V8.8L9.8 10" })
|
|
173
|
+
] })
|
|
174
|
+
);
|
|
175
|
+
var BoardDownloadIcon = createSvgIcon(
|
|
176
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 2.5V10.5M8 10.5L5.2 7.7M8 10.5L10.8 7.7M2.5 11.5V13C2.5 13.4 2.9 13.8 3.4 13.8H12.6C13.1 13.8 13.5 13.4 13.5 13V11.5" })
|
|
177
|
+
);
|
|
178
|
+
var BoardInspectorIcon = createSvgIcon(
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
180
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4" }),
|
|
181
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 2.5V13.5M4.5 6H7.8M4.5 8.8H7.8" })
|
|
182
|
+
] })
|
|
183
|
+
);
|
|
184
|
+
var BoardFitScreenIcon = createSvgIcon(
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 5.8V2.8H5.5M10.5 2.8H13.5V5.8M13.5 10.2V13.2H10.5M5.5 13.2H2.5V10.2" })
|
|
186
|
+
);
|
|
187
|
+
var BoardVoteThumbIcon = createSvgIcon(
|
|
188
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.5 7.5L7.8 2.8C8.4 2.8 9 3.3 9 4V6.2H12.2C12.8 6.2 13.2 6.7 13.1 7.3L12.2 12.2C12.1 12.7 11.6 13.2 11 13.2H5.5V7.5ZM5.5 7.5H3.2V13.2H5.5" })
|
|
189
|
+
);
|
|
190
|
+
var BoardPlusIcon = createSvgIcon(
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 3.2V12.8M3.2 8H12.8" })
|
|
192
|
+
);
|
|
193
|
+
var BoardTrashIcon = createSvgIcon(
|
|
194
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 4.5H13M6 4.5V3H10V4.5M4.5 4.5L5.2 13.2H10.8L11.5 4.5" })
|
|
195
|
+
);
|
|
196
|
+
var BoardAlignLeftIcon = createSvgIcon(
|
|
197
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 2.5V13.5M5 5.2H12.5M5 8.2H10M5 11.2H13.5" })
|
|
198
|
+
);
|
|
199
|
+
var BoardAlignCenterIcon = createSvgIcon(
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 2.2V13.8M3.5 5.2H12.5M5 8.2H11M3 11.2H13" })
|
|
201
|
+
);
|
|
202
|
+
var BoardAlignRightIcon = createSvgIcon(
|
|
203
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13.5 2.5V13.5M3.5 5.2H11M6 8.2H11M2.5 11.2H11" })
|
|
204
|
+
);
|
|
205
|
+
var BoardGridIcon = createSvgIcon(
|
|
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" })
|
|
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
|
+
);
|
|
249
|
+
var BOARD_ICON_MAP = {
|
|
250
|
+
BoardSelectIcon,
|
|
251
|
+
BoardHandIcon,
|
|
252
|
+
BoardFrameIcon,
|
|
253
|
+
BoardSwimlaneIcon,
|
|
254
|
+
BoardStickyIcon,
|
|
255
|
+
BoardShapeIcon,
|
|
256
|
+
BoardConnectorIcon,
|
|
257
|
+
BoardInkIcon,
|
|
258
|
+
BoardMindmapIcon,
|
|
259
|
+
BoardEntityCardIcon,
|
|
260
|
+
BoardChartTableIcon,
|
|
261
|
+
BoardCommentIcon,
|
|
262
|
+
BoardMermaidIcon,
|
|
263
|
+
BoardPlayTourIcon,
|
|
264
|
+
BoardLaserIcon,
|
|
265
|
+
BoardTimerIcon,
|
|
266
|
+
BoardDownloadIcon,
|
|
267
|
+
BoardInspectorIcon,
|
|
268
|
+
BoardFitScreenIcon,
|
|
269
|
+
BoardVoteThumbIcon,
|
|
270
|
+
BoardPlusIcon,
|
|
271
|
+
BoardTrashIcon,
|
|
272
|
+
BoardAlignLeftIcon,
|
|
273
|
+
BoardAlignCenterIcon,
|
|
274
|
+
BoardAlignRightIcon,
|
|
275
|
+
BoardGridIcon,
|
|
276
|
+
BoardEyeOffIcon,
|
|
277
|
+
BoardEyeRevealIcon,
|
|
278
|
+
BoardSpotlightIcon,
|
|
279
|
+
BoardFollowIcon,
|
|
280
|
+
BoardTrophyRankIcon,
|
|
281
|
+
BoardDocUploadIcon
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// src/operations/board-ui.operation.ts
|
|
285
|
+
var import_core = require("@univerjs/core");
|
|
286
|
+
var import_ui = require("@univerjs/ui");
|
|
287
|
+
var import_univer_boards = require("@yudaocode/univer-boards");
|
|
288
|
+
var BOARD_INSPECTOR_SIDEBAR_ID = "univer.boards.inspector.sidebar";
|
|
289
|
+
var BOARD_INSPECTOR_COMPONENT_KEY = "univer.boards.inspector.component";
|
|
290
|
+
function openBoardInspectorSidebar(sidebarService) {
|
|
291
|
+
sidebarService.open({
|
|
292
|
+
id: BOARD_INSPECTOR_SIDEBAR_ID,
|
|
293
|
+
header: { title: "boards.sidebar.inspectorTitle" },
|
|
294
|
+
children: { label: BOARD_INSPECTOR_COMPONENT_KEY },
|
|
295
|
+
width: 328
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
var ToggleBoardInspectorOperation = {
|
|
299
|
+
id: "boards-ui.operation.toggle-inspector",
|
|
300
|
+
type: import_core.CommandType.OPERATION,
|
|
301
|
+
handler: (accessor) => {
|
|
302
|
+
const sidebarService = accessor.get(import_ui.ISidebarService);
|
|
303
|
+
if (sidebarService.visible && sidebarService.options?.id === BOARD_INSPECTOR_SIDEBAR_ID) {
|
|
304
|
+
sidebarService.close(BOARD_INSPECTOR_SIDEBAR_ID);
|
|
305
|
+
} else {
|
|
306
|
+
openBoardInspectorSidebar(sidebarService);
|
|
307
|
+
}
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
var OpenBoardMermaidModalOperation = {
|
|
312
|
+
id: "boards-ui.operation.open-mermaid-modal",
|
|
313
|
+
type: import_core.CommandType.OPERATION,
|
|
314
|
+
handler: (accessor, params) => {
|
|
315
|
+
const selService = accessor.get(import_univer_boards.IBoardSelectionService);
|
|
316
|
+
selService.setMermaidModalOpen(params?.open ?? true);
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
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
|
+
};
|
|
338
|
+
var SetBoardToolOperation = {
|
|
339
|
+
id: "boards-ui.operation.set-tool",
|
|
340
|
+
type: import_core.CommandType.OPERATION,
|
|
341
|
+
handler: (accessor, params) => {
|
|
342
|
+
if (!params?.tool) return false;
|
|
343
|
+
accessor.get(import_univer_boards.IBoardSelectionService).setActiveTool(params.tool);
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
var StartBoardPresentationOperation = {
|
|
348
|
+
id: "boards-ui.operation.toggle-presentation",
|
|
349
|
+
type: import_core.CommandType.OPERATION,
|
|
350
|
+
handler: (accessor, params) => {
|
|
351
|
+
const sel = accessor.get(import_univer_boards.IBoardSelectionService);
|
|
352
|
+
const current = sel.getPresentationState();
|
|
353
|
+
const nextActive = params?.active ?? !current.active;
|
|
354
|
+
const nextIndex = params?.frameIndex ?? 0;
|
|
355
|
+
sel.setPresentationState({
|
|
356
|
+
active: nextActive,
|
|
357
|
+
frameIndex: nextIndex,
|
|
358
|
+
laserActive: nextActive ? current.laserActive : false
|
|
359
|
+
});
|
|
360
|
+
if (nextActive) {
|
|
361
|
+
const instanceService = accessor.get(import_core.IUniverInstanceService);
|
|
362
|
+
const unit = instanceService.getCurrentUnitOfType(
|
|
363
|
+
import_core.UniverInstanceType.UNIVER_BOARD
|
|
364
|
+
);
|
|
365
|
+
const frames = unit?.getFramesOrdered() ?? [];
|
|
366
|
+
const targetFrame = frames[nextIndex];
|
|
367
|
+
if (unit && targetFrame) {
|
|
368
|
+
const stageW = 1080;
|
|
369
|
+
const stageH = 680;
|
|
370
|
+
const zoom = Math.max(
|
|
371
|
+
0.25,
|
|
372
|
+
Math.min(2, Math.min((stageW - 96) / targetFrame.width, (stageH - 96) / targetFrame.height))
|
|
373
|
+
);
|
|
374
|
+
const panX = Math.round((stageW - targetFrame.width * zoom) / 2 - targetFrame.x * zoom);
|
|
375
|
+
const panY = Math.round((stageH - targetFrame.height * zoom) / 2 - targetFrame.y * zoom);
|
|
376
|
+
accessor.get(import_core.ICommandService).syncExecuteCommand(import_univer_boards.SetBoardViewportCommand.id, {
|
|
377
|
+
unitId: unit.getUnitId(),
|
|
378
|
+
viewport: { panX, panY, zoom: Number(zoom.toFixed(2)) }
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
var FitBoardToScreenOperation = {
|
|
386
|
+
id: "boards-ui.operation.fit-screen",
|
|
387
|
+
type: import_core.CommandType.OPERATION,
|
|
388
|
+
handler: (accessor, params) => {
|
|
389
|
+
const instanceService = accessor.get(import_core.IUniverInstanceService);
|
|
390
|
+
const unit = instanceService.getCurrentUnitOfType(
|
|
391
|
+
import_core.UniverInstanceType.UNIVER_BOARD
|
|
392
|
+
);
|
|
393
|
+
if (!unit) return false;
|
|
394
|
+
const snap = unit.getSnapshot();
|
|
395
|
+
const bounds = (0, import_univer_boards.computeBoardBounds)(snap, void 0, 48);
|
|
396
|
+
const stageW = params?.stageWidth ?? 1120;
|
|
397
|
+
const stageH = params?.stageHeight ?? 700;
|
|
398
|
+
const zoom = Math.max(
|
|
399
|
+
0.15,
|
|
400
|
+
Math.min(1.5, Math.min(stageW / bounds.width, stageH / bounds.height))
|
|
401
|
+
);
|
|
402
|
+
const panX = Math.round((stageW - bounds.width * zoom) / 2 - bounds.x * zoom);
|
|
403
|
+
const panY = Math.round((stageH - bounds.height * zoom) / 2 - bounds.y * zoom);
|
|
404
|
+
return accessor.get(import_core.ICommandService).syncExecuteCommand(import_univer_boards.SetBoardViewportCommand.id, {
|
|
405
|
+
unitId: unit.getUnitId(),
|
|
406
|
+
viewport: { panX, panY, zoom: Number(zoom.toFixed(2)) }
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
function triggerBrowserDownload(content, fileName, mimeType) {
|
|
411
|
+
if (typeof document === "undefined" || typeof URL === "undefined") return;
|
|
412
|
+
const blobPart = typeof content === "string" ? content : content.slice().buffer;
|
|
413
|
+
const blob = new Blob([blobPart], { type: mimeType });
|
|
414
|
+
const url = URL.createObjectURL(blob);
|
|
415
|
+
const anchor = document.createElement("a");
|
|
416
|
+
anchor.href = url;
|
|
417
|
+
anchor.download = fileName;
|
|
418
|
+
document.body.appendChild(anchor);
|
|
419
|
+
anchor.click();
|
|
420
|
+
document.body.removeChild(anchor);
|
|
421
|
+
setTimeout(() => URL.revokeObjectURL(url), 1500);
|
|
422
|
+
}
|
|
423
|
+
var ExportBoardFileOperation = {
|
|
424
|
+
id: "boards-ui.operation.export-file",
|
|
425
|
+
type: import_core.CommandType.OPERATION,
|
|
426
|
+
handler: async (accessor, params) => {
|
|
427
|
+
const format = params?.format ?? "svg";
|
|
428
|
+
const instanceService = accessor.get(import_core.IUniverInstanceService);
|
|
429
|
+
const unit = instanceService.getCurrentUnitOfType(
|
|
430
|
+
import_core.UniverInstanceType.UNIVER_BOARD
|
|
431
|
+
);
|
|
432
|
+
if (!unit) return false;
|
|
433
|
+
const ioService = accessor.get(import_univer_boards.IBoardIoService);
|
|
434
|
+
const snap = unit.save();
|
|
435
|
+
const safeBaseName = (snap.name || "univer-board").replace(/[\\/:*?"<>|]/g, "_");
|
|
436
|
+
if (format === "svg") {
|
|
437
|
+
const svg = ioService.exportSvg(snap);
|
|
438
|
+
triggerBrowserDownload(svg, `${safeBaseName}.svg`, "image/svg+xml;charset=utf-8");
|
|
439
|
+
return true;
|
|
440
|
+
}
|
|
441
|
+
if (format === "csv") {
|
|
442
|
+
const csv = ioService.exportCsv(snap);
|
|
443
|
+
triggerBrowserDownload(csv, `${safeBaseName}.csv`, "text/csv;charset=utf-8");
|
|
444
|
+
return true;
|
|
445
|
+
}
|
|
446
|
+
if (format === "pptx") {
|
|
447
|
+
const pptx = ioService.exportPptx(snap);
|
|
448
|
+
triggerBrowserDownload(
|
|
449
|
+
pptx,
|
|
450
|
+
`${safeBaseName}.pptx`,
|
|
451
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
452
|
+
);
|
|
453
|
+
return true;
|
|
454
|
+
}
|
|
455
|
+
if (format === "pdf") {
|
|
456
|
+
const pdfBytes = await ioService.exportPdf(snap, {
|
|
457
|
+
mode: params?.pdfMode ?? (snap.frameOrder.length > 0 ? "frames" : "full")
|
|
458
|
+
});
|
|
459
|
+
triggerBrowserDownload(pdfBytes, `${safeBaseName}.pdf`, "application/pdf");
|
|
460
|
+
return true;
|
|
461
|
+
}
|
|
462
|
+
if (format === "png") {
|
|
463
|
+
const dataUrl = await ioService.exportRasterDataUrl(snap, "png", 2);
|
|
464
|
+
if (typeof document !== "undefined") {
|
|
465
|
+
const anchor = document.createElement("a");
|
|
466
|
+
anchor.href = dataUrl;
|
|
467
|
+
anchor.download = `${safeBaseName}.png`;
|
|
468
|
+
document.body.appendChild(anchor);
|
|
469
|
+
anchor.click();
|
|
470
|
+
document.body.removeChild(anchor);
|
|
471
|
+
}
|
|
472
|
+
return true;
|
|
473
|
+
}
|
|
474
|
+
return false;
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
// src/views/canvas/BoardsInfiniteCanvas.tsx
|
|
479
|
+
var import_core2 = require("@univerjs/core");
|
|
480
|
+
var import_ui2 = require("@univerjs/ui");
|
|
481
|
+
var import_univer_boards2 = require("@yudaocode/univer-boards");
|
|
482
|
+
var import_react = require("react");
|
|
483
|
+
var import_rxjs = require("rxjs");
|
|
484
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
485
|
+
var RESIZE_HANDLES = ["nw", "n", "ne", "e", "se", "s", "sw", "w"];
|
|
486
|
+
var PORT_SIDES = ["top", "right", "bottom", "left"];
|
|
487
|
+
var QUICK_SHAPES = [
|
|
488
|
+
{ type: "roundRect", label: "\u5706\u89D2\u8282\u70B9" },
|
|
489
|
+
{ type: "rect", label: "\u77E9\u5F62\u6A21\u5757" },
|
|
490
|
+
{ type: "diamond", label: "\u6761\u4EF6\u83F1\u5F62" },
|
|
491
|
+
{ type: "cylinder", label: "\u5B58\u50A8\u6570\u636E\u5E93" },
|
|
492
|
+
{ type: "hexagon", label: "\u7F51\u5173\u516D\u8FB9\u5F62" },
|
|
493
|
+
{ type: "ellipse", label: "\u8D77\u6B62\u692D\u5706" },
|
|
494
|
+
{ type: "parallelogram", label: "\u8F93\u5165\u8F93\u51FA" },
|
|
495
|
+
{ type: "cloud", label: "\u5916\u90E8\u4E91\u670D\u52A1" },
|
|
496
|
+
{ type: "document", label: "\u5355\u636E\u6587\u6863" },
|
|
497
|
+
{ type: "actor", label: "\u4E1A\u52A1\u89D2\u8272" },
|
|
498
|
+
{ type: "callout", label: "\u8BF4\u660E\u6807\u6CE8" }
|
|
499
|
+
];
|
|
500
|
+
function formatCountdown(sec) {
|
|
501
|
+
const safe = Math.max(0, Math.floor(sec));
|
|
502
|
+
const m = String(Math.floor(safe / 60)).padStart(2, "0");
|
|
503
|
+
const s = String(safe % 60).padStart(2, "0");
|
|
504
|
+
return `${m}:${s}`;
|
|
505
|
+
}
|
|
506
|
+
var BoardsInfiniteCanvas = () => {
|
|
507
|
+
const instanceService = (0, import_ui2.useDependency)(import_core2.IUniverInstanceService);
|
|
508
|
+
const commandService = (0, import_ui2.useDependency)(import_core2.ICommandService);
|
|
509
|
+
const selectionService = (0, import_ui2.useDependency)(import_univer_boards2.IBoardSelectionService);
|
|
510
|
+
const unit = (0, import_ui2.useObservable)(
|
|
511
|
+
() => instanceService.getCurrentTypeOfUnit$(import_core2.UniverInstanceType.UNIVER_BOARD),
|
|
512
|
+
instanceService.getCurrentUnitOfType(import_core2.UniverInstanceType.UNIVER_BOARD),
|
|
513
|
+
false,
|
|
514
|
+
[instanceService]
|
|
515
|
+
);
|
|
516
|
+
const snapshot = (0, import_ui2.useObservable)(
|
|
517
|
+
() => unit ? unit.snapshotChanged$ : (0, import_rxjs.of)(null),
|
|
518
|
+
unit ? unit.getSnapshot() : null,
|
|
519
|
+
false,
|
|
520
|
+
[unit]
|
|
521
|
+
);
|
|
522
|
+
const selectedIds = (0, import_ui2.useObservable)(
|
|
523
|
+
selectionService.selectedIds$,
|
|
524
|
+
selectionService.getSelectedIds()
|
|
525
|
+
);
|
|
526
|
+
const editingId = (0, import_ui2.useObservable)(
|
|
527
|
+
selectionService.editingElementId$,
|
|
528
|
+
selectionService.getEditingElementId()
|
|
529
|
+
);
|
|
530
|
+
const activeTool = (0, import_ui2.useObservable)(
|
|
531
|
+
selectionService.activeTool$,
|
|
532
|
+
selectionService.getActiveTool()
|
|
533
|
+
);
|
|
534
|
+
const activeShapeType = (0, import_ui2.useObservable)(
|
|
535
|
+
selectionService.activeShapeType$,
|
|
536
|
+
selectionService.getActiveShapeType()
|
|
537
|
+
);
|
|
538
|
+
const activeStickyColor = (0, import_ui2.useObservable)(
|
|
539
|
+
selectionService.activeStickyColor$,
|
|
540
|
+
selectionService.getActiveStickyColor()
|
|
541
|
+
);
|
|
542
|
+
const presentation = (0, import_ui2.useObservable)(
|
|
543
|
+
selectionService.presentation$,
|
|
544
|
+
selectionService.getPresentationState()
|
|
545
|
+
);
|
|
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
|
+
);
|
|
559
|
+
const stageRef = (0, import_react.useRef)(null);
|
|
560
|
+
const [spacePressed, setSpacePressed] = (0, import_react.useState)(false);
|
|
561
|
+
const [hoveredElementId, setHoveredElementId] = (0, import_react.useState)(null);
|
|
562
|
+
const [shapeMenuOpen, setShapeMenuOpen] = (0, import_react.useState)(false);
|
|
563
|
+
const [widgetMenuOpen, setWidgetMenuOpen] = (0, import_react.useState)(false);
|
|
564
|
+
const [editingDraft, setEditingDraft] = (0, import_react.useState)("");
|
|
565
|
+
const [dragDelta, setDragDelta] = (0, import_react.useState)(null);
|
|
566
|
+
const [resizeDraft, setResizeDraft] = (0, import_react.useState)(null);
|
|
567
|
+
const [marqueeBox, setMarqueeBox] = (0, import_react.useState)(null);
|
|
568
|
+
const [connectingDraft, setConnectingDraft] = (0, import_react.useState)(null);
|
|
569
|
+
const [inkDraft, setInkDraft] = (0, import_react.useState)(null);
|
|
570
|
+
const [laserTrail, setLaserTrail] = (0, import_react.useState)([]);
|
|
571
|
+
const gestureRef = (0, import_react.useRef)(null);
|
|
572
|
+
const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
|
|
573
|
+
(0, import_react.useEffect)(() => {
|
|
574
|
+
if (!timer.running) return void 0;
|
|
575
|
+
const handle = setInterval(() => {
|
|
576
|
+
const latest = selectionService.getTimerState();
|
|
577
|
+
if (!latest.running) return;
|
|
578
|
+
if (latest.remainingSec <= 1) {
|
|
579
|
+
selectionService.setTimerState({ remainingSec: 0, running: false });
|
|
580
|
+
} else {
|
|
581
|
+
selectionService.setTimerState({ remainingSec: latest.remainingSec - 1 });
|
|
582
|
+
}
|
|
583
|
+
}, 1e3);
|
|
584
|
+
return () => clearInterval(handle);
|
|
585
|
+
}, [timer.running, selectionService]);
|
|
586
|
+
(0, import_react.useEffect)(() => {
|
|
587
|
+
if (!presentation.laserActive || laserTrail.length === 0) return void 0;
|
|
588
|
+
const timerId = setInterval(() => {
|
|
589
|
+
const cutoff = Date.now() - 800;
|
|
590
|
+
setLaserTrail((prev) => prev.filter((pt) => pt.ts >= cutoff));
|
|
591
|
+
}, 80);
|
|
592
|
+
return () => clearInterval(timerId);
|
|
593
|
+
}, [presentation.laserActive, laserTrail.length]);
|
|
594
|
+
(0, import_react.useEffect)(() => {
|
|
595
|
+
if (typeof window === "undefined") return void 0;
|
|
596
|
+
const onKeyDown = (e) => {
|
|
597
|
+
const target = e.target;
|
|
598
|
+
if (target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable)) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
if (e.code === "Space") {
|
|
602
|
+
setSpacePressed(true);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
const key = e.key.toLowerCase();
|
|
606
|
+
if (key === "v") selectionService.setActiveTool("select");
|
|
607
|
+
else if (key === "h") selectionService.setActiveTool("hand");
|
|
608
|
+
else if (key === "f") selectionService.setActiveTool("frame");
|
|
609
|
+
else if (key === "s" && !e.metaKey && !e.ctrlKey) selectionService.setActiveTool("swimlane");
|
|
610
|
+
else if (key === "n") selectionService.setActiveTool("sticky");
|
|
611
|
+
else if (key === "l") selectionService.setActiveTool("connector");
|
|
612
|
+
else if (key === "p") selectionService.setActiveTool("ink");
|
|
613
|
+
else if (key === "m") selectionService.setActiveTool("mindmap");
|
|
614
|
+
else if (key === "e") selectionService.setActiveTool("entityCard");
|
|
615
|
+
else if ((e.key === "Delete" || e.key === "Backspace") && unit) {
|
|
616
|
+
const ids = selectionService.getSelectedIds();
|
|
617
|
+
if (ids.length > 0) {
|
|
618
|
+
commandService.syncExecuteCommand(import_univer_boards2.DeleteBoardElementsCommand.id, {
|
|
619
|
+
unitId: unit.getUnitId(),
|
|
620
|
+
elementIds: ids
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
const onKeyUp = (e) => {
|
|
626
|
+
if (e.code === "Space") setSpacePressed(false);
|
|
627
|
+
};
|
|
628
|
+
window.addEventListener("keydown", onKeyDown);
|
|
629
|
+
window.addEventListener("keyup", onKeyUp);
|
|
630
|
+
return () => {
|
|
631
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
632
|
+
window.removeEventListener("keyup", onKeyUp);
|
|
633
|
+
};
|
|
634
|
+
}, [selectionService, commandService, unit]);
|
|
635
|
+
const screenToBoard = (0, import_react.useCallback)(
|
|
636
|
+
(clientX, clientY) => {
|
|
637
|
+
const rect = stageRef.current?.getBoundingClientRect() ?? { left: 0, top: 0 };
|
|
638
|
+
const rawVp = currentSnap?.viewport ?? { panX: 0, panY: 0, zoom: 1 };
|
|
639
|
+
const vp = selectionService.resolveEffectiveViewport(rawVp);
|
|
640
|
+
return {
|
|
641
|
+
x: (clientX - rect.left - vp.panX) / vp.zoom,
|
|
642
|
+
y: (clientY - rect.top - vp.panY) / vp.zoom
|
|
643
|
+
};
|
|
644
|
+
},
|
|
645
|
+
[currentSnap?.viewport, selectionService]
|
|
646
|
+
);
|
|
647
|
+
const effectiveElementsMap = (0, import_react.useMemo)(() => {
|
|
648
|
+
if (!currentSnap) return {};
|
|
649
|
+
if (!dragDelta && !resizeDraft) return currentSnap.elements;
|
|
650
|
+
const next = { ...currentSnap.elements };
|
|
651
|
+
if (dragDelta) {
|
|
652
|
+
for (const id of dragDelta.ids) {
|
|
653
|
+
const orig = next[id];
|
|
654
|
+
if (orig) {
|
|
655
|
+
next[id] = { ...orig, x: orig.x + dragDelta.dx, y: orig.y + dragDelta.dy };
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
if (resizeDraft && next[resizeDraft.id]) {
|
|
660
|
+
next[resizeDraft.id] = {
|
|
661
|
+
...next[resizeDraft.id],
|
|
662
|
+
x: resizeDraft.x,
|
|
663
|
+
y: resizeDraft.y,
|
|
664
|
+
width: resizeDraft.width,
|
|
665
|
+
height: resizeDraft.height
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
return next;
|
|
669
|
+
}, [currentSnap, dragDelta, resizeDraft]);
|
|
670
|
+
if (!currentSnap || !unit) {
|
|
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..." });
|
|
672
|
+
}
|
|
673
|
+
const unitId = unit.getUnitId();
|
|
674
|
+
const effectiveViewport = selectionService.resolveEffectiveViewport(currentSnap.viewport);
|
|
675
|
+
const { panX, panY, zoom } = effectiveViewport;
|
|
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;
|
|
682
|
+
const orderedElements = (currentSnap.elementOrder.length ? currentSnap.elementOrder : Object.keys(currentSnap.elements)).map((id) => effectiveElementsMap[id]).filter((el) => Boolean(el && !el.hidden));
|
|
683
|
+
const visibleMindmaps = orderedElements.filter(
|
|
684
|
+
(el) => el.type === "mindmap" && !(0, import_univer_boards2.isMindmapNodeCollapsedHidden)(el, effectiveElementsMap)
|
|
685
|
+
);
|
|
686
|
+
const connectors = orderedElements.filter(
|
|
687
|
+
(el) => el.type === "connector"
|
|
688
|
+
);
|
|
689
|
+
const worldBounds = (0, import_univer_boards2.computeBoardBounds)(currentSnap, void 0, 80);
|
|
690
|
+
const minimapW = 196;
|
|
691
|
+
const minimapH = 128;
|
|
692
|
+
const mmScale = Math.min(
|
|
693
|
+
minimapW / Math.max(1, worldBounds.width),
|
|
694
|
+
minimapH / Math.max(1, worldBounds.height)
|
|
695
|
+
);
|
|
696
|
+
const stageW = stageRef.current?.clientWidth || 1120;
|
|
697
|
+
const stageH = stageRef.current?.clientHeight || 700;
|
|
698
|
+
const viewWorldX = -panX / zoom;
|
|
699
|
+
const viewWorldY = -panY / zoom;
|
|
700
|
+
const viewWorldW = stageW / zoom;
|
|
701
|
+
const viewWorldH = stageH / zoom;
|
|
702
|
+
const commitInlineEdit = () => {
|
|
703
|
+
if (!editingId) return;
|
|
704
|
+
const el = currentSnap.elements[editingId];
|
|
705
|
+
if (el) {
|
|
706
|
+
if (el.type === "frame" || el.type === "swimlane" || el.type === "entityCard" || el.type === "chart") {
|
|
707
|
+
commandService.syncExecuteCommand(import_univer_boards2.UpdateBoardElementsCommand.id, {
|
|
708
|
+
unitId,
|
|
709
|
+
updates: [{ id: el.id, patch: { title: editingDraft } }]
|
|
710
|
+
});
|
|
711
|
+
} else if (el.type === "sticky" || el.type === "shape" || el.type === "mindmap" || el.type === "text") {
|
|
712
|
+
commandService.syncExecuteCommand(import_univer_boards2.UpdateBoardElementsCommand.id, {
|
|
713
|
+
unitId,
|
|
714
|
+
updates: [{ id: el.id, patch: { text: editingDraft } }]
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
selectionService.setEditingElement(null);
|
|
719
|
+
};
|
|
720
|
+
const startInlineEdit = (el) => {
|
|
721
|
+
if (el.type === "sticky" && (0, import_univer_boards2.isStickyMaskedForViewer)(el, currentSnap.brainstorm, currentUserId)) {
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
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 : "";
|
|
725
|
+
setEditingDraft(initial);
|
|
726
|
+
selectionService.setEditingElement(el.id);
|
|
727
|
+
};
|
|
728
|
+
const handleWheel = (e) => {
|
|
729
|
+
e.preventDefault();
|
|
730
|
+
const rect = stageRef.current?.getBoundingClientRect() ?? { left: 0, top: 0 };
|
|
731
|
+
const cursorX = e.clientX - rect.left;
|
|
732
|
+
const cursorY = e.clientY - rect.top;
|
|
733
|
+
const factor = e.deltaY < 0 ? 1.1 : 0.9;
|
|
734
|
+
const nextZoom = Math.max(0.1, Math.min(4, Number((zoom * factor).toFixed(3))));
|
|
735
|
+
const nextPanX = Math.round(cursorX - (cursorX - panX) / zoom * nextZoom);
|
|
736
|
+
const nextPanY = Math.round(cursorY - (cursorY - panY) / zoom * nextZoom);
|
|
737
|
+
commandService.syncExecuteCommand(import_univer_boards2.SetBoardViewportCommand.id, {
|
|
738
|
+
unitId,
|
|
739
|
+
viewport: { panX: nextPanX, panY: nextPanY, zoom: nextZoom }
|
|
740
|
+
});
|
|
741
|
+
};
|
|
742
|
+
const handleStagePointerDown = (e) => {
|
|
743
|
+
if (editingId) {
|
|
744
|
+
commitInlineEdit();
|
|
745
|
+
}
|
|
746
|
+
setShapeMenuOpen(false);
|
|
747
|
+
setWidgetMenuOpen(false);
|
|
748
|
+
const boardPt = screenToBoard(e.clientX, e.clientY);
|
|
749
|
+
if (spacePressed || activeTool === "hand" || e.button === 1) {
|
|
750
|
+
gestureRef.current = {
|
|
751
|
+
kind: "pan",
|
|
752
|
+
startClientX: e.clientX,
|
|
753
|
+
startClientY: e.clientY,
|
|
754
|
+
origPanX: panX,
|
|
755
|
+
origPanY: panY
|
|
756
|
+
};
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
if (activeTool === "ink") {
|
|
760
|
+
const startPt = { x: boardPt.x, y: boardPt.y, pressure: e.pressure || 0.5 };
|
|
761
|
+
gestureRef.current = { kind: "ink", points: [startPt] };
|
|
762
|
+
setInkDraft([startPt]);
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
if (activeTool === "comment") {
|
|
766
|
+
commandService.syncExecuteCommand(import_univer_boards2.AddBoardCommentCommand.id, {
|
|
767
|
+
unitId,
|
|
768
|
+
x: boardPt.x,
|
|
769
|
+
y: boardPt.y,
|
|
770
|
+
text: "\u65B0\u589E\u56E2\u961F\u8BC4\u5BA1\u610F\u89C1"
|
|
771
|
+
});
|
|
772
|
+
selectionService.setActiveTool("select");
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
if (activeTool === "frame" || activeTool === "swimlane" || activeTool === "sticky" || activeTool === "shape" || activeTool === "text" || activeTool === "mindmap" || activeTool === "entityCard" || activeTool === "table" || activeTool === "chart") {
|
|
776
|
+
const extra = {
|
|
777
|
+
x: Math.round(boardPt.x - 80),
|
|
778
|
+
y: Math.round(boardPt.y - 40)
|
|
779
|
+
};
|
|
780
|
+
if (activeTool === "shape") extra.shapeType = activeShapeType;
|
|
781
|
+
if (activeTool === "sticky") {
|
|
782
|
+
extra.color = activeStickyColor;
|
|
783
|
+
extra.authorId = currentUserId;
|
|
784
|
+
extra.author = selectionService.getCurrentUserName();
|
|
785
|
+
}
|
|
786
|
+
commandService.syncExecuteCommand(import_univer_boards2.AddBoardElementsCommand.id, {
|
|
787
|
+
unitId,
|
|
788
|
+
element: {
|
|
789
|
+
type: activeTool,
|
|
790
|
+
...extra
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
selectionService.setActiveTool("select");
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
if (activeTool === "connector") {
|
|
797
|
+
const fromId = `conn-free-${(0, import_core2.generateRandomId)(5)}`;
|
|
798
|
+
commandService.syncExecuteCommand(import_univer_boards2.AddBoardElementsCommand.id, {
|
|
799
|
+
unitId,
|
|
800
|
+
element: {
|
|
801
|
+
id: fromId,
|
|
802
|
+
type: "connector",
|
|
803
|
+
routeType: "orthogonal",
|
|
804
|
+
from: { x: Math.round(boardPt.x), y: Math.round(boardPt.y) },
|
|
805
|
+
to: { x: Math.round(boardPt.x + 180), y: Math.round(boardPt.y + 60) },
|
|
806
|
+
x: Math.round(boardPt.x),
|
|
807
|
+
y: Math.round(boardPt.y),
|
|
808
|
+
width: 180,
|
|
809
|
+
height: 60
|
|
810
|
+
}
|
|
811
|
+
});
|
|
812
|
+
selectionService.setActiveTool("select");
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
if (!e.shiftKey) {
|
|
816
|
+
selectionService.clearSelection();
|
|
817
|
+
}
|
|
818
|
+
gestureRef.current = {
|
|
819
|
+
kind: "marquee",
|
|
820
|
+
startBoardX: boardPt.x,
|
|
821
|
+
startBoardY: boardPt.y
|
|
822
|
+
};
|
|
823
|
+
setMarqueeBox({
|
|
824
|
+
x1: boardPt.x,
|
|
825
|
+
y1: boardPt.y,
|
|
826
|
+
x2: boardPt.x,
|
|
827
|
+
y2: boardPt.y
|
|
828
|
+
});
|
|
829
|
+
};
|
|
830
|
+
const handleElementPointerDown = (e, el) => {
|
|
831
|
+
if (spacePressed || activeTool === "hand") return;
|
|
832
|
+
e.stopPropagation();
|
|
833
|
+
if (activeTool === "connector") {
|
|
834
|
+
const startPt = (0, import_univer_boards2.getElementPortPoint)(el, "right");
|
|
835
|
+
gestureRef.current = {
|
|
836
|
+
kind: "connect",
|
|
837
|
+
fromElementId: el.id,
|
|
838
|
+
fromPort: "right",
|
|
839
|
+
startX: startPt.x,
|
|
840
|
+
startY: startPt.y
|
|
841
|
+
};
|
|
842
|
+
setConnectingDraft({
|
|
843
|
+
fromElementId: el.id,
|
|
844
|
+
fromPort: "right",
|
|
845
|
+
startX: startPt.x,
|
|
846
|
+
startY: startPt.y,
|
|
847
|
+
currX: startPt.x,
|
|
848
|
+
currY: startPt.y
|
|
849
|
+
});
|
|
850
|
+
return;
|
|
851
|
+
}
|
|
852
|
+
let nextSel = selectedIds;
|
|
853
|
+
if (e.shiftKey) {
|
|
854
|
+
selectionService.toggleSelectElement(el.id);
|
|
855
|
+
nextSel = selectionService.getSelectedIds();
|
|
856
|
+
} else if (!selectedIds.includes(el.id)) {
|
|
857
|
+
selectionService.selectElements([el.id]);
|
|
858
|
+
nextSel = [el.id];
|
|
859
|
+
}
|
|
860
|
+
if (el.locked) return;
|
|
861
|
+
const boardPt = screenToBoard(e.clientX, e.clientY);
|
|
862
|
+
const movableSet = new Set(nextSel);
|
|
863
|
+
for (const id of nextSel) {
|
|
864
|
+
const item = currentSnap.elements[id];
|
|
865
|
+
if (item && item.type === "frame") {
|
|
866
|
+
for (const child of unit.getElementsInFrame(item.id)) {
|
|
867
|
+
if (!child.locked) {
|
|
868
|
+
movableSet.add(child.id);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
const origPositions = /* @__PURE__ */ new Map();
|
|
874
|
+
for (const id of movableSet) {
|
|
875
|
+
const target = currentSnap.elements[id];
|
|
876
|
+
if (target && !target.locked) {
|
|
877
|
+
origPositions.set(id, { x: target.x, y: target.y });
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
gestureRef.current = {
|
|
881
|
+
kind: "move",
|
|
882
|
+
startBoardX: boardPt.x,
|
|
883
|
+
startBoardY: boardPt.y,
|
|
884
|
+
movableIds: Array.from(origPositions.keys()),
|
|
885
|
+
origPositions
|
|
886
|
+
};
|
|
887
|
+
};
|
|
888
|
+
const handlePortPointerDown = (e, el, port) => {
|
|
889
|
+
e.stopPropagation();
|
|
890
|
+
const pt = (0, import_univer_boards2.getElementPortPoint)(el, port);
|
|
891
|
+
gestureRef.current = {
|
|
892
|
+
kind: "connect",
|
|
893
|
+
fromElementId: el.id,
|
|
894
|
+
fromPort: port,
|
|
895
|
+
startX: pt.x,
|
|
896
|
+
startY: pt.y
|
|
897
|
+
};
|
|
898
|
+
setConnectingDraft({
|
|
899
|
+
fromElementId: el.id,
|
|
900
|
+
fromPort: port,
|
|
901
|
+
startX: pt.x,
|
|
902
|
+
startY: pt.y,
|
|
903
|
+
currX: pt.x,
|
|
904
|
+
currY: pt.y
|
|
905
|
+
});
|
|
906
|
+
};
|
|
907
|
+
const handleResizePointerDown = (e, el, dir) => {
|
|
908
|
+
e.stopPropagation();
|
|
909
|
+
if (el.locked) return;
|
|
910
|
+
const boardPt = screenToBoard(e.clientX, e.clientY);
|
|
911
|
+
gestureRef.current = {
|
|
912
|
+
kind: "resize",
|
|
913
|
+
id: el.id,
|
|
914
|
+
dir,
|
|
915
|
+
startBoardX: boardPt.x,
|
|
916
|
+
startBoardY: boardPt.y,
|
|
917
|
+
origRect: { x: el.x, y: el.y, width: el.width, height: el.height }
|
|
918
|
+
};
|
|
919
|
+
};
|
|
920
|
+
const handleStagePointerMove = (e) => {
|
|
921
|
+
const boardPt = screenToBoard(e.clientX, e.clientY);
|
|
922
|
+
if (presentation.laserActive || activeTool === "laser") {
|
|
923
|
+
setLaserTrail((prev) => [...prev.slice(-18), { x: boardPt.x, y: boardPt.y, ts: Date.now() }]);
|
|
924
|
+
}
|
|
925
|
+
const g = gestureRef.current;
|
|
926
|
+
if (!g) return;
|
|
927
|
+
if (g.kind === "pan") {
|
|
928
|
+
const dx = e.clientX - g.startClientX;
|
|
929
|
+
const dy = e.clientY - g.startClientY;
|
|
930
|
+
commandService.syncExecuteCommand(import_univer_boards2.SetBoardViewportCommand.id, {
|
|
931
|
+
unitId,
|
|
932
|
+
viewport: { panX: g.origPanX + dx, panY: g.origPanY + dy }
|
|
933
|
+
});
|
|
934
|
+
} else if (g.kind === "move") {
|
|
935
|
+
let dx = boardPt.x - g.startBoardX;
|
|
936
|
+
let dy = boardPt.y - g.startBoardY;
|
|
937
|
+
if (currentSnap.snapToGrid !== false) {
|
|
938
|
+
dx = Math.round(dx / 8) * 8;
|
|
939
|
+
dy = Math.round(dy / 8) * 8;
|
|
940
|
+
}
|
|
941
|
+
setDragDelta({ ids: new Set(g.movableIds), dx, dy });
|
|
942
|
+
} else if (g.kind === "resize") {
|
|
943
|
+
const dx = boardPt.x - g.startBoardX;
|
|
944
|
+
const dy = boardPt.y - g.startBoardY;
|
|
945
|
+
let { x, y, width, height } = g.origRect;
|
|
946
|
+
if (g.dir.includes("e")) width = Math.max(36, width + dx);
|
|
947
|
+
if (g.dir.includes("s")) height = Math.max(28, height + dy);
|
|
948
|
+
if (g.dir.includes("w")) {
|
|
949
|
+
const nextW = Math.max(36, width - dx);
|
|
950
|
+
x += width - nextW;
|
|
951
|
+
width = nextW;
|
|
952
|
+
}
|
|
953
|
+
if (g.dir.includes("n")) {
|
|
954
|
+
const nextH = Math.max(28, height - dy);
|
|
955
|
+
y += height - nextH;
|
|
956
|
+
height = nextH;
|
|
957
|
+
}
|
|
958
|
+
setResizeDraft({
|
|
959
|
+
id: g.id,
|
|
960
|
+
x: Math.round(x),
|
|
961
|
+
y: Math.round(y),
|
|
962
|
+
width: Math.round(width),
|
|
963
|
+
height: Math.round(height)
|
|
964
|
+
});
|
|
965
|
+
} else if (g.kind === "marquee") {
|
|
966
|
+
setMarqueeBox({
|
|
967
|
+
x1: g.startBoardX,
|
|
968
|
+
y1: g.startBoardY,
|
|
969
|
+
x2: boardPt.x,
|
|
970
|
+
y2: boardPt.y
|
|
971
|
+
});
|
|
972
|
+
} else if (g.kind === "connect") {
|
|
973
|
+
setConnectingDraft(
|
|
974
|
+
(prev) => prev ? { ...prev, currX: boardPt.x, currY: boardPt.y } : null
|
|
975
|
+
);
|
|
976
|
+
} else if (g.kind === "ink") {
|
|
977
|
+
const pt = { x: boardPt.x, y: boardPt.y, pressure: e.pressure || 0.5 };
|
|
978
|
+
g.points.push(pt);
|
|
979
|
+
setInkDraft([...g.points]);
|
|
980
|
+
}
|
|
981
|
+
};
|
|
982
|
+
const handleStagePointerUp = (e) => {
|
|
983
|
+
const g = gestureRef.current;
|
|
984
|
+
gestureRef.current = null;
|
|
985
|
+
if (!g) return;
|
|
986
|
+
const boardPt = screenToBoard(e.clientX, e.clientY);
|
|
987
|
+
if (g.kind === "move") {
|
|
988
|
+
if (dragDelta && (Math.abs(dragDelta.dx) >= 1 || Math.abs(dragDelta.dy) >= 1)) {
|
|
989
|
+
const updates = g.movableIds.map((id) => {
|
|
990
|
+
const orig = g.origPositions.get(id);
|
|
991
|
+
if (!orig) return null;
|
|
992
|
+
return {
|
|
993
|
+
id,
|
|
994
|
+
patch: {
|
|
995
|
+
x: Math.round(orig.x + dragDelta.dx),
|
|
996
|
+
y: Math.round(orig.y + dragDelta.dy)
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
}).filter((u) => u !== null);
|
|
1000
|
+
if (updates.length > 0) {
|
|
1001
|
+
commandService.syncExecuteCommand(import_univer_boards2.UpdateBoardElementsCommand.id, {
|
|
1002
|
+
unitId,
|
|
1003
|
+
updates
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
setDragDelta(null);
|
|
1008
|
+
} else if (g.kind === "resize") {
|
|
1009
|
+
if (resizeDraft) {
|
|
1010
|
+
commandService.syncExecuteCommand(import_univer_boards2.UpdateBoardElementsCommand.id, {
|
|
1011
|
+
unitId,
|
|
1012
|
+
updates: [
|
|
1013
|
+
{
|
|
1014
|
+
id: resizeDraft.id,
|
|
1015
|
+
patch: {
|
|
1016
|
+
x: resizeDraft.x,
|
|
1017
|
+
y: resizeDraft.y,
|
|
1018
|
+
width: resizeDraft.width,
|
|
1019
|
+
height: resizeDraft.height
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
]
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
setResizeDraft(null);
|
|
1026
|
+
} else if (g.kind === "marquee") {
|
|
1027
|
+
if (marqueeBox) {
|
|
1028
|
+
const minX = Math.min(marqueeBox.x1, marqueeBox.x2);
|
|
1029
|
+
const maxX = Math.max(marqueeBox.x1, marqueeBox.x2);
|
|
1030
|
+
const minY = Math.min(marqueeBox.y1, marqueeBox.y2);
|
|
1031
|
+
const maxY = Math.max(marqueeBox.y1, marqueeBox.y2);
|
|
1032
|
+
if (maxX - minX > 4 || maxY - minY > 4) {
|
|
1033
|
+
const hit = orderedElements.filter(
|
|
1034
|
+
(el) => el.type !== "frame" && el.x + el.width >= minX && el.x <= maxX && el.y + el.height >= minY && el.y <= maxY
|
|
1035
|
+
).map((el) => el.id);
|
|
1036
|
+
selectionService.selectElements(hit);
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
setMarqueeBox(null);
|
|
1040
|
+
} else if (g.kind === "connect") {
|
|
1041
|
+
const targetEl = [...orderedElements].reverse().find(
|
|
1042
|
+
(el) => el.id !== g.fromElementId && el.type !== "connector" && el.type !== "frame" && el.type !== "ink" && boardPt.x >= el.x - 14 && boardPt.x <= el.x + el.width + 14 && boardPt.y >= el.y - 14 && boardPt.y <= el.y + el.height + 14
|
|
1043
|
+
);
|
|
1044
|
+
let toEndpoint = {
|
|
1045
|
+
x: Math.round(boardPt.x),
|
|
1046
|
+
y: Math.round(boardPt.y)
|
|
1047
|
+
};
|
|
1048
|
+
if (targetEl) {
|
|
1049
|
+
let bestPort = "left";
|
|
1050
|
+
let bestDist = Infinity;
|
|
1051
|
+
for (const pSide of PORT_SIDES) {
|
|
1052
|
+
const pp = (0, import_univer_boards2.getElementPortPoint)(targetEl, pSide);
|
|
1053
|
+
const d = Math.hypot(pp.x - boardPt.x, pp.y - boardPt.y);
|
|
1054
|
+
if (d < bestDist) {
|
|
1055
|
+
bestDist = d;
|
|
1056
|
+
bestPort = pSide;
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
toEndpoint = { elementId: targetEl.id, port: bestPort };
|
|
1060
|
+
}
|
|
1061
|
+
if (Math.hypot(boardPt.x - g.startX, boardPt.y - g.startY) > 12) {
|
|
1062
|
+
commandService.syncExecuteCommand(import_univer_boards2.AddBoardElementsCommand.id, {
|
|
1063
|
+
unitId,
|
|
1064
|
+
element: {
|
|
1065
|
+
type: "connector",
|
|
1066
|
+
routeType: "orthogonal",
|
|
1067
|
+
from: { elementId: g.fromElementId, port: g.fromPort },
|
|
1068
|
+
to: toEndpoint,
|
|
1069
|
+
stroke: "#2563EB",
|
|
1070
|
+
strokeWidth: 2,
|
|
1071
|
+
endMarker: "arrow",
|
|
1072
|
+
x: Math.min(g.startX, boardPt.x),
|
|
1073
|
+
y: Math.min(g.startY, boardPt.y),
|
|
1074
|
+
width: Math.max(20, Math.abs(boardPt.x - g.startX)),
|
|
1075
|
+
height: Math.max(20, Math.abs(boardPt.y - g.startY))
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
setConnectingDraft(null);
|
|
1080
|
+
} else if (g.kind === "ink") {
|
|
1081
|
+
if (g.points.length >= 2) {
|
|
1082
|
+
const xs = g.points.map((p) => p.x);
|
|
1083
|
+
const ys = g.points.map((p) => p.y);
|
|
1084
|
+
const minX = Math.min(...xs);
|
|
1085
|
+
const minY = Math.min(...ys);
|
|
1086
|
+
commandService.syncExecuteCommand(import_univer_boards2.AddBoardElementsCommand.id, {
|
|
1087
|
+
unitId,
|
|
1088
|
+
element: {
|
|
1089
|
+
type: "ink",
|
|
1090
|
+
points: g.points.map((p) => ({
|
|
1091
|
+
x: Number(p.x.toFixed(1)),
|
|
1092
|
+
y: Number(p.y.toFixed(1)),
|
|
1093
|
+
pressure: p.pressure
|
|
1094
|
+
})),
|
|
1095
|
+
stroke: "#2563EB",
|
|
1096
|
+
strokeWidth: 3,
|
|
1097
|
+
opacity: 0.95,
|
|
1098
|
+
x: Math.round(minX),
|
|
1099
|
+
y: Math.round(minY),
|
|
1100
|
+
width: Math.max(8, Math.round(Math.max(...xs) - minX)),
|
|
1101
|
+
height: Math.max(8, Math.round(Math.max(...ys) - minY))
|
|
1102
|
+
},
|
|
1103
|
+
selectAdded: false
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
setInkDraft(null);
|
|
1107
|
+
}
|
|
1108
|
+
};
|
|
1109
|
+
const stepPresentationFrame = (delta) => {
|
|
1110
|
+
if (framesOrdered.length === 0) return;
|
|
1111
|
+
const nextIdx = (presentation.frameIndex + delta + framesOrdered.length) % framesOrdered.length;
|
|
1112
|
+
commandService.syncExecuteCommand(StartBoardPresentationOperation.id, {
|
|
1113
|
+
active: true,
|
|
1114
|
+
frameIndex: nextIdx
|
|
1115
|
+
});
|
|
1116
|
+
};
|
|
1117
|
+
const setTimerPreset = (minutes) => {
|
|
1118
|
+
const sec = minutes * 60;
|
|
1119
|
+
selectionService.setTimerState({
|
|
1120
|
+
durationSec: sec,
|
|
1121
|
+
remainingSec: sec,
|
|
1122
|
+
running: false
|
|
1123
|
+
});
|
|
1124
|
+
};
|
|
1125
|
+
const handleMinimapClick = (e) => {
|
|
1126
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
1127
|
+
const mx = e.clientX - rect.left;
|
|
1128
|
+
const my = e.clientY - rect.top;
|
|
1129
|
+
const targetWorldX = worldBounds.x + mx / mmScale;
|
|
1130
|
+
const targetWorldY = worldBounds.y + my / mmScale;
|
|
1131
|
+
const nextPanX = Math.round(stageW / 2 - targetWorldX * zoom);
|
|
1132
|
+
const nextPanY = Math.round(stageH / 2 - targetWorldY * zoom);
|
|
1133
|
+
commandService.syncExecuteCommand(import_univer_boards2.SetBoardViewportCommand.id, {
|
|
1134
|
+
unitId,
|
|
1135
|
+
viewport: { panX: nextPanX, panY: nextPanY }
|
|
1136
|
+
});
|
|
1137
|
+
};
|
|
1138
|
+
const renderShapeNode = (el) => {
|
|
1139
|
+
const { width: w, height: h, fill, stroke, strokeWidth } = el;
|
|
1140
|
+
const dash = el.dashed ? "6 4" : void 0;
|
|
1141
|
+
if (el.shapeType === "rect") {
|
|
1142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1143
|
+
"rect",
|
|
1144
|
+
{
|
|
1145
|
+
x: 1,
|
|
1146
|
+
y: 1,
|
|
1147
|
+
width: Math.max(2, w - 2),
|
|
1148
|
+
height: Math.max(2, h - 2),
|
|
1149
|
+
rx: 4,
|
|
1150
|
+
fill,
|
|
1151
|
+
stroke,
|
|
1152
|
+
strokeWidth,
|
|
1153
|
+
strokeDasharray: dash
|
|
1154
|
+
}
|
|
1155
|
+
);
|
|
1156
|
+
}
|
|
1157
|
+
if (el.shapeType === "roundRect") {
|
|
1158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1159
|
+
"rect",
|
|
1160
|
+
{
|
|
1161
|
+
x: 1,
|
|
1162
|
+
y: 1,
|
|
1163
|
+
width: Math.max(2, w - 2),
|
|
1164
|
+
height: Math.max(2, h - 2),
|
|
1165
|
+
rx: Math.min(18, h / 2),
|
|
1166
|
+
fill,
|
|
1167
|
+
stroke,
|
|
1168
|
+
strokeWidth,
|
|
1169
|
+
strokeDasharray: dash
|
|
1170
|
+
}
|
|
1171
|
+
);
|
|
1172
|
+
}
|
|
1173
|
+
if (el.shapeType === "ellipse") {
|
|
1174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1175
|
+
"ellipse",
|
|
1176
|
+
{
|
|
1177
|
+
cx: w / 2,
|
|
1178
|
+
cy: h / 2,
|
|
1179
|
+
rx: Math.max(2, w / 2 - 1),
|
|
1180
|
+
ry: Math.max(2, h / 2 - 1),
|
|
1181
|
+
fill,
|
|
1182
|
+
stroke,
|
|
1183
|
+
strokeWidth,
|
|
1184
|
+
strokeDasharray: dash
|
|
1185
|
+
}
|
|
1186
|
+
);
|
|
1187
|
+
}
|
|
1188
|
+
if (el.shapeType === "cylinder") {
|
|
1189
|
+
const ry = Math.min(11, h * 0.18);
|
|
1190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1191
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1192
|
+
"path",
|
|
1193
|
+
{
|
|
1194
|
+
d: `M 1 ${ry} L 1 ${h - ry} A ${w / 2 - 1} ${ry} 0 0 0 ${w - 1} ${h - ry} L ${w - 1} ${ry} Z`,
|
|
1195
|
+
fill,
|
|
1196
|
+
stroke,
|
|
1197
|
+
strokeWidth,
|
|
1198
|
+
strokeDasharray: dash
|
|
1199
|
+
}
|
|
1200
|
+
),
|
|
1201
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1202
|
+
"ellipse",
|
|
1203
|
+
{
|
|
1204
|
+
cx: w / 2,
|
|
1205
|
+
cy: ry,
|
|
1206
|
+
rx: Math.max(2, w / 2 - 1),
|
|
1207
|
+
ry,
|
|
1208
|
+
fill,
|
|
1209
|
+
stroke,
|
|
1210
|
+
strokeWidth,
|
|
1211
|
+
strokeDasharray: dash
|
|
1212
|
+
}
|
|
1213
|
+
)
|
|
1214
|
+
] });
|
|
1215
|
+
}
|
|
1216
|
+
if (el.shapeType === "actor") {
|
|
1217
|
+
const cx = w / 2;
|
|
1218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1220
|
+
"rect",
|
|
1221
|
+
{
|
|
1222
|
+
x: 1,
|
|
1223
|
+
y: 1,
|
|
1224
|
+
width: w - 2,
|
|
1225
|
+
height: h - 2,
|
|
1226
|
+
rx: 10,
|
|
1227
|
+
fill,
|
|
1228
|
+
stroke,
|
|
1229
|
+
strokeWidth
|
|
1230
|
+
}
|
|
1231
|
+
),
|
|
1232
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx, cy: 14, r: 6.5, fill: "none", stroke, strokeWidth: 1.8 }),
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1234
|
+
"path",
|
|
1235
|
+
{
|
|
1236
|
+
d: `M ${cx} 20.5 L ${cx} 33 M ${cx - 10} 25 L ${cx + 10} 25 M ${cx} 33 L ${cx - 8} 42 M ${cx} 33 L ${cx + 8} 42`,
|
|
1237
|
+
stroke,
|
|
1238
|
+
strokeWidth: 1.8,
|
|
1239
|
+
strokeLinecap: "round"
|
|
1240
|
+
}
|
|
1241
|
+
)
|
|
1242
|
+
] });
|
|
1243
|
+
}
|
|
1244
|
+
const pathD = (0, import_univer_boards2.buildShapeSvgPath)(el.shapeType, 1, 1, w - 2, h - 2);
|
|
1245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1246
|
+
"path",
|
|
1247
|
+
{
|
|
1248
|
+
d: pathD,
|
|
1249
|
+
fill,
|
|
1250
|
+
stroke,
|
|
1251
|
+
strokeWidth,
|
|
1252
|
+
strokeLinejoin: "round",
|
|
1253
|
+
strokeDasharray: dash
|
|
1254
|
+
}
|
|
1255
|
+
);
|
|
1256
|
+
};
|
|
1257
|
+
const renderInlineChart = (el) => {
|
|
1258
|
+
const plotW = Math.max(80, el.width - 40);
|
|
1259
|
+
const plotH = Math.max(60, el.height - 58);
|
|
1260
|
+
const allVals = el.series.flatMap((s) => s.values);
|
|
1261
|
+
const maxVal = Math.max(1, ...allVals);
|
|
1262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-chart-card", children: [
|
|
1263
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-chart-title", children: el.title }),
|
|
1264
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: plotW + 20, height: plotH + 22, viewBox: `0 0 ${plotW + 20} ${plotH + 22}`, children: [
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: 12, y1: plotH, x2: plotW + 12, y2: plotH, stroke: "#CBD5E1", strokeWidth: 1 }),
|
|
1266
|
+
el.categories.map((cat, cIdx) => {
|
|
1267
|
+
const groupW = plotW / Math.max(1, el.categories.length);
|
|
1268
|
+
const barW = Math.max(6, groupW * 0.66 / Math.max(1, el.series.length));
|
|
1269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { children: [
|
|
1270
|
+
el.series.map((s, sIdx) => {
|
|
1271
|
+
const val = s.values[cIdx] ?? 0;
|
|
1272
|
+
const bh = val / maxVal * (plotH - 8);
|
|
1273
|
+
const bx = 12 + cIdx * groupW + groupW * 0.16 + sIdx * barW;
|
|
1274
|
+
const by = plotH - bh;
|
|
1275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1276
|
+
"rect",
|
|
1277
|
+
{
|
|
1278
|
+
x: bx,
|
|
1279
|
+
y: by,
|
|
1280
|
+
width: Math.max(4, barW - 2),
|
|
1281
|
+
height: Math.max(2, bh),
|
|
1282
|
+
rx: 2,
|
|
1283
|
+
fill: s.color ?? (sIdx === 0 ? "#93C5FD" : "#2563EB")
|
|
1284
|
+
},
|
|
1285
|
+
`${s.name}-${sIdx}`
|
|
1286
|
+
);
|
|
1287
|
+
}),
|
|
1288
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1289
|
+
"text",
|
|
1290
|
+
{
|
|
1291
|
+
x: 12 + cIdx * groupW + groupW / 2,
|
|
1292
|
+
y: plotH + 14,
|
|
1293
|
+
fontSize: 10,
|
|
1294
|
+
fill: "#64748B",
|
|
1295
|
+
textAnchor: "middle",
|
|
1296
|
+
children: cat
|
|
1297
|
+
}
|
|
1298
|
+
)
|
|
1299
|
+
] }, `${cat}-${cIdx}`);
|
|
1300
|
+
})
|
|
1301
|
+
] })
|
|
1302
|
+
] });
|
|
1303
|
+
};
|
|
1304
|
+
const renderInlineTable = (el) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-table-card", children: [
|
|
1305
|
+
el.title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-table-title", children: el.title }),
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { className: "yudao-boards-inline-table", children: [
|
|
1307
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { style: { backgroundColor: el.headerFill ?? "#EFF6FF" }, children: el.headers.map((h, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: h }, `${h}-${idx}`)) }) }),
|
|
1308
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: el.rows.map((row, rIdx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: el.headers.map((_, cIdx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: row[cIdx] ?? "" }, `c-${cIdx}`)) }, `r-${rIdx}`)) })
|
|
1309
|
+
] })
|
|
1310
|
+
] });
|
|
1311
|
+
const gridBgClass = currentSnap.gridStyle === "dots" ? "is-grid-dots" : currentSnap.gridStyle === "lines" ? "is-grid-lines" : "is-grid-none";
|
|
1312
|
+
const dockItems = [
|
|
1313
|
+
{ tool: "select", label: "\u9009\u62E9 (V)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardSelectIcon, {}) },
|
|
1314
|
+
{ tool: "hand", label: "\u6293\u624B (H)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardHandIcon, {}) },
|
|
1315
|
+
{ tool: "frame", label: "\u753B\u6846 (F)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardFrameIcon, {}) },
|
|
1316
|
+
{ tool: "swimlane", label: "\u6CF3\u9053 (S)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardSwimlaneIcon, {}) },
|
|
1317
|
+
{ tool: "sticky", label: "\u4FBF\u7B7E (N)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardStickyIcon, {}) },
|
|
1318
|
+
{
|
|
1319
|
+
tool: "shape",
|
|
1320
|
+
label: "\u5F62\u72B6",
|
|
1321
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardShapeIcon, {}),
|
|
1322
|
+
onClick: () => {
|
|
1323
|
+
selectionService.setActiveTool("shape");
|
|
1324
|
+
setShapeMenuOpen((v) => !v);
|
|
1325
|
+
setWidgetMenuOpen(false);
|
|
1326
|
+
}
|
|
1327
|
+
},
|
|
1328
|
+
{ tool: "connector", label: "\u667A\u80FD\u8FDE\u7EBF (L)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardConnectorIcon, {}) },
|
|
1329
|
+
{ tool: "ink", label: "\u81EA\u7531\u753B\u7B14 (P)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardInkIcon, {}) },
|
|
1330
|
+
{ tool: "mindmap", label: "\u601D\u7EF4\u5BFC\u56FE (M)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardMindmapIcon, {}) },
|
|
1331
|
+
{ tool: "entityCard", label: "\u5B9E\u4F53\u6A21\u578B\u5361 (E)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardEntityCardIcon, {}) },
|
|
1332
|
+
{
|
|
1333
|
+
tool: "chart",
|
|
1334
|
+
label: "\u5185\u5D4C\u56FE\u8868/\u8868\u683C",
|
|
1335
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardChartTableIcon, {}),
|
|
1336
|
+
onClick: () => {
|
|
1337
|
+
setWidgetMenuOpen((v) => !v);
|
|
1338
|
+
setShapeMenuOpen(false);
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
{ tool: "comment", label: "\u8BC4\u8BBA\u56FE\u9489", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardCommentIcon, {}) }
|
|
1342
|
+
];
|
|
1343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1344
|
+
"div",
|
|
1345
|
+
{
|
|
1346
|
+
ref: stageRef,
|
|
1347
|
+
className: `yudao-boards-stage ${gridBgClass} ${spacePressed || activeTool === "hand" ? "is-panning" : ""} ${presentation.laserActive || activeTool === "laser" ? "is-laser" : ""}`,
|
|
1348
|
+
"data-testid": "boards-infinite-canvas",
|
|
1349
|
+
style: {
|
|
1350
|
+
backgroundColor: currentSnap.backgroundColor || "#F8FAFC",
|
|
1351
|
+
backgroundPosition: `${panX}px ${panY}px`,
|
|
1352
|
+
backgroundSize: `${Math.max(8, 24 * zoom)}px ${Math.max(8, 24 * zoom)}px`
|
|
1353
|
+
},
|
|
1354
|
+
onWheel: handleWheel,
|
|
1355
|
+
onPointerDown: handleStagePointerDown,
|
|
1356
|
+
onPointerMove: handleStagePointerMove,
|
|
1357
|
+
onPointerUp: handleStagePointerUp,
|
|
1358
|
+
children: [
|
|
1359
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1360
|
+
"div",
|
|
1361
|
+
{
|
|
1362
|
+
className: "yudao-boards-top-bar",
|
|
1363
|
+
"data-testid": "boards-top-bar",
|
|
1364
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
1365
|
+
children: [
|
|
1366
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-tour-group", children: [
|
|
1367
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1368
|
+
"button",
|
|
1369
|
+
{
|
|
1370
|
+
type: "button",
|
|
1371
|
+
className: `yudao-boards-top-btn ${presentation.active ? "is-active" : ""}`,
|
|
1372
|
+
"data-testid": "boards-tour-toggle",
|
|
1373
|
+
onClick: () => commandService.syncExecuteCommand(StartBoardPresentationOperation.id, {
|
|
1374
|
+
active: !presentation.active,
|
|
1375
|
+
frameIndex: 0
|
|
1376
|
+
}),
|
|
1377
|
+
children: [
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardPlayTourIcon, {}),
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: presentation.active ? `\u753B\u6846\u653E\u6620 (${presentation.frameIndex + 1}/${Math.max(1, framesOrdered.length)})` : "\u753B\u6846\u6F14\u793A\u653E\u6620" })
|
|
1380
|
+
]
|
|
1381
|
+
}
|
|
1382
|
+
),
|
|
1383
|
+
presentation.active && framesOrdered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1384
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1385
|
+
"button",
|
|
1386
|
+
{
|
|
1387
|
+
type: "button",
|
|
1388
|
+
className: "yudao-boards-top-btn",
|
|
1389
|
+
onClick: () => stepPresentationFrame(-1),
|
|
1390
|
+
children: "\u4E0A\u4E00\u5E27"
|
|
1391
|
+
}
|
|
1392
|
+
),
|
|
1393
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1394
|
+
"button",
|
|
1395
|
+
{
|
|
1396
|
+
type: "button",
|
|
1397
|
+
className: "yudao-boards-top-btn",
|
|
1398
|
+
onClick: () => stepPresentationFrame(1),
|
|
1399
|
+
children: "\u4E0B\u4E00\u5E27"
|
|
1400
|
+
}
|
|
1401
|
+
)
|
|
1402
|
+
] }),
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1404
|
+
"button",
|
|
1405
|
+
{
|
|
1406
|
+
type: "button",
|
|
1407
|
+
className: `yudao-boards-top-btn ${presentation.laserActive ? "is-laser-active" : ""}`,
|
|
1408
|
+
"data-testid": "boards-laser-toggle",
|
|
1409
|
+
onClick: () => selectionService.setPresentationState({
|
|
1410
|
+
laserActive: !presentation.laserActive
|
|
1411
|
+
}),
|
|
1412
|
+
children: [
|
|
1413
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardLaserIcon, {}),
|
|
1414
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u6FC0\u5149\u7B14" })
|
|
1415
|
+
]
|
|
1416
|
+
}
|
|
1417
|
+
)
|
|
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
|
+
] }),
|
|
1537
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-timer-group", "data-testid": "boards-workshop-timer", children: [
|
|
1538
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardTimerIcon, {}),
|
|
1539
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-timer-clock", children: formatCountdown(timer.remainingSec) }),
|
|
1540
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: () => setTimerPreset(3), children: "3m" }),
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: () => setTimerPreset(5), children: "5m" }),
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: () => setTimerPreset(10), children: "10m" }),
|
|
1543
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1544
|
+
"button",
|
|
1545
|
+
{
|
|
1546
|
+
type: "button",
|
|
1547
|
+
className: "is-accent",
|
|
1548
|
+
onClick: () => selectionService.setTimerState({ running: !timer.running }),
|
|
1549
|
+
children: timer.running ? "\u6682\u505C" : "\u5F00\u59CB"
|
|
1550
|
+
}
|
|
1551
|
+
),
|
|
1552
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1553
|
+
"button",
|
|
1554
|
+
{
|
|
1555
|
+
type: "button",
|
|
1556
|
+
onClick: () => selectionService.setTimerState({
|
|
1557
|
+
remainingSec: timer.durationSec,
|
|
1558
|
+
running: false
|
|
1559
|
+
}),
|
|
1560
|
+
children: "\u91CD\u7F6E"
|
|
1561
|
+
}
|
|
1562
|
+
)
|
|
1563
|
+
] }),
|
|
1564
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-export-group", "data-testid": "boards-export-bar", children: [
|
|
1565
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardDownloadIcon, {}),
|
|
1566
|
+
["svg", "png", "pdf", "pptx", "csv"].map((fmt) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1567
|
+
"button",
|
|
1568
|
+
{
|
|
1569
|
+
type: "button",
|
|
1570
|
+
className: "yudao-boards-export-chip",
|
|
1571
|
+
"data-testid": `boards-export-${fmt}`,
|
|
1572
|
+
onClick: () => void commandService.executeCommand(ExportBoardFileOperation.id, { format: fmt }),
|
|
1573
|
+
children: fmt.toUpperCase()
|
|
1574
|
+
},
|
|
1575
|
+
fmt
|
|
1576
|
+
)),
|
|
1577
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1578
|
+
"button",
|
|
1579
|
+
{
|
|
1580
|
+
type: "button",
|
|
1581
|
+
className: "yudao-boards-top-btn",
|
|
1582
|
+
onClick: () => commandService.syncExecuteCommand(ToggleBoardInspectorOperation.id),
|
|
1583
|
+
title: "\u5207\u6362\u53F3\u4FA7\u5C5E\u6027\u68C0\u67E5\u5668",
|
|
1584
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardInspectorIcon, {})
|
|
1585
|
+
}
|
|
1586
|
+
)
|
|
1587
|
+
] })
|
|
1588
|
+
]
|
|
1589
|
+
}
|
|
1590
|
+
),
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1592
|
+
"div",
|
|
1593
|
+
{
|
|
1594
|
+
className: "yudao-boards-creation-dock",
|
|
1595
|
+
"data-testid": "boards-creation-dock",
|
|
1596
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
1597
|
+
children: [
|
|
1598
|
+
dockItems.map((item) => {
|
|
1599
|
+
const isActive = activeTool === item.tool;
|
|
1600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1601
|
+
"button",
|
|
1602
|
+
{
|
|
1603
|
+
type: "button",
|
|
1604
|
+
className: `yudao-boards-dock-btn ${isActive ? "is-active" : ""}`,
|
|
1605
|
+
title: item.label,
|
|
1606
|
+
"data-testid": `boards-dock-${item.tool}`,
|
|
1607
|
+
onClick: () => {
|
|
1608
|
+
if (item.onClick) {
|
|
1609
|
+
item.onClick();
|
|
1610
|
+
} else {
|
|
1611
|
+
selectionService.setActiveTool(item.tool);
|
|
1612
|
+
setShapeMenuOpen(false);
|
|
1613
|
+
setWidgetMenuOpen(false);
|
|
1614
|
+
}
|
|
1615
|
+
},
|
|
1616
|
+
children: [
|
|
1617
|
+
item.icon,
|
|
1618
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-dock-label", children: item.label })
|
|
1619
|
+
]
|
|
1620
|
+
},
|
|
1621
|
+
item.tool
|
|
1622
|
+
);
|
|
1623
|
+
}),
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-dock-divider" }),
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1626
|
+
"button",
|
|
1627
|
+
{
|
|
1628
|
+
type: "button",
|
|
1629
|
+
className: "yudao-boards-dock-btn is-mermaid",
|
|
1630
|
+
"data-testid": "boards-dock-mermaid",
|
|
1631
|
+
title: "\u6D41\u7A0B\u56FE\u4EE3\u7801\u4E92\u8F6C (Mermaid)",
|
|
1632
|
+
onClick: () => commandService.syncExecuteCommand(OpenBoardMermaidModalOperation.id, { open: true }),
|
|
1633
|
+
children: [
|
|
1634
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardMermaidIcon, {}),
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-dock-label", children: "\u6D41\u7A0B\u56FE\u4EE3\u7801\u4E92\u8F6C (Mermaid)" })
|
|
1636
|
+
]
|
|
1637
|
+
}
|
|
1638
|
+
),
|
|
1639
|
+
shapeMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-dock-popover", "data-testid": "boards-shape-popover", children: QUICK_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1640
|
+
"button",
|
|
1641
|
+
{
|
|
1642
|
+
type: "button",
|
|
1643
|
+
className: activeShapeType === s.type ? "is-selected" : "",
|
|
1644
|
+
onClick: () => {
|
|
1645
|
+
selectionService.setActiveShapeType(s.type);
|
|
1646
|
+
selectionService.setActiveTool("shape");
|
|
1647
|
+
setShapeMenuOpen(false);
|
|
1648
|
+
},
|
|
1649
|
+
children: s.label
|
|
1650
|
+
},
|
|
1651
|
+
s.type
|
|
1652
|
+
)) }),
|
|
1653
|
+
widgetMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-dock-popover", children: [
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1655
|
+
"button",
|
|
1656
|
+
{
|
|
1657
|
+
type: "button",
|
|
1658
|
+
onClick: () => {
|
|
1659
|
+
selectionService.setActiveTool("chart");
|
|
1660
|
+
setWidgetMenuOpen(false);
|
|
1661
|
+
},
|
|
1662
|
+
children: "\u63D2\u5165\u77E2\u91CF\u56FE\u8868 (Chart)"
|
|
1663
|
+
}
|
|
1664
|
+
),
|
|
1665
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1666
|
+
"button",
|
|
1667
|
+
{
|
|
1668
|
+
type: "button",
|
|
1669
|
+
onClick: () => {
|
|
1670
|
+
selectionService.setActiveTool("table");
|
|
1671
|
+
setWidgetMenuOpen(false);
|
|
1672
|
+
},
|
|
1673
|
+
children: "\u63D2\u5165\u6570\u636E\u7F51\u683C\u8868 (Table)"
|
|
1674
|
+
}
|
|
1675
|
+
)
|
|
1676
|
+
] })
|
|
1677
|
+
]
|
|
1678
|
+
}
|
|
1679
|
+
),
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1681
|
+
"div",
|
|
1682
|
+
{
|
|
1683
|
+
className: "yudao-boards-world",
|
|
1684
|
+
style: {
|
|
1685
|
+
transform: `translate(${panX}px, ${panY}px) scale(${zoom})`,
|
|
1686
|
+
transformOrigin: "0 0"
|
|
1687
|
+
},
|
|
1688
|
+
children: [
|
|
1689
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { className: "yudao-boards-vector-overlay", overflow: "visible", children: [
|
|
1690
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("defs", { children: [
|
|
1691
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1692
|
+
"marker",
|
|
1693
|
+
{
|
|
1694
|
+
id: "canvas-marker-arrow",
|
|
1695
|
+
viewBox: "0 0 10 10",
|
|
1696
|
+
refX: "9",
|
|
1697
|
+
refY: "5",
|
|
1698
|
+
markerWidth: "7",
|
|
1699
|
+
markerHeight: "7",
|
|
1700
|
+
orient: "auto-start-reverse",
|
|
1701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M 0 1.5 L 9 5 L 0 8.5 z", fill: "context-stroke" })
|
|
1702
|
+
}
|
|
1703
|
+
),
|
|
1704
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1705
|
+
"marker",
|
|
1706
|
+
{
|
|
1707
|
+
id: "canvas-marker-triangle",
|
|
1708
|
+
viewBox: "0 0 12 12",
|
|
1709
|
+
refX: "11",
|
|
1710
|
+
refY: "6",
|
|
1711
|
+
markerWidth: "9",
|
|
1712
|
+
markerHeight: "9",
|
|
1713
|
+
orient: "auto-start-reverse",
|
|
1714
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1715
|
+
"path",
|
|
1716
|
+
{
|
|
1717
|
+
d: "M 1 1.5 L 11 6 L 1 10.5 z",
|
|
1718
|
+
fill: "#FFFFFF",
|
|
1719
|
+
stroke: "context-stroke",
|
|
1720
|
+
strokeWidth: "1.5"
|
|
1721
|
+
}
|
|
1722
|
+
)
|
|
1723
|
+
}
|
|
1724
|
+
),
|
|
1725
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1726
|
+
"marker",
|
|
1727
|
+
{
|
|
1728
|
+
id: "canvas-marker-diamond",
|
|
1729
|
+
viewBox: "0 0 14 10",
|
|
1730
|
+
refX: "13",
|
|
1731
|
+
refY: "5",
|
|
1732
|
+
markerWidth: "10",
|
|
1733
|
+
markerHeight: "8",
|
|
1734
|
+
orient: "auto-start-reverse",
|
|
1735
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1736
|
+
"path",
|
|
1737
|
+
{
|
|
1738
|
+
d: "M 1 5 L 7 1 L 13 5 L 7 9 z",
|
|
1739
|
+
fill: "#FFFFFF",
|
|
1740
|
+
stroke: "context-stroke",
|
|
1741
|
+
strokeWidth: "1.5"
|
|
1742
|
+
}
|
|
1743
|
+
)
|
|
1744
|
+
}
|
|
1745
|
+
),
|
|
1746
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1747
|
+
"marker",
|
|
1748
|
+
{
|
|
1749
|
+
id: "canvas-marker-filledDiamond",
|
|
1750
|
+
viewBox: "0 0 14 10",
|
|
1751
|
+
refX: "13",
|
|
1752
|
+
refY: "5",
|
|
1753
|
+
markerWidth: "10",
|
|
1754
|
+
markerHeight: "8",
|
|
1755
|
+
orient: "auto-start-reverse",
|
|
1756
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M 1 5 L 7 1 L 13 5 L 7 9 z", fill: "context-stroke" })
|
|
1757
|
+
}
|
|
1758
|
+
),
|
|
1759
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1760
|
+
"marker",
|
|
1761
|
+
{
|
|
1762
|
+
id: "canvas-marker-crowsFootOne",
|
|
1763
|
+
viewBox: "0 0 12 12",
|
|
1764
|
+
refX: "10",
|
|
1765
|
+
refY: "6",
|
|
1766
|
+
markerWidth: "9",
|
|
1767
|
+
markerHeight: "9",
|
|
1768
|
+
orient: "auto-start-reverse",
|
|
1769
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1770
|
+
"path",
|
|
1771
|
+
{
|
|
1772
|
+
d: "M 6 1 L 6 11 M 10 1 L 10 11",
|
|
1773
|
+
fill: "none",
|
|
1774
|
+
stroke: "context-stroke",
|
|
1775
|
+
strokeWidth: "1.6"
|
|
1776
|
+
}
|
|
1777
|
+
)
|
|
1778
|
+
}
|
|
1779
|
+
),
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1781
|
+
"marker",
|
|
1782
|
+
{
|
|
1783
|
+
id: "canvas-marker-crowsFootMany",
|
|
1784
|
+
viewBox: "0 0 14 12",
|
|
1785
|
+
refX: "12",
|
|
1786
|
+
refY: "6",
|
|
1787
|
+
markerWidth: "10",
|
|
1788
|
+
markerHeight: "9",
|
|
1789
|
+
orient: "auto-start-reverse",
|
|
1790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1791
|
+
"path",
|
|
1792
|
+
{
|
|
1793
|
+
d: "M 2 6 L 12 1 M 2 6 L 12 6 M 2 6 L 12 11 M 2 1 L 2 11",
|
|
1794
|
+
fill: "none",
|
|
1795
|
+
stroke: "context-stroke",
|
|
1796
|
+
strokeWidth: "1.5"
|
|
1797
|
+
}
|
|
1798
|
+
)
|
|
1799
|
+
}
|
|
1800
|
+
)
|
|
1801
|
+
] }),
|
|
1802
|
+
visibleMindmaps.map((mm) => {
|
|
1803
|
+
if (!mm.parentId) return null;
|
|
1804
|
+
const parent = effectiveElementsMap[mm.parentId];
|
|
1805
|
+
if (!parent || parent.type !== "mindmap" || parent.collapsed) return null;
|
|
1806
|
+
const isLeft = mm.x + mm.width / 2 < parent.x + parent.width / 2;
|
|
1807
|
+
const sx = isLeft ? parent.x : parent.x + parent.width;
|
|
1808
|
+
const sy = parent.y + parent.height / 2;
|
|
1809
|
+
const ex = isLeft ? mm.x + mm.width : mm.x;
|
|
1810
|
+
const ey = mm.y + mm.height / 2;
|
|
1811
|
+
const mx = (sx + ex) / 2;
|
|
1812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1813
|
+
"path",
|
|
1814
|
+
{
|
|
1815
|
+
d: `M ${sx} ${sy} C ${mx} ${sy}, ${mx} ${ey}, ${ex} ${ey}`,
|
|
1816
|
+
fill: "none",
|
|
1817
|
+
stroke: mm.branchColor || parent.branchColor || "#2563EB",
|
|
1818
|
+
strokeWidth: 2.4,
|
|
1819
|
+
strokeLinecap: "round"
|
|
1820
|
+
},
|
|
1821
|
+
`mm-branch-${mm.id}`
|
|
1822
|
+
);
|
|
1823
|
+
}),
|
|
1824
|
+
connectors.map((conn) => {
|
|
1825
|
+
const routed = (0, import_univer_boards2.computeBoardConnectorPath)(conn, effectiveElementsMap);
|
|
1826
|
+
const isSelected = selectedIds.includes(conn.id);
|
|
1827
|
+
const mStart = conn.startMarker && conn.startMarker !== "none" ? `url(#canvas-marker-${conn.startMarker})` : void 0;
|
|
1828
|
+
const mEnd = conn.endMarker && conn.endMarker !== "none" ? `url(#canvas-marker-${conn.endMarker})` : void 0;
|
|
1829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1830
|
+
"g",
|
|
1831
|
+
{
|
|
1832
|
+
"data-element-id": conn.id,
|
|
1833
|
+
"data-element-type": "connector",
|
|
1834
|
+
className: "yudao-boards-connector-group",
|
|
1835
|
+
onPointerDown: (e) => {
|
|
1836
|
+
e.stopPropagation();
|
|
1837
|
+
selectionService.selectElements([conn.id]);
|
|
1838
|
+
},
|
|
1839
|
+
children: [
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1841
|
+
"path",
|
|
1842
|
+
{
|
|
1843
|
+
d: routed.svgPath,
|
|
1844
|
+
fill: "none",
|
|
1845
|
+
stroke: "transparent",
|
|
1846
|
+
strokeWidth: 14,
|
|
1847
|
+
style: { pointerEvents: "stroke", cursor: "pointer" }
|
|
1848
|
+
}
|
|
1849
|
+
),
|
|
1850
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1851
|
+
"path",
|
|
1852
|
+
{
|
|
1853
|
+
d: routed.svgPath,
|
|
1854
|
+
fill: "none",
|
|
1855
|
+
stroke: isSelected ? "#2563EB" : conn.stroke,
|
|
1856
|
+
strokeWidth: isSelected ? conn.strokeWidth + 1 : conn.strokeWidth,
|
|
1857
|
+
strokeDasharray: conn.dashed ? "6 4" : void 0,
|
|
1858
|
+
strokeLinecap: "round",
|
|
1859
|
+
strokeLinejoin: "round",
|
|
1860
|
+
markerStart: mStart,
|
|
1861
|
+
markerEnd: mEnd
|
|
1862
|
+
}
|
|
1863
|
+
),
|
|
1864
|
+
conn.label && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { transform: `translate(${routed.labelPosition.x}, ${routed.labelPosition.y})`, children: [
|
|
1865
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1866
|
+
"rect",
|
|
1867
|
+
{
|
|
1868
|
+
x: -Math.max(24, conn.label.length * 6 + 8),
|
|
1869
|
+
y: -11,
|
|
1870
|
+
width: Math.max(48, conn.label.length * 12 + 16),
|
|
1871
|
+
height: 22,
|
|
1872
|
+
rx: 6,
|
|
1873
|
+
fill: "#FFFFFF",
|
|
1874
|
+
stroke: isSelected ? "#2563EB" : "#CBD5E1",
|
|
1875
|
+
strokeWidth: 1
|
|
1876
|
+
}
|
|
1877
|
+
),
|
|
1878
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1879
|
+
"text",
|
|
1880
|
+
{
|
|
1881
|
+
x: 0,
|
|
1882
|
+
y: 4,
|
|
1883
|
+
textAnchor: "middle",
|
|
1884
|
+
fontSize: 11,
|
|
1885
|
+
fontWeight: 600,
|
|
1886
|
+
fill: "#334155",
|
|
1887
|
+
children: conn.label
|
|
1888
|
+
}
|
|
1889
|
+
)
|
|
1890
|
+
] })
|
|
1891
|
+
]
|
|
1892
|
+
},
|
|
1893
|
+
conn.id
|
|
1894
|
+
);
|
|
1895
|
+
}),
|
|
1896
|
+
orderedElements.filter((el) => el.type === "ink").map((ink) => {
|
|
1897
|
+
if (ink.type !== "ink" || ink.points.length === 0) return null;
|
|
1898
|
+
const d = ink.points.map((p, idx) => `${idx === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
1899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1900
|
+
"path",
|
|
1901
|
+
{
|
|
1902
|
+
"data-element-id": ink.id,
|
|
1903
|
+
d,
|
|
1904
|
+
fill: "none",
|
|
1905
|
+
stroke: ink.stroke,
|
|
1906
|
+
strokeWidth: ink.strokeWidth,
|
|
1907
|
+
opacity: ink.opacity,
|
|
1908
|
+
strokeLinecap: "round",
|
|
1909
|
+
strokeLinejoin: "round",
|
|
1910
|
+
style: { pointerEvents: "stroke", cursor: "pointer" },
|
|
1911
|
+
onPointerDown: (e) => handleElementPointerDown(e, ink)
|
|
1912
|
+
},
|
|
1913
|
+
ink.id
|
|
1914
|
+
);
|
|
1915
|
+
}),
|
|
1916
|
+
inkDraft && inkDraft.length >= 2 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1917
|
+
"path",
|
|
1918
|
+
{
|
|
1919
|
+
d: inkDraft.map((p, idx) => `${idx === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" "),
|
|
1920
|
+
fill: "none",
|
|
1921
|
+
stroke: "#2563EB",
|
|
1922
|
+
strokeWidth: 3,
|
|
1923
|
+
strokeLinecap: "round",
|
|
1924
|
+
strokeLinejoin: "round"
|
|
1925
|
+
}
|
|
1926
|
+
),
|
|
1927
|
+
connectingDraft && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1928
|
+
"line",
|
|
1929
|
+
{
|
|
1930
|
+
x1: connectingDraft.startX,
|
|
1931
|
+
y1: connectingDraft.startY,
|
|
1932
|
+
x2: connectingDraft.currX,
|
|
1933
|
+
y2: connectingDraft.currY,
|
|
1934
|
+
stroke: "#2563EB",
|
|
1935
|
+
strokeWidth: 2,
|
|
1936
|
+
strokeDasharray: "5 4",
|
|
1937
|
+
markerEnd: "url(#canvas-marker-arrow)"
|
|
1938
|
+
}
|
|
1939
|
+
),
|
|
1940
|
+
laserTrail.length >= 2 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1941
|
+
"polyline",
|
|
1942
|
+
{
|
|
1943
|
+
points: laserTrail.map((p) => `${p.x},${p.y}`).join(" "),
|
|
1944
|
+
fill: "none",
|
|
1945
|
+
stroke: "#EF4444",
|
|
1946
|
+
strokeWidth: 4,
|
|
1947
|
+
strokeLinecap: "round",
|
|
1948
|
+
strokeLinejoin: "round",
|
|
1949
|
+
opacity: 0.85
|
|
1950
|
+
}
|
|
1951
|
+
)
|
|
1952
|
+
] }),
|
|
1953
|
+
orderedElements.map((el) => {
|
|
1954
|
+
if (el.type === "connector" || el.type === "ink") return null;
|
|
1955
|
+
if (el.type === "mindmap" && (0, import_univer_boards2.isMindmapNodeCollapsedHidden)(el, effectiveElementsMap)) {
|
|
1956
|
+
return null;
|
|
1957
|
+
}
|
|
1958
|
+
const isSelected = selectedIds.includes(el.id);
|
|
1959
|
+
const isEditing = editingId === el.id;
|
|
1960
|
+
const isHovered = hoveredElementId === el.id;
|
|
1961
|
+
const showPorts = el.type !== "frame" && el.type !== "swimlane" && (isHovered || isSelected || activeTool === "connector");
|
|
1962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1963
|
+
"div",
|
|
1964
|
+
{
|
|
1965
|
+
"data-element-id": el.id,
|
|
1966
|
+
"data-element-type": el.type,
|
|
1967
|
+
className: `yudao-boards-element is-${el.type} ${isSelected ? "is-selected" : ""}`,
|
|
1968
|
+
style: {
|
|
1969
|
+
left: el.x,
|
|
1970
|
+
top: el.y,
|
|
1971
|
+
width: el.width,
|
|
1972
|
+
height: el.height,
|
|
1973
|
+
transform: el.rotation ? `rotate(${el.rotation}deg)` : void 0
|
|
1974
|
+
},
|
|
1975
|
+
onPointerEnter: () => setHoveredElementId(el.id),
|
|
1976
|
+
onPointerLeave: () => setHoveredElementId((curr) => curr === el.id ? null : curr),
|
|
1977
|
+
onPointerDown: (e) => handleElementPointerDown(e, el),
|
|
1978
|
+
onDoubleClick: (e) => {
|
|
1979
|
+
e.stopPropagation();
|
|
1980
|
+
startInlineEdit(el);
|
|
1981
|
+
},
|
|
1982
|
+
children: [
|
|
1983
|
+
el.type === "frame" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1984
|
+
"div",
|
|
1985
|
+
{
|
|
1986
|
+
className: "yudao-boards-frame-box",
|
|
1987
|
+
style: {
|
|
1988
|
+
backgroundColor: el.backgroundColor ?? "#FFFFFF",
|
|
1989
|
+
borderColor: el.borderColor ?? "#CBD5E1"
|
|
1990
|
+
},
|
|
1991
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-frame-header-pill", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1992
|
+
"input",
|
|
1993
|
+
{
|
|
1994
|
+
autoFocus: true,
|
|
1995
|
+
value: editingDraft,
|
|
1996
|
+
onChange: (e) => setEditingDraft(e.target.value),
|
|
1997
|
+
onBlur: commitInlineEdit,
|
|
1998
|
+
onKeyDown: (e) => e.key === "Enter" && commitInlineEdit()
|
|
1999
|
+
}
|
|
2000
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: el.title }) })
|
|
2001
|
+
}
|
|
2002
|
+
),
|
|
2003
|
+
el.type === "swimlane" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2004
|
+
"div",
|
|
2005
|
+
{
|
|
2006
|
+
className: "yudao-boards-swimlane-box",
|
|
2007
|
+
style: { borderColor: el.borderColor ?? "#94A3B8" },
|
|
2008
|
+
children: [
|
|
2009
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-swimlane-header", children: el.title }),
|
|
2010
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2011
|
+
"div",
|
|
2012
|
+
{
|
|
2013
|
+
className: `yudao-boards-swimlane-lanes is-${el.orientation}`,
|
|
2014
|
+
children: el.lanes.map((lane) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2015
|
+
"div",
|
|
2016
|
+
{
|
|
2017
|
+
className: "yudao-boards-swimlane-lane",
|
|
2018
|
+
style: { backgroundColor: lane.color ?? "#F8FAFC" },
|
|
2019
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-swimlane-lane-title", children: lane.title })
|
|
2020
|
+
},
|
|
2021
|
+
lane.id
|
|
2022
|
+
))
|
|
2023
|
+
}
|
|
2024
|
+
)
|
|
2025
|
+
]
|
|
2026
|
+
}
|
|
2027
|
+
),
|
|
2028
|
+
el.type === "sticky" && (() => {
|
|
2029
|
+
const sticky = el;
|
|
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 ?? "";
|
|
2058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2059
|
+
"div",
|
|
2060
|
+
{
|
|
2061
|
+
className: "yudao-boards-sticky-card",
|
|
2062
|
+
style: {
|
|
2063
|
+
backgroundColor: pal.fill,
|
|
2064
|
+
borderColor: pal.border,
|
|
2065
|
+
color: pal.text
|
|
2066
|
+
},
|
|
2067
|
+
children: [
|
|
2068
|
+
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2069
|
+
"textarea",
|
|
2070
|
+
{
|
|
2071
|
+
autoFocus: true,
|
|
2072
|
+
className: "yudao-boards-inline-editor",
|
|
2073
|
+
value: editingDraft,
|
|
2074
|
+
onChange: (e) => setEditingDraft(e.target.value),
|
|
2075
|
+
onBlur: commitInlineEdit
|
|
2076
|
+
}
|
|
2077
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-sticky-text", children: sticky.text }),
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-sticky-footer", children: [
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-sticky-author", children: authorLabel }),
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2081
|
+
"button",
|
|
2082
|
+
{
|
|
2083
|
+
type: "button",
|
|
2084
|
+
className: "yudao-boards-vote-btn",
|
|
2085
|
+
"data-testid": `sticky-vote-${sticky.id}`,
|
|
2086
|
+
style: { backgroundColor: pal.badgeFill, borderColor: pal.border },
|
|
2087
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2088
|
+
onClick: (e) => {
|
|
2089
|
+
e.stopPropagation();
|
|
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
|
+
}
|
|
2102
|
+
},
|
|
2103
|
+
children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardVoteThumbIcon, {}),
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
2106
|
+
"+",
|
|
2107
|
+
sticky.votes.length
|
|
2108
|
+
] })
|
|
2109
|
+
]
|
|
2110
|
+
}
|
|
2111
|
+
)
|
|
2112
|
+
] })
|
|
2113
|
+
]
|
|
2114
|
+
}
|
|
2115
|
+
);
|
|
2116
|
+
})(),
|
|
2117
|
+
el.type === "shape" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-shape-card", children: [
|
|
2118
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2119
|
+
"svg",
|
|
2120
|
+
{
|
|
2121
|
+
width: el.width,
|
|
2122
|
+
height: el.height,
|
|
2123
|
+
viewBox: `0 0 ${el.width} ${el.height}`,
|
|
2124
|
+
className: "yudao-boards-shape-svg",
|
|
2125
|
+
children: renderShapeNode(el)
|
|
2126
|
+
}
|
|
2127
|
+
),
|
|
2128
|
+
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2129
|
+
"textarea",
|
|
2130
|
+
{
|
|
2131
|
+
autoFocus: true,
|
|
2132
|
+
className: "yudao-boards-inline-editor is-centered",
|
|
2133
|
+
value: editingDraft,
|
|
2134
|
+
onChange: (e) => setEditingDraft(e.target.value),
|
|
2135
|
+
onBlur: commitInlineEdit
|
|
2136
|
+
}
|
|
2137
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2138
|
+
"div",
|
|
2139
|
+
{
|
|
2140
|
+
className: `yudao-boards-shape-label ${el.shapeType === "actor" ? "is-actor-label" : ""}`,
|
|
2141
|
+
style: { color: el.textColor, fontSize: el.fontSize ?? 13 },
|
|
2142
|
+
children: el.text
|
|
2143
|
+
}
|
|
2144
|
+
)
|
|
2145
|
+
] }),
|
|
2146
|
+
el.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2147
|
+
"div",
|
|
2148
|
+
{
|
|
2149
|
+
className: "yudao-boards-text-block",
|
|
2150
|
+
style: {
|
|
2151
|
+
fontSize: el.fontSize,
|
|
2152
|
+
fontWeight: el.fontWeight,
|
|
2153
|
+
color: el.color,
|
|
2154
|
+
textAlign: el.align
|
|
2155
|
+
},
|
|
2156
|
+
children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2157
|
+
"textarea",
|
|
2158
|
+
{
|
|
2159
|
+
autoFocus: true,
|
|
2160
|
+
className: "yudao-boards-inline-editor",
|
|
2161
|
+
value: editingDraft,
|
|
2162
|
+
onChange: (e) => setEditingDraft(e.target.value),
|
|
2163
|
+
onBlur: commitInlineEdit
|
|
2164
|
+
}
|
|
2165
|
+
) : el.text
|
|
2166
|
+
}
|
|
2167
|
+
),
|
|
2168
|
+
el.type === "mindmap" && (() => {
|
|
2169
|
+
const mm = el;
|
|
2170
|
+
const isRoot = !mm.parentId;
|
|
2171
|
+
const hasChildren = Object.values(currentSnap.elements).some(
|
|
2172
|
+
(c) => c.type === "mindmap" && c.parentId === mm.id
|
|
2173
|
+
);
|
|
2174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2175
|
+
"div",
|
|
2176
|
+
{
|
|
2177
|
+
className: `yudao-boards-mindmap-pill ${isRoot ? "is-root" : ""}`,
|
|
2178
|
+
style: {
|
|
2179
|
+
backgroundColor: mm.fill ?? (isRoot ? "#2563EB" : "#FFFFFF"),
|
|
2180
|
+
borderColor: mm.branchColor ?? "#2563EB",
|
|
2181
|
+
color: mm.textColor ?? (isRoot ? "#FFFFFF" : "#0F172A")
|
|
2182
|
+
},
|
|
2183
|
+
children: [
|
|
2184
|
+
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2185
|
+
"textarea",
|
|
2186
|
+
{
|
|
2187
|
+
autoFocus: true,
|
|
2188
|
+
className: "yudao-boards-inline-editor is-centered",
|
|
2189
|
+
value: editingDraft,
|
|
2190
|
+
onChange: (e) => setEditingDraft(e.target.value),
|
|
2191
|
+
onBlur: commitInlineEdit
|
|
2192
|
+
}
|
|
2193
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-mindmap-text", children: mm.text }),
|
|
2194
|
+
hasChildren && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2195
|
+
"button",
|
|
2196
|
+
{
|
|
2197
|
+
type: "button",
|
|
2198
|
+
className: "yudao-boards-mm-collapse-btn",
|
|
2199
|
+
title: mm.collapsed ? "\u5C55\u5F00\u5B50\u5206\u652F" : "\u6298\u53E0\u5B50\u5206\u652F",
|
|
2200
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2201
|
+
onClick: (e) => {
|
|
2202
|
+
e.stopPropagation();
|
|
2203
|
+
commandService.syncExecuteCommand(import_univer_boards2.UpdateBoardElementsCommand.id, {
|
|
2204
|
+
unitId,
|
|
2205
|
+
updates: [{ id: mm.id, patch: { collapsed: !mm.collapsed } }]
|
|
2206
|
+
});
|
|
2207
|
+
},
|
|
2208
|
+
children: mm.collapsed ? "+" : "-"
|
|
2209
|
+
}
|
|
2210
|
+
),
|
|
2211
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2212
|
+
"div",
|
|
2213
|
+
{
|
|
2214
|
+
className: "yudao-boards-mm-quick-actions",
|
|
2215
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2216
|
+
children: [
|
|
2217
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2218
|
+
"button",
|
|
2219
|
+
{
|
|
2220
|
+
type: "button",
|
|
2221
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards2.AddMindmapChildCommand.id, {
|
|
2222
|
+
unitId,
|
|
2223
|
+
parentId: mm.id
|
|
2224
|
+
}),
|
|
2225
|
+
children: "+ \u5B50\u8282\u70B9"
|
|
2226
|
+
}
|
|
2227
|
+
),
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2229
|
+
"button",
|
|
2230
|
+
{
|
|
2231
|
+
type: "button",
|
|
2232
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards2.AddMindmapSiblingCommand.id, {
|
|
2233
|
+
unitId,
|
|
2234
|
+
nodeId: mm.id
|
|
2235
|
+
}),
|
|
2236
|
+
children: "+ \u540C\u7EA7"
|
|
2237
|
+
}
|
|
2238
|
+
)
|
|
2239
|
+
]
|
|
2240
|
+
}
|
|
2241
|
+
)
|
|
2242
|
+
]
|
|
2243
|
+
}
|
|
2244
|
+
);
|
|
2245
|
+
})(),
|
|
2246
|
+
el.type === "entityCard" && (() => {
|
|
2247
|
+
const card = el;
|
|
2248
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-entity-card", children: [
|
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2250
|
+
"div",
|
|
2251
|
+
{
|
|
2252
|
+
className: "yudao-boards-entity-header",
|
|
2253
|
+
style: {
|
|
2254
|
+
backgroundColor: card.headerColor ?? (card.cardKind === "uml" ? "#7C3AED" : "#1D4ED8")
|
|
2255
|
+
},
|
|
2256
|
+
children: [
|
|
2257
|
+
card.stereotype && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-entity-stereo", children: [
|
|
2258
|
+
"<<",
|
|
2259
|
+
card.stereotype,
|
|
2260
|
+
">>"
|
|
2261
|
+
] }),
|
|
2262
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-entity-title", children: card.title })
|
|
2263
|
+
]
|
|
2264
|
+
}
|
|
2265
|
+
),
|
|
2266
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-entity-body", children: [
|
|
2267
|
+
card.fields.map((f, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-entity-row", children: [
|
|
2268
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "yudao-boards-entity-col-name", children: [
|
|
2269
|
+
f.pk && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { className: "is-pk", children: "PK" }),
|
|
2270
|
+
f.fk && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { className: "is-fk", children: "FK" }),
|
|
2271
|
+
f.visibility && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { children: f.visibility }),
|
|
2272
|
+
f.name
|
|
2273
|
+
] }),
|
|
2274
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-entity-col-type", children: f.type })
|
|
2275
|
+
] }, `${f.name}-${idx}`)),
|
|
2276
|
+
card.methods && card.methods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-entity-methods", children: card.methods.map((m, mIdx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-entity-method", children: m }, `${m}-${mIdx}`)) })
|
|
2277
|
+
] })
|
|
2278
|
+
] });
|
|
2279
|
+
})(),
|
|
2280
|
+
el.type === "table" && renderInlineTable(el),
|
|
2281
|
+
el.type === "chart" && renderInlineChart(el),
|
|
2282
|
+
el.type === "image" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2283
|
+
"img",
|
|
2284
|
+
{
|
|
2285
|
+
src: el.src,
|
|
2286
|
+
alt: el.caption ?? "board-image",
|
|
2287
|
+
className: "yudao-boards-image-el",
|
|
2288
|
+
style: { objectFit: el.fit ?? "contain" },
|
|
2289
|
+
draggable: false
|
|
2290
|
+
}
|
|
2291
|
+
),
|
|
2292
|
+
showPorts && PORT_SIDES.map((pSide) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2293
|
+
"span",
|
|
2294
|
+
{
|
|
2295
|
+
className: `yudao-boards-port-dot is-${pSide}`,
|
|
2296
|
+
title: `\u62D6\u62FD\u4ECE ${pSide} \u7AEF\u53E3\u521B\u5EFA\u667A\u80FD\u8FDE\u7EBF`,
|
|
2297
|
+
onPointerDown: (e) => handlePortPointerDown(e, el, pSide)
|
|
2298
|
+
},
|
|
2299
|
+
pSide
|
|
2300
|
+
)),
|
|
2301
|
+
isSelected && !el.locked && RESIZE_HANDLES.map((dir) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2302
|
+
"span",
|
|
2303
|
+
{
|
|
2304
|
+
className: `yudao-boards-resize-handle is-${dir}`,
|
|
2305
|
+
onPointerDown: (e) => handleResizePointerDown(e, el, dir)
|
|
2306
|
+
},
|
|
2307
|
+
dir
|
|
2308
|
+
))
|
|
2309
|
+
]
|
|
2310
|
+
},
|
|
2311
|
+
el.id
|
|
2312
|
+
);
|
|
2313
|
+
}),
|
|
2314
|
+
currentSnap.comments.map((pin, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2315
|
+
"div",
|
|
2316
|
+
{
|
|
2317
|
+
className: "yudao-boards-comment-pin",
|
|
2318
|
+
style: { left: pin.x, top: pin.y },
|
|
2319
|
+
title: `${pin.author}: ${pin.text}`,
|
|
2320
|
+
children: [
|
|
2321
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-pin-badge", children: idx + 1 }),
|
|
2322
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-pin-popover", children: [
|
|
2323
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: pin.author }),
|
|
2324
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: pin.text })
|
|
2325
|
+
] })
|
|
2326
|
+
]
|
|
2327
|
+
},
|
|
2328
|
+
pin.id
|
|
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
|
+
}),
|
|
2360
|
+
marqueeBox && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2361
|
+
"div",
|
|
2362
|
+
{
|
|
2363
|
+
className: "yudao-boards-marquee",
|
|
2364
|
+
style: {
|
|
2365
|
+
left: Math.min(marqueeBox.x1, marqueeBox.x2),
|
|
2366
|
+
top: Math.min(marqueeBox.y1, marqueeBox.y2),
|
|
2367
|
+
width: Math.abs(marqueeBox.x2 - marqueeBox.x1),
|
|
2368
|
+
height: Math.abs(marqueeBox.y2 - marqueeBox.y1)
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
)
|
|
2372
|
+
]
|
|
2373
|
+
}
|
|
2374
|
+
),
|
|
2375
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2376
|
+
"div",
|
|
2377
|
+
{
|
|
2378
|
+
className: "yudao-boards-minimap",
|
|
2379
|
+
"data-testid": "boards-minimap",
|
|
2380
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2381
|
+
children: [
|
|
2382
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-minimap-header", children: [
|
|
2383
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u9E70\u773C\u5C0F\u5730\u56FE" }),
|
|
2384
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2385
|
+
"button",
|
|
2386
|
+
{
|
|
2387
|
+
type: "button",
|
|
2388
|
+
title: "\u9002\u5E94\u5C4F\u5E55",
|
|
2389
|
+
onClick: () => commandService.syncExecuteCommand(FitBoardToScreenOperation.id),
|
|
2390
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardFitScreenIcon, {})
|
|
2391
|
+
}
|
|
2392
|
+
)
|
|
2393
|
+
] }),
|
|
2394
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2395
|
+
"svg",
|
|
2396
|
+
{
|
|
2397
|
+
width: minimapW,
|
|
2398
|
+
height: minimapH,
|
|
2399
|
+
viewBox: `0 0 ${minimapW} ${minimapH}`,
|
|
2400
|
+
onClick: handleMinimapClick,
|
|
2401
|
+
children: [
|
|
2402
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { width: minimapW, height: minimapH, rx: 6, fill: "#F1F5F9" }),
|
|
2403
|
+
orderedElements.map((el) => {
|
|
2404
|
+
if (el.type === "connector" || el.type === "ink") return null;
|
|
2405
|
+
const rx = (el.x - worldBounds.x) * mmScale;
|
|
2406
|
+
const ry = (el.y - worldBounds.y) * mmScale;
|
|
2407
|
+
const rw = Math.max(3, el.width * mmScale);
|
|
2408
|
+
const rh = Math.max(2, el.height * mmScale);
|
|
2409
|
+
const fill = el.type === "frame" ? "#E2E8F0" : el.type === "sticky" ? "#FCD34D" : el.type === "entityCard" ? "#C4B5FD" : el.type === "mindmap" ? "#6EE7B7" : "#93C5FD";
|
|
2410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2411
|
+
"rect",
|
|
2412
|
+
{
|
|
2413
|
+
x: rx,
|
|
2414
|
+
y: ry,
|
|
2415
|
+
width: rw,
|
|
2416
|
+
height: rh,
|
|
2417
|
+
rx: 1.5,
|
|
2418
|
+
fill,
|
|
2419
|
+
stroke: "#64748B",
|
|
2420
|
+
strokeWidth: 0.4
|
|
2421
|
+
},
|
|
2422
|
+
`mm-${el.id}`
|
|
2423
|
+
);
|
|
2424
|
+
}),
|
|
2425
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2426
|
+
"rect",
|
|
2427
|
+
{
|
|
2428
|
+
x: (viewWorldX - worldBounds.x) * mmScale,
|
|
2429
|
+
y: (viewWorldY - worldBounds.y) * mmScale,
|
|
2430
|
+
width: Math.max(12, viewWorldW * mmScale),
|
|
2431
|
+
height: Math.max(10, viewWorldH * mmScale),
|
|
2432
|
+
fill: "rgba(37, 99, 235, 0.12)",
|
|
2433
|
+
stroke: "#2563EB",
|
|
2434
|
+
strokeWidth: 1.4,
|
|
2435
|
+
rx: 2
|
|
2436
|
+
}
|
|
2437
|
+
)
|
|
2438
|
+
]
|
|
2439
|
+
}
|
|
2440
|
+
)
|
|
2441
|
+
]
|
|
2442
|
+
}
|
|
2443
|
+
)
|
|
2444
|
+
]
|
|
2445
|
+
}
|
|
2446
|
+
);
|
|
2447
|
+
};
|
|
2448
|
+
|
|
2449
|
+
// src/views/footer/BoardsStatusBar.tsx
|
|
2450
|
+
var import_core3 = require("@univerjs/core");
|
|
2451
|
+
var import_ui3 = require("@univerjs/ui");
|
|
2452
|
+
var import_univer_boards3 = require("@yudaocode/univer-boards");
|
|
2453
|
+
var import_rxjs2 = require("rxjs");
|
|
2454
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2455
|
+
var ZOOM_STEPS = [0.1, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4];
|
|
2456
|
+
var BoardsStatusBar = () => {
|
|
2457
|
+
const instanceService = (0, import_ui3.useDependency)(import_core3.IUniverInstanceService);
|
|
2458
|
+
const commandService = (0, import_ui3.useDependency)(import_core3.ICommandService);
|
|
2459
|
+
const selectionService = (0, import_ui3.useDependency)(import_univer_boards3.IBoardSelectionService);
|
|
2460
|
+
const unit = (0, import_ui3.useObservable)(
|
|
2461
|
+
() => instanceService.getCurrentTypeOfUnit$(import_core3.UniverInstanceType.UNIVER_BOARD),
|
|
2462
|
+
instanceService.getCurrentUnitOfType(import_core3.UniverInstanceType.UNIVER_BOARD),
|
|
2463
|
+
false,
|
|
2464
|
+
[instanceService]
|
|
2465
|
+
);
|
|
2466
|
+
const snapshot = (0, import_ui3.useObservable)(
|
|
2467
|
+
() => unit ? unit.snapshotChanged$ : (0, import_rxjs2.of)(null),
|
|
2468
|
+
unit ? unit.getSnapshot() : null,
|
|
2469
|
+
false,
|
|
2470
|
+
[unit]
|
|
2471
|
+
);
|
|
2472
|
+
const selectedIds = (0, import_ui3.useObservable)(
|
|
2473
|
+
selectionService.selectedIds$,
|
|
2474
|
+
selectionService.getSelectedIds()
|
|
2475
|
+
);
|
|
2476
|
+
const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
|
|
2477
|
+
if (!currentSnap || !unit) return null;
|
|
2478
|
+
const zoom = currentSnap.viewport.zoom;
|
|
2479
|
+
const totalCount = Object.keys(currentSnap.elements).length;
|
|
2480
|
+
const frameCount = currentSnap.frameOrder.length;
|
|
2481
|
+
const setZoom = (nextZoom) => {
|
|
2482
|
+
const clamped = Math.max(0.1, Math.min(4, Number(nextZoom.toFixed(2))));
|
|
2483
|
+
commandService.syncExecuteCommand(import_univer_boards3.SetBoardViewportCommand.id, {
|
|
2484
|
+
unitId: unit.getUnitId(),
|
|
2485
|
+
viewport: { zoom: clamped }
|
|
2486
|
+
});
|
|
2487
|
+
};
|
|
2488
|
+
const cycleGrid = () => {
|
|
2489
|
+
const order = ["dots", "lines", "none"];
|
|
2490
|
+
const next = order[(order.indexOf(currentSnap.gridStyle) + 1) % order.length];
|
|
2491
|
+
commandService.syncExecuteCommand(import_univer_boards3.UpdateBoardPropsCommand.id, {
|
|
2492
|
+
unitId: unit.getUnitId(),
|
|
2493
|
+
patch: { gridStyle: next }
|
|
2494
|
+
});
|
|
2495
|
+
};
|
|
2496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("footer", { className: "yudao-boards-status-bar", "data-testid": "boards-status-bar", children: [
|
|
2497
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "yudao-boards-status-left", children: [
|
|
2498
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
2499
|
+
"\u5143\u7D20\u603B\u6570\uFF1A",
|
|
2500
|
+
totalCount
|
|
2501
|
+
] }),
|
|
2502
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
2503
|
+
"\u6F14\u793A\u753B\u6846\uFF1A",
|
|
2504
|
+
frameCount
|
|
2505
|
+
] }),
|
|
2506
|
+
selectedIds.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
2507
|
+
"\u5DF2\u9009\u4E2D\uFF1A",
|
|
2508
|
+
selectedIds.length
|
|
2509
|
+
] })
|
|
2510
|
+
] }),
|
|
2511
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "yudao-boards-status-right", children: [
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2513
|
+
"button",
|
|
2514
|
+
{
|
|
2515
|
+
type: "button",
|
|
2516
|
+
className: "yudao-boards-status-btn",
|
|
2517
|
+
onClick: cycleGrid,
|
|
2518
|
+
title: "\u5207\u6362\u753B\u5E03\u7F51\u683C\u6837\u5F0F",
|
|
2519
|
+
children: [
|
|
2520
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BoardGridIcon, {}),
|
|
2521
|
+
" \u7F51\u683C: ",
|
|
2522
|
+
currentSnap.gridStyle
|
|
2523
|
+
]
|
|
2524
|
+
}
|
|
2525
|
+
),
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2527
|
+
"button",
|
|
2528
|
+
{
|
|
2529
|
+
type: "button",
|
|
2530
|
+
className: "yudao-boards-status-btn",
|
|
2531
|
+
onClick: () => commandService.syncExecuteCommand(FitBoardToScreenOperation.id),
|
|
2532
|
+
title: "\u9002\u5E94\u5C4F\u5E55",
|
|
2533
|
+
children: [
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BoardFitScreenIcon, {}),
|
|
2535
|
+
" \u9002\u5E94\u5168\u5C4F"
|
|
2536
|
+
]
|
|
2537
|
+
}
|
|
2538
|
+
),
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "yudao-boards-zoom-controls", children: [
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: () => setZoom(zoom - 0.15), children: "-" }),
|
|
2541
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2542
|
+
"select",
|
|
2543
|
+
{
|
|
2544
|
+
value: String(Math.round(zoom * 100)),
|
|
2545
|
+
onChange: (e) => setZoom(Number(e.target.value) / 100),
|
|
2546
|
+
children: [
|
|
2547
|
+
!ZOOM_STEPS.some((z) => Math.round(z * 100) === Math.round(zoom * 100)) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("option", { value: String(Math.round(zoom * 100)), children: [
|
|
2548
|
+
Math.round(zoom * 100),
|
|
2549
|
+
"%"
|
|
2550
|
+
] }),
|
|
2551
|
+
ZOOM_STEPS.map((z) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("option", { value: String(Math.round(z * 100)), children: [
|
|
2552
|
+
Math.round(z * 100),
|
|
2553
|
+
"%"
|
|
2554
|
+
] }, z))
|
|
2555
|
+
]
|
|
2556
|
+
}
|
|
2557
|
+
),
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: () => setZoom(zoom + 0.15), children: "+" })
|
|
2559
|
+
] })
|
|
2560
|
+
] })
|
|
2561
|
+
] });
|
|
2562
|
+
};
|
|
2563
|
+
|
|
2564
|
+
// src/views/inspector/BoardsInspectorPanel.tsx
|
|
2565
|
+
var import_core4 = require("@univerjs/core");
|
|
2566
|
+
var import_ui4 = require("@univerjs/ui");
|
|
2567
|
+
var import_univer_boards4 = require("@yudaocode/univer-boards");
|
|
2568
|
+
var import_rxjs3 = require("rxjs");
|
|
2569
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2570
|
+
var SHAPE_TYPES = [
|
|
2571
|
+
{ value: "rect", label: "\u77E9\u5F62 (Rect)" },
|
|
2572
|
+
{ value: "roundRect", label: "\u5706\u89D2\u77E9\u5F62 (Round)" },
|
|
2573
|
+
{ value: "diamond", label: "\u5224\u5B9A\u83F1\u5F62 (Diamond)" },
|
|
2574
|
+
{ value: "ellipse", label: "\u692D\u5706/\u5706 (Ellipse)" },
|
|
2575
|
+
{ value: "parallelogram", label: "\u5E73\u884C\u56DB\u8FB9\u5F62 (I/O)" },
|
|
2576
|
+
{ value: "cylinder", label: "\u6570\u636E\u5E93\u5706\u67F1 (DB)" },
|
|
2577
|
+
{ value: "hexagon", label: "\u516D\u8FB9\u5F62\u7F51\u5173 (Hex)" },
|
|
2578
|
+
{ value: "cloud", label: "\u4E91\u8282\u70B9 (Cloud)" },
|
|
2579
|
+
{ value: "document", label: "\u6587\u6863\u8282\u70B9 (Doc)" },
|
|
2580
|
+
{ value: "actor", label: "\u53C2\u4E0E\u8005 (Actor)" },
|
|
2581
|
+
{ value: "callout", label: "\u6807\u6CE8\u6C14\u6CE1 (Callout)" }
|
|
2582
|
+
];
|
|
2583
|
+
var MARKER_OPTIONS = [
|
|
2584
|
+
{ value: "none", label: "\u65E0\u7AEF\u70B9 (None)" },
|
|
2585
|
+
{ value: "arrow", label: "\u6807\u51C6\u7BAD\u5934 (Arrow)" },
|
|
2586
|
+
{ value: "triangle", label: "UML \u7EE7\u627F\u7A7A\u5FC3\u4E09\u89D2" },
|
|
2587
|
+
{ value: "diamond", label: "UML \u805A\u5408\u7A7A\u5FC3\u83F1\u5F62" },
|
|
2588
|
+
{ value: "filledDiamond", label: "UML \u7EC4\u5408\u5B9E\u5FC3\u83F1\u5F62" },
|
|
2589
|
+
{ value: "crowsFootOne", label: "ER \u4E00\u5BF9\u4E00 (||)" },
|
|
2590
|
+
{ value: "crowsFootMany", label: "ER \u4E00\u5BF9\u591A (o{)" }
|
|
2591
|
+
];
|
|
2592
|
+
var BoardsInspectorPanel = () => {
|
|
2593
|
+
const instanceService = (0, import_ui4.useDependency)(import_core4.IUniverInstanceService);
|
|
2594
|
+
const commandService = (0, import_ui4.useDependency)(import_core4.ICommandService);
|
|
2595
|
+
const selectionService = (0, import_ui4.useDependency)(import_univer_boards4.IBoardSelectionService);
|
|
2596
|
+
const unit = (0, import_ui4.useObservable)(
|
|
2597
|
+
() => instanceService.getCurrentTypeOfUnit$(import_core4.UniverInstanceType.UNIVER_BOARD),
|
|
2598
|
+
instanceService.getCurrentUnitOfType(import_core4.UniverInstanceType.UNIVER_BOARD),
|
|
2599
|
+
false,
|
|
2600
|
+
[instanceService]
|
|
2601
|
+
);
|
|
2602
|
+
const snapshot = (0, import_ui4.useObservable)(
|
|
2603
|
+
() => unit ? unit.snapshotChanged$ : (0, import_rxjs3.of)(null),
|
|
2604
|
+
unit ? unit.getSnapshot() : null,
|
|
2605
|
+
false,
|
|
2606
|
+
[unit]
|
|
2607
|
+
);
|
|
2608
|
+
const selectedIds = (0, import_ui4.useObservable)(
|
|
2609
|
+
selectionService.selectedIds$,
|
|
2610
|
+
selectionService.getSelectedIds()
|
|
2611
|
+
);
|
|
2612
|
+
const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
|
|
2613
|
+
if (!currentSnap || !unit) {
|
|
2614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector", children: "\u6682\u65E0\u6D3B\u8DC3\u767D\u677F" });
|
|
2615
|
+
}
|
|
2616
|
+
const unitId = unit.getUnitId();
|
|
2617
|
+
const selectedElements = selectedIds.map((id) => currentSnap.elements[id]).filter((el) => Boolean(el));
|
|
2618
|
+
const primary = selectedElements[0] ?? null;
|
|
2619
|
+
const patchElement = (id, patch) => {
|
|
2620
|
+
commandService.syncExecuteCommand(import_univer_boards4.UpdateBoardElementsCommand.id, {
|
|
2621
|
+
unitId,
|
|
2622
|
+
updates: [{ id, patch }]
|
|
2623
|
+
});
|
|
2624
|
+
};
|
|
2625
|
+
const runAlign = (alignment) => {
|
|
2626
|
+
commandService.syncExecuteCommand(import_univer_boards4.AlignBoardElementsCommand.id, {
|
|
2627
|
+
unitId,
|
|
2628
|
+
elementIds: selectedIds,
|
|
2629
|
+
alignment
|
|
2630
|
+
});
|
|
2631
|
+
};
|
|
2632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector", "data-testid": "boards-inspector-panel", children: [
|
|
2633
|
+
selectedElements.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
|
|
2634
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u753B\u5E03\u5168\u5C40\u8BBE\u7F6E" }),
|
|
2635
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2636
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u767D\u677F\u540D\u79F0" }),
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2638
|
+
"input",
|
|
2639
|
+
{
|
|
2640
|
+
type: "text",
|
|
2641
|
+
value: currentSnap.name,
|
|
2642
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_boards4.UpdateBoardPropsCommand.id, {
|
|
2643
|
+
unitId,
|
|
2644
|
+
patch: { name: e.target.value }
|
|
2645
|
+
})
|
|
2646
|
+
}
|
|
2647
|
+
)
|
|
2648
|
+
] }),
|
|
2649
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2650
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7F51\u683C\u6837\u5F0F" }),
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2652
|
+
"select",
|
|
2653
|
+
{
|
|
2654
|
+
value: currentSnap.gridStyle,
|
|
2655
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_boards4.UpdateBoardPropsCommand.id, {
|
|
2656
|
+
unitId,
|
|
2657
|
+
patch: { gridStyle: e.target.value }
|
|
2658
|
+
}),
|
|
2659
|
+
children: [
|
|
2660
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "dots", children: "\u70B9\u9635\u7F51\u683C (Dots)" }),
|
|
2661
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "lines", children: "\u65B9\u683C\u8F85\u52A9\u7EBF (Lines)" }),
|
|
2662
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "none", children: "\u7EAF\u8272\u65E0\u7F51\u683C (None)" })
|
|
2663
|
+
]
|
|
2664
|
+
}
|
|
2665
|
+
)
|
|
2666
|
+
] }),
|
|
2667
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2668
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u753B\u5E03\u5E95\u8272" }),
|
|
2669
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2670
|
+
"input",
|
|
2671
|
+
{
|
|
2672
|
+
type: "color",
|
|
2673
|
+
value: currentSnap.backgroundColor || "#F8FAFC",
|
|
2674
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_boards4.UpdateBoardPropsCommand.id, {
|
|
2675
|
+
unitId,
|
|
2676
|
+
patch: { backgroundColor: e.target.value }
|
|
2677
|
+
})
|
|
2678
|
+
}
|
|
2679
|
+
)
|
|
2680
|
+
] }),
|
|
2681
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-checkbox-label", children: [
|
|
2682
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2683
|
+
"input",
|
|
2684
|
+
{
|
|
2685
|
+
type: "checkbox",
|
|
2686
|
+
checked: currentSnap.snapToGrid !== false,
|
|
2687
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_boards4.UpdateBoardPropsCommand.id, {
|
|
2688
|
+
unitId,
|
|
2689
|
+
patch: { snapToGrid: e.target.checked }
|
|
2690
|
+
})
|
|
2691
|
+
}
|
|
2692
|
+
),
|
|
2693
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u542F\u7528\u7F51\u683C\u667A\u80FD\u5438\u9644\u5BF9\u9F50" })
|
|
2694
|
+
] })
|
|
2695
|
+
] }),
|
|
2696
|
+
selectedElements.length >= 1 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-heading", children: [
|
|
2698
|
+
"\u5DF2\u9009\u4E2D ",
|
|
2699
|
+
selectedElements.length,
|
|
2700
|
+
" \u4E2A\u5143\u7D20 (",
|
|
2701
|
+
primary?.type,
|
|
2702
|
+
")"
|
|
2703
|
+
] }),
|
|
2704
|
+
selectedElements.length >= 2 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-align-bar", "data-testid": "boards-align-bar", children: [
|
|
2705
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u5DE6\u5BF9\u9F50", onClick: () => runAlign("left"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardAlignLeftIcon, {}) }),
|
|
2706
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u6C34\u5E73\u5C45\u4E2D", onClick: () => runAlign("center"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardAlignCenterIcon, {}) }),
|
|
2707
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u53F3\u5BF9\u9F50", onClick: () => runAlign("right"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardAlignRightIcon, {}) }),
|
|
2708
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u9876\u5BF9\u9F50", onClick: () => runAlign("top"), children: "\u9876" }),
|
|
2709
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u5782\u76F4\u5C45\u4E2D", onClick: () => runAlign("middle"), children: "\u4E2D" }),
|
|
2710
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u5E95\u5BF9\u9F50", onClick: () => runAlign("bottom"), children: "\u5E95" }),
|
|
2711
|
+
selectedElements.length >= 3 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u6C34\u5E73\u7B49\u8DDD\u5206\u5E03", onClick: () => runAlign("distribute-h"), children: "\u7B49\u5BBD\u8DDD" }),
|
|
2713
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u5782\u76F4\u7B49\u8DDD\u5206\u5E03", onClick: () => runAlign("distribute-v"), children: "\u7B49\u9AD8\u8DDD" })
|
|
2714
|
+
] })
|
|
2715
|
+
] }),
|
|
2716
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inline-actions", children: [
|
|
2717
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2718
|
+
"button",
|
|
2719
|
+
{
|
|
2720
|
+
type: "button",
|
|
2721
|
+
className: "yudao-boards-mini-btn",
|
|
2722
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards4.GroupBoardElementsInFrameCommand.id, {
|
|
2723
|
+
unitId,
|
|
2724
|
+
elementIds: selectedIds
|
|
2725
|
+
}),
|
|
2726
|
+
children: "\u6253\u5305\u4E3A\u6F14\u793A\u753B\u6846"
|
|
2727
|
+
}
|
|
2728
|
+
),
|
|
2729
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2730
|
+
"button",
|
|
2731
|
+
{
|
|
2732
|
+
type: "button",
|
|
2733
|
+
className: "yudao-boards-mini-btn is-danger",
|
|
2734
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards4.DeleteBoardElementsCommand.id, {
|
|
2735
|
+
unitId,
|
|
2736
|
+
elementIds: selectedIds
|
|
2737
|
+
}),
|
|
2738
|
+
children: [
|
|
2739
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardTrashIcon, {}),
|
|
2740
|
+
" \u5220\u9664"
|
|
2741
|
+
]
|
|
2742
|
+
}
|
|
2743
|
+
)
|
|
2744
|
+
] })
|
|
2745
|
+
] }),
|
|
2746
|
+
primary && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
|
|
2747
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u5750\u6807\u4E0E\u5C3A\u5BF8" }),
|
|
2748
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-coord-grid", children: [
|
|
2749
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
2750
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "X" }),
|
|
2751
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2752
|
+
"input",
|
|
2753
|
+
{
|
|
2754
|
+
type: "number",
|
|
2755
|
+
value: Math.round(primary.x),
|
|
2756
|
+
onChange: (e) => patchElement(primary.id, { x: Number(e.target.value) || 0 })
|
|
2757
|
+
}
|
|
2758
|
+
)
|
|
2759
|
+
] }),
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
2761
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Y" }),
|
|
2762
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2763
|
+
"input",
|
|
2764
|
+
{
|
|
2765
|
+
type: "number",
|
|
2766
|
+
value: Math.round(primary.y),
|
|
2767
|
+
onChange: (e) => patchElement(primary.id, { y: Number(e.target.value) || 0 })
|
|
2768
|
+
}
|
|
2769
|
+
)
|
|
2770
|
+
] }),
|
|
2771
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "W" }),
|
|
2773
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2774
|
+
"input",
|
|
2775
|
+
{
|
|
2776
|
+
type: "number",
|
|
2777
|
+
value: Math.round(primary.width),
|
|
2778
|
+
onChange: (e) => patchElement(primary.id, { width: Math.max(24, Number(e.target.value) || 24) })
|
|
2779
|
+
}
|
|
2780
|
+
)
|
|
2781
|
+
] }),
|
|
2782
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
2783
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "H" }),
|
|
2784
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2785
|
+
"input",
|
|
2786
|
+
{
|
|
2787
|
+
type: "number",
|
|
2788
|
+
value: Math.round(primary.height),
|
|
2789
|
+
onChange: (e) => patchElement(primary.id, { height: Math.max(20, Number(e.target.value) || 20) })
|
|
2790
|
+
}
|
|
2791
|
+
)
|
|
2792
|
+
] })
|
|
2793
|
+
] })
|
|
2794
|
+
] }),
|
|
2795
|
+
primary?.type === "shape" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
|
|
2796
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u6D41\u7A0B\u56FE\u5F62\u72B6\u5916\u89C2" }),
|
|
2797
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2798
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u51E0\u4F55\u7C7B\u578B" }),
|
|
2799
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2800
|
+
"select",
|
|
2801
|
+
{
|
|
2802
|
+
value: primary.shapeType,
|
|
2803
|
+
onChange: (e) => patchElement(primary.id, { shapeType: e.target.value }),
|
|
2804
|
+
children: SHAPE_TYPES.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
2805
|
+
}
|
|
2806
|
+
)
|
|
2807
|
+
] }),
|
|
2808
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2809
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u586B\u5145\u8272" }),
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2811
|
+
"input",
|
|
2812
|
+
{
|
|
2813
|
+
type: "color",
|
|
2814
|
+
value: primary.fill,
|
|
2815
|
+
onChange: (e) => patchElement(primary.id, { fill: e.target.value })
|
|
2816
|
+
}
|
|
2817
|
+
)
|
|
2818
|
+
] }),
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2820
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u63CF\u8FB9\u8272" }),
|
|
2821
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2822
|
+
"input",
|
|
2823
|
+
{
|
|
2824
|
+
type: "color",
|
|
2825
|
+
value: primary.stroke,
|
|
2826
|
+
onChange: (e) => patchElement(primary.id, { stroke: e.target.value })
|
|
2827
|
+
}
|
|
2828
|
+
)
|
|
2829
|
+
] }),
|
|
2830
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2831
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6587\u5B57\u8272" }),
|
|
2832
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2833
|
+
"input",
|
|
2834
|
+
{
|
|
2835
|
+
type: "color",
|
|
2836
|
+
value: primary.textColor,
|
|
2837
|
+
onChange: (e) => patchElement(primary.id, { textColor: e.target.value })
|
|
2838
|
+
}
|
|
2839
|
+
)
|
|
2840
|
+
] })
|
|
2841
|
+
] }),
|
|
2842
|
+
primary?.type === "sticky" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u534F\u4F5C\u4FBF\u7B7E\u6837\u5F0F" }),
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-swatch-row", children: Object.keys(import_univer_boards4.BOARD_STICKY_PALETTE).map((cKey) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2845
|
+
"button",
|
|
2846
|
+
{
|
|
2847
|
+
type: "button",
|
|
2848
|
+
className: `yudao-boards-color-dot ${primary.color === cKey ? "is-selected" : ""}`,
|
|
2849
|
+
style: { backgroundColor: import_univer_boards4.BOARD_STICKY_PALETTE[cKey].fill, borderColor: import_univer_boards4.BOARD_STICKY_PALETTE[cKey].border },
|
|
2850
|
+
onClick: () => patchElement(primary.id, { color: cKey }),
|
|
2851
|
+
title: cKey
|
|
2852
|
+
},
|
|
2853
|
+
cKey
|
|
2854
|
+
)) }),
|
|
2855
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2856
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7F72\u540D\u4F5C\u8005" }),
|
|
2857
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2858
|
+
"input",
|
|
2859
|
+
{
|
|
2860
|
+
type: "text",
|
|
2861
|
+
value: primary.author ?? "",
|
|
2862
|
+
onChange: (e) => patchElement(primary.id, { author: e.target.value })
|
|
2863
|
+
}
|
|
2864
|
+
)
|
|
2865
|
+
] }),
|
|
2866
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-hint-box", children: [
|
|
2867
|
+
"\u5F53\u524D\u8D5E\u540C\u7968\u6570\uFF1A",
|
|
2868
|
+
primary.votes.length,
|
|
2869
|
+
" \u7968"
|
|
2870
|
+
] })
|
|
2871
|
+
] }),
|
|
2872
|
+
primary?.type === "connector" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
|
|
2873
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u667A\u80FD\u8FDE\u7EBF\u4E0E\u7BAD\u5934\u6807\u8BB0" }),
|
|
2874
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2875
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u8DEF\u7531\u7B97\u6CD5" }),
|
|
2876
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2877
|
+
"select",
|
|
2878
|
+
{
|
|
2879
|
+
value: primary.routeType,
|
|
2880
|
+
onChange: (e) => patchElement(primary.id, { routeType: e.target.value }),
|
|
2881
|
+
children: [
|
|
2882
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "orthogonal", children: "\u6B63\u4EA4\u66FC\u54C8\u987F\u8DEF\u7531 (Orthogonal)" }),
|
|
2883
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "curved", children: "\u5E73\u6ED1\u8D1D\u585E\u5C14\u66F2\u7EBF (Curved)" }),
|
|
2884
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "straight", children: "\u76F4\u7EBF\u8FDE\u63A5 (Straight)" })
|
|
2885
|
+
]
|
|
2886
|
+
}
|
|
2887
|
+
)
|
|
2888
|
+
] }),
|
|
2889
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2890
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u8D77\u70B9\u6807\u8BB0" }),
|
|
2891
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2892
|
+
"select",
|
|
2893
|
+
{
|
|
2894
|
+
value: primary.startMarker ?? "none",
|
|
2895
|
+
onChange: (e) => patchElement(primary.id, { startMarker: e.target.value }),
|
|
2896
|
+
children: MARKER_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: m.value, children: m.label }, m.value))
|
|
2897
|
+
}
|
|
2898
|
+
)
|
|
2899
|
+
] }),
|
|
2900
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2901
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7EC8\u70B9\u6807\u8BB0" }),
|
|
2902
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2903
|
+
"select",
|
|
2904
|
+
{
|
|
2905
|
+
value: primary.endMarker ?? "arrow",
|
|
2906
|
+
onChange: (e) => patchElement(primary.id, { endMarker: e.target.value }),
|
|
2907
|
+
children: MARKER_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: m.value, children: m.label }, m.value))
|
|
2908
|
+
}
|
|
2909
|
+
)
|
|
2910
|
+
] }),
|
|
2911
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2912
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u8FDE\u7EBF\u6807\u7B7E" }),
|
|
2913
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2914
|
+
"input",
|
|
2915
|
+
{
|
|
2916
|
+
type: "text",
|
|
2917
|
+
value: primary.label ?? "",
|
|
2918
|
+
onChange: (e) => patchElement(primary.id, { label: e.target.value })
|
|
2919
|
+
}
|
|
2920
|
+
)
|
|
2921
|
+
] }),
|
|
2922
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-checkbox-label", children: [
|
|
2923
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2924
|
+
"input",
|
|
2925
|
+
{
|
|
2926
|
+
type: "checkbox",
|
|
2927
|
+
checked: Boolean(primary.dashed),
|
|
2928
|
+
onChange: (e) => patchElement(primary.id, { dashed: e.target.checked })
|
|
2929
|
+
}
|
|
2930
|
+
),
|
|
2931
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u865A\u7EBF\u6837\u5F0F" })
|
|
2932
|
+
] })
|
|
2933
|
+
] }),
|
|
2934
|
+
primary?.type === "entityCard" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", "data-testid": "boards-entity-card-editor", children: [
|
|
2935
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "ER / UML \u5B9E\u4F53\u6A21\u578B\u5B57\u6BB5\u7F16\u8F91" }),
|
|
2936
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2937
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5361\u7247\u7C7B\u578B" }),
|
|
2938
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
2939
|
+
"select",
|
|
2940
|
+
{
|
|
2941
|
+
value: primary.cardKind,
|
|
2942
|
+
onChange: (e) => patchElement(primary.id, { cardKind: e.target.value }),
|
|
2943
|
+
children: [
|
|
2944
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "erd", children: "\u6570\u636E\u5E93\u5B9E\u4F53\u8868 (ERD)" }),
|
|
2945
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "uml", children: "\u9886\u57DF\u5BF9\u8C61\u7C7B\u56FE (UML)" }),
|
|
2946
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "kanbanCard", children: "\u654F\u6377\u9700\u6C42\u5361 (Kanban)" })
|
|
2947
|
+
]
|
|
2948
|
+
}
|
|
2949
|
+
)
|
|
2950
|
+
] }),
|
|
2951
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
2952
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5B9E\u4F53\u540D\u79F0" }),
|
|
2953
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2954
|
+
"input",
|
|
2955
|
+
{
|
|
2956
|
+
type: "text",
|
|
2957
|
+
value: primary.title,
|
|
2958
|
+
onChange: (e) => patchElement(primary.id, { title: e.target.value })
|
|
2959
|
+
}
|
|
2960
|
+
)
|
|
2961
|
+
] }),
|
|
2962
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-entity-fields-list", children: primary.fields.map((field, fIdx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-entity-field-edit", children: [
|
|
2963
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2964
|
+
"input",
|
|
2965
|
+
{
|
|
2966
|
+
type: "text",
|
|
2967
|
+
value: field.name,
|
|
2968
|
+
placeholder: "\u5B57\u6BB5\u540D",
|
|
2969
|
+
onChange: (e) => {
|
|
2970
|
+
const next = primary.fields.map(
|
|
2971
|
+
(item, idx) => idx === fIdx ? { ...item, name: e.target.value } : item
|
|
2972
|
+
);
|
|
2973
|
+
patchElement(primary.id, { fields: next });
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
),
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2978
|
+
"input",
|
|
2979
|
+
{
|
|
2980
|
+
type: "text",
|
|
2981
|
+
value: field.type,
|
|
2982
|
+
placeholder: "\u7C7B\u578B",
|
|
2983
|
+
onChange: (e) => {
|
|
2984
|
+
const next = primary.fields.map(
|
|
2985
|
+
(item, idx) => idx === fIdx ? { ...item, type: e.target.value } : item
|
|
2986
|
+
);
|
|
2987
|
+
patchElement(primary.id, { fields: next });
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
),
|
|
2991
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2992
|
+
"button",
|
|
2993
|
+
{
|
|
2994
|
+
type: "button",
|
|
2995
|
+
className: `yudao-boards-flag-chip ${field.pk ? "is-pk" : ""}`,
|
|
2996
|
+
onClick: () => {
|
|
2997
|
+
const next = primary.fields.map(
|
|
2998
|
+
(item, idx) => idx === fIdx ? { ...item, pk: !item.pk } : item
|
|
2999
|
+
);
|
|
3000
|
+
patchElement(primary.id, { fields: next });
|
|
3001
|
+
},
|
|
3002
|
+
children: "PK"
|
|
3003
|
+
}
|
|
3004
|
+
),
|
|
3005
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3006
|
+
"button",
|
|
3007
|
+
{
|
|
3008
|
+
type: "button",
|
|
3009
|
+
className: "yudao-boards-icon-ghost",
|
|
3010
|
+
onClick: () => {
|
|
3011
|
+
const next = primary.fields.filter((_, idx) => idx !== fIdx);
|
|
3012
|
+
patchElement(primary.id, { fields: next });
|
|
3013
|
+
},
|
|
3014
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardTrashIcon, {})
|
|
3015
|
+
}
|
|
3016
|
+
)
|
|
3017
|
+
] }, `${field.name}-${fIdx}`)) }),
|
|
3018
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
3019
|
+
"button",
|
|
3020
|
+
{
|
|
3021
|
+
type: "button",
|
|
3022
|
+
className: "yudao-boards-secondary-block-btn",
|
|
3023
|
+
onClick: () => {
|
|
3024
|
+
const next = [
|
|
3025
|
+
...primary.fields,
|
|
3026
|
+
{ name: `col_${primary.fields.length + 1}`, type: "varchar(64)" }
|
|
3027
|
+
];
|
|
3028
|
+
patchElement(primary.id, {
|
|
3029
|
+
fields: next,
|
|
3030
|
+
height: Math.max(primary.height, 64 + next.length * 26)
|
|
3031
|
+
});
|
|
3032
|
+
},
|
|
3033
|
+
children: [
|
|
3034
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardPlusIcon, {}),
|
|
3035
|
+
" \u65B0\u589E\u5B9E\u4F53\u5B57\u6BB5"
|
|
3036
|
+
]
|
|
3037
|
+
}
|
|
3038
|
+
)
|
|
3039
|
+
] }),
|
|
3040
|
+
primary?.type === "mindmap" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
|
|
3041
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u601D\u7EF4\u5BFC\u56FE\u8282\u70B9\u63A7\u5236" }),
|
|
3042
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
3043
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5206\u652F\u4E3B\u8272" }),
|
|
3044
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3045
|
+
"input",
|
|
3046
|
+
{
|
|
3047
|
+
type: "color",
|
|
3048
|
+
value: primary.branchColor ?? "#2563EB",
|
|
3049
|
+
onChange: (e) => patchElement(primary.id, { branchColor: e.target.value })
|
|
3050
|
+
}
|
|
3051
|
+
)
|
|
3052
|
+
] }),
|
|
3053
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inline-actions", children: [
|
|
3054
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3055
|
+
"button",
|
|
3056
|
+
{
|
|
3057
|
+
type: "button",
|
|
3058
|
+
className: "yudao-boards-mini-btn",
|
|
3059
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards4.AddMindmapChildCommand.id, {
|
|
3060
|
+
unitId,
|
|
3061
|
+
parentId: primary.id
|
|
3062
|
+
}),
|
|
3063
|
+
children: "+ \u5B50\u8282\u70B9"
|
|
3064
|
+
}
|
|
3065
|
+
),
|
|
3066
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3067
|
+
"button",
|
|
3068
|
+
{
|
|
3069
|
+
type: "button",
|
|
3070
|
+
className: "yudao-boards-mini-btn",
|
|
3071
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards4.AddMindmapSiblingCommand.id, {
|
|
3072
|
+
unitId,
|
|
3073
|
+
nodeId: primary.id
|
|
3074
|
+
}),
|
|
3075
|
+
children: "+ \u540C\u7EA7"
|
|
3076
|
+
}
|
|
3077
|
+
),
|
|
3078
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3079
|
+
"button",
|
|
3080
|
+
{
|
|
3081
|
+
type: "button",
|
|
3082
|
+
className: "yudao-boards-mini-btn",
|
|
3083
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards4.LayoutBoardMindmapCommand.id, {
|
|
3084
|
+
unitId
|
|
3085
|
+
}),
|
|
3086
|
+
children: "\u81EA\u52A8\u91CD\u6392"
|
|
3087
|
+
}
|
|
3088
|
+
)
|
|
3089
|
+
] })
|
|
3090
|
+
] }),
|
|
3091
|
+
(primary?.type === "frame" || primary?.type === "swimlane") && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
|
|
3092
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u5BB9\u5668\u6807\u9898\u4E0E\u914D\u8272" }),
|
|
3093
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
3094
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6807\u9898" }),
|
|
3095
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3096
|
+
"input",
|
|
3097
|
+
{
|
|
3098
|
+
type: "text",
|
|
3099
|
+
value: primary.title,
|
|
3100
|
+
onChange: (e) => patchElement(primary.id, { title: e.target.value })
|
|
3101
|
+
}
|
|
3102
|
+
)
|
|
3103
|
+
] }),
|
|
3104
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
|
|
3105
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u8FB9\u6846\u8272" }),
|
|
3106
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3107
|
+
"input",
|
|
3108
|
+
{
|
|
3109
|
+
type: "color",
|
|
3110
|
+
value: primary.borderColor ?? "#93C5FD",
|
|
3111
|
+
onChange: (e) => patchElement(primary.id, { borderColor: e.target.value })
|
|
3112
|
+
}
|
|
3113
|
+
)
|
|
3114
|
+
] })
|
|
3115
|
+
] })
|
|
3116
|
+
] });
|
|
3117
|
+
};
|
|
3118
|
+
|
|
3119
|
+
// src/views/left-sidebar/BoardsLeftSidebar.tsx
|
|
3120
|
+
var import_core5 = require("@univerjs/core");
|
|
3121
|
+
var import_ui5 = require("@univerjs/ui");
|
|
3122
|
+
var import_univer_boards5 = require("@yudaocode/univer-boards");
|
|
3123
|
+
var import_react2 = require("react");
|
|
3124
|
+
var import_rxjs4 = require("rxjs");
|
|
3125
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3126
|
+
var BoardsLeftSidebar = () => {
|
|
3127
|
+
const instanceService = (0, import_ui5.useDependency)(import_core5.IUniverInstanceService);
|
|
3128
|
+
const commandService = (0, import_ui5.useDependency)(import_core5.ICommandService);
|
|
3129
|
+
const selectionService = (0, import_ui5.useDependency)(import_univer_boards5.IBoardSelectionService);
|
|
3130
|
+
const unit = (0, import_ui5.useObservable)(
|
|
3131
|
+
() => instanceService.getCurrentTypeOfUnit$(import_core5.UniverInstanceType.UNIVER_BOARD),
|
|
3132
|
+
instanceService.getCurrentUnitOfType(import_core5.UniverInstanceType.UNIVER_BOARD),
|
|
3133
|
+
false,
|
|
3134
|
+
[instanceService]
|
|
3135
|
+
);
|
|
3136
|
+
const snapshot = (0, import_ui5.useObservable)(
|
|
3137
|
+
() => unit ? unit.snapshotChanged$ : (0, import_rxjs4.of)(null),
|
|
3138
|
+
unit ? unit.getSnapshot() : null,
|
|
3139
|
+
false,
|
|
3140
|
+
[unit]
|
|
3141
|
+
);
|
|
3142
|
+
const selectedIds = (0, import_ui5.useObservable)(
|
|
3143
|
+
selectionService.selectedIds$,
|
|
3144
|
+
selectionService.getSelectedIds()
|
|
3145
|
+
);
|
|
3146
|
+
const [activeTab, setActiveTab] = (0, import_react2.useState)("frames");
|
|
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);
|
|
3149
|
+
const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
|
|
3150
|
+
if (!currentSnap || !unit) {
|
|
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" });
|
|
3152
|
+
}
|
|
3153
|
+
const frames = unit.getFramesOrdered();
|
|
3154
|
+
const orderedElements = unit.getElementsOrdered();
|
|
3155
|
+
const focusFrame = (frameId) => {
|
|
3156
|
+
const frame = currentSnap.elements[frameId];
|
|
3157
|
+
if (!frame) return;
|
|
3158
|
+
selectionService.selectElements([frameId]);
|
|
3159
|
+
const zoom = Math.max(0.35, Math.min(1.2, Math.min(920 / frame.width, 600 / frame.height)));
|
|
3160
|
+
const panX = Math.round(64 - frame.x * zoom);
|
|
3161
|
+
const panY = Math.round(64 - frame.y * zoom);
|
|
3162
|
+
commandService.syncExecuteCommand(import_univer_boards5.SetBoardViewportCommand.id, {
|
|
3163
|
+
unitId: unit.getUnitId(),
|
|
3164
|
+
viewport: { panX, panY, zoom: Number(zoom.toFixed(2)) }
|
|
3165
|
+
});
|
|
3166
|
+
};
|
|
3167
|
+
const handleAddFrame = () => {
|
|
3168
|
+
const idx = frames.length + 1;
|
|
3169
|
+
commandService.syncExecuteCommand(import_univer_boards5.AddBoardElementsCommand.id, {
|
|
3170
|
+
unitId: unit.getUnitId(),
|
|
3171
|
+
element: {
|
|
3172
|
+
type: "frame",
|
|
3173
|
+
title: `0${idx} \xB7 \u65B0\u5EFA\u7814\u8BA8\u753B\u6846`,
|
|
3174
|
+
x: 80 + frames.length * 60,
|
|
3175
|
+
y: 80 + frames.length * 40,
|
|
3176
|
+
width: 760,
|
|
3177
|
+
height: 460
|
|
3178
|
+
}
|
|
3179
|
+
});
|
|
3180
|
+
};
|
|
3181
|
+
const handleImportCsv = () => {
|
|
3182
|
+
const elements = (0, import_univer_boards5.importCsvToBoardStickies)(csvInput, {
|
|
3183
|
+
originX: 120,
|
|
3184
|
+
originY: 120,
|
|
3185
|
+
frameTitle: "CSV \u6279\u91CF\u5171\u521B\u4FBF\u7B7E"
|
|
3186
|
+
});
|
|
3187
|
+
if (elements.length > 0) {
|
|
3188
|
+
commandService.syncExecuteCommand(import_univer_boards5.AddBoardElementsCommand.id, {
|
|
3189
|
+
unitId: unit.getUnitId(),
|
|
3190
|
+
elements
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
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
|
+
};
|
|
3211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("aside", { className: "yudao-boards-left-sidebar", "data-testid": "boards-left-sidebar", children: [
|
|
3212
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-sidebar-tabs", children: [
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3214
|
+
"button",
|
|
3215
|
+
{
|
|
3216
|
+
type: "button",
|
|
3217
|
+
className: activeTab === "frames" ? "is-active" : "",
|
|
3218
|
+
onClick: () => setActiveTab("frames"),
|
|
3219
|
+
children: [
|
|
3220
|
+
"\u753B\u6846 (",
|
|
3221
|
+
frames.length,
|
|
3222
|
+
")"
|
|
3223
|
+
]
|
|
3224
|
+
}
|
|
3225
|
+
),
|
|
3226
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3227
|
+
"button",
|
|
3228
|
+
{
|
|
3229
|
+
type: "button",
|
|
3230
|
+
className: activeTab === "elements" ? "is-active" : "",
|
|
3231
|
+
onClick: () => setActiveTab("elements"),
|
|
3232
|
+
children: [
|
|
3233
|
+
"\u5927\u7EB2 (",
|
|
3234
|
+
orderedElements.length,
|
|
3235
|
+
")"
|
|
3236
|
+
]
|
|
3237
|
+
}
|
|
3238
|
+
),
|
|
3239
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3240
|
+
"button",
|
|
3241
|
+
{
|
|
3242
|
+
type: "button",
|
|
3243
|
+
className: activeTab === "templates" ? "is-active" : "",
|
|
3244
|
+
onClick: () => setActiveTab("templates"),
|
|
3245
|
+
children: "\u6A21\u677F/\u5BFC\u5165"
|
|
3246
|
+
}
|
|
3247
|
+
)
|
|
3248
|
+
] }),
|
|
3249
|
+
activeTab === "frames" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-sidebar-section", children: [
|
|
3250
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-sidebar-header-row", children: [
|
|
3251
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u6F14\u793A\u753B\u6846\u5E8F\u5217" }),
|
|
3252
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3253
|
+
"button",
|
|
3254
|
+
{
|
|
3255
|
+
type: "button",
|
|
3256
|
+
className: "yudao-boards-mini-btn",
|
|
3257
|
+
onClick: handleAddFrame,
|
|
3258
|
+
title: "\u65B0\u5EFA\u753B\u6846",
|
|
3259
|
+
children: [
|
|
3260
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardPlusIcon, {}),
|
|
3261
|
+
" \u65B0\u5EFA"
|
|
3262
|
+
]
|
|
3263
|
+
}
|
|
3264
|
+
)
|
|
3265
|
+
] }),
|
|
3266
|
+
frames.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-hint-box", children: "\u6682\u65E0\u753B\u6846\uFF0C\u70B9\u51FB\u300C\u65B0\u5EFA\u300D\u6216\u6846\u9009\u8282\u70B9\u521B\u5EFA\u6F14\u793A\u753B\u6846\u3002" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-frame-list", children: frames.map((frame, idx) => {
|
|
3267
|
+
const selected = selectedIds.includes(frame.id);
|
|
3268
|
+
const memberCount = unit.getElementsInFrame(frame.id).length;
|
|
3269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3270
|
+
"div",
|
|
3271
|
+
{
|
|
3272
|
+
className: `yudao-boards-frame-card ${selected ? "is-selected" : ""}`,
|
|
3273
|
+
onClick: () => focusFrame(frame.id),
|
|
3274
|
+
children: [
|
|
3275
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-frame-badge", children: idx + 1 }),
|
|
3276
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-frame-meta", children: [
|
|
3277
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-frame-title", children: frame.title }),
|
|
3278
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-frame-sub", children: [
|
|
3279
|
+
Math.round(frame.width),
|
|
3280
|
+
" \xD7 ",
|
|
3281
|
+
Math.round(frame.height),
|
|
3282
|
+
" \xB7 ",
|
|
3283
|
+
memberCount,
|
|
3284
|
+
" \u9879"
|
|
3285
|
+
] })
|
|
3286
|
+
] })
|
|
3287
|
+
]
|
|
3288
|
+
},
|
|
3289
|
+
frame.id
|
|
3290
|
+
);
|
|
3291
|
+
}) })
|
|
3292
|
+
] }),
|
|
3293
|
+
activeTab === "elements" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-sidebar-section", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-element-list", children: orderedElements.map((el) => {
|
|
3294
|
+
const selected = selectedIds.includes(el.id);
|
|
3295
|
+
const label = el.type === "frame" || el.type === "swimlane" || el.type === "entityCard" || el.type === "chart" ? el.title : el.type === "sticky" || el.type === "shape" || el.type === "text" || el.type === "mindmap" ? el.text : el.type === "connector" ? el.label || "\u667A\u80FD\u8FDE\u7EBF" : el.type;
|
|
3296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3297
|
+
"div",
|
|
3298
|
+
{
|
|
3299
|
+
className: `yudao-boards-layer-row ${selected ? "is-selected" : ""}`,
|
|
3300
|
+
onClick: () => selectionService.selectElements([el.id]),
|
|
3301
|
+
children: [
|
|
3302
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "yudao-boards-layer-icon", children: el.type === "frame" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardFrameIcon, {}) : el.type === "swimlane" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardSwimlaneIcon, {}) : el.type === "sticky" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardStickyIcon, {}) : el.type === "mindmap" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardMindmapIcon, {}) : el.type === "entityCard" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardEntityCardIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardShapeIcon, {}) }),
|
|
3303
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "yudao-boards-layer-name", children: label || el.id }),
|
|
3304
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3305
|
+
"button",
|
|
3306
|
+
{
|
|
3307
|
+
type: "button",
|
|
3308
|
+
className: "yudao-boards-icon-ghost",
|
|
3309
|
+
title: "\u5220\u9664\u5143\u7D20",
|
|
3310
|
+
onClick: (ev) => {
|
|
3311
|
+
ev.stopPropagation();
|
|
3312
|
+
commandService.syncExecuteCommand(import_univer_boards5.DeleteBoardElementsCommand.id, {
|
|
3313
|
+
unitId: unit.getUnitId(),
|
|
3314
|
+
elementIds: [el.id]
|
|
3315
|
+
});
|
|
3316
|
+
},
|
|
3317
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardTrashIcon, {})
|
|
3318
|
+
}
|
|
3319
|
+
)
|
|
3320
|
+
]
|
|
3321
|
+
},
|
|
3322
|
+
el.id
|
|
3323
|
+
);
|
|
3324
|
+
}) }) }),
|
|
3325
|
+
activeTab === "templates" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-sidebar-section", children: [
|
|
3326
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3327
|
+
"button",
|
|
3328
|
+
{
|
|
3329
|
+
type: "button",
|
|
3330
|
+
className: "yudao-boards-primary-block-btn",
|
|
3331
|
+
onClick: () => commandService.syncExecuteCommand(OpenBoardMermaidModalOperation.id, { open: true }),
|
|
3332
|
+
children: [
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardMermaidIcon, {}),
|
|
3334
|
+
" \u6253\u5F00 Mermaid \u4EE3\u7801\u4E92\u8F6C\u5DE5\u4F5C\u53F0"
|
|
3335
|
+
]
|
|
3336
|
+
}
|
|
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
|
+
),
|
|
3373
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3374
|
+
"button",
|
|
3375
|
+
{
|
|
3376
|
+
type: "button",
|
|
3377
|
+
className: "yudao-boards-secondary-block-btn",
|
|
3378
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards5.ReplaceBoardSnapshotCommand.id, {
|
|
3379
|
+
unitId: unit.getUnitId(),
|
|
3380
|
+
snapshot: (0, import_univer_boards5.createSampleArchitectureBoardData)({ id: unit.getUnitId() })
|
|
3381
|
+
}),
|
|
3382
|
+
children: "\u52A0\u8F7D\u5168\u573A\u666F\u67B6\u6784\u5171\u521B\u793A\u4F8B\u767D\u677F"
|
|
3383
|
+
}
|
|
3384
|
+
),
|
|
3385
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-group-label", children: "\u5FEB\u901F\u63D2\u5165 Mermaid \u67B6\u6784\u9884\u8BBE" }),
|
|
3386
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-preset-list", children: import_univer_boards5.MERMAID_PRESET_TEMPLATES.map((tpl) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
3387
|
+
"button",
|
|
3388
|
+
{
|
|
3389
|
+
type: "button",
|
|
3390
|
+
className: "yudao-boards-preset-item",
|
|
3391
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_boards5.ImportMermaidToBoardCommand.id, {
|
|
3392
|
+
unitId: unit.getUnitId(),
|
|
3393
|
+
mermaidCode: tpl.code,
|
|
3394
|
+
originX: 120,
|
|
3395
|
+
originY: 120
|
|
3396
|
+
}),
|
|
3397
|
+
children: [
|
|
3398
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: tpl.title }),
|
|
3399
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "yudao-boards-tag", children: tpl.diagramType })
|
|
3400
|
+
]
|
|
3401
|
+
},
|
|
3402
|
+
tpl.key
|
|
3403
|
+
)) }),
|
|
3404
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-group-label", children: "CSV \u6279\u91CF\u751F\u6210\u4FBF\u7B7E\u753B\u6846" }),
|
|
3405
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3406
|
+
"textarea",
|
|
3407
|
+
{
|
|
3408
|
+
className: "yudao-boards-csv-textarea",
|
|
3409
|
+
rows: 4,
|
|
3410
|
+
value: csvInput,
|
|
3411
|
+
onChange: (e) => setCsvInput(e.target.value)
|
|
3412
|
+
}
|
|
3413
|
+
),
|
|
3414
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3415
|
+
"button",
|
|
3416
|
+
{
|
|
3417
|
+
type: "button",
|
|
3418
|
+
className: "yudao-boards-secondary-block-btn",
|
|
3419
|
+
onClick: handleImportCsv,
|
|
3420
|
+
children: "\u5BFC\u5165 CSV \u751F\u6210\u5206\u7EC4\u4FBF\u7B7E"
|
|
3421
|
+
}
|
|
3422
|
+
)
|
|
3423
|
+
] })
|
|
3424
|
+
] });
|
|
3425
|
+
};
|
|
3426
|
+
|
|
3427
|
+
// src/views/modals/BoardsDocImportModal.tsx
|
|
3428
|
+
var import_core6 = require("@univerjs/core");
|
|
3429
|
+
var import_ui6 = require("@univerjs/ui");
|
|
3430
|
+
var import_univer_boards6 = require("@yudaocode/univer-boards");
|
|
3431
|
+
var import_react3 = require("react");
|
|
3432
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3433
|
+
var BoardsDocImportModal = ({ forceOpen }) => {
|
|
3434
|
+
const instanceService = (0, import_ui6.useDependency)(import_core6.IUniverInstanceService);
|
|
3435
|
+
const commandService = (0, import_ui6.useDependency)(import_core6.ICommandService);
|
|
3436
|
+
const selectionService = (0, import_ui6.useDependency)(import_univer_boards6.IBoardSelectionService);
|
|
3437
|
+
const isOpen = (0, import_ui6.useObservable)(
|
|
3438
|
+
selectionService.docImportModalOpen$,
|
|
3439
|
+
selectionService.isDocImportModalOpen()
|
|
3440
|
+
);
|
|
3441
|
+
const unit = (0, import_ui6.useObservable)(
|
|
3442
|
+
() => instanceService.getCurrentTypeOfUnit$(import_core6.UniverInstanceType.UNIVER_BOARD),
|
|
3443
|
+
instanceService.getCurrentUnitOfType(import_core6.UniverInstanceType.UNIVER_BOARD),
|
|
3444
|
+
false,
|
|
3445
|
+
[instanceService]
|
|
3446
|
+
);
|
|
3447
|
+
const fileInputRef = (0, import_react3.useRef)(null);
|
|
3448
|
+
const [columns, setColumns] = (0, import_react3.useState)(3);
|
|
3449
|
+
const [replaceExisting, setReplaceExisting] = (0, import_react3.useState)(false);
|
|
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}...`);
|
|
3462
|
+
try {
|
|
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)({
|
|
3613
|
+
id: "mermaid-preview",
|
|
3614
|
+
name: "Preview",
|
|
3615
|
+
gridStyle: "dots",
|
|
3616
|
+
backgroundColor: "#F8FAFC",
|
|
3617
|
+
elements: Object.fromEntries(elements.map((el) => [el.id, el])),
|
|
3618
|
+
elementOrder: elements.map((el) => el.id),
|
|
3619
|
+
frameOrder: elements.filter((el) => el.type === "frame").map((el) => el.id)
|
|
3620
|
+
});
|
|
3621
|
+
const svg = (0, import_univer_boards7.exportBoardToSvg)(tempSnap, { padding: 28 });
|
|
3622
|
+
const framesCount = elements.filter((e) => e.type === "frame").length;
|
|
3623
|
+
const connectorsCount = elements.filter((e) => e.type === "connector").length;
|
|
3624
|
+
const nodesCount = elements.length - framesCount - connectorsCount;
|
|
3625
|
+
return {
|
|
3626
|
+
elements,
|
|
3627
|
+
detectedType,
|
|
3628
|
+
svg,
|
|
3629
|
+
framesCount,
|
|
3630
|
+
nodesCount,
|
|
3631
|
+
connectorsCount,
|
|
3632
|
+
error: null
|
|
3633
|
+
};
|
|
3634
|
+
} catch (err) {
|
|
3635
|
+
return {
|
|
3636
|
+
elements: [],
|
|
3637
|
+
detectedType: "flowchart",
|
|
3638
|
+
svg: "",
|
|
3639
|
+
framesCount: 0,
|
|
3640
|
+
nodesCount: 0,
|
|
3641
|
+
connectorsCount: 0,
|
|
3642
|
+
error: err instanceof Error ? err.message : String(err)
|
|
3643
|
+
};
|
|
3644
|
+
}
|
|
3645
|
+
}, [code]);
|
|
3646
|
+
if (!isOpen && !forceOpen) return null;
|
|
3647
|
+
const handleClose = () => {
|
|
3648
|
+
selectionService.setMermaidModalOpen(false);
|
|
3649
|
+
};
|
|
3650
|
+
const handleParseAndInsert = () => {
|
|
3651
|
+
if (!unit || !code.trim()) return;
|
|
3652
|
+
const ok = commandService.syncExecuteCommand(import_univer_boards7.ImportMermaidToBoardCommand.id, {
|
|
3653
|
+
unitId: unit.getUnitId(),
|
|
3654
|
+
mermaidCode: code,
|
|
3655
|
+
originX: 120,
|
|
3656
|
+
originY: 120,
|
|
3657
|
+
replaceExisting
|
|
3658
|
+
});
|
|
3659
|
+
if (ok) {
|
|
3660
|
+
selectionService.setMermaidModalOpen(false);
|
|
3661
|
+
}
|
|
3662
|
+
};
|
|
3663
|
+
const handleReverseFromCanvas = () => {
|
|
3664
|
+
if (!unit) return;
|
|
3665
|
+
const generated = (0, import_univer_boards7.exportBoardToMermaid)(unit.save(), {
|
|
3666
|
+
diagramType: reverseKind
|
|
3667
|
+
});
|
|
3668
|
+
setCode(generated);
|
|
3669
|
+
};
|
|
3670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3671
|
+
"div",
|
|
3672
|
+
{
|
|
3673
|
+
className: "yudao-boards-modal-backdrop",
|
|
3674
|
+
"data-testid": "boards-mermaid-modal",
|
|
3675
|
+
onClick: handleClose,
|
|
3676
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
3677
|
+
"div",
|
|
3678
|
+
{
|
|
3679
|
+
className: "yudao-boards-mermaid-dialog",
|
|
3680
|
+
onClick: (e) => e.stopPropagation(),
|
|
3681
|
+
children: [
|
|
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" })
|
|
3686
|
+
] }),
|
|
3687
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3688
|
+
"button",
|
|
3689
|
+
{
|
|
3690
|
+
type: "button",
|
|
3691
|
+
className: "yudao-boards-modal-close",
|
|
3692
|
+
onClick: handleClose,
|
|
3693
|
+
children: "\u5173\u95ED"
|
|
3694
|
+
}
|
|
3695
|
+
)
|
|
3696
|
+
] }),
|
|
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)(
|
|
3700
|
+
"button",
|
|
3701
|
+
{
|
|
3702
|
+
type: "button",
|
|
3703
|
+
className: "yudao-boards-preset-pill",
|
|
3704
|
+
"data-testid": `mermaid-preset-${tpl.key}`,
|
|
3705
|
+
onClick: () => setCode(tpl.code),
|
|
3706
|
+
children: tpl.title
|
|
3707
|
+
},
|
|
3708
|
+
tpl.key
|
|
3709
|
+
))
|
|
3710
|
+
] }),
|
|
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: [
|
|
3715
|
+
"Mermaid DSL \u6E90\u7801 (",
|
|
3716
|
+
previewInfo.detectedType,
|
|
3717
|
+
")"
|
|
3718
|
+
] }),
|
|
3719
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "yudao-boards-reverse-bar", children: [
|
|
3720
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
3721
|
+
"select",
|
|
3722
|
+
{
|
|
3723
|
+
value: reverseKind,
|
|
3724
|
+
onChange: (e) => setReverseKind(e.target.value),
|
|
3725
|
+
className: "yudao-boards-select-sm",
|
|
3726
|
+
children: [
|
|
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" })
|
|
3733
|
+
]
|
|
3734
|
+
}
|
|
3735
|
+
),
|
|
3736
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3737
|
+
"button",
|
|
3738
|
+
{
|
|
3739
|
+
type: "button",
|
|
3740
|
+
className: "yudao-boards-reverse-btn",
|
|
3741
|
+
"data-testid": "mermaid-reverse-generate",
|
|
3742
|
+
onClick: handleReverseFromCanvas,
|
|
3743
|
+
children: "\u4ECE\u5F53\u524D\u753B\u5E03\u53CD\u5411\u751F\u6210\u4EE3\u7801"
|
|
3744
|
+
}
|
|
3745
|
+
)
|
|
3746
|
+
] })
|
|
3747
|
+
] }),
|
|
3748
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
3749
|
+
"textarea",
|
|
3750
|
+
{
|
|
3751
|
+
className: "yudao-boards-mermaid-textarea",
|
|
3752
|
+
"data-testid": "mermaid-code-input",
|
|
3753
|
+
value: code,
|
|
3754
|
+
onChange: (e) => setCode(e.target.value),
|
|
3755
|
+
spellCheck: false
|
|
3756
|
+
}
|
|
3757
|
+
)
|
|
3758
|
+
] }),
|
|
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: [
|
|
3763
|
+
"\u5171 ",
|
|
3764
|
+
previewInfo.elements.length,
|
|
3765
|
+
" \u4E2A\u539F\u751F\u5143\u7D20\uFF08\u8282\u70B9 ",
|
|
3766
|
+
previewInfo.nodesCount,
|
|
3767
|
+
" \xB7 \u8FDE\u7EBF",
|
|
3768
|
+
" ",
|
|
3769
|
+
previewInfo.connectorsCount,
|
|
3770
|
+
" \xB7 \u753B\u6846 ",
|
|
3771
|
+
previewInfo.framesCount,
|
|
3772
|
+
"\uFF09"
|
|
3773
|
+
] })
|
|
3774
|
+
] }),
|
|
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)(
|
|
3776
|
+
"div",
|
|
3777
|
+
{
|
|
3778
|
+
className: "yudao-boards-svg-preview-inner",
|
|
3779
|
+
dangerouslySetInnerHTML: { __html: previewInfo.svg }
|
|
3780
|
+
}
|
|
3781
|
+
) })
|
|
3782
|
+
] })
|
|
3783
|
+
] }),
|
|
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)(
|
|
3787
|
+
"input",
|
|
3788
|
+
{
|
|
3789
|
+
type: "checkbox",
|
|
3790
|
+
checked: replaceExisting,
|
|
3791
|
+
onChange: (e) => setReplaceExisting(e.target.checked)
|
|
3792
|
+
}
|
|
3793
|
+
),
|
|
3794
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "\u63D2\u5165\u524D\u6E05\u7A7A\u5F53\u524D\u753B\u5E03\u539F\u6709\u5143\u7D20" })
|
|
3795
|
+
] }),
|
|
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)(
|
|
3799
|
+
"button",
|
|
3800
|
+
{
|
|
3801
|
+
type: "button",
|
|
3802
|
+
className: "yudao-boards-btn-primary",
|
|
3803
|
+
"data-testid": "mermaid-parse-insert",
|
|
3804
|
+
disabled: previewInfo.elements.length === 0,
|
|
3805
|
+
onClick: handleParseAndInsert,
|
|
3806
|
+
children: [
|
|
3807
|
+
"\u89E3\u6790\u5E76\u63D2\u5165\u753B\u5E03 (",
|
|
3808
|
+
previewInfo.elements.length,
|
|
3809
|
+
")"
|
|
3810
|
+
]
|
|
3811
|
+
}
|
|
3812
|
+
)
|
|
3813
|
+
] })
|
|
3814
|
+
] })
|
|
3815
|
+
]
|
|
3816
|
+
}
|
|
3817
|
+
)
|
|
3818
|
+
}
|
|
3819
|
+
);
|
|
3820
|
+
};
|
|
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
|
+
|
|
4147
|
+
// src/views/modals/BoardsModalsHost.tsx
|
|
4148
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
4149
|
+
var BoardsModalsHost = () => {
|
|
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
|
+
] });
|
|
4155
|
+
};
|
|
4156
|
+
|
|
4157
|
+
// src/controllers/menu.schema.ts
|
|
4158
|
+
var import_ui9 = require("@univerjs/ui");
|
|
4159
|
+
var import_univer_boards9 = require("@yudaocode/univer-boards");
|
|
4160
|
+
var import_rxjs6 = require("rxjs");
|
|
4161
|
+
var BOARDS_RIBBON_TAB = "ribbon.boards";
|
|
4162
|
+
var BOARDS_RIBBON_GROUP = "ribbon.boards.workshop";
|
|
4163
|
+
var boardsRootMenuExtension = {
|
|
4164
|
+
[import_ui9.MenuManagerPosition.RIBBON]: {
|
|
4165
|
+
[BOARDS_RIBBON_TAB]: {
|
|
4166
|
+
order: 2,
|
|
4167
|
+
title: "boards.ribbon.boardTab",
|
|
4168
|
+
[BOARDS_RIBBON_GROUP]: {
|
|
4169
|
+
order: 0,
|
|
4170
|
+
title: "boards.ribbon.boardTab"
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
};
|
|
4175
|
+
function makeSimpleMenuBtn(config) {
|
|
4176
|
+
return () => ({
|
|
4177
|
+
id: config.id,
|
|
4178
|
+
commandId: config.commandId ?? config.id,
|
|
4179
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
4180
|
+
title: config.title,
|
|
4181
|
+
label: config.label,
|
|
4182
|
+
tooltip: config.title,
|
|
4183
|
+
icon: config.icon,
|
|
4184
|
+
params: config.params
|
|
4185
|
+
});
|
|
4186
|
+
}
|
|
4187
|
+
var BoardSelectToolMenuFactory = (accessor) => {
|
|
4188
|
+
const sel = accessor.get(import_univer_boards9.IBoardSelectionService);
|
|
4189
|
+
return {
|
|
4190
|
+
id: "boards-ui.menu.tool-select",
|
|
4191
|
+
commandId: SetBoardToolOperation.id,
|
|
4192
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
4193
|
+
title: "boards.ribbon.selectTool",
|
|
4194
|
+
tooltip: "boards.ribbon.selectTool",
|
|
4195
|
+
icon: "BoardSelectIcon",
|
|
4196
|
+
params: { tool: "select" },
|
|
4197
|
+
activated$: sel.activeTool$.pipe((0, import_rxjs6.map)((t) => t === "select"))
|
|
4198
|
+
};
|
|
4199
|
+
};
|
|
4200
|
+
var BoardHandToolMenuFactory = (accessor) => {
|
|
4201
|
+
const sel = accessor.get(import_univer_boards9.IBoardSelectionService);
|
|
4202
|
+
return {
|
|
4203
|
+
id: "boards-ui.menu.tool-hand",
|
|
4204
|
+
commandId: SetBoardToolOperation.id,
|
|
4205
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
4206
|
+
title: "boards.ribbon.handTool",
|
|
4207
|
+
tooltip: "boards.ribbon.handTool",
|
|
4208
|
+
icon: "BoardHandIcon",
|
|
4209
|
+
params: { tool: "hand" },
|
|
4210
|
+
activated$: sel.activeTool$.pipe((0, import_rxjs6.map)((t) => t === "hand"))
|
|
4211
|
+
};
|
|
4212
|
+
};
|
|
4213
|
+
var boardsMenuSchema = {
|
|
4214
|
+
[import_ui9.RibbonStartGroup.FORMAT]: {
|
|
4215
|
+
["boards-ui.menu.tool-select"]: { order: 0, menuItemFactory: BoardSelectToolMenuFactory },
|
|
4216
|
+
["boards-ui.menu.tool-hand"]: { order: 1, menuItemFactory: BoardHandToolMenuFactory },
|
|
4217
|
+
["boards-ui.menu.add-frame"]: {
|
|
4218
|
+
order: 2,
|
|
4219
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4220
|
+
id: "boards-ui.menu.add-frame",
|
|
4221
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
4222
|
+
title: "boards.ribbon.insertFrame",
|
|
4223
|
+
icon: "BoardFrameIcon",
|
|
4224
|
+
params: { element: { type: "frame" } }
|
|
4225
|
+
})
|
|
4226
|
+
},
|
|
4227
|
+
["boards-ui.menu.add-sticky"]: {
|
|
4228
|
+
order: 3,
|
|
4229
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4230
|
+
id: "boards-ui.menu.add-sticky",
|
|
4231
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
4232
|
+
title: "boards.ribbon.insertSticky",
|
|
4233
|
+
icon: "BoardStickyIcon",
|
|
4234
|
+
params: { element: { type: "sticky" } }
|
|
4235
|
+
})
|
|
4236
|
+
},
|
|
4237
|
+
["boards-ui.menu.add-shape"]: {
|
|
4238
|
+
order: 4,
|
|
4239
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4240
|
+
id: "boards-ui.menu.add-shape",
|
|
4241
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
4242
|
+
title: "boards.ribbon.insertShape",
|
|
4243
|
+
icon: "BoardShapeIcon",
|
|
4244
|
+
params: { element: { type: "shape" } }
|
|
4245
|
+
})
|
|
4246
|
+
},
|
|
4247
|
+
["boards-ui.menu.add-mindmap"]: {
|
|
4248
|
+
order: 5,
|
|
4249
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4250
|
+
id: "boards-ui.menu.add-mindmap",
|
|
4251
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
4252
|
+
title: "boards.ribbon.insertMindmap",
|
|
4253
|
+
icon: "BoardMindmapIcon",
|
|
4254
|
+
params: { element: { type: "mindmap" } }
|
|
4255
|
+
})
|
|
4256
|
+
},
|
|
4257
|
+
["boards-ui.menu.add-entity"]: {
|
|
4258
|
+
order: 6,
|
|
4259
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4260
|
+
id: "boards-ui.menu.add-entity",
|
|
4261
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
4262
|
+
title: "boards.ribbon.insertEntityCard",
|
|
4263
|
+
icon: "BoardEntityCardIcon",
|
|
4264
|
+
params: { element: { type: "entityCard" } }
|
|
4265
|
+
})
|
|
4266
|
+
}
|
|
4267
|
+
},
|
|
4268
|
+
[import_ui9.RibbonInsertGroup.MEDIA]: {
|
|
4269
|
+
["boards-ui.menu.mermaid-studio"]: {
|
|
4270
|
+
order: 1,
|
|
4271
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4272
|
+
id: "boards-ui.menu.mermaid-studio",
|
|
4273
|
+
commandId: OpenBoardMermaidModalOperation.id,
|
|
4274
|
+
title: "boards.ribbon.mermaidStudio",
|
|
4275
|
+
label: "boards.ribbon.mermaidStudio",
|
|
4276
|
+
icon: "BoardMermaidIcon",
|
|
4277
|
+
params: { open: true }
|
|
4278
|
+
})
|
|
4279
|
+
},
|
|
4280
|
+
["boards-ui.menu.insert-swimlane"]: {
|
|
4281
|
+
order: 2,
|
|
4282
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4283
|
+
id: "boards-ui.menu.insert-swimlane",
|
|
4284
|
+
commandId: import_univer_boards9.AddBoardElementsCommand.id,
|
|
4285
|
+
title: "boards.ribbon.insertSwimlane",
|
|
4286
|
+
icon: "BoardSwimlaneIcon",
|
|
4287
|
+
params: { element: { type: "swimlane" } }
|
|
4288
|
+
})
|
|
4289
|
+
}
|
|
4290
|
+
},
|
|
4291
|
+
[BOARDS_RIBBON_GROUP]: {
|
|
4292
|
+
["boards-ui.menu.mermaid-sync"]: {
|
|
4293
|
+
order: 1,
|
|
4294
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4295
|
+
id: "boards-ui.menu.mermaid-sync",
|
|
4296
|
+
commandId: OpenBoardMermaidModalOperation.id,
|
|
4297
|
+
title: "boards.ribbon.mermaidStudio",
|
|
4298
|
+
label: "boards.ribbon.mermaidStudio",
|
|
4299
|
+
icon: "BoardMermaidIcon",
|
|
4300
|
+
params: { open: true }
|
|
4301
|
+
})
|
|
4302
|
+
},
|
|
4303
|
+
["boards-ui.menu.tour"]: {
|
|
4304
|
+
order: 2,
|
|
4305
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4306
|
+
id: "boards-ui.menu.tour",
|
|
4307
|
+
commandId: StartBoardPresentationOperation.id,
|
|
4308
|
+
title: "boards.ribbon.presentationTour",
|
|
4309
|
+
label: "boards.ribbon.presentationTour",
|
|
4310
|
+
icon: "BoardPlayTourIcon"
|
|
4311
|
+
})
|
|
4312
|
+
},
|
|
4313
|
+
["boards-ui.menu.export-svg"]: {
|
|
4314
|
+
order: 3,
|
|
4315
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4316
|
+
id: "boards-ui.menu.export-svg",
|
|
4317
|
+
commandId: ExportBoardFileOperation.id,
|
|
4318
|
+
title: "boards.ribbon.exportSvg",
|
|
4319
|
+
icon: "BoardDownloadIcon",
|
|
4320
|
+
params: { format: "svg" }
|
|
4321
|
+
})
|
|
4322
|
+
},
|
|
4323
|
+
["boards-ui.menu.export-pdf"]: {
|
|
4324
|
+
order: 4,
|
|
4325
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4326
|
+
id: "boards-ui.menu.export-pdf",
|
|
4327
|
+
commandId: ExportBoardFileOperation.id,
|
|
4328
|
+
title: "boards.ribbon.exportPdf",
|
|
4329
|
+
icon: "BoardDownloadIcon",
|
|
4330
|
+
params: { format: "pdf" }
|
|
4331
|
+
})
|
|
4332
|
+
},
|
|
4333
|
+
["boards-ui.menu.export-pptx"]: {
|
|
4334
|
+
order: 5,
|
|
4335
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4336
|
+
id: "boards-ui.menu.export-pptx",
|
|
4337
|
+
commandId: ExportBoardFileOperation.id,
|
|
4338
|
+
title: "boards.ribbon.exportPptx",
|
|
4339
|
+
icon: "BoardDownloadIcon",
|
|
4340
|
+
params: { format: "pptx" }
|
|
4341
|
+
})
|
|
4342
|
+
}
|
|
4343
|
+
},
|
|
4344
|
+
[import_ui9.RibbonViewGroup.DISPLAY]: {
|
|
4345
|
+
[FitBoardToScreenOperation.id]: {
|
|
4346
|
+
order: 1,
|
|
4347
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4348
|
+
id: FitBoardToScreenOperation.id,
|
|
4349
|
+
title: "boards.ribbon.fitScreen",
|
|
4350
|
+
icon: "BoardFitScreenIcon"
|
|
4351
|
+
})
|
|
4352
|
+
},
|
|
4353
|
+
[ToggleBoardInspectorOperation.id]: {
|
|
4354
|
+
order: 2,
|
|
4355
|
+
menuItemFactory: makeSimpleMenuBtn({
|
|
4356
|
+
id: ToggleBoardInspectorOperation.id,
|
|
4357
|
+
title: "boards.ribbon.inspector",
|
|
4358
|
+
label: "boards.ribbon.inspector",
|
|
4359
|
+
icon: "BoardInspectorIcon"
|
|
4360
|
+
})
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
};
|
|
4364
|
+
|
|
4365
|
+
// src/controllers/boards-ui.controller.ts
|
|
4366
|
+
var BoardsUIController = class extends import_core9.Disposable {
|
|
4367
|
+
constructor(_config, _commandService, _menuManagerService, _uiPartsService, _sidebarService, _componentManager, _iconManager) {
|
|
4368
|
+
super();
|
|
4369
|
+
this._config = _config;
|
|
4370
|
+
this._commandService = _commandService;
|
|
4371
|
+
this._menuManagerService = _menuManagerService;
|
|
4372
|
+
this._uiPartsService = _uiPartsService;
|
|
4373
|
+
this._sidebarService = _sidebarService;
|
|
4374
|
+
this._componentManager = _componentManager;
|
|
4375
|
+
this._iconManager = _iconManager;
|
|
4376
|
+
this._inspectorTimer = null;
|
|
4377
|
+
this._initIcons();
|
|
4378
|
+
this._initComponents();
|
|
4379
|
+
this._initOperations();
|
|
4380
|
+
this._initMenus();
|
|
4381
|
+
this._initWorkbenchParts();
|
|
4382
|
+
if (this._config.defaultOpenInspector) {
|
|
4383
|
+
this._inspectorTimer = setTimeout(() => {
|
|
4384
|
+
this._inspectorTimer = null;
|
|
4385
|
+
if (!this._disposed) {
|
|
4386
|
+
openBoardInspectorSidebar(this._sidebarService);
|
|
4387
|
+
}
|
|
4388
|
+
}, 100);
|
|
4389
|
+
this.disposeWithMe(
|
|
4390
|
+
(0, import_core9.toDisposable)(() => {
|
|
4391
|
+
if (this._inspectorTimer !== null) {
|
|
4392
|
+
clearTimeout(this._inspectorTimer);
|
|
4393
|
+
this._inspectorTimer = null;
|
|
4394
|
+
}
|
|
4395
|
+
})
|
|
4396
|
+
);
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
4399
|
+
_initIcons() {
|
|
4400
|
+
this.disposeWithMe(this._iconManager.register(BOARD_ICON_MAP));
|
|
4401
|
+
}
|
|
4402
|
+
_initComponents() {
|
|
4403
|
+
this.disposeWithMe(
|
|
4404
|
+
this._componentManager.register(BOARD_INSPECTOR_COMPONENT_KEY, BoardsInspectorPanel)
|
|
4405
|
+
);
|
|
4406
|
+
}
|
|
4407
|
+
_initOperations() {
|
|
4408
|
+
const ops = [
|
|
4409
|
+
ToggleBoardInspectorOperation,
|
|
4410
|
+
OpenBoardMermaidModalOperation,
|
|
4411
|
+
OpenBoardVotingModalOperation,
|
|
4412
|
+
OpenBoardDocImportModalOperation,
|
|
4413
|
+
SetBoardToolOperation,
|
|
4414
|
+
StartBoardPresentationOperation,
|
|
4415
|
+
FitBoardToScreenOperation,
|
|
4416
|
+
ExportBoardFileOperation
|
|
4417
|
+
];
|
|
4418
|
+
for (const op of ops) {
|
|
4419
|
+
this.disposeWithMe(this._commandService.registerCommand(op));
|
|
4420
|
+
}
|
|
4421
|
+
}
|
|
4422
|
+
_initMenus() {
|
|
4423
|
+
this._menuManagerService.appendRootMenu(boardsRootMenuExtension);
|
|
4424
|
+
this._menuManagerService.mergeMenu(boardsMenuSchema);
|
|
4425
|
+
}
|
|
4426
|
+
_initWorkbenchParts() {
|
|
4427
|
+
this.disposeWithMe(
|
|
4428
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.LEFT_SIDEBAR, () => BoardsLeftSidebar)
|
|
4429
|
+
);
|
|
4430
|
+
this.disposeWithMe(
|
|
4431
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.CONTENT, () => BoardsInfiniteCanvas)
|
|
4432
|
+
);
|
|
4433
|
+
this.disposeWithMe(
|
|
4434
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.FOOTER, () => BoardsStatusBar)
|
|
4435
|
+
);
|
|
4436
|
+
this.disposeWithMe(
|
|
4437
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.GLOBAL, () => BoardsModalsHost)
|
|
4438
|
+
);
|
|
4439
|
+
}
|
|
4440
|
+
};
|
|
4441
|
+
BoardsUIController = __decorateClass([
|
|
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))
|
|
4448
|
+
], BoardsUIController);
|
|
4449
|
+
|
|
4450
|
+
// src/locale/en-US.ts
|
|
4451
|
+
var enUS = {
|
|
4452
|
+
boards: {
|
|
4453
|
+
ribbon: {
|
|
4454
|
+
boardTab: "Whiteboard",
|
|
4455
|
+
selectTool: "Select (V)",
|
|
4456
|
+
handTool: "Hand Pan (H)",
|
|
4457
|
+
insertFrame: "Frame (F)",
|
|
4458
|
+
insertSwimlane: "Swimlane (S)",
|
|
4459
|
+
insertSticky: "Sticky Note (N)",
|
|
4460
|
+
insertShape: "Flowchart Shape",
|
|
4461
|
+
insertConnector: "Smart Connector (L)",
|
|
4462
|
+
insertInk: "Freehand Ink (P)",
|
|
4463
|
+
insertMindmap: "Mindmap (M)",
|
|
4464
|
+
insertEntityCard: "Entity Card (E)",
|
|
4465
|
+
mermaidStudio: "Mermaid Code Sync",
|
|
4466
|
+
presentationTour: "Frame Presentation",
|
|
4467
|
+
fitScreen: "Fit to Screen",
|
|
4468
|
+
inspector: "Inspector",
|
|
4469
|
+
exportSvg: "Export SVG",
|
|
4470
|
+
exportPdf: "Export PDF",
|
|
4471
|
+
exportPptx: "Export PPTX"
|
|
4472
|
+
},
|
|
4473
|
+
sidebar: {
|
|
4474
|
+
inspectorTitle: "Board & Element Inspector",
|
|
4475
|
+
framesTab: "Frames",
|
|
4476
|
+
layersTab: "Elements",
|
|
4477
|
+
templatesTab: "Templates"
|
|
4478
|
+
},
|
|
4479
|
+
mermaid: {
|
|
4480
|
+
modalTitle: "Bidirectional Mermaid Diagram Studio",
|
|
4481
|
+
parseAndInsert: "Parse & Insert to Canvas",
|
|
4482
|
+
reverseGenerate: "Reverse Generate from Canvas"
|
|
4483
|
+
}
|
|
4484
|
+
}
|
|
4485
|
+
};
|
|
4486
|
+
var en_US_default = enUS;
|
|
4487
|
+
|
|
4488
|
+
// src/locale/zh-CN.ts
|
|
4489
|
+
var zhCN = {
|
|
4490
|
+
boards: {
|
|
4491
|
+
ribbon: {
|
|
4492
|
+
boardTab: "\u767D\u677F\u5171\u521B",
|
|
4493
|
+
selectTool: "\u9009\u62E9 (V)",
|
|
4494
|
+
handTool: "\u6293\u624B\u5E73\u79FB (H)",
|
|
4495
|
+
insertFrame: "\u65B0\u5EFA\u753B\u6846 (F)",
|
|
4496
|
+
insertSwimlane: "\u6D41\u7A0B\u6CF3\u9053 (S)",
|
|
4497
|
+
insertSticky: "\u534F\u4F5C\u4FBF\u7B7E (N)",
|
|
4498
|
+
insertShape: "\u6D41\u7A0B\u56FE\u5F62\u72B6",
|
|
4499
|
+
insertConnector: "\u667A\u80FD\u8FDE\u7EBF (L)",
|
|
4500
|
+
insertInk: "\u81EA\u7531\u753B\u7B14 (P)",
|
|
4501
|
+
insertMindmap: "\u601D\u7EF4\u5BFC\u56FE (M)",
|
|
4502
|
+
insertEntityCard: "\u5B9E\u4F53\u6A21\u578B\u5361 (E)",
|
|
4503
|
+
mermaidStudio: "\u6D41\u7A0B\u56FE\u4EE3\u7801\u4E92\u8F6C (Mermaid)",
|
|
4504
|
+
presentationTour: "\u753B\u6846\u6F14\u793A\u653E\u6620",
|
|
4505
|
+
fitScreen: "\u9002\u5E94\u5C4F\u5E55",
|
|
4506
|
+
inspector: "\u5C5E\u6027\u9762\u677F",
|
|
4507
|
+
exportSvg: "\u5BFC\u51FA SVG",
|
|
4508
|
+
exportPdf: "\u5BFC\u51FA PDF",
|
|
4509
|
+
exportPptx: "\u5BFC\u51FA PPTX"
|
|
4510
|
+
},
|
|
4511
|
+
sidebar: {
|
|
4512
|
+
inspectorTitle: "\u767D\u677F\u4E0E\u56FE\u5F62\u5C5E\u6027",
|
|
4513
|
+
framesTab: "\u753B\u6846\u5BFC\u89C8",
|
|
4514
|
+
layersTab: "\u5143\u7D20\u5927\u7EB2",
|
|
4515
|
+
templatesTab: "\u573A\u666F\u6A21\u677F"
|
|
4516
|
+
},
|
|
4517
|
+
mermaid: {
|
|
4518
|
+
modalTitle: "Mermaid \u6D41\u7A0B\u56FE\u4E0E\u67B6\u6784\u4EE3\u7801\u53CC\u5411\u4E92\u8F6C\u5DE5\u4F5C\u53F0",
|
|
4519
|
+
parseAndInsert: "\u89E3\u6790\u5E76\u63D2\u5165\u753B\u5E03",
|
|
4520
|
+
reverseGenerate: "\u4ECE\u5F53\u524D\u753B\u5E03\u53CD\u5411\u751F\u6210\u4EE3\u7801"
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
};
|
|
4524
|
+
var zh_CN_default = zhCN;
|
|
4525
|
+
|
|
4526
|
+
// src/plugin.ts
|
|
4527
|
+
var import_core10 = require("@univerjs/core");
|
|
4528
|
+
var import_engine_render = require("@univerjs/engine-render");
|
|
4529
|
+
var import_univer_boards10 = require("@yudaocode/univer-boards");
|
|
4530
|
+
var UNIVER_BOARDS_UI_PLUGIN_NAME = "UNIVER_BOARDS_UI_PLUGIN";
|
|
4531
|
+
var UniverBoardsUIPlugin = class extends import_core10.Plugin {
|
|
4532
|
+
constructor(_config = {}, _injector) {
|
|
4533
|
+
super();
|
|
4534
|
+
this._config = _config;
|
|
4535
|
+
this._injector = _injector;
|
|
4536
|
+
}
|
|
4537
|
+
onStarting() {
|
|
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
|
|
4542
|
+
});
|
|
4543
|
+
}
|
|
4544
|
+
this._injector.add([
|
|
4545
|
+
BoardsUIController,
|
|
4546
|
+
{
|
|
4547
|
+
useFactory: () => this._injector.createInstance(BoardsUIController, this._config)
|
|
4548
|
+
}
|
|
4549
|
+
]);
|
|
4550
|
+
this._injector.get(BoardsUIController);
|
|
4551
|
+
}
|
|
4552
|
+
};
|
|
4553
|
+
UniverBoardsUIPlugin.pluginName = UNIVER_BOARDS_UI_PLUGIN_NAME;
|
|
4554
|
+
UniverBoardsUIPlugin.packageName = "@yudaocode/univer-boards-ui";
|
|
4555
|
+
UniverBoardsUIPlugin.type = import_core10.UniverInstanceType.UNIVER_BOARD;
|
|
4556
|
+
UniverBoardsUIPlugin = __decorateClass([
|
|
4557
|
+
(0, import_core10.DependentOn)(import_engine_render.UniverRenderEnginePlugin, import_univer_boards10.UniverBoardsPlugin),
|
|
4558
|
+
__decorateParam(1, (0, import_core10.Inject)(import_core10.Injector))
|
|
4559
|
+
], UniverBoardsUIPlugin);
|
|
4560
|
+
|
|
4561
|
+
// src/index.ts
|
|
4562
|
+
var VERSION = "1.6.219";
|
|
4563
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4564
|
+
0 && (module.exports = {
|
|
4565
|
+
BOARDS_RIBBON_GROUP,
|
|
4566
|
+
BOARDS_RIBBON_TAB,
|
|
4567
|
+
BOARD_ICON_MAP,
|
|
4568
|
+
BOARD_INSPECTOR_COMPONENT_KEY,
|
|
4569
|
+
BOARD_INSPECTOR_SIDEBAR_ID,
|
|
4570
|
+
BoardsDocImportModal,
|
|
4571
|
+
BoardsInfiniteCanvas,
|
|
4572
|
+
BoardsInspectorPanel,
|
|
4573
|
+
BoardsLeftSidebar,
|
|
4574
|
+
BoardsMermaidModal,
|
|
4575
|
+
BoardsModalsHost,
|
|
4576
|
+
BoardsStatusBar,
|
|
4577
|
+
BoardsUIController,
|
|
4578
|
+
BoardsVotingModal,
|
|
4579
|
+
ExportBoardFileOperation,
|
|
4580
|
+
FitBoardToScreenOperation,
|
|
4581
|
+
OpenBoardDocImportModalOperation,
|
|
4582
|
+
OpenBoardMermaidModalOperation,
|
|
4583
|
+
OpenBoardVotingModalOperation,
|
|
4584
|
+
SetBoardToolOperation,
|
|
4585
|
+
StartBoardPresentationOperation,
|
|
4586
|
+
ToggleBoardInspectorOperation,
|
|
4587
|
+
UNIVER_BOARDS_UI_PLUGIN_NAME,
|
|
4588
|
+
UniverBoardsUIPlugin,
|
|
4589
|
+
VERSION,
|
|
4590
|
+
boardsMenuSchema,
|
|
4591
|
+
boardsRootMenuExtension,
|
|
4592
|
+
enUS,
|
|
4593
|
+
openBoardInspectorSidebar,
|
|
4594
|
+
zhCN
|
|
4595
|
+
});
|
|
4596
|
+
//# sourceMappingURL=index.js.map
|