@yudaocode/univer-docs-ui 1.6.209 → 1.6.211
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/lib/cjs/index.js +1228 -631
- package/lib/cjs/index.js.map +1 -1
- package/lib/es/index.js +1226 -627
- package/lib/es/index.js.map +1 -1
- package/lib/types/index.d.ts +4 -2
- package/package.json +3 -3
package/lib/es/index.js
CHANGED
|
@@ -321,34 +321,43 @@ var PrintDocOperation = {
|
|
|
321
321
|
return triggerIframePrint(pdfBytes);
|
|
322
322
|
}
|
|
323
323
|
};
|
|
324
|
+
var DOC_IMPORT_ACCEPT_EXTENSIONS = ".docx,.doc,.rtf,.odt,.xml,.md,.html,.txt,.json";
|
|
324
325
|
var ImportDocFileOperation = {
|
|
325
326
|
id: "yudao-docs-ui.operation.import-file",
|
|
326
327
|
type: CommandType.OPERATION,
|
|
327
328
|
handler: (accessor, params) => {
|
|
328
|
-
if (typeof document === "undefined") return false;
|
|
329
329
|
const commandService = accessor.get(ICommandService);
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
330
|
+
if (params?.file) {
|
|
331
|
+
const instanceService = accessor.get(IUniverInstanceService);
|
|
332
|
+
const ioService = accessor.get(IDocIoService);
|
|
333
|
+
const docModel = instanceService.getCurrentUnitOfType(
|
|
334
|
+
UniverInstanceType.UNIVER_DOC
|
|
335
|
+
);
|
|
336
|
+
if (!docModel) return false;
|
|
337
|
+
void ioService.importDoc(params.file, docModel.getUnitId(), {
|
|
338
|
+
target: params.target
|
|
339
|
+
}).then((parsed) => {
|
|
340
|
+
if (parsed.body) {
|
|
341
|
+
commandService.syncExecuteCommand(ReplaceDocUnitSnapshotCommand.id, {
|
|
342
|
+
unitId: docModel.getUnitId(),
|
|
343
|
+
snapshot: parsed
|
|
344
|
+
});
|
|
345
|
+
}
|
|
342
346
|
});
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
if (accessor.has(IDocsUIFeatureService)) {
|
|
351
|
+
const featureService = accessor.get(IDocsUIFeatureService);
|
|
352
|
+
if (featureService.getFeatures().builtinPreviewModal !== false) {
|
|
353
|
+
featureService.openModal("import");
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
return false;
|
|
348
357
|
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
return
|
|
358
|
+
} catch {
|
|
359
|
+
}
|
|
360
|
+
return commandService.syncExecuteCommand(OpenDocModalOperation.id, { tab: "import" });
|
|
352
361
|
}
|
|
353
362
|
};
|
|
354
363
|
var QuickInsertDocSdtOperation = {
|
|
@@ -638,6 +647,7 @@ import {
|
|
|
638
647
|
SetDocTableBorderPresetCommand,
|
|
639
648
|
SetDocTableCellPropertiesCommand,
|
|
640
649
|
SetDocTableRepeatHeaderCommand,
|
|
650
|
+
SetDocTableRowLoopCommand,
|
|
641
651
|
SetDocTextDirectionCommand,
|
|
642
652
|
SetDocTrackChangesCommand,
|
|
643
653
|
SetParagraphBorderAndShadingCommand,
|
|
@@ -742,6 +752,12 @@ var DocInspectorPanel = () => {
|
|
|
742
752
|
const [newCascadeCond, setNewCascadeCond] = useState('contractType == "\u8DE8\u5883\u91C7\u8D2D" && amount > 500000');
|
|
743
753
|
const [newCascadeConcept, setNewCascadeConcept] = useState("taxClause");
|
|
744
754
|
const [newNoteText, setNewNoteText] = useState("");
|
|
755
|
+
const [loopTableId, setLoopTableId] = useState("");
|
|
756
|
+
const [loopRowIndex, setLoopRowIndex] = useState(1);
|
|
757
|
+
const [loopListKey, setLoopListKey] = useState("");
|
|
758
|
+
const [loopRepeatHeader, setLoopRepeatHeader] = useState(true);
|
|
759
|
+
const [loopEmptyStrategy, setLoopEmptyStrategy] = useState("keep-blank");
|
|
760
|
+
const [loopEmptyPlaceholder, setLoopEmptyPlaceholder] = useState("\u6682\u65E0\u660E\u7EC6\u6570\u636E");
|
|
745
761
|
const versionsTick = useObservable(sdtService.versionsChange$, "");
|
|
746
762
|
useEffect(() => {
|
|
747
763
|
const disp = commandService.onCommandExecuted((info) => {
|
|
@@ -751,6 +767,34 @@ var DocInspectorPanel = () => {
|
|
|
751
767
|
});
|
|
752
768
|
return () => disp.dispose();
|
|
753
769
|
}, [commandService]);
|
|
770
|
+
useEffect(() => {
|
|
771
|
+
if (!unit) return;
|
|
772
|
+
const tbls = listDocTables(unit.getSnapshot());
|
|
773
|
+
if (tbls.length === 0) return;
|
|
774
|
+
const selTbl = tbls.find((t) => t.tableId === loopTableId) ?? tbls[0];
|
|
775
|
+
const defaultRow = selTbl.rowCount > 1 ? 1 : 0;
|
|
776
|
+
const clampedRow = Math.min(Math.max(0, loopRowIndex), Math.max(0, selTbl.rowCount - 1));
|
|
777
|
+
const targetRow = loopTableId === selTbl.tableId ? clampedRow : defaultRow;
|
|
778
|
+
if (loopTableId !== selTbl.tableId) {
|
|
779
|
+
setLoopTableId(selTbl.tableId);
|
|
780
|
+
setLoopRowIndex(targetRow);
|
|
781
|
+
} else if (loopRowIndex !== targetRow) {
|
|
782
|
+
setLoopRowIndex(targetRow);
|
|
783
|
+
}
|
|
784
|
+
const meta = sdtService.getTemplateMetadata(unit.getUnitId());
|
|
785
|
+
const cfg = meta.tableRowLoops?.[`${selTbl.tableId}:${targetRow}`];
|
|
786
|
+
if (cfg) {
|
|
787
|
+
setLoopListKey(cfg.listKey || "");
|
|
788
|
+
setLoopRepeatHeader(cfg.repeatHeaderRow ?? true);
|
|
789
|
+
setLoopEmptyStrategy(cfg.emptyStrategy ?? "keep-blank");
|
|
790
|
+
setLoopEmptyPlaceholder(cfg.emptyPlaceholderText ?? "\u6682\u65E0\u660E\u7EC6\u6570\u636E");
|
|
791
|
+
} else {
|
|
792
|
+
setLoopListKey("");
|
|
793
|
+
setLoopRepeatHeader(true);
|
|
794
|
+
setLoopEmptyStrategy("keep-blank");
|
|
795
|
+
setLoopEmptyPlaceholder("\u6682\u65E0\u660E\u7EC6\u6570\u636E");
|
|
796
|
+
}
|
|
797
|
+
}, [unit, loopTableId, loopRowIndex, metaVersion, rev, sdtService]);
|
|
754
798
|
if (!unit) return null;
|
|
755
799
|
void rev;
|
|
756
800
|
void metaVersion;
|
|
@@ -1820,6 +1864,267 @@ var DocInspectorPanel = () => {
|
|
|
1820
1864
|
] })
|
|
1821
1865
|
] })
|
|
1822
1866
|
] }),
|
|
1867
|
+
tables.length > 0 && (() => {
|
|
1868
|
+
const activeLoopTable = tables.find((t) => t.tableId === loopTableId) ?? tables[0];
|
|
1869
|
+
const activeLoopRowIdx = Math.min(
|
|
1870
|
+
Math.max(0, loopRowIndex),
|
|
1871
|
+
Math.max(0, activeLoopTable.rowCount - 1)
|
|
1872
|
+
);
|
|
1873
|
+
const existingLoop = metadata.tableRowLoops?.[`${activeLoopTable.tableId}:${activeLoopRowIdx}`];
|
|
1874
|
+
const suggestedListKeys = Array.from(
|
|
1875
|
+
/* @__PURE__ */ new Set([
|
|
1876
|
+
...(metadata.datasets ?? []).map((ds) => ds.id).filter(Boolean),
|
|
1877
|
+
...Object.entries(metadata.sampleData ?? {}).filter(([, val]) => Array.isArray(val)).map(([key]) => key)
|
|
1878
|
+
])
|
|
1879
|
+
);
|
|
1880
|
+
const allBoundLoops = Object.values(metadata.tableRowLoops ?? {});
|
|
1881
|
+
return /* @__PURE__ */ jsxs2("div", { className: "yudao-doc-section", "data-testid": "yudao-table-row-loops-card", children: [
|
|
1882
|
+
/* @__PURE__ */ jsxs2("div", { className: "yudao-doc-section-title", children: [
|
|
1883
|
+
/* @__PURE__ */ jsx2("span", { children: "\u8868\u683C\u660E\u7EC6\u884C\u5FAA\u73AF (tableRowLoops)" }),
|
|
1884
|
+
allBoundLoops.length > 0 && /* @__PURE__ */ jsxs2(
|
|
1885
|
+
"span",
|
|
1886
|
+
{
|
|
1887
|
+
style: {
|
|
1888
|
+
fontSize: 10.5,
|
|
1889
|
+
padding: "1px 6px",
|
|
1890
|
+
borderRadius: 999,
|
|
1891
|
+
background: "#f3f5ff",
|
|
1892
|
+
color: "#2c53f1",
|
|
1893
|
+
fontWeight: 500
|
|
1894
|
+
},
|
|
1895
|
+
children: [
|
|
1896
|
+
"\u5DF2\u7ED1 ",
|
|
1897
|
+
allBoundLoops.length,
|
|
1898
|
+
" \u884C"
|
|
1899
|
+
]
|
|
1900
|
+
}
|
|
1901
|
+
)
|
|
1902
|
+
] }),
|
|
1903
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 6 }, children: [
|
|
1904
|
+
/* @__PURE__ */ jsx2(
|
|
1905
|
+
"select",
|
|
1906
|
+
{
|
|
1907
|
+
"data-testid": "yudao-loop-table-select",
|
|
1908
|
+
value: activeLoopTable.tableId,
|
|
1909
|
+
onChange: (e) => {
|
|
1910
|
+
const nextTbl = tables.find((t) => t.tableId === e.target.value) ?? tables[0];
|
|
1911
|
+
setLoopTableId(nextTbl.tableId);
|
|
1912
|
+
setLoopRowIndex(nextTbl.rowCount > 1 ? 1 : 0);
|
|
1913
|
+
},
|
|
1914
|
+
style: {
|
|
1915
|
+
flex: 1,
|
|
1916
|
+
fontSize: 11.5,
|
|
1917
|
+
padding: "4px 6px",
|
|
1918
|
+
border: "1px solid #e3e5ea",
|
|
1919
|
+
borderRadius: 6,
|
|
1920
|
+
color: "#1b1c1f",
|
|
1921
|
+
background: "#ffffff"
|
|
1922
|
+
},
|
|
1923
|
+
children: tables.map((t, idx) => /* @__PURE__ */ jsxs2("option", { value: t.tableId, children: [
|
|
1924
|
+
"\u8868\u683C #",
|
|
1925
|
+
idx + 1,
|
|
1926
|
+
" (",
|
|
1927
|
+
t.tableId,
|
|
1928
|
+
", ",
|
|
1929
|
+
t.rowCount,
|
|
1930
|
+
"\u884C)"
|
|
1931
|
+
] }, t.tableId))
|
|
1932
|
+
}
|
|
1933
|
+
),
|
|
1934
|
+
/* @__PURE__ */ jsx2(
|
|
1935
|
+
"select",
|
|
1936
|
+
{
|
|
1937
|
+
"data-testid": "yudao-loop-row-select",
|
|
1938
|
+
value: activeLoopRowIdx,
|
|
1939
|
+
onChange: (e) => setLoopRowIndex(Number(e.target.value)),
|
|
1940
|
+
style: {
|
|
1941
|
+
width: 120,
|
|
1942
|
+
fontSize: 11.5,
|
|
1943
|
+
padding: "4px 6px",
|
|
1944
|
+
border: "1px solid #e3e5ea",
|
|
1945
|
+
borderRadius: 6,
|
|
1946
|
+
color: "#1b1c1f",
|
|
1947
|
+
background: "#ffffff"
|
|
1948
|
+
},
|
|
1949
|
+
children: activeLoopTable.rows.map((r) => /* @__PURE__ */ jsxs2("option", { value: r.rowIndex, children: [
|
|
1950
|
+
"\u7B2C ",
|
|
1951
|
+
r.rowIndex + 1,
|
|
1952
|
+
" \u884C (row ",
|
|
1953
|
+
r.rowIndex,
|
|
1954
|
+
")",
|
|
1955
|
+
r.loopConfig ? ` [${r.loopConfig.listKey}]` : ""
|
|
1956
|
+
] }, r.rowIndex))
|
|
1957
|
+
}
|
|
1958
|
+
)
|
|
1959
|
+
] }),
|
|
1960
|
+
/* @__PURE__ */ jsxs2("label", { className: "yudao-doc-field-row", children: [
|
|
1961
|
+
/* @__PURE__ */ jsx2("span", { children: "\u7ED1\u5B9A\u5217\u8868\u6570\u636E\u96C6\u952E (listKey)" }),
|
|
1962
|
+
/* @__PURE__ */ jsx2(
|
|
1963
|
+
"input",
|
|
1964
|
+
{
|
|
1965
|
+
type: "text",
|
|
1966
|
+
"data-testid": "yudao-loop-listkey-input",
|
|
1967
|
+
placeholder: "\u5982 items \u6216 order.items",
|
|
1968
|
+
value: loopListKey,
|
|
1969
|
+
onChange: (e) => setLoopListKey(e.target.value)
|
|
1970
|
+
}
|
|
1971
|
+
)
|
|
1972
|
+
] }),
|
|
1973
|
+
suggestedListKeys.length > 0 && /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 4, flexWrap: "wrap", alignItems: "center" }, children: [
|
|
1974
|
+
/* @__PURE__ */ jsx2("span", { style: { fontSize: 10.5, color: "#7d8698" }, children: "\u5FEB\u6377\u63A8\u8350\uFF1A" }),
|
|
1975
|
+
suggestedListKeys.map((candKey) => /* @__PURE__ */ jsx2(
|
|
1976
|
+
"button",
|
|
1977
|
+
{
|
|
1978
|
+
type: "button",
|
|
1979
|
+
className: `yudao-doc-mini-btn ${loopListKey === candKey ? "is-soft-primary" : ""}`,
|
|
1980
|
+
style: { padding: "1px 6px", fontSize: 10.5 },
|
|
1981
|
+
onClick: () => setLoopListKey(candKey),
|
|
1982
|
+
children: candKey
|
|
1983
|
+
},
|
|
1984
|
+
candKey
|
|
1985
|
+
))
|
|
1986
|
+
] }),
|
|
1987
|
+
/* @__PURE__ */ jsxs2(
|
|
1988
|
+
"label",
|
|
1989
|
+
{
|
|
1990
|
+
style: {
|
|
1991
|
+
display: "flex",
|
|
1992
|
+
alignItems: "center",
|
|
1993
|
+
gap: 6,
|
|
1994
|
+
fontSize: 11.5,
|
|
1995
|
+
color: "#31363f",
|
|
1996
|
+
cursor: "pointer"
|
|
1997
|
+
},
|
|
1998
|
+
children: [
|
|
1999
|
+
/* @__PURE__ */ jsx2(
|
|
2000
|
+
"input",
|
|
2001
|
+
{
|
|
2002
|
+
type: "checkbox",
|
|
2003
|
+
"data-testid": "yudao-loop-repeat-header",
|
|
2004
|
+
checked: loopRepeatHeader,
|
|
2005
|
+
onChange: (e) => setLoopRepeatHeader(e.target.checked)
|
|
2006
|
+
}
|
|
2007
|
+
),
|
|
2008
|
+
/* @__PURE__ */ jsx2("span", { children: "\u91CD\u590D\u8868\u5934 (repeatHeaderRow)" })
|
|
2009
|
+
]
|
|
2010
|
+
}
|
|
2011
|
+
),
|
|
2012
|
+
/* @__PURE__ */ jsxs2("label", { className: "yudao-doc-field-row", children: [
|
|
2013
|
+
/* @__PURE__ */ jsx2("span", { children: "\u7A7A\u6570\u636E\u7B56\u7565 (emptyStrategy)" }),
|
|
2014
|
+
/* @__PURE__ */ jsxs2(
|
|
2015
|
+
"select",
|
|
2016
|
+
{
|
|
2017
|
+
"data-testid": "yudao-loop-empty-strategy",
|
|
2018
|
+
value: loopEmptyStrategy,
|
|
2019
|
+
onChange: (e) => setLoopEmptyStrategy(e.target.value),
|
|
2020
|
+
children: [
|
|
2021
|
+
/* @__PURE__ */ jsx2("option", { value: "keep-blank", children: "\u4FDD\u7559\u7A7A\u884C (keep-blank)" }),
|
|
2022
|
+
/* @__PURE__ */ jsx2("option", { value: "placeholder", children: "\u7A7A\u6570\u636E\u5360\u4F4D\u6587\u672C (placeholder)" }),
|
|
2023
|
+
/* @__PURE__ */ jsx2("option", { value: "remove", children: "\u79FB\u9664\u660E\u7EC6\u884C (remove)" })
|
|
2024
|
+
]
|
|
2025
|
+
}
|
|
2026
|
+
)
|
|
2027
|
+
] }),
|
|
2028
|
+
loopEmptyStrategy === "placeholder" && /* @__PURE__ */ jsxs2("label", { className: "yudao-doc-field-row", children: [
|
|
2029
|
+
/* @__PURE__ */ jsx2("span", { children: "\u7A7A\u6570\u636E\u5360\u4F4D\u6587\u672C (emptyPlaceholderText)" }),
|
|
2030
|
+
/* @__PURE__ */ jsx2(
|
|
2031
|
+
"input",
|
|
2032
|
+
{
|
|
2033
|
+
type: "text",
|
|
2034
|
+
"data-testid": "yudao-loop-empty-placeholder",
|
|
2035
|
+
placeholder: "\u5982 \u6682\u65E0\u660E\u7EC6\u6570\u636E",
|
|
2036
|
+
value: loopEmptyPlaceholder,
|
|
2037
|
+
onChange: (e) => setLoopEmptyPlaceholder(e.target.value)
|
|
2038
|
+
}
|
|
2039
|
+
)
|
|
2040
|
+
] }),
|
|
2041
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 6 }, children: [
|
|
2042
|
+
/* @__PURE__ */ jsx2(
|
|
2043
|
+
"button",
|
|
2044
|
+
{
|
|
2045
|
+
type: "button",
|
|
2046
|
+
"data-testid": "yudao-loop-save-btn",
|
|
2047
|
+
className: "yudao-doc-mini-btn is-primary",
|
|
2048
|
+
style: { flex: 1 },
|
|
2049
|
+
disabled: !loopListKey.trim(),
|
|
2050
|
+
onClick: () => commandService.syncExecuteCommand(SetDocTableRowLoopCommand.id, {
|
|
2051
|
+
unitId: unit.getUnitId(),
|
|
2052
|
+
tableId: activeLoopTable.tableId,
|
|
2053
|
+
rowIndex: activeLoopRowIdx,
|
|
2054
|
+
config: {
|
|
2055
|
+
listKey: loopListKey.trim(),
|
|
2056
|
+
repeatHeaderRow: loopRepeatHeader,
|
|
2057
|
+
emptyStrategy: loopEmptyStrategy,
|
|
2058
|
+
...loopEmptyStrategy === "placeholder" ? { emptyPlaceholderText: loopEmptyPlaceholder || "\u6682\u65E0\u660E\u7EC6\u6570\u636E" } : {}
|
|
2059
|
+
}
|
|
2060
|
+
}),
|
|
2061
|
+
children: existingLoop ? "\u66F4\u65B0\u660E\u7EC6\u5FAA\u73AF\u7ED1\u5B9A" : "\u4FDD\u5B58\u660E\u7EC6\u5FAA\u73AF\u7ED1\u5B9A"
|
|
2062
|
+
}
|
|
2063
|
+
),
|
|
2064
|
+
/* @__PURE__ */ jsx2(
|
|
2065
|
+
"button",
|
|
2066
|
+
{
|
|
2067
|
+
type: "button",
|
|
2068
|
+
"data-testid": "yudao-loop-clear-btn",
|
|
2069
|
+
className: "yudao-doc-mini-btn",
|
|
2070
|
+
disabled: !existingLoop,
|
|
2071
|
+
onClick: () => commandService.syncExecuteCommand(SetDocTableRowLoopCommand.id, {
|
|
2072
|
+
unitId: unit.getUnitId(),
|
|
2073
|
+
tableId: activeLoopTable.tableId,
|
|
2074
|
+
rowIndex: activeLoopRowIdx,
|
|
2075
|
+
config: null
|
|
2076
|
+
}),
|
|
2077
|
+
children: "\u6E05\u9664\u7ED1\u5B9A"
|
|
2078
|
+
}
|
|
2079
|
+
)
|
|
2080
|
+
] }),
|
|
2081
|
+
allBoundLoops.length > 0 && /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: allBoundLoops.map((item) => /* @__PURE__ */ jsxs2(
|
|
2082
|
+
"div",
|
|
2083
|
+
{
|
|
2084
|
+
style: {
|
|
2085
|
+
display: "flex",
|
|
2086
|
+
justifyContent: "space-between",
|
|
2087
|
+
alignItems: "center",
|
|
2088
|
+
fontSize: 10.5,
|
|
2089
|
+
padding: "3px 6px",
|
|
2090
|
+
borderRadius: 5,
|
|
2091
|
+
background: "#f9fafb",
|
|
2092
|
+
border: "1px solid #e3e5ea",
|
|
2093
|
+
color: "#4e5565"
|
|
2094
|
+
},
|
|
2095
|
+
children: [
|
|
2096
|
+
/* @__PURE__ */ jsxs2("span", { children: [
|
|
2097
|
+
/* @__PURE__ */ jsx2("code", { children: item.tableId }),
|
|
2098
|
+
" \u7B2C ",
|
|
2099
|
+
item.rowIndex + 1,
|
|
2100
|
+
" \u884C ->",
|
|
2101
|
+
" ",
|
|
2102
|
+
/* @__PURE__ */ jsx2("code", { children: item.listKey }),
|
|
2103
|
+
" (",
|
|
2104
|
+
item.emptyStrategy || "keep-blank",
|
|
2105
|
+
")"
|
|
2106
|
+
] }),
|
|
2107
|
+
/* @__PURE__ */ jsx2(
|
|
2108
|
+
"button",
|
|
2109
|
+
{
|
|
2110
|
+
type: "button",
|
|
2111
|
+
className: "yudao-doc-mini-btn is-danger",
|
|
2112
|
+
style: { padding: "1px 5px", fontSize: 10 },
|
|
2113
|
+
onClick: () => commandService.syncExecuteCommand(SetDocTableRowLoopCommand.id, {
|
|
2114
|
+
unitId: unit.getUnitId(),
|
|
2115
|
+
tableId: item.tableId,
|
|
2116
|
+
rowIndex: item.rowIndex,
|
|
2117
|
+
config: null
|
|
2118
|
+
}),
|
|
2119
|
+
children: "\u79FB\u9664"
|
|
2120
|
+
}
|
|
2121
|
+
)
|
|
2122
|
+
]
|
|
2123
|
+
},
|
|
2124
|
+
`${item.tableId}:${item.rowIndex}`
|
|
2125
|
+
)) })
|
|
2126
|
+
] });
|
|
2127
|
+
})(),
|
|
1823
2128
|
features.paragraphAdvancedLayout && /* @__PURE__ */ jsxs2("div", { className: "yudao-doc-section", children: [
|
|
1824
2129
|
/* @__PURE__ */ jsx2("div", { className: "yudao-doc-section-title", children: /* @__PURE__ */ jsx2("span", { children: "\u6BB5\u843D\u5206\u9875\u63A7\u5236\u4E0E\u5236\u8868\u4F4D\u524D\u5BFC\u7B26" }) }),
|
|
1825
2130
|
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
@@ -4640,9 +4945,11 @@ import {
|
|
|
4640
4945
|
import { useDependency as useDependency3, useObservable as useObservable3 } from "@univerjs/ui";
|
|
4641
4946
|
import {
|
|
4642
4947
|
autoCropCanvasToPngDataUrl,
|
|
4948
|
+
DOC_IO_CAPABILITY_FORMATS,
|
|
4643
4949
|
exportBatchDocPdfBytes,
|
|
4644
4950
|
exportDocHtmlString,
|
|
4645
4951
|
FillDocDatasetCommand as FillDocDatasetCommand2,
|
|
4952
|
+
getDocumentStats as getDocumentStats2,
|
|
4646
4953
|
IDocIoService as IDocIoService3,
|
|
4647
4954
|
IDocSdtService as IDocSdtService4,
|
|
4648
4955
|
inspectDocxExportCapabilities,
|
|
@@ -4657,6 +4964,13 @@ var MODAL_PEN_COLORS = [
|
|
|
4657
4964
|
{ hex: "#2C53F1", label: "\u7B7E\u5B57\u84DD" },
|
|
4658
4965
|
{ hex: "#DC2626", label: "\u6731\u7802\u7EA2" }
|
|
4659
4966
|
];
|
|
4967
|
+
function inferExtFromFileName(fileName) {
|
|
4968
|
+
const m = fileName.trim().toLowerCase().match(/\.([^.]+)$/);
|
|
4969
|
+
if (!m) return "docx";
|
|
4970
|
+
if (m[1] === "markdown") return "md";
|
|
4971
|
+
if (m[1] === "htm") return "html";
|
|
4972
|
+
return m[1];
|
|
4973
|
+
}
|
|
4660
4974
|
function repaintModalSignatureCanvas(canvas, strokes) {
|
|
4661
4975
|
const ctx = canvas?.getContext("2d");
|
|
4662
4976
|
if (!canvas || !ctx) return;
|
|
@@ -4708,8 +5022,12 @@ var DocPreviewAndIoModal = () => {
|
|
|
4708
5022
|
const [sigPenColor, setSigPenColor] = useState3("#1B1C1F");
|
|
4709
5023
|
const [isDrawingSig, setIsDrawingSig] = useState3(false);
|
|
4710
5024
|
const [ioTarget, setIoTarget] = useState3("browser");
|
|
5025
|
+
const [exportFormat, setExportFormat] = useState3("docx");
|
|
4711
5026
|
const [skipDatasetOnExport, setSkipDatasetOnExport] = useState3(false);
|
|
4712
|
-
const [
|
|
5027
|
+
const [selectedImportFile, setSelectedImportFile] = useState3(null);
|
|
5028
|
+
const [pendingImport, setPendingImport] = useState3(null);
|
|
5029
|
+
const [ioError, setIoError] = useState3(null);
|
|
5030
|
+
const fileInputRef = useRef(null);
|
|
4713
5031
|
const sigCanvasRef = useRef(null);
|
|
4714
5032
|
const iframeRef = useRef(null);
|
|
4715
5033
|
useEffect3(() => {
|
|
@@ -4725,8 +5043,13 @@ var DocPreviewAndIoModal = () => {
|
|
|
4725
5043
|
})
|
|
4726
5044
|
);
|
|
4727
5045
|
setJsonEditorText(JSON.stringify(snap, null, 2));
|
|
4728
|
-
|
|
4729
|
-
|
|
5046
|
+
const caps = ioService.getIoCapabilities();
|
|
5047
|
+
const activeOp = tab === "import" ? "import" : "export";
|
|
5048
|
+
const activeFmt = tab === "import" ? "docx" : exportFormat;
|
|
5049
|
+
const resolvedDefault = caps.defaultIoTarget === "browser" ? "browser" : caps.defaultIoTarget === "server" ? "server" : caps.formats[activeOp]?.[activeFmt]?.defaultTarget ?? caps.recommendedDefaultTarget;
|
|
5050
|
+
setIoTarget(resolvedDefault);
|
|
5051
|
+
setPendingImport(null);
|
|
5052
|
+
setIoError(null);
|
|
4730
5053
|
setStatusTip("");
|
|
4731
5054
|
}, [open, unit, features.datasetBinding, sdtService, ioService, ioAdapter]);
|
|
4732
5055
|
if (!open || !unit || !features.builtinPreviewModal) return null;
|
|
@@ -4738,6 +5061,14 @@ var DocPreviewAndIoModal = () => {
|
|
|
4738
5061
|
const isCustomBackendAdapter = Boolean(
|
|
4739
5062
|
ioAdapter.exportDoc || ioAdapter.importDoc || ioAdapter.onSave
|
|
4740
5063
|
);
|
|
5064
|
+
const activeCapabilityOp = tab === "import" ? "import" : "export";
|
|
5065
|
+
const activeFormatMatrix = ioCaps.formats[activeCapabilityOp];
|
|
5066
|
+
const browserSupportedFormats = DOC_IO_CAPABILITY_FORMATS.filter(
|
|
5067
|
+
(fmt) => activeFormatMatrix[fmt]?.browser
|
|
5068
|
+
);
|
|
5069
|
+
const serverSupportedFormats = DOC_IO_CAPABILITY_FORMATS.filter(
|
|
5070
|
+
(fmt) => activeFormatMatrix[fmt]?.server
|
|
5071
|
+
);
|
|
4741
5072
|
const refreshHtmlPreview = (overrides) => {
|
|
4742
5073
|
try {
|
|
4743
5074
|
const parsedRaw = features.datasetBinding ? JSON.parse(datasetText) : void 0;
|
|
@@ -4771,7 +5102,29 @@ var DocPreviewAndIoModal = () => {
|
|
|
4771
5102
|
setStatusTip(`\u586B\u5145\u5931\u8D25: ${err?.message || String(err)}`);
|
|
4772
5103
|
}
|
|
4773
5104
|
};
|
|
4774
|
-
const
|
|
5105
|
+
const triggerBlobDownload = (bytes, mime, downloadName) => {
|
|
5106
|
+
if (typeof document !== "undefined" && typeof URL !== "undefined" && typeof URL.createObjectURL === "function") {
|
|
5107
|
+
const ab = bytes.buffer.slice(
|
|
5108
|
+
bytes.byteOffset,
|
|
5109
|
+
bytes.byteOffset + bytes.byteLength
|
|
5110
|
+
);
|
|
5111
|
+
const blob = new Blob([ab], { type: mime });
|
|
5112
|
+
const url = URL.createObjectURL(blob);
|
|
5113
|
+
const a = document.createElement("a");
|
|
5114
|
+
a.href = url;
|
|
5115
|
+
a.download = downloadName;
|
|
5116
|
+
a.click();
|
|
5117
|
+
setTimeout(() => {
|
|
5118
|
+
try {
|
|
5119
|
+
URL.revokeObjectURL(url);
|
|
5120
|
+
} catch {
|
|
5121
|
+
}
|
|
5122
|
+
}, 1e3);
|
|
5123
|
+
}
|
|
5124
|
+
};
|
|
5125
|
+
const runExport = async (format, targetOverride) => {
|
|
5126
|
+
const activeTarget = targetOverride ?? ioTarget;
|
|
5127
|
+
setIoError(null);
|
|
4775
5128
|
try {
|
|
4776
5129
|
const parsedRaw = features.datasetBinding && !skipDatasetOnExport ? JSON.parse(datasetText) : void 0;
|
|
4777
5130
|
const parsedData = Array.isArray(parsedRaw) ? parsedRaw[0] : parsedRaw;
|
|
@@ -4788,21 +5141,21 @@ var DocPreviewAndIoModal = () => {
|
|
|
4788
5141
|
showLineNumbers,
|
|
4789
5142
|
printFieldsOnly
|
|
4790
5143
|
} : void 0,
|
|
4791
|
-
target:
|
|
5144
|
+
target: activeTarget
|
|
4792
5145
|
});
|
|
4793
|
-
const mime = format === "docx" ? "application/vnd.openxmlformats-officedocument.wordprocessingml.document" : format === "pdf" ? "application/pdf" : format === "rtf" ? "application/rtf" : format === "odt" ? "application/vnd.oasis.opendocument.text" : format === "md" ? "text/markdown;charset=utf-8" : "text/html;charset=utf-8";
|
|
4794
|
-
|
|
4795
|
-
const
|
|
4796
|
-
const a = document.createElement("a");
|
|
4797
|
-
a.href = url;
|
|
4798
|
-
a.download = `${snapshot.title || "document"}.${format}`;
|
|
4799
|
-
a.click();
|
|
4800
|
-
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
4801
|
-
const channelLabel = ioTarget === "server" ? `\u670D\u52A1\u7AEF (${ioAdapter.name})` : "\u6D4F\u89C8\u5668\u672C\u5730\u5F15\u64CE";
|
|
5146
|
+
const mime = format === "docx" ? "application/vnd.openxmlformats-officedocument.wordprocessingml.document" : format === "pdf" ? "application/pdf" : format === "rtf" || format === "doc" ? "application/rtf" : format === "odt" ? "application/vnd.oasis.opendocument.text" : format === "md" ? "text/markdown;charset=utf-8" : format === "txt" ? "text/plain;charset=utf-8" : format === "json" ? "application/json;charset=utf-8" : "text/html;charset=utf-8";
|
|
5147
|
+
triggerBlobDownload(bytes, mime, `${snapshot.title || "document"}.${format}`);
|
|
5148
|
+
const channelLabel = activeTarget === "server" ? `\u670D\u52A1\u7AEF\u5904\u7406 (${ioAdapter.name})` : "\u6D4F\u89C8\u5668\u5904\u7406";
|
|
4802
5149
|
setStatusTip(`\u5DF2\u901A\u8FC7 ${channelLabel} \u5BFC\u51FA .${format} \u6587\u4EF6`);
|
|
4803
5150
|
} catch (err) {
|
|
4804
|
-
const
|
|
4805
|
-
|
|
5151
|
+
const message = err?.message || String(err);
|
|
5152
|
+
setIoError({
|
|
5153
|
+
operation: "export",
|
|
5154
|
+
failedTarget: activeTarget,
|
|
5155
|
+
message,
|
|
5156
|
+
exportFormat: format
|
|
5157
|
+
});
|
|
5158
|
+
setStatusTip(`\u5BFC\u51FA\u5931\u8D25: ${message}`);
|
|
4806
5159
|
}
|
|
4807
5160
|
};
|
|
4808
5161
|
const handleBatchExportPdf = () => {
|
|
@@ -4826,49 +5179,93 @@ var DocPreviewAndIoModal = () => {
|
|
|
4826
5179
|
showLineNumbers,
|
|
4827
5180
|
printFieldsOnly
|
|
4828
5181
|
});
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
a.click();
|
|
4835
|
-
setTimeout(() => URL.revokeObjectURL(url), 1e3);
|
|
5182
|
+
triggerBlobDownload(
|
|
5183
|
+
pdfBytes,
|
|
5184
|
+
"application/pdf",
|
|
5185
|
+
`${snapshot.title || "document"}_batch_${records.length}.pdf`
|
|
5186
|
+
);
|
|
4836
5187
|
setStatusTip(`\u5DF2\u6279\u91CF\u5957\u6253\u5408\u5E76\u5BFC\u51FA ${records.length} \u4EFD\u8BB0\u5F55\u4E3A\u5355\u4EFD\u8FDE\u7EED PDF`);
|
|
4837
5188
|
} catch (err) {
|
|
4838
5189
|
setStatusTip(`\u6279\u91CF\u5408\u5E76\u5BFC\u51FA PDF \u5931\u8D25: ${err?.message || String(err)}`);
|
|
4839
5190
|
}
|
|
4840
5191
|
};
|
|
4841
|
-
const
|
|
4842
|
-
const
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
setJsonEditorText(JSON.stringify(unit.getSnapshot(), null, 2));
|
|
4862
|
-
setPreviewHtml(exportDocHtmlString(unit.getSnapshot(), void 0, { printFieldsOnly }));
|
|
4863
|
-
setStatusTip(
|
|
4864
|
-
`\u5DF2\u901A\u8FC7 ${outcome.executedBy === "server" ? "\u670D\u52A1\u7AEF\u5904\u7406" : "\u6D4F\u89C8\u5668\u5904\u7406"} \u5BFC\u5165\u300C${file.name}\u300D\uFF08\u672A\u843D\u5E93\uFF0C\u70B9\u4FDD\u5B58\u751F\u6548\uFF09`
|
|
5192
|
+
const runImportFile = async (file, targetOverride) => {
|
|
5193
|
+
const activeTarget = targetOverride ?? ioTarget;
|
|
5194
|
+
setSelectedImportFile(file);
|
|
5195
|
+
setIoError(null);
|
|
5196
|
+
setPendingImport(null);
|
|
5197
|
+
try {
|
|
5198
|
+
const outcome = await ioService.importDocWithReport(file, {
|
|
5199
|
+
unitId: unit.getUnitId(),
|
|
5200
|
+
target: activeTarget
|
|
5201
|
+
});
|
|
5202
|
+
const stagedSnap = outcome.snapshot ?? outcome.documentData;
|
|
5203
|
+
setPendingImport({
|
|
5204
|
+
snapshot: stagedSnap,
|
|
5205
|
+
warnings: outcome.warnings,
|
|
5206
|
+
executedBy: outcome.executedBy,
|
|
5207
|
+
fileName: outcome.fileName || file.name
|
|
5208
|
+
});
|
|
5209
|
+
if (stagedSnap.body) {
|
|
5210
|
+
setPreviewHtml(
|
|
5211
|
+
exportDocHtmlString(stagedSnap, void 0, { printFieldsOnly })
|
|
4865
5212
|
);
|
|
4866
|
-
} catch (err) {
|
|
4867
|
-
const hint = err?.suggestedFallback === "server" ? "\uFF08\u672A\u9759\u9ED8\u964D\u7EA7\uFF0C\u5EFA\u8BAE\u6539\u9009\u300C\u670D\u52A1\u7AEF\u5904\u7406\u300D\u91CD\u8BD5\uFF09" : "";
|
|
4868
|
-
setStatusTip(`\u5BFC\u5165\u5931\u8D25: ${err?.message || String(err)}${hint}`);
|
|
4869
5213
|
}
|
|
4870
|
-
|
|
4871
|
-
|
|
5214
|
+
setStatusTip(
|
|
5215
|
+
`\u5DF2\u5B8C\u6210\u300C${outcome.fileName || file.name}\u300D\u9884\u89E3\u6790\uFF08\u5C1A\u672A\u8986\u76D6\u5F53\u524D\u8BBE\u8BA1\u5668\u6587\u6863\uFF0C\u8BF7\u786E\u8BA4\u540E\u5E94\u7528\uFF09`
|
|
5216
|
+
);
|
|
5217
|
+
} catch (err) {
|
|
5218
|
+
const message = err?.message || String(err);
|
|
5219
|
+
setIoError({
|
|
5220
|
+
operation: "import",
|
|
5221
|
+
failedTarget: activeTarget,
|
|
5222
|
+
message
|
|
5223
|
+
});
|
|
5224
|
+
setStatusTip(`\u5BFC\u5165\u5931\u8D25: ${message}`);
|
|
5225
|
+
}
|
|
5226
|
+
};
|
|
5227
|
+
const handleFileInputChange = (e) => {
|
|
5228
|
+
const file = e.target.files?.[0];
|
|
5229
|
+
if (!file) return;
|
|
5230
|
+
if (ioCaps.defaultIoTarget === "auto") {
|
|
5231
|
+
const ext = inferExtFromFileName(file.name);
|
|
5232
|
+
const fmtDef = ioCaps.formats.import[ext]?.defaultTarget;
|
|
5233
|
+
if (fmtDef && fmtDef !== ioTarget) {
|
|
5234
|
+
setIoTarget(fmtDef);
|
|
5235
|
+
void runImportFile(file, fmtDef);
|
|
5236
|
+
return;
|
|
5237
|
+
}
|
|
5238
|
+
}
|
|
5239
|
+
void runImportFile(file, ioTarget);
|
|
5240
|
+
};
|
|
5241
|
+
const handleConfirmStagedImport = () => {
|
|
5242
|
+
if (!pendingImport) return;
|
|
5243
|
+
if (pendingImport.snapshot.body) {
|
|
5244
|
+
commandService.syncExecuteCommand(ReplaceDocUnitSnapshotCommand3.id, {
|
|
5245
|
+
unitId: unit.getUnitId(),
|
|
5246
|
+
snapshot: pendingImport.snapshot
|
|
5247
|
+
});
|
|
5248
|
+
}
|
|
5249
|
+
setPendingImport(null);
|
|
5250
|
+
setJsonEditorText(JSON.stringify(unit.getSnapshot(), null, 2));
|
|
5251
|
+
setPreviewHtml(exportDocHtmlString(unit.getSnapshot(), void 0, { printFieldsOnly }));
|
|
5252
|
+
setStatusTip("\u5DF2\u5E94\u7528\u5230\u5F53\u524D\u8BBE\u8BA1\u5668\uFF0C\u8BF7\u7531\u5BBF\u4E3B\u4FDD\u5B58");
|
|
5253
|
+
};
|
|
5254
|
+
const handleCancelStagedImport = () => {
|
|
5255
|
+
setPendingImport(null);
|
|
5256
|
+
setPreviewHtml(exportDocHtmlString(unit.getSnapshot(), void 0, { printFieldsOnly }));
|
|
5257
|
+
setStatusTip("\u5DF2\u53D6\u6D88\u672C\u6B21\u5BFC\u5165\uFF0C\u5F53\u524D\u8BBE\u8BA1\u5668\u6587\u6863\u672A\u505A\u4FEE\u6539");
|
|
5258
|
+
};
|
|
5259
|
+
const handleSwitchTargetAndRetry = () => {
|
|
5260
|
+
if (!ioError) return;
|
|
5261
|
+
const nextTarget = ioError.failedTarget === "browser" ? "server" : "browser";
|
|
5262
|
+
setIoTarget(nextTarget);
|
|
5263
|
+
setIoError(null);
|
|
5264
|
+
if (ioError.operation === "import" && selectedImportFile) {
|
|
5265
|
+
void runImportFile(selectedImportFile, nextTarget);
|
|
5266
|
+
} else if (ioError.operation === "export") {
|
|
5267
|
+
void runExport(ioError.exportFormat ?? exportFormat, nextTarget);
|
|
5268
|
+
}
|
|
4872
5269
|
};
|
|
4873
5270
|
const handleSaveToHost = async () => {
|
|
4874
5271
|
try {
|
|
@@ -4883,637 +5280,838 @@ var DocPreviewAndIoModal = () => {
|
|
|
4883
5280
|
setStatusTip(`\u4FDD\u5B58\u5931\u8D25: ${err?.message || String(err)}`);
|
|
4884
5281
|
}
|
|
4885
5282
|
};
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
5283
|
+
const stagedStats = pendingImport?.snapshot?.body ? getDocumentStats2(pendingImport.snapshot) : null;
|
|
5284
|
+
const renderIoControlCard = () => /* @__PURE__ */ jsxs4(
|
|
5285
|
+
"div",
|
|
5286
|
+
{
|
|
5287
|
+
style: {
|
|
5288
|
+
padding: "8px 10px",
|
|
5289
|
+
background: "#ffffff",
|
|
5290
|
+
border: "1px solid #e3e5ea",
|
|
5291
|
+
borderRadius: 8,
|
|
5292
|
+
display: "flex",
|
|
5293
|
+
flexDirection: "column",
|
|
5294
|
+
gap: 6
|
|
5295
|
+
},
|
|
5296
|
+
children: [
|
|
5297
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5 }, children: [
|
|
5298
|
+
/* @__PURE__ */ jsxs4("span", { style: { fontWeight: 600, color: "#1b1c1f" }, children: [
|
|
5299
|
+
"\u5BFC\u5165/\u5BFC\u51FA\u5904\u7406\u901A\u9053\uFF08\u9ED8\u8BA4: ",
|
|
5300
|
+
ioCaps.defaultIoTarget,
|
|
5301
|
+
"\uFF09"
|
|
5302
|
+
] }),
|
|
5303
|
+
/* @__PURE__ */ jsxs4("span", { style: { fontSize: 10.5, color: "#7d8698" }, children: [
|
|
5304
|
+
"\u5FEB\u7167 ",
|
|
5305
|
+
snapSizeKb,
|
|
5306
|
+
" KB"
|
|
5307
|
+
] })
|
|
5308
|
+
] }),
|
|
5309
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
|
|
5310
|
+
/* @__PURE__ */ jsxs4(
|
|
5311
|
+
"button",
|
|
5312
|
+
{
|
|
5313
|
+
type: "button",
|
|
5314
|
+
"data-testid": "yudao-io-target-browser",
|
|
5315
|
+
className: `yudao-doc-segmented-btn ${ioTarget === "browser" ? "is-active" : ""}`,
|
|
5316
|
+
style: {
|
|
5317
|
+
display: "flex",
|
|
5318
|
+
flexDirection: "column",
|
|
5319
|
+
alignItems: "flex-start",
|
|
5320
|
+
gap: 3,
|
|
5321
|
+
padding: "6px 8px",
|
|
5322
|
+
border: `1px solid ${ioTarget === "browser" ? "#2c53f1" : "#e3e5ea"}`,
|
|
5323
|
+
borderRadius: 6,
|
|
5324
|
+
background: ioTarget === "browser" ? "#f3f5ff" : "#f9fafb",
|
|
5325
|
+
textAlign: "left"
|
|
5326
|
+
},
|
|
5327
|
+
onClick: () => setIoTarget("browser"),
|
|
5328
|
+
children: [
|
|
5329
|
+
/* @__PURE__ */ jsx4("span", { style: { fontWeight: 600, fontSize: 11.5, color: "#1b1c1f" }, children: "\u6D4F\u89C8\u5668\u5904\u7406" }),
|
|
5330
|
+
/* @__PURE__ */ jsx4("span", { style: { fontSize: 9.5, color: "#4e5565", lineHeight: 1.3 }, children: browserSupportedFormats.length > 0 ? browserSupportedFormats.join(" / ") : "\u672A\u542F\u7528\u672C\u5730\u683C\u5F0F" })
|
|
5331
|
+
]
|
|
5332
|
+
}
|
|
5333
|
+
),
|
|
5334
|
+
/* @__PURE__ */ jsxs4(
|
|
5335
|
+
"button",
|
|
5336
|
+
{
|
|
5337
|
+
type: "button",
|
|
5338
|
+
"data-testid": "yudao-io-target-server",
|
|
5339
|
+
className: `yudao-doc-segmented-btn ${ioTarget === "server" ? "is-active" : ""}`,
|
|
5340
|
+
style: {
|
|
5341
|
+
display: "flex",
|
|
5342
|
+
flexDirection: "column",
|
|
5343
|
+
alignItems: "flex-start",
|
|
5344
|
+
gap: 3,
|
|
5345
|
+
padding: "6px 8px",
|
|
5346
|
+
border: `1px solid ${ioTarget === "server" ? "#2c53f1" : "#e3e5ea"}`,
|
|
5347
|
+
borderRadius: 6,
|
|
5348
|
+
background: ioTarget === "server" ? "#f3f5ff" : "#f9fafb",
|
|
5349
|
+
textAlign: "left"
|
|
5350
|
+
},
|
|
5351
|
+
onClick: () => setIoTarget("server"),
|
|
5352
|
+
children: [
|
|
5353
|
+
/* @__PURE__ */ jsx4("span", { style: { fontWeight: 600, fontSize: 11.5, color: "#1b1c1f" }, children: "\u670D\u52A1\u7AEF\u5904\u7406" }),
|
|
5354
|
+
/* @__PURE__ */ jsx4("span", { style: { fontSize: 9.5, color: "#4e5565", lineHeight: 1.3 }, children: serverSupportedFormats.length > 0 ? serverSupportedFormats.join(" / ") : "\u672A\u63A5\u5165" })
|
|
5355
|
+
]
|
|
5356
|
+
}
|
|
5357
|
+
)
|
|
5358
|
+
] }),
|
|
4889
5359
|
/* @__PURE__ */ jsx4(
|
|
4890
|
-
"
|
|
4891
|
-
{
|
|
4892
|
-
type: "button",
|
|
4893
|
-
className: `yudao-doc-modal-tab ${tab === "preview" ? "is-active" : ""}`,
|
|
4894
|
-
onClick: () => featureService.setModalTab("preview"),
|
|
4895
|
-
children: "\u5957\u6253\u9884\u89C8\u4E0E\u5BFC\u51FA"
|
|
4896
|
-
}
|
|
4897
|
-
),
|
|
4898
|
-
features.sdtControls && /* @__PURE__ */ jsx4(
|
|
4899
|
-
"button",
|
|
5360
|
+
"input",
|
|
4900
5361
|
{
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
5362
|
+
ref: fileInputRef,
|
|
5363
|
+
type: "file",
|
|
5364
|
+
"data-testid": "yudao-io-file-input",
|
|
5365
|
+
accept: DOC_IMPORT_ACCEPT_EXTENSIONS,
|
|
5366
|
+
style: { display: "none" },
|
|
5367
|
+
onChange: handleFileInputChange
|
|
4905
5368
|
}
|
|
4906
5369
|
),
|
|
4907
|
-
/* @__PURE__ */
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
5370
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
|
|
5371
|
+
/* @__PURE__ */ jsx4(
|
|
5372
|
+
"button",
|
|
5373
|
+
{
|
|
5374
|
+
type: "button",
|
|
5375
|
+
"data-testid": "yudao-io-pick-file",
|
|
5376
|
+
className: "yudao-doc-mini-btn",
|
|
5377
|
+
style: { flex: 1 },
|
|
5378
|
+
onClick: () => {
|
|
5379
|
+
if (fileInputRef.current) {
|
|
5380
|
+
fileInputRef.current.value = "";
|
|
5381
|
+
fileInputRef.current.click();
|
|
5382
|
+
}
|
|
5383
|
+
},
|
|
5384
|
+
children: "\u9009\u62E9\u6587\u4EF6\u9884\u5BFC\u5165"
|
|
5385
|
+
}
|
|
5386
|
+
),
|
|
5387
|
+
selectedImportFile && !pendingImport && /* @__PURE__ */ jsx4(
|
|
5388
|
+
"span",
|
|
5389
|
+
{
|
|
5390
|
+
style: {
|
|
5391
|
+
fontSize: 10.5,
|
|
5392
|
+
color: "#4e5565",
|
|
5393
|
+
maxWidth: 130,
|
|
5394
|
+
overflow: "hidden",
|
|
5395
|
+
textOverflow: "ellipsis",
|
|
5396
|
+
whiteSpace: "nowrap"
|
|
5397
|
+
},
|
|
5398
|
+
title: selectedImportFile.name,
|
|
5399
|
+
children: selectedImportFile.name
|
|
5400
|
+
}
|
|
5401
|
+
)
|
|
5402
|
+
] }),
|
|
5403
|
+
pendingImport && /* @__PURE__ */ jsxs4(
|
|
5404
|
+
"div",
|
|
5405
|
+
{
|
|
5406
|
+
"data-testid": "yudao-io-staged-result",
|
|
5407
|
+
style: {
|
|
5408
|
+
padding: "8px",
|
|
5409
|
+
borderRadius: 6,
|
|
5410
|
+
background: "#f3f5ff",
|
|
5411
|
+
border: "1px solid #d2dafa",
|
|
5412
|
+
display: "flex",
|
|
5413
|
+
flexDirection: "column",
|
|
5414
|
+
gap: 6,
|
|
4922
5415
|
fontSize: 11,
|
|
4923
|
-
|
|
4924
|
-
borderRadius: 999,
|
|
4925
|
-
background: isCustomBackendAdapter ? "#f3f5ff" : "#eeeff1",
|
|
4926
|
-
color: isCustomBackendAdapter ? "#2c53f1" : "#4e5565",
|
|
4927
|
-
border: `1px solid ${isCustomBackendAdapter ? "#d2dafa" : "#e3e5ea"}`,
|
|
4928
|
-
fontWeight: 500
|
|
5416
|
+
color: "#1b1c1f"
|
|
4929
5417
|
},
|
|
4930
5418
|
children: [
|
|
4931
|
-
"
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
background: "#f9fafb"
|
|
4959
|
-
},
|
|
4960
|
-
children: [
|
|
4961
|
-
features.datasetBinding ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
4962
|
-
/* @__PURE__ */ jsx4("div", { style: { fontSize: 12, fontWeight: 600, color: "#1b1c1f" }, children: "\u4E1A\u52A1\u6570\u636E\u96C6 JSON\uFF08\u652F\u6301\u5355\u6761\u5BF9\u8C61\u6216\u6279\u91CF\u6570\u7EC4 [...]\uFF09" }),
|
|
5419
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", gap: 6 }, children: [
|
|
5420
|
+
/* @__PURE__ */ jsx4("strong", { style: { wordBreak: "break-all" }, children: pendingImport.fileName }),
|
|
5421
|
+
/* @__PURE__ */ jsx4(
|
|
5422
|
+
"span",
|
|
5423
|
+
{
|
|
5424
|
+
style: {
|
|
5425
|
+
fontSize: 10,
|
|
5426
|
+
padding: "1px 6px",
|
|
5427
|
+
borderRadius: 999,
|
|
5428
|
+
background: "#ffffff",
|
|
5429
|
+
border: "1px solid #d2dafa",
|
|
5430
|
+
color: "#2c53f1",
|
|
5431
|
+
flexShrink: 0
|
|
5432
|
+
},
|
|
5433
|
+
children: pendingImport.executedBy === "server" ? "\u670D\u52A1\u7AEF\u5904\u7406" : "\u6D4F\u89C8\u5668\u5904\u7406"
|
|
5434
|
+
}
|
|
5435
|
+
)
|
|
5436
|
+
] }),
|
|
5437
|
+
stagedStats && /* @__PURE__ */ jsxs4("div", { style: { fontSize: 10.5, color: "#4e5565" }, children: [
|
|
5438
|
+
"\u6BB5\u843D ",
|
|
5439
|
+
stagedStats.paragraphCount,
|
|
5440
|
+
" \xB7 \u8868\u683C ",
|
|
5441
|
+
stagedStats.tableCount,
|
|
5442
|
+
" \xB7 \u63A7\u4EF6",
|
|
5443
|
+
" ",
|
|
5444
|
+
stagedStats.sdtTotalCount
|
|
5445
|
+
] }),
|
|
4963
5446
|
/* @__PURE__ */ jsx4(
|
|
4964
|
-
"
|
|
5447
|
+
"ul",
|
|
4965
5448
|
{
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
5449
|
+
"data-testid": "yudao-io-warnings",
|
|
5450
|
+
style: {
|
|
5451
|
+
margin: 0,
|
|
5452
|
+
paddingLeft: pendingImport.warnings.length > 0 ? 16 : 0,
|
|
5453
|
+
listStyle: pendingImport.warnings.length > 0 ? "disc" : "none",
|
|
5454
|
+
fontSize: 10.5,
|
|
5455
|
+
color: "#4e5565"
|
|
5456
|
+
},
|
|
5457
|
+
children: pendingImport.warnings.length === 0 ? /* @__PURE__ */ jsx4("li", { children: "\u65E0\u683C\u5F0F\u964D\u7EA7\u544A\u8B66" }) : pendingImport.warnings.map((w, idx) => /* @__PURE__ */ jsx4("li", { children: w.message }, `${w.code}-${idx}`))
|
|
4969
5458
|
}
|
|
4970
5459
|
),
|
|
4971
|
-
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 6
|
|
4972
|
-
/* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-doc-mini-btn", onClick: () => refreshHtmlPreview(), children: "\u5237\u65B0\u53F3\u4FA7\u9884\u89C8" }),
|
|
5460
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 6 }, children: [
|
|
4973
5461
|
/* @__PURE__ */ jsx4(
|
|
4974
5462
|
"button",
|
|
4975
5463
|
{
|
|
4976
5464
|
type: "button",
|
|
5465
|
+
"data-testid": "yudao-io-confirm-import",
|
|
5466
|
+
className: "yudao-doc-mini-btn is-primary",
|
|
5467
|
+
style: { flex: 1 },
|
|
5468
|
+
onClick: handleConfirmStagedImport,
|
|
5469
|
+
children: "\u786E\u8BA4\u5E94\u7528\u5230\u8BBE\u8BA1\u5668"
|
|
5470
|
+
}
|
|
5471
|
+
),
|
|
5472
|
+
/* @__PURE__ */ jsx4(
|
|
5473
|
+
"button",
|
|
5474
|
+
{
|
|
5475
|
+
type: "button",
|
|
5476
|
+
"data-testid": "yudao-io-cancel-import",
|
|
4977
5477
|
className: "yudao-doc-mini-btn",
|
|
4978
|
-
onClick:
|
|
4979
|
-
children: "\
|
|
5478
|
+
onClick: handleCancelStagedImport,
|
|
5479
|
+
children: "\u53D6\u6D88\u672C\u6B21\u5BFC\u5165"
|
|
4980
5480
|
}
|
|
4981
5481
|
)
|
|
4982
5482
|
] })
|
|
4983
|
-
]
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
border: "1px solid #e3e5ea",
|
|
5004
|
-
borderRadius: 6,
|
|
5005
|
-
padding: "5px 8px",
|
|
5006
|
-
fontSize: 11.5,
|
|
5007
|
-
color: "#1b1c1f",
|
|
5008
|
-
background: "#ffffff"
|
|
5009
|
-
}
|
|
5010
|
-
}
|
|
5011
|
-
),
|
|
5012
|
-
/* @__PURE__ */ jsx4(
|
|
5013
|
-
"input",
|
|
5014
|
-
{
|
|
5015
|
-
type: "text",
|
|
5016
|
-
placeholder: "\u9632\u4F2A\u659C\u5411\u5E73\u94FA\u6C34\u5370\uFF08\u5982\uFF1A\u5185\u90E8\u673A\u5BC6\uFF09",
|
|
5017
|
-
value: watermarkText,
|
|
5018
|
-
onChange: (e) => {
|
|
5019
|
-
setWatermarkText(e.target.value);
|
|
5020
|
-
refreshHtmlPreview({ wm: e.target.value });
|
|
5021
|
-
},
|
|
5022
|
-
style: {
|
|
5023
|
-
border: "1px solid #e3e5ea",
|
|
5024
|
-
borderRadius: 6,
|
|
5025
|
-
padding: "5px 8px",
|
|
5026
|
-
fontSize: 11.5,
|
|
5027
|
-
color: "#1b1c1f",
|
|
5028
|
-
background: "#ffffff"
|
|
5029
|
-
}
|
|
5030
|
-
}
|
|
5031
|
-
),
|
|
5483
|
+
]
|
|
5484
|
+
}
|
|
5485
|
+
),
|
|
5486
|
+
ioError && /* @__PURE__ */ jsxs4(
|
|
5487
|
+
"div",
|
|
5488
|
+
{
|
|
5489
|
+
"data-testid": "yudao-io-error-banner",
|
|
5490
|
+
style: {
|
|
5491
|
+
padding: "7px 8px",
|
|
5492
|
+
borderRadius: 6,
|
|
5493
|
+
background: "#fef2f2",
|
|
5494
|
+
border: "1px solid #fecaca",
|
|
5495
|
+
color: "#b91c1c",
|
|
5496
|
+
fontSize: 11,
|
|
5497
|
+
display: "flex",
|
|
5498
|
+
flexDirection: "column",
|
|
5499
|
+
gap: 6
|
|
5500
|
+
},
|
|
5501
|
+
children: [
|
|
5502
|
+
/* @__PURE__ */ jsx4("div", { style: { lineHeight: 1.4 }, children: ioError.message }),
|
|
5032
5503
|
/* @__PURE__ */ jsx4(
|
|
5033
|
-
"
|
|
5504
|
+
"button",
|
|
5034
5505
|
{
|
|
5035
|
-
type: "
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
refreshHtmlPreview({ seal: e.target.value });
|
|
5041
|
-
},
|
|
5042
|
-
style: {
|
|
5043
|
-
border: "1px solid #e3e5ea",
|
|
5044
|
-
borderRadius: 6,
|
|
5045
|
-
padding: "5px 8px",
|
|
5046
|
-
fontSize: 11.5,
|
|
5047
|
-
color: "#1b1c1f",
|
|
5048
|
-
background: "#ffffff"
|
|
5049
|
-
}
|
|
5506
|
+
type: "button",
|
|
5507
|
+
"data-testid": "yudao-io-switch-retry",
|
|
5508
|
+
className: "yudao-doc-mini-btn",
|
|
5509
|
+
onClick: handleSwitchTargetAndRetry,
|
|
5510
|
+
children: `\u5207\u6362\u4E3A\u300C${ioError.failedTarget === "browser" ? "\u670D\u52A1\u7AEF\u5904\u7406" : "\u6D4F\u89C8\u5668\u5904\u7406"}\u300D\u91CD\u8BD5`
|
|
5050
5511
|
}
|
|
5051
|
-
)
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5512
|
+
)
|
|
5513
|
+
]
|
|
5514
|
+
}
|
|
5515
|
+
),
|
|
5516
|
+
features.datasetBinding && ioTarget === "browser" && /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 5, fontSize: 11, color: "#31363f", cursor: "pointer" }, children: [
|
|
5517
|
+
/* @__PURE__ */ jsx4(
|
|
5518
|
+
"input",
|
|
5519
|
+
{
|
|
5520
|
+
type: "checkbox",
|
|
5521
|
+
checked: skipDatasetOnExport,
|
|
5522
|
+
onChange: (e) => setSkipDatasetOnExport(e.target.checked)
|
|
5523
|
+
}
|
|
5524
|
+
),
|
|
5525
|
+
/* @__PURE__ */ jsx4("span", { children: "\u4EC5\u7F16\u7801\u5F53\u524D\u5FEB\u7167\uFF08\u4E0D\u91CD\u590D\u6267\u884C\u6570\u636E\u96C6\u586B\u6570\uFF09" })
|
|
5526
|
+
] })
|
|
5527
|
+
]
|
|
5528
|
+
}
|
|
5529
|
+
);
|
|
5530
|
+
return /* @__PURE__ */ jsx4("div", { className: "yudao-doc-modal-backdrop", onClick: () => featureService.closeModal(), children: /* @__PURE__ */ jsxs4(
|
|
5531
|
+
"div",
|
|
5532
|
+
{
|
|
5533
|
+
className: "yudao-doc-modal-card",
|
|
5534
|
+
"data-testid": "yudao-io-modal",
|
|
5535
|
+
onClick: (e) => e.stopPropagation(),
|
|
5536
|
+
children: [
|
|
5537
|
+
/* @__PURE__ */ jsxs4("div", { className: "yudao-doc-modal-header", children: [
|
|
5538
|
+
/* @__PURE__ */ jsxs4("div", { className: "yudao-doc-modal-tabs", children: [
|
|
5539
|
+
/* @__PURE__ */ jsx4(
|
|
5540
|
+
"button",
|
|
5541
|
+
{
|
|
5542
|
+
type: "button",
|
|
5543
|
+
className: `yudao-doc-modal-tab ${tab === "import" ? "is-active" : ""}`,
|
|
5544
|
+
onClick: () => featureService.setModalTab("import"),
|
|
5545
|
+
children: "\u6587\u6863\u5BFC\u5165"
|
|
5546
|
+
}
|
|
5547
|
+
),
|
|
5548
|
+
/* @__PURE__ */ jsx4(
|
|
5549
|
+
"button",
|
|
5550
|
+
{
|
|
5551
|
+
type: "button",
|
|
5552
|
+
className: `yudao-doc-modal-tab ${tab === "preview" ? "is-active" : ""}`,
|
|
5553
|
+
onClick: () => featureService.setModalTab("preview"),
|
|
5554
|
+
children: "\u5957\u6253\u9884\u89C8\u4E0E\u5BFC\u51FA"
|
|
5555
|
+
}
|
|
5556
|
+
),
|
|
5557
|
+
features.sdtControls && /* @__PURE__ */ jsx4(
|
|
5558
|
+
"button",
|
|
5559
|
+
{
|
|
5560
|
+
type: "button",
|
|
5561
|
+
className: `yudao-doc-modal-tab ${tab === "form" ? "is-active" : ""}`,
|
|
5562
|
+
onClick: () => featureService.setModalTab("form"),
|
|
5563
|
+
children: "\u7ED3\u6784\u5316\u8868\u5355\u6821\u9A8C\u4E0E\u53D6\u503C"
|
|
5564
|
+
}
|
|
5565
|
+
),
|
|
5566
|
+
/* @__PURE__ */ jsx4(
|
|
5567
|
+
"button",
|
|
5568
|
+
{
|
|
5569
|
+
type: "button",
|
|
5570
|
+
className: `yudao-doc-modal-tab ${tab === "json" ? "is-active" : ""}`,
|
|
5571
|
+
onClick: () => featureService.setModalTab("json"),
|
|
5572
|
+
children: `{ } Univer IDocumentData \u5951\u7EA6`
|
|
5573
|
+
}
|
|
5574
|
+
)
|
|
5575
|
+
] }),
|
|
5576
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
5577
|
+
/* @__PURE__ */ jsxs4(
|
|
5578
|
+
"span",
|
|
5579
|
+
{
|
|
5580
|
+
style: {
|
|
5581
|
+
fontSize: 11,
|
|
5582
|
+
padding: "3px 8px",
|
|
5583
|
+
borderRadius: 999,
|
|
5584
|
+
background: isCustomBackendAdapter ? "#f3f5ff" : "#eeeff1",
|
|
5585
|
+
color: isCustomBackendAdapter ? "#2c53f1" : "#4e5565",
|
|
5586
|
+
border: `1px solid ${isCustomBackendAdapter ? "#d2dafa" : "#e3e5ea"}`,
|
|
5587
|
+
fontWeight: 500
|
|
5588
|
+
},
|
|
5589
|
+
children: [
|
|
5590
|
+
"IO \u7BA1\u9053: ",
|
|
5591
|
+
ioAdapter.name || "frontend-default"
|
|
5592
|
+
]
|
|
5593
|
+
}
|
|
5594
|
+
),
|
|
5595
|
+
/* @__PURE__ */ jsx4(
|
|
5596
|
+
"button",
|
|
5597
|
+
{
|
|
5598
|
+
type: "button",
|
|
5599
|
+
className: "yudao-doc-mini-btn",
|
|
5600
|
+
onClick: () => featureService.closeModal(),
|
|
5601
|
+
children: "\u5173\u95ED"
|
|
5602
|
+
}
|
|
5603
|
+
)
|
|
5604
|
+
] })
|
|
5605
|
+
] }),
|
|
5606
|
+
tab === "import" || tab === "preview" ? /* @__PURE__ */ jsxs4("div", { style: { flex: 1, minHeight: 0, display: "flex" }, children: [
|
|
5607
|
+
/* @__PURE__ */ jsxs4(
|
|
5608
|
+
"div",
|
|
5609
|
+
{
|
|
5610
|
+
style: {
|
|
5611
|
+
width: features.datasetBinding ? 356 : 290,
|
|
5612
|
+
borderRight: "1px solid #e3e5ea",
|
|
5613
|
+
padding: 14,
|
|
5614
|
+
display: "flex",
|
|
5615
|
+
flexDirection: "column",
|
|
5616
|
+
gap: 8,
|
|
5617
|
+
background: "#f9fafb",
|
|
5618
|
+
overflowY: "auto"
|
|
5619
|
+
},
|
|
5620
|
+
children: [
|
|
5621
|
+
tab === "import" && renderIoControlCard(),
|
|
5622
|
+
features.datasetBinding ? /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
5623
|
+
/* @__PURE__ */ jsx4("div", { style: { fontSize: 12, fontWeight: 600, color: "#1b1c1f" }, children: "\u4E1A\u52A1\u6570\u636E\u96C6 JSON\uFF08\u652F\u6301\u5355\u6761\u5BF9\u8C61\u6216\u6279\u91CF\u6570\u7EC4 [...]\uFF09" }),
|
|
5624
|
+
/* @__PURE__ */ jsx4(
|
|
5625
|
+
"textarea",
|
|
5626
|
+
{
|
|
5627
|
+
className: "yudao-doc-code-area",
|
|
5628
|
+
value: datasetText,
|
|
5629
|
+
onChange: (e) => setDatasetText(e.target.value)
|
|
5630
|
+
}
|
|
5631
|
+
),
|
|
5632
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 6, flexWrap: "wrap" }, children: [
|
|
5633
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-doc-mini-btn", onClick: () => refreshHtmlPreview(), children: "\u5237\u65B0\u53F3\u4FA7\u9884\u89C8" }),
|
|
5634
|
+
/* @__PURE__ */ jsx4(
|
|
5635
|
+
"button",
|
|
5636
|
+
{
|
|
5637
|
+
type: "button",
|
|
5638
|
+
className: "yudao-doc-mini-btn",
|
|
5639
|
+
onClick: handleApplyDatasetToEditor,
|
|
5640
|
+
children: "\u586B\u5145\u81F3\u4E3B\u6587\u6863"
|
|
5641
|
+
}
|
|
5642
|
+
)
|
|
5643
|
+
] })
|
|
5644
|
+
] }) : /* @__PURE__ */ jsxs4("div", { style: { fontSize: 12, color: "#4e5565", lineHeight: 1.6 }, children: [
|
|
5645
|
+
"\u652F\u6301\u6309\u6B21\u9009\u62E9\u6D4F\u89C8\u5668\u672C\u5730\u5F15\u64CE\u6216\u670D\u52A1\u7AEF\u63A5\u53E3\u5BFC\u5165/\u5BFC\u51FA\u6807\u51C6 ",
|
|
5646
|
+
/* @__PURE__ */ jsx4("code", { children: ".docx" }),
|
|
5647
|
+
"\u3001",
|
|
5648
|
+
/* @__PURE__ */ jsx4("code", { children: ".pdf" }),
|
|
5649
|
+
"\u3001",
|
|
5650
|
+
/* @__PURE__ */ jsx4("code", { children: ".html" }),
|
|
5651
|
+
"\u3001",
|
|
5652
|
+
/* @__PURE__ */ jsx4("code", { children: ".md" }),
|
|
5653
|
+
" \u7B49\u6587\u6863\u683C\u5F0F\u3002"
|
|
5654
|
+
] }),
|
|
5655
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 6, paddingTop: 4, borderTop: "1px solid #e3e5ea" }, children: [
|
|
5656
|
+
/* @__PURE__ */ jsx4(
|
|
5657
|
+
"input",
|
|
5658
|
+
{
|
|
5659
|
+
type: "text",
|
|
5660
|
+
placeholder: "\u516C\u6587\u7EA2\u5934\u7248\u5934\uFF08\u5982\uFF1A\u96C6\u56E2\u7EA2\u5934\u6587\u4EF6\uFF09",
|
|
5661
|
+
value: redHeaderTitle,
|
|
5662
|
+
onChange: (e) => {
|
|
5663
|
+
setRedHeaderTitle(e.target.value);
|
|
5664
|
+
refreshHtmlPreview({ red: e.target.value });
|
|
5665
|
+
},
|
|
5666
|
+
style: {
|
|
5667
|
+
border: "1px solid #e3e5ea",
|
|
5668
|
+
borderRadius: 6,
|
|
5669
|
+
padding: "5px 8px",
|
|
5670
|
+
fontSize: 11.5,
|
|
5671
|
+
color: "#1b1c1f",
|
|
5672
|
+
background: "#ffffff"
|
|
5673
|
+
}
|
|
5674
|
+
}
|
|
5675
|
+
),
|
|
5676
|
+
/* @__PURE__ */ jsx4(
|
|
5677
|
+
"input",
|
|
5678
|
+
{
|
|
5679
|
+
type: "text",
|
|
5680
|
+
placeholder: "\u9632\u4F2A\u659C\u5411\u5E73\u94FA\u6C34\u5370\uFF08\u5982\uFF1A\u5185\u90E8\u673A\u5BC6\uFF09",
|
|
5681
|
+
value: watermarkText,
|
|
5682
|
+
onChange: (e) => {
|
|
5683
|
+
setWatermarkText(e.target.value);
|
|
5684
|
+
refreshHtmlPreview({ wm: e.target.value });
|
|
5685
|
+
},
|
|
5686
|
+
style: {
|
|
5687
|
+
border: "1px solid #e3e5ea",
|
|
5688
|
+
borderRadius: 6,
|
|
5689
|
+
padding: "5px 8px",
|
|
5690
|
+
fontSize: 11.5,
|
|
5691
|
+
color: "#1b1c1f",
|
|
5692
|
+
background: "#ffffff"
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
5695
|
+
),
|
|
5696
|
+
/* @__PURE__ */ jsx4(
|
|
5697
|
+
"input",
|
|
5698
|
+
{
|
|
5699
|
+
type: "text",
|
|
5700
|
+
placeholder: "\u8DE8\u9875\u9A91\u7F1D\u7AE0\u4E3B\u4F53\uFF08\u5982\uFF1A\u516C\u53F8\u5408\u540C\u4E13\u7528\u7AE0\uFF09",
|
|
5701
|
+
value: straddleSealText,
|
|
5702
|
+
onChange: (e) => {
|
|
5703
|
+
setStraddleSealText(e.target.value);
|
|
5704
|
+
refreshHtmlPreview({ seal: e.target.value });
|
|
5705
|
+
},
|
|
5706
|
+
style: {
|
|
5707
|
+
border: "1px solid #e3e5ea",
|
|
5708
|
+
borderRadius: 6,
|
|
5709
|
+
padding: "5px 8px",
|
|
5710
|
+
fontSize: 11.5,
|
|
5711
|
+
color: "#1b1c1f",
|
|
5712
|
+
background: "#ffffff"
|
|
5713
|
+
}
|
|
5714
|
+
}
|
|
5715
|
+
),
|
|
5716
|
+
/* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5, color: "#31363f", cursor: "pointer" }, children: [
|
|
5717
|
+
/* @__PURE__ */ jsx4(
|
|
5718
|
+
"input",
|
|
5719
|
+
{
|
|
5720
|
+
type: "checkbox",
|
|
5721
|
+
checked: showLineNumbers,
|
|
5722
|
+
onChange: (e) => {
|
|
5723
|
+
setShowLineNumbers(e.target.checked);
|
|
5724
|
+
refreshHtmlPreview({ lineNo: e.target.checked });
|
|
5725
|
+
}
|
|
5726
|
+
}
|
|
5727
|
+
),
|
|
5728
|
+
/* @__PURE__ */ jsx4("span", { children: "\u663E\u793A\u6CD5\u52A1\u5DE6\u4FA7\u884C\u53F7 (Line Numbers)" })
|
|
5729
|
+
] }),
|
|
5730
|
+
/* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5, color: "#31363f", cursor: "pointer" }, children: [
|
|
5731
|
+
/* @__PURE__ */ jsx4(
|
|
5732
|
+
"input",
|
|
5733
|
+
{
|
|
5734
|
+
type: "checkbox",
|
|
5735
|
+
checked: printFieldsOnly,
|
|
5736
|
+
onChange: (e) => {
|
|
5737
|
+
setPrintFieldsOnly(e.target.checked);
|
|
5738
|
+
refreshHtmlPreview({ fieldsOnly: e.target.checked });
|
|
5739
|
+
}
|
|
5740
|
+
}
|
|
5741
|
+
),
|
|
5742
|
+
/* @__PURE__ */ jsx4("span", { children: "\u4EC5\u5957\u6253\u586B\u7A7A\u503C (\u9690\u85CF\u56FA\u5B9A\u6B63\u6587)" })
|
|
5743
|
+
] }),
|
|
5744
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
5745
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11 }, children: [
|
|
5746
|
+
/* @__PURE__ */ jsx4("span", { style: { fontWeight: 600, color: "#31363f" }, children: "\u843D\u6B3E\u624B\u5199\u7B7E\u540D\u677F" }),
|
|
5747
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 4 }, children: [
|
|
5748
|
+
/* @__PURE__ */ jsx4(
|
|
5749
|
+
"button",
|
|
5750
|
+
{
|
|
5751
|
+
type: "button",
|
|
5752
|
+
className: "yudao-doc-mini-btn",
|
|
5753
|
+
style: { padding: "1px 6px", fontSize: 10.5 },
|
|
5754
|
+
disabled: sigStrokes.length === 0,
|
|
5755
|
+
onClick: () => {
|
|
5756
|
+
const next = sigStrokes.slice(0, -1);
|
|
5757
|
+
setSigStrokes(next);
|
|
5758
|
+
repaintModalSignatureCanvas(sigCanvasRef.current, next);
|
|
5759
|
+
const nextUrl = next.length === 0 ? "" : (sigCanvasRef.current ? autoCropCanvasToPngDataUrl(sigCanvasRef.current) : "") || renderSignatureStrokesToSvgDataUri(next)?.dataUri || "";
|
|
5760
|
+
setSignatureDataUrl(nextUrl);
|
|
5761
|
+
refreshHtmlPreview({ sig: nextUrl });
|
|
5762
|
+
},
|
|
5763
|
+
children: "\u64A4\u9500"
|
|
5764
|
+
}
|
|
5765
|
+
),
|
|
5766
|
+
/* @__PURE__ */ jsx4(
|
|
5767
|
+
"button",
|
|
5768
|
+
{
|
|
5769
|
+
type: "button",
|
|
5770
|
+
className: "yudao-doc-mini-btn",
|
|
5771
|
+
style: { padding: "1px 6px", fontSize: 10.5 },
|
|
5772
|
+
onClick: () => {
|
|
5773
|
+
setSigStrokes([]);
|
|
5774
|
+
repaintModalSignatureCanvas(sigCanvasRef.current, []);
|
|
5775
|
+
setSignatureDataUrl("");
|
|
5776
|
+
refreshHtmlPreview({ sig: "" });
|
|
5777
|
+
},
|
|
5778
|
+
children: "\u6E05\u7A7A\u7B7E\u540D"
|
|
5779
|
+
}
|
|
5780
|
+
)
|
|
5781
|
+
] })
|
|
5782
|
+
] }),
|
|
5783
|
+
/* @__PURE__ */ jsx4("div", { style: { display: "flex", gap: 4 }, children: MODAL_PEN_COLORS.map((pen) => /* @__PURE__ */ jsxs4(
|
|
5784
|
+
"button",
|
|
5785
|
+
{
|
|
5786
|
+
type: "button",
|
|
5787
|
+
className: `yudao-doc-mini-btn ${sigPenColor === pen.hex ? "is-soft-primary" : ""}`,
|
|
5788
|
+
style: { padding: "1px 6px", fontSize: 10.5 },
|
|
5789
|
+
onClick: () => setSigPenColor(pen.hex),
|
|
5790
|
+
children: [
|
|
5791
|
+
/* @__PURE__ */ jsx4(
|
|
5792
|
+
"span",
|
|
5793
|
+
{
|
|
5794
|
+
style: {
|
|
5795
|
+
display: "inline-block",
|
|
5796
|
+
width: 7,
|
|
5797
|
+
height: 7,
|
|
5798
|
+
borderRadius: 999,
|
|
5799
|
+
background: pen.hex,
|
|
5800
|
+
marginRight: 4
|
|
5801
|
+
}
|
|
5802
|
+
}
|
|
5803
|
+
),
|
|
5804
|
+
pen.label
|
|
5805
|
+
]
|
|
5806
|
+
},
|
|
5807
|
+
pen.hex
|
|
5808
|
+
)) }),
|
|
5809
|
+
/* @__PURE__ */ jsx4(
|
|
5810
|
+
"canvas",
|
|
5811
|
+
{
|
|
5812
|
+
ref: sigCanvasRef,
|
|
5813
|
+
width: 260,
|
|
5814
|
+
height: 64,
|
|
5815
|
+
style: {
|
|
5816
|
+
border: "1px dashed #e3e5ea",
|
|
5817
|
+
borderRadius: 6,
|
|
5818
|
+
background: "#ffffff",
|
|
5819
|
+
cursor: "crosshair",
|
|
5820
|
+
touchAction: "none"
|
|
5821
|
+
},
|
|
5822
|
+
onPointerDown: (e) => {
|
|
5823
|
+
const cvs = sigCanvasRef.current;
|
|
5824
|
+
if (!cvs) return;
|
|
5825
|
+
const rect = cvs.getBoundingClientRect();
|
|
5826
|
+
const pt = { x: e.clientX - rect.left, y: e.clientY - rect.top };
|
|
5827
|
+
const next = [
|
|
5828
|
+
...sigStrokes,
|
|
5829
|
+
{ points: [pt], color: sigPenColor, lineWidth: 2.2 }
|
|
5830
|
+
];
|
|
5831
|
+
setSigStrokes(next);
|
|
5832
|
+
setIsDrawingSig(true);
|
|
5833
|
+
repaintModalSignatureCanvas(cvs, next);
|
|
5834
|
+
},
|
|
5835
|
+
onPointerMove: (e) => {
|
|
5836
|
+
if (!isDrawingSig) return;
|
|
5837
|
+
const cvs = sigCanvasRef.current;
|
|
5838
|
+
if (!cvs || sigStrokes.length === 0) return;
|
|
5839
|
+
const rect = cvs.getBoundingClientRect();
|
|
5840
|
+
const pt = { x: e.clientX - rect.left, y: e.clientY - rect.top };
|
|
5841
|
+
const next = [...sigStrokes];
|
|
5842
|
+
const last = next[next.length - 1];
|
|
5843
|
+
next[next.length - 1] = { ...last, points: [...last.points, pt] };
|
|
5844
|
+
setSigStrokes(next);
|
|
5845
|
+
repaintModalSignatureCanvas(cvs, next);
|
|
5846
|
+
},
|
|
5847
|
+
onPointerUp: () => {
|
|
5848
|
+
if (!isDrawingSig) return;
|
|
5849
|
+
setIsDrawingSig(false);
|
|
5850
|
+
const cropped = (sigCanvasRef.current ? autoCropCanvasToPngDataUrl(sigCanvasRef.current) : "") || renderSignatureStrokesToSvgDataUri(sigStrokes)?.dataUri || "";
|
|
5851
|
+
setSignatureDataUrl(cropped);
|
|
5852
|
+
refreshHtmlPreview({ sig: cropped });
|
|
5853
|
+
},
|
|
5854
|
+
onPointerLeave: () => {
|
|
5855
|
+
if (!isDrawingSig) return;
|
|
5856
|
+
setIsDrawingSig(false);
|
|
5857
|
+
const cropped = (sigCanvasRef.current ? autoCropCanvasToPngDataUrl(sigCanvasRef.current) : "") || renderSignatureStrokesToSvgDataUri(sigStrokes)?.dataUri || "";
|
|
5858
|
+
setSignatureDataUrl(cropped);
|
|
5859
|
+
refreshHtmlPreview({ sig: cropped });
|
|
5860
|
+
}
|
|
5861
|
+
}
|
|
5862
|
+
)
|
|
5863
|
+
] })
|
|
5864
|
+
] }),
|
|
5865
|
+
tab !== "import" && renderIoControlCard(),
|
|
5866
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 6, marginTop: 2 }, children: [
|
|
5867
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 6 }, children: [
|
|
5868
|
+
/* @__PURE__ */ jsxs4(
|
|
5869
|
+
"select",
|
|
5870
|
+
{
|
|
5871
|
+
"data-testid": "yudao-io-export-format",
|
|
5872
|
+
value: exportFormat,
|
|
5873
|
+
onChange: (e) => setExportFormat(e.target.value),
|
|
5874
|
+
style: {
|
|
5875
|
+
width: 110,
|
|
5876
|
+
fontSize: 11.5,
|
|
5877
|
+
padding: "4px 6px",
|
|
5878
|
+
border: "1px solid #e3e5ea",
|
|
5879
|
+
borderRadius: 6,
|
|
5880
|
+
color: "#1b1c1f",
|
|
5881
|
+
background: "#ffffff"
|
|
5882
|
+
},
|
|
5883
|
+
children: [
|
|
5884
|
+
/* @__PURE__ */ jsx4("option", { value: "docx", children: ".docx (Word)" }),
|
|
5885
|
+
/* @__PURE__ */ jsx4("option", { value: "pdf", children: ".pdf (PDF)" }),
|
|
5886
|
+
/* @__PURE__ */ jsx4("option", { value: "html", children: ".html (HTML)" }),
|
|
5887
|
+
/* @__PURE__ */ jsx4("option", { value: "md", children: ".md (Markdown)" }),
|
|
5888
|
+
/* @__PURE__ */ jsx4("option", { value: "rtf", children: ".rtf (RTF)" }),
|
|
5889
|
+
/* @__PURE__ */ jsx4("option", { value: "odt", children: ".odt (ODT)" }),
|
|
5890
|
+
/* @__PURE__ */ jsx4("option", { value: "doc", children: ".doc (\u517C\u5BB9)" }),
|
|
5891
|
+
/* @__PURE__ */ jsx4("option", { value: "txt", children: ".txt (\u7EAF\u6587\u672C)" }),
|
|
5892
|
+
/* @__PURE__ */ jsx4("option", { value: "json", children: ".json (\u5FEB\u7167)" })
|
|
5893
|
+
]
|
|
5894
|
+
}
|
|
5895
|
+
),
|
|
5896
|
+
/* @__PURE__ */ jsx4(
|
|
5897
|
+
"button",
|
|
5898
|
+
{
|
|
5899
|
+
type: "button",
|
|
5900
|
+
"data-testid": "yudao-io-export-download",
|
|
5901
|
+
className: "yudao-doc-mini-btn is-primary yudao-doc-export-btn",
|
|
5902
|
+
style: { flex: 1 },
|
|
5903
|
+
onClick: () => void runExport(exportFormat),
|
|
5904
|
+
children: `\u5BFC\u51FA\u4E0B\u8F7D (.${exportFormat})`
|
|
5905
|
+
}
|
|
5906
|
+
)
|
|
5907
|
+
] }),
|
|
5908
|
+
/* @__PURE__ */ jsx4(
|
|
5909
|
+
"button",
|
|
5910
|
+
{
|
|
5911
|
+
type: "button",
|
|
5912
|
+
className: "yudao-doc-mini-btn yudao-doc-export-btn",
|
|
5913
|
+
onClick: () => void runExport("pdf"),
|
|
5914
|
+
children: "\u5BFC\u51FA\u6B63\u5F0F\u9A91\u7F1D\u7AE0 PDF"
|
|
5061
5915
|
}
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
type: "checkbox",
|
|
5071
|
-
checked: printFieldsOnly,
|
|
5072
|
-
onChange: (e) => {
|
|
5073
|
-
setPrintFieldsOnly(e.target.checked);
|
|
5074
|
-
refreshHtmlPreview({ fieldsOnly: e.target.checked });
|
|
5916
|
+
),
|
|
5917
|
+
/* @__PURE__ */ jsx4(
|
|
5918
|
+
"button",
|
|
5919
|
+
{
|
|
5920
|
+
type: "button",
|
|
5921
|
+
className: "yudao-doc-mini-btn yudao-doc-export-btn",
|
|
5922
|
+
onClick: handleBatchExportPdf,
|
|
5923
|
+
children: "\u6279\u91CF\u5957\u6253\u5408\u5E76\u5BFC\u51FA PDF"
|
|
5075
5924
|
}
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
/* @__PURE__ */ jsx4("span", { children: "\u4EC5\u5957\u6253\u586B\u7A7A\u503C (\u9690\u85CF\u56FA\u5B9A\u6B63\u6587)" })
|
|
5079
|
-
] }),
|
|
5080
|
-
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
5081
|
-
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11 }, children: [
|
|
5082
|
-
/* @__PURE__ */ jsx4("span", { style: { fontWeight: 600, color: "#31363f" }, children: "\u843D\u6B3E\u624B\u5199\u7B7E\u540D\u677F" }),
|
|
5083
|
-
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 4 }, children: [
|
|
5925
|
+
),
|
|
5926
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
|
|
5084
5927
|
/* @__PURE__ */ jsx4(
|
|
5085
5928
|
"button",
|
|
5086
5929
|
{
|
|
5087
5930
|
type: "button",
|
|
5088
|
-
className: "yudao-doc-mini-btn",
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
onClick: () => {
|
|
5092
|
-
const next = sigStrokes.slice(0, -1);
|
|
5093
|
-
setSigStrokes(next);
|
|
5094
|
-
repaintModalSignatureCanvas(sigCanvasRef.current, next);
|
|
5095
|
-
const nextUrl = next.length === 0 ? "" : (sigCanvasRef.current ? autoCropCanvasToPngDataUrl(sigCanvasRef.current) : "") || renderSignatureStrokesToSvgDataUri(next)?.dataUri || "";
|
|
5096
|
-
setSignatureDataUrl(nextUrl);
|
|
5097
|
-
refreshHtmlPreview({ sig: nextUrl });
|
|
5098
|
-
},
|
|
5099
|
-
children: "\u64A4\u9500"
|
|
5931
|
+
className: "yudao-doc-mini-btn yudao-doc-export-btn",
|
|
5932
|
+
onClick: () => void runExport("html"),
|
|
5933
|
+
children: "\u5BFC\u51FA (.html)"
|
|
5100
5934
|
}
|
|
5101
5935
|
),
|
|
5102
5936
|
/* @__PURE__ */ jsx4(
|
|
5103
5937
|
"button",
|
|
5104
5938
|
{
|
|
5105
5939
|
type: "button",
|
|
5106
|
-
className: "yudao-doc-mini-btn",
|
|
5107
|
-
|
|
5940
|
+
className: "yudao-doc-mini-btn yudao-doc-export-btn",
|
|
5941
|
+
onClick: () => void runExport("md"),
|
|
5942
|
+
children: "\u5BFC\u51FA Markdown (.md)"
|
|
5943
|
+
}
|
|
5944
|
+
),
|
|
5945
|
+
/* @__PURE__ */ jsx4(
|
|
5946
|
+
"button",
|
|
5947
|
+
{
|
|
5948
|
+
type: "button",
|
|
5949
|
+
className: "yudao-doc-mini-btn yudao-doc-export-btn",
|
|
5950
|
+
style: { gridColumn: "1 / -1" },
|
|
5108
5951
|
onClick: () => {
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
setSignatureDataUrl("");
|
|
5112
|
-
refreshHtmlPreview({ sig: "" });
|
|
5952
|
+
iframeRef.current?.contentWindow?.focus();
|
|
5953
|
+
iframeRef.current?.contentWindow?.print();
|
|
5113
5954
|
},
|
|
5114
|
-
children: "\
|
|
5955
|
+
children: "A4 \u77E2\u91CF\u6253\u5370"
|
|
5115
5956
|
}
|
|
5116
5957
|
)
|
|
5117
|
-
] })
|
|
5958
|
+
] }),
|
|
5959
|
+
ioAdapter.onSave && /* @__PURE__ */ jsx4(
|
|
5960
|
+
"button",
|
|
5961
|
+
{
|
|
5962
|
+
type: "button",
|
|
5963
|
+
className: "yudao-doc-mini-btn yudao-doc-export-btn",
|
|
5964
|
+
onClick: handleSaveToHost,
|
|
5965
|
+
children: "\u4FDD\u5B58\u6A21\u677F\u81F3\u5BBF\u4E3B\u540E\u7AEF"
|
|
5966
|
+
}
|
|
5967
|
+
)
|
|
5118
5968
|
] }),
|
|
5119
|
-
|
|
5120
|
-
"
|
|
5121
|
-
{
|
|
5122
|
-
type: "button",
|
|
5123
|
-
className: `yudao-doc-mini-btn ${sigPenColor === pen.hex ? "is-soft-primary" : ""}`,
|
|
5124
|
-
style: { padding: "1px 6px", fontSize: 10.5 },
|
|
5125
|
-
onClick: () => setSigPenColor(pen.hex),
|
|
5126
|
-
children: [
|
|
5127
|
-
/* @__PURE__ */ jsx4(
|
|
5128
|
-
"span",
|
|
5129
|
-
{
|
|
5130
|
-
style: {
|
|
5131
|
-
display: "inline-block",
|
|
5132
|
-
width: 7,
|
|
5133
|
-
height: 7,
|
|
5134
|
-
borderRadius: 999,
|
|
5135
|
-
background: pen.hex,
|
|
5136
|
-
marginRight: 4
|
|
5137
|
-
}
|
|
5138
|
-
}
|
|
5139
|
-
),
|
|
5140
|
-
pen.label
|
|
5141
|
-
]
|
|
5142
|
-
},
|
|
5143
|
-
pen.hex
|
|
5144
|
-
)) }),
|
|
5145
|
-
/* @__PURE__ */ jsx4(
|
|
5146
|
-
"canvas",
|
|
5969
|
+
statusTip && /* @__PURE__ */ jsx4(
|
|
5970
|
+
"div",
|
|
5147
5971
|
{
|
|
5148
|
-
|
|
5149
|
-
width: 260,
|
|
5150
|
-
height: 64,
|
|
5972
|
+
"data-testid": "yudao-io-status-tip",
|
|
5151
5973
|
style: {
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
background: "#
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
onPointerDown: (e) => {
|
|
5159
|
-
const cvs = sigCanvasRef.current;
|
|
5160
|
-
if (!cvs) return;
|
|
5161
|
-
const rect = cvs.getBoundingClientRect();
|
|
5162
|
-
const pt = { x: e.clientX - rect.left, y: e.clientY - rect.top };
|
|
5163
|
-
const next = [
|
|
5164
|
-
...sigStrokes,
|
|
5165
|
-
{ points: [pt], color: sigPenColor, lineWidth: 2.2 }
|
|
5166
|
-
];
|
|
5167
|
-
setSigStrokes(next);
|
|
5168
|
-
setIsDrawingSig(true);
|
|
5169
|
-
repaintModalSignatureCanvas(cvs, next);
|
|
5170
|
-
},
|
|
5171
|
-
onPointerMove: (e) => {
|
|
5172
|
-
if (!isDrawingSig) return;
|
|
5173
|
-
const cvs = sigCanvasRef.current;
|
|
5174
|
-
if (!cvs || sigStrokes.length === 0) return;
|
|
5175
|
-
const rect = cvs.getBoundingClientRect();
|
|
5176
|
-
const pt = { x: e.clientX - rect.left, y: e.clientY - rect.top };
|
|
5177
|
-
const next = [...sigStrokes];
|
|
5178
|
-
const last = next[next.length - 1];
|
|
5179
|
-
next[next.length - 1] = { ...last, points: [...last.points, pt] };
|
|
5180
|
-
setSigStrokes(next);
|
|
5181
|
-
repaintModalSignatureCanvas(cvs, next);
|
|
5182
|
-
},
|
|
5183
|
-
onPointerUp: () => {
|
|
5184
|
-
if (!isDrawingSig) return;
|
|
5185
|
-
setIsDrawingSig(false);
|
|
5186
|
-
const cropped = (sigCanvasRef.current ? autoCropCanvasToPngDataUrl(sigCanvasRef.current) : "") || renderSignatureStrokesToSvgDataUri(sigStrokes)?.dataUri || "";
|
|
5187
|
-
setSignatureDataUrl(cropped);
|
|
5188
|
-
refreshHtmlPreview({ sig: cropped });
|
|
5974
|
+
fontSize: 11.5,
|
|
5975
|
+
color: "#2c53f1",
|
|
5976
|
+
background: "#f3f5ff",
|
|
5977
|
+
border: "1px solid #d2dafa",
|
|
5978
|
+
padding: "6px 8px",
|
|
5979
|
+
borderRadius: 6
|
|
5189
5980
|
},
|
|
5190
|
-
|
|
5191
|
-
if (!isDrawingSig) return;
|
|
5192
|
-
setIsDrawingSig(false);
|
|
5193
|
-
const cropped = (sigCanvasRef.current ? autoCropCanvasToPngDataUrl(sigCanvasRef.current) : "") || renderSignatureStrokesToSvgDataUri(sigStrokes)?.dataUri || "";
|
|
5194
|
-
setSignatureDataUrl(cropped);
|
|
5195
|
-
refreshHtmlPreview({ sig: cropped });
|
|
5196
|
-
}
|
|
5981
|
+
children: statusTip
|
|
5197
5982
|
}
|
|
5198
5983
|
)
|
|
5199
|
-
]
|
|
5200
|
-
|
|
5201
|
-
|
|
5984
|
+
]
|
|
5985
|
+
}
|
|
5986
|
+
),
|
|
5987
|
+
/* @__PURE__ */ jsx4("div", { style: { flex: 1, background: "#eeeff1", padding: 20, overflow: "auto" }, children: /* @__PURE__ */ jsx4(
|
|
5988
|
+
"iframe",
|
|
5989
|
+
{
|
|
5990
|
+
ref: iframeRef,
|
|
5991
|
+
title: "Word Document Preview",
|
|
5992
|
+
srcDoc: previewHtml,
|
|
5993
|
+
style: {
|
|
5994
|
+
width: "100%",
|
|
5995
|
+
height: "100%",
|
|
5996
|
+
border: "1px solid #e3e5ea",
|
|
5997
|
+
background: "#ffffff",
|
|
5998
|
+
borderRadius: 4,
|
|
5999
|
+
boxShadow: "0 4px 16px rgba(27, 28, 31, 0.08)"
|
|
6000
|
+
}
|
|
6001
|
+
}
|
|
6002
|
+
) })
|
|
6003
|
+
] }) : tab === "form" ? /* @__PURE__ */ jsxs4("div", { style: { flex: 1, minHeight: 0, padding: 18, display: "flex", gap: 16 }, children: [
|
|
6004
|
+
/* @__PURE__ */ jsxs4("div", { style: { width: 320, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
6005
|
+
/* @__PURE__ */ jsx4(
|
|
5202
6006
|
"div",
|
|
5203
6007
|
{
|
|
5204
6008
|
style: {
|
|
5205
|
-
padding: "
|
|
5206
|
-
background: "#ffffff",
|
|
5207
|
-
border: "1px solid #e3e5ea",
|
|
6009
|
+
padding: "12px 14px",
|
|
5208
6010
|
borderRadius: 8,
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
6011
|
+
background: validation.valid ? "#f3f5ff" : "#f9fafb",
|
|
6012
|
+
border: `1px solid ${validation.valid ? "#d2dafa" : "#e3e5ea"}`,
|
|
6013
|
+
color: validation.valid ? "#2c53f1" : "#1b1c1f",
|
|
6014
|
+
fontWeight: 600,
|
|
6015
|
+
fontSize: 12.5
|
|
5212
6016
|
},
|
|
5213
|
-
children:
|
|
5214
|
-
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5 }, children: [
|
|
5215
|
-
/* @__PURE__ */ jsx4("span", { style: { fontWeight: 600, color: "#1b1c1f" }, children: "\u5BFC\u5165/\u5BFC\u51FA\u5904\u7406\u65B9\u5F0F\uFF08\u6309\u6B21\u9009\u62E9\uFF09" }),
|
|
5216
|
-
/* @__PURE__ */ jsxs4("span", { style: { fontSize: 10.5, color: "#7d8698" }, children: [
|
|
5217
|
-
"\u5FEB\u7167 ",
|
|
5218
|
-
snapSizeKb,
|
|
5219
|
-
" KB"
|
|
5220
|
-
] })
|
|
5221
|
-
] }),
|
|
5222
|
-
/* @__PURE__ */ jsxs4("div", { className: "yudao-doc-segmented", children: [
|
|
5223
|
-
/* @__PURE__ */ jsx4(
|
|
5224
|
-
"button",
|
|
5225
|
-
{
|
|
5226
|
-
type: "button",
|
|
5227
|
-
className: `yudao-doc-segmented-btn ${ioTarget === "browser" ? "is-active" : ""}`,
|
|
5228
|
-
onClick: () => setIoTarget("browser"),
|
|
5229
|
-
children: "\u6D4F\u89C8\u5668\u5904\u7406"
|
|
5230
|
-
}
|
|
5231
|
-
),
|
|
5232
|
-
/* @__PURE__ */ jsxs4(
|
|
5233
|
-
"button",
|
|
5234
|
-
{
|
|
5235
|
-
type: "button",
|
|
5236
|
-
className: `yudao-doc-segmented-btn ${ioTarget === "server" ? "is-active" : ""}`,
|
|
5237
|
-
onClick: () => setIoTarget("server"),
|
|
5238
|
-
children: [
|
|
5239
|
-
"\u670D\u52A1\u7AEF",
|
|
5240
|
-
ioCaps.server.exportDoc || ioCaps.server.importDoc ? "" : " (\u672A\u63A5\u5165)"
|
|
5241
|
-
]
|
|
5242
|
-
}
|
|
5243
|
-
)
|
|
5244
|
-
] }),
|
|
5245
|
-
ioTarget === "browser" ? exportCapReport.warnings.length > 0 ? /* @__PURE__ */ jsxs4(
|
|
5246
|
-
"div",
|
|
5247
|
-
{
|
|
5248
|
-
style: {
|
|
5249
|
-
fontSize: 10.5,
|
|
5250
|
-
color: "#4e5565",
|
|
5251
|
-
background: "#f9fafb",
|
|
5252
|
-
border: "1px solid #e3e5ea",
|
|
5253
|
-
padding: "4px 6px",
|
|
5254
|
-
borderRadius: 5,
|
|
5255
|
-
lineHeight: 1.4
|
|
5256
|
-
},
|
|
5257
|
-
children: [
|
|
5258
|
-
"\u6D4F\u89C8\u5668\u7AEF\u63D0\u793A\uFF1A",
|
|
5259
|
-
exportCapReport.warnings.join("\uFF1B")
|
|
5260
|
-
]
|
|
5261
|
-
}
|
|
5262
|
-
) : /* @__PURE__ */ jsx4("div", { style: { fontSize: 10.5, color: "#4e5565", lineHeight: 1.4 }, children: "\u6D4F\u89C8\u5668\u672C\u5730\u5904\u7406\uFF1A\u96F6\u4E0A\u4F20\uFF0C\u5B8C\u6574\u4FDD\u7559\u8868\u683C/SDT/\u811A\u6CE8\u5C3E\u6CE8/\u591A\u680F/\u591A\u9875\u7709\u9875\u811A/\u4FEE\u8BA2\u7559\u75D5\u4E0E\u77E2\u91CF\u9A91\u7F1D\u7AE0 PDF\u3002" }) : /* @__PURE__ */ jsx4("div", { style: { fontSize: 10.5, color: "#4e5565", lineHeight: 1.4 }, children: "\u670D\u52A1\u7AEF\u5904\u7406\uFF1A\u8D70\u540E\u7AEF Apache POI / poi-tl \u9AD8\u4FDD\u771F\u8BFB\u5199\uFF08\u5931\u8D25\u4E0D\u9759\u9ED8\u8F6C\u524D\u7AEF\uFF09\u3002" }),
|
|
5263
|
-
features.datasetBinding && ioTarget === "browser" && /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 5, fontSize: 11, color: "#31363f", cursor: "pointer" }, children: [
|
|
5264
|
-
/* @__PURE__ */ jsx4(
|
|
5265
|
-
"input",
|
|
5266
|
-
{
|
|
5267
|
-
type: "checkbox",
|
|
5268
|
-
checked: skipDatasetOnExport,
|
|
5269
|
-
onChange: (e) => setSkipDatasetOnExport(e.target.checked)
|
|
5270
|
-
}
|
|
5271
|
-
),
|
|
5272
|
-
/* @__PURE__ */ jsx4("span", { children: "\u4EC5\u7F16\u7801\u5F53\u524D\u5FEB\u7167\uFF08\u4E0D\u91CD\u590D\u6267\u884C\u6570\u636E\u96C6\u586B\u6570\uFF09" })
|
|
5273
|
-
] })
|
|
5274
|
-
]
|
|
6017
|
+
children: validation.valid ? "\u6240\u6709\u5FC5\u586B\u7ED3\u6784\u5316\u63A7\u4EF6\u5747\u5DF2\u5408\u89C4\u586B\u5199\u5B8C\u6BD5" : `\u5B58\u5728 ${validation.issues.length} \u4E2A\u7ED3\u6784\u5316\u63A7\u4EF6\u5F85\u586B\u5199\u6216\u683C\u5F0F\u672A\u901A\u8FC7`
|
|
5275
6018
|
}
|
|
5276
6019
|
),
|
|
5277
|
-
|
|
6020
|
+
validation.issues.map((it) => /* @__PURE__ */ jsxs4(
|
|
5278
6021
|
"div",
|
|
5279
6022
|
{
|
|
5280
6023
|
style: {
|
|
5281
|
-
|
|
5282
|
-
|
|
6024
|
+
padding: "8px 10px",
|
|
6025
|
+
borderRadius: 6,
|
|
5283
6026
|
background: "#f9fafb",
|
|
5284
6027
|
border: "1px solid #e3e5ea",
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
6028
|
+
borderLeft: "2px solid #d93025",
|
|
6029
|
+
color: "#31363f",
|
|
6030
|
+
fontSize: 12
|
|
5288
6031
|
},
|
|
5289
6032
|
children: [
|
|
5290
|
-
"\
|
|
5291
|
-
|
|
6033
|
+
"\u2022 ",
|
|
6034
|
+
it.message,
|
|
6035
|
+
" (",
|
|
6036
|
+
/* @__PURE__ */ jsx4("code", { children: it.tag }),
|
|
6037
|
+
")"
|
|
5292
6038
|
]
|
|
6039
|
+
},
|
|
6040
|
+
it.controlId
|
|
6041
|
+
))
|
|
6042
|
+
] }),
|
|
6043
|
+
/* @__PURE__ */ jsxs4("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
6044
|
+
/* @__PURE__ */ jsxs4("div", { style: { fontSize: 12.5, fontWeight: 600, color: "#1b1c1f" }, children: [
|
|
6045
|
+
"\u63D0\u53D6\u7684\u7ED3\u6784\u5316\u8868\u5355\u952E\u503C JSON (",
|
|
6046
|
+
/* @__PURE__ */ jsx4("code", { children: "getFormValues()" }),
|
|
6047
|
+
")\uFF1A"
|
|
6048
|
+
] }),
|
|
6049
|
+
/* @__PURE__ */ jsx4(
|
|
6050
|
+
"textarea",
|
|
6051
|
+
{
|
|
6052
|
+
readOnly: true,
|
|
6053
|
+
className: "yudao-doc-code-area",
|
|
6054
|
+
value: JSON.stringify(validation.values, null, 2)
|
|
5293
6055
|
}
|
|
5294
|
-
)
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
6056
|
+
)
|
|
6057
|
+
] })
|
|
6058
|
+
] }) : /* @__PURE__ */ jsxs4("div", { style: { flex: 1, minHeight: 0, padding: 16, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
6059
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
6060
|
+
/* @__PURE__ */ jsxs4("span", { style: { fontSize: 12.5, fontWeight: 600, color: "#1b1c1f" }, children: [
|
|
6061
|
+
"Univer \u6807\u51C6 ",
|
|
6062
|
+
/* @__PURE__ */ jsx4("code", { children: "IDocumentData" }),
|
|
6063
|
+
" JSON\uFF08\u542B\u539F\u751F ",
|
|
6064
|
+
/* @__PURE__ */ jsx4("code", { children: "CustomRangeType.SDT" }),
|
|
6065
|
+
"\uFF09"
|
|
6066
|
+
] }),
|
|
6067
|
+
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 8 }, children: [
|
|
5305
6068
|
/* @__PURE__ */ jsx4(
|
|
5306
6069
|
"button",
|
|
5307
6070
|
{
|
|
5308
6071
|
type: "button",
|
|
5309
|
-
className: "yudao-doc-mini-btn
|
|
5310
|
-
onClick: () =>
|
|
5311
|
-
|
|
6072
|
+
className: "yudao-doc-mini-btn",
|
|
6073
|
+
onClick: () => {
|
|
6074
|
+
navigator.clipboard?.writeText(jsonEditorText);
|
|
6075
|
+
setStatusTip("\u5DF2\u590D\u5236 JSON \u5230\u526A\u8D34\u677F\uFF01");
|
|
6076
|
+
},
|
|
6077
|
+
children: "\u590D\u5236 JSON"
|
|
5312
6078
|
}
|
|
5313
6079
|
),
|
|
5314
6080
|
/* @__PURE__ */ jsx4(
|
|
5315
6081
|
"button",
|
|
5316
6082
|
{
|
|
5317
6083
|
type: "button",
|
|
5318
|
-
className: "yudao-doc-mini-btn
|
|
5319
|
-
onClick:
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
),
|
|
5333
|
-
/* @__PURE__ */ jsx4(
|
|
5334
|
-
"button",
|
|
5335
|
-
{
|
|
5336
|
-
type: "button",
|
|
5337
|
-
className: "yudao-doc-mini-btn yudao-doc-export-btn",
|
|
5338
|
-
onClick: () => handleDownload("html"),
|
|
5339
|
-
children: "\u5BFC\u51FA (.html)"
|
|
5340
|
-
}
|
|
5341
|
-
),
|
|
5342
|
-
/* @__PURE__ */ jsx4(
|
|
5343
|
-
"button",
|
|
5344
|
-
{
|
|
5345
|
-
type: "button",
|
|
5346
|
-
className: "yudao-doc-mini-btn yudao-doc-export-btn",
|
|
5347
|
-
onClick: () => handleDownload("md"),
|
|
5348
|
-
children: "\u5BFC\u51FA Markdown (.md)"
|
|
5349
|
-
}
|
|
5350
|
-
),
|
|
5351
|
-
/* @__PURE__ */ jsx4(
|
|
5352
|
-
"button",
|
|
5353
|
-
{
|
|
5354
|
-
type: "button",
|
|
5355
|
-
className: "yudao-doc-mini-btn yudao-doc-export-btn",
|
|
5356
|
-
onClick: () => {
|
|
5357
|
-
iframeRef.current?.contentWindow?.focus();
|
|
5358
|
-
iframeRef.current?.contentWindow?.print();
|
|
5359
|
-
},
|
|
5360
|
-
children: "A4 \u77E2\u91CF\u6253\u5370"
|
|
5361
|
-
}
|
|
5362
|
-
)
|
|
5363
|
-
] }),
|
|
5364
|
-
ioAdapter.onSave && /* @__PURE__ */ jsx4(
|
|
5365
|
-
"button",
|
|
5366
|
-
{
|
|
5367
|
-
type: "button",
|
|
5368
|
-
className: "yudao-doc-mini-btn yudao-doc-export-btn",
|
|
5369
|
-
onClick: handleSaveToHost,
|
|
5370
|
-
children: "\u4FDD\u5B58\u6A21\u677F\u81F3\u5BBF\u4E3B\u540E\u7AEF"
|
|
6084
|
+
className: "yudao-doc-mini-btn is-primary",
|
|
6085
|
+
onClick: () => {
|
|
6086
|
+
try {
|
|
6087
|
+
const parsed = JSON.parse(jsonEditorText);
|
|
6088
|
+
commandService.syncExecuteCommand(ReplaceDocUnitSnapshotCommand3.id, {
|
|
6089
|
+
unitId: unit.getUnitId(),
|
|
6090
|
+
snapshot: parsed
|
|
6091
|
+
});
|
|
6092
|
+
setStatusTip("\u5DF2\u5E94\u7528 JSON \u5FEB\u7167\uFF08\u652F\u6301 Ctrl+Z \u64A4\u9500\uFF09\uFF01");
|
|
6093
|
+
} catch (err) {
|
|
6094
|
+
setStatusTip(`JSON \u683C\u5F0F\u6709\u8BEF: ${err?.message || String(err)}`);
|
|
6095
|
+
}
|
|
6096
|
+
},
|
|
6097
|
+
children: "\u5E94\u7528\u7F16\u8F91\u5668\u4E2D\u7684 JSON"
|
|
5371
6098
|
}
|
|
5372
6099
|
)
|
|
5373
|
-
] })
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
{
|
|
5377
|
-
style: {
|
|
5378
|
-
fontSize: 11.5,
|
|
5379
|
-
color: "#2c53f1",
|
|
5380
|
-
background: "#f3f5ff",
|
|
5381
|
-
border: "1px solid #d2dafa",
|
|
5382
|
-
padding: "6px 8px",
|
|
5383
|
-
borderRadius: 6
|
|
5384
|
-
},
|
|
5385
|
-
children: statusTip
|
|
5386
|
-
}
|
|
5387
|
-
)
|
|
5388
|
-
]
|
|
5389
|
-
}
|
|
5390
|
-
),
|
|
5391
|
-
/* @__PURE__ */ jsx4("div", { style: { flex: 1, background: "#eeeff1", padding: 20, overflow: "auto" }, children: /* @__PURE__ */ jsx4(
|
|
5392
|
-
"iframe",
|
|
5393
|
-
{
|
|
5394
|
-
ref: iframeRef,
|
|
5395
|
-
title: "Word Document Preview",
|
|
5396
|
-
srcDoc: previewHtml,
|
|
5397
|
-
style: {
|
|
5398
|
-
width: "100%",
|
|
5399
|
-
height: "100%",
|
|
5400
|
-
border: "1px solid #e3e5ea",
|
|
5401
|
-
background: "#ffffff",
|
|
5402
|
-
borderRadius: 4,
|
|
5403
|
-
boxShadow: "0 4px 16px rgba(27, 28, 31, 0.08)"
|
|
5404
|
-
}
|
|
5405
|
-
}
|
|
5406
|
-
) })
|
|
5407
|
-
] }) : tab === "form" ? /* @__PURE__ */ jsxs4("div", { style: { flex: 1, minHeight: 0, padding: 18, display: "flex", gap: 16 }, children: [
|
|
5408
|
-
/* @__PURE__ */ jsxs4("div", { style: { width: 320, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
5409
|
-
/* @__PURE__ */ jsx4(
|
|
5410
|
-
"div",
|
|
5411
|
-
{
|
|
5412
|
-
style: {
|
|
5413
|
-
padding: "12px 14px",
|
|
5414
|
-
borderRadius: 8,
|
|
5415
|
-
background: validation.valid ? "#f3f5ff" : "#f9fafb",
|
|
5416
|
-
border: `1px solid ${validation.valid ? "#d2dafa" : "#e3e5ea"}`,
|
|
5417
|
-
color: validation.valid ? "#2c53f1" : "#1b1c1f",
|
|
5418
|
-
fontWeight: 600,
|
|
5419
|
-
fontSize: 12.5
|
|
5420
|
-
},
|
|
5421
|
-
children: validation.valid ? "\u6240\u6709\u5FC5\u586B\u7ED3\u6784\u5316\u63A7\u4EF6\u5747\u5DF2\u5408\u89C4\u586B\u5199\u5B8C\u6BD5" : `\u5B58\u5728 ${validation.issues.length} \u4E2A\u7ED3\u6784\u5316\u63A7\u4EF6\u5F85\u586B\u5199\u6216\u683C\u5F0F\u672A\u901A\u8FC7`
|
|
5422
|
-
}
|
|
5423
|
-
),
|
|
5424
|
-
validation.issues.map((it) => /* @__PURE__ */ jsxs4(
|
|
5425
|
-
"div",
|
|
5426
|
-
{
|
|
5427
|
-
style: {
|
|
5428
|
-
padding: "8px 10px",
|
|
5429
|
-
borderRadius: 6,
|
|
5430
|
-
background: "#f9fafb",
|
|
5431
|
-
border: "1px solid #e3e5ea",
|
|
5432
|
-
borderLeft: "2px solid #d93025",
|
|
5433
|
-
color: "#31363f",
|
|
5434
|
-
fontSize: 12
|
|
5435
|
-
},
|
|
5436
|
-
children: [
|
|
5437
|
-
"\u2022 ",
|
|
5438
|
-
it.message,
|
|
5439
|
-
" (",
|
|
5440
|
-
/* @__PURE__ */ jsx4("code", { children: it.tag }),
|
|
5441
|
-
")"
|
|
5442
|
-
]
|
|
5443
|
-
},
|
|
5444
|
-
it.controlId
|
|
5445
|
-
))
|
|
5446
|
-
] }),
|
|
5447
|
-
/* @__PURE__ */ jsxs4("div", { style: { flex: 1, display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
5448
|
-
/* @__PURE__ */ jsxs4("div", { style: { fontSize: 12.5, fontWeight: 600, color: "#1b1c1f" }, children: [
|
|
5449
|
-
"\u63D0\u53D6\u7684\u7ED3\u6784\u5316\u8868\u5355\u952E\u503C JSON (",
|
|
5450
|
-
/* @__PURE__ */ jsx4("code", { children: "getFormValues()" }),
|
|
5451
|
-
")\uFF1A"
|
|
5452
|
-
] }),
|
|
5453
|
-
/* @__PURE__ */ jsx4(
|
|
5454
|
-
"textarea",
|
|
5455
|
-
{
|
|
5456
|
-
readOnly: true,
|
|
5457
|
-
className: "yudao-doc-code-area",
|
|
5458
|
-
value: JSON.stringify(validation.values, null, 2)
|
|
5459
|
-
}
|
|
5460
|
-
)
|
|
5461
|
-
] })
|
|
5462
|
-
] }) : /* @__PURE__ */ jsxs4("div", { style: { flex: 1, minHeight: 0, padding: 16, display: "flex", flexDirection: "column", gap: 10 }, children: [
|
|
5463
|
-
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
5464
|
-
/* @__PURE__ */ jsxs4("span", { style: { fontSize: 12.5, fontWeight: 600, color: "#1b1c1f" }, children: [
|
|
5465
|
-
"Univer \u6807\u51C6 ",
|
|
5466
|
-
/* @__PURE__ */ jsx4("code", { children: "IDocumentData" }),
|
|
5467
|
-
" JSON\uFF08\u542B\u539F\u751F ",
|
|
5468
|
-
/* @__PURE__ */ jsx4("code", { children: "CustomRangeType.SDT" }),
|
|
5469
|
-
"\uFF09"
|
|
5470
|
-
] }),
|
|
5471
|
-
/* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 8 }, children: [
|
|
5472
|
-
/* @__PURE__ */ jsx4(
|
|
5473
|
-
"button",
|
|
5474
|
-
{
|
|
5475
|
-
type: "button",
|
|
5476
|
-
className: "yudao-doc-mini-btn",
|
|
5477
|
-
onClick: () => {
|
|
5478
|
-
navigator.clipboard?.writeText(jsonEditorText);
|
|
5479
|
-
setStatusTip("\u5DF2\u590D\u5236 JSON \u5230\u526A\u8D34\u677F\uFF01");
|
|
5480
|
-
},
|
|
5481
|
-
children: "\u590D\u5236 JSON"
|
|
5482
|
-
}
|
|
5483
|
-
),
|
|
6100
|
+
] })
|
|
6101
|
+
] }),
|
|
6102
|
+
statusTip && /* @__PURE__ */ jsx4("div", { style: { fontSize: 12, color: "#2c53f1" }, children: statusTip }),
|
|
5484
6103
|
/* @__PURE__ */ jsx4(
|
|
5485
|
-
"
|
|
6104
|
+
"textarea",
|
|
5486
6105
|
{
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
try {
|
|
5491
|
-
const parsed = JSON.parse(jsonEditorText);
|
|
5492
|
-
commandService.syncExecuteCommand(ReplaceDocUnitSnapshotCommand3.id, {
|
|
5493
|
-
unitId: unit.getUnitId(),
|
|
5494
|
-
snapshot: parsed
|
|
5495
|
-
});
|
|
5496
|
-
setStatusTip("\u5DF2\u5E94\u7528 JSON \u5FEB\u7167\uFF08\u652F\u6301 Ctrl+Z \u64A4\u9500\uFF09\uFF01");
|
|
5497
|
-
} catch (err) {
|
|
5498
|
-
setStatusTip(`JSON \u683C\u5F0F\u6709\u8BEF: ${err?.message || String(err)}`);
|
|
5499
|
-
}
|
|
5500
|
-
},
|
|
5501
|
-
children: "\u5E94\u7528\u7F16\u8F91\u5668\u4E2D\u7684 JSON"
|
|
6106
|
+
className: "yudao-doc-code-area",
|
|
6107
|
+
value: jsonEditorText,
|
|
6108
|
+
onChange: (e) => setJsonEditorText(e.target.value)
|
|
5502
6109
|
}
|
|
5503
6110
|
)
|
|
5504
6111
|
] })
|
|
5505
|
-
]
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
"textarea",
|
|
5509
|
-
{
|
|
5510
|
-
className: "yudao-doc-code-area",
|
|
5511
|
-
value: jsonEditorText,
|
|
5512
|
-
onChange: (e) => setJsonEditorText(e.target.value)
|
|
5513
|
-
}
|
|
5514
|
-
)
|
|
5515
|
-
] })
|
|
5516
|
-
] }) });
|
|
6112
|
+
]
|
|
6113
|
+
}
|
|
6114
|
+
) });
|
|
5517
6115
|
};
|
|
5518
6116
|
|
|
5519
6117
|
// src/views/popup/DocSdtCanvasPopupHost.tsx
|
|
@@ -7681,6 +8279,7 @@ UniverDocsExtUIPlugin = __decorateClass([
|
|
|
7681
8279
|
__decorateParam(1, Inject2(Injector2))
|
|
7682
8280
|
], UniverDocsExtUIPlugin);
|
|
7683
8281
|
export {
|
|
8282
|
+
DOC_IMPORT_ACCEPT_EXTENSIONS,
|
|
7684
8283
|
DOC_INSPECTOR_COMPONENT_KEY,
|
|
7685
8284
|
DOC_INSPECTOR_SIDEBAR_ID,
|
|
7686
8285
|
DocInspectorPanel,
|