@yudaocode/univer-pdfs-ui 1.6.218 → 1.6.219
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/lib/cjs/index.js +1660 -324
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/locale/en-US.js +2 -0
- package/lib/cjs/locale/en-US.js.map +1 -1
- package/lib/cjs/locale/zh-CN.js +2 -0
- package/lib/cjs/locale/zh-CN.js.map +1 -1
- package/lib/es/{chunk-BGVYO6EP.js → chunk-FVF66I7J.js} +3 -1
- package/lib/es/chunk-FVF66I7J.js.map +1 -0
- package/lib/es/{chunk-TLZPB72N.js → chunk-QLNL6XVB.js} +3 -1
- package/lib/es/chunk-QLNL6XVB.js.map +1 -0
- package/lib/es/index.js +1598 -250
- package/lib/es/index.js.map +1 -1
- package/lib/es/locale/en-US.js +1 -1
- package/lib/es/locale/zh-CN.js +1 -1
- package/lib/types/index.d.ts +25 -1
- package/lib/types/locale/zh-CN.d.ts +2 -0
- package/package.json +3 -3
- package/lib/es/chunk-BGVYO6EP.js.map +0 -1
- package/lib/es/chunk-TLZPB72N.js.map +0 -1
package/lib/cjs/index.js
CHANGED
|
@@ -44,6 +44,7 @@ __export(src_exports, {
|
|
|
44
44
|
IPdfsUIFeatureService: () => IPdfsUIFeatureService,
|
|
45
45
|
InsertPdfPresetElementOperation: () => InsertPdfPresetElementOperation,
|
|
46
46
|
OpenPdfPreviewOperation: () => OpenPdfPreviewOperation,
|
|
47
|
+
OpenPdfSplitModalOperation: () => OpenPdfSplitModalOperation,
|
|
47
48
|
PDF_INSPECTOR_COMPONENT_KEY: () => PDF_INSPECTOR_COMPONENT_KEY,
|
|
48
49
|
PDF_INSPECTOR_SIDEBAR_ID: () => PDF_INSPECTOR_SIDEBAR_ID,
|
|
49
50
|
PdfCanvasView: () => PdfCanvasView,
|
|
@@ -52,6 +53,7 @@ __export(src_exports, {
|
|
|
52
53
|
PdfInspectorSidebar: () => PdfInspectorPanel,
|
|
53
54
|
PdfLeftSidebar: () => PdfLeftSidebar,
|
|
54
55
|
PdfPreviewModal: () => PdfPreviewModal,
|
|
56
|
+
PdfSplitExtractModal: () => PdfSplitExtractModal,
|
|
55
57
|
PdfStatusBar: () => PdfStatusBar,
|
|
56
58
|
PdfUnifiedIoSection: () => PdfUnifiedIoSection,
|
|
57
59
|
PdfsUIController: () => PdfsUIController,
|
|
@@ -81,6 +83,7 @@ __export(src_exports, {
|
|
|
81
83
|
clearPdfDocumentCache: () => clearPdfDocumentCache,
|
|
82
84
|
collectPdfFindMatches: () => collectPdfFindMatches,
|
|
83
85
|
computePdfDocumentCacheKey: () => computePdfDocumentCacheKey,
|
|
86
|
+
computePdfSplitPlanPreview: () => computePdfSplitPlanPreview,
|
|
84
87
|
configurePdfjsAssets: () => configurePdfjsAssets,
|
|
85
88
|
countBookmarkTreeItems: () => countBookmarkTreeItems,
|
|
86
89
|
deleteBookmarkFromTree: () => deleteBookmarkFromTree,
|
|
@@ -101,8 +104,8 @@ __export(src_exports, {
|
|
|
101
104
|
module.exports = __toCommonJS(src_exports);
|
|
102
105
|
|
|
103
106
|
// src/controllers/pdfs-ui.controller.ts
|
|
104
|
-
var
|
|
105
|
-
var
|
|
107
|
+
var import_core10 = require("@univerjs/core");
|
|
108
|
+
var import_ui10 = require("@univerjs/ui");
|
|
106
109
|
|
|
107
110
|
// src/icons/pdf-icons.tsx
|
|
108
111
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -281,6 +284,19 @@ var PdfFindReplaceIcon = createSvgIcon(
|
|
|
281
284
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10.2 10.2L13.8 13.8", strokeWidth: "1.45", strokeLinecap: "round" })
|
|
282
285
|
] })
|
|
283
286
|
);
|
|
287
|
+
var PdfSplitExtractIcon = createSvgIcon(
|
|
288
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
289
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2.6", width: "4.8", height: "10.8", rx: "0.9", strokeWidth: "1.35" }),
|
|
290
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "9.2", y: "2.6", width: "4.8", height: "10.8", rx: "0.9", strokeWidth: "1.35" }),
|
|
291
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.8 8H9.2", strokeWidth: "1.35", strokeLinecap: "round" })
|
|
292
|
+
] })
|
|
293
|
+
);
|
|
294
|
+
var PdfCropPageIcon = createSvgIcon(
|
|
295
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
296
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4.5 2V11.5H14", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
297
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2 4.5H11.5V14", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
298
|
+
] })
|
|
299
|
+
);
|
|
284
300
|
function createInlineIcon(children, size = 14) {
|
|
285
301
|
return ({ style }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
286
302
|
"svg",
|
|
@@ -537,6 +553,27 @@ var UiShieldLockIcon = createInlineIcon(
|
|
|
537
553
|
] }),
|
|
538
554
|
14
|
|
539
555
|
);
|
|
556
|
+
var UiStampSealIcon = createInlineIcon(
|
|
557
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
558
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2.2", y: "3.4", width: "11.6", height: "9.2", rx: "2" }),
|
|
559
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.2 8.2L7 10L10.8 6.2" })
|
|
560
|
+
] }),
|
|
561
|
+
14
|
|
562
|
+
);
|
|
563
|
+
var UiMessageReplyIcon = createInlineIcon(
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 3.2H13.5V10.8H6.5L3.2 13.5V10.8H2.5V3.2Z" }),
|
|
566
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.2 6.2H10.8M5.2 8.4H8.8" })
|
|
567
|
+
] }),
|
|
568
|
+
14
|
|
569
|
+
);
|
|
570
|
+
var UiPptxSlideIcon = createInlineIcon(
|
|
571
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
572
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2.8", width: "12", height: "8.6", rx: "1.2" }),
|
|
573
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 11.4V13.8M5.2 13.8H10.8M5.2 5.8H8.2M5.2 8.2H10.8" })
|
|
574
|
+
] }),
|
|
575
|
+
14
|
|
576
|
+
);
|
|
540
577
|
var PDF_ICON_MAP = {
|
|
541
578
|
PdfSelectCursorIcon,
|
|
542
579
|
PdfHandPanIcon,
|
|
@@ -569,7 +606,9 @@ var PDF_ICON_MAP = {
|
|
|
569
606
|
PdfRulerIcon,
|
|
570
607
|
PdfGridIcon,
|
|
571
608
|
PdfMarginIcon,
|
|
572
|
-
PdfFindReplaceIcon
|
|
609
|
+
PdfFindReplaceIcon,
|
|
610
|
+
PdfSplitExtractIcon,
|
|
611
|
+
PdfCropPageIcon
|
|
573
612
|
};
|
|
574
613
|
|
|
575
614
|
// src/operations/pdf-ui.operation.ts
|
|
@@ -773,6 +812,18 @@ var TogglePdfInspectorOperation = {
|
|
|
773
812
|
return true;
|
|
774
813
|
}
|
|
775
814
|
};
|
|
815
|
+
var OpenPdfSplitModalOperation = {
|
|
816
|
+
id: "pdfs-ui.operation.open-split-modal",
|
|
817
|
+
type: import_core2.CommandType.OPERATION,
|
|
818
|
+
handler: (accessor, params) => {
|
|
819
|
+
const selectionService = accessor.get(import_univer_pdfs.IPdfSelectionService);
|
|
820
|
+
selectionService.commitActiveEditing();
|
|
821
|
+
selectionService.setEditingElement(null);
|
|
822
|
+
const nextOpen = typeof params?.open === "boolean" ? params.open : true;
|
|
823
|
+
selectionService.setSplitModalOpen(nextOpen);
|
|
824
|
+
return true;
|
|
825
|
+
}
|
|
826
|
+
};
|
|
776
827
|
var OpenPdfPreviewOperation = {
|
|
777
828
|
id: "pdfs-ui.operation.open-preview",
|
|
778
829
|
type: import_core2.CommandType.OPERATION,
|
|
@@ -940,7 +991,10 @@ var SetPdfInteractionModeOperation = {
|
|
|
940
991
|
const featureService = accessor.get(IPdfsUIFeatureService);
|
|
941
992
|
const sel = accessor.get(import_univer_pdfs.IPdfSelectionService);
|
|
942
993
|
const targetMode = params?.mode ?? "select";
|
|
943
|
-
if (!featureService.isEditorEnabled() && targetMode === "ink") {
|
|
994
|
+
if (!featureService.isEditorEnabled() && (targetMode === "ink" || targetMode === "crop")) {
|
|
995
|
+
return false;
|
|
996
|
+
}
|
|
997
|
+
if (targetMode === "crop" && !featureService.getFeatures().cropBox) {
|
|
944
998
|
return false;
|
|
945
999
|
}
|
|
946
1000
|
sel.setInteractionMode(
|
|
@@ -1969,6 +2023,112 @@ var PdfCanvasView = () => {
|
|
|
1969
2023
|
const [liveInkPoints, setLiveInkPoints] = (0, import_react2.useState)(null);
|
|
1970
2024
|
const [isPanning, setIsPanning] = (0, import_react2.useState)(false);
|
|
1971
2025
|
const [signaturePadElementId, setSignaturePadElementId] = (0, import_react2.useState)(null);
|
|
2026
|
+
const [cropDraft, setCropDraft] = (0, import_react2.useState)(null);
|
|
2027
|
+
const resolvedActiveCrop = (0, import_react2.useMemo)(
|
|
2028
|
+
() => (0, import_univer_pdfs4.resolvePdfCropBoxPt)(activePage?.cropBox),
|
|
2029
|
+
[activePage?.cropBox]
|
|
2030
|
+
);
|
|
2031
|
+
const defaultCropRect = (0, import_react2.useMemo)(
|
|
2032
|
+
() => ({
|
|
2033
|
+
left: Math.round(pageSize.width * 0.06),
|
|
2034
|
+
top: Math.round(pageSize.height * 0.06),
|
|
2035
|
+
width: Math.max(24, Math.round(pageSize.width * 0.88)),
|
|
2036
|
+
height: Math.max(24, Math.round(pageSize.height * 0.88))
|
|
2037
|
+
}),
|
|
2038
|
+
[pageSize.width, pageSize.height]
|
|
2039
|
+
);
|
|
2040
|
+
(0, import_react2.useEffect)(() => {
|
|
2041
|
+
setCropDraft(null);
|
|
2042
|
+
}, [activePageId, interactionMode]);
|
|
2043
|
+
const effectiveCropRect = cropDraft ?? resolvedActiveCrop ?? defaultCropRect;
|
|
2044
|
+
const commitActiveCropBox = (0, import_react2.useCallback)(() => {
|
|
2045
|
+
if (!activePageId) return;
|
|
2046
|
+
commandService.syncExecuteCommand(import_univer_pdfs4.SetPdfPageCropBoxCommand.id, {
|
|
2047
|
+
pageId: activePageId,
|
|
2048
|
+
cropBox: {
|
|
2049
|
+
left: effectiveCropRect.left,
|
|
2050
|
+
top: effectiveCropRect.top,
|
|
2051
|
+
width: effectiveCropRect.width,
|
|
2052
|
+
height: effectiveCropRect.height,
|
|
2053
|
+
leftPt: effectiveCropRect.left,
|
|
2054
|
+
topPt: effectiveCropRect.top,
|
|
2055
|
+
widthPt: effectiveCropRect.width,
|
|
2056
|
+
heightPt: effectiveCropRect.height
|
|
2057
|
+
}
|
|
2058
|
+
});
|
|
2059
|
+
setCropDraft(null);
|
|
2060
|
+
void commandService.executeCommand(SetPdfInteractionModeOperation.id, { mode: "select" });
|
|
2061
|
+
}, [activePageId, commandService, effectiveCropRect]);
|
|
2062
|
+
const resetActiveCropBox = (0, import_react2.useCallback)(() => {
|
|
2063
|
+
if (!activePageId) return;
|
|
2064
|
+
commandService.syncExecuteCommand(import_univer_pdfs4.SetPdfPageCropBoxCommand.id, {
|
|
2065
|
+
pageId: activePageId,
|
|
2066
|
+
cropBox: void 0
|
|
2067
|
+
});
|
|
2068
|
+
setCropDraft(null);
|
|
2069
|
+
void commandService.executeCommand(SetPdfInteractionModeOperation.id, { mode: "select" });
|
|
2070
|
+
}, [activePageId, commandService]);
|
|
2071
|
+
const startPanCropRect = (e) => {
|
|
2072
|
+
e.stopPropagation();
|
|
2073
|
+
e.preventDefault();
|
|
2074
|
+
const orig = { ...effectiveCropRect };
|
|
2075
|
+
const startX = e.clientX;
|
|
2076
|
+
const startY = e.clientY;
|
|
2077
|
+
const onMove = (ev) => {
|
|
2078
|
+
const dx = (ev.clientX - startX) / zoom;
|
|
2079
|
+
const dy = (ev.clientY - startY) / zoom;
|
|
2080
|
+
const nextLeft = Math.round(Math.max(0, Math.min(pageSize.width - orig.width, orig.left + dx)) * 100) / 100;
|
|
2081
|
+
const nextTop = Math.round(Math.max(0, Math.min(pageSize.height - orig.height, orig.top + dy)) * 100) / 100;
|
|
2082
|
+
setCropDraft({ ...orig, left: nextLeft, top: nextTop });
|
|
2083
|
+
};
|
|
2084
|
+
const onUp = () => {
|
|
2085
|
+
window.removeEventListener("pointermove", onMove);
|
|
2086
|
+
window.removeEventListener("pointerup", onUp);
|
|
2087
|
+
};
|
|
2088
|
+
window.addEventListener("pointermove", onMove);
|
|
2089
|
+
window.addEventListener("pointerup", onUp);
|
|
2090
|
+
};
|
|
2091
|
+
const startResizeCropRect = (e, dir) => {
|
|
2092
|
+
e.stopPropagation();
|
|
2093
|
+
e.preventDefault();
|
|
2094
|
+
const orig = { ...effectiveCropRect };
|
|
2095
|
+
const startX = e.clientX;
|
|
2096
|
+
const startY = e.clientY;
|
|
2097
|
+
const minDim = 24;
|
|
2098
|
+
const onMove = (ev) => {
|
|
2099
|
+
const dx = (ev.clientX - startX) / zoom;
|
|
2100
|
+
const dy = (ev.clientY - startY) / zoom;
|
|
2101
|
+
let { left, top, width, height } = orig;
|
|
2102
|
+
if (dir.includes("e")) {
|
|
2103
|
+
width = Math.max(minDim, Math.min(pageSize.width - orig.left, orig.width + dx));
|
|
2104
|
+
}
|
|
2105
|
+
if (dir.includes("s")) {
|
|
2106
|
+
height = Math.max(minDim, Math.min(pageSize.height - orig.top, orig.height + dy));
|
|
2107
|
+
}
|
|
2108
|
+
if (dir.includes("w")) {
|
|
2109
|
+
const clampedLeft = Math.max(0, Math.min(orig.left + orig.width - minDim, orig.left + dx));
|
|
2110
|
+
width = orig.left + orig.width - clampedLeft;
|
|
2111
|
+
left = clampedLeft;
|
|
2112
|
+
}
|
|
2113
|
+
if (dir.includes("n")) {
|
|
2114
|
+
const clampedTop = Math.max(0, Math.min(orig.top + orig.height - minDim, orig.top + dy));
|
|
2115
|
+
height = orig.top + orig.height - clampedTop;
|
|
2116
|
+
top = clampedTop;
|
|
2117
|
+
}
|
|
2118
|
+
setCropDraft({
|
|
2119
|
+
left: Math.round(left * 100) / 100,
|
|
2120
|
+
top: Math.round(top * 100) / 100,
|
|
2121
|
+
width: Math.round(width * 100) / 100,
|
|
2122
|
+
height: Math.round(height * 100) / 100
|
|
2123
|
+
});
|
|
2124
|
+
};
|
|
2125
|
+
const onUp = () => {
|
|
2126
|
+
window.removeEventListener("pointermove", onMove);
|
|
2127
|
+
window.removeEventListener("pointerup", onUp);
|
|
2128
|
+
};
|
|
2129
|
+
window.addEventListener("pointermove", onMove);
|
|
2130
|
+
window.addEventListener("pointerup", onUp);
|
|
2131
|
+
};
|
|
1972
2132
|
const triggerDirectImageUpload = (0, import_react2.useCallback)(
|
|
1973
2133
|
(elementId) => {
|
|
1974
2134
|
if (typeof document === "undefined") return;
|
|
@@ -2283,7 +2443,7 @@ var PdfCanvasView = () => {
|
|
|
2283
2443
|
}
|
|
2284
2444
|
};
|
|
2285
2445
|
const startMoveElements = (e, clickedEl) => {
|
|
2286
|
-
if (interactionMode === "pan" || interactionMode === "ink") return;
|
|
2446
|
+
if (interactionMode === "pan" || interactionMode === "ink" || interactionMode === "crop") return;
|
|
2287
2447
|
if (interactionMode === "form") {
|
|
2288
2448
|
e.stopPropagation();
|
|
2289
2449
|
if (isLockedByLayer(clickedEl)) return;
|
|
@@ -2594,6 +2754,28 @@ var PdfCanvasView = () => {
|
|
|
2594
2754
|
}
|
|
2595
2755
|
)
|
|
2596
2756
|
] }),
|
|
2757
|
+
interactionMode === "crop" && editorEnabled && features.cropBox && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2758
|
+
"div",
|
|
2759
|
+
{
|
|
2760
|
+
className: "univer-pdf-floating-mode-bar",
|
|
2761
|
+
"data-testid": "pdf-crop-mode-banner",
|
|
2762
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2763
|
+
children: [
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(UiCropIcon, {}),
|
|
2765
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "\u9875\u9762\u88C1\u5207\u6A21\u5F0F\uFF1A\u62D6\u52A8\u56DB\u89D2\u6216\u56DB\u8FB9\u63A7\u5236\u70B9\u8C03\u6574\u88C1\u5207\u533A\u57DF" }),
|
|
2766
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: commitActiveCropBox, children: "\u5E94\u7528\u88C1\u5207" }),
|
|
2767
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: resetActiveCropBox, children: "\u91CD\u7F6E\u88C1\u5207" }),
|
|
2768
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2769
|
+
"button",
|
|
2770
|
+
{
|
|
2771
|
+
type: "button",
|
|
2772
|
+
onClick: () => void commandService.executeCommand(SetPdfInteractionModeOperation.id, { mode: "select" }),
|
|
2773
|
+
children: "\u53D6\u6D88 (Esc)"
|
|
2774
|
+
}
|
|
2775
|
+
)
|
|
2776
|
+
]
|
|
2777
|
+
}
|
|
2778
|
+
),
|
|
2597
2779
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ref: scrollRef, className: "univer-pdf-stage-scroll", onScroll: syncViewportRatio, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2598
2780
|
"div",
|
|
2599
2781
|
{
|
|
@@ -2679,15 +2861,16 @@ var PdfCanvasView = () => {
|
|
|
2679
2861
|
}
|
|
2680
2862
|
),
|
|
2681
2863
|
showCalibrationGrid && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CalibrationGridOverlay, { widthPt: pageSize.width, heightPt: pageSize.height, zoom }),
|
|
2682
|
-
|
|
2864
|
+
interactionMode !== "crop" && resolvedActiveCrop && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2683
2865
|
"div",
|
|
2684
2866
|
{
|
|
2867
|
+
"data-testid": "pdf-passive-crop-guide",
|
|
2685
2868
|
style: {
|
|
2686
2869
|
position: "absolute",
|
|
2687
|
-
left:
|
|
2688
|
-
top:
|
|
2689
|
-
width:
|
|
2690
|
-
height:
|
|
2870
|
+
left: resolvedActiveCrop.left * zoom,
|
|
2871
|
+
top: resolvedActiveCrop.top * zoom,
|
|
2872
|
+
width: resolvedActiveCrop.width * zoom,
|
|
2873
|
+
height: resolvedActiveCrop.height * zoom,
|
|
2691
2874
|
border: "1.5px dashed #2C53F1",
|
|
2692
2875
|
boxShadow: "0 0 0 9999px rgba(27, 28, 31, 0.08)",
|
|
2693
2876
|
pointerEvents: "none",
|
|
@@ -2695,6 +2878,160 @@ var PdfCanvasView = () => {
|
|
|
2695
2878
|
}
|
|
2696
2879
|
}
|
|
2697
2880
|
),
|
|
2881
|
+
interactionMode === "crop" && editorEnabled && features.cropBox && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2882
|
+
"div",
|
|
2883
|
+
{
|
|
2884
|
+
"data-testid": "pdf-canvas-crop-overlay",
|
|
2885
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
2886
|
+
style: {
|
|
2887
|
+
position: "absolute",
|
|
2888
|
+
inset: 0,
|
|
2889
|
+
zIndex: 60
|
|
2890
|
+
},
|
|
2891
|
+
children: [
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2893
|
+
"div",
|
|
2894
|
+
{
|
|
2895
|
+
style: {
|
|
2896
|
+
position: "absolute",
|
|
2897
|
+
left: 0,
|
|
2898
|
+
top: 0,
|
|
2899
|
+
width: pageWidthPx,
|
|
2900
|
+
height: effectiveCropRect.top * zoom,
|
|
2901
|
+
background: "rgba(27, 28, 31, 0.38)",
|
|
2902
|
+
pointerEvents: "none"
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
),
|
|
2906
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2907
|
+
"div",
|
|
2908
|
+
{
|
|
2909
|
+
style: {
|
|
2910
|
+
position: "absolute",
|
|
2911
|
+
left: 0,
|
|
2912
|
+
top: (effectiveCropRect.top + effectiveCropRect.height) * zoom,
|
|
2913
|
+
width: pageWidthPx,
|
|
2914
|
+
height: Math.max(0, pageHeightPx - (effectiveCropRect.top + effectiveCropRect.height) * zoom),
|
|
2915
|
+
background: "rgba(27, 28, 31, 0.38)",
|
|
2916
|
+
pointerEvents: "none"
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
),
|
|
2920
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2921
|
+
"div",
|
|
2922
|
+
{
|
|
2923
|
+
style: {
|
|
2924
|
+
position: "absolute",
|
|
2925
|
+
left: 0,
|
|
2926
|
+
top: effectiveCropRect.top * zoom,
|
|
2927
|
+
width: effectiveCropRect.left * zoom,
|
|
2928
|
+
height: effectiveCropRect.height * zoom,
|
|
2929
|
+
background: "rgba(27, 28, 31, 0.38)",
|
|
2930
|
+
pointerEvents: "none"
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2933
|
+
),
|
|
2934
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2935
|
+
"div",
|
|
2936
|
+
{
|
|
2937
|
+
style: {
|
|
2938
|
+
position: "absolute",
|
|
2939
|
+
left: (effectiveCropRect.left + effectiveCropRect.width) * zoom,
|
|
2940
|
+
top: effectiveCropRect.top * zoom,
|
|
2941
|
+
width: Math.max(0, pageWidthPx - (effectiveCropRect.left + effectiveCropRect.width) * zoom),
|
|
2942
|
+
height: effectiveCropRect.height * zoom,
|
|
2943
|
+
background: "rgba(27, 28, 31, 0.38)",
|
|
2944
|
+
pointerEvents: "none"
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
),
|
|
2948
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2949
|
+
"div",
|
|
2950
|
+
{
|
|
2951
|
+
"data-testid": "pdf-crop-box-rect",
|
|
2952
|
+
onPointerDown: startPanCropRect,
|
|
2953
|
+
style: {
|
|
2954
|
+
position: "absolute",
|
|
2955
|
+
left: effectiveCropRect.left * zoom,
|
|
2956
|
+
top: effectiveCropRect.top * zoom,
|
|
2957
|
+
width: effectiveCropRect.width * zoom,
|
|
2958
|
+
height: effectiveCropRect.height * zoom,
|
|
2959
|
+
border: "2px dashed #2C53F1",
|
|
2960
|
+
boxSizing: "border-box",
|
|
2961
|
+
cursor: "move"
|
|
2962
|
+
},
|
|
2963
|
+
children: [
|
|
2964
|
+
HANDLE_LIST.map((h) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2965
|
+
"div",
|
|
2966
|
+
{
|
|
2967
|
+
"data-testid": `pdf-crop-handle-${h.dir}`,
|
|
2968
|
+
className: "univer-pdf-resize-handle",
|
|
2969
|
+
style: {
|
|
2970
|
+
...h.style,
|
|
2971
|
+
width: 9,
|
|
2972
|
+
height: 9,
|
|
2973
|
+
background: "#2C53F1",
|
|
2974
|
+
border: "1.5px solid #FFFFFF",
|
|
2975
|
+
borderRadius: 2,
|
|
2976
|
+
cursor: h.cursor
|
|
2977
|
+
},
|
|
2978
|
+
onPointerDown: (ev) => startResizeCropRect(ev, h.dir)
|
|
2979
|
+
},
|
|
2980
|
+
`crop-${h.dir}`
|
|
2981
|
+
)),
|
|
2982
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
2983
|
+
"div",
|
|
2984
|
+
{
|
|
2985
|
+
"data-testid": "pdf-crop-action-pill",
|
|
2986
|
+
onPointerDown: (ev) => ev.stopPropagation(),
|
|
2987
|
+
style: {
|
|
2988
|
+
position: "absolute",
|
|
2989
|
+
bottom: -36,
|
|
2990
|
+
right: 0,
|
|
2991
|
+
display: "inline-flex",
|
|
2992
|
+
alignItems: "center",
|
|
2993
|
+
gap: 6,
|
|
2994
|
+
padding: "4px 8px",
|
|
2995
|
+
background: "#FFFFFF",
|
|
2996
|
+
border: "1px solid #D2DAFA",
|
|
2997
|
+
borderRadius: 999,
|
|
2998
|
+
boxShadow: "0 4px 14px rgba(27, 28, 31, 0.16)",
|
|
2999
|
+
whiteSpace: "nowrap",
|
|
3000
|
+
zIndex: 65
|
|
3001
|
+
},
|
|
3002
|
+
children: [
|
|
3003
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontSize: 10.5, color: "#4E5565", fontFamily: "monospace" }, children: displayUnit === "mm" ? `${(0, import_univer_pdfs4.ptToMm)(effectiveCropRect.width)}\xD7${(0, import_univer_pdfs4.ptToMm)(effectiveCropRect.height)} mm` : `${Math.round(effectiveCropRect.width)}\xD7${Math.round(effectiveCropRect.height)} pt` }),
|
|
3004
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3005
|
+
"button",
|
|
3006
|
+
{
|
|
3007
|
+
type: "button",
|
|
3008
|
+
"data-testid": "pdf-crop-apply-btn",
|
|
3009
|
+
className: "univer-pdf-mini-btn is-soft-primary",
|
|
3010
|
+
style: { padding: "2px 8px", fontSize: 11 },
|
|
3011
|
+
onClick: commitActiveCropBox,
|
|
3012
|
+
children: "\u5E94\u7528\u88C1\u5207"
|
|
3013
|
+
}
|
|
3014
|
+
),
|
|
3015
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3016
|
+
"button",
|
|
3017
|
+
{
|
|
3018
|
+
type: "button",
|
|
3019
|
+
"data-testid": "pdf-crop-reset-btn",
|
|
3020
|
+
className: "univer-pdf-mini-btn is-danger",
|
|
3021
|
+
style: { padding: "2px 8px", fontSize: 11 },
|
|
3022
|
+
onClick: resetActiveCropBox,
|
|
3023
|
+
children: "\u91CD\u7F6E\u88C1\u5207"
|
|
3024
|
+
}
|
|
3025
|
+
)
|
|
3026
|
+
]
|
|
3027
|
+
}
|
|
3028
|
+
)
|
|
3029
|
+
]
|
|
3030
|
+
}
|
|
3031
|
+
)
|
|
3032
|
+
]
|
|
3033
|
+
}
|
|
3034
|
+
),
|
|
2698
3035
|
elements.map((el) => {
|
|
2699
3036
|
if (isHiddenByLayer(el)) return null;
|
|
2700
3037
|
const elLocked = isLockedByLayer(el);
|
|
@@ -3394,8 +3731,24 @@ var ListElementView = ({ element, zoom, isEditing, onCommit }) => {
|
|
|
3394
3731
|
);
|
|
3395
3732
|
};
|
|
3396
3733
|
var StampElementView = ({ element, zoom }) => {
|
|
3734
|
+
if (element.svgContent) {
|
|
3735
|
+
const dataUrl = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(element.svgContent)}`;
|
|
3736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3737
|
+
"img",
|
|
3738
|
+
{
|
|
3739
|
+
src: dataUrl,
|
|
3740
|
+
alt: element.name || element.primaryText || "Stamp",
|
|
3741
|
+
draggable: false,
|
|
3742
|
+
style: { width: "100%", height: "100%", objectFit: "contain" }
|
|
3743
|
+
}
|
|
3744
|
+
);
|
|
3745
|
+
}
|
|
3397
3746
|
const color = element.color || "#dc2626";
|
|
3398
3747
|
const isRect = element.stampShape === "rect";
|
|
3748
|
+
const isPill = element.stampShape === "pill";
|
|
3749
|
+
const outerRadius = isPill ? 999 : isRect ? 4 * zoom : "50%";
|
|
3750
|
+
const innerRadius = isPill ? 999 : isRect ? 2 * zoom : "50%";
|
|
3751
|
+
const metaLine = [element.signer, element.dateText].filter(Boolean).join(" \xB7 ");
|
|
3399
3752
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3400
3753
|
"div",
|
|
3401
3754
|
{
|
|
@@ -3404,7 +3757,7 @@ var StampElementView = ({ element, zoom }) => {
|
|
|
3404
3757
|
height: "100%",
|
|
3405
3758
|
boxSizing: "border-box",
|
|
3406
3759
|
border: `${2.2 * zoom}px solid ${color}`,
|
|
3407
|
-
borderRadius:
|
|
3760
|
+
borderRadius: outerRadius,
|
|
3408
3761
|
padding: 3 * zoom,
|
|
3409
3762
|
display: "flex",
|
|
3410
3763
|
alignItems: "center",
|
|
@@ -3418,7 +3771,7 @@ var StampElementView = ({ element, zoom }) => {
|
|
|
3418
3771
|
width: "100%",
|
|
3419
3772
|
height: "100%",
|
|
3420
3773
|
border: `${0.9 * zoom}px solid ${color}`,
|
|
3421
|
-
borderRadius:
|
|
3774
|
+
borderRadius: innerRadius,
|
|
3422
3775
|
display: "flex",
|
|
3423
3776
|
flexDirection: "column",
|
|
3424
3777
|
alignItems: "center",
|
|
@@ -3430,7 +3783,8 @@ var StampElementView = ({ element, zoom }) => {
|
|
|
3430
3783
|
children: [
|
|
3431
3784
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 10.5 * zoom, fontWeight: 700, letterSpacing: 0.5 }, children: element.primaryText }),
|
|
3432
3785
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 16 16", width: 12 * zoom, height: 12 * zoom, fill: color, style: { margin: "1px 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polygon", { points: "8,1.5 9.9,5.8 14.5,6.2 11,9.3 12.1,13.8 8,11.4 3.9,13.8 5,9.3 1.5,6.2 6.1,5.8" }) }),
|
|
3433
|
-
element.secondaryText && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 8 * zoom, fontWeight: 600 }, children: element.secondaryText })
|
|
3786
|
+
element.secondaryText && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 8 * zoom, fontWeight: 600 }, children: element.secondaryText }),
|
|
3787
|
+
metaLine && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 7.5 * zoom, marginTop: 1 }, children: metaLine })
|
|
3434
3788
|
]
|
|
3435
3789
|
}
|
|
3436
3790
|
)
|
|
@@ -4195,11 +4549,18 @@ var AnnotationElementView = ({ element, zoom, isSelected }) => {
|
|
|
4195
4549
|
fontSize: 9.5,
|
|
4196
4550
|
padding: "1px 5px",
|
|
4197
4551
|
borderRadius: 999,
|
|
4198
|
-
background: element.status === "
|
|
4199
|
-
color: element.status === "
|
|
4200
|
-
border: `1px solid ${element.status === "
|
|
4552
|
+
background: (element.reviewStatus ?? element.status) === "accepted" || (element.reviewStatus ?? element.status) === "completed" || element.status === "resolved" ? "#F3F5FF" : (element.reviewStatus ?? element.status) === "rejected" ? "#FEF2F2" : "#EEEFF1",
|
|
4553
|
+
color: (element.reviewStatus ?? element.status) === "accepted" || (element.reviewStatus ?? element.status) === "completed" || element.status === "resolved" ? "#2C53F1" : (element.reviewStatus ?? element.status) === "rejected" ? "#DC2626" : "#4E5565",
|
|
4554
|
+
border: `1px solid ${(element.reviewStatus ?? element.status) === "accepted" || (element.reviewStatus ?? element.status) === "completed" || element.status === "resolved" ? "#D2DAFA" : (element.reviewStatus ?? element.status) === "rejected" ? "#FECACA" : "#E3E5EA"}`
|
|
4201
4555
|
},
|
|
4202
|
-
children:
|
|
4556
|
+
children: (() => {
|
|
4557
|
+
const st = element.reviewStatus ?? element.status ?? "open";
|
|
4558
|
+
if (st === "accepted") return "\u5DF2\u63A5\u53D7";
|
|
4559
|
+
if (st === "rejected") return "\u5DF2\u9A73\u56DE";
|
|
4560
|
+
if (st === "completed" || st === "resolved") return "\u5DF2\u5B8C\u6210";
|
|
4561
|
+
if (st === "cancelled") return "\u5DF2\u53D6\u6D88";
|
|
4562
|
+
return "\u5F85\u5904\u7406";
|
|
4563
|
+
})()
|
|
4203
4564
|
}
|
|
4204
4565
|
)
|
|
4205
4566
|
] }),
|
|
@@ -5005,6 +5366,10 @@ var PdfInspectorPanel = () => {
|
|
|
5005
5366
|
const [replaceNotice, setReplaceNotice] = (0, import_react4.useState)("");
|
|
5006
5367
|
const [replyAuthorInput, setReplyAuthorInput] = (0, import_react4.useState)("Reviewer");
|
|
5007
5368
|
const [replyContentInput, setReplyContentInput] = (0, import_react4.useState)("");
|
|
5369
|
+
const [stampPresetId, setStampPresetId] = (0, import_react4.useState)("approved");
|
|
5370
|
+
const [stampSignerInput, setStampSignerInput] = (0, import_react4.useState)("\u5BA1\u9605\u7EC4");
|
|
5371
|
+
const [stampDateInput, setStampDateInput] = (0, import_react4.useState)(() => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10));
|
|
5372
|
+
const [stampShapeInput, setStampShapeInput] = (0, import_react4.useState)("rect");
|
|
5008
5373
|
const currentSnapshot = snapshot ?? unit?.getSnapshot() ?? null;
|
|
5009
5374
|
if (!currentSnapshot || !unit) return null;
|
|
5010
5375
|
void versionsTick;
|
|
@@ -5461,38 +5826,248 @@ var PdfInspectorPanel = () => {
|
|
|
5461
5826
|
}
|
|
5462
5827
|
)
|
|
5463
5828
|
] }),
|
|
5464
|
-
features.cropBox && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("
|
|
5465
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5829
|
+
features.cropBox && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 5 }, children: [
|
|
5830
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-checkbox-row", children: [
|
|
5831
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5832
|
+
"input",
|
|
5833
|
+
{
|
|
5834
|
+
type: "checkbox",
|
|
5835
|
+
checked: Boolean(activePage.cropBox),
|
|
5836
|
+
onChange: (e) => {
|
|
5837
|
+
if (e.target.checked) {
|
|
5838
|
+
const pSz = activePage.pageSize ?? pageSize;
|
|
5839
|
+
commandService.syncExecuteCommand(import_univer_pdfs6.SetPdfPageCropBoxCommand.id, {
|
|
5840
|
+
pageId: activePage.id,
|
|
5841
|
+
cropBox: {
|
|
5842
|
+
left: Math.round(pSz.width * 0.05),
|
|
5843
|
+
top: Math.round(pSz.height * 0.05),
|
|
5844
|
+
width: Math.round(pSz.width * 0.9),
|
|
5845
|
+
height: Math.round(pSz.height * 0.9)
|
|
5846
|
+
}
|
|
5847
|
+
});
|
|
5848
|
+
} else {
|
|
5849
|
+
commandService.syncExecuteCommand(import_univer_pdfs6.SetPdfPageCropBoxCommand.id, {
|
|
5850
|
+
pageId: activePage.id,
|
|
5851
|
+
cropBox: void 0
|
|
5852
|
+
});
|
|
5853
|
+
}
|
|
5487
5854
|
}
|
|
5488
5855
|
}
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5856
|
+
),
|
|
5857
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UiCropIcon, {}),
|
|
5858
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u542F\u7528\u5F53\u524D\u9875\u88C1\u5207\u6846 (CropBox)" })
|
|
5859
|
+
] }),
|
|
5860
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-btn-row", children: [
|
|
5861
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5862
|
+
"button",
|
|
5863
|
+
{
|
|
5864
|
+
type: "button",
|
|
5865
|
+
"data-testid": "pdf-inspector-enter-crop-btn",
|
|
5866
|
+
className: "univer-pdf-mini-btn",
|
|
5867
|
+
style: { flex: 1, display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 4 },
|
|
5868
|
+
onClick: () => void commandService.executeCommand(SetPdfInteractionModeOperation.id, { mode: "crop" }),
|
|
5869
|
+
children: [
|
|
5870
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UiCropIcon, {}),
|
|
5871
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u753B\u5E03\u62D6\u62FD\u88C1\u5207" })
|
|
5872
|
+
]
|
|
5873
|
+
}
|
|
5874
|
+
),
|
|
5875
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5876
|
+
"button",
|
|
5877
|
+
{
|
|
5878
|
+
type: "button",
|
|
5879
|
+
"data-testid": "pdf-inspector-open-split-btn",
|
|
5880
|
+
className: "univer-pdf-mini-btn",
|
|
5881
|
+
style: { flex: 1, display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 4 },
|
|
5882
|
+
onClick: () => void commandService.executeCommand(OpenPdfSplitModalOperation.id, { open: true }),
|
|
5883
|
+
children: [
|
|
5884
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UiSplitMergeIcon, {}),
|
|
5885
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u62C6\u5206\u63D0\u53D6" })
|
|
5886
|
+
]
|
|
5887
|
+
}
|
|
5888
|
+
)
|
|
5889
|
+
] })
|
|
5890
|
+
] }),
|
|
5891
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
5892
|
+
"button",
|
|
5893
|
+
{
|
|
5894
|
+
type: "button",
|
|
5895
|
+
"data-testid": "pdf-inspector-export-pptx-btn",
|
|
5896
|
+
className: "univer-pdf-mini-btn",
|
|
5897
|
+
style: { width: "100%", marginTop: 4, display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 5 },
|
|
5898
|
+
onClick: () => {
|
|
5899
|
+
const pptxBytes = (0, import_univer_pdfs6.convertPdfUnitToPptxBytes)(currentSnapshot);
|
|
5900
|
+
if (typeof document !== "undefined" && typeof URL !== "undefined" && typeof URL.createObjectURL === "function") {
|
|
5901
|
+
const blob = new Blob([pptxBytes.slice().buffer], {
|
|
5902
|
+
type: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
|
5903
|
+
});
|
|
5904
|
+
const url = URL.createObjectURL(blob);
|
|
5905
|
+
const a = document.createElement("a");
|
|
5906
|
+
a.href = url;
|
|
5907
|
+
a.download = `${(currentSnapshot.name || "presentation").replace(/[\\/:*?"<>|]+/g, "_")}.pptx`;
|
|
5908
|
+
document.body.appendChild(a);
|
|
5909
|
+
a.click();
|
|
5910
|
+
a.remove();
|
|
5911
|
+
setTimeout(() => URL.revokeObjectURL(url), 1e4);
|
|
5912
|
+
}
|
|
5913
|
+
},
|
|
5914
|
+
children: [
|
|
5915
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UiPptxSlideIcon, { style: { color: "#2C53F1" } }),
|
|
5916
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5BFC\u51FA\u53EF\u7F16\u8F91 PPTX \u6F14\u793A\u6587\u7A3F (.pptx)" })
|
|
5917
|
+
]
|
|
5918
|
+
}
|
|
5919
|
+
)
|
|
5494
5920
|
] })
|
|
5495
5921
|
] }),
|
|
5922
|
+
(isPdfElementTypeAllowed(import_univer_pdfs6.PdfElementType.STAMP, features) || isPdfElementTypeAllowed(import_univer_pdfs6.PdfElementType.SVG, features)) && (() => {
|
|
5923
|
+
const activeStampPreset = (0, import_univer_pdfs6.getPdfStandardStampPreset)(stampPresetId) ?? import_univer_pdfs6.PDF_STANDARD_STAMP_PRESETS[0];
|
|
5924
|
+
const previewSvg = (0, import_univer_pdfs6.buildPdfApprovalStampSvg)({
|
|
5925
|
+
preset: activeStampPreset.id,
|
|
5926
|
+
title: activeStampPreset.title,
|
|
5927
|
+
subtitle: activeStampPreset.subtitle,
|
|
5928
|
+
signer: stampSignerInput,
|
|
5929
|
+
dateText: stampDateInput,
|
|
5930
|
+
color: activeStampPreset.color,
|
|
5931
|
+
shape: stampShapeInput
|
|
5932
|
+
});
|
|
5933
|
+
const previewDataUri = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(previewSvg)}`;
|
|
5934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-inspector-section", "data-testid": "pdf-inspector-stamp-library", children: [
|
|
5935
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-inspector-heading", style: { justifyContent: "flex-start", gap: 5 }, children: [
|
|
5936
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UiStampSealIcon, { style: { color: "#4E5565" } }),
|
|
5937
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u6807\u51C6\u5BA1\u9605\u56FE\u7AE0\u5E93\u4E0E\u52A8\u6001\u7B7E\u7AE0" })
|
|
5938
|
+
] }),
|
|
5939
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 4 }, children: import_univer_pdfs6.PDF_STANDARD_STAMP_PRESETS.map((preset) => {
|
|
5940
|
+
const selected = preset.id === activeStampPreset.id;
|
|
5941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5942
|
+
"button",
|
|
5943
|
+
{
|
|
5944
|
+
type: "button",
|
|
5945
|
+
"data-testid": `pdf-stamp-preset-${preset.id}`,
|
|
5946
|
+
onClick: () => {
|
|
5947
|
+
setStampPresetId(preset.id);
|
|
5948
|
+
setStampShapeInput(preset.shape);
|
|
5949
|
+
},
|
|
5950
|
+
style: {
|
|
5951
|
+
padding: "4px 3px",
|
|
5952
|
+
fontSize: 10.5,
|
|
5953
|
+
fontWeight: selected ? 600 : 500,
|
|
5954
|
+
borderRadius: 4,
|
|
5955
|
+
border: selected ? `1.5px solid ${preset.color}` : "1px solid #E3E5EA",
|
|
5956
|
+
background: selected ? "#F9FAFB" : "#FFFFFF",
|
|
5957
|
+
color: preset.color,
|
|
5958
|
+
cursor: "pointer",
|
|
5959
|
+
overflow: "hidden",
|
|
5960
|
+
textOverflow: "ellipsis",
|
|
5961
|
+
whiteSpace: "nowrap"
|
|
5962
|
+
},
|
|
5963
|
+
title: `${preset.title} (${preset.subtitle})`,
|
|
5964
|
+
children: preset.title
|
|
5965
|
+
},
|
|
5966
|
+
preset.id
|
|
5967
|
+
);
|
|
5968
|
+
}) }),
|
|
5969
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-grid-2", children: [
|
|
5970
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
5971
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u7B7E\u7F72\u4EBA / \u90E8\u95E8" }),
|
|
5972
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5973
|
+
"input",
|
|
5974
|
+
{
|
|
5975
|
+
type: "text",
|
|
5976
|
+
"data-testid": "pdf-stamp-signer-input",
|
|
5977
|
+
value: stampSignerInput,
|
|
5978
|
+
placeholder: "\u5982\uFF1A\u6CD5\u52A1\u90E8 \xB7 \u738B\u5DE5",
|
|
5979
|
+
onChange: (e) => setStampSignerInput(e.target.value)
|
|
5980
|
+
}
|
|
5981
|
+
)
|
|
5982
|
+
] }),
|
|
5983
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
5984
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u7B7E\u7AE0\u65E5\u671F" }),
|
|
5985
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5986
|
+
"input",
|
|
5987
|
+
{
|
|
5988
|
+
type: "text",
|
|
5989
|
+
"data-testid": "pdf-stamp-date-input",
|
|
5990
|
+
value: stampDateInput,
|
|
5991
|
+
placeholder: "YYYY-MM-DD",
|
|
5992
|
+
onChange: (e) => setStampDateInput(e.target.value)
|
|
5993
|
+
}
|
|
5994
|
+
)
|
|
5995
|
+
] })
|
|
5996
|
+
] }),
|
|
5997
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-row", children: [
|
|
5998
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u56FE\u7AE0\u5916\u6846\u7248\u5F0F" }),
|
|
5999
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
6000
|
+
"select",
|
|
6001
|
+
{
|
|
6002
|
+
"data-testid": "pdf-stamp-shape-select",
|
|
6003
|
+
value: stampShapeInput,
|
|
6004
|
+
onChange: (e) => setStampShapeInput(e.target.value),
|
|
6005
|
+
children: [
|
|
6006
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "rect", children: "\u6807\u51C6\u65B9\u7AE0 (rect)" }),
|
|
6007
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "pill", children: "\u5706\u89D2\u80F6\u56CA\u7AE0 (pill)" }),
|
|
6008
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "circle", children: "\u53CC\u73AF\u516C\u7AE0\u5706\u7AE0 (circle)" })
|
|
6009
|
+
]
|
|
6010
|
+
}
|
|
6011
|
+
)
|
|
6012
|
+
] }),
|
|
6013
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6014
|
+
"div",
|
|
6015
|
+
{
|
|
6016
|
+
style: {
|
|
6017
|
+
padding: "6px 8px",
|
|
6018
|
+
background: "#F9FAFB",
|
|
6019
|
+
border: "1px dashed #D5D8DF",
|
|
6020
|
+
borderRadius: 5,
|
|
6021
|
+
display: "flex",
|
|
6022
|
+
alignItems: "center",
|
|
6023
|
+
justifyContent: "center",
|
|
6024
|
+
minHeight: 54
|
|
6025
|
+
},
|
|
6026
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6027
|
+
"img",
|
|
6028
|
+
{
|
|
6029
|
+
src: previewDataUri,
|
|
6030
|
+
alt: activeStampPreset.title,
|
|
6031
|
+
style: { maxHeight: 58, maxWidth: "100%", objectFit: "contain" }
|
|
6032
|
+
}
|
|
6033
|
+
)
|
|
6034
|
+
}
|
|
6035
|
+
),
|
|
6036
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6037
|
+
"button",
|
|
6038
|
+
{
|
|
6039
|
+
type: "button",
|
|
6040
|
+
"data-testid": "pdf-stamp-insert-btn",
|
|
6041
|
+
className: "univer-pdf-mini-btn is-soft-primary",
|
|
6042
|
+
style: { width: "100%" },
|
|
6043
|
+
onClick: () => {
|
|
6044
|
+
const useStampType = isPdfElementTypeAllowed(import_univer_pdfs6.PdfElementType.STAMP, features);
|
|
6045
|
+
const built = (0, import_univer_pdfs6.createPdfApprovalStampElement)({
|
|
6046
|
+
preset: activeStampPreset.id,
|
|
6047
|
+
title: activeStampPreset.title,
|
|
6048
|
+
subtitle: activeStampPreset.subtitle,
|
|
6049
|
+
signer: stampSignerInput,
|
|
6050
|
+
dateText: stampDateInput,
|
|
6051
|
+
color: activeStampPreset.color,
|
|
6052
|
+
shape: stampShapeInput
|
|
6053
|
+
});
|
|
6054
|
+
commandService.syncExecuteCommand(import_univer_pdfs6.AddPdfElementCommand.id, {
|
|
6055
|
+
pageId: activePageId,
|
|
6056
|
+
elementType: useStampType ? import_univer_pdfs6.PdfElementType.STAMP : import_univer_pdfs6.PdfElementType.SVG,
|
|
6057
|
+
element: useStampType ? built : {
|
|
6058
|
+
type: import_univer_pdfs6.PdfElementType.SVG,
|
|
6059
|
+
name: built.name,
|
|
6060
|
+
svgContent: previewSvg,
|
|
6061
|
+
opacity: 0.92,
|
|
6062
|
+
transform: built.transform
|
|
6063
|
+
}
|
|
6064
|
+
});
|
|
6065
|
+
},
|
|
6066
|
+
children: "\u4E00\u952E\u52A0\u76D6\u52A8\u6001\u56FE\u7AE0\u81F3\u5F53\u524D\u9875"
|
|
6067
|
+
}
|
|
6068
|
+
)
|
|
6069
|
+
] });
|
|
6070
|
+
})(),
|
|
5496
6071
|
features.findReplace && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-inspector-section", children: [
|
|
5497
6072
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-inspector-heading", style: { justifyContent: "space-between" }, children: [
|
|
5498
6073
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 5 }, children: [
|
|
@@ -6512,165 +7087,245 @@ var PdfInspectorPanel = () => {
|
|
|
6512
7087
|
)
|
|
6513
7088
|
] })
|
|
6514
7089
|
] }),
|
|
6515
|
-
isPdfElementTypeAllowed(import_univer_pdfs6.PdfElementType.ANNOTATION, features) && element.type === import_univer_pdfs6.PdfElementType.ANNOTATION &&
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
}
|
|
6533
|
-
)
|
|
6534
|
-
] }),
|
|
6535
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
6536
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5BA1\u9605\u72B6\u6001" }),
|
|
6537
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
6538
|
-
"select",
|
|
6539
|
-
{
|
|
6540
|
-
value: element.status ?? "open",
|
|
6541
|
-
onChange: (e) => updateElement({ status: e.target.value }),
|
|
6542
|
-
children: [
|
|
6543
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "open", children: "\u5F85\u5904\u7406 (open)" }),
|
|
6544
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "accepted", children: "\u5DF2\u91C7\u7EB3 (accepted)" }),
|
|
6545
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "rejected", children: "\u5DF2\u9A73\u56DE (rejected)" }),
|
|
6546
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "resolved", children: "\u5DF2\u89E3\u51B3 (resolved)" })
|
|
6547
|
-
]
|
|
6548
|
-
}
|
|
6549
|
-
)
|
|
6550
|
-
] }),
|
|
6551
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
6552
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5BA1\u9605\u4EBA" }),
|
|
7090
|
+
isPdfElementTypeAllowed(import_univer_pdfs6.PdfElementType.ANNOTATION, features) && element.type === import_univer_pdfs6.PdfElementType.ANNOTATION && (() => {
|
|
7091
|
+
const rawStatus = element.reviewStatus ?? element.status ?? "open";
|
|
7092
|
+
const effectiveReviewStatus = rawStatus === "accepted" || rawStatus === "rejected" || rawStatus === "completed" || rawStatus === "cancelled" ? rawStatus : rawStatus === "resolved" ? "completed" : "open";
|
|
7093
|
+
const statusMetaMap = {
|
|
7094
|
+
open: { label: "\u5F85\u5904\u7406", color: "#4E5565", bg: "#F9FAFB", border: "#D5D8DF" },
|
|
7095
|
+
accepted: { label: "\u5DF2\u63A5\u53D7", color: "#16A34A", bg: "#F0FDF4", border: "#BBF7D0" },
|
|
7096
|
+
rejected: { label: "\u5DF2\u62D2\u7EDD", color: "#DC2626", bg: "#FEF2F2", border: "#FECACA" },
|
|
7097
|
+
completed: { label: "\u5DF2\u5B8C\u6210", color: "#2C53F1", bg: "#F3F5FF", border: "#D2DAFA" },
|
|
7098
|
+
cancelled: { label: "\u5DF2\u53D6\u6D88", color: "#64748B", bg: "#F1F5F9", border: "#CBD5E1" }
|
|
7099
|
+
};
|
|
7100
|
+
const curBadge = statusMetaMap[effectiveReviewStatus];
|
|
7101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-inspector-section", "data-testid": "pdf-inspector-annotation-thread", children: [
|
|
7102
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-inspector-heading", style: { justifyContent: "space-between" }, children: [
|
|
7103
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 5 }, children: [
|
|
7104
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UiMessageReplyIcon, { style: { color: "#4E5565" } }),
|
|
7105
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u6279\u6CE8\u56DE\u590D\u7EBF\u7A0B\u4E0E\u5BA1\u9605\u72B6\u6001\u6D41\u8F6C" })
|
|
7106
|
+
] }),
|
|
6553
7107
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6554
|
-
"
|
|
7108
|
+
"span",
|
|
6555
7109
|
{
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
7110
|
+
"data-testid": "pdf-annot-review-status-badge",
|
|
7111
|
+
style: {
|
|
7112
|
+
fontSize: 10.5,
|
|
7113
|
+
fontWeight: 600,
|
|
7114
|
+
padding: "1px 7px",
|
|
7115
|
+
borderRadius: 999,
|
|
7116
|
+
color: curBadge.color,
|
|
7117
|
+
background: curBadge.bg,
|
|
7118
|
+
border: `1px solid ${curBadge.border}`
|
|
7119
|
+
},
|
|
7120
|
+
children: curBadge.label
|
|
6559
7121
|
}
|
|
6560
7122
|
)
|
|
6561
7123
|
] }),
|
|
6562
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
7124
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 4 }, children: ["open", "accepted", "rejected", "completed", "cancelled"].map((st) => {
|
|
7125
|
+
const m = statusMetaMap[st];
|
|
7126
|
+
const isCur = effectiveReviewStatus === st;
|
|
7127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7128
|
+
"button",
|
|
6566
7129
|
{
|
|
6567
|
-
type: "
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
6587
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { fontSize: 11, fontWeight: 600, color: "#31363F" }, children: [
|
|
6588
|
-
"\u56DE\u590D\u4E32 (",
|
|
6589
|
-
(element.replies ?? []).length,
|
|
6590
|
-
")"
|
|
6591
|
-
] }),
|
|
6592
|
-
(element.replies ?? []).map((rep) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
6593
|
-
"div",
|
|
6594
|
-
{
|
|
6595
|
-
style: {
|
|
6596
|
-
padding: "5px 7px",
|
|
6597
|
-
background: "#F9FAFB",
|
|
6598
|
-
border: "1px solid #E3E5EA",
|
|
6599
|
-
borderRadius: 4,
|
|
6600
|
-
fontSize: 11,
|
|
6601
|
-
display: "flex",
|
|
6602
|
-
justifyContent: "space-between",
|
|
6603
|
-
alignItems: "flex-start",
|
|
6604
|
-
gap: 6
|
|
7130
|
+
type: "button",
|
|
7131
|
+
"data-testid": `pdf-annot-status-btn-${st}`,
|
|
7132
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_pdfs6.SetPdfAnnotationReviewStatusCommand.id, {
|
|
7133
|
+
unitId: unit.getUnitId(),
|
|
7134
|
+
pageId: activePageId,
|
|
7135
|
+
elementId: element.id,
|
|
7136
|
+
reviewStatus: st
|
|
7137
|
+
}),
|
|
7138
|
+
style: {
|
|
7139
|
+
padding: "2px 7px",
|
|
7140
|
+
fontSize: 10.5,
|
|
7141
|
+
fontWeight: isCur ? 600 : 500,
|
|
7142
|
+
borderRadius: 4,
|
|
7143
|
+
border: isCur ? `1.5px solid ${m.color}` : "1px solid #E3E5EA",
|
|
7144
|
+
background: isCur ? m.bg : "#FFFFFF",
|
|
7145
|
+
color: isCur ? m.color : "#4E5565",
|
|
7146
|
+
cursor: "pointer"
|
|
7147
|
+
},
|
|
7148
|
+
children: m.label
|
|
6605
7149
|
},
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
{
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
}),
|
|
6622
|
-
children: "\
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
},
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
7150
|
+
st
|
|
7151
|
+
);
|
|
7152
|
+
}) }),
|
|
7153
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-grid-2", children: [
|
|
7154
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
7155
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u6279\u6CE8\u7C7B\u578B" }),
|
|
7156
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
7157
|
+
"select",
|
|
7158
|
+
{
|
|
7159
|
+
value: element.annotationType,
|
|
7160
|
+
onChange: (e) => updateElement({ annotationType: e.target.value }),
|
|
7161
|
+
children: [
|
|
7162
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "highlight", children: "\u8367\u5149\u9AD8\u4EAE (Highlight)" }),
|
|
7163
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "underline", children: "\u4E0B\u5212\u7EBF (Underline)" }),
|
|
7164
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "strikeout", children: "\u5220\u9664\u7EBF (Strikeout)" }),
|
|
7165
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "squiggly", children: "\u6CE2\u6D6A\u7EBF (Squiggly)" }),
|
|
7166
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "stickyNote", children: "\u5BA1\u9605\u4FBF\u7B7E (Sticky Note)" })
|
|
7167
|
+
]
|
|
7168
|
+
}
|
|
7169
|
+
)
|
|
7170
|
+
] }),
|
|
7171
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
7172
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5BA1\u9605\u72B6\u6001" }),
|
|
7173
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
7174
|
+
"select",
|
|
7175
|
+
{
|
|
7176
|
+
"data-testid": "pdf-annot-review-status-select",
|
|
7177
|
+
value: effectiveReviewStatus,
|
|
7178
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_pdfs6.SetPdfAnnotationReviewStatusCommand.id, {
|
|
7179
|
+
unitId: unit.getUnitId(),
|
|
7180
|
+
pageId: activePageId,
|
|
7181
|
+
elementId: element.id,
|
|
7182
|
+
reviewStatus: e.target.value
|
|
7183
|
+
}),
|
|
7184
|
+
children: [
|
|
7185
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "open", children: "\u5F85\u5904\u7406 (open)" }),
|
|
7186
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "accepted", children: "\u5DF2\u63A5\u53D7 (accepted)" }),
|
|
7187
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "rejected", children: "\u5DF2\u62D2\u7EDD (rejected)" }),
|
|
7188
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "completed", children: "\u5DF2\u5B8C\u6210 (completed)" }),
|
|
7189
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "cancelled", children: "\u5DF2\u53D6\u6D88 (cancelled)" })
|
|
7190
|
+
]
|
|
7191
|
+
}
|
|
7192
|
+
)
|
|
7193
|
+
] }),
|
|
7194
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
7195
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5BA1\u9605\u4EBA" }),
|
|
7196
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7197
|
+
"input",
|
|
7198
|
+
{
|
|
7199
|
+
type: "text",
|
|
7200
|
+
value: element.author ?? "Reviewer",
|
|
7201
|
+
onChange: (e) => updateElement({ author: e.target.value })
|
|
7202
|
+
}
|
|
7203
|
+
)
|
|
7204
|
+
] }),
|
|
7205
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
7206
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u6807\u8BB0\u989C\u8272" }),
|
|
7207
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7208
|
+
"input",
|
|
7209
|
+
{
|
|
7210
|
+
type: "color",
|
|
7211
|
+
value: element.color || "#2C53F1",
|
|
7212
|
+
onChange: (e) => updateElement({ color: e.target.value })
|
|
7213
|
+
}
|
|
7214
|
+
)
|
|
7215
|
+
] })
|
|
7216
|
+
] }),
|
|
7217
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
7218
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u6279\u6CE8\u6B63\u6587" }),
|
|
6640
7219
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
6641
|
-
"
|
|
7220
|
+
"textarea",
|
|
6642
7221
|
{
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
onChange: (e) =>
|
|
6647
|
-
style: { flex: 1, fontSize: 11, padding: "3px 5px", border: "1px solid #E3E5EA", borderRadius: 4 }
|
|
7222
|
+
rows: 2,
|
|
7223
|
+
value: element.comment ?? "",
|
|
7224
|
+
placeholder: "\u8F93\u5165\u5BA1\u9605\u610F\u89C1...",
|
|
7225
|
+
onChange: (e) => updateElement({ comment: e.target.value })
|
|
6648
7226
|
}
|
|
6649
|
-
)
|
|
6650
|
-
|
|
6651
|
-
|
|
7227
|
+
)
|
|
7228
|
+
] }),
|
|
7229
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { "data-testid": "pdf-annot-reply-list", style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
7230
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { fontSize: 11, fontWeight: 600, color: "#31363F" }, children: [
|
|
7231
|
+
"\u56DE\u590D\u4E32 (",
|
|
7232
|
+
(element.replies ?? []).length,
|
|
7233
|
+
")"
|
|
7234
|
+
] }),
|
|
7235
|
+
(element.replies ?? []).map((rep) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
7236
|
+
"div",
|
|
6652
7237
|
{
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
replies: [...element.replies ?? [], newReply]
|
|
6665
|
-
});
|
|
6666
|
-
setReplyContentInput("");
|
|
7238
|
+
"data-testid": `pdf-annot-reply-item-${rep.id}`,
|
|
7239
|
+
style: {
|
|
7240
|
+
padding: "5px 7px",
|
|
7241
|
+
background: "#F9FAFB",
|
|
7242
|
+
border: "1px solid #E3E5EA",
|
|
7243
|
+
borderRadius: 4,
|
|
7244
|
+
fontSize: 11,
|
|
7245
|
+
display: "flex",
|
|
7246
|
+
justifyContent: "space-between",
|
|
7247
|
+
alignItems: "flex-start",
|
|
7248
|
+
gap: 6
|
|
6667
7249
|
},
|
|
6668
|
-
children:
|
|
6669
|
-
|
|
6670
|
-
|
|
7250
|
+
children: [
|
|
7251
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
7252
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
7253
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("strong", { style: { color: "#1B1C1F" }, children: [
|
|
7254
|
+
rep.author,
|
|
7255
|
+
": "
|
|
7256
|
+
] }),
|
|
7257
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "#31363F" }, children: rep.content })
|
|
7258
|
+
] }),
|
|
7259
|
+
rep.createdAt && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: 9.5, color: "#7D8698", marginTop: 1 }, children: rep.createdAt.slice(0, 16).replace("T", " ") })
|
|
7260
|
+
] }),
|
|
7261
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7262
|
+
"button",
|
|
7263
|
+
{
|
|
7264
|
+
type: "button",
|
|
7265
|
+
"data-testid": `pdf-annot-delete-reply-${rep.id}`,
|
|
7266
|
+
className: "univer-pdf-mini-btn is-danger",
|
|
7267
|
+
onClick: () => commandService.syncExecuteCommand(import_univer_pdfs6.DeletePdfAnnotationReplyCommand.id, {
|
|
7268
|
+
unitId: unit.getUnitId(),
|
|
7269
|
+
pageId: activePageId,
|
|
7270
|
+
elementId: element.id,
|
|
7271
|
+
replyId: rep.id
|
|
7272
|
+
}),
|
|
7273
|
+
children: "\xD7"
|
|
7274
|
+
}
|
|
7275
|
+
)
|
|
7276
|
+
]
|
|
7277
|
+
},
|
|
7278
|
+
rep.id
|
|
7279
|
+
)),
|
|
7280
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { display: "flex", gap: 4 }, children: [
|
|
7281
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7282
|
+
"input",
|
|
7283
|
+
{
|
|
7284
|
+
type: "text",
|
|
7285
|
+
placeholder: "\u56DE\u590D\u4EBA",
|
|
7286
|
+
value: replyAuthorInput,
|
|
7287
|
+
onChange: (e) => setReplyAuthorInput(e.target.value),
|
|
7288
|
+
style: { width: 68, fontSize: 11, padding: "3px 5px", border: "1px solid #E3E5EA", borderRadius: 4 }
|
|
7289
|
+
}
|
|
7290
|
+
),
|
|
7291
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7292
|
+
"input",
|
|
7293
|
+
{
|
|
7294
|
+
type: "text",
|
|
7295
|
+
"data-testid": "pdf-annot-reply-input",
|
|
7296
|
+
placeholder: "\u8F93\u5165\u6279\u6CE8\u56DE\u590D\u5185\u5BB9...",
|
|
7297
|
+
value: replyContentInput,
|
|
7298
|
+
onChange: (e) => setReplyContentInput(e.target.value),
|
|
7299
|
+
style: { flex: 1, fontSize: 11, padding: "3px 5px", border: "1px solid #E3E5EA", borderRadius: 4 }
|
|
7300
|
+
}
|
|
7301
|
+
),
|
|
7302
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7303
|
+
"button",
|
|
7304
|
+
{
|
|
7305
|
+
type: "button",
|
|
7306
|
+
"data-testid": "pdf-annot-add-reply-btn",
|
|
7307
|
+
className: "univer-pdf-mini-btn is-soft-primary",
|
|
7308
|
+
disabled: !replyContentInput.trim(),
|
|
7309
|
+
onClick: () => {
|
|
7310
|
+
commandService.syncExecuteCommand(import_univer_pdfs6.AddPdfAnnotationReplyCommand.id, {
|
|
7311
|
+
unitId: unit.getUnitId(),
|
|
7312
|
+
pageId: activePageId,
|
|
7313
|
+
elementId: element.id,
|
|
7314
|
+
reply: {
|
|
7315
|
+
author: replyAuthorInput.trim() || "Reviewer",
|
|
7316
|
+
content: replyContentInput.trim(),
|
|
7317
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
7318
|
+
}
|
|
7319
|
+
});
|
|
7320
|
+
setReplyContentInput("");
|
|
7321
|
+
},
|
|
7322
|
+
children: "+ \u6DFB\u52A0\u56DE\u590D"
|
|
7323
|
+
}
|
|
7324
|
+
)
|
|
7325
|
+
] })
|
|
6671
7326
|
] })
|
|
6672
|
-
] })
|
|
6673
|
-
|
|
7327
|
+
] });
|
|
7328
|
+
})(),
|
|
6674
7329
|
isPdfElementTypeAllowed(import_univer_pdfs6.PdfElementType.REDACTION, features) && element.type === import_univer_pdfs6.PdfElementType.REDACTION && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-inspector-section", children: [
|
|
6675
7330
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "univer-pdf-inspector-heading", children: "\u6C38\u4E45\u8131\u654F\u6D82\u9ED1 (\u5BFC\u51FA\u81EA\u52A8\u5265\u79BB\u5E95\u5C42\u6587\u672C)" }),
|
|
6676
7331
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-row", children: [
|
|
@@ -7162,17 +7817,64 @@ var PdfInspectorPanel = () => {
|
|
|
7162
7817
|
] })
|
|
7163
7818
|
] }),
|
|
7164
7819
|
element.type === import_univer_pdfs6.PdfElementType.STAMP && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-inspector-section", children: [
|
|
7165
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "univer-pdf-inspector-heading", children: "\u7535\u5B50\u7B7E\u7AE0\u914D\u7F6E" }),
|
|
7820
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "univer-pdf-inspector-heading", children: "\u7535\u5B50\u7B7E\u7AE0\u4E0E\u6807\u51C6\u5BA1\u9605\u7AE0\u914D\u7F6E" }),
|
|
7821
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { display: "grid", gridTemplateColumns: "repeat(4, 1fr)", gap: 4 }, children: import_univer_pdfs6.PDF_STANDARD_STAMP_PRESETS.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7822
|
+
"button",
|
|
7823
|
+
{
|
|
7824
|
+
type: "button",
|
|
7825
|
+
className: "univer-pdf-mini-btn",
|
|
7826
|
+
style: { fontSize: 10, padding: "3px 2px", color: preset.color, borderColor: element.preset === preset.id ? preset.color : void 0 },
|
|
7827
|
+
onClick: () => {
|
|
7828
|
+
const nextShape = preset.shape;
|
|
7829
|
+
const nextSvg = (0, import_univer_pdfs6.buildPdfApprovalStampSvg)({
|
|
7830
|
+
preset: preset.id,
|
|
7831
|
+
title: preset.title,
|
|
7832
|
+
subtitle: preset.subtitle,
|
|
7833
|
+
signer: element.signer,
|
|
7834
|
+
dateText: element.dateText,
|
|
7835
|
+
color: preset.color,
|
|
7836
|
+
shape: nextShape
|
|
7837
|
+
});
|
|
7838
|
+
updateElement({
|
|
7839
|
+
preset: preset.id,
|
|
7840
|
+
stampShape: nextShape,
|
|
7841
|
+
primaryText: preset.title,
|
|
7842
|
+
secondaryText: preset.subtitle,
|
|
7843
|
+
color: preset.color,
|
|
7844
|
+
svgContent: nextSvg
|
|
7845
|
+
});
|
|
7846
|
+
},
|
|
7847
|
+
children: preset.title
|
|
7848
|
+
},
|
|
7849
|
+
preset.id
|
|
7850
|
+
)) }),
|
|
7166
7851
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-row", children: [
|
|
7167
7852
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5370\u7AE0\u5916\u6846" }),
|
|
7168
7853
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
7169
7854
|
"select",
|
|
7170
7855
|
{
|
|
7171
7856
|
value: element.stampShape || "oval",
|
|
7172
|
-
onChange: (e) =>
|
|
7857
|
+
onChange: (e) => {
|
|
7858
|
+
const nextShape = e.target.value;
|
|
7859
|
+
const rebuildSvg = element.svgContent && nextShape !== "oval" ? (0, import_univer_pdfs6.buildPdfApprovalStampSvg)({
|
|
7860
|
+
preset: element.preset,
|
|
7861
|
+
title: element.primaryText,
|
|
7862
|
+
subtitle: element.secondaryText,
|
|
7863
|
+
signer: element.signer,
|
|
7864
|
+
dateText: element.dateText,
|
|
7865
|
+
color: element.color,
|
|
7866
|
+
shape: nextShape
|
|
7867
|
+
}) : void 0;
|
|
7868
|
+
updateElement({
|
|
7869
|
+
stampShape: nextShape,
|
|
7870
|
+
...rebuildSvg !== void 0 ? { svgContent: rebuildSvg } : {}
|
|
7871
|
+
});
|
|
7872
|
+
},
|
|
7173
7873
|
children: [
|
|
7174
7874
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "oval", children: "\u692D\u5706\u516C\u7AE0 / \u4E13\u7528\u7AE0" }),
|
|
7175
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "
|
|
7875
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "circle", children: "\u6B63\u5706\u6807\u51C6\u516C\u7AE0 (circle)" }),
|
|
7876
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "rect", children: "\u65B9\u578B\u8D22\u52A1/\u5BA1\u9605\u7AE0 (rect)" }),
|
|
7877
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "pill", children: "\u80F6\u56CA\u5BA1\u9605\u72B6\u6001\u7AE0 (pill)" })
|
|
7176
7878
|
]
|
|
7177
7879
|
}
|
|
7178
7880
|
)
|
|
@@ -7184,7 +7886,22 @@ var PdfInspectorPanel = () => {
|
|
|
7184
7886
|
{
|
|
7185
7887
|
type: "text",
|
|
7186
7888
|
value: element.primaryText,
|
|
7187
|
-
onChange: (e) =>
|
|
7889
|
+
onChange: (e) => {
|
|
7890
|
+
const nextTitle = e.target.value;
|
|
7891
|
+
const nextSvg = element.svgContent ? (0, import_univer_pdfs6.buildPdfApprovalStampSvg)({
|
|
7892
|
+
preset: element.preset,
|
|
7893
|
+
title: nextTitle,
|
|
7894
|
+
subtitle: element.secondaryText,
|
|
7895
|
+
signer: element.signer,
|
|
7896
|
+
dateText: element.dateText,
|
|
7897
|
+
color: element.color,
|
|
7898
|
+
shape: element.stampShape === "circle" || element.stampShape === "pill" ? element.stampShape : "rect"
|
|
7899
|
+
}) : void 0;
|
|
7900
|
+
updateElement({
|
|
7901
|
+
primaryText: nextTitle,
|
|
7902
|
+
...nextSvg ? { svgContent: nextSvg } : {}
|
|
7903
|
+
});
|
|
7904
|
+
}
|
|
7188
7905
|
}
|
|
7189
7906
|
)
|
|
7190
7907
|
] }),
|
|
@@ -7195,10 +7912,81 @@ var PdfInspectorPanel = () => {
|
|
|
7195
7912
|
{
|
|
7196
7913
|
type: "text",
|
|
7197
7914
|
value: element.secondaryText || "",
|
|
7198
|
-
onChange: (e) =>
|
|
7915
|
+
onChange: (e) => {
|
|
7916
|
+
const nextSub = e.target.value;
|
|
7917
|
+
const nextSvg = element.svgContent ? (0, import_univer_pdfs6.buildPdfApprovalStampSvg)({
|
|
7918
|
+
preset: element.preset,
|
|
7919
|
+
title: element.primaryText,
|
|
7920
|
+
subtitle: nextSub,
|
|
7921
|
+
signer: element.signer,
|
|
7922
|
+
dateText: element.dateText,
|
|
7923
|
+
color: element.color,
|
|
7924
|
+
shape: element.stampShape === "circle" || element.stampShape === "pill" ? element.stampShape : "rect"
|
|
7925
|
+
}) : void 0;
|
|
7926
|
+
updateElement({
|
|
7927
|
+
secondaryText: nextSub,
|
|
7928
|
+
...nextSvg ? { svgContent: nextSvg } : {}
|
|
7929
|
+
});
|
|
7930
|
+
}
|
|
7199
7931
|
}
|
|
7200
7932
|
)
|
|
7201
7933
|
] }),
|
|
7934
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "univer-pdf-grid-2", children: [
|
|
7935
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
7936
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u7B7E\u7F72\u4EBA" }),
|
|
7937
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7938
|
+
"input",
|
|
7939
|
+
{
|
|
7940
|
+
type: "text",
|
|
7941
|
+
placeholder: "\u5982\uFF1A\u5F20\u5DE5",
|
|
7942
|
+
value: element.signer || "",
|
|
7943
|
+
onChange: (e) => {
|
|
7944
|
+
const nextSigner = e.target.value;
|
|
7945
|
+
const nextSvg = element.svgContent ? (0, import_univer_pdfs6.buildPdfApprovalStampSvg)({
|
|
7946
|
+
preset: element.preset,
|
|
7947
|
+
title: element.primaryText,
|
|
7948
|
+
subtitle: element.secondaryText,
|
|
7949
|
+
signer: nextSigner,
|
|
7950
|
+
dateText: element.dateText,
|
|
7951
|
+
color: element.color,
|
|
7952
|
+
shape: element.stampShape === "circle" || element.stampShape === "pill" ? element.stampShape : "rect"
|
|
7953
|
+
}) : void 0;
|
|
7954
|
+
updateElement({
|
|
7955
|
+
signer: nextSigner || void 0,
|
|
7956
|
+
...nextSvg ? { svgContent: nextSvg } : {}
|
|
7957
|
+
});
|
|
7958
|
+
}
|
|
7959
|
+
}
|
|
7960
|
+
)
|
|
7961
|
+
] }),
|
|
7962
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-col", children: [
|
|
7963
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u65E5\u671F" }),
|
|
7964
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7965
|
+
"input",
|
|
7966
|
+
{
|
|
7967
|
+
type: "text",
|
|
7968
|
+
placeholder: "YYYY-MM-DD",
|
|
7969
|
+
value: element.dateText || "",
|
|
7970
|
+
onChange: (e) => {
|
|
7971
|
+
const nextDate = e.target.value;
|
|
7972
|
+
const nextSvg = element.svgContent ? (0, import_univer_pdfs6.buildPdfApprovalStampSvg)({
|
|
7973
|
+
preset: element.preset,
|
|
7974
|
+
title: element.primaryText,
|
|
7975
|
+
subtitle: element.secondaryText,
|
|
7976
|
+
signer: element.signer,
|
|
7977
|
+
dateText: nextDate,
|
|
7978
|
+
color: element.color,
|
|
7979
|
+
shape: element.stampShape === "circle" || element.stampShape === "pill" ? element.stampShape : "rect"
|
|
7980
|
+
}) : void 0;
|
|
7981
|
+
updateElement({
|
|
7982
|
+
dateText: nextDate || void 0,
|
|
7983
|
+
...nextSvg ? { svgContent: nextSvg } : {}
|
|
7984
|
+
});
|
|
7985
|
+
}
|
|
7986
|
+
}
|
|
7987
|
+
)
|
|
7988
|
+
] })
|
|
7989
|
+
] }),
|
|
7202
7990
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "univer-pdf-form-row", children: [
|
|
7203
7991
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u5370\u6CE5\u989C\u8272" }),
|
|
7204
7992
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -7206,7 +7994,22 @@ var PdfInspectorPanel = () => {
|
|
|
7206
7994
|
{
|
|
7207
7995
|
type: "color",
|
|
7208
7996
|
value: element.color || "#dc2626",
|
|
7209
|
-
onChange: (e) =>
|
|
7997
|
+
onChange: (e) => {
|
|
7998
|
+
const nextColor = e.target.value;
|
|
7999
|
+
const nextSvg = element.svgContent ? (0, import_univer_pdfs6.buildPdfApprovalStampSvg)({
|
|
8000
|
+
preset: element.preset,
|
|
8001
|
+
title: element.primaryText,
|
|
8002
|
+
subtitle: element.secondaryText,
|
|
8003
|
+
signer: element.signer,
|
|
8004
|
+
dateText: element.dateText,
|
|
8005
|
+
color: nextColor,
|
|
8006
|
+
shape: element.stampShape === "circle" || element.stampShape === "pill" ? element.stampShape : "rect"
|
|
8007
|
+
}) : void 0;
|
|
8008
|
+
updateElement({
|
|
8009
|
+
color: nextColor,
|
|
8010
|
+
...nextSvg ? { svgContent: nextSvg } : {}
|
|
8011
|
+
});
|
|
8012
|
+
}
|
|
7210
8013
|
}
|
|
7211
8014
|
)
|
|
7212
8015
|
] })
|
|
@@ -8728,6 +9531,36 @@ var PdfLeftSidebar = ({ initialTab = "pages" }) => {
|
|
|
8728
9531
|
item.key
|
|
8729
9532
|
)) }),
|
|
8730
9533
|
effectiveTab === "pages" && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "univer-pdf-thumb-list", children: [
|
|
9534
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: { display: "grid", gridTemplateColumns: editorEnabled && features.cropBox ? "1fr 1fr" : "1fr", gap: 4 }, children: [
|
|
9535
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
9536
|
+
"button",
|
|
9537
|
+
{
|
|
9538
|
+
type: "button",
|
|
9539
|
+
"data-testid": "pdf-sidebar-split-extract-btn",
|
|
9540
|
+
className: "univer-pdf-mini-btn",
|
|
9541
|
+
style: { display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 4 },
|
|
9542
|
+
onClick: () => void commandService.executeCommand(OpenPdfSplitModalOperation.id, { open: true }),
|
|
9543
|
+
children: [
|
|
9544
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(UiSplitMergeIcon, {}),
|
|
9545
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "\u62C6\u5206\u63D0\u53D6" })
|
|
9546
|
+
]
|
|
9547
|
+
}
|
|
9548
|
+
),
|
|
9549
|
+
editorEnabled && features.cropBox && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
9550
|
+
"button",
|
|
9551
|
+
{
|
|
9552
|
+
type: "button",
|
|
9553
|
+
"data-testid": "pdf-sidebar-crop-mode-btn",
|
|
9554
|
+
className: "univer-pdf-mini-btn",
|
|
9555
|
+
style: { display: "inline-flex", alignItems: "center", justifyContent: "center", gap: 4 },
|
|
9556
|
+
onClick: () => void commandService.executeCommand(SetPdfInteractionModeOperation.id, { mode: "crop" }),
|
|
9557
|
+
children: [
|
|
9558
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(UiCropIcon, {}),
|
|
9559
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "\u9875\u9762\u88C1\u5207" })
|
|
9560
|
+
]
|
|
9561
|
+
}
|
|
9562
|
+
)
|
|
9563
|
+
] }),
|
|
8731
9564
|
editorEnabled && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "univer-pdf-thumb-toolbar", style: { display: "flex", flexDirection: "column", gap: 5 }, children: [
|
|
8732
9565
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
8733
9566
|
"button",
|
|
@@ -11298,14 +12131,480 @@ var PdfPreviewModal = () => {
|
|
|
11298
12131
|
) });
|
|
11299
12132
|
};
|
|
11300
12133
|
|
|
11301
|
-
// src/
|
|
12134
|
+
// src/views/preview/PdfSplitExtractModal.tsx
|
|
12135
|
+
var import_core9 = require("@univerjs/core");
|
|
11302
12136
|
var import_ui8 = require("@univerjs/ui");
|
|
11303
12137
|
var import_univer_pdfs9 = require("@yudaocode/univer-pdfs");
|
|
12138
|
+
var import_react7 = require("react");
|
|
11304
12139
|
var import_rxjs7 = require("rxjs");
|
|
12140
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
12141
|
+
function computePdfSplitPlanPreview(mode, rangeSpec, everyNPages, totalPages) {
|
|
12142
|
+
if (totalPages <= 0) {
|
|
12143
|
+
return { valid: false, error: "\u5F53\u524D\u6587\u6863\u6682\u65E0\u53EF\u62C6\u5206\u9875\u9762", fileCount: 0, items: [] };
|
|
12144
|
+
}
|
|
12145
|
+
try {
|
|
12146
|
+
const groups = mode === "everyN" ? (0, import_univer_pdfs9.parsePdfPageRangeSpec)("", totalPages, {
|
|
12147
|
+
everyNPages: Math.max(1, Math.floor(Number(everyNPages) || 1))
|
|
12148
|
+
}) : (0, import_univer_pdfs9.parsePdfPageRangeSpec)(rangeSpec, totalPages);
|
|
12149
|
+
if (groups.length === 0) {
|
|
12150
|
+
return { valid: false, error: "\u672A\u5339\u914D\u5230\u6709\u6548\u9875\u7801\u8303\u56F4", fileCount: 0, items: [] };
|
|
12151
|
+
}
|
|
12152
|
+
const items = groups.map((pageIndices, idx) => ({
|
|
12153
|
+
index: idx + 1,
|
|
12154
|
+
label: (0, import_univer_pdfs9.formatPdfPageIndicesLabel)(pageIndices),
|
|
12155
|
+
pageCount: pageIndices.length,
|
|
12156
|
+
pageIndices
|
|
12157
|
+
}));
|
|
12158
|
+
return {
|
|
12159
|
+
valid: true,
|
|
12160
|
+
fileCount: items.length,
|
|
12161
|
+
items
|
|
12162
|
+
};
|
|
12163
|
+
} catch (err) {
|
|
12164
|
+
return {
|
|
12165
|
+
valid: false,
|
|
12166
|
+
error: err instanceof Error ? err.message : "\u9875\u7801\u533A\u95F4\u683C\u5F0F\u6709\u8BEF",
|
|
12167
|
+
fileCount: 0,
|
|
12168
|
+
items: []
|
|
12169
|
+
};
|
|
12170
|
+
}
|
|
12171
|
+
}
|
|
12172
|
+
function triggerBrowserFileDownload(bytes, fileName) {
|
|
12173
|
+
if (typeof document === "undefined" || typeof URL === "undefined" || typeof URL.createObjectURL !== "function") {
|
|
12174
|
+
return;
|
|
12175
|
+
}
|
|
12176
|
+
const blob = new Blob([bytes.slice().buffer], { type: "application/pdf" });
|
|
12177
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
12178
|
+
const anchor = document.createElement("a");
|
|
12179
|
+
anchor.href = blobUrl;
|
|
12180
|
+
anchor.download = fileName;
|
|
12181
|
+
anchor.style.display = "none";
|
|
12182
|
+
document.body.appendChild(anchor);
|
|
12183
|
+
anchor.click();
|
|
12184
|
+
anchor.remove();
|
|
12185
|
+
setTimeout(() => URL.revokeObjectURL(blobUrl), 1e4);
|
|
12186
|
+
}
|
|
12187
|
+
var PdfSplitExtractModal = ({
|
|
12188
|
+
forceOpen,
|
|
12189
|
+
onClose
|
|
12190
|
+
}) => {
|
|
12191
|
+
const instanceService = (0, import_ui8.useDependency)(import_core9.IUniverInstanceService);
|
|
12192
|
+
const commandService = (0, import_ui8.useDependency)(import_core9.ICommandService);
|
|
12193
|
+
const selectionService = (0, import_ui8.useDependency)(import_univer_pdfs9.IPdfSelectionService);
|
|
12194
|
+
const ioService = (0, import_ui8.useDependency)(import_univer_pdfs9.IPdfIoService);
|
|
12195
|
+
const featureService = (0, import_ui8.useDependency)(IPdfsUIFeatureService);
|
|
12196
|
+
const splitModalOpen = (0, import_ui8.useObservable)(
|
|
12197
|
+
selectionService.splitModalOpen$,
|
|
12198
|
+
selectionService.getSplitModalOpen()
|
|
12199
|
+
);
|
|
12200
|
+
const editorEnabled = (0, import_ui8.useObservable)(
|
|
12201
|
+
featureService.editorEnabled$,
|
|
12202
|
+
featureService.isEditorEnabled()
|
|
12203
|
+
);
|
|
12204
|
+
const unit = (0, import_ui8.useObservable)(
|
|
12205
|
+
() => instanceService.getCurrentTypeOfUnit$(import_core9.UniverInstanceType.UNIVER_PDF),
|
|
12206
|
+
instanceService.getCurrentUnitOfType(import_core9.UniverInstanceType.UNIVER_PDF),
|
|
12207
|
+
false,
|
|
12208
|
+
[instanceService]
|
|
12209
|
+
);
|
|
12210
|
+
const snapshot = (0, import_ui8.useObservable)(
|
|
12211
|
+
() => unit ? unit.snapshotChanged$ : (0, import_rxjs7.of)(null),
|
|
12212
|
+
unit ? unit.getSnapshot() : null,
|
|
12213
|
+
false,
|
|
12214
|
+
[unit]
|
|
12215
|
+
);
|
|
12216
|
+
const [mode, setMode] = (0, import_react7.useState)("range");
|
|
12217
|
+
const [rangeSpec, setRangeSpec] = (0, import_react7.useState)("");
|
|
12218
|
+
const [everyN, setEveryN] = (0, import_react7.useState)(2);
|
|
12219
|
+
const [busy, setBusy] = (0, import_react7.useState)(false);
|
|
12220
|
+
const [statusMessage, setStatusMessage] = (0, import_react7.useState)("");
|
|
12221
|
+
const isOpen = forceOpen ?? splitModalOpen;
|
|
12222
|
+
const currentSnapshot = snapshot ?? unit?.getSnapshot() ?? null;
|
|
12223
|
+
const totalPages = currentSnapshot?.document.pageOrder.length ?? 0;
|
|
12224
|
+
const effectiveRangeSpec = rangeSpec || (totalPages >= 4 ? `1-2, 3-${totalPages}` : totalPages >= 2 ? `1, 2-${totalPages}` : "1");
|
|
12225
|
+
const preview = (0, import_react7.useMemo)(
|
|
12226
|
+
() => computePdfSplitPlanPreview(mode, effectiveRangeSpec, everyN, totalPages),
|
|
12227
|
+
[mode, effectiveRangeSpec, everyN, totalPages]
|
|
12228
|
+
);
|
|
12229
|
+
if (!isOpen || !currentSnapshot || !unit) {
|
|
12230
|
+
return null;
|
|
12231
|
+
}
|
|
12232
|
+
const handleClose = () => {
|
|
12233
|
+
setStatusMessage("");
|
|
12234
|
+
selectionService.setSplitModalOpen(false);
|
|
12235
|
+
onClose?.();
|
|
12236
|
+
};
|
|
12237
|
+
const handleExtractIntoWorkspace = () => {
|
|
12238
|
+
if (!preview.valid || preview.items.length === 0 || !editorEnabled) return;
|
|
12239
|
+
const mergedOneBased = preview.items.map((item) => item.label).join("+");
|
|
12240
|
+
const parts = (0, import_univer_pdfs9.splitPdfUnitByRanges)(currentSnapshot, [mergedOneBased]);
|
|
12241
|
+
if (parts.length === 0) return;
|
|
12242
|
+
const extracted = {
|
|
12243
|
+
...parts[0].unit,
|
|
12244
|
+
id: unit.getUnitId()
|
|
12245
|
+
};
|
|
12246
|
+
commandService.syncExecuteCommand(import_univer_pdfs9.ReplacePdfSnapshotCommand.id, {
|
|
12247
|
+
unitId: unit.getUnitId(),
|
|
12248
|
+
snapshot: extracted
|
|
12249
|
+
});
|
|
12250
|
+
handleClose();
|
|
12251
|
+
};
|
|
12252
|
+
const handleDownloadSplitFiles = async () => {
|
|
12253
|
+
if (!preview.valid || preview.items.length === 0) return;
|
|
12254
|
+
setBusy(true);
|
|
12255
|
+
setStatusMessage("");
|
|
12256
|
+
try {
|
|
12257
|
+
const fullPdfBytes = await ioService.exportPdf({
|
|
12258
|
+
unitId: unit.getUnitId(),
|
|
12259
|
+
snapshot: currentSnapshot,
|
|
12260
|
+
data: currentSnapshot.metadata?.sampleData
|
|
12261
|
+
});
|
|
12262
|
+
const splitParts = mode === "everyN" ? await (0, import_univer_pdfs9.splitPdfBytesByRanges)(fullPdfBytes, [], {
|
|
12263
|
+
everyNPages: Math.max(1, Math.floor(Number(everyN) || 1))
|
|
12264
|
+
}) : await (0, import_univer_pdfs9.splitPdfBytesByRanges)(fullPdfBytes, [effectiveRangeSpec]);
|
|
12265
|
+
const safeBaseName = (currentSnapshot.name || "document").replace(/[\\/:*?"<>|]+/g, "_").trim() || "document";
|
|
12266
|
+
for (const part of splitParts) {
|
|
12267
|
+
triggerBrowserFileDownload(part.bytes, `${safeBaseName}-P${part.label}.pdf`);
|
|
12268
|
+
}
|
|
12269
|
+
setStatusMessage(`\u5DF2\u751F\u6210\u5E76\u5BFC\u51FA ${splitParts.length} \u4E2A\u72EC\u7ACB PDF \u6587\u4EF6`);
|
|
12270
|
+
} catch (err) {
|
|
12271
|
+
setStatusMessage(err instanceof Error ? err.message : "\u62C6\u5206\u5BFC\u51FA PDF \u5931\u8D25");
|
|
12272
|
+
} finally {
|
|
12273
|
+
setBusy(false);
|
|
12274
|
+
}
|
|
12275
|
+
};
|
|
12276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12277
|
+
"div",
|
|
12278
|
+
{
|
|
12279
|
+
role: "dialog",
|
|
12280
|
+
"aria-modal": "true",
|
|
12281
|
+
"aria-label": "PDF \u9875\u9762\u62C6\u5206\u4E0E\u63D0\u53D6",
|
|
12282
|
+
"data-testid": "pdf-split-extract-modal",
|
|
12283
|
+
onPointerDown: (e) => {
|
|
12284
|
+
if (e.target === e.currentTarget) handleClose();
|
|
12285
|
+
},
|
|
12286
|
+
style: {
|
|
12287
|
+
position: "fixed",
|
|
12288
|
+
inset: 0,
|
|
12289
|
+
background: "rgba(27, 28, 31, 0.44)",
|
|
12290
|
+
display: "flex",
|
|
12291
|
+
alignItems: "center",
|
|
12292
|
+
justifyContent: "center",
|
|
12293
|
+
zIndex: 1250
|
|
12294
|
+
},
|
|
12295
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
12296
|
+
"div",
|
|
12297
|
+
{
|
|
12298
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
12299
|
+
style: {
|
|
12300
|
+
width: 520,
|
|
12301
|
+
maxWidth: "calc(100vw - 32px)",
|
|
12302
|
+
background: "#FFFFFF",
|
|
12303
|
+
border: "1px solid #E3E5EA",
|
|
12304
|
+
borderRadius: 8,
|
|
12305
|
+
boxShadow: "0 14px 36px rgba(27, 28, 31, 0.2)",
|
|
12306
|
+
padding: "16px 20px",
|
|
12307
|
+
display: "flex",
|
|
12308
|
+
flexDirection: "column",
|
|
12309
|
+
gap: 12,
|
|
12310
|
+
color: "#1B1C1F"
|
|
12311
|
+
},
|
|
12312
|
+
children: [
|
|
12313
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
12314
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "inline-flex", alignItems: "center", gap: 7, fontSize: 14, fontWeight: 600 }, children: [
|
|
12315
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UiSplitMergeIcon, { style: { color: "#2C53F1" } }),
|
|
12316
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { children: [
|
|
12317
|
+
"\u9875\u9762\u62C6\u5206\u4E0E\u63D0\u53D6 (",
|
|
12318
|
+
currentSnapshot.name,
|
|
12319
|
+
" \xB7 \u5171 ",
|
|
12320
|
+
totalPages,
|
|
12321
|
+
" \u9875)"
|
|
12322
|
+
] })
|
|
12323
|
+
] }),
|
|
12324
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12325
|
+
"button",
|
|
12326
|
+
{
|
|
12327
|
+
type: "button",
|
|
12328
|
+
className: "univer-pdf-mini-btn",
|
|
12329
|
+
onClick: handleClose,
|
|
12330
|
+
"aria-label": "\u5173\u95ED\u62C6\u5206\u7A97\u53E3",
|
|
12331
|
+
children: "\xD7"
|
|
12332
|
+
}
|
|
12333
|
+
)
|
|
12334
|
+
] }),
|
|
12335
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
|
|
12336
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12337
|
+
"button",
|
|
12338
|
+
{
|
|
12339
|
+
type: "button",
|
|
12340
|
+
"data-testid": "pdf-split-mode-range",
|
|
12341
|
+
onClick: () => setMode("range"),
|
|
12342
|
+
style: {
|
|
12343
|
+
padding: "8px 10px",
|
|
12344
|
+
borderRadius: 6,
|
|
12345
|
+
border: mode === "range" ? "1.5px solid #2C53F1" : "1px solid #E3E5EA",
|
|
12346
|
+
background: mode === "range" ? "#F3F5FF" : "#F9FAFB",
|
|
12347
|
+
color: mode === "range" ? "#2C53F1" : "#31363F",
|
|
12348
|
+
fontSize: 12,
|
|
12349
|
+
fontWeight: mode === "range" ? 600 : 500,
|
|
12350
|
+
cursor: "pointer",
|
|
12351
|
+
textAlign: "left"
|
|
12352
|
+
},
|
|
12353
|
+
children: "\u6309\u9875\u7801\u533A\u95F4\u62C6\u5206 (\u5982 1-2, 3-5)"
|
|
12354
|
+
}
|
|
12355
|
+
),
|
|
12356
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12357
|
+
"button",
|
|
12358
|
+
{
|
|
12359
|
+
type: "button",
|
|
12360
|
+
"data-testid": "pdf-split-mode-everyn",
|
|
12361
|
+
onClick: () => setMode("everyN"),
|
|
12362
|
+
style: {
|
|
12363
|
+
padding: "8px 10px",
|
|
12364
|
+
borderRadius: 6,
|
|
12365
|
+
border: mode === "everyN" ? "1.5px solid #2C53F1" : "1px solid #E3E5EA",
|
|
12366
|
+
background: mode === "everyN" ? "#F3F5FF" : "#F9FAFB",
|
|
12367
|
+
color: mode === "everyN" ? "#2C53F1" : "#31363F",
|
|
12368
|
+
fontSize: 12,
|
|
12369
|
+
fontWeight: mode === "everyN" ? 600 : 500,
|
|
12370
|
+
cursor: "pointer",
|
|
12371
|
+
textAlign: "left"
|
|
12372
|
+
},
|
|
12373
|
+
children: "\u6BCF N \u9875\u62C6\u5206\u4E3A\u72EC\u7ACB\u6587\u4EF6"
|
|
12374
|
+
}
|
|
12375
|
+
)
|
|
12376
|
+
] }),
|
|
12377
|
+
mode === "range" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
12378
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { style: { fontSize: 11.5, color: "#4E5565", fontWeight: 500 }, children: [
|
|
12379
|
+
"\u8F93\u5165\u9875\u7801\u533A\u95F4\uFF08\u9017\u53F7\u5206\u9694\u591A\u4E2A\u72EC\u7ACB\u6587\u4EF6\uFF0C\u52A0\u53F7\u5408\u5E76\u975E\u8FDE\u7EED\u9875\uFF0C\u5982 ",
|
|
12380
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { children: "1-2, 3-5" }),
|
|
12381
|
+
" \u6216 ",
|
|
12382
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { children: "1+3, 2+4" }),
|
|
12383
|
+
"\uFF09"
|
|
12384
|
+
] }),
|
|
12385
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12386
|
+
"input",
|
|
12387
|
+
{
|
|
12388
|
+
type: "text",
|
|
12389
|
+
"data-testid": "pdf-split-range-input",
|
|
12390
|
+
value: effectiveRangeSpec,
|
|
12391
|
+
placeholder: "\u4F8B\u5982 1-2, 3-5 \u6216 odd / even",
|
|
12392
|
+
onChange: (e) => setRangeSpec(e.target.value),
|
|
12393
|
+
style: {
|
|
12394
|
+
height: 32,
|
|
12395
|
+
padding: "0 10px",
|
|
12396
|
+
fontSize: 12.5,
|
|
12397
|
+
border: "1px solid #D5D8DF",
|
|
12398
|
+
borderRadius: 5,
|
|
12399
|
+
color: "#1B1C1F",
|
|
12400
|
+
background: "#FFFFFF"
|
|
12401
|
+
}
|
|
12402
|
+
}
|
|
12403
|
+
),
|
|
12404
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", gap: 6, flexWrap: "wrap" }, children: [
|
|
12405
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12406
|
+
"button",
|
|
12407
|
+
{
|
|
12408
|
+
type: "button",
|
|
12409
|
+
className: "univer-pdf-mini-btn",
|
|
12410
|
+
onClick: () => setRangeSpec("single"),
|
|
12411
|
+
children: "\u9010\u9875\u5355\u4EFD\u62C6\u5206"
|
|
12412
|
+
}
|
|
12413
|
+
),
|
|
12414
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12415
|
+
"button",
|
|
12416
|
+
{
|
|
12417
|
+
type: "button",
|
|
12418
|
+
className: "univer-pdf-mini-btn",
|
|
12419
|
+
onClick: () => setRangeSpec("odd"),
|
|
12420
|
+
children: "\u4EC5\u63D0\u53D6\u5947\u6570\u9875 (odd)"
|
|
12421
|
+
}
|
|
12422
|
+
),
|
|
12423
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12424
|
+
"button",
|
|
12425
|
+
{
|
|
12426
|
+
type: "button",
|
|
12427
|
+
className: "univer-pdf-mini-btn",
|
|
12428
|
+
onClick: () => setRangeSpec("even"),
|
|
12429
|
+
children: "\u4EC5\u63D0\u53D6\u5076\u6570\u9875 (even)"
|
|
12430
|
+
}
|
|
12431
|
+
),
|
|
12432
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12433
|
+
"button",
|
|
12434
|
+
{
|
|
12435
|
+
type: "button",
|
|
12436
|
+
className: "univer-pdf-mini-btn",
|
|
12437
|
+
onClick: () => setRangeSpec("all"),
|
|
12438
|
+
children: "\u5168\u90E8\u9875\u9762"
|
|
12439
|
+
}
|
|
12440
|
+
)
|
|
12441
|
+
] })
|
|
12442
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
12443
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: { fontSize: 12, color: "#31363F" }, children: "\u6BCF" }),
|
|
12444
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12445
|
+
"input",
|
|
12446
|
+
{
|
|
12447
|
+
type: "number",
|
|
12448
|
+
"data-testid": "pdf-split-every-n-input",
|
|
12449
|
+
min: 1,
|
|
12450
|
+
max: Math.max(1, totalPages),
|
|
12451
|
+
value: everyN,
|
|
12452
|
+
onChange: (e) => setEveryN(Math.max(1, Number(e.target.value) || 1)),
|
|
12453
|
+
style: {
|
|
12454
|
+
width: 76,
|
|
12455
|
+
height: 30,
|
|
12456
|
+
padding: "0 8px",
|
|
12457
|
+
fontSize: 12.5,
|
|
12458
|
+
border: "1px solid #D5D8DF",
|
|
12459
|
+
borderRadius: 5,
|
|
12460
|
+
color: "#1B1C1F",
|
|
12461
|
+
background: "#FFFFFF"
|
|
12462
|
+
}
|
|
12463
|
+
}
|
|
12464
|
+
),
|
|
12465
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: { fontSize: 12, color: "#31363F" }, children: "\u9875\u81EA\u52A8\u62C6\u5206\u4E3A\u4E00\u4E2A\u72EC\u7ACB PDF \u6587\u4EF6" })
|
|
12466
|
+
] }),
|
|
12467
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12468
|
+
"div",
|
|
12469
|
+
{
|
|
12470
|
+
"data-testid": "pdf-split-preview-summary",
|
|
12471
|
+
style: {
|
|
12472
|
+
padding: "10px 12px",
|
|
12473
|
+
background: "#F9FAFB",
|
|
12474
|
+
border: "1px solid #E3E5EA",
|
|
12475
|
+
borderRadius: 6,
|
|
12476
|
+
display: "flex",
|
|
12477
|
+
flexDirection: "column",
|
|
12478
|
+
gap: 6,
|
|
12479
|
+
maxHeight: 156,
|
|
12480
|
+
overflowY: "auto"
|
|
12481
|
+
},
|
|
12482
|
+
children: preview.valid ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
12483
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { fontSize: 12, fontWeight: 600, color: "#1B1C1F" }, children: [
|
|
12484
|
+
"\u9884\u8BA1\u751F\u6210 ",
|
|
12485
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { style: { color: "#2C53F1" }, children: preview.fileCount }),
|
|
12486
|
+
" \u4E2A\u72EC\u7ACB PDF \u6587\u4EF6"
|
|
12487
|
+
] }),
|
|
12488
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 6 }, children: preview.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
12489
|
+
"span",
|
|
12490
|
+
{
|
|
12491
|
+
style: {
|
|
12492
|
+
display: "inline-flex",
|
|
12493
|
+
alignItems: "center",
|
|
12494
|
+
gap: 4,
|
|
12495
|
+
padding: "3px 8px",
|
|
12496
|
+
borderRadius: 4,
|
|
12497
|
+
background: "#FFFFFF",
|
|
12498
|
+
border: "1px solid #D2DAFA",
|
|
12499
|
+
fontSize: 11,
|
|
12500
|
+
color: "#31363F"
|
|
12501
|
+
},
|
|
12502
|
+
children: [
|
|
12503
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UiFilePdfIcon, { style: { width: 12, height: 12, color: "#2C53F1" } }),
|
|
12504
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { children: [
|
|
12505
|
+
"\u7B2C ",
|
|
12506
|
+
item.index,
|
|
12507
|
+
" \u4EFD \xB7 P",
|
|
12508
|
+
item.label,
|
|
12509
|
+
" (",
|
|
12510
|
+
item.pageCount,
|
|
12511
|
+
" \u9875)"
|
|
12512
|
+
] })
|
|
12513
|
+
]
|
|
12514
|
+
},
|
|
12515
|
+
item.index
|
|
12516
|
+
)) })
|
|
12517
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: { fontSize: 11.5, color: "#DC2626" }, children: preview.error })
|
|
12518
|
+
}
|
|
12519
|
+
),
|
|
12520
|
+
statusMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12521
|
+
"div",
|
|
12522
|
+
{
|
|
12523
|
+
style: {
|
|
12524
|
+
fontSize: 11.5,
|
|
12525
|
+
color: "#2C53F1",
|
|
12526
|
+
background: "#F3F5FF",
|
|
12527
|
+
padding: "5px 8px",
|
|
12528
|
+
borderRadius: 4
|
|
12529
|
+
},
|
|
12530
|
+
children: statusMessage
|
|
12531
|
+
}
|
|
12532
|
+
),
|
|
12533
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 8 }, children: [
|
|
12534
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12535
|
+
"button",
|
|
12536
|
+
{
|
|
12537
|
+
type: "button",
|
|
12538
|
+
className: "univer-pdf-mini-btn",
|
|
12539
|
+
style: { height: 32, padding: "0 14px", fontSize: 12 },
|
|
12540
|
+
onClick: handleClose,
|
|
12541
|
+
children: "\u53D6\u6D88"
|
|
12542
|
+
}
|
|
12543
|
+
),
|
|
12544
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { display: "inline-flex", alignItems: "center", gap: 8 }, children: [
|
|
12545
|
+
editorEnabled && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
12546
|
+
"button",
|
|
12547
|
+
{
|
|
12548
|
+
type: "button",
|
|
12549
|
+
"data-testid": "pdf-split-extract-workspace-btn",
|
|
12550
|
+
className: "univer-pdf-mini-btn",
|
|
12551
|
+
disabled: !preview.valid || busy,
|
|
12552
|
+
onClick: handleExtractIntoWorkspace,
|
|
12553
|
+
style: {
|
|
12554
|
+
height: 32,
|
|
12555
|
+
padding: "0 12px",
|
|
12556
|
+
fontSize: 12,
|
|
12557
|
+
borderColor: "#2C53F1",
|
|
12558
|
+
color: "#2C53F1",
|
|
12559
|
+
background: "#F3F5FF"
|
|
12560
|
+
},
|
|
12561
|
+
children: "\u63D0\u53D6\u81F3\u5F53\u524D\u5DE5\u4F5C\u533A"
|
|
12562
|
+
}
|
|
12563
|
+
),
|
|
12564
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
12565
|
+
"button",
|
|
12566
|
+
{
|
|
12567
|
+
type: "button",
|
|
12568
|
+
"data-testid": "pdf-split-download-btn",
|
|
12569
|
+
disabled: !preview.valid || busy,
|
|
12570
|
+
onClick: handleDownloadSplitFiles,
|
|
12571
|
+
style: {
|
|
12572
|
+
height: 32,
|
|
12573
|
+
padding: "0 14px",
|
|
12574
|
+
fontSize: 12,
|
|
12575
|
+
fontWeight: 600,
|
|
12576
|
+
color: "#FFFFFF",
|
|
12577
|
+
background: preview.valid && !busy ? "#2C53F1" : "#7D8698",
|
|
12578
|
+
border: "none",
|
|
12579
|
+
borderRadius: 5,
|
|
12580
|
+
cursor: preview.valid && !busy ? "pointer" : "not-allowed",
|
|
12581
|
+
display: "inline-flex",
|
|
12582
|
+
alignItems: "center",
|
|
12583
|
+
gap: 5
|
|
12584
|
+
},
|
|
12585
|
+
children: [
|
|
12586
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UiDownloadIcon, { style: { width: 13, height: 13, color: "#FFFFFF" } }),
|
|
12587
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: busy ? "\u6B63\u5728\u62C6\u5206\u5BFC\u51FA..." : "\u4E0B\u8F7D\u62C6\u5206 PDF \u6587\u4EF6" })
|
|
12588
|
+
]
|
|
12589
|
+
}
|
|
12590
|
+
)
|
|
12591
|
+
] })
|
|
12592
|
+
] })
|
|
12593
|
+
]
|
|
12594
|
+
}
|
|
12595
|
+
)
|
|
12596
|
+
}
|
|
12597
|
+
);
|
|
12598
|
+
};
|
|
12599
|
+
|
|
12600
|
+
// src/controllers/menu.schema.ts
|
|
12601
|
+
var import_ui9 = require("@univerjs/ui");
|
|
12602
|
+
var import_univer_pdfs10 = require("@yudaocode/univer-pdfs");
|
|
12603
|
+
var import_rxjs8 = require("rxjs");
|
|
11305
12604
|
var PDF_RIBBON_ANNOTATE_TAB = "ribbon.annotate";
|
|
11306
12605
|
var PDF_RIBBON_ANNOTATE_GROUP = "ribbon.annotate.tools";
|
|
11307
12606
|
var pdfsRootMenuExtension = {
|
|
11308
|
-
[
|
|
12607
|
+
[import_ui9.MenuManagerPosition.RIBBON]: {
|
|
11309
12608
|
[PDF_RIBBON_ANNOTATE_TAB]: {
|
|
11310
12609
|
order: 2,
|
|
11311
12610
|
title: "pdfs.ribbon.annotateTab",
|
|
@@ -11324,18 +12623,18 @@ function createBtn(config) {
|
|
|
11324
12623
|
return {
|
|
11325
12624
|
id: config.id,
|
|
11326
12625
|
commandId: config.commandId ?? config.id,
|
|
11327
|
-
type:
|
|
12626
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11328
12627
|
title: config.title,
|
|
11329
12628
|
label: config.label,
|
|
11330
12629
|
tooltip: config.tooltip ?? config.title,
|
|
11331
12630
|
icon: config.icon,
|
|
11332
12631
|
params: config.params,
|
|
11333
|
-
hidden$: needsHiddenObs ? (0,
|
|
12632
|
+
hidden$: needsHiddenObs ? (0, import_rxjs8.combineLatest)([
|
|
11334
12633
|
featService.features$,
|
|
11335
12634
|
featService.editorEnabled$,
|
|
11336
12635
|
featService.ioModal$
|
|
11337
12636
|
]).pipe(
|
|
11338
|
-
(0,
|
|
12637
|
+
(0, import_rxjs8.map)(([f, editorEnabled, ioModal]) => {
|
|
11339
12638
|
if (requiresEditor && !editorEnabled) return true;
|
|
11340
12639
|
if (config.elementTypeGate && !isPdfElementTypeAllowed(config.elementTypeGate, f)) {
|
|
11341
12640
|
return true;
|
|
@@ -11347,67 +12646,67 @@ function createBtn(config) {
|
|
|
11347
12646
|
};
|
|
11348
12647
|
}
|
|
11349
12648
|
var SelectModeMenuFactory = (accessor) => {
|
|
11350
|
-
const sel = accessor.get(
|
|
12649
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
11351
12650
|
return {
|
|
11352
12651
|
id: "pdfs-ui.menu.mode-select",
|
|
11353
12652
|
commandId: SetPdfInteractionModeOperation.id,
|
|
11354
|
-
type:
|
|
12653
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11355
12654
|
title: "pdfs.ribbon.selectMode",
|
|
11356
12655
|
tooltip: "pdfs.ribbon.selectMode",
|
|
11357
12656
|
icon: "PdfSelectCursorIcon",
|
|
11358
12657
|
params: { mode: "select" },
|
|
11359
|
-
activated$: sel.interactionMode$.pipe((0,
|
|
12658
|
+
activated$: sel.interactionMode$.pipe((0, import_rxjs8.map)((m) => m === "select"))
|
|
11360
12659
|
};
|
|
11361
12660
|
};
|
|
11362
12661
|
var PanModeMenuFactory = (accessor) => {
|
|
11363
|
-
const sel = accessor.get(
|
|
12662
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
11364
12663
|
return {
|
|
11365
12664
|
id: "pdfs-ui.menu.mode-pan",
|
|
11366
12665
|
commandId: SetPdfInteractionModeOperation.id,
|
|
11367
|
-
type:
|
|
12666
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11368
12667
|
title: "pdfs.ribbon.panMode",
|
|
11369
12668
|
tooltip: "pdfs.ribbon.panMode",
|
|
11370
12669
|
icon: "PdfHandPanIcon",
|
|
11371
12670
|
params: { mode: "pan" },
|
|
11372
|
-
activated$: sel.interactionMode$.pipe((0,
|
|
12671
|
+
activated$: sel.interactionMode$.pipe((0, import_rxjs8.map)((m) => m === "pan"))
|
|
11373
12672
|
};
|
|
11374
12673
|
};
|
|
11375
12674
|
var InkModeMenuFactory = (accessor) => {
|
|
11376
|
-
const sel = accessor.get(
|
|
12675
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
11377
12676
|
const featService = accessor.get(IPdfsUIFeatureService);
|
|
11378
12677
|
return {
|
|
11379
12678
|
id: "pdfs-ui.menu.mode-ink",
|
|
11380
12679
|
commandId: SetPdfInteractionModeOperation.id,
|
|
11381
|
-
type:
|
|
12680
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11382
12681
|
title: "pdfs.ribbon.inkMode",
|
|
11383
12682
|
label: "pdfs.ribbon.inkMode",
|
|
11384
12683
|
tooltip: "pdfs.ribbon.inkMode",
|
|
11385
12684
|
icon: "PdfPenInkIcon",
|
|
11386
12685
|
params: { mode: "ink" },
|
|
11387
|
-
activated$: sel.interactionMode$.pipe((0,
|
|
11388
|
-
hidden$: (0,
|
|
11389
|
-
(0,
|
|
12686
|
+
activated$: sel.interactionMode$.pipe((0, import_rxjs8.map)((m) => m === "ink")),
|
|
12687
|
+
hidden$: (0, import_rxjs8.combineLatest)([featService.features$, featService.editorEnabled$]).pipe(
|
|
12688
|
+
(0, import_rxjs8.map)(([f, editorEnabled]) => !editorEnabled || !f.ink || !isPdfElementTypeAllowed(import_univer_pdfs10.PdfElementType.INK, f))
|
|
11390
12689
|
)
|
|
11391
12690
|
};
|
|
11392
12691
|
};
|
|
11393
12692
|
var InsertPdfTextMenuFactory = createBtn({
|
|
11394
12693
|
id: "pdfs-ui.menu.insert-text",
|
|
11395
|
-
commandId:
|
|
12694
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11396
12695
|
title: "pdfs.ribbon.insertText",
|
|
11397
12696
|
label: "pdfs.ribbon.insertText",
|
|
11398
12697
|
icon: "PdfTextIcon",
|
|
11399
|
-
params: { elementType:
|
|
12698
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.TEXT },
|
|
11400
12699
|
requiresEditor: true,
|
|
11401
|
-
elementTypeGate:
|
|
12700
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.TEXT
|
|
11402
12701
|
});
|
|
11403
12702
|
var InsertPdfTextCompactMenuFactory = createBtn({
|
|
11404
12703
|
id: "pdfs-ui.menu.start-insert-text",
|
|
11405
|
-
commandId:
|
|
12704
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11406
12705
|
title: "pdfs.ribbon.insertText",
|
|
11407
12706
|
icon: "PdfTextIcon",
|
|
11408
|
-
params: { elementType:
|
|
12707
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.TEXT },
|
|
11409
12708
|
requiresEditor: true,
|
|
11410
|
-
elementTypeGate:
|
|
12709
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.TEXT
|
|
11411
12710
|
});
|
|
11412
12711
|
var InsertPdfParagraphMenuFactory = createBtn({
|
|
11413
12712
|
id: "pdfs-ui.menu.insert-paragraph",
|
|
@@ -11417,17 +12716,17 @@ var InsertPdfParagraphMenuFactory = createBtn({
|
|
|
11417
12716
|
icon: "PdfParagraphIcon",
|
|
11418
12717
|
params: { preset: "paragraph" },
|
|
11419
12718
|
requiresEditor: true,
|
|
11420
|
-
elementTypeGate:
|
|
12719
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.TEXT
|
|
11421
12720
|
});
|
|
11422
12721
|
var InsertPdfListMenuFactory = createBtn({
|
|
11423
12722
|
id: "pdfs-ui.menu.insert-list",
|
|
11424
|
-
commandId:
|
|
12723
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11425
12724
|
title: "pdfs.ribbon.insertList",
|
|
11426
12725
|
label: "pdfs.ribbon.insertList",
|
|
11427
12726
|
icon: "PdfListIcon",
|
|
11428
|
-
params: { elementType:
|
|
12727
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.LIST },
|
|
11429
12728
|
requiresEditor: true,
|
|
11430
|
-
elementTypeGate:
|
|
12729
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.LIST
|
|
11431
12730
|
});
|
|
11432
12731
|
var InsertPdfDividerMenuFactory = createBtn({
|
|
11433
12732
|
id: "pdfs-ui.menu.insert-divider",
|
|
@@ -11437,68 +12736,68 @@ var InsertPdfDividerMenuFactory = createBtn({
|
|
|
11437
12736
|
icon: "PdfDividerIcon",
|
|
11438
12737
|
params: { preset: "divider" },
|
|
11439
12738
|
requiresEditor: true,
|
|
11440
|
-
elementTypeGate:
|
|
12739
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.LINE
|
|
11441
12740
|
});
|
|
11442
12741
|
var InsertPdfImageMenuFactory = createBtn({
|
|
11443
12742
|
id: "pdfs-ui.menu.insert-image",
|
|
11444
|
-
commandId:
|
|
12743
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11445
12744
|
title: "pdfs.ribbon.insertImage",
|
|
11446
12745
|
icon: "PdfImageIcon",
|
|
11447
|
-
params: { elementType:
|
|
12746
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.IMAGE },
|
|
11448
12747
|
requiresEditor: true,
|
|
11449
|
-
elementTypeGate:
|
|
12748
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.IMAGE
|
|
11450
12749
|
});
|
|
11451
12750
|
var InsertPdfTableMenuFactory = createBtn({
|
|
11452
12751
|
id: "pdfs-ui.menu.insert-table",
|
|
11453
|
-
commandId:
|
|
12752
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11454
12753
|
title: "pdfs.ribbon.insertTable",
|
|
11455
12754
|
icon: "PdfTableIcon",
|
|
11456
|
-
params: { elementType:
|
|
12755
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.TABLE },
|
|
11457
12756
|
requiresEditor: true,
|
|
11458
|
-
elementTypeGate:
|
|
12757
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.TABLE,
|
|
11459
12758
|
hiddenWhen: (f) => !f.dynamicTable
|
|
11460
12759
|
});
|
|
11461
12760
|
var InsertPdfQrCodeMenuFactory = createBtn({
|
|
11462
12761
|
id: "pdfs-ui.menu.insert-qrcode",
|
|
11463
|
-
commandId:
|
|
12762
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11464
12763
|
title: "pdfs.ribbon.insertQrCode",
|
|
11465
12764
|
icon: "PdfQrCodeIcon",
|
|
11466
|
-
params: { elementType:
|
|
12765
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.QRCODE },
|
|
11467
12766
|
requiresEditor: true,
|
|
11468
|
-
elementTypeGate:
|
|
12767
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.QRCODE,
|
|
11469
12768
|
hiddenWhen: (f) => !f.qrcode
|
|
11470
12769
|
});
|
|
11471
12770
|
var InsertPdfBarcodeMenuFactory = createBtn({
|
|
11472
12771
|
id: "pdfs-ui.menu.insert-barcode",
|
|
11473
|
-
commandId:
|
|
12772
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11474
12773
|
title: "pdfs.ribbon.insertBarcode",
|
|
11475
12774
|
icon: "PdfBarcodeIcon",
|
|
11476
|
-
params: { elementType:
|
|
12775
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.BARCODE },
|
|
11477
12776
|
requiresEditor: true,
|
|
11478
|
-
elementTypeGate:
|
|
12777
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.BARCODE,
|
|
11479
12778
|
hiddenWhen: (f) => !f.barcode
|
|
11480
12779
|
});
|
|
11481
12780
|
var InsertPdfShapeMenuFactory = createBtn({
|
|
11482
12781
|
id: "pdfs-ui.menu.insert-shape",
|
|
11483
|
-
commandId:
|
|
12782
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11484
12783
|
title: "pdfs.ribbon.insertShape",
|
|
11485
12784
|
icon: "PdfShapeIcon",
|
|
11486
|
-
params: { elementType:
|
|
12785
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.SHAPE },
|
|
11487
12786
|
requiresEditor: true,
|
|
11488
|
-
elementTypeGate:
|
|
12787
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.SHAPE
|
|
11489
12788
|
});
|
|
11490
12789
|
var InsertPdfStampMenuFactory = createBtn({
|
|
11491
12790
|
id: "pdfs-ui.menu.insert-stamp",
|
|
11492
|
-
commandId:
|
|
12791
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11493
12792
|
title: "pdfs.ribbon.insertStamp",
|
|
11494
12793
|
icon: "PdfStampIcon",
|
|
11495
|
-
params: { elementType:
|
|
12794
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.STAMP },
|
|
11496
12795
|
requiresEditor: true,
|
|
11497
|
-
elementTypeGate:
|
|
12796
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.STAMP
|
|
11498
12797
|
});
|
|
11499
12798
|
var AddPdfPageMenuFactory = createBtn({
|
|
11500
12799
|
id: "pdfs-ui.menu.add-page",
|
|
11501
|
-
commandId:
|
|
12800
|
+
commandId: import_univer_pdfs10.AddPdfPageCommand.id,
|
|
11502
12801
|
title: "pdfs.ribbon.addPage",
|
|
11503
12802
|
label: "pdfs.ribbon.addPage",
|
|
11504
12803
|
icon: "PdfAddPageIcon",
|
|
@@ -11512,7 +12811,7 @@ var InsertHighlightMenuFactory = createBtn({
|
|
|
11512
12811
|
icon: "PdfHighlightIcon",
|
|
11513
12812
|
params: { preset: "highlight" },
|
|
11514
12813
|
requiresEditor: true,
|
|
11515
|
-
elementTypeGate:
|
|
12814
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.ANNOTATION
|
|
11516
12815
|
});
|
|
11517
12816
|
var InsertUnderlineMarkMenuFactory = createBtn({
|
|
11518
12817
|
id: "pdfs-ui.menu.annotate-underline",
|
|
@@ -11522,7 +12821,7 @@ var InsertUnderlineMarkMenuFactory = createBtn({
|
|
|
11522
12821
|
icon: "PdfUnderlineMarkIcon",
|
|
11523
12822
|
params: { preset: "underline-mark" },
|
|
11524
12823
|
requiresEditor: true,
|
|
11525
|
-
elementTypeGate:
|
|
12824
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.ANNOTATION
|
|
11526
12825
|
});
|
|
11527
12826
|
var InsertStrikeMarkMenuFactory = createBtn({
|
|
11528
12827
|
id: "pdfs-ui.menu.annotate-strike",
|
|
@@ -11532,21 +12831,21 @@ var InsertStrikeMarkMenuFactory = createBtn({
|
|
|
11532
12831
|
icon: "PdfStrikeMarkIcon",
|
|
11533
12832
|
params: { preset: "strike-mark" },
|
|
11534
12833
|
requiresEditor: true,
|
|
11535
|
-
elementTypeGate:
|
|
12834
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.ANNOTATION
|
|
11536
12835
|
});
|
|
11537
12836
|
var InsertAnnotateStampMenuFactory = createBtn({
|
|
11538
12837
|
id: "pdfs-ui.menu.annotate-stamp",
|
|
11539
|
-
commandId:
|
|
12838
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11540
12839
|
title: "pdfs.ribbon.insertStamp",
|
|
11541
12840
|
label: "pdfs.ribbon.insertStamp",
|
|
11542
12841
|
icon: "PdfStampIcon",
|
|
11543
|
-
params: { elementType:
|
|
12842
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.STAMP },
|
|
11544
12843
|
requiresEditor: true,
|
|
11545
|
-
elementTypeGate:
|
|
12844
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.STAMP
|
|
11546
12845
|
});
|
|
11547
12846
|
var AlignLeftMenuFactory = createBtn({
|
|
11548
12847
|
id: "pdfs-ui.menu.align-left",
|
|
11549
|
-
commandId:
|
|
12848
|
+
commandId: import_univer_pdfs10.AlignSelectedPdfElementsCommand.id,
|
|
11550
12849
|
title: "pdfs.ribbon.alignLeft",
|
|
11551
12850
|
icon: "PdfAlignLeftIcon",
|
|
11552
12851
|
params: { mode: "left" },
|
|
@@ -11554,7 +12853,7 @@ var AlignLeftMenuFactory = createBtn({
|
|
|
11554
12853
|
});
|
|
11555
12854
|
var AlignCenterMenuFactory = createBtn({
|
|
11556
12855
|
id: "pdfs-ui.menu.align-center",
|
|
11557
|
-
commandId:
|
|
12856
|
+
commandId: import_univer_pdfs10.AlignSelectedPdfElementsCommand.id,
|
|
11558
12857
|
title: "pdfs.ribbon.alignCenter",
|
|
11559
12858
|
icon: "PdfAlignCenterIcon",
|
|
11560
12859
|
params: { mode: "center" },
|
|
@@ -11562,7 +12861,7 @@ var AlignCenterMenuFactory = createBtn({
|
|
|
11562
12861
|
});
|
|
11563
12862
|
var AlignRightMenuFactory = createBtn({
|
|
11564
12863
|
id: "pdfs-ui.menu.align-right",
|
|
11565
|
-
commandId:
|
|
12864
|
+
commandId: import_univer_pdfs10.AlignSelectedPdfElementsCommand.id,
|
|
11566
12865
|
title: "pdfs.ribbon.alignRight",
|
|
11567
12866
|
icon: "PdfAlignRightIcon",
|
|
11568
12867
|
params: { mode: "right" },
|
|
@@ -11570,7 +12869,7 @@ var AlignRightMenuFactory = createBtn({
|
|
|
11570
12869
|
});
|
|
11571
12870
|
var AlignMiddleMenuFactory = createBtn({
|
|
11572
12871
|
id: "pdfs-ui.menu.align-middle",
|
|
11573
|
-
commandId:
|
|
12872
|
+
commandId: import_univer_pdfs10.AlignSelectedPdfElementsCommand.id,
|
|
11574
12873
|
title: "pdfs.ribbon.alignMiddle",
|
|
11575
12874
|
icon: "PdfAlignMiddleIcon",
|
|
11576
12875
|
params: { mode: "middle" },
|
|
@@ -11578,36 +12877,36 @@ var AlignMiddleMenuFactory = createBtn({
|
|
|
11578
12877
|
});
|
|
11579
12878
|
var DistributeHMenuFactory = createBtn({
|
|
11580
12879
|
id: "pdfs-ui.menu.distribute-h",
|
|
11581
|
-
commandId:
|
|
12880
|
+
commandId: import_univer_pdfs10.DistributeSelectedPdfElementsCommand.id,
|
|
11582
12881
|
title: "pdfs.ribbon.distributeH",
|
|
11583
12882
|
icon: "PdfDistributeHIcon",
|
|
11584
12883
|
params: { direction: "horizontal" },
|
|
11585
12884
|
requiresEditor: true
|
|
11586
12885
|
});
|
|
11587
12886
|
var DuplicateElementMenuFactory = (accessor) => {
|
|
11588
|
-
const sel = accessor.get(
|
|
12887
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
11589
12888
|
const featService = accessor.get(IPdfsUIFeatureService);
|
|
11590
12889
|
return {
|
|
11591
|
-
id:
|
|
11592
|
-
type:
|
|
12890
|
+
id: import_univer_pdfs10.DuplicateSelectedPdfElementsCommand.id,
|
|
12891
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11593
12892
|
title: "pdfs.ribbon.duplicate",
|
|
11594
12893
|
tooltip: "pdfs.ribbon.duplicate",
|
|
11595
12894
|
icon: "PdfDuplicateIcon",
|
|
11596
|
-
disabled$: sel.state$.pipe((0,
|
|
11597
|
-
hidden$: featService.editorEnabled$.pipe((0,
|
|
12895
|
+
disabled$: sel.state$.pipe((0, import_rxjs8.map)((s) => s.selectedElementIds.length === 0)),
|
|
12896
|
+
hidden$: featService.editorEnabled$.pipe((0, import_rxjs8.map)((enabled) => !enabled))
|
|
11598
12897
|
};
|
|
11599
12898
|
};
|
|
11600
12899
|
var DeleteElementMenuFactory = (accessor) => {
|
|
11601
|
-
const sel = accessor.get(
|
|
12900
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
11602
12901
|
const featService = accessor.get(IPdfsUIFeatureService);
|
|
11603
12902
|
return {
|
|
11604
|
-
id:
|
|
11605
|
-
type:
|
|
12903
|
+
id: import_univer_pdfs10.DeleteSelectedPdfElementsCommand.id,
|
|
12904
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11606
12905
|
title: "pdfs.ribbon.delete",
|
|
11607
12906
|
tooltip: "pdfs.ribbon.delete",
|
|
11608
12907
|
icon: "PdfDeleteIcon",
|
|
11609
|
-
disabled$: sel.state$.pipe((0,
|
|
11610
|
-
hidden$: featService.editorEnabled$.pipe((0,
|
|
12908
|
+
disabled$: sel.state$.pipe((0, import_rxjs8.map)((s) => s.selectedElementIds.length === 0)),
|
|
12909
|
+
hidden$: featService.editorEnabled$.pipe((0, import_rxjs8.map)((enabled) => !enabled))
|
|
11611
12910
|
};
|
|
11612
12911
|
};
|
|
11613
12912
|
var UploadBasePdfMenuFactory = createBtn({
|
|
@@ -11636,17 +12935,41 @@ var ToggleInspectorMenuFactory = createBtn({
|
|
|
11636
12935
|
requiresEditor: true
|
|
11637
12936
|
});
|
|
11638
12937
|
var ToggleFindReplaceMenuFactory = (accessor) => {
|
|
11639
|
-
const sel = accessor.get(
|
|
12938
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
11640
12939
|
const featService = accessor.get(IPdfsUIFeatureService);
|
|
11641
12940
|
return {
|
|
11642
12941
|
id: TogglePdfFindReplaceOperation.id,
|
|
11643
|
-
type:
|
|
12942
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11644
12943
|
title: "pdfs.ribbon.findReplace",
|
|
11645
12944
|
label: "pdfs.ribbon.findReplace",
|
|
11646
12945
|
tooltip: "pdfs.ribbon.findReplace",
|
|
11647
12946
|
icon: "PdfFindReplaceIcon",
|
|
11648
12947
|
activated$: sel.findReplaceOpen$,
|
|
11649
|
-
hidden$: featService.features$.pipe((0,
|
|
12948
|
+
hidden$: featService.features$.pipe((0, import_rxjs8.map)((f) => !f.findReplace))
|
|
12949
|
+
};
|
|
12950
|
+
};
|
|
12951
|
+
var OpenPdfSplitModalMenuFactory = createBtn({
|
|
12952
|
+
id: OpenPdfSplitModalOperation.id,
|
|
12953
|
+
title: "pdfs.ribbon.splitExtract",
|
|
12954
|
+
label: "pdfs.ribbon.splitExtract",
|
|
12955
|
+
icon: "PdfSplitExtractIcon"
|
|
12956
|
+
});
|
|
12957
|
+
var CropModeMenuFactory = (accessor) => {
|
|
12958
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
12959
|
+
const featService = accessor.get(IPdfsUIFeatureService);
|
|
12960
|
+
return {
|
|
12961
|
+
id: "pdfs-ui.menu.mode-crop",
|
|
12962
|
+
commandId: SetPdfInteractionModeOperation.id,
|
|
12963
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
12964
|
+
title: "pdfs.ribbon.cropPage",
|
|
12965
|
+
label: "pdfs.ribbon.cropPage",
|
|
12966
|
+
tooltip: "pdfs.ribbon.cropPage",
|
|
12967
|
+
icon: "PdfCropPageIcon",
|
|
12968
|
+
params: { mode: "crop" },
|
|
12969
|
+
activated$: sel.interactionMode$.pipe((0, import_rxjs8.map)((m) => m === "crop")),
|
|
12970
|
+
hidden$: (0, import_rxjs8.combineLatest)([featService.features$, featService.editorEnabled$]).pipe(
|
|
12971
|
+
(0, import_rxjs8.map)(([f, editorEnabled]) => !editorEnabled || !f.cropBox)
|
|
12972
|
+
)
|
|
11650
12973
|
};
|
|
11651
12974
|
};
|
|
11652
12975
|
var OpenPdfPreviewMenuFactory = createBtn({
|
|
@@ -11662,10 +12985,10 @@ var PrintPdfMenuFactory = createBtn({
|
|
|
11662
12985
|
hiddenWhen: (f) => !f.print
|
|
11663
12986
|
});
|
|
11664
12987
|
var ToggleRulerMenuFactory = (accessor) => {
|
|
11665
|
-
const sel = accessor.get(
|
|
12988
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
11666
12989
|
return {
|
|
11667
12990
|
id: TogglePdfRulerOperation.id,
|
|
11668
|
-
type:
|
|
12991
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11669
12992
|
title: "pdfs.ribbon.toggleRuler",
|
|
11670
12993
|
tooltip: "pdfs.ribbon.toggleRuler",
|
|
11671
12994
|
icon: "PdfRulerIcon",
|
|
@@ -11673,10 +12996,10 @@ var ToggleRulerMenuFactory = (accessor) => {
|
|
|
11673
12996
|
};
|
|
11674
12997
|
};
|
|
11675
12998
|
var ToggleGridMenuFactory = (accessor) => {
|
|
11676
|
-
const sel = accessor.get(
|
|
12999
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
11677
13000
|
return {
|
|
11678
13001
|
id: TogglePdfGridOperation.id,
|
|
11679
|
-
type:
|
|
13002
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11680
13003
|
title: "pdfs.ribbon.toggleGrid",
|
|
11681
13004
|
tooltip: "pdfs.ribbon.toggleGrid",
|
|
11682
13005
|
icon: "PdfGridIcon",
|
|
@@ -11684,10 +13007,10 @@ var ToggleGridMenuFactory = (accessor) => {
|
|
|
11684
13007
|
};
|
|
11685
13008
|
};
|
|
11686
13009
|
var ToggleMarginsMenuFactory = (accessor) => {
|
|
11687
|
-
const sel = accessor.get(
|
|
13010
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
11688
13011
|
return {
|
|
11689
13012
|
id: TogglePdfMarginsOperation.id,
|
|
11690
|
-
type:
|
|
13013
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11691
13014
|
title: "pdfs.ribbon.toggleMargins",
|
|
11692
13015
|
tooltip: "pdfs.ribbon.toggleMargins",
|
|
11693
13016
|
icon: "PdfMarginIcon",
|
|
@@ -11695,10 +13018,10 @@ var ToggleMarginsMenuFactory = (accessor) => {
|
|
|
11695
13018
|
};
|
|
11696
13019
|
};
|
|
11697
13020
|
var ToggleSnapMenuFactory = (accessor) => {
|
|
11698
|
-
const sel = accessor.get(
|
|
13021
|
+
const sel = accessor.get(import_univer_pdfs10.IPdfSelectionService);
|
|
11699
13022
|
return {
|
|
11700
13023
|
id: TogglePdfSnapOperation.id,
|
|
11701
|
-
type:
|
|
13024
|
+
type: import_ui9.MenuItemType.BUTTON,
|
|
11702
13025
|
title: "pdfs.ribbon.toggleSnap",
|
|
11703
13026
|
tooltip: "pdfs.ribbon.toggleSnap",
|
|
11704
13027
|
icon: "PdfAlignCenterIcon",
|
|
@@ -11718,7 +13041,7 @@ var ZoomResetMenuFactory = createBtn({
|
|
|
11718
13041
|
params: { zoom: 1 }
|
|
11719
13042
|
});
|
|
11720
13043
|
var pdfsMenuSchema = {
|
|
11721
|
-
[
|
|
13044
|
+
[import_ui9.RibbonStartGroup.FORMAT]: {
|
|
11722
13045
|
["pdfs-ui.menu.mode-select"]: { order: 0, menuItemFactory: SelectModeMenuFactory },
|
|
11723
13046
|
["pdfs-ui.menu.mode-pan"]: { order: 0.5, menuItemFactory: PanModeMenuFactory },
|
|
11724
13047
|
["pdfs-ui.menu.start-insert-text"]: { order: 1, menuItemFactory: InsertPdfTextCompactMenuFactory },
|
|
@@ -11728,56 +13051,57 @@ var pdfsMenuSchema = {
|
|
|
11728
13051
|
["pdfs-ui.menu.insert-image"]: { order: 5, menuItemFactory: InsertPdfImageMenuFactory },
|
|
11729
13052
|
["pdfs-ui.menu.insert-stamp"]: { order: 6, menuItemFactory: InsertPdfStampMenuFactory }
|
|
11730
13053
|
},
|
|
11731
|
-
[
|
|
13054
|
+
[import_ui9.RibbonStartGroup.LAYOUT]: {
|
|
11732
13055
|
["pdfs-ui.menu.align-left"]: { order: 1, menuItemFactory: AlignLeftMenuFactory },
|
|
11733
13056
|
["pdfs-ui.menu.align-center"]: { order: 2, menuItemFactory: AlignCenterMenuFactory },
|
|
11734
13057
|
["pdfs-ui.menu.align-right"]: { order: 3, menuItemFactory: AlignRightMenuFactory },
|
|
11735
13058
|
["pdfs-ui.menu.align-middle"]: { order: 4, menuItemFactory: AlignMiddleMenuFactory },
|
|
11736
13059
|
["pdfs-ui.menu.distribute-h"]: { order: 5, menuItemFactory: DistributeHMenuFactory },
|
|
11737
|
-
[
|
|
11738
|
-
[
|
|
13060
|
+
[import_univer_pdfs10.DuplicateSelectedPdfElementsCommand.id]: { order: 6, menuItemFactory: DuplicateElementMenuFactory },
|
|
13061
|
+
[import_univer_pdfs10.DeleteSelectedPdfElementsCommand.id]: { order: 7, menuItemFactory: DeleteElementMenuFactory }
|
|
11739
13062
|
},
|
|
11740
|
-
[
|
|
13063
|
+
[import_ui9.RibbonStartGroup.OTHERS]: {
|
|
11741
13064
|
[UploadBasePdfOperation.id]: { order: 1, menuItemFactory: UploadBasePdfMenuFactory },
|
|
11742
13065
|
["pdfs-ui.menu.open-json"]: { order: 2, menuItemFactory: OpenJsonExchangeMenuFactory },
|
|
11743
13066
|
[TogglePdfInspectorOperation.id]: { order: 3, menuItemFactory: ToggleInspectorMenuFactory },
|
|
11744
13067
|
[TogglePdfFindReplaceOperation.id]: { order: 3.5, menuItemFactory: ToggleFindReplaceMenuFactory },
|
|
13068
|
+
[OpenPdfSplitModalOperation.id]: { order: 3.8, menuItemFactory: OpenPdfSplitModalMenuFactory },
|
|
11745
13069
|
[OpenPdfPreviewOperation.id]: { order: 4, menuItemFactory: OpenPdfPreviewMenuFactory },
|
|
11746
13070
|
[PrintPdfOperation.id]: { order: 5, menuItemFactory: PrintPdfMenuFactory }
|
|
11747
13071
|
},
|
|
11748
|
-
[
|
|
13072
|
+
[import_ui9.RibbonInsertGroup.EDIT]: {
|
|
11749
13073
|
["pdfs-ui.menu.insert-text"]: { order: 1, menuItemFactory: InsertPdfTextMenuFactory },
|
|
11750
13074
|
["pdfs-ui.menu.insert-paragraph"]: { order: 2, menuItemFactory: InsertPdfParagraphMenuFactory },
|
|
11751
13075
|
["pdfs-ui.menu.insert-list"]: { order: 3, menuItemFactory: InsertPdfListMenuFactory },
|
|
11752
13076
|
["pdfs-ui.menu.insert-divider"]: { order: 4, menuItemFactory: InsertPdfDividerMenuFactory },
|
|
11753
13077
|
["pdfs-ui.menu.add-page"]: { order: 5, menuItemFactory: AddPdfPageMenuFactory }
|
|
11754
13078
|
},
|
|
11755
|
-
[
|
|
13079
|
+
[import_ui9.RibbonInsertGroup.MEDIA]: {
|
|
11756
13080
|
["pdfs-ui.menu.insert-image-2"]: {
|
|
11757
13081
|
order: 1,
|
|
11758
13082
|
menuItemFactory: createBtn({
|
|
11759
13083
|
id: "pdfs-ui.menu.insert-image-2",
|
|
11760
|
-
commandId:
|
|
13084
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11761
13085
|
title: "pdfs.ribbon.insertImage",
|
|
11762
13086
|
icon: "PdfImageIcon",
|
|
11763
|
-
params: { elementType:
|
|
13087
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.IMAGE },
|
|
11764
13088
|
requiresEditor: true,
|
|
11765
|
-
elementTypeGate:
|
|
13089
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.IMAGE
|
|
11766
13090
|
})
|
|
11767
13091
|
},
|
|
11768
13092
|
["pdfs-ui.menu.insert-static-table"]: {
|
|
11769
13093
|
order: 1.5,
|
|
11770
13094
|
menuItemFactory: createBtn({
|
|
11771
13095
|
id: "pdfs-ui.menu.insert-static-table",
|
|
11772
|
-
commandId:
|
|
13096
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11773
13097
|
title: "pdfs.ribbon.insertStaticTable",
|
|
11774
13098
|
icon: "PdfTableIcon",
|
|
11775
13099
|
params: {
|
|
11776
|
-
elementType:
|
|
13100
|
+
elementType: import_univer_pdfs10.PdfElementType.TABLE,
|
|
11777
13101
|
element: { bindingField: void 0, name: "\u8868\u683C" }
|
|
11778
13102
|
},
|
|
11779
13103
|
requiresEditor: true,
|
|
11780
|
-
elementTypeGate:
|
|
13104
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.TABLE,
|
|
11781
13105
|
hiddenWhen: (f) => f.dynamicTable
|
|
11782
13106
|
})
|
|
11783
13107
|
},
|
|
@@ -11785,12 +13109,12 @@ var pdfsMenuSchema = {
|
|
|
11785
13109
|
order: 2,
|
|
11786
13110
|
menuItemFactory: createBtn({
|
|
11787
13111
|
id: "pdfs-ui.menu.insert-table-2",
|
|
11788
|
-
commandId:
|
|
13112
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11789
13113
|
title: "pdfs.ribbon.insertTable",
|
|
11790
13114
|
icon: "PdfTableIcon",
|
|
11791
|
-
params: { elementType:
|
|
13115
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.TABLE },
|
|
11792
13116
|
requiresEditor: true,
|
|
11793
|
-
elementTypeGate:
|
|
13117
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.TABLE,
|
|
11794
13118
|
hiddenWhen: (f) => !f.dynamicTable
|
|
11795
13119
|
})
|
|
11796
13120
|
},
|
|
@@ -11798,12 +13122,12 @@ var pdfsMenuSchema = {
|
|
|
11798
13122
|
order: 3,
|
|
11799
13123
|
menuItemFactory: createBtn({
|
|
11800
13124
|
id: "pdfs-ui.menu.insert-qrcode-2",
|
|
11801
|
-
commandId:
|
|
13125
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11802
13126
|
title: "pdfs.ribbon.insertQrCode",
|
|
11803
13127
|
icon: "PdfQrCodeIcon",
|
|
11804
|
-
params: { elementType:
|
|
13128
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.QRCODE },
|
|
11805
13129
|
requiresEditor: true,
|
|
11806
|
-
elementTypeGate:
|
|
13130
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.QRCODE,
|
|
11807
13131
|
hiddenWhen: (f) => !f.qrcode
|
|
11808
13132
|
})
|
|
11809
13133
|
},
|
|
@@ -11811,12 +13135,12 @@ var pdfsMenuSchema = {
|
|
|
11811
13135
|
order: 4,
|
|
11812
13136
|
menuItemFactory: createBtn({
|
|
11813
13137
|
id: "pdfs-ui.menu.insert-barcode-2",
|
|
11814
|
-
commandId:
|
|
13138
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11815
13139
|
title: "pdfs.ribbon.insertBarcode",
|
|
11816
13140
|
icon: "PdfBarcodeIcon",
|
|
11817
|
-
params: { elementType:
|
|
13141
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.BARCODE },
|
|
11818
13142
|
requiresEditor: true,
|
|
11819
|
-
elementTypeGate:
|
|
13143
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.BARCODE,
|
|
11820
13144
|
hiddenWhen: (f) => !f.barcode
|
|
11821
13145
|
})
|
|
11822
13146
|
},
|
|
@@ -11825,12 +13149,12 @@ var pdfsMenuSchema = {
|
|
|
11825
13149
|
order: 6,
|
|
11826
13150
|
menuItemFactory: createBtn({
|
|
11827
13151
|
id: "pdfs-ui.menu.insert-stamp-2",
|
|
11828
|
-
commandId:
|
|
13152
|
+
commandId: import_univer_pdfs10.AddPdfElementCommand.id,
|
|
11829
13153
|
title: "pdfs.ribbon.insertStamp",
|
|
11830
13154
|
icon: "PdfStampIcon",
|
|
11831
|
-
params: { elementType:
|
|
13155
|
+
params: { elementType: import_univer_pdfs10.PdfElementType.STAMP },
|
|
11832
13156
|
requiresEditor: true,
|
|
11833
|
-
elementTypeGate:
|
|
13157
|
+
elementTypeGate: import_univer_pdfs10.PdfElementType.STAMP
|
|
11834
13158
|
})
|
|
11835
13159
|
}
|
|
11836
13160
|
},
|
|
@@ -11841,18 +13165,19 @@ var pdfsMenuSchema = {
|
|
|
11841
13165
|
["pdfs-ui.menu.mode-ink"]: { order: 4, menuItemFactory: InkModeMenuFactory },
|
|
11842
13166
|
["pdfs-ui.menu.annotate-stamp"]: { order: 5, menuItemFactory: InsertAnnotateStampMenuFactory }
|
|
11843
13167
|
},
|
|
11844
|
-
[
|
|
13168
|
+
[import_ui9.RibbonViewGroup.DISPLAY]: {
|
|
11845
13169
|
[TogglePdfRulerOperation.id]: { order: 1, menuItemFactory: ToggleRulerMenuFactory },
|
|
11846
13170
|
[TogglePdfGridOperation.id]: { order: 2, menuItemFactory: ToggleGridMenuFactory },
|
|
11847
13171
|
[TogglePdfMarginsOperation.id]: { order: 3, menuItemFactory: ToggleMarginsMenuFactory },
|
|
11848
13172
|
[TogglePdfSnapOperation.id]: { order: 4, menuItemFactory: ToggleSnapMenuFactory },
|
|
13173
|
+
["pdfs-ui.menu.mode-crop"]: { order: 4.5, menuItemFactory: CropModeMenuFactory },
|
|
11849
13174
|
[SwitchPdfDisplayUnitOperation.id]: { order: 5, menuItemFactory: SwitchUnitMenuFactory },
|
|
11850
13175
|
["pdfs-ui.menu.zoom-reset"]: { order: 6, menuItemFactory: ZoomResetMenuFactory }
|
|
11851
13176
|
}
|
|
11852
13177
|
};
|
|
11853
13178
|
|
|
11854
13179
|
// src/controllers/pdfs-ui.controller.ts
|
|
11855
|
-
var PdfsUIController = class extends
|
|
13180
|
+
var PdfsUIController = class extends import_core10.Disposable {
|
|
11856
13181
|
constructor(_config, _commandService, _menuManagerService, _uiPartsService, _sidebarService, _componentManager, _iconManager) {
|
|
11857
13182
|
super();
|
|
11858
13183
|
this._config = _config;
|
|
@@ -11877,7 +13202,7 @@ var PdfsUIController = class extends import_core9.Disposable {
|
|
|
11877
13202
|
}
|
|
11878
13203
|
}, 100);
|
|
11879
13204
|
this.disposeWithMe(
|
|
11880
|
-
(0,
|
|
13205
|
+
(0, import_core10.toDisposable)(() => {
|
|
11881
13206
|
if (this._openInspectorTimer !== null) {
|
|
11882
13207
|
clearTimeout(this._openInspectorTimer);
|
|
11883
13208
|
this._openInspectorTimer = null;
|
|
@@ -11899,6 +13224,7 @@ var PdfsUIController = class extends import_core9.Disposable {
|
|
|
11899
13224
|
TogglePdfInspectorOperation,
|
|
11900
13225
|
TogglePdfFindReplaceOperation,
|
|
11901
13226
|
OpenPdfPreviewOperation,
|
|
13227
|
+
OpenPdfSplitModalOperation,
|
|
11902
13228
|
UploadBasePdfOperation,
|
|
11903
13229
|
SavePdfToHostOperation,
|
|
11904
13230
|
PrintPdfOperation,
|
|
@@ -11925,32 +13251,35 @@ var PdfsUIController = class extends import_core9.Disposable {
|
|
|
11925
13251
|
}
|
|
11926
13252
|
_initWorkbenchParts() {
|
|
11927
13253
|
this.disposeWithMe(
|
|
11928
|
-
this._uiPartsService.registerComponent(
|
|
13254
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.LEFT_SIDEBAR, () => PdfLeftSidebar)
|
|
11929
13255
|
);
|
|
11930
13256
|
this.disposeWithMe(
|
|
11931
|
-
this._uiPartsService.registerComponent(
|
|
13257
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.CONTENT, () => PdfCanvasView)
|
|
11932
13258
|
);
|
|
11933
13259
|
this.disposeWithMe(
|
|
11934
|
-
this._uiPartsService.registerComponent(
|
|
13260
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.FOOTER, () => PdfStatusBar)
|
|
11935
13261
|
);
|
|
11936
13262
|
this.disposeWithMe(
|
|
11937
|
-
this._uiPartsService.registerComponent(
|
|
13263
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.GLOBAL, () => PdfPreviewModal)
|
|
13264
|
+
);
|
|
13265
|
+
this.disposeWithMe(
|
|
13266
|
+
this._uiPartsService.registerComponent(import_ui10.BuiltInUIPart.GLOBAL, () => PdfSplitExtractModal)
|
|
11938
13267
|
);
|
|
11939
13268
|
}
|
|
11940
13269
|
};
|
|
11941
13270
|
PdfsUIController = __decorateClass([
|
|
11942
|
-
__decorateParam(1,
|
|
11943
|
-
__decorateParam(2,
|
|
11944
|
-
__decorateParam(3,
|
|
11945
|
-
__decorateParam(4,
|
|
11946
|
-
__decorateParam(5, (0,
|
|
11947
|
-
__decorateParam(6, (0,
|
|
13271
|
+
__decorateParam(1, import_core10.ICommandService),
|
|
13272
|
+
__decorateParam(2, import_ui10.IMenuManagerService),
|
|
13273
|
+
__decorateParam(3, import_ui10.IUIPartsService),
|
|
13274
|
+
__decorateParam(4, import_ui10.ISidebarService),
|
|
13275
|
+
__decorateParam(5, (0, import_core10.Inject)(import_ui10.ComponentManager)),
|
|
13276
|
+
__decorateParam(6, (0, import_core10.Inject)(import_ui10.IconManager))
|
|
11948
13277
|
], PdfsUIController);
|
|
11949
13278
|
|
|
11950
13279
|
// src/plugin.ts
|
|
11951
|
-
var
|
|
13280
|
+
var import_core11 = require("@univerjs/core");
|
|
11952
13281
|
var import_engine_render = require("@univerjs/engine-render");
|
|
11953
|
-
var
|
|
13282
|
+
var import_univer_pdfs11 = require("@yudaocode/univer-pdfs");
|
|
11954
13283
|
|
|
11955
13284
|
// src/locale/en-US.ts
|
|
11956
13285
|
var locale = {
|
|
@@ -11989,6 +13318,8 @@ var locale = {
|
|
|
11989
13318
|
jsonExchange: "JSON / pdfme",
|
|
11990
13319
|
inspector: "Inspector",
|
|
11991
13320
|
findReplace: "Find & Replace",
|
|
13321
|
+
splitExtract: "Split & Extract",
|
|
13322
|
+
cropPage: "Crop Page",
|
|
11992
13323
|
previewPdf: "Preview / Export PDF",
|
|
11993
13324
|
printPdf: "Print PDF",
|
|
11994
13325
|
toggleRuler: "Ruler",
|
|
@@ -12061,6 +13392,8 @@ var locale2 = {
|
|
|
12061
13392
|
jsonExchange: "JSON / pdfme",
|
|
12062
13393
|
inspector: "\u5C5E\u6027\u4E0E\u7ED1\u5B9A",
|
|
12063
13394
|
findReplace: "\u67E5\u627E\u4E0E\u66FF\u6362",
|
|
13395
|
+
splitExtract: "\u62C6\u5206\u63D0\u53D6",
|
|
13396
|
+
cropPage: "\u9875\u9762\u88C1\u5207",
|
|
12064
13397
|
previewPdf: "\u9884\u89C8/\u5BFC\u51FAPDF",
|
|
12065
13398
|
printPdf: "\u6253\u5370PDF",
|
|
12066
13399
|
toggleRuler: "\u6807\u5C3A",
|
|
@@ -12098,20 +13431,20 @@ var zh_CN_default = locale2;
|
|
|
12098
13431
|
|
|
12099
13432
|
// src/plugin.ts
|
|
12100
13433
|
var UNIVER_PDFS_UI_PLUGIN_NAME = "UNIVER_PDFS_UI_PLUGIN";
|
|
12101
|
-
var UniverPdfsUIPlugin = class extends
|
|
13434
|
+
var UniverPdfsUIPlugin = class extends import_core11.Plugin {
|
|
12102
13435
|
constructor(_config = {}, _injector) {
|
|
12103
13436
|
super();
|
|
12104
13437
|
this._config = _config;
|
|
12105
13438
|
this._injector = _injector;
|
|
12106
13439
|
}
|
|
12107
13440
|
onStarting() {
|
|
12108
|
-
if (this._injector.has(
|
|
12109
|
-
this._injector.get(
|
|
12110
|
-
[
|
|
12111
|
-
[
|
|
13441
|
+
if (this._injector.has(import_core11.LocaleService)) {
|
|
13442
|
+
this._injector.get(import_core11.LocaleService).load({
|
|
13443
|
+
[import_core11.LocaleType.ZH_CN]: zh_CN_default,
|
|
13444
|
+
[import_core11.LocaleType.EN_US]: en_US_default
|
|
12112
13445
|
});
|
|
12113
13446
|
}
|
|
12114
|
-
const coreAssets = this._injector.has(
|
|
13447
|
+
const coreAssets = this._injector.has(import_univer_pdfs11.IPdfIoService) ? this._injector.get(import_univer_pdfs11.IPdfIoService).getPdfjsAssets() : void 0;
|
|
12115
13448
|
const mergedAssets = this._config.pdfjsAssets ?? coreAssets;
|
|
12116
13449
|
if (mergedAssets) {
|
|
12117
13450
|
configurePdfjsAssets(mergedAssets);
|
|
@@ -12134,10 +13467,10 @@ var UniverPdfsUIPlugin = class extends import_core10.Plugin {
|
|
|
12134
13467
|
};
|
|
12135
13468
|
UniverPdfsUIPlugin.pluginName = UNIVER_PDFS_UI_PLUGIN_NAME;
|
|
12136
13469
|
UniverPdfsUIPlugin.packageName = "@yudaocode/univer-pdfs-ui";
|
|
12137
|
-
UniverPdfsUIPlugin.type =
|
|
13470
|
+
UniverPdfsUIPlugin.type = import_core11.UniverInstanceType.UNIVER_PDF;
|
|
12138
13471
|
UniverPdfsUIPlugin = __decorateClass([
|
|
12139
|
-
(0,
|
|
12140
|
-
__decorateParam(1, (0,
|
|
13472
|
+
(0, import_core11.DependentOn)(import_engine_render.UniverRenderEnginePlugin, import_univer_pdfs11.UniverPdfsPlugin),
|
|
13473
|
+
__decorateParam(1, (0, import_core11.Inject)(import_core11.Injector))
|
|
12141
13474
|
], UniverPdfsUIPlugin);
|
|
12142
13475
|
// Annotate the CommonJS export names for ESM import in node:
|
|
12143
13476
|
0 && (module.exports = {
|
|
@@ -12146,6 +13479,7 @@ UniverPdfsUIPlugin = __decorateClass([
|
|
|
12146
13479
|
IPdfsUIFeatureService,
|
|
12147
13480
|
InsertPdfPresetElementOperation,
|
|
12148
13481
|
OpenPdfPreviewOperation,
|
|
13482
|
+
OpenPdfSplitModalOperation,
|
|
12149
13483
|
PDF_INSPECTOR_COMPONENT_KEY,
|
|
12150
13484
|
PDF_INSPECTOR_SIDEBAR_ID,
|
|
12151
13485
|
PdfCanvasView,
|
|
@@ -12154,6 +13488,7 @@ UniverPdfsUIPlugin = __decorateClass([
|
|
|
12154
13488
|
PdfInspectorSidebar,
|
|
12155
13489
|
PdfLeftSidebar,
|
|
12156
13490
|
PdfPreviewModal,
|
|
13491
|
+
PdfSplitExtractModal,
|
|
12157
13492
|
PdfStatusBar,
|
|
12158
13493
|
PdfUnifiedIoSection,
|
|
12159
13494
|
PdfsUIController,
|
|
@@ -12183,6 +13518,7 @@ UniverPdfsUIPlugin = __decorateClass([
|
|
|
12183
13518
|
clearPdfDocumentCache,
|
|
12184
13519
|
collectPdfFindMatches,
|
|
12185
13520
|
computePdfDocumentCacheKey,
|
|
13521
|
+
computePdfSplitPlanPreview,
|
|
12186
13522
|
configurePdfjsAssets,
|
|
12187
13523
|
countBookmarkTreeItems,
|
|
12188
13524
|
deleteBookmarkFromTree,
|