@yudaocode/univer-sheets-ui 1.6.210 → 1.6.212

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/es/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  zhCN,
3
3
  zh_CN_default
4
- } from "./chunk-AB543OUU.js";
4
+ } from "./chunk-IPJHJPI2.js";
5
5
  import {
6
6
  enUS,
7
7
  en_US_default
8
- } from "./chunk-KJM4CK3I.js";
8
+ } from "./chunk-KB7JKXVX.js";
9
9
  import {
10
10
  __decorateClass,
11
11
  __decorateParam
@@ -183,37 +183,51 @@ var OpenSheetModalOperation = {
183
183
  return true;
184
184
  }
185
185
  };
186
+ function mergeImportedTemplateMetadata(prevMeta, importedMeta) {
187
+ const next = { ...prevMeta, ...importedMeta };
188
+ if (!importedMeta.charts) delete next.charts;
189
+ return next;
190
+ }
186
191
  var ImportSheetFileOperation = {
187
192
  id: "yudao-sheets-ui.operation.import-file",
188
193
  type: CommandType.OPERATION,
189
194
  handler: (accessor, params) => {
190
- if (typeof document === "undefined") return false;
191
195
  const commandService = accessor.get(ICommandService);
196
+ if (!params?.file) {
197
+ if (commandService.hasCommand(OpenSheetModalOperation.id)) {
198
+ return commandService.syncExecuteCommand(OpenSheetModalOperation.id, { tab: "import" });
199
+ }
200
+ accessor.get(ISheetsUIFeatureService).openModal("import");
201
+ return true;
202
+ }
203
+ const file = params.file;
192
204
  const instanceService = accessor.get(IUniverInstanceService);
193
205
  const ioService = accessor.get(ISheetIoService);
194
206
  const templateService = accessor.get(ISheetTemplateService);
195
- const input = document.createElement("input");
196
- input.type = "file";
197
- input.accept = ".xlsx,.xls,.xml,.csv,.json";
198
- input.onchange = async () => {
199
- const file = input.files?.[0];
200
- if (!file) return;
201
- const workbook = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
202
- if (!workbook) return;
203
- const unitId = workbook.getUnitId();
204
- const imported = await ioService.importSheet(file, unitId, {
205
- target: params?.target
206
- });
207
+ const workbook = instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
208
+ if (!workbook) return false;
209
+ const unitId = workbook.getUnitId();
210
+ return ioService.importSheetWithReport(file, {
211
+ unitId,
212
+ target: params.target
213
+ }).then((outcome) => {
214
+ const imported = outcome.snapshot ?? outcome.workbookData;
207
215
  const prevMeta = templateService.getTemplateMetadata(unitId);
208
216
  const xmlMeta = imported.__templateMetadata ?? {};
209
- commandService.syncExecuteCommand(ApplyImportedWorkbookDataCommand.id, {
217
+ const mergedBase = mergeImportedTemplateMetadata(prevMeta, xmlMeta);
218
+ const nextMeta = {
219
+ ...mergedBase,
220
+ ...imported.definedNames ? { definedNames: imported.definedNames } : {},
221
+ ...typeof imported.workbookStructureLocked === "boolean" ? { workbookStructureLocked: imported.workbookStructureLocked } : {},
222
+ ...imported.conditionalRules ? { conditionalRules: imported.conditionalRules } : {},
223
+ ...imported.cellNotes ? { cellNotes: imported.cellNotes } : {}
224
+ };
225
+ return commandService.syncExecuteCommand(ApplyImportedWorkbookDataCommand.id, {
210
226
  unitId,
211
227
  workbookData: imported,
212
- metadata: { ...prevMeta, ...xmlMeta }
228
+ metadata: nextMeta
213
229
  });
214
- };
215
- input.click();
216
- return true;
230
+ });
217
231
  }
218
232
  };
219
233
  var FillSheetSampleDatasetOperation = {
@@ -376,6 +390,9 @@ var SheetInspectorPanel = () => {
376
390
  const [chartTrendline, setChartTrendline] = useState("none");
377
391
  const [chartLogScale, setChartLogScale] = useState(false);
378
392
  const [chartThreeD, setChartThreeD] = useState(false);
393
+ const [chartSmooth, setChartSmooth] = useState(false);
394
+ const [chartShowLegend, setChartShowLegend] = useState(true);
395
+ const [chartLegendPos, setChartLegendPos] = useState("right");
379
396
  const [auditOutput, setAuditOutput] = useState("");
380
397
  const [goalTargetCell, setGoalTargetCell] = useState("F10");
381
398
  const [goalTargetValue, setGoalTargetValue] = useState("1000");
@@ -2119,7 +2136,18 @@ var SheetInspectorPanel = () => {
2119
2136
  }
2120
2137
  )
2121
2138
  ] }),
2122
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 8, paddingBottom: 4, fontSize: 11, color: "#31363F" }, children: [
2139
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, paddingBottom: 4, fontSize: 11, color: "#31363F" }, children: [
2140
+ /* @__PURE__ */ jsxs2("label", { style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" }, children: [
2141
+ /* @__PURE__ */ jsx2(
2142
+ "input",
2143
+ {
2144
+ type: "checkbox",
2145
+ checked: chartSmooth || chartType.endsWith("Smooth"),
2146
+ onChange: (e) => setChartSmooth(e.target.checked)
2147
+ }
2148
+ ),
2149
+ /* @__PURE__ */ jsx2("span", { children: "\u5E73\u6ED1\u66F2\u7EBF" })
2150
+ ] }),
2123
2151
  /* @__PURE__ */ jsxs2("label", { style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" }, children: [
2124
2152
  /* @__PURE__ */ jsx2(
2125
2153
  "input",
@@ -2144,6 +2172,51 @@ var SheetInspectorPanel = () => {
2144
2172
  ] })
2145
2173
  ] })
2146
2174
  ] }),
2175
+ /* @__PURE__ */ jsxs2("div", { style: { display: "grid", gridTemplateColumns: "0.9fr 1.1fr", gap: 4, alignItems: "end" }, children: [
2176
+ /* @__PURE__ */ jsxs2(
2177
+ "label",
2178
+ {
2179
+ style: {
2180
+ display: "flex",
2181
+ alignItems: "center",
2182
+ gap: 6,
2183
+ paddingBottom: 4,
2184
+ fontSize: 11,
2185
+ color: "#31363F",
2186
+ cursor: "pointer"
2187
+ },
2188
+ children: [
2189
+ /* @__PURE__ */ jsx2(
2190
+ "input",
2191
+ {
2192
+ type: "checkbox",
2193
+ checked: chartShowLegend,
2194
+ onChange: (e) => setChartShowLegend(e.target.checked)
2195
+ }
2196
+ ),
2197
+ /* @__PURE__ */ jsx2("span", { children: "\u663E\u793A\u56FE\u4F8B" })
2198
+ ]
2199
+ }
2200
+ ),
2201
+ /* @__PURE__ */ jsxs2("label", { className: "yudao-sheet-field-row", children: [
2202
+ /* @__PURE__ */ jsx2("span", { children: "\u56FE\u4F8B\u4F4D\u7F6E" }),
2203
+ /* @__PURE__ */ jsxs2(
2204
+ "select",
2205
+ {
2206
+ value: chartLegendPos,
2207
+ disabled: !chartShowLegend,
2208
+ onChange: (e) => setChartLegendPos(e.target.value),
2209
+ children: [
2210
+ /* @__PURE__ */ jsx2("option", { value: "right", children: "\u53F3\u4FA7 (Right)" }),
2211
+ /* @__PURE__ */ jsx2("option", { value: "top", children: "\u9876\u90E8 (Top)" }),
2212
+ /* @__PURE__ */ jsx2("option", { value: "bottom", children: "\u5E95\u90E8 (Bottom)" }),
2213
+ /* @__PURE__ */ jsx2("option", { value: "left", children: "\u5DE6\u4FA7 (Left)" }),
2214
+ /* @__PURE__ */ jsx2("option", { value: "topRight", children: "\u53F3\u4E0A\u89D2 (TopRight)" })
2215
+ ]
2216
+ }
2217
+ )
2218
+ ] })
2219
+ ] }),
2147
2220
  /* @__PURE__ */ jsxs2("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
2148
2221
  /* @__PURE__ */ jsx2(
2149
2222
  "button",
@@ -2151,6 +2224,7 @@ var SheetInspectorPanel = () => {
2151
2224
  type: "button",
2152
2225
  className: "yudao-sheet-btn is-soft-primary",
2153
2226
  onClick: () => {
2227
+ const isSmoothEnabled = chartType.startsWith("line") && (chartSmooth || chartType.endsWith("Smooth"));
2154
2228
  templateService.addOrUpdateChart(unitId, {
2155
2229
  id: `chart-${generateRandomId(5)}`,
2156
2230
  sheetId: sheet.getSheetId(),
@@ -2158,6 +2232,9 @@ var SheetInspectorPanel = () => {
2158
2232
  chartType,
2159
2233
  categoryRange: chartCatRange || "B6:B9",
2160
2234
  valueRange: chartValRange || "F6:F9",
2235
+ smooth: isSmoothEnabled ? true : void 0,
2236
+ showLegend: chartShowLegend,
2237
+ legendPosition: chartShowLegend ? chartLegendPos : void 0,
2161
2238
  trendline: chartTrendline !== "none" ? chartTrendline : void 0,
2162
2239
  yAxisScale: chartLogScale ? "log" : "linear",
2163
2240
  threeD: chartThreeD ? { rotX: 15, rotY: 20 } : void 0,
@@ -2176,6 +2253,7 @@ var SheetInspectorPanel = () => {
2176
2253
  type: "button",
2177
2254
  className: "yudao-sheet-btn",
2178
2255
  onClick: () => {
2256
+ const isSmoothEnabled = chartType.startsWith("line") && (chartSmooth || chartType.endsWith("Smooth"));
2179
2257
  commandService.syncExecuteCommand(InsertChartSheetCommand.id, {
2180
2258
  unitId,
2181
2259
  name: chartTitle || "\u56FE\u8868\u5DE5\u4F5C\u8868",
@@ -2186,6 +2264,9 @@ var SheetInspectorPanel = () => {
2186
2264
  chartType,
2187
2265
  categoryRange: chartCatRange || "B6:B9",
2188
2266
  valueRange: chartValRange || "F6:F9",
2267
+ smooth: isSmoothEnabled ? true : void 0,
2268
+ showLegend: chartShowLegend,
2269
+ legendPosition: chartShowLegend ? chartLegendPos : void 0,
2189
2270
  trendline: chartTrendline !== "none" ? chartTrendline : void 0,
2190
2271
  yAxisScale: chartLogScale ? "log" : "linear",
2191
2272
  threeD: chartThreeD ? { rotX: 15, rotY: 20 } : void 0,
@@ -3752,6 +3833,7 @@ import {
3752
3833
  filterDatasetsWithQueryParams,
3753
3834
  generateMockDatasetForTemplate,
3754
3835
  importSheetReportPackage as importSheetReportPackage2,
3836
+ inferSheetFileFormat,
3755
3837
  inspectWorkbookExportCapabilities,
3756
3838
  ISheetIoService as ISheetIoService3,
3757
3839
  ISheetTemplateService as ISheetTemplateService4,
@@ -3770,6 +3852,10 @@ var SheetPreviewAndIoModal = () => {
3770
3852
  const tab = useObservable4(featureService.modalTab$, featureService.getModalTab());
3771
3853
  const features = useObservable4(featureService.features$, featureService.getFeatures());
3772
3854
  const ioAdapter = useObservable4(ioService.adapter$, ioService.getAdapter());
3855
+ const defaultIoTargetPref = useObservable4(
3856
+ ioService.defaultIoTarget$,
3857
+ ioService.getDefaultIoTarget()
3858
+ );
3773
3859
  const workbook = useObservable4(
3774
3860
  () => instanceService.getCurrentTypeOfUnit$(UniverInstanceType4.UNIVER_SHEET),
3775
3861
  instanceService.getCurrentUnitOfType(UniverInstanceType4.UNIVER_SHEET),
@@ -3781,8 +3867,12 @@ var SheetPreviewAndIoModal = () => {
3781
3867
  const [jsonText, setJsonText] = useState3("");
3782
3868
  const [statusTip, setStatusTip] = useState3("");
3783
3869
  const [ioTarget, setIoTarget] = useState3("browser");
3870
+ const [exportFormat, setExportFormat] = useState3("xlsx");
3871
+ const [selectedImportFile, setSelectedImportFile] = useState3(null);
3872
+ const [pendingImport, setPendingImport] = useState3(null);
3873
+ const [ioError, setIoError] = useState3(null);
3874
+ const [lastIoAction, setLastIoAction] = useState3(null);
3784
3875
  const [skipDatasetOnExport, setSkipDatasetOnExport] = useState3(false);
3785
- const [importWarnings, setImportWarnings] = useState3([]);
3786
3876
  const [paginationEnabled, setPaginationEnabled] = useState3(false);
3787
3877
  const [pageIndex, setPageIndex] = useState3(1);
3788
3878
  const [pageSize, setPageSize] = useState3(50);
@@ -3793,6 +3883,10 @@ var SheetPreviewAndIoModal = () => {
3793
3883
  const [queryValues, setQueryValues] = useState3({});
3794
3884
  const metaVersion = useObservable4(templateService.metadataChange$, "");
3795
3885
  void metaVersion;
3886
+ void defaultIoTargetPref;
3887
+ const userTouchedTargetRef = useRef(false);
3888
+ const prevOpenRef = useRef(false);
3889
+ const fileInputRef = useRef(null);
3796
3890
  const [printCfg, setPrintCfg] = useState3({
3797
3891
  paperOrientation: "A4_LANDSCAPE",
3798
3892
  scaleMode: "all",
@@ -3896,7 +3990,10 @@ var SheetPreviewAndIoModal = () => {
3896
3990
  return () => sub.unsubscribe();
3897
3991
  }, [templateService, featureService, workbook]);
3898
3992
  useEffect3(() => {
3993
+ const justOpened = open && !prevOpenRef.current;
3994
+ prevOpenRef.current = open;
3899
3995
  if (!open || !workbook) return;
3996
+ if (!justOpened) return;
3900
3997
  const snap = workbook.save();
3901
3998
  const meta = templateService.getTemplateMetadata(workbook.getUnitId());
3902
3999
  const initialData = meta.sampleData ?? {};
@@ -3957,10 +4054,27 @@ var SheetPreviewAndIoModal = () => {
3957
4054
  )
3958
4055
  );
3959
4056
  setJsonText(JSON.stringify(snap, null, 2));
3960
- setIoTarget(ioService.getIoCapabilities().recommendedDefaultTarget);
3961
- setImportWarnings([]);
4057
+ userTouchedTargetRef.current = false;
4058
+ const initExportFmt = tab === "print" ? "pdf" : "xlsx";
4059
+ setExportFormat(initExportFmt);
4060
+ const caps = ioService.getIoCapabilities();
4061
+ const initOp = tab === "import" ? "import" : "export";
4062
+ const initFmt = initOp === "import" ? "xlsx" : initExportFmt;
4063
+ setIoTarget(caps.formats[initOp]?.[initFmt]?.defaultTarget ?? caps.recommendedDefaultTarget);
4064
+ setSelectedImportFile(null);
4065
+ setPendingImport(null);
4066
+ setIoError(null);
4067
+ setLastIoAction(null);
3962
4068
  setStatusTip("");
3963
- }, [open, workbook, features.datasetBinding, templateService, ioService, ioAdapter]);
4069
+ }, [open, tab, workbook, features.datasetBinding, templateService, ioService]);
4070
+ useEffect3(() => {
4071
+ if (!open || userTouchedTargetRef.current) return;
4072
+ const caps = ioService.getIoCapabilities();
4073
+ const op = tab === "import" ? "import" : "export";
4074
+ const fmt = op === "import" ? selectedImportFile ? inferSheetFileFormat(selectedImportFile.name) : "xlsx" : exportFormat;
4075
+ const nextDefault = caps.formats[op]?.[fmt]?.defaultTarget ?? caps.recommendedDefaultTarget;
4076
+ setIoTarget(nextDefault);
4077
+ }, [open, tab, exportFormat, selectedImportFile, ioAdapter, defaultIoTargetPref, ioService]);
3964
4078
  if (!open || !workbook) return null;
3965
4079
  const ioCaps = ioService.getIoCapabilities();
3966
4080
  const isCustomBackendAdapter = Boolean(
@@ -3968,6 +4082,12 @@ var SheetPreviewAndIoModal = () => {
3968
4082
  );
3969
4083
  const exportCapReport = inspectWorkbookExportCapabilities(workbook.save());
3970
4084
  const snapSizeKb = (exportCapReport.snapshotByteSize / 1024).toFixed(1);
4085
+ const activeIoOp = tab === "import" ? "import" : "export";
4086
+ const activeIoFormat = activeIoOp === "import" ? selectedImportFile ? inferSheetFileFormat(selectedImportFile.name) : "xlsx" : exportFormat;
4087
+ const activeFormatCap = ioCaps.formats[activeIoOp]?.[activeIoFormat];
4088
+ const browserAvailabilityLabel = (activeFormatCap ? activeFormatCap.browser : true) ? "\u53EF\u7528" : "\u4E0D\u652F\u6301\u5F53\u524D\u683C\u5F0F";
4089
+ const serverHasOpHook = activeIoOp === "import" ? ioCaps.server.importSheet : ioCaps.server.exportSheet;
4090
+ const serverAvailabilityLabel = !serverHasOpHook ? "\u672A\u63A5\u5165" : activeFormatCap && !activeFormatCap.server ? "\u4E0D\u652F\u6301\u5F53\u524D\u683C\u5F0F" : "\u53EF\u7528";
3971
4091
  const queryParamFields = templateService.getQueryParamFields(workbook.getUnitId());
3972
4092
  const rebuildPreview = (nextCfg, nextPaging, nextQueryVals) => {
3973
4093
  try {
@@ -4042,7 +4162,28 @@ var SheetPreviewAndIoModal = () => {
4042
4162
  );
4043
4163
  setStatusTip("\u5DF2\u6839\u636E\u6A21\u677F\u5360\u4F4D\u7B26\u81EA\u52A8\u751F\u6210\u7C7B\u578B\u5316\u6A21\u62DF\u6570\u636E\u96C6");
4044
4164
  };
4045
- const handleDownload = async (format) => {
4165
+ const triggerBrowserBlobDownload = (blob, downloadFileName) => {
4166
+ if (typeof URL === "undefined" || typeof URL.createObjectURL !== "function") {
4167
+ return;
4168
+ }
4169
+ const url = URL.createObjectURL(blob);
4170
+ if (typeof document !== "undefined") {
4171
+ const a = document.createElement("a");
4172
+ a.href = url;
4173
+ a.download = downloadFileName;
4174
+ a.click();
4175
+ }
4176
+ setTimeout(() => {
4177
+ if (typeof URL.revokeObjectURL === "function") {
4178
+ URL.revokeObjectURL(url);
4179
+ }
4180
+ }, 1e3);
4181
+ };
4182
+ const handleDownload = async (format, targetOverride) => {
4183
+ const effectiveTarget = targetOverride ?? ioTarget;
4184
+ setExportFormat(format);
4185
+ setLastIoAction({ kind: "export", format });
4186
+ setIoError(null);
4046
4187
  try {
4047
4188
  const unitId = workbook.getUnitId();
4048
4189
  const rawParsedData = format !== "xml" && features.datasetBinding && !skipDatasetOnExport ? JSON.parse(datasetText) : void 0;
@@ -4056,71 +4197,120 @@ var SheetPreviewAndIoModal = () => {
4056
4197
  printConfig: printCfg,
4057
4198
  metadata: templateService.getTemplateMetadata(unitId),
4058
4199
  implicitExpand: templateService.getImplicitExpand(unitId),
4059
- target: ioTarget
4200
+ target: effectiveTarget
4060
4201
  });
4061
- const mime = format === "xlsx" ? "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : format === "xls" ? "application/vnd.ms-excel" : format === "pdf" ? "application/pdf" : format === "docx" ? "application/vnd.openxmlformats-officedocument.wordprocessingml.document" : format === "xml" ? "application/xml;charset=utf-8" : format === "html" ? "text/html;charset=utf-8" : "text/csv;charset=utf-8";
4202
+ const mime = format === "xlsx" ? "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : format === "xls" ? "application/vnd.ms-excel" : format === "pdf" ? "application/pdf" : format === "docx" ? "application/vnd.openxmlformats-officedocument.wordprocessingml.document" : format === "xml" ? "application/xml;charset=utf-8" : format === "html" ? "text/html;charset=utf-8" : format === "json" ? "application/json;charset=utf-8" : "text/csv;charset=utf-8";
4062
4203
  const blob = new Blob([bytes.buffer], { type: mime });
4063
- const url = URL.createObjectURL(blob);
4064
- const a = document.createElement("a");
4065
- a.href = url;
4066
4204
  const ext = format === "xml" ? "report.xml" : format;
4067
- a.download = `${workbook.name || "workbook"}.${ext}`;
4068
- a.click();
4069
- setTimeout(() => URL.revokeObjectURL(url), 1e3);
4070
- const channelLabel = ioTarget === "server" ? `\u670D\u52A1\u7AEF (${ioAdapter.name})` : "\u6D4F\u89C8\u5668\u672C\u5730\u5F15\u64CE";
4205
+ triggerBrowserBlobDownload(blob, `${workbook.name || "workbook"}.${ext}`);
4206
+ const channelLabel = effectiveTarget === "server" ? `\u670D\u52A1\u7AEF (${ioAdapter.name})` : "\u6D4F\u89C8\u5668\u672C\u5730\u5F15\u64CE";
4071
4207
  setStatusTip(`\u5DF2\u901A\u8FC7 ${channelLabel} \u5BFC\u51FA .${ext} \u6587\u4EF6`);
4072
4208
  } catch (err) {
4073
- const hint = err?.suggestedFallback === "server" ? "\uFF08\u672A\u81EA\u52A8\u9759\u9ED8\u964D\u7EA7\uFF0C\u53EF\u5207\u6362\u4E3A\u300C\u670D\u52A1\u7AEF\u5904\u7406\u300D\u91CD\u8BD5\uFF09" : "";
4074
- setStatusTip(`\u5BFC\u51FA\u5931\u8D25: ${err?.message || String(err)}${hint}`);
4209
+ const exactMessage = err?.message || String(err);
4210
+ setIoError(exactMessage);
4211
+ setStatusTip(`\u5BFC\u51FA\u5931\u8D25: ${exactMessage}`);
4075
4212
  }
4076
4213
  };
4077
- const handleImportBySelectedTarget = () => {
4078
- const input = document.createElement("input");
4079
- input.type = "file";
4080
- input.accept = ".xlsx,.xls,.xml,.csv,.json";
4081
- input.onchange = async () => {
4082
- const file = input.files?.[0];
4083
- if (!file) return;
4084
- setImportWarnings([]);
4085
- try {
4086
- const unitId = workbook.getUnitId();
4087
- const outcome = await ioService.importSheetWithReport(file, {
4088
- unitId,
4089
- target: ioTarget
4090
- });
4091
- const imported = outcome.workbookData;
4092
- const prevMeta = templateService.getTemplateMetadata(unitId);
4093
- const xmlMeta = imported.__templateMetadata ?? {};
4094
- const nextMeta = { ...prevMeta, ...xmlMeta };
4095
- commandService.syncExecuteCommand(ApplyImportedWorkbookDataCommand3.id, {
4096
- unitId,
4097
- workbookData: imported,
4098
- metadata: nextMeta
4099
- });
4100
- if (nextMeta.printConfig) {
4101
- setPrintCfg((prev) => ({ ...prev, ...nextMeta.printConfig }));
4102
- }
4103
- setImportWarnings(outcome.warnings.map((w) => w.message));
4104
- setJsonText(JSON.stringify(workbook.save(), null, 2));
4105
- setPreviewHtml(
4106
- renderPreviewSnapshotHtml(
4107
- workbook.save(),
4108
- void 0,
4109
- { ...printCfg, ...nextMeta.printConfig ?? {} },
4110
- paginationEnabled,
4111
- pageIndex,
4112
- pageSize
4113
- )
4114
- );
4115
- setStatusTip(
4116
- `\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`
4117
- );
4118
- } catch (err) {
4119
- 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" : "";
4120
- setStatusTip(`\u5BFC\u5165\u5931\u8D25: ${err?.message || String(err)}${hint}`);
4121
- }
4214
+ const runStagedImport = async (file, targetOverride) => {
4215
+ const effectiveTarget = targetOverride ?? ioTarget;
4216
+ setSelectedImportFile(file);
4217
+ setLastIoAction({ kind: "import", file });
4218
+ setIoError(null);
4219
+ setPendingImport(null);
4220
+ try {
4221
+ const unitId = workbook.getUnitId();
4222
+ const outcome = await ioService.importSheetWithReport(file, {
4223
+ unitId,
4224
+ target: effectiveTarget
4225
+ });
4226
+ const snapshot = outcome.snapshot ?? outcome.workbookData;
4227
+ setPendingImport({
4228
+ snapshot,
4229
+ warnings: outcome.warnings,
4230
+ executedBy: outcome.executedBy,
4231
+ fileName: outcome.fileName || file.name
4232
+ });
4233
+ setStatusTip(
4234
+ `\u5DF2\u901A\u8FC7${outcome.executedBy === "server" ? "\u670D\u52A1\u7AEF\u5904\u7406" : "\u6D4F\u89C8\u5668\u5904\u7406"}\u5B8C\u6210\u89E3\u6790\u300C${outcome.fileName || file.name}\u300D\uFF0C\u8BF7\u786E\u8BA4\u540E\u5E94\u7528\u5230\u8BBE\u8BA1\u5668`
4235
+ );
4236
+ } catch (err) {
4237
+ const exactMessage = err?.message || String(err);
4238
+ setIoError(exactMessage);
4239
+ setStatusTip(`\u5BFC\u5165\u5931\u8D25: ${exactMessage}`);
4240
+ }
4241
+ };
4242
+ const handleFileInputChange = (e) => {
4243
+ const file = e.target.files?.[0];
4244
+ if (e.target) {
4245
+ e.target.value = "";
4246
+ }
4247
+ if (!file) return;
4248
+ void runStagedImport(file);
4249
+ };
4250
+ const handleConfirmStagedImport = () => {
4251
+ if (!pendingImport) return;
4252
+ const unitId = workbook.getUnitId();
4253
+ const imported = pendingImport.snapshot;
4254
+ const prevMeta = templateService.getTemplateMetadata(unitId);
4255
+ const xmlMeta = imported.__templateMetadata ?? {};
4256
+ const mergedBase = mergeImportedTemplateMetadata(prevMeta, xmlMeta);
4257
+ const nextMeta = {
4258
+ ...mergedBase,
4259
+ ...imported.definedNames ? { definedNames: imported.definedNames } : {},
4260
+ ...typeof imported.workbookStructureLocked === "boolean" ? { workbookStructureLocked: imported.workbookStructureLocked } : {},
4261
+ ...imported.conditionalRules ? { conditionalRules: imported.conditionalRules } : {},
4262
+ ...imported.cellNotes ? { cellNotes: imported.cellNotes } : {}
4122
4263
  };
4123
- input.click();
4264
+ commandService.syncExecuteCommand(ApplyImportedWorkbookDataCommand3.id, {
4265
+ unitId,
4266
+ workbookData: imported,
4267
+ metadata: nextMeta
4268
+ });
4269
+ const effectivePrintCfg = nextMeta.printConfig ? { ...printCfg, ...nextMeta.printConfig } : printCfg;
4270
+ if (nextMeta.printConfig) {
4271
+ setPrintCfg(effectivePrintCfg);
4272
+ }
4273
+ setPendingImport(null);
4274
+ setIoError(null);
4275
+ setJsonText(JSON.stringify(workbook.save(), null, 2));
4276
+ setPreviewHtml(
4277
+ renderPreviewSnapshotHtml(
4278
+ workbook.save(),
4279
+ void 0,
4280
+ effectivePrintCfg,
4281
+ paginationEnabled,
4282
+ pageIndex,
4283
+ pageSize
4284
+ )
4285
+ );
4286
+ setStatusTip("\u5DF2\u5E94\u7528\u5230\u5F53\u524D\u8BBE\u8BA1\u5668\uFF08\u672A\u843D\u5E93\uFF0C\u8BF7\u4F7F\u7528\u4FDD\u5B58\u64CD\u4F5C\u6301\u4E45\u5316\uFF09");
4287
+ };
4288
+ const handleCancelStagedImport = () => {
4289
+ setPendingImport(null);
4290
+ setIoError(null);
4291
+ setStatusTip("\u5DF2\u53D6\u6D88\u672C\u6B21\u5BFC\u5165\uFF0C\u5F53\u524D\u5DE5\u4F5C\u7C3F\u672A\u53D1\u751F\u53D8\u66F4");
4292
+ };
4293
+ const handleSwitchTargetAndRetry = () => {
4294
+ const nextTarget = ioTarget === "server" ? "browser" : "server";
4295
+ userTouchedTargetRef.current = true;
4296
+ setIoTarget(nextTarget);
4297
+ setIoError(null);
4298
+ if (lastIoAction?.kind === "import") {
4299
+ const retryFile = lastIoAction.file ?? selectedImportFile;
4300
+ if (retryFile) {
4301
+ void runStagedImport(retryFile, nextTarget);
4302
+ }
4303
+ return;
4304
+ }
4305
+ if (lastIoAction?.kind === "export") {
4306
+ void handleDownload(lastIoAction.format, nextTarget);
4307
+ return;
4308
+ }
4309
+ if (selectedImportFile && tab === "import") {
4310
+ void runStagedImport(selectedImportFile, nextTarget);
4311
+ return;
4312
+ }
4313
+ void handleDownload(exportFormat, nextTarget);
4124
4314
  };
4125
4315
  const handleExportReportPackage = () => {
4126
4316
  try {
@@ -4130,12 +4320,7 @@ var SheetPreviewAndIoModal = () => {
4130
4320
  templateService.getTemplateMetadata(unitId)
4131
4321
  );
4132
4322
  const blob = new Blob([json], { type: "application/json;charset=utf-8" });
4133
- const url = URL.createObjectURL(blob);
4134
- const a = document.createElement("a");
4135
- a.href = url;
4136
- a.download = `${workbook.name || "report"}.yudao-sheet.json`;
4137
- a.click();
4138
- setTimeout(() => URL.revokeObjectURL(url), 1e3);
4323
+ triggerBrowserBlobDownload(blob, `${workbook.name || "report"}.yudao-sheet.json`);
4139
4324
  setStatusTip("\u5DF2\u5BFC\u51FA\u5B8C\u6574\u62A5\u8868\u8FC1\u79FB\u5305 (.yudao-sheet.json)");
4140
4325
  } catch (err) {
4141
4326
  setStatusTip(`\u5BFC\u51FA\u8FC1\u79FB\u5305\u5931\u8D25: ${err?.message || String(err)}`);
@@ -4201,1089 +4386,1256 @@ var SheetPreviewAndIoModal = () => {
4201
4386
  setStatusTip("\u5DF2\u5524\u8D77\u6D4F\u89C8\u5668\u77E2\u91CF\u6253\u5370\u5E76\u89E6\u53D1 onAfterPrint / onSheetPrintConfirmed \u6253\u5370\u5B8C\u6210\u56DE\u8C03");
4202
4387
  }
4203
4388
  };
4204
- return /* @__PURE__ */ jsx4("div", { className: "yudao-sheet-modal-backdrop", onClick: handleCloseModal, children: /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-card", onClick: (e) => e.stopPropagation(), children: [
4205
- /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-header", children: [
4206
- /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-tabs", children: [
4207
- /* @__PURE__ */ jsx4(
4208
- "button",
4209
- {
4210
- type: "button",
4211
- className: `yudao-sheet-modal-tab ${tab === "export" ? "is-active" : ""}`,
4212
- onClick: () => featureService.setModalTab("export"),
4213
- children: t("yudaoSheets.modal.tabExport")
4214
- }
4215
- ),
4216
- features.printTemplate && /* @__PURE__ */ jsx4(
4217
- "button",
4218
- {
4219
- type: "button",
4220
- className: `yudao-sheet-modal-tab ${tab === "print" ? "is-active" : ""}`,
4221
- onClick: () => featureService.setModalTab("print"),
4222
- children: t("yudaoSheets.modal.tabPrint")
4223
- }
4224
- ),
4225
- /* @__PURE__ */ jsx4(
4226
- "button",
4227
- {
4228
- type: "button",
4229
- className: `yudao-sheet-modal-tab ${tab === "json" ? "is-active" : ""}`,
4230
- onClick: () => featureService.setModalTab("json"),
4231
- children: t("yudaoSheets.modal.tabJson")
4232
- }
4233
- )
4234
- ] }),
4235
- /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
4236
- /* @__PURE__ */ jsxs4(
4237
- "span",
4238
- {
4239
- style: {
4240
- fontSize: 11,
4241
- padding: "3px 8px",
4242
- borderRadius: 999,
4243
- background: isCustomBackendAdapter ? "#F3F5FF" : "#EEEFF1",
4244
- color: isCustomBackendAdapter ? "#2C53F1" : "#4E5565",
4245
- border: `1px solid ${isCustomBackendAdapter ? "#D2DAFA" : "transparent"}`,
4246
- fontWeight: 500
4247
- },
4248
- children: [
4249
- t("yudaoSheets.modal.ioPipelinePrefix"),
4250
- ": ",
4251
- ioAdapter.name || "frontend-default"
4252
- ]
4253
- }
4254
- ),
4255
- /* @__PURE__ */ jsx4(
4256
- "button",
4257
- {
4258
- type: "button",
4259
- className: "yudao-sheet-btn",
4260
- onClick: handleCloseModal,
4261
- children: "\xD7"
4262
- }
4263
- )
4264
- ] })
4265
- ] }),
4266
- tab === "export" || tab === "print" ? /* @__PURE__ */ jsxs4("div", { style: { flex: 1, minHeight: 0, display: "flex" }, children: [
4267
- /* @__PURE__ */ jsxs4(
4268
- "div",
4269
- {
4270
- style: {
4271
- width: tab === "export" && features.datasetBinding ? 330 : 305,
4272
- borderRight: "1px solid #E3E5EA",
4273
- padding: 14,
4274
- display: "flex",
4275
- flexDirection: "column",
4276
- gap: 8,
4277
- background: "#F9FAFB",
4278
- overflowY: "auto"
4279
- },
4280
- children: [
4281
- tab === "export" ? features.datasetBinding ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
4282
- /* @__PURE__ */ jsx4("div", { style: { fontSize: 12, fontWeight: 600, color: "#1B1C1F" }, children: "\u6D4B\u8BD5\u6570\u636E\u96C6 JSON\uFF08\u652F\u6301\u5E76\u6392\u5206\u533A\u3001\u4E3B\u5B50\u5757\u3001\u5E73\u94FA\u5361\u7247\u4E0E\u516C\u5F0F\u91CD\u5199\uFF09" }),
4283
- /* @__PURE__ */ jsx4(
4284
- "textarea",
4285
- {
4286
- className: "yudao-sheet-code-area",
4287
- value: datasetText,
4288
- onChange: (e) => setDatasetText(e.target.value)
4289
- }
4290
- ),
4291
- /* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 6, flexWrap: "wrap" }, children: [
4292
- /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: () => rebuildPreview(), children: t("yudaoSheets.modal.refreshPreviewBtn") }),
4293
- /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleGenerateMockDataset, children: t("yudaoSheets.modal.mockDatasetBtn") }),
4294
- /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleApplyToSheet, children: t("yudaoSheets.modal.applyToSheetBtn") })
4295
- ] })
4296
- ] }) : /* @__PURE__ */ jsxs4("div", { style: { fontSize: 12, color: "#4E5565", lineHeight: 1.6 }, children: [
4297
- "\u5F53\u524D\u5904\u4E8E\u7EAF\u51C0\u7535\u5B50\u8868\u683C\u6A21\u5F0F\u3002\u5185\u7F6E\u96F6\u5916\u90E8\u4F9D\u8D56\u7684 OOXML \u4E0E\u77E2\u91CF PDF \u5F15\u64CE\uFF0C\u53EF\u76F4\u63A5\u5BFC\u51FA\u4FDD\u7559\u516C\u5F0F\u3001\u5408\u5E76\u5355\u5143\u683C\u3001\u5B57\u4F53\u989C\u8272\u4E0E\u8FB9\u6846\u7684\u6807\u51C6",
4298
- " ",
4299
- /* @__PURE__ */ jsx4("code", { children: ".xlsx" }),
4300
- " \u4E0E ",
4301
- /* @__PURE__ */ jsx4("code", { children: ".pdf" }),
4302
- " \u6587\u4EF6\u3002"
4303
- ] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
4304
- /* @__PURE__ */ jsx4("div", { style: { fontSize: 12, fontWeight: 600, color: "#1B1C1F" }, children: "\u6253\u5370\u7EB8\u5F20\u3001\u7F29\u653E\u6A21\u5F0F\u3001\u7269\u7406\u5957\u6253\u4E0E\u9875\u7801\u914D\u7F6E" }),
4305
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4306
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4307
- /* @__PURE__ */ jsx4("span", { children: "\u7EB8\u5F20\u4E0E\u9488\u5F0F\u7968\u636E\u89C4\u683C" }),
4308
- /* @__PURE__ */ jsxs4(
4309
- "select",
4310
- {
4311
- value: printCfg.paperOrientation,
4312
- onChange: (e) => {
4313
- const next = {
4314
- ...printCfg,
4315
- paperOrientation: e.target.value
4316
- };
4317
- setPrintCfg(next);
4318
- rebuildPreview(next);
4319
- },
4320
- children: [
4321
- /* @__PURE__ */ jsx4("option", { value: "A4_LANDSCAPE", children: "A4 \u6A2A\u5411" }),
4322
- /* @__PURE__ */ jsx4("option", { value: "A4_PORTRAIT", children: "A4 \u7EB5\u5411" }),
4323
- /* @__PURE__ */ jsx4("option", { value: "A3_LANDSCAPE", children: "A3 \u6A2A\u5411" }),
4324
- /* @__PURE__ */ jsx4("option", { value: "INVOICE_240_140", children: "240\xD7140mm \u4E8C\u7B49\u5206" }),
4325
- /* @__PURE__ */ jsx4("option", { value: "INVOICE_240_93", children: "240\xD793mm \u4E09\u7B49\u5206" })
4326
- ]
4327
- }
4328
- )
4329
- ] }),
4330
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4331
- /* @__PURE__ */ jsx4("span", { children: "\u6253\u5370/PDF \u7F29\u653E\u6A21\u5F0F" }),
4332
- /* @__PURE__ */ jsxs4(
4333
- "select",
4334
- {
4335
- value: printCfg.scaleMode ?? "all",
4336
- onChange: (e) => {
4337
- const next = {
4338
- ...printCfg,
4339
- scaleMode: e.target.value
4340
- };
4341
- setPrintCfg(next);
4342
- rebuildPreview(next);
4343
- },
4344
- children: [
4345
- /* @__PURE__ */ jsx4("option", { value: "all", children: "\u6807\u51C6\u5206\u9875" }),
4346
- /* @__PURE__ */ jsx4("option", { value: "fitWidth", children: "\u9002\u5E94\u9875\u5BBD" }),
4347
- /* @__PURE__ */ jsx4("option", { value: "fitSinglePage", children: "\u7F29\u81F3\u4E00\u9875" }),
4348
- /* @__PURE__ */ jsx4("option", { value: "currentPage", children: "\u5F53\u524D\u9875" })
4349
- ]
4350
- }
4351
- )
4352
- ] })
4353
- ] }),
4354
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4355
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4356
- /* @__PURE__ */ jsx4("span", { children: "\u91CD\u590D\u8868\u5934\u884C (thead)" }),
4357
- /* @__PURE__ */ jsx4(
4358
- "input",
4359
- {
4360
- type: "number",
4361
- min: 0,
4362
- max: 20,
4363
- value: printCfg.repeatHeaderRow ?? 0,
4364
- onChange: (e) => {
4365
- const n = Number(e.target.value);
4366
- const next = { ...printCfg, repeatHeaderRow: n > 0 ? n : null };
4367
- setPrintCfg(next);
4368
- rebuildPreview(next);
4369
- }
4370
- }
4371
- )
4372
- ] }),
4373
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4374
- /* @__PURE__ */ jsx4("span", { children: "\u91CD\u590D\u5C3E\u884C\u6570 (tfoot)" }),
4375
- /* @__PURE__ */ jsx4(
4376
- "input",
4377
- {
4378
- type: "number",
4379
- min: 0,
4380
- max: 10,
4381
- value: printCfg.repeatFooterRows ?? 0,
4382
- onChange: (e) => {
4383
- const next = {
4384
- ...printCfg,
4385
- repeatFooterRows: Math.max(0, Number(e.target.value) || 0)
4386
- };
4387
- setPrintCfg(next);
4388
- rebuildPreview(next);
4389
- }
4390
- }
4391
- )
4392
- ] })
4393
- ] }),
4394
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 6 }, children: [
4395
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4396
- /* @__PURE__ */ jsx4("span", { children: "\u591A\u680F\u5217\u6570" }),
4397
- /* @__PURE__ */ jsx4(
4398
- "input",
4399
- {
4400
- type: "number",
4401
- min: 1,
4402
- max: 4,
4403
- value: printCfg.multiColumnCount ?? 1,
4404
- onChange: (e) => {
4405
- const n = Math.max(1, Math.min(4, Number(e.target.value) || 1));
4406
- const next = {
4407
- ...printCfg,
4408
- multiColumnCount: n > 1 ? n : void 0
4409
- };
4410
- setPrintCfg(next);
4411
- rebuildPreview(next);
4412
- }
4413
- }
4414
- )
4415
- ] }),
4416
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4417
- /* @__PURE__ */ jsx4("span", { children: "\u680F\u95F4\u8DDD (pt)" }),
4389
+ const stagedSheetSummary = pendingImport ? (() => {
4390
+ const sheetsObj = pendingImport.snapshot.sheets ?? {};
4391
+ const orderedIds = pendingImport.snapshot.sheetOrder && pendingImport.snapshot.sheetOrder.length > 0 ? pendingImport.snapshot.sheetOrder.filter((id) => Boolean(sheetsObj[id])) : Object.keys(sheetsObj);
4392
+ const names = orderedIds.map((id, idx) => sheetsObj[id]?.name || `Sheet${idx + 1}`);
4393
+ return { count: names.length, names };
4394
+ })() : null;
4395
+ return /* @__PURE__ */ jsx4(
4396
+ "div",
4397
+ {
4398
+ className: "yudao-sheet-modal-backdrop",
4399
+ "data-testid": "yudao-io-modal",
4400
+ onClick: handleCloseModal,
4401
+ children: /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-card", onClick: (e) => e.stopPropagation(), children: [
4402
+ /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-header", children: [
4403
+ /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-tabs", children: [
4404
+ /* @__PURE__ */ jsx4(
4405
+ "button",
4406
+ {
4407
+ type: "button",
4408
+ className: `yudao-sheet-modal-tab ${tab === "import" ? "is-active" : ""}`,
4409
+ onClick: () => featureService.setModalTab("import"),
4410
+ children: t("yudaoSheets.modal.tabImport")
4411
+ }
4412
+ ),
4413
+ /* @__PURE__ */ jsx4(
4414
+ "button",
4415
+ {
4416
+ type: "button",
4417
+ className: `yudao-sheet-modal-tab ${tab === "export" ? "is-active" : ""}`,
4418
+ onClick: () => featureService.setModalTab("export"),
4419
+ children: t("yudaoSheets.modal.tabExport")
4420
+ }
4421
+ ),
4422
+ features.printTemplate && /* @__PURE__ */ jsx4(
4423
+ "button",
4424
+ {
4425
+ type: "button",
4426
+ className: `yudao-sheet-modal-tab ${tab === "print" ? "is-active" : ""}`,
4427
+ onClick: () => featureService.setModalTab("print"),
4428
+ children: t("yudaoSheets.modal.tabPrint")
4429
+ }
4430
+ ),
4431
+ /* @__PURE__ */ jsx4(
4432
+ "button",
4433
+ {
4434
+ type: "button",
4435
+ className: `yudao-sheet-modal-tab ${tab === "json" ? "is-active" : ""}`,
4436
+ onClick: () => featureService.setModalTab("json"),
4437
+ children: t("yudaoSheets.modal.tabJson")
4438
+ }
4439
+ )
4440
+ ] }),
4441
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
4442
+ /* @__PURE__ */ jsxs4(
4443
+ "span",
4444
+ {
4445
+ style: {
4446
+ fontSize: 11,
4447
+ padding: "3px 8px",
4448
+ borderRadius: 999,
4449
+ background: isCustomBackendAdapter ? "#F3F5FF" : "#EEEFF1",
4450
+ color: isCustomBackendAdapter ? "#2C53F1" : "#4E5565",
4451
+ border: `1px solid ${isCustomBackendAdapter ? "#D2DAFA" : "transparent"}`,
4452
+ fontWeight: 500
4453
+ },
4454
+ children: [
4455
+ t("yudaoSheets.modal.ioPipelinePrefix"),
4456
+ ": ",
4457
+ ioAdapter.name || "frontend-default"
4458
+ ]
4459
+ }
4460
+ ),
4461
+ /* @__PURE__ */ jsx4(
4462
+ "button",
4463
+ {
4464
+ type: "button",
4465
+ className: "yudao-sheet-btn",
4466
+ onClick: handleCloseModal,
4467
+ children: "\xD7"
4468
+ }
4469
+ )
4470
+ ] })
4471
+ ] }),
4472
+ tab === "import" || tab === "export" || tab === "print" ? /* @__PURE__ */ jsxs4("div", { style: { flex: 1, minHeight: 0, display: "flex" }, children: [
4473
+ /* @__PURE__ */ jsxs4(
4474
+ "div",
4475
+ {
4476
+ style: {
4477
+ width: (tab === "export" || tab === "import") && features.datasetBinding ? 336 : 318,
4478
+ borderRight: "1px solid #E3E5EA",
4479
+ padding: 14,
4480
+ display: "flex",
4481
+ flexDirection: "column",
4482
+ gap: 8,
4483
+ background: "#F9FAFB",
4484
+ overflowY: "auto"
4485
+ },
4486
+ children: [
4487
+ tab === "import" ? /* @__PURE__ */ jsxs4("div", { style: { fontSize: 12, color: "#4E5565", lineHeight: 1.55 }, children: [
4488
+ "\u652F\u6301\u9884\u68C0\u89E3\u6790\u672C\u5730\u6216\u670D\u52A1\u7AEF ",
4489
+ /* @__PURE__ */ jsx4("code", { children: ".xlsx" }),
4490
+ " / ",
4491
+ /* @__PURE__ */ jsx4("code", { children: ".xls" }),
4492
+ " / ",
4493
+ /* @__PURE__ */ jsx4("code", { children: ".csv" }),
4494
+ " / ",
4495
+ /* @__PURE__ */ jsx4("code", { children: ".xml" }),
4496
+ " / ",
4497
+ /* @__PURE__ */ jsx4("code", { children: ".json" }),
4498
+ " \u6587\u4EF6\uFF0C\u786E\u8BA4\u517C\u5BB9\u6027\u62A5\u544A\u540E\u518D\u5E94\u7528\u81F3\u5F53\u524D\u8BBE\u8BA1\u5668\uFF0C\u907F\u514D\u8BEF\u8986\u76D6\u6B63\u5728\u7F16\u8F91\u7684\u5DE5\u4F5C\u7C3F\u3002"
4499
+ ] }) : tab === "export" ? features.datasetBinding ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
4500
+ /* @__PURE__ */ jsx4("div", { style: { fontSize: 12, fontWeight: 600, color: "#1B1C1F" }, children: "\u6D4B\u8BD5\u6570\u636E\u96C6 JSON\uFF08\u652F\u6301\u5E76\u6392\u5206\u533A\u3001\u4E3B\u5B50\u5757\u3001\u5E73\u94FA\u5361\u7247\u4E0E\u516C\u5F0F\u91CD\u5199\uFF09" }),
4418
4501
  /* @__PURE__ */ jsx4(
4419
- "input",
4502
+ "textarea",
4420
4503
  {
4421
- type: "number",
4422
- min: 0,
4423
- max: 72,
4424
- value: printCfg.columnMarginPt ?? 12,
4425
- onChange: (e) => {
4426
- const next = {
4427
- ...printCfg,
4428
- columnMarginPt: Math.max(0, Number(e.target.value) || 0)
4429
- };
4430
- setPrintCfg(next);
4431
- rebuildPreview(next);
4432
- }
4504
+ className: "yudao-sheet-code-area",
4505
+ value: datasetText,
4506
+ onChange: (e) => setDatasetText(e.target.value)
4433
4507
  }
4434
- )
4435
- ] }),
4436
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4437
- /* @__PURE__ */ jsx4("span", { children: "\u5B9A\u884C\u5206\u9875" }),
4438
- /* @__PURE__ */ jsx4(
4439
- "input",
4440
- {
4441
- type: "number",
4442
- min: 0,
4443
- max: 200,
4444
- placeholder: "\u81EA\u52A8",
4445
- value: printCfg.fixedRowsPerPage ?? "",
4446
- onChange: (e) => {
4447
- const raw = e.target.value.trim();
4448
- const n = raw === "" ? 0 : Math.max(0, Number(raw) || 0);
4449
- const next = {
4450
- ...printCfg,
4451
- fixedRowsPerPage: n > 0 ? n : void 0
4452
- };
4453
- setPrintCfg(next);
4454
- rebuildPreview(next);
4455
- }
4456
- }
4457
- )
4458
- ] })
4459
- ] }),
4460
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4461
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4462
- /* @__PURE__ */ jsx4("span", { children: "\u7F16\u9875\u8D77\u59CB\u7269\u7406\u9875" }),
4463
- /* @__PURE__ */ jsx4(
4464
- "input",
4465
- {
4466
- type: "number",
4467
- min: 1,
4468
- max: 99,
4469
- title: "\u5982\u8BBE\u4E3A 2 \u53EF\u8DF3\u8FC7\u7B2C 1 \u9875\u5C01\u9762\u4E0D\u7F16\u9875\u7801",
4470
- value: printCfg.pageNumberStartPage ?? 1,
4471
- onChange: (e) => {
4472
- const next = {
4473
- ...printCfg,
4474
- pageNumberStartPage: Math.max(1, Number(e.target.value) || 1)
4475
- };
4476
- setPrintCfg(next);
4477
- rebuildPreview(next);
4478
- }
4479
- }
4480
- )
4481
- ] }),
4482
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4483
- /* @__PURE__ */ jsx4("span", { children: "\u9875\u7801\u5BF9\u9F50\u65B9\u5F0F" }),
4484
- /* @__PURE__ */ jsxs4(
4485
- "select",
4486
- {
4487
- value: printCfg.pageNumberAlign ?? "right",
4488
- onChange: (e) => {
4489
- const next = {
4490
- ...printCfg,
4491
- pageNumberAlign: e.target.value
4492
- };
4493
- setPrintCfg(next);
4494
- rebuildPreview(next);
4495
- },
4496
- children: [
4497
- /* @__PURE__ */ jsx4("option", { value: "left", children: "\u5C45\u5DE6" }),
4498
- /* @__PURE__ */ jsx4("option", { value: "center", children: "\u5C45\u4E2D" }),
4499
- /* @__PURE__ */ jsx4("option", { value: "right", children: "\u5C45\u53F3" })
4500
- ]
4501
- }
4502
- )
4503
- ] })
4504
- ] }),
4505
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4506
- /* @__PURE__ */ jsx4("span", { children: "\u6253\u5370\u9875\u7709\u6807\u9898" }),
4507
- /* @__PURE__ */ jsx4(
4508
- "input",
4509
- {
4510
- type: "text",
4511
- value: printCfg.headerTitle,
4512
- onChange: (e) => {
4513
- const next = { ...printCfg, headerTitle: e.target.value };
4514
- setPrintCfg(next);
4515
- rebuildPreview(next);
4516
- }
4517
- }
4518
- )
4519
- ] }),
4520
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 4 }, children: [
4521
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4522
- /* @__PURE__ */ jsx4("span", { children: "\u9875\u7709\u5DE6 (&D/&F)" }),
4523
- /* @__PURE__ */ jsx4(
4524
- "input",
4525
- {
4526
- type: "text",
4527
- placeholder: "\u5982 &D",
4528
- value: printCfg.headerLeft ?? "",
4529
- onChange: (e) => {
4530
- const next = { ...printCfg, headerLeft: e.target.value };
4531
- setPrintCfg(next);
4532
- rebuildPreview(next);
4533
- }
4534
- }
4535
- )
4536
- ] }),
4537
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4538
- /* @__PURE__ */ jsx4("span", { children: "\u9875\u7709\u4E2D" }),
4539
- /* @__PURE__ */ jsx4(
4540
- "input",
4541
- {
4542
- type: "text",
4543
- placeholder: "\u5982 &A",
4544
- value: printCfg.headerCenter ?? "",
4545
- onChange: (e) => {
4546
- const next = { ...printCfg, headerCenter: e.target.value };
4547
- setPrintCfg(next);
4548
- rebuildPreview(next);
4549
- }
4550
- }
4551
- )
4552
- ] }),
4553
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4554
- /* @__PURE__ */ jsx4("span", { children: "\u9875\u7709\u53F3 (&P/&N)" }),
4555
- /* @__PURE__ */ jsx4(
4556
- "input",
4557
- {
4558
- type: "text",
4559
- placeholder: "\u5982 \u7B2C&P/&N\u9875",
4560
- value: printCfg.headerRight ?? "",
4561
- onChange: (e) => {
4562
- const next = { ...printCfg, headerRight: e.target.value };
4563
- setPrintCfg(next);
4564
- rebuildPreview(next);
4565
- }
4566
- }
4567
- )
4568
- ] })
4569
- ] }),
4570
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 4 }, children: [
4571
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4572
- /* @__PURE__ */ jsx4("span", { children: "\u9875\u811A\u5DE6" }),
4573
- /* @__PURE__ */ jsx4(
4574
- "input",
4575
- {
4576
- type: "text",
4577
- placeholder: "\u5236\u8868\u90E8\u95E8",
4578
- value: printCfg.footerLeft ?? "",
4579
- onChange: (e) => {
4580
- const next = { ...printCfg, footerLeft: e.target.value };
4581
- setPrintCfg(next);
4582
- rebuildPreview(next);
4583
- }
4584
- }
4585
- )
4586
- ] }),
4587
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4588
- /* @__PURE__ */ jsx4("span", { children: "\u9875\u811A\u4E2D" }),
4589
- /* @__PURE__ */ jsx4(
4590
- "input",
4591
- {
4592
- type: "text",
4593
- placeholder: "&F",
4594
- value: printCfg.footerCenter ?? "",
4595
- onChange: (e) => {
4596
- const next = { ...printCfg, footerCenter: e.target.value };
4597
- setPrintCfg(next);
4598
- rebuildPreview(next);
4599
- }
4600
- }
4601
- )
4602
- ] }),
4603
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4604
- /* @__PURE__ */ jsx4("span", { children: "\u9875\u811A\u53F3" }),
4605
- /* @__PURE__ */ jsx4(
4606
- "input",
4607
- {
4608
- type: "text",
4609
- placeholder: "#[PAGE]/#[PAGES]",
4610
- value: printCfg.footerRight ?? "",
4611
- onChange: (e) => {
4612
- const next = { ...printCfg, footerRight: e.target.value };
4613
- setPrintCfg(next);
4614
- rebuildPreview(next);
4508
+ ),
4509
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 6, flexWrap: "wrap" }, children: [
4510
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: () => rebuildPreview(), children: t("yudaoSheets.modal.refreshPreviewBtn") }),
4511
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleGenerateMockDataset, children: t("yudaoSheets.modal.mockDatasetBtn") }),
4512
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleApplyToSheet, children: t("yudaoSheets.modal.applyToSheetBtn") })
4513
+ ] })
4514
+ ] }) : /* @__PURE__ */ jsxs4("div", { style: { fontSize: 12, color: "#4E5565", lineHeight: 1.6 }, children: [
4515
+ "\u5F53\u524D\u5904\u4E8E\u7EAF\u51C0\u7535\u5B50\u8868\u683C\u6A21\u5F0F\u3002\u5185\u7F6E\u96F6\u5916\u90E8\u4F9D\u8D56\u7684 OOXML \u4E0E\u77E2\u91CF PDF \u5F15\u64CE\uFF0C\u53EF\u76F4\u63A5\u5BFC\u51FA\u4FDD\u7559\u516C\u5F0F\u3001\u5408\u5E76\u5355\u5143\u683C\u3001\u5B57\u4F53\u989C\u8272\u4E0E\u8FB9\u6846\u7684\u6807\u51C6",
4516
+ " ",
4517
+ /* @__PURE__ */ jsx4("code", { children: ".xlsx" }),
4518
+ " \u4E0E ",
4519
+ /* @__PURE__ */ jsx4("code", { children: ".pdf" }),
4520
+ " \u6587\u4EF6\u3002"
4521
+ ] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
4522
+ /* @__PURE__ */ jsx4("div", { style: { fontSize: 12, fontWeight: 600, color: "#1B1C1F" }, children: "\u6253\u5370\u7EB8\u5F20\u3001\u7F29\u653E\u6A21\u5F0F\u3001\u7269\u7406\u5957\u6253\u4E0E\u9875\u7801\u914D\u7F6E" }),
4523
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4524
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4525
+ /* @__PURE__ */ jsx4("span", { children: "\u7EB8\u5F20\u4E0E\u9488\u5F0F\u7968\u636E\u89C4\u683C" }),
4526
+ /* @__PURE__ */ jsxs4(
4527
+ "select",
4528
+ {
4529
+ value: printCfg.paperOrientation,
4530
+ onChange: (e) => {
4531
+ const next = {
4532
+ ...printCfg,
4533
+ paperOrientation: e.target.value
4534
+ };
4535
+ setPrintCfg(next);
4536
+ rebuildPreview(next);
4537
+ },
4538
+ children: [
4539
+ /* @__PURE__ */ jsx4("option", { value: "A4_LANDSCAPE", children: "A4 \u6A2A\u5411" }),
4540
+ /* @__PURE__ */ jsx4("option", { value: "A4_PORTRAIT", children: "A4 \u7EB5\u5411" }),
4541
+ /* @__PURE__ */ jsx4("option", { value: "A3_LANDSCAPE", children: "A3 \u6A2A\u5411" }),
4542
+ /* @__PURE__ */ jsx4("option", { value: "INVOICE_240_140", children: "240\xD7140mm \u4E8C\u7B49\u5206" }),
4543
+ /* @__PURE__ */ jsx4("option", { value: "INVOICE_240_93", children: "240\xD793mm \u4E09\u7B49\u5206" })
4544
+ ]
4545
+ }
4546
+ )
4547
+ ] }),
4548
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4549
+ /* @__PURE__ */ jsx4("span", { children: "\u6253\u5370/PDF \u7F29\u653E\u6A21\u5F0F" }),
4550
+ /* @__PURE__ */ jsxs4(
4551
+ "select",
4552
+ {
4553
+ value: printCfg.scaleMode ?? "all",
4554
+ onChange: (e) => {
4555
+ const next = {
4556
+ ...printCfg,
4557
+ scaleMode: e.target.value
4558
+ };
4559
+ setPrintCfg(next);
4560
+ rebuildPreview(next);
4561
+ },
4562
+ children: [
4563
+ /* @__PURE__ */ jsx4("option", { value: "all", children: "\u6807\u51C6\u5206\u9875" }),
4564
+ /* @__PURE__ */ jsx4("option", { value: "fitWidth", children: "\u9002\u5E94\u9875\u5BBD" }),
4565
+ /* @__PURE__ */ jsx4("option", { value: "fitSinglePage", children: "\u7F29\u81F3\u4E00\u9875" }),
4566
+ /* @__PURE__ */ jsx4("option", { value: "currentPage", children: "\u5F53\u524D\u9875" })
4567
+ ]
4568
+ }
4569
+ )
4570
+ ] })
4571
+ ] }),
4572
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4573
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4574
+ /* @__PURE__ */ jsx4("span", { children: "\u91CD\u590D\u8868\u5934\u884C (thead)" }),
4575
+ /* @__PURE__ */ jsx4(
4576
+ "input",
4577
+ {
4578
+ type: "number",
4579
+ min: 0,
4580
+ max: 20,
4581
+ value: printCfg.repeatHeaderRow ?? 0,
4582
+ onChange: (e) => {
4583
+ const n = Number(e.target.value);
4584
+ const next = { ...printCfg, repeatHeaderRow: n > 0 ? n : null };
4585
+ setPrintCfg(next);
4586
+ rebuildPreview(next);
4587
+ }
4588
+ }
4589
+ )
4590
+ ] }),
4591
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4592
+ /* @__PURE__ */ jsx4("span", { children: "\u91CD\u590D\u5C3E\u884C\u6570 (tfoot)" }),
4593
+ /* @__PURE__ */ jsx4(
4594
+ "input",
4595
+ {
4596
+ type: "number",
4597
+ min: 0,
4598
+ max: 10,
4599
+ value: printCfg.repeatFooterRows ?? 0,
4600
+ onChange: (e) => {
4601
+ const next = {
4602
+ ...printCfg,
4603
+ repeatFooterRows: Math.max(0, Number(e.target.value) || 0)
4604
+ };
4605
+ setPrintCfg(next);
4606
+ rebuildPreview(next);
4607
+ }
4608
+ }
4609
+ )
4610
+ ] })
4611
+ ] }),
4612
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 6 }, children: [
4613
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4614
+ /* @__PURE__ */ jsx4("span", { children: "\u591A\u680F\u5217\u6570" }),
4615
+ /* @__PURE__ */ jsx4(
4616
+ "input",
4617
+ {
4618
+ type: "number",
4619
+ min: 1,
4620
+ max: 4,
4621
+ value: printCfg.multiColumnCount ?? 1,
4622
+ onChange: (e) => {
4623
+ const n = Math.max(1, Math.min(4, Number(e.target.value) || 1));
4624
+ const next = {
4625
+ ...printCfg,
4626
+ multiColumnCount: n > 1 ? n : void 0
4627
+ };
4628
+ setPrintCfg(next);
4629
+ rebuildPreview(next);
4630
+ }
4631
+ }
4632
+ )
4633
+ ] }),
4634
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4635
+ /* @__PURE__ */ jsx4("span", { children: "\u680F\u95F4\u8DDD (pt)" }),
4636
+ /* @__PURE__ */ jsx4(
4637
+ "input",
4638
+ {
4639
+ type: "number",
4640
+ min: 0,
4641
+ max: 72,
4642
+ value: printCfg.columnMarginPt ?? 12,
4643
+ onChange: (e) => {
4644
+ const next = {
4645
+ ...printCfg,
4646
+ columnMarginPt: Math.max(0, Number(e.target.value) || 0)
4647
+ };
4648
+ setPrintCfg(next);
4649
+ rebuildPreview(next);
4650
+ }
4651
+ }
4652
+ )
4653
+ ] }),
4654
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4655
+ /* @__PURE__ */ jsx4("span", { children: "\u5B9A\u884C\u5206\u9875" }),
4656
+ /* @__PURE__ */ jsx4(
4657
+ "input",
4658
+ {
4659
+ type: "number",
4660
+ min: 0,
4661
+ max: 200,
4662
+ placeholder: "\u81EA\u52A8",
4663
+ value: printCfg.fixedRowsPerPage ?? "",
4664
+ onChange: (e) => {
4665
+ const raw = e.target.value.trim();
4666
+ const n = raw === "" ? 0 : Math.max(0, Number(raw) || 0);
4667
+ const next = {
4668
+ ...printCfg,
4669
+ fixedRowsPerPage: n > 0 ? n : void 0
4670
+ };
4671
+ setPrintCfg(next);
4672
+ rebuildPreview(next);
4673
+ }
4674
+ }
4675
+ )
4676
+ ] })
4677
+ ] }),
4678
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4679
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4680
+ /* @__PURE__ */ jsx4("span", { children: "\u7F16\u9875\u8D77\u59CB\u7269\u7406\u9875" }),
4681
+ /* @__PURE__ */ jsx4(
4682
+ "input",
4683
+ {
4684
+ type: "number",
4685
+ min: 1,
4686
+ max: 99,
4687
+ title: "\u5982\u8BBE\u4E3A 2 \u53EF\u8DF3\u8FC7\u7B2C 1 \u9875\u5C01\u9762\u4E0D\u7F16\u9875\u7801",
4688
+ value: printCfg.pageNumberStartPage ?? 1,
4689
+ onChange: (e) => {
4690
+ const next = {
4691
+ ...printCfg,
4692
+ pageNumberStartPage: Math.max(1, Number(e.target.value) || 1)
4693
+ };
4694
+ setPrintCfg(next);
4695
+ rebuildPreview(next);
4696
+ }
4697
+ }
4698
+ )
4699
+ ] }),
4700
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4701
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u7801\u5BF9\u9F50\u65B9\u5F0F" }),
4702
+ /* @__PURE__ */ jsxs4(
4703
+ "select",
4704
+ {
4705
+ value: printCfg.pageNumberAlign ?? "right",
4706
+ onChange: (e) => {
4707
+ const next = {
4708
+ ...printCfg,
4709
+ pageNumberAlign: e.target.value
4710
+ };
4711
+ setPrintCfg(next);
4712
+ rebuildPreview(next);
4713
+ },
4714
+ children: [
4715
+ /* @__PURE__ */ jsx4("option", { value: "left", children: "\u5C45\u5DE6" }),
4716
+ /* @__PURE__ */ jsx4("option", { value: "center", children: "\u5C45\u4E2D" }),
4717
+ /* @__PURE__ */ jsx4("option", { value: "right", children: "\u5C45\u53F3" })
4718
+ ]
4719
+ }
4720
+ )
4721
+ ] })
4722
+ ] }),
4723
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4724
+ /* @__PURE__ */ jsx4("span", { children: "\u6253\u5370\u9875\u7709\u6807\u9898" }),
4725
+ /* @__PURE__ */ jsx4(
4726
+ "input",
4727
+ {
4728
+ type: "text",
4729
+ value: printCfg.headerTitle,
4730
+ onChange: (e) => {
4731
+ const next = { ...printCfg, headerTitle: e.target.value };
4732
+ setPrintCfg(next);
4733
+ rebuildPreview(next);
4734
+ }
4615
4735
  }
4616
- }
4617
- )
4618
- ] })
4619
- ] }),
4620
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4621
- /* @__PURE__ */ jsx4("span", { children: "\u659C\u5411\u9632\u4F2A\u5E73\u94FA\u6C34\u5370\u6587\u5B57" }),
4622
- /* @__PURE__ */ jsx4(
4623
- "input",
4624
- {
4625
- type: "text",
4626
- placeholder: "\u5982\uFF1A\u4F01\u4E1A\u62A5\u8868 \xB7 \u5185\u90E8\u8D44\u6599",
4627
- value: printCfg.watermarkText ?? "",
4628
- onChange: (e) => {
4629
- const next = { ...printCfg, watermarkText: e.target.value };
4630
- setPrintCfg(next);
4631
- rebuildPreview(next);
4632
- }
4633
- }
4634
- )
4635
- ] }),
4636
- /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4637
- /* @__PURE__ */ jsx4("span", { children: "\u7269\u7406\u5957\u6253\u6821\u51C6\u5E95\u56FE URL\uFF08\u53EF\u9009\uFF09" }),
4638
- /* @__PURE__ */ jsx4(
4639
- "input",
4640
- {
4641
- type: "text",
4642
- placeholder: "\u8F93\u5165\u9884\u5370\u53D1\u7968/\u8BC1\u4E66\u626B\u63CF\u4EF6\u56FE\u7247 URL",
4643
- value: printCfg.overlayBackgroundUrl ?? "",
4644
- onChange: (e) => {
4645
- const next = { ...printCfg, overlayBackgroundUrl: e.target.value };
4646
- setPrintCfg(next);
4647
- rebuildPreview(next);
4648
- }
4649
- }
4650
- )
4651
- ] }),
4652
- /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4653
- /* @__PURE__ */ jsx4(
4654
- "input",
4655
- {
4656
- type: "checkbox",
4657
- checked: Boolean(printCfg.pinFooterToBottom),
4658
- onChange: (e) => {
4659
- const next = { ...printCfg, pinFooterToBottom: e.target.checked };
4660
- setPrintCfg(next);
4661
- rebuildPreview(next);
4662
- }
4663
- }
4664
- ),
4665
- /* @__PURE__ */ jsx4("span", { children: "\u5C3E\u884C\u8D34\u5E95\u56FA\u5B9A\u6253\u5370 (pinFooterToBottom)" })
4666
- ] }),
4667
- /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4668
- /* @__PURE__ */ jsx4(
4669
- "input",
4670
- {
4671
- type: "checkbox",
4672
- checked: Boolean(printCfg.pageBreakAfterGroup),
4673
- onChange: (e) => {
4674
- const next = { ...printCfg, pageBreakAfterGroup: e.target.checked };
4675
- setPrintCfg(next);
4676
- rebuildPreview(next);
4677
- }
4678
- }
4679
- ),
4680
- /* @__PURE__ */ jsx4("span", { children: "\u6309\u7EC4\u81EA\u52A8\u5206\u9875 (pageBreakAfterGroup)" })
4681
- ] }),
4682
- /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4683
- /* @__PURE__ */ jsx4(
4684
- "input",
4685
- {
4686
- type: "checkbox",
4687
- checked: printCfg.showPageNumbers !== false,
4688
- onChange: (e) => {
4689
- const next = { ...printCfg, showPageNumbers: e.target.checked };
4690
- setPrintCfg(next);
4691
- rebuildPreview(next);
4692
- }
4693
- }
4694
- ),
4695
- /* @__PURE__ */ jsx4("span", { children: "\u663E\u793A\u9875\u7801 (showPageNumbers)" })
4696
- ] }),
4697
- /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4698
- /* @__PURE__ */ jsx4(
4699
- "input",
4700
- {
4701
- type: "checkbox",
4702
- checked: printCfg.excludeBackgroundOnPrint ?? true,
4703
- onChange: (e) => {
4704
- const next = { ...printCfg, excludeBackgroundOnPrint: e.target.checked };
4705
- setPrintCfg(next);
4706
- rebuildPreview(next);
4707
- }
4708
- }
4709
- ),
4710
- /* @__PURE__ */ jsx4("span", { children: "\u5957\u6253\u6A21\u5F0F\uFF1A\u4EC5\u9884\u89C8\u53C2\u8003\u5E95\u56FE\uFF0C\u6253\u5370\u81EA\u52A8\u5265\u79BB\u5E95\u56FE" })
4711
- ] }),
4712
- /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4713
- /* @__PURE__ */ jsx4(
4714
- "input",
4715
- {
4716
- type: "checkbox",
4717
- checked: printCfg.showGridlines,
4718
- onChange: (e) => {
4719
- const next = { ...printCfg, showGridlines: e.target.checked };
4720
- setPrintCfg(next);
4721
- rebuildPreview(next);
4722
- }
4723
- }
4724
- ),
4725
- /* @__PURE__ */ jsx4("span", { children: "\u663E\u793A\u7A7A\u767D\u5355\u5143\u683C\u8F85\u52A9\u7F51\u683C\u7EBF" })
4726
- ] }),
4727
- /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4728
- /* @__PURE__ */ jsx4(
4729
- "input",
4730
- {
4731
- type: "checkbox",
4732
- checked: Boolean(printCfg.wordFormStyle),
4733
- onChange: (e) => {
4734
- const next = { ...printCfg, wordFormStyle: e.target.checked };
4735
- setPrintCfg(next);
4736
- rebuildPreview(next);
4737
- }
4738
- }
4739
- ),
4740
- /* @__PURE__ */ jsx4("span", { children: "\u7C7B Word \u65E0\u8FB9\u6846\u516C\u6587/\u8868\u5355\u98CE\u683C" })
4741
- ] })
4742
- ] }),
4743
- /* @__PURE__ */ jsxs4(
4744
- "div",
4745
- {
4746
- style: {
4747
- padding: "6px 8px",
4748
- background: "#FFFFFF",
4749
- border: "1px solid #E3E5EA",
4750
- borderRadius: 6,
4751
- display: "flex",
4752
- flexDirection: "column",
4753
- gap: 5
4754
- },
4755
- children: [
4756
- /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11.5, cursor: "pointer" }, children: [
4757
- /* @__PURE__ */ jsxs4("span", { style: { display: "inline-flex", alignItems: "center", gap: 5, fontWeight: 600, color: "#1B1C1F" }, children: [
4736
+ )
4737
+ ] }),
4738
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 4 }, children: [
4739
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4740
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u7709\u5DE6 (&D/&F)" }),
4758
4741
  /* @__PURE__ */ jsx4(
4759
4742
  "input",
4760
4743
  {
4761
- type: "checkbox",
4762
- checked: paginationEnabled,
4744
+ type: "text",
4745
+ placeholder: "\u5982 &D",
4746
+ value: printCfg.headerLeft ?? "",
4763
4747
  onChange: (e) => {
4764
- const enabled = e.target.checked;
4765
- setPaginationEnabled(enabled);
4766
- setPageIndex(1);
4767
- rebuildPreview(void 0, { enabled, page: 1, pageSize });
4748
+ const next = { ...printCfg, headerLeft: e.target.value };
4749
+ setPrintCfg(next);
4750
+ rebuildPreview(next);
4768
4751
  }
4769
4752
  }
4770
- ),
4771
- "\u5927\u6570\u636E\u5206\u9875\u5207\u7247\u9884\u89C8"
4753
+ )
4772
4754
  ] }),
4773
- /* @__PURE__ */ jsxs4(
4774
- "select",
4755
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4756
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u7709\u4E2D" }),
4757
+ /* @__PURE__ */ jsx4(
4758
+ "input",
4759
+ {
4760
+ type: "text",
4761
+ placeholder: "\u5982 &A",
4762
+ value: printCfg.headerCenter ?? "",
4763
+ onChange: (e) => {
4764
+ const next = { ...printCfg, headerCenter: e.target.value };
4765
+ setPrintCfg(next);
4766
+ rebuildPreview(next);
4767
+ }
4768
+ }
4769
+ )
4770
+ ] }),
4771
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4772
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u7709\u53F3 (&P/&N)" }),
4773
+ /* @__PURE__ */ jsx4(
4774
+ "input",
4775
+ {
4776
+ type: "text",
4777
+ placeholder: "\u5982 \u7B2C&P/&N\u9875",
4778
+ value: printCfg.headerRight ?? "",
4779
+ onChange: (e) => {
4780
+ const next = { ...printCfg, headerRight: e.target.value };
4781
+ setPrintCfg(next);
4782
+ rebuildPreview(next);
4783
+ }
4784
+ }
4785
+ )
4786
+ ] })
4787
+ ] }),
4788
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 4 }, children: [
4789
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4790
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u811A\u5DE6" }),
4791
+ /* @__PURE__ */ jsx4(
4792
+ "input",
4793
+ {
4794
+ type: "text",
4795
+ placeholder: "\u5236\u8868\u90E8\u95E8",
4796
+ value: printCfg.footerLeft ?? "",
4797
+ onChange: (e) => {
4798
+ const next = { ...printCfg, footerLeft: e.target.value };
4799
+ setPrintCfg(next);
4800
+ rebuildPreview(next);
4801
+ }
4802
+ }
4803
+ )
4804
+ ] }),
4805
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4806
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u811A\u4E2D" }),
4807
+ /* @__PURE__ */ jsx4(
4808
+ "input",
4809
+ {
4810
+ type: "text",
4811
+ placeholder: "&F",
4812
+ value: printCfg.footerCenter ?? "",
4813
+ onChange: (e) => {
4814
+ const next = { ...printCfg, footerCenter: e.target.value };
4815
+ setPrintCfg(next);
4816
+ rebuildPreview(next);
4817
+ }
4818
+ }
4819
+ )
4820
+ ] }),
4821
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4822
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u811A\u53F3" }),
4823
+ /* @__PURE__ */ jsx4(
4824
+ "input",
4825
+ {
4826
+ type: "text",
4827
+ placeholder: "#[PAGE]/#[PAGES]",
4828
+ value: printCfg.footerRight ?? "",
4829
+ onChange: (e) => {
4830
+ const next = { ...printCfg, footerRight: e.target.value };
4831
+ setPrintCfg(next);
4832
+ rebuildPreview(next);
4833
+ }
4834
+ }
4835
+ )
4836
+ ] })
4837
+ ] }),
4838
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4839
+ /* @__PURE__ */ jsx4("span", { children: "\u659C\u5411\u9632\u4F2A\u5E73\u94FA\u6C34\u5370\u6587\u5B57" }),
4840
+ /* @__PURE__ */ jsx4(
4841
+ "input",
4775
4842
  {
4776
- style: {
4777
- fontSize: 10.5,
4778
- padding: "1px 4px",
4779
- borderRadius: 4,
4780
- border: "1px solid #E3E5EA",
4781
- background: "#FFFFFF",
4782
- color: "#31363F"
4783
- },
4784
- value: pageSize,
4785
- disabled: !paginationEnabled,
4843
+ type: "text",
4844
+ placeholder: "\u5982\uFF1A\u4F01\u4E1A\u62A5\u8868 \xB7 \u5185\u90E8\u8D44\u6599",
4845
+ value: printCfg.watermarkText ?? "",
4786
4846
  onChange: (e) => {
4787
- const nextSize = Number(e.target.value);
4788
- setPageSize(nextSize);
4789
- setPageIndex(1);
4790
- rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize: nextSize });
4791
- },
4792
- children: [
4793
- /* @__PURE__ */ jsx4("option", { value: 25, children: "25 \u884C/\u9875" }),
4794
- /* @__PURE__ */ jsx4("option", { value: 50, children: "50 \u884C/\u9875" }),
4795
- /* @__PURE__ */ jsx4("option", { value: 100, children: "100 \u884C/\u9875" }),
4796
- /* @__PURE__ */ jsx4("option", { value: 500, children: "500 \u884C/\u9875" })
4797
- ]
4847
+ const next = { ...printCfg, watermarkText: e.target.value };
4848
+ setPrintCfg(next);
4849
+ rebuildPreview(next);
4850
+ }
4798
4851
  }
4799
4852
  )
4800
4853
  ] }),
4801
- paginationEnabled && /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11 }, children: [
4854
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4855
+ /* @__PURE__ */ jsx4("span", { children: "\u7269\u7406\u5957\u6253\u6821\u51C6\u5E95\u56FE URL\uFF08\u53EF\u9009\uFF09" }),
4802
4856
  /* @__PURE__ */ jsx4(
4803
- "button",
4857
+ "input",
4804
4858
  {
4805
- type: "button",
4806
- className: "yudao-sheet-btn",
4807
- style: { padding: "2px 6px", fontSize: 10.5 },
4808
- disabled: pageIndex <= 1,
4809
- onClick: () => {
4810
- const prev = Math.max(1, pageIndex - 1);
4811
- setPageIndex(prev);
4812
- rebuildPreview(void 0, { enabled: true, page: prev, pageSize });
4813
- },
4814
- children: "\u4E0A\u4E00\u9875"
4859
+ type: "text",
4860
+ placeholder: "\u8F93\u5165\u9884\u5370\u53D1\u7968/\u8BC1\u4E66\u626B\u63CF\u4EF6\u56FE\u7247 URL",
4861
+ value: printCfg.overlayBackgroundUrl ?? "",
4862
+ onChange: (e) => {
4863
+ const next = { ...printCfg, overlayBackgroundUrl: e.target.value };
4864
+ setPrintCfg(next);
4865
+ rebuildPreview(next);
4866
+ }
4867
+ }
4868
+ )
4869
+ ] }),
4870
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4871
+ /* @__PURE__ */ jsx4(
4872
+ "input",
4873
+ {
4874
+ type: "checkbox",
4875
+ checked: Boolean(printCfg.pinFooterToBottom),
4876
+ onChange: (e) => {
4877
+ const next = { ...printCfg, pinFooterToBottom: e.target.checked };
4878
+ setPrintCfg(next);
4879
+ rebuildPreview(next);
4880
+ }
4815
4881
  }
4816
4882
  ),
4817
- /* @__PURE__ */ jsxs4("span", { style: { color: "#4E5565" }, children: [
4818
- "\u7B2C ",
4819
- pageIndex,
4820
- "/",
4821
- pageSummary.totalPages,
4822
- " \u9875 \xB7 \u5171 ",
4823
- pageSummary.totalRows,
4824
- " \u884C"
4825
- ] }),
4883
+ /* @__PURE__ */ jsx4("span", { children: "\u5C3E\u884C\u8D34\u5E95\u56FA\u5B9A\u6253\u5370 (pinFooterToBottom)" })
4884
+ ] }),
4885
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4826
4886
  /* @__PURE__ */ jsx4(
4827
- "button",
4887
+ "input",
4828
4888
  {
4829
- type: "button",
4830
- className: "yudao-sheet-btn",
4831
- style: { padding: "2px 6px", fontSize: 10.5 },
4832
- disabled: pageIndex >= pageSummary.totalPages,
4833
- onClick: () => {
4834
- const next = Math.min(pageSummary.totalPages, pageIndex + 1);
4835
- setPageIndex(next);
4836
- rebuildPreview(void 0, { enabled: true, page: next, pageSize });
4837
- },
4838
- children: "\u4E0B\u4E00\u9875"
4889
+ type: "checkbox",
4890
+ checked: Boolean(printCfg.pageBreakAfterGroup),
4891
+ onChange: (e) => {
4892
+ const next = { ...printCfg, pageBreakAfterGroup: e.target.checked };
4893
+ setPrintCfg(next);
4894
+ rebuildPreview(next);
4895
+ }
4839
4896
  }
4840
- )
4841
- ] })
4842
- ]
4843
- }
4844
- ),
4845
- /* @__PURE__ */ jsxs4(
4846
- "div",
4847
- {
4848
- style: {
4849
- marginTop: "auto",
4850
- padding: "8px 10px",
4851
- background: "#FFFFFF",
4852
- border: "1px solid #E3E5EA",
4853
- borderRadius: 8,
4854
- display: "flex",
4855
- flexDirection: "column",
4856
- gap: 6
4857
- },
4858
- children: [
4859
- /* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5 }, children: [
4860
- /* @__PURE__ */ jsx4("span", { style: { fontWeight: 600, color: "#1B1C1F" }, children: "\u5BFC\u5165/\u5BFC\u51FA\u5904\u7406\u65B9\u5F0F\uFF08\u6309\u6B21\u9009\u62E9\uFF09" }),
4861
- /* @__PURE__ */ jsxs4("span", { style: { fontSize: 10.5, color: "#7D8698" }, children: [
4862
- "\u5FEB\u7167 ",
4863
- snapSizeKb,
4864
- " KB"
4865
- ] })
4897
+ ),
4898
+ /* @__PURE__ */ jsx4("span", { children: "\u6309\u7EC4\u81EA\u52A8\u5206\u9875 (pageBreakAfterGroup)" })
4866
4899
  ] }),
4867
- /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-segmented", style: { gridTemplateColumns: "1fr 1fr" }, children: [
4900
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4868
4901
  /* @__PURE__ */ jsx4(
4869
- "button",
4902
+ "input",
4870
4903
  {
4871
- type: "button",
4872
- className: `yudao-sheet-segmented-item ${ioTarget === "browser" ? "is-active" : ""}`,
4873
- onClick: () => setIoTarget("browser"),
4874
- children: t("yudaoSheets.modal.browserModeBtn")
4904
+ type: "checkbox",
4905
+ checked: printCfg.showPageNumbers !== false,
4906
+ onChange: (e) => {
4907
+ const next = { ...printCfg, showPageNumbers: e.target.checked };
4908
+ setPrintCfg(next);
4909
+ rebuildPreview(next);
4910
+ }
4875
4911
  }
4876
4912
  ),
4877
- /* @__PURE__ */ jsxs4(
4878
- "button",
4913
+ /* @__PURE__ */ jsx4("span", { children: "\u663E\u793A\u9875\u7801 (showPageNumbers)" })
4914
+ ] }),
4915
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4916
+ /* @__PURE__ */ jsx4(
4917
+ "input",
4879
4918
  {
4880
- type: "button",
4881
- className: `yudao-sheet-segmented-item ${ioTarget === "server" ? "is-active" : ""}`,
4882
- onClick: () => setIoTarget("server"),
4883
- title: ioCaps.server.exportSheet || ioCaps.server.importSheet ? `\u8D70\u670D\u52A1\u7AEF\u9002\u914D\u5668 (${ioCaps.server.adapterName})` : "\u5F53\u524D\u672A\u6CE8\u518C\u670D\u52A1\u7AEF\u5BFC\u5165/\u5BFC\u51FA\u9002\u914D\u5668",
4884
- children: [
4885
- t("yudaoSheets.modal.serverModeBtn"),
4886
- ioCaps.server.exportSheet || ioCaps.server.importSheet ? "" : t("yudaoSheets.modal.serverNotConnected")
4887
- ]
4919
+ type: "checkbox",
4920
+ checked: printCfg.excludeBackgroundOnPrint ?? true,
4921
+ onChange: (e) => {
4922
+ const next = { ...printCfg, excludeBackgroundOnPrint: e.target.checked };
4923
+ setPrintCfg(next);
4924
+ rebuildPreview(next);
4925
+ }
4888
4926
  }
4889
- )
4927
+ ),
4928
+ /* @__PURE__ */ jsx4("span", { children: "\u5957\u6253\u6A21\u5F0F\uFF1A\u4EC5\u9884\u89C8\u53C2\u8003\u5E95\u56FE\uFF0C\u6253\u5370\u81EA\u52A8\u5265\u79BB\u5E95\u56FE" })
4890
4929
  ] }),
4891
- ioTarget === "browser" ? exportCapReport.warnings.length > 0 ? /* @__PURE__ */ jsxs4(
4892
- "div",
4893
- {
4894
- style: {
4895
- fontSize: 10.5,
4896
- color: "#4E5565",
4897
- background: "#F9FAFB",
4898
- border: "1px solid #E3E5EA",
4899
- padding: "4px 6px",
4900
- borderRadius: 5,
4901
- lineHeight: 1.4
4902
- },
4903
- children: [
4904
- "\u6D4F\u89C8\u5668\u7AEF\u63D0\u793A\uFF1A",
4905
- exportCapReport.warnings.join("\uFF1B"),
4906
- "\uFF08\u9AD8\u4FDD\u771F\u5EFA\u8BAE\u9009\u670D\u52A1\u7AEF\uFF09\u3002"
4907
- ]
4908
- }
4909
- ) : /* @__PURE__ */ jsx4("div", { style: { fontSize: 10.5, color: "#4E5565", lineHeight: 1.4 }, children: "\u6D4F\u89C8\u5668\u672C\u5730\u5904\u7406\uFF1A\u96F6\u6587\u4EF6\u4E0A\u4F20\uFF0C\u652F\u6301\u56FE\u7247/\u6570\u636E\u9A8C\u8BC1/\u6761\u4EF6\u683C\u5F0F\u4E0E\u77E2\u91CF PDF\u3002" }) : /* @__PURE__ */ jsx4("div", { style: { fontSize: 10.5, color: "#4E5565", lineHeight: 1.4 }, children: "\u670D\u52A1\u7AEF\u5904\u7406\uFF1A\u8D70\u540E\u7AEF POI \u9AD8\u4FDD\u771F\u8BFB\u5199\uFF08\u91CD\u65B0\u53D6\u6570\u5C55\u5F00\uFF0C\u5931\u8D25\u4E0D\u9759\u9ED8\u8F6C\u524D\u7AEF\uFF09\u3002" }),
4910
- features.datasetBinding && ioTarget === "browser" && /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 5, fontSize: 11, color: "#31363F", cursor: "pointer" }, children: [
4930
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4931
+ /* @__PURE__ */ jsx4(
4932
+ "input",
4933
+ {
4934
+ type: "checkbox",
4935
+ checked: printCfg.showGridlines,
4936
+ onChange: (e) => {
4937
+ const next = { ...printCfg, showGridlines: e.target.checked };
4938
+ setPrintCfg(next);
4939
+ rebuildPreview(next);
4940
+ }
4941
+ }
4942
+ ),
4943
+ /* @__PURE__ */ jsx4("span", { children: "\u663E\u793A\u7A7A\u767D\u5355\u5143\u683C\u8F85\u52A9\u7F51\u683C\u7EBF" })
4944
+ ] }),
4945
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4911
4946
  /* @__PURE__ */ jsx4(
4912
4947
  "input",
4913
4948
  {
4914
4949
  type: "checkbox",
4915
- checked: skipDatasetOnExport,
4916
- onChange: (e) => setSkipDatasetOnExport(e.target.checked)
4950
+ checked: Boolean(printCfg.wordFormStyle),
4951
+ onChange: (e) => {
4952
+ const next = { ...printCfg, wordFormStyle: e.target.checked };
4953
+ setPrintCfg(next);
4954
+ rebuildPreview(next);
4955
+ }
4917
4956
  }
4918
4957
  ),
4919
- /* @__PURE__ */ jsx4("span", { children: "\u4EC5\u7F16\u7801\u5F53\u524D\u5FEB\u7167\uFF08\u4E0D\u91CD\u590D\u6267\u884C\u6570\u636E\u96C6\u586B\u6570\uFF09" })
4958
+ /* @__PURE__ */ jsx4("span", { children: "\u7C7B Word \u65E0\u8FB9\u6846\u516C\u6587/\u8868\u5355\u98CE\u683C" })
4920
4959
  ] })
4921
- ]
4922
- }
4923
- ),
4924
- importWarnings.length > 0 && /* @__PURE__ */ jsxs4(
4925
- "div",
4926
- {
4927
- style: {
4928
- fontSize: 10.5,
4929
- color: "#4E5565",
4930
- background: "#F9FAFB",
4931
- border: "1px solid #E3E5EA",
4932
- padding: "5px 7px",
4933
- borderRadius: 6,
4934
- lineHeight: 1.4
4935
- },
4936
- children: [
4937
- "\u5BFC\u5165\u964D\u7EA7\u6E05\u5355\uFF1A",
4938
- importWarnings.join("\uFF1B")
4939
- ]
4940
- }
4941
- ),
4942
- /* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
4943
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4944
- /* @__PURE__ */ jsx4(
4945
- "button",
4946
- {
4947
- type: "button",
4948
- className: `yudao-sheet-btn ${tab !== "print" ? "is-primary" : ""}`,
4949
- onClick: () => handleDownload("xlsx"),
4950
- children: "\u5BFC\u51FA Excel (.xlsx)"
4951
- }
4952
- ),
4953
- /* @__PURE__ */ jsx4(
4954
- "button",
4955
- {
4956
- type: "button",
4957
- className: "yudao-sheet-btn",
4958
- onClick: () => handleDownload("xls"),
4959
- children: "\u5BFC\u51FA\u517C\u5BB9 (.xls)"
4960
- }
4961
- )
4962
- ] }),
4963
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4964
- /* @__PURE__ */ jsx4(
4965
- "button",
4966
- {
4967
- type: "button",
4968
- className: `yudao-sheet-btn ${tab === "print" ? "is-primary" : ""}`,
4969
- onClick: () => handleDownload("pdf"),
4970
- children: "\u5BFC\u51FA\u77E2\u91CF PDF"
4971
- }
4972
- ),
4973
- /* @__PURE__ */ jsx4(
4974
- "button",
4975
- {
4976
- type: "button",
4977
- className: "yudao-sheet-btn",
4978
- onClick: () => handleDownload("docx"),
4979
- children: "\u5BFC\u51FA Word (.docx)"
4980
- }
4981
- )
4982
- ] }),
4983
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4984
- /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleImportBySelectedTarget, children: "\u5BFC\u5165 (.xlsx/.xls/.xml/.csv)" }),
4985
- /* @__PURE__ */ jsx4(
4986
- "button",
4987
- {
4988
- type: "button",
4989
- className: "yudao-sheet-btn",
4990
- onClick: () => handleDownload("csv"),
4991
- children: "\u5BFC\u51FA CSV"
4992
- }
4993
- )
4994
- ] }),
4995
- /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4996
- /* @__PURE__ */ jsx4(
4997
- "button",
4960
+ ] }),
4961
+ /* @__PURE__ */ jsxs4(
4962
+ "div",
4998
4963
  {
4999
- type: "button",
5000
- className: "yudao-sheet-btn",
5001
- onClick: () => handleDownload("xml"),
5002
- children: "\u5BFC\u51FA\u6807\u51C6\u62A5\u8868 XML"
4964
+ style: {
4965
+ padding: "6px 8px",
4966
+ background: "#FFFFFF",
4967
+ border: "1px solid #E3E5EA",
4968
+ borderRadius: 6,
4969
+ display: "flex",
4970
+ flexDirection: "column",
4971
+ gap: 5
4972
+ },
4973
+ children: [
4974
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11.5, cursor: "pointer" }, children: [
4975
+ /* @__PURE__ */ jsxs4("span", { style: { display: "inline-flex", alignItems: "center", gap: 5, fontWeight: 600, color: "#1B1C1F" }, children: [
4976
+ /* @__PURE__ */ jsx4(
4977
+ "input",
4978
+ {
4979
+ type: "checkbox",
4980
+ checked: paginationEnabled,
4981
+ onChange: (e) => {
4982
+ const enabled = e.target.checked;
4983
+ setPaginationEnabled(enabled);
4984
+ setPageIndex(1);
4985
+ rebuildPreview(void 0, { enabled, page: 1, pageSize });
4986
+ }
4987
+ }
4988
+ ),
4989
+ "\u5927\u6570\u636E\u5206\u9875\u5207\u7247\u9884\u89C8"
4990
+ ] }),
4991
+ /* @__PURE__ */ jsxs4(
4992
+ "select",
4993
+ {
4994
+ style: {
4995
+ fontSize: 10.5,
4996
+ padding: "1px 4px",
4997
+ borderRadius: 4,
4998
+ border: "1px solid #E3E5EA",
4999
+ background: "#FFFFFF",
5000
+ color: "#31363F"
5001
+ },
5002
+ value: pageSize,
5003
+ disabled: !paginationEnabled,
5004
+ onChange: (e) => {
5005
+ const nextSize = Number(e.target.value);
5006
+ setPageSize(nextSize);
5007
+ setPageIndex(1);
5008
+ rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize: nextSize });
5009
+ },
5010
+ children: [
5011
+ /* @__PURE__ */ jsx4("option", { value: 25, children: "25 \u884C/\u9875" }),
5012
+ /* @__PURE__ */ jsx4("option", { value: 50, children: "50 \u884C/\u9875" }),
5013
+ /* @__PURE__ */ jsx4("option", { value: 100, children: "100 \u884C/\u9875" }),
5014
+ /* @__PURE__ */ jsx4("option", { value: 500, children: "500 \u884C/\u9875" })
5015
+ ]
5016
+ }
5017
+ )
5018
+ ] }),
5019
+ paginationEnabled && /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11 }, children: [
5020
+ /* @__PURE__ */ jsx4(
5021
+ "button",
5022
+ {
5023
+ type: "button",
5024
+ className: "yudao-sheet-btn",
5025
+ style: { padding: "2px 6px", fontSize: 10.5 },
5026
+ disabled: pageIndex <= 1,
5027
+ onClick: () => {
5028
+ const prev = Math.max(1, pageIndex - 1);
5029
+ setPageIndex(prev);
5030
+ rebuildPreview(void 0, { enabled: true, page: prev, pageSize });
5031
+ },
5032
+ children: "\u4E0A\u4E00\u9875"
5033
+ }
5034
+ ),
5035
+ /* @__PURE__ */ jsxs4("span", { style: { color: "#4E5565" }, children: [
5036
+ "\u7B2C ",
5037
+ pageIndex,
5038
+ "/",
5039
+ pageSummary.totalPages,
5040
+ " \u9875 \xB7 \u5171 ",
5041
+ pageSummary.totalRows,
5042
+ " \u884C"
5043
+ ] }),
5044
+ /* @__PURE__ */ jsx4(
5045
+ "button",
5046
+ {
5047
+ type: "button",
5048
+ className: "yudao-sheet-btn",
5049
+ style: { padding: "2px 6px", fontSize: 10.5 },
5050
+ disabled: pageIndex >= pageSummary.totalPages,
5051
+ onClick: () => {
5052
+ const next = Math.min(pageSummary.totalPages, pageIndex + 1);
5053
+ setPageIndex(next);
5054
+ rebuildPreview(void 0, { enabled: true, page: next, pageSize });
5055
+ },
5056
+ children: "\u4E0B\u4E00\u9875"
5057
+ }
5058
+ )
5059
+ ] })
5060
+ ]
5003
5061
  }
5004
5062
  ),
5005
- /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleExportReportPackage, children: "\u5BFC\u51FA\u62A5\u8868\u8FC1\u79FB\u5305 (.json)" })
5006
- ] }),
5007
- /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleImportReportPackage, children: "\u5BFC\u5165\u62A5\u8868\u8FC1\u79FB\u5305 (.yudao-sheet.json)" }),
5008
- /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleBrowserPrint, children: t("yudaoSheets.modal.triggerPrintBtn") }),
5009
- Boolean(ioAdapter.onSave) && /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleSaveToHost, children: "\u4FDD\u5B58\u6A21\u677F\u81F3\u4E1A\u52A1\u540E\u7AEF (onSave)" })
5010
- ] }),
5011
- statusTip && /* @__PURE__ */ jsx4(
5012
- "div",
5013
- {
5014
- style: {
5015
- fontSize: 11,
5016
- color: "#31363F",
5017
- background: "#F3F5FF",
5018
- border: "1px solid #D2DAFA",
5019
- padding: "6px 8px",
5020
- borderRadius: 6,
5021
- lineHeight: 1.4
5022
- },
5023
- children: statusTip
5024
- }
5025
- )
5026
- ]
5027
- }
5028
- ),
5029
- /* @__PURE__ */ jsxs4("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
5030
- /* @__PURE__ */ jsxs4(
5031
- "div",
5032
- {
5033
- className: "yudao-sheet-quick-export-bar",
5034
- style: {
5035
- background: "#F9FAFB",
5036
- borderBottom: "1px solid #E3E5EA",
5037
- padding: "6px 16px",
5038
- display: "flex",
5039
- alignItems: "center",
5040
- justifyContent: "space-between",
5041
- gap: 8,
5042
- flexWrap: "wrap"
5043
- },
5044
- children: [
5045
- /* @__PURE__ */ jsxs4("div", { style: { display: "inline-flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
5046
- /* @__PURE__ */ jsx4("span", { style: { fontSize: 11.5, fontWeight: 600, color: "#31363F" }, children: t("yudaoSheets.modal.quickExportLabel") }),
5047
- [
5048
- ["xlsx", t("yudaoSheets.modal.quickExportXlsx")],
5049
- ["pdf", t("yudaoSheets.modal.quickExportPdf")],
5050
- ["docx", t("yudaoSheets.modal.quickExportDocx")],
5051
- ["csv", t("yudaoSheets.modal.quickExportCsv")],
5052
- ["html", t("yudaoSheets.modal.quickExportHtml")]
5053
- ].map(([fmt, label]) => /* @__PURE__ */ jsx4(
5054
- "button",
5055
- {
5056
- type: "button",
5057
- className: `yudao-sheet-btn ${fmt === "xlsx" ? "is-primary" : ""}`,
5058
- style: { height: 24, padding: "0 9px", fontSize: 11 },
5059
- onClick: () => handleDownload(fmt),
5060
- children: label
5061
- },
5062
- fmt
5063
- ))
5064
- ] }),
5065
- /* @__PURE__ */ jsx4(
5066
- "button",
5067
- {
5068
- type: "button",
5069
- className: "yudao-sheet-btn",
5070
- style: { height: 24, padding: "0 10px", fontSize: 11 },
5071
- onClick: handleBrowserPrint,
5072
- children: t("yudaoSheets.modal.triggerPrintBtn")
5073
- }
5074
- )
5075
- ]
5076
- }
5077
- ),
5078
- queryParamFields.length > 0 && /* @__PURE__ */ jsxs4(
5079
- "div",
5080
- {
5081
- className: "yudao-sheet-query-bar",
5082
- style: {
5083
- background: "#FFFFFF",
5084
- borderBottom: "1px solid #E3E5EA",
5085
- padding: "10px 16px",
5086
- display: "flex",
5087
- flexWrap: "wrap",
5088
- alignItems: "center",
5089
- gap: 10
5090
- },
5091
- children: [
5092
- queryParamFields.map((field) => {
5093
- const rawVal = queryValues[field.name];
5094
- const dictOpts = field.options ?? (field.dictCode ? templateService.getTemplateMetadata(workbook.getUnitId()).dicts?.[field.dictCode] : void 0) ?? [];
5095
- return /* @__PURE__ */ jsxs4(
5063
+ /* @__PURE__ */ jsxs4(
5096
5064
  "div",
5097
5065
  {
5098
5066
  style: {
5099
- display: "inline-flex",
5100
- alignItems: "center",
5101
- gap: 6,
5102
- fontSize: 12,
5103
- color: "#31363F"
5067
+ marginTop: "auto",
5068
+ padding: "8px 10px",
5069
+ background: "#FFFFFF",
5070
+ border: "1px solid #E3E5EA",
5071
+ borderRadius: 8,
5072
+ display: "flex",
5073
+ flexDirection: "column",
5074
+ gap: 6
5104
5075
  },
5105
5076
  children: [
5106
- /* @__PURE__ */ jsxs4("span", { style: { fontWeight: 500, color: "#1B1C1F", whiteSpace: "nowrap" }, children: [
5107
- field.label || field.name,
5108
- field.required ? " *" : "",
5109
- ":"
5077
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5 }, children: [
5078
+ /* @__PURE__ */ jsxs4("span", { style: { fontWeight: 600, color: "#1B1C1F" }, children: [
5079
+ "\u5BFC\u5165/\u5BFC\u51FA\u5904\u7406\u65B9\u5F0F\uFF08\u5F53\u524D .",
5080
+ activeIoFormat,
5081
+ "\uFF09"
5082
+ ] }),
5083
+ /* @__PURE__ */ jsxs4("span", { style: { fontSize: 10.5, color: "#7D8698" }, children: [
5084
+ "\u5FEB\u7167 ",
5085
+ snapSizeKb,
5086
+ " KB"
5087
+ ] })
5110
5088
  ] }),
5111
- field.widget === "select" || field.widget === "cascader" ? /* @__PURE__ */ jsxs4(
5112
- "select",
5089
+ /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-segmented", style: { gridTemplateColumns: "1fr 1fr" }, children: [
5090
+ /* @__PURE__ */ jsxs4(
5091
+ "button",
5092
+ {
5093
+ type: "button",
5094
+ "data-testid": "yudao-io-target-browser",
5095
+ className: `yudao-sheet-segmented-item ${ioTarget === "browser" ? "is-active" : ""}`,
5096
+ onClick: () => {
5097
+ userTouchedTargetRef.current = true;
5098
+ setIoTarget("browser");
5099
+ },
5100
+ children: [
5101
+ /* @__PURE__ */ jsx4("span", { children: "\u6D4F\u89C8\u5668\u5904\u7406" }),
5102
+ /* @__PURE__ */ jsxs4("span", { style: { fontSize: 10, marginLeft: 3, opacity: 0.85 }, children: [
5103
+ "(",
5104
+ browserAvailabilityLabel,
5105
+ ")"
5106
+ ] })
5107
+ ]
5108
+ }
5109
+ ),
5110
+ /* @__PURE__ */ jsxs4(
5111
+ "button",
5112
+ {
5113
+ type: "button",
5114
+ "data-testid": "yudao-io-target-server",
5115
+ className: `yudao-sheet-segmented-item ${ioTarget === "server" ? "is-active" : ""}`,
5116
+ onClick: () => {
5117
+ userTouchedTargetRef.current = true;
5118
+ setIoTarget("server");
5119
+ },
5120
+ title: ioCaps.server.exportSheet || ioCaps.server.importSheet ? `\u8D70\u670D\u52A1\u7AEF\u9002\u914D\u5668 (${ioCaps.server.adapterName})` : "\u5F53\u524D\u672A\u6CE8\u518C\u670D\u52A1\u7AEF\u5BFC\u5165/\u5BFC\u51FA\u9002\u914D\u5668",
5121
+ children: [
5122
+ /* @__PURE__ */ jsx4("span", { children: "\u670D\u52A1\u7AEF\u5904\u7406" }),
5123
+ /* @__PURE__ */ jsxs4("span", { style: { fontSize: 10, marginLeft: 3, opacity: 0.85 }, children: [
5124
+ "(",
5125
+ serverAvailabilityLabel,
5126
+ ")"
5127
+ ] })
5128
+ ]
5129
+ }
5130
+ )
5131
+ ] }),
5132
+ ioTarget === "browser" ? exportCapReport.warnings.length > 0 ? /* @__PURE__ */ jsxs4(
5133
+ "div",
5113
5134
  {
5114
5135
  style: {
5115
- height: 28,
5116
- padding: "0 8px",
5117
- fontSize: 12,
5118
- borderRadius: 6,
5136
+ fontSize: 10.5,
5137
+ color: "#4E5565",
5138
+ background: "#F9FAFB",
5119
5139
  border: "1px solid #E3E5EA",
5120
- background: "#FFFFFF",
5121
- color: "#1B1C1F",
5122
- minWidth: 110
5140
+ padding: "4px 6px",
5141
+ borderRadius: 5,
5142
+ lineHeight: 1.4
5123
5143
  },
5124
- value: rawVal == null ? "" : String(rawVal),
5125
- onChange: (e) => setQueryValues((prev) => ({ ...prev, [field.name]: e.target.value })),
5126
5144
  children: [
5127
- /* @__PURE__ */ jsx4("option", { value: "", children: t("yudaoSheets.modal.allOption") }),
5128
- dictOpts.map((opt) => /* @__PURE__ */ jsx4("option", { value: opt.value, children: opt.label }, opt.value))
5145
+ "\u6D4F\u89C8\u5668\u7AEF\u63D0\u793A\uFF1A",
5146
+ exportCapReport.warnings.join("\uFF1B"),
5147
+ "\uFF08\u9AD8\u4FDD\u771F\u5EFA\u8BAE\u9009\u670D\u52A1\u7AEF\uFF09\u3002"
5129
5148
  ]
5130
5149
  }
5131
- ) : field.widget === "multiSelect" ? /* @__PURE__ */ jsx4(
5132
- "input",
5133
- {
5134
- type: "text",
5135
- placeholder: "\u591A\u503C\u9017\u53F7\u5206\u9694",
5136
- style: {
5137
- height: 28,
5138
- padding: "0 8px",
5139
- fontSize: 12,
5140
- borderRadius: 6,
5141
- border: "1px solid #E3E5EA",
5142
- background: "#FFFFFF",
5143
- color: "#1B1C1F",
5144
- width: 132
5145
- },
5146
- value: Array.isArray(rawVal) ? rawVal.join(",") : rawVal == null ? "" : String(rawVal),
5147
- onChange: (e) => setQueryValues((prev) => ({
5148
- ...prev,
5149
- [field.name]: e.target.value.split(",").map((s) => s.trim()).filter(Boolean)
5150
- }))
5151
- }
5152
- ) : field.widget === "dateRange" ? /* @__PURE__ */ jsxs4("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
5150
+ ) : /* @__PURE__ */ jsx4("div", { style: { fontSize: 10.5, color: "#4E5565", lineHeight: 1.4 }, children: "\u6D4F\u89C8\u5668\u672C\u5730\u5904\u7406\uFF1A\u96F6\u6587\u4EF6\u4E0A\u4F20\uFF0C\u652F\u6301\u56FE\u7247/\u6570\u636E\u9A8C\u8BC1/\u6761\u4EF6\u683C\u5F0F\u4E0E\u77E2\u91CF PDF\u3002" }) : /* @__PURE__ */ jsx4("div", { style: { fontSize: 10.5, color: "#4E5565", lineHeight: 1.4 }, children: "\u670D\u52A1\u7AEF\u5904\u7406\uFF1A\u8D70\u540E\u7AEF\u9AD8\u4FDD\u771F\u8BFB\u5199\u63A5\u53E3\uFF08\u5931\u8D25\u663E\u5F0F\u63D0\u793A\uFF0C\u7EDD\u4E0D\u9759\u9ED8\u964D\u7EA7\uFF09\u3002" }),
5151
+ features.datasetBinding && ioTarget === "browser" && /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 5, fontSize: 11, color: "#31363F", cursor: "pointer" }, children: [
5153
5152
  /* @__PURE__ */ jsx4(
5154
5153
  "input",
5155
5154
  {
5156
- type: "date",
5157
- style: {
5158
- height: 28,
5159
- padding: "0 6px",
5160
- fontSize: 11.5,
5161
- borderRadius: 6,
5162
- border: "1px solid #E3E5EA",
5163
- background: "#FFFFFF",
5164
- color: "#1B1C1F"
5165
- },
5166
- value: Array.isArray(rawVal) ? String(rawVal[0] ?? "") : "",
5167
- onChange: (e) => {
5168
- const curArr = Array.isArray(rawVal) ? [...rawVal] : ["", ""];
5169
- curArr[0] = e.target.value;
5170
- setQueryValues((prev) => ({ ...prev, [field.name]: curArr }));
5171
- }
5155
+ type: "checkbox",
5156
+ checked: skipDatasetOnExport,
5157
+ onChange: (e) => setSkipDatasetOnExport(e.target.checked)
5172
5158
  }
5173
5159
  ),
5174
- /* @__PURE__ */ jsx4("span", { style: { color: "#7D8698" }, children: "-" }),
5175
- /* @__PURE__ */ jsx4(
5176
- "input",
5160
+ /* @__PURE__ */ jsx4("span", { children: "\u4EC5\u7F16\u7801\u5F53\u524D\u5FEB\u7167\uFF08\u4E0D\u91CD\u590D\u6267\u884C\u6570\u636E\u96C6\u586B\u6570\uFF09" })
5161
+ ] })
5162
+ ]
5163
+ }
5164
+ ),
5165
+ ioError && /* @__PURE__ */ jsxs4(
5166
+ "div",
5167
+ {
5168
+ "data-testid": "yudao-io-error-banner",
5169
+ style: {
5170
+ fontSize: 11,
5171
+ color: "#B42318",
5172
+ background: "#FEF3F2",
5173
+ border: "1px solid #FECDCA",
5174
+ padding: "8px 10px",
5175
+ borderRadius: 6,
5176
+ lineHeight: 1.45,
5177
+ display: "flex",
5178
+ flexDirection: "column",
5179
+ gap: 6
5180
+ },
5181
+ children: [
5182
+ /* @__PURE__ */ jsx4("div", { children: ioError }),
5183
+ /* @__PURE__ */ jsx4(
5184
+ "button",
5185
+ {
5186
+ type: "button",
5187
+ "data-testid": "yudao-io-switch-retry",
5188
+ className: "yudao-sheet-btn",
5189
+ style: { alignSelf: "flex-start", borderColor: "#FDA29B", color: "#B42318" },
5190
+ onClick: handleSwitchTargetAndRetry,
5191
+ children: ioTarget === "server" ? "\u5207\u6362\u4E3A\u300C\u6D4F\u89C8\u5668\u5904\u7406\u300D\u91CD\u8BD5" : "\u5207\u6362\u4E3A\u300C\u670D\u52A1\u7AEF\u5904\u7406\u300D\u91CD\u8BD5"
5192
+ }
5193
+ )
5194
+ ]
5195
+ }
5196
+ ),
5197
+ /* @__PURE__ */ jsxs4(
5198
+ "div",
5199
+ {
5200
+ style: {
5201
+ padding: "8px 10px",
5202
+ background: "#FFFFFF",
5203
+ border: "1px solid #E3E5EA",
5204
+ borderRadius: 8,
5205
+ display: "flex",
5206
+ flexDirection: "column",
5207
+ gap: 6
5208
+ },
5209
+ children: [
5210
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5 }, children: [
5211
+ /* @__PURE__ */ jsx4("span", { style: { fontWeight: 600, color: "#1B1C1F" }, children: "\u5DE5\u4F5C\u7C3F\u5BFC\u5165\uFF08\u9884\u68C0\u6682\u5B58\uFF09" }),
5212
+ selectedImportFile && /* @__PURE__ */ jsx4(
5213
+ "span",
5177
5214
  {
5178
- type: "date",
5179
5215
  style: {
5180
- height: 28,
5181
- padding: "0 6px",
5182
- fontSize: 11.5,
5183
- borderRadius: 6,
5184
- border: "1px solid #E3E5EA",
5185
- background: "#FFFFFF",
5186
- color: "#1B1C1F"
5216
+ fontSize: 10.5,
5217
+ color: "#4E5565",
5218
+ maxWidth: 155,
5219
+ overflow: "hidden",
5220
+ textOverflow: "ellipsis",
5221
+ whiteSpace: "nowrap"
5187
5222
  },
5188
- value: Array.isArray(rawVal) ? String(rawVal[1] ?? "") : "",
5189
- onChange: (e) => {
5190
- const curArr = Array.isArray(rawVal) ? [...rawVal] : ["", ""];
5191
- curArr[1] = e.target.value;
5192
- setQueryValues((prev) => ({ ...prev, [field.name]: curArr }));
5193
- }
5223
+ title: selectedImportFile.name,
5224
+ children: selectedImportFile.name
5194
5225
  }
5195
5226
  )
5196
- ] }) : /* @__PURE__ */ jsx4(
5227
+ ] }),
5228
+ /* @__PURE__ */ jsx4(
5197
5229
  "input",
5198
5230
  {
5199
- type: field.widget === "number" ? "number" : field.widget === "date" ? "date" : "text",
5200
- placeholder: `\u8F93\u5165${field.label || field.name}`,
5231
+ ref: fileInputRef,
5232
+ type: "file",
5233
+ "data-testid": "yudao-io-file-input",
5234
+ accept: ".xlsx,.xls,.xml,.csv,.json",
5235
+ style: { display: "none" },
5236
+ onChange: handleFileInputChange
5237
+ }
5238
+ ),
5239
+ /* @__PURE__ */ jsx4(
5240
+ "button",
5241
+ {
5242
+ type: "button",
5243
+ "data-testid": "yudao-io-pick-file",
5244
+ className: `yudao-sheet-btn ${tab === "import" && !pendingImport ? "is-primary" : ""}`,
5245
+ onClick: () => fileInputRef.current?.click(),
5246
+ children: "\u9009\u62E9\u6587\u4EF6\u5BFC\u5165"
5247
+ }
5248
+ ),
5249
+ pendingImport && stagedSheetSummary && /* @__PURE__ */ jsxs4(
5250
+ "div",
5251
+ {
5252
+ "data-testid": "yudao-io-staged-result",
5201
5253
  style: {
5202
- height: 28,
5203
- padding: "0 8px",
5204
- fontSize: 12,
5254
+ fontSize: 11,
5255
+ color: "#31363F",
5256
+ background: "#F9FAFB",
5257
+ border: "1px solid #D2DAFA",
5258
+ padding: "8px",
5205
5259
  borderRadius: 6,
5206
- border: "1px solid #E3E5EA",
5207
- background: "#FFFFFF",
5208
- color: "#1B1C1F",
5209
- width: field.widget === "number" ? 96 : 124
5260
+ display: "flex",
5261
+ flexDirection: "column",
5262
+ gap: 5,
5263
+ lineHeight: 1.45
5210
5264
  },
5211
- value: rawVal == null ? "" : String(rawVal),
5212
- onChange: (e) => setQueryValues((prev) => ({
5213
- ...prev,
5214
- [field.name]: field.widget === "number" && e.target.value !== "" ? Number(e.target.value) : e.target.value
5215
- }))
5265
+ children: [
5266
+ /* @__PURE__ */ jsxs4("div", { style: { fontWeight: 600, color: "#1B1C1F" }, children: [
5267
+ "\u5F85\u786E\u8BA4\u6587\u4EF6\uFF1A",
5268
+ pendingImport.fileName
5269
+ ] }),
5270
+ /* @__PURE__ */ jsxs4("div", { children: [
5271
+ "\u89E3\u6790\u901A\u9053\uFF1A",
5272
+ pendingImport.executedBy === "server" ? "\u670D\u52A1\u7AEF\u5904\u7406" : "\u6D4F\u89C8\u5668\u5904\u7406"
5273
+ ] }),
5274
+ /* @__PURE__ */ jsxs4("div", { children: [
5275
+ "\u5DE5\u4F5C\u8868\u6982\u89C8\uFF1A\u5171 ",
5276
+ stagedSheetSummary.count,
5277
+ " \u4E2A\u5DE5\u4F5C\u8868\uFF08",
5278
+ stagedSheetSummary.names.join("\u3001") || "-",
5279
+ "\uFF09"
5280
+ ] }),
5281
+ /* @__PURE__ */ jsx4("div", { "data-testid": "yudao-io-warnings", style: { color: "#4E5565" }, children: pendingImport.warnings.length > 0 ? /* @__PURE__ */ jsx4("ul", { style: { margin: "2px 0 0", paddingLeft: 16 }, children: pendingImport.warnings.map((w, idx) => /* @__PURE__ */ jsx4("li", { children: w.message }, `${w.code}-${idx}`)) }) : "\u65E0\u517C\u5BB9\u6027\u8B66\u544A" }),
5282
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6, marginTop: 2 }, children: [
5283
+ /* @__PURE__ */ jsx4(
5284
+ "button",
5285
+ {
5286
+ type: "button",
5287
+ "data-testid": "yudao-io-confirm-import",
5288
+ className: "yudao-sheet-btn is-primary",
5289
+ onClick: handleConfirmStagedImport,
5290
+ children: "\u786E\u8BA4\u5E94\u7528\u5230\u8BBE\u8BA1\u5668"
5291
+ }
5292
+ ),
5293
+ /* @__PURE__ */ jsx4(
5294
+ "button",
5295
+ {
5296
+ type: "button",
5297
+ "data-testid": "yudao-io-cancel-import",
5298
+ className: "yudao-sheet-btn",
5299
+ onClick: handleCancelStagedImport,
5300
+ children: "\u53D6\u6D88\u672C\u6B21\u5BFC\u5165"
5301
+ }
5302
+ )
5303
+ ] })
5304
+ ]
5216
5305
  }
5217
5306
  )
5218
5307
  ]
5219
- },
5220
- field.name
5221
- );
5222
- }),
5223
- /* @__PURE__ */ jsxs4("div", { style: { display: "inline-flex", alignItems: "center", gap: 6, marginLeft: "auto" }, children: [
5224
- /* @__PURE__ */ jsx4(
5225
- "button",
5226
- {
5227
- type: "button",
5228
- className: "yudao-sheet-btn is-primary",
5229
- style: { height: 28, padding: "0 12px", fontSize: 12 },
5230
- onClick: () => {
5231
- setPageIndex(1);
5232
- rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize }, queryValues);
5233
- setStatusTip("\u5DF2\u6309\u67E5\u8BE2\u6761\u4EF6\u8FC7\u6EE4\u6570\u636E\u96C6\u5E76\u5237\u65B0\u9884\u89C8");
5234
- },
5235
- children: t("yudaoSheets.modal.queryBtn")
5236
5308
  }
5237
5309
  ),
5238
- /* @__PURE__ */ jsx4(
5239
- "button",
5310
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
5311
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "112px 1fr", gap: 6 }, children: [
5312
+ /* @__PURE__ */ jsxs4(
5313
+ "select",
5314
+ {
5315
+ "data-testid": "yudao-io-export-format",
5316
+ style: {
5317
+ height: 30,
5318
+ padding: "0 6px",
5319
+ fontSize: 11.5,
5320
+ borderRadius: 6,
5321
+ border: "1px solid #E3E5EA",
5322
+ background: "#FFFFFF",
5323
+ color: "#1B1C1F"
5324
+ },
5325
+ value: exportFormat,
5326
+ onChange: (e) => setExportFormat(e.target.value),
5327
+ children: [
5328
+ /* @__PURE__ */ jsx4("option", { value: "xlsx", children: "Excel (.xlsx)" }),
5329
+ /* @__PURE__ */ jsx4("option", { value: "xls", children: "\u517C\u5BB9 (.xls)" }),
5330
+ /* @__PURE__ */ jsx4("option", { value: "pdf", children: "\u77E2\u91CF (.pdf)" }),
5331
+ /* @__PURE__ */ jsx4("option", { value: "docx", children: "Word (.docx)" }),
5332
+ /* @__PURE__ */ jsx4("option", { value: "csv", children: "\u8868\u683C (.csv)" }),
5333
+ /* @__PURE__ */ jsx4("option", { value: "xml", children: "\u62A5\u8868 (.xml)" }),
5334
+ /* @__PURE__ */ jsx4("option", { value: "html", children: "\u7F51\u9875 (.html)" }),
5335
+ /* @__PURE__ */ jsx4("option", { value: "json", children: "\u5FEB\u7167 (.json)" })
5336
+ ]
5337
+ }
5338
+ ),
5339
+ /* @__PURE__ */ jsxs4(
5340
+ "button",
5341
+ {
5342
+ type: "button",
5343
+ "data-testid": "yudao-io-export-download",
5344
+ className: `yudao-sheet-btn ${tab !== "import" ? "is-primary" : ""}`,
5345
+ onClick: () => handleDownload(exportFormat),
5346
+ children: [
5347
+ "\u5BFC\u51FA\u4E0B\u8F7D (.",
5348
+ exportFormat === "xml" ? "report.xml" : exportFormat,
5349
+ ")"
5350
+ ]
5351
+ }
5352
+ )
5353
+ ] }),
5354
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
5355
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleExportReportPackage, children: "\u5BFC\u51FA\u62A5\u8868\u8FC1\u79FB\u5305 (.json)" }),
5356
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleImportReportPackage, children: "\u5BFC\u5165\u62A5\u8868\u8FC1\u79FB\u5305 (.json)" })
5357
+ ] }),
5358
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleBrowserPrint, children: t("yudaoSheets.modal.triggerPrintBtn") }),
5359
+ Boolean(ioAdapter.onSave) && /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleSaveToHost, children: "\u4FDD\u5B58\u6A21\u677F\u81F3\u4E1A\u52A1\u540E\u7AEF (onSave)" })
5360
+ ] }),
5361
+ statusTip && /* @__PURE__ */ jsx4(
5362
+ "div",
5240
5363
  {
5241
- type: "button",
5242
- className: "yudao-sheet-btn",
5243
- style: { height: 28, padding: "0 12px", fontSize: 12 },
5244
- onClick: () => {
5245
- const resetVals = buildInitialQueryValues(queryParamFields);
5246
- setQueryValues(resetVals);
5247
- setPageIndex(1);
5248
- rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize }, resetVals);
5249
- setStatusTip("\u5DF2\u91CD\u7F6E\u67E5\u8BE2\u6761\u4EF6");
5364
+ style: {
5365
+ fontSize: 11,
5366
+ color: "#31363F",
5367
+ background: "#F3F5FF",
5368
+ border: "1px solid #D2DAFA",
5369
+ padding: "6px 8px",
5370
+ borderRadius: 6,
5371
+ lineHeight: 1.4
5250
5372
  },
5251
- children: t("yudaoSheets.modal.resetBtn")
5373
+ children: statusTip
5252
5374
  }
5253
5375
  )
5254
- ] })
5255
- ]
5256
- }
5257
- ),
5258
- /* @__PURE__ */ jsx4("div", { style: { flex: 1, background: "#EEEFF1", padding: 16, overflow: "hidden" }, children: /* @__PURE__ */ jsx4(
5259
- "iframe",
5260
- {
5261
- ref: printIframeRef,
5262
- title: "Sheet Print & Expansion Preview",
5263
- srcDoc: previewHtml,
5264
- style: {
5265
- width: "100%",
5266
- height: "100%",
5267
- border: "1px solid #E3E5EA",
5268
- borderRadius: 8,
5269
- background: "#FFFFFF",
5270
- boxShadow: "0 4px 16px rgba(27, 28, 31, 0.08)"
5376
+ ]
5271
5377
  }
5272
- }
5273
- ) })
5378
+ ),
5379
+ /* @__PURE__ */ jsxs4("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
5380
+ /* @__PURE__ */ jsxs4(
5381
+ "div",
5382
+ {
5383
+ className: "yudao-sheet-quick-export-bar",
5384
+ style: {
5385
+ background: "#F9FAFB",
5386
+ borderBottom: "1px solid #E3E5EA",
5387
+ padding: "6px 16px",
5388
+ display: "flex",
5389
+ alignItems: "center",
5390
+ justifyContent: "space-between",
5391
+ gap: 8,
5392
+ flexWrap: "wrap"
5393
+ },
5394
+ children: [
5395
+ /* @__PURE__ */ jsxs4("div", { style: { display: "inline-flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
5396
+ /* @__PURE__ */ jsx4("span", { style: { fontSize: 11.5, fontWeight: 600, color: "#31363F" }, children: t("yudaoSheets.modal.quickExportLabel") }),
5397
+ [
5398
+ ["xlsx", t("yudaoSheets.modal.quickExportXlsx")],
5399
+ ["pdf", t("yudaoSheets.modal.quickExportPdf")],
5400
+ ["docx", t("yudaoSheets.modal.quickExportDocx")],
5401
+ ["csv", t("yudaoSheets.modal.quickExportCsv")],
5402
+ ["html", t("yudaoSheets.modal.quickExportHtml")]
5403
+ ].map(([fmt, label]) => /* @__PURE__ */ jsx4(
5404
+ "button",
5405
+ {
5406
+ type: "button",
5407
+ className: `yudao-sheet-btn ${fmt === "xlsx" ? "is-primary" : ""}`,
5408
+ style: { height: 24, padding: "0 9px", fontSize: 11 },
5409
+ onClick: () => handleDownload(fmt),
5410
+ children: label
5411
+ },
5412
+ fmt
5413
+ ))
5414
+ ] }),
5415
+ /* @__PURE__ */ jsx4(
5416
+ "button",
5417
+ {
5418
+ type: "button",
5419
+ className: "yudao-sheet-btn",
5420
+ style: { height: 24, padding: "0 10px", fontSize: 11 },
5421
+ onClick: handleBrowserPrint,
5422
+ children: t("yudaoSheets.modal.triggerPrintBtn")
5423
+ }
5424
+ )
5425
+ ]
5426
+ }
5427
+ ),
5428
+ queryParamFields.length > 0 && /* @__PURE__ */ jsxs4(
5429
+ "div",
5430
+ {
5431
+ className: "yudao-sheet-query-bar",
5432
+ style: {
5433
+ background: "#FFFFFF",
5434
+ borderBottom: "1px solid #E3E5EA",
5435
+ padding: "10px 16px",
5436
+ display: "flex",
5437
+ flexWrap: "wrap",
5438
+ alignItems: "center",
5439
+ gap: 10
5440
+ },
5441
+ children: [
5442
+ queryParamFields.map((field) => {
5443
+ const rawVal = queryValues[field.name];
5444
+ const dictOpts = field.options ?? (field.dictCode ? templateService.getTemplateMetadata(workbook.getUnitId()).dicts?.[field.dictCode] : void 0) ?? [];
5445
+ return /* @__PURE__ */ jsxs4(
5446
+ "div",
5447
+ {
5448
+ style: {
5449
+ display: "inline-flex",
5450
+ alignItems: "center",
5451
+ gap: 6,
5452
+ fontSize: 12,
5453
+ color: "#31363F"
5454
+ },
5455
+ children: [
5456
+ /* @__PURE__ */ jsxs4("span", { style: { fontWeight: 500, color: "#1B1C1F", whiteSpace: "nowrap" }, children: [
5457
+ field.label || field.name,
5458
+ field.required ? " *" : "",
5459
+ ":"
5460
+ ] }),
5461
+ field.widget === "select" || field.widget === "cascader" ? /* @__PURE__ */ jsxs4(
5462
+ "select",
5463
+ {
5464
+ style: {
5465
+ height: 28,
5466
+ padding: "0 8px",
5467
+ fontSize: 12,
5468
+ borderRadius: 6,
5469
+ border: "1px solid #E3E5EA",
5470
+ background: "#FFFFFF",
5471
+ color: "#1B1C1F",
5472
+ minWidth: 110
5473
+ },
5474
+ value: rawVal == null ? "" : String(rawVal),
5475
+ onChange: (e) => setQueryValues((prev) => ({ ...prev, [field.name]: e.target.value })),
5476
+ children: [
5477
+ /* @__PURE__ */ jsx4("option", { value: "", children: t("yudaoSheets.modal.allOption") }),
5478
+ dictOpts.map((opt) => /* @__PURE__ */ jsx4("option", { value: opt.value, children: opt.label }, opt.value))
5479
+ ]
5480
+ }
5481
+ ) : field.widget === "multiSelect" ? /* @__PURE__ */ jsx4(
5482
+ "input",
5483
+ {
5484
+ type: "text",
5485
+ placeholder: "\u591A\u503C\u9017\u53F7\u5206\u9694",
5486
+ style: {
5487
+ height: 28,
5488
+ padding: "0 8px",
5489
+ fontSize: 12,
5490
+ borderRadius: 6,
5491
+ border: "1px solid #E3E5EA",
5492
+ background: "#FFFFFF",
5493
+ color: "#1B1C1F",
5494
+ width: 132
5495
+ },
5496
+ value: Array.isArray(rawVal) ? rawVal.join(",") : rawVal == null ? "" : String(rawVal),
5497
+ onChange: (e) => setQueryValues((prev) => ({
5498
+ ...prev,
5499
+ [field.name]: e.target.value.split(",").map((s) => s.trim()).filter(Boolean)
5500
+ }))
5501
+ }
5502
+ ) : field.widget === "dateRange" ? /* @__PURE__ */ jsxs4("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
5503
+ /* @__PURE__ */ jsx4(
5504
+ "input",
5505
+ {
5506
+ type: "date",
5507
+ style: {
5508
+ height: 28,
5509
+ padding: "0 6px",
5510
+ fontSize: 11.5,
5511
+ borderRadius: 6,
5512
+ border: "1px solid #E3E5EA",
5513
+ background: "#FFFFFF",
5514
+ color: "#1B1C1F"
5515
+ },
5516
+ value: Array.isArray(rawVal) ? String(rawVal[0] ?? "") : "",
5517
+ onChange: (e) => {
5518
+ const curArr = Array.isArray(rawVal) ? [...rawVal] : ["", ""];
5519
+ curArr[0] = e.target.value;
5520
+ setQueryValues((prev) => ({ ...prev, [field.name]: curArr }));
5521
+ }
5522
+ }
5523
+ ),
5524
+ /* @__PURE__ */ jsx4("span", { style: { color: "#7D8698" }, children: "-" }),
5525
+ /* @__PURE__ */ jsx4(
5526
+ "input",
5527
+ {
5528
+ type: "date",
5529
+ style: {
5530
+ height: 28,
5531
+ padding: "0 6px",
5532
+ fontSize: 11.5,
5533
+ borderRadius: 6,
5534
+ border: "1px solid #E3E5EA",
5535
+ background: "#FFFFFF",
5536
+ color: "#1B1C1F"
5537
+ },
5538
+ value: Array.isArray(rawVal) ? String(rawVal[1] ?? "") : "",
5539
+ onChange: (e) => {
5540
+ const curArr = Array.isArray(rawVal) ? [...rawVal] : ["", ""];
5541
+ curArr[1] = e.target.value;
5542
+ setQueryValues((prev) => ({ ...prev, [field.name]: curArr }));
5543
+ }
5544
+ }
5545
+ )
5546
+ ] }) : /* @__PURE__ */ jsx4(
5547
+ "input",
5548
+ {
5549
+ type: field.widget === "number" ? "number" : field.widget === "date" ? "date" : "text",
5550
+ placeholder: `\u8F93\u5165${field.label || field.name}`,
5551
+ style: {
5552
+ height: 28,
5553
+ padding: "0 8px",
5554
+ fontSize: 12,
5555
+ borderRadius: 6,
5556
+ border: "1px solid #E3E5EA",
5557
+ background: "#FFFFFF",
5558
+ color: "#1B1C1F",
5559
+ width: field.widget === "number" ? 96 : 124
5560
+ },
5561
+ value: rawVal == null ? "" : String(rawVal),
5562
+ onChange: (e) => setQueryValues((prev) => ({
5563
+ ...prev,
5564
+ [field.name]: field.widget === "number" && e.target.value !== "" ? Number(e.target.value) : e.target.value
5565
+ }))
5566
+ }
5567
+ )
5568
+ ]
5569
+ },
5570
+ field.name
5571
+ );
5572
+ }),
5573
+ /* @__PURE__ */ jsxs4("div", { style: { display: "inline-flex", alignItems: "center", gap: 6, marginLeft: "auto" }, children: [
5574
+ /* @__PURE__ */ jsx4(
5575
+ "button",
5576
+ {
5577
+ type: "button",
5578
+ className: "yudao-sheet-btn is-primary",
5579
+ style: { height: 28, padding: "0 12px", fontSize: 12 },
5580
+ onClick: () => {
5581
+ setPageIndex(1);
5582
+ rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize }, queryValues);
5583
+ setStatusTip("\u5DF2\u6309\u67E5\u8BE2\u6761\u4EF6\u8FC7\u6EE4\u6570\u636E\u96C6\u5E76\u5237\u65B0\u9884\u89C8");
5584
+ },
5585
+ children: t("yudaoSheets.modal.queryBtn")
5586
+ }
5587
+ ),
5588
+ /* @__PURE__ */ jsx4(
5589
+ "button",
5590
+ {
5591
+ type: "button",
5592
+ className: "yudao-sheet-btn",
5593
+ style: { height: 28, padding: "0 12px", fontSize: 12 },
5594
+ onClick: () => {
5595
+ const resetVals = buildInitialQueryValues(queryParamFields);
5596
+ setQueryValues(resetVals);
5597
+ setPageIndex(1);
5598
+ rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize }, resetVals);
5599
+ setStatusTip("\u5DF2\u91CD\u7F6E\u67E5\u8BE2\u6761\u4EF6");
5600
+ },
5601
+ children: t("yudaoSheets.modal.resetBtn")
5602
+ }
5603
+ )
5604
+ ] })
5605
+ ]
5606
+ }
5607
+ ),
5608
+ /* @__PURE__ */ jsx4("div", { style: { flex: 1, background: "#EEEFF1", padding: 16, overflow: "hidden" }, children: /* @__PURE__ */ jsx4(
5609
+ "iframe",
5610
+ {
5611
+ ref: printIframeRef,
5612
+ title: "Sheet Print & Expansion Preview",
5613
+ srcDoc: previewHtml,
5614
+ style: {
5615
+ width: "100%",
5616
+ height: "100%",
5617
+ border: "1px solid #E3E5EA",
5618
+ borderRadius: 8,
5619
+ background: "#FFFFFF",
5620
+ boxShadow: "0 4px 16px rgba(27, 28, 31, 0.08)"
5621
+ }
5622
+ }
5623
+ ) })
5624
+ ] })
5625
+ ] }) : /* @__PURE__ */ jsxs4("div", { style: { flex: 1, padding: 16, display: "flex", flexDirection: "column", gap: 8 }, children: [
5626
+ /* @__PURE__ */ jsxs4("div", { style: { fontSize: 12, color: "#4E5565" }, children: [
5627
+ "\u5F53\u524D\u5DE5\u4F5C\u7C3F\u9075\u5FAA\u6807\u51C6 Univer ",
5628
+ /* @__PURE__ */ jsx4("code", { children: "IWorkbookData" }),
5629
+ " JSON \u89C4\u8303\uFF08\u6269\u5C55\u5C5E\u6027\u5B58\u50A8\u5728",
5630
+ " ",
5631
+ /* @__PURE__ */ jsx4("code", { children: "cell.custom.yudaoMeta" }),
5632
+ "\uFF0C\u65E0\u79C1\u6709\u5916\u90E8\u4F9D\u8D56\uFF09\uFF1A"
5633
+ ] }),
5634
+ /* @__PURE__ */ jsx4("textarea", { className: "yudao-sheet-code-area", readOnly: true, value: jsonText })
5635
+ ] })
5274
5636
  ] })
5275
- ] }) : /* @__PURE__ */ jsxs4("div", { style: { flex: 1, padding: 16, display: "flex", flexDirection: "column", gap: 8 }, children: [
5276
- /* @__PURE__ */ jsxs4("div", { style: { fontSize: 12, color: "#4E5565" }, children: [
5277
- "\u5F53\u524D\u5DE5\u4F5C\u7C3F\u9075\u5FAA\u6807\u51C6 Univer ",
5278
- /* @__PURE__ */ jsx4("code", { children: "IWorkbookData" }),
5279
- " JSON \u89C4\u8303\uFF08\u6269\u5C55\u5C5E\u6027\u5B58\u50A8\u5728",
5280
- " ",
5281
- /* @__PURE__ */ jsx4("code", { children: "cell.custom.yudaoMeta" }),
5282
- "\uFF0C\u65E0\u79C1\u6709\u5916\u90E8\u4F9D\u8D56\uFF09\uFF1A"
5283
- ] }),
5284
- /* @__PURE__ */ jsx4("textarea", { className: "yudao-sheet-code-area", readOnly: true, value: jsonText })
5285
- ] })
5286
- ] }) });
5637
+ }
5638
+ );
5287
5639
  };
5288
5640
 
5289
5641
  // src/views/overlay/SheetRichOverlayHost.tsx
@@ -5420,7 +5772,7 @@ var BuiltinSvgChart = ({ chart, data, onSelectItem }) => {
5420
5772
  index
5421
5773
  });
5422
5774
  };
5423
- const hasWave2Config = Boolean(chart.trendline) && chart.trendline !== "none" || Boolean(chart.errorBars && chart.errorBars.length > 0) || chart.yAxisScale === "log" || Boolean(chart.threeD) || chart.radarShape === "circle" || chart.radarFill !== void 0;
5775
+ const hasWave2Config = Boolean(chart.trendline) && chart.trendline !== "none" || Boolean(chart.errorBars && chart.errorBars.length > 0) || chart.yAxisScale === "log" || Boolean(chart.threeD) || chart.radarShape === "circle" || chart.radarFill !== void 0 || Boolean(chart.smooth) || cType === "lineSmooth" || cType === "lineStackedSmooth" || cType === "linePercentStackedSmooth" || chart.showLegend !== void 0 || Boolean(chart.legendPosition) || Boolean(chart.seriesOrientation) || Boolean(chart.series && chart.series.length > 0);
5424
5776
  if (!LEGACY_INLINE_CHART_TYPES.has(cType) || hasWave2Config) {
5425
5777
  const svgHtml = renderSheetChartSvg(chart, data).replace(
5426
5778
  "<svg ",
@@ -6715,14 +7067,27 @@ var SheetRichOverlayHost = () => {
6715
7067
  });
6716
7068
  const unitId2 = workbook.getUnitId();
6717
7069
  const renderUnit = renderManagerService.getRenderUnitById(unitId2);
6718
- let scrollSub;
6719
- let skelSub;
6720
- try {
6721
- const scrollMgr = renderUnit?.with(SheetScrollManagerService);
6722
- scrollSub = scrollMgr?.validViewportScrollInfo$.subscribe(() => setTick((v) => v + 1));
6723
- const skelMgr = renderUnit?.with(SheetSkeletonManagerService);
6724
- skelSub = skelMgr?.currentSkeleton$.subscribe(() => setTick((v) => v + 1));
6725
- } catch {
7070
+ const renderSubs = [];
7071
+ const bump = () => setTick((v) => v + 1);
7072
+ const watchRenderUnit = (unit) => {
7073
+ if (!unit) return;
7074
+ try {
7075
+ renderSubs.push(unit.with(SheetScrollManagerService).validViewportScrollInfo$.subscribe(bump));
7076
+ renderSubs.push(unit.with(SheetSkeletonManagerService).currentSkeleton$.subscribe(bump));
7077
+ } catch {
7078
+ }
7079
+ renderSubs.push(unit.engine.onTransformChange$.subscribeEvent(bump));
7080
+ bump();
7081
+ };
7082
+ if (renderUnit) {
7083
+ watchRenderUnit(renderUnit);
7084
+ } else {
7085
+ const createdSub = renderManagerService.created$.subscribe((unit) => {
7086
+ if (unit.unitId !== unitId2) return;
7087
+ createdSub.unsubscribe();
7088
+ watchRenderUnit(renderManagerService.getRenderUnitById(unitId2));
7089
+ });
7090
+ renderSubs.push(createdSub);
6726
7091
  }
6727
7092
  const onResize = () => setTick((v) => v + 1);
6728
7093
  window.addEventListener("resize", onResize);
@@ -6808,8 +7173,7 @@ var SheetRichOverlayHost = () => {
6808
7173
  canvasEl?.addEventListener("drop", onDrop);
6809
7174
  return () => {
6810
7175
  disp.dispose();
6811
- scrollSub?.unsubscribe();
6812
- skelSub?.unsubscribe();
7176
+ renderSubs.forEach((sub) => sub.unsubscribe());
6813
7177
  window.removeEventListener("resize", onResize);
6814
7178
  canvasEl?.removeEventListener("dragover", onDragOver);
6815
7179
  canvasEl?.removeEventListener("drop", onDrop);