@yudaocode/univer-sheets-ui 1.6.210 → 1.6.211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/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 = {
@@ -3752,6 +3766,7 @@ import {
3752
3766
  filterDatasetsWithQueryParams,
3753
3767
  generateMockDatasetForTemplate,
3754
3768
  importSheetReportPackage as importSheetReportPackage2,
3769
+ inferSheetFileFormat,
3755
3770
  inspectWorkbookExportCapabilities,
3756
3771
  ISheetIoService as ISheetIoService3,
3757
3772
  ISheetTemplateService as ISheetTemplateService4,
@@ -3770,6 +3785,10 @@ var SheetPreviewAndIoModal = () => {
3770
3785
  const tab = useObservable4(featureService.modalTab$, featureService.getModalTab());
3771
3786
  const features = useObservable4(featureService.features$, featureService.getFeatures());
3772
3787
  const ioAdapter = useObservable4(ioService.adapter$, ioService.getAdapter());
3788
+ const defaultIoTargetPref = useObservable4(
3789
+ ioService.defaultIoTarget$,
3790
+ ioService.getDefaultIoTarget()
3791
+ );
3773
3792
  const workbook = useObservable4(
3774
3793
  () => instanceService.getCurrentTypeOfUnit$(UniverInstanceType4.UNIVER_SHEET),
3775
3794
  instanceService.getCurrentUnitOfType(UniverInstanceType4.UNIVER_SHEET),
@@ -3781,8 +3800,12 @@ var SheetPreviewAndIoModal = () => {
3781
3800
  const [jsonText, setJsonText] = useState3("");
3782
3801
  const [statusTip, setStatusTip] = useState3("");
3783
3802
  const [ioTarget, setIoTarget] = useState3("browser");
3803
+ const [exportFormat, setExportFormat] = useState3("xlsx");
3804
+ const [selectedImportFile, setSelectedImportFile] = useState3(null);
3805
+ const [pendingImport, setPendingImport] = useState3(null);
3806
+ const [ioError, setIoError] = useState3(null);
3807
+ const [lastIoAction, setLastIoAction] = useState3(null);
3784
3808
  const [skipDatasetOnExport, setSkipDatasetOnExport] = useState3(false);
3785
- const [importWarnings, setImportWarnings] = useState3([]);
3786
3809
  const [paginationEnabled, setPaginationEnabled] = useState3(false);
3787
3810
  const [pageIndex, setPageIndex] = useState3(1);
3788
3811
  const [pageSize, setPageSize] = useState3(50);
@@ -3793,6 +3816,10 @@ var SheetPreviewAndIoModal = () => {
3793
3816
  const [queryValues, setQueryValues] = useState3({});
3794
3817
  const metaVersion = useObservable4(templateService.metadataChange$, "");
3795
3818
  void metaVersion;
3819
+ void defaultIoTargetPref;
3820
+ const userTouchedTargetRef = useRef(false);
3821
+ const prevOpenRef = useRef(false);
3822
+ const fileInputRef = useRef(null);
3796
3823
  const [printCfg, setPrintCfg] = useState3({
3797
3824
  paperOrientation: "A4_LANDSCAPE",
3798
3825
  scaleMode: "all",
@@ -3896,7 +3923,10 @@ var SheetPreviewAndIoModal = () => {
3896
3923
  return () => sub.unsubscribe();
3897
3924
  }, [templateService, featureService, workbook]);
3898
3925
  useEffect3(() => {
3926
+ const justOpened = open && !prevOpenRef.current;
3927
+ prevOpenRef.current = open;
3899
3928
  if (!open || !workbook) return;
3929
+ if (!justOpened) return;
3900
3930
  const snap = workbook.save();
3901
3931
  const meta = templateService.getTemplateMetadata(workbook.getUnitId());
3902
3932
  const initialData = meta.sampleData ?? {};
@@ -3957,10 +3987,27 @@ var SheetPreviewAndIoModal = () => {
3957
3987
  )
3958
3988
  );
3959
3989
  setJsonText(JSON.stringify(snap, null, 2));
3960
- setIoTarget(ioService.getIoCapabilities().recommendedDefaultTarget);
3961
- setImportWarnings([]);
3990
+ userTouchedTargetRef.current = false;
3991
+ const initExportFmt = tab === "print" ? "pdf" : "xlsx";
3992
+ setExportFormat(initExportFmt);
3993
+ const caps = ioService.getIoCapabilities();
3994
+ const initOp = tab === "import" ? "import" : "export";
3995
+ const initFmt = initOp === "import" ? "xlsx" : initExportFmt;
3996
+ setIoTarget(caps.formats[initOp]?.[initFmt]?.defaultTarget ?? caps.recommendedDefaultTarget);
3997
+ setSelectedImportFile(null);
3998
+ setPendingImport(null);
3999
+ setIoError(null);
4000
+ setLastIoAction(null);
3962
4001
  setStatusTip("");
3963
- }, [open, workbook, features.datasetBinding, templateService, ioService, ioAdapter]);
4002
+ }, [open, tab, workbook, features.datasetBinding, templateService, ioService]);
4003
+ useEffect3(() => {
4004
+ if (!open || userTouchedTargetRef.current) return;
4005
+ const caps = ioService.getIoCapabilities();
4006
+ const op = tab === "import" ? "import" : "export";
4007
+ const fmt = op === "import" ? selectedImportFile ? inferSheetFileFormat(selectedImportFile.name) : "xlsx" : exportFormat;
4008
+ const nextDefault = caps.formats[op]?.[fmt]?.defaultTarget ?? caps.recommendedDefaultTarget;
4009
+ setIoTarget(nextDefault);
4010
+ }, [open, tab, exportFormat, selectedImportFile, ioAdapter, defaultIoTargetPref, ioService]);
3964
4011
  if (!open || !workbook) return null;
3965
4012
  const ioCaps = ioService.getIoCapabilities();
3966
4013
  const isCustomBackendAdapter = Boolean(
@@ -3968,6 +4015,12 @@ var SheetPreviewAndIoModal = () => {
3968
4015
  );
3969
4016
  const exportCapReport = inspectWorkbookExportCapabilities(workbook.save());
3970
4017
  const snapSizeKb = (exportCapReport.snapshotByteSize / 1024).toFixed(1);
4018
+ const activeIoOp = tab === "import" ? "import" : "export";
4019
+ const activeIoFormat = activeIoOp === "import" ? selectedImportFile ? inferSheetFileFormat(selectedImportFile.name) : "xlsx" : exportFormat;
4020
+ const activeFormatCap = ioCaps.formats[activeIoOp]?.[activeIoFormat];
4021
+ const browserAvailabilityLabel = (activeFormatCap ? activeFormatCap.browser : true) ? "\u53EF\u7528" : "\u4E0D\u652F\u6301\u5F53\u524D\u683C\u5F0F";
4022
+ const serverHasOpHook = activeIoOp === "import" ? ioCaps.server.importSheet : ioCaps.server.exportSheet;
4023
+ const serverAvailabilityLabel = !serverHasOpHook ? "\u672A\u63A5\u5165" : activeFormatCap && !activeFormatCap.server ? "\u4E0D\u652F\u6301\u5F53\u524D\u683C\u5F0F" : "\u53EF\u7528";
3971
4024
  const queryParamFields = templateService.getQueryParamFields(workbook.getUnitId());
3972
4025
  const rebuildPreview = (nextCfg, nextPaging, nextQueryVals) => {
3973
4026
  try {
@@ -4042,7 +4095,28 @@ var SheetPreviewAndIoModal = () => {
4042
4095
  );
4043
4096
  setStatusTip("\u5DF2\u6839\u636E\u6A21\u677F\u5360\u4F4D\u7B26\u81EA\u52A8\u751F\u6210\u7C7B\u578B\u5316\u6A21\u62DF\u6570\u636E\u96C6");
4044
4097
  };
4045
- const handleDownload = async (format) => {
4098
+ const triggerBrowserBlobDownload = (blob, downloadFileName) => {
4099
+ if (typeof URL === "undefined" || typeof URL.createObjectURL !== "function") {
4100
+ return;
4101
+ }
4102
+ const url = URL.createObjectURL(blob);
4103
+ if (typeof document !== "undefined") {
4104
+ const a = document.createElement("a");
4105
+ a.href = url;
4106
+ a.download = downloadFileName;
4107
+ a.click();
4108
+ }
4109
+ setTimeout(() => {
4110
+ if (typeof URL.revokeObjectURL === "function") {
4111
+ URL.revokeObjectURL(url);
4112
+ }
4113
+ }, 1e3);
4114
+ };
4115
+ const handleDownload = async (format, targetOverride) => {
4116
+ const effectiveTarget = targetOverride ?? ioTarget;
4117
+ setExportFormat(format);
4118
+ setLastIoAction({ kind: "export", format });
4119
+ setIoError(null);
4046
4120
  try {
4047
4121
  const unitId = workbook.getUnitId();
4048
4122
  const rawParsedData = format !== "xml" && features.datasetBinding && !skipDatasetOnExport ? JSON.parse(datasetText) : void 0;
@@ -4056,71 +4130,120 @@ var SheetPreviewAndIoModal = () => {
4056
4130
  printConfig: printCfg,
4057
4131
  metadata: templateService.getTemplateMetadata(unitId),
4058
4132
  implicitExpand: templateService.getImplicitExpand(unitId),
4059
- target: ioTarget
4133
+ target: effectiveTarget
4060
4134
  });
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";
4135
+ 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
4136
  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
4137
  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";
4138
+ triggerBrowserBlobDownload(blob, `${workbook.name || "workbook"}.${ext}`);
4139
+ const channelLabel = effectiveTarget === "server" ? `\u670D\u52A1\u7AEF (${ioAdapter.name})` : "\u6D4F\u89C8\u5668\u672C\u5730\u5F15\u64CE";
4071
4140
  setStatusTip(`\u5DF2\u901A\u8FC7 ${channelLabel} \u5BFC\u51FA .${ext} \u6587\u4EF6`);
4072
4141
  } 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}`);
4142
+ const exactMessage = err?.message || String(err);
4143
+ setIoError(exactMessage);
4144
+ setStatusTip(`\u5BFC\u51FA\u5931\u8D25: ${exactMessage}`);
4075
4145
  }
4076
4146
  };
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
- }
4147
+ const runStagedImport = async (file, targetOverride) => {
4148
+ const effectiveTarget = targetOverride ?? ioTarget;
4149
+ setSelectedImportFile(file);
4150
+ setLastIoAction({ kind: "import", file });
4151
+ setIoError(null);
4152
+ setPendingImport(null);
4153
+ try {
4154
+ const unitId = workbook.getUnitId();
4155
+ const outcome = await ioService.importSheetWithReport(file, {
4156
+ unitId,
4157
+ target: effectiveTarget
4158
+ });
4159
+ const snapshot = outcome.snapshot ?? outcome.workbookData;
4160
+ setPendingImport({
4161
+ snapshot,
4162
+ warnings: outcome.warnings,
4163
+ executedBy: outcome.executedBy,
4164
+ fileName: outcome.fileName || file.name
4165
+ });
4166
+ setStatusTip(
4167
+ `\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`
4168
+ );
4169
+ } catch (err) {
4170
+ const exactMessage = err?.message || String(err);
4171
+ setIoError(exactMessage);
4172
+ setStatusTip(`\u5BFC\u5165\u5931\u8D25: ${exactMessage}`);
4173
+ }
4174
+ };
4175
+ const handleFileInputChange = (e) => {
4176
+ const file = e.target.files?.[0];
4177
+ if (e.target) {
4178
+ e.target.value = "";
4179
+ }
4180
+ if (!file) return;
4181
+ void runStagedImport(file);
4182
+ };
4183
+ const handleConfirmStagedImport = () => {
4184
+ if (!pendingImport) return;
4185
+ const unitId = workbook.getUnitId();
4186
+ const imported = pendingImport.snapshot;
4187
+ const prevMeta = templateService.getTemplateMetadata(unitId);
4188
+ const xmlMeta = imported.__templateMetadata ?? {};
4189
+ const mergedBase = mergeImportedTemplateMetadata(prevMeta, xmlMeta);
4190
+ const nextMeta = {
4191
+ ...mergedBase,
4192
+ ...imported.definedNames ? { definedNames: imported.definedNames } : {},
4193
+ ...typeof imported.workbookStructureLocked === "boolean" ? { workbookStructureLocked: imported.workbookStructureLocked } : {},
4194
+ ...imported.conditionalRules ? { conditionalRules: imported.conditionalRules } : {},
4195
+ ...imported.cellNotes ? { cellNotes: imported.cellNotes } : {}
4122
4196
  };
4123
- input.click();
4197
+ commandService.syncExecuteCommand(ApplyImportedWorkbookDataCommand3.id, {
4198
+ unitId,
4199
+ workbookData: imported,
4200
+ metadata: nextMeta
4201
+ });
4202
+ const effectivePrintCfg = nextMeta.printConfig ? { ...printCfg, ...nextMeta.printConfig } : printCfg;
4203
+ if (nextMeta.printConfig) {
4204
+ setPrintCfg(effectivePrintCfg);
4205
+ }
4206
+ setPendingImport(null);
4207
+ setIoError(null);
4208
+ setJsonText(JSON.stringify(workbook.save(), null, 2));
4209
+ setPreviewHtml(
4210
+ renderPreviewSnapshotHtml(
4211
+ workbook.save(),
4212
+ void 0,
4213
+ effectivePrintCfg,
4214
+ paginationEnabled,
4215
+ pageIndex,
4216
+ pageSize
4217
+ )
4218
+ );
4219
+ 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");
4220
+ };
4221
+ const handleCancelStagedImport = () => {
4222
+ setPendingImport(null);
4223
+ setIoError(null);
4224
+ setStatusTip("\u5DF2\u53D6\u6D88\u672C\u6B21\u5BFC\u5165\uFF0C\u5F53\u524D\u5DE5\u4F5C\u7C3F\u672A\u53D1\u751F\u53D8\u66F4");
4225
+ };
4226
+ const handleSwitchTargetAndRetry = () => {
4227
+ const nextTarget = ioTarget === "server" ? "browser" : "server";
4228
+ userTouchedTargetRef.current = true;
4229
+ setIoTarget(nextTarget);
4230
+ setIoError(null);
4231
+ if (lastIoAction?.kind === "import") {
4232
+ const retryFile = lastIoAction.file ?? selectedImportFile;
4233
+ if (retryFile) {
4234
+ void runStagedImport(retryFile, nextTarget);
4235
+ }
4236
+ return;
4237
+ }
4238
+ if (lastIoAction?.kind === "export") {
4239
+ void handleDownload(lastIoAction.format, nextTarget);
4240
+ return;
4241
+ }
4242
+ if (selectedImportFile && tab === "import") {
4243
+ void runStagedImport(selectedImportFile, nextTarget);
4244
+ return;
4245
+ }
4246
+ void handleDownload(exportFormat, nextTarget);
4124
4247
  };
4125
4248
  const handleExportReportPackage = () => {
4126
4249
  try {
@@ -4130,12 +4253,7 @@ var SheetPreviewAndIoModal = () => {
4130
4253
  templateService.getTemplateMetadata(unitId)
4131
4254
  );
4132
4255
  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);
4256
+ triggerBrowserBlobDownload(blob, `${workbook.name || "report"}.yudao-sheet.json`);
4139
4257
  setStatusTip("\u5DF2\u5BFC\u51FA\u5B8C\u6574\u62A5\u8868\u8FC1\u79FB\u5305 (.yudao-sheet.json)");
4140
4258
  } catch (err) {
4141
4259
  setStatusTip(`\u5BFC\u51FA\u8FC1\u79FB\u5305\u5931\u8D25: ${err?.message || String(err)}`);
@@ -4201,1089 +4319,1256 @@ var SheetPreviewAndIoModal = () => {
4201
4319
  setStatusTip("\u5DF2\u5524\u8D77\u6D4F\u89C8\u5668\u77E2\u91CF\u6253\u5370\u5E76\u89E6\u53D1 onAfterPrint / onSheetPrintConfirmed \u6253\u5370\u5B8C\u6210\u56DE\u8C03");
4202
4320
  }
4203
4321
  };
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)" }),
4418
- /* @__PURE__ */ jsx4(
4419
- "input",
4420
- {
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
- }
4433
- }
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" }),
4322
+ const stagedSheetSummary = pendingImport ? (() => {
4323
+ const sheetsObj = pendingImport.snapshot.sheets ?? {};
4324
+ const orderedIds = pendingImport.snapshot.sheetOrder && pendingImport.snapshot.sheetOrder.length > 0 ? pendingImport.snapshot.sheetOrder.filter((id) => Boolean(sheetsObj[id])) : Object.keys(sheetsObj);
4325
+ const names = orderedIds.map((id, idx) => sheetsObj[id]?.name || `Sheet${idx + 1}`);
4326
+ return { count: names.length, names };
4327
+ })() : null;
4328
+ return /* @__PURE__ */ jsx4(
4329
+ "div",
4330
+ {
4331
+ className: "yudao-sheet-modal-backdrop",
4332
+ "data-testid": "yudao-io-modal",
4333
+ onClick: handleCloseModal,
4334
+ children: /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-card", onClick: (e) => e.stopPropagation(), children: [
4335
+ /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-header", children: [
4336
+ /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-modal-tabs", children: [
4337
+ /* @__PURE__ */ jsx4(
4338
+ "button",
4339
+ {
4340
+ type: "button",
4341
+ className: `yudao-sheet-modal-tab ${tab === "import" ? "is-active" : ""}`,
4342
+ onClick: () => featureService.setModalTab("import"),
4343
+ children: t("yudaoSheets.modal.tabImport")
4344
+ }
4345
+ ),
4346
+ /* @__PURE__ */ jsx4(
4347
+ "button",
4348
+ {
4349
+ type: "button",
4350
+ className: `yudao-sheet-modal-tab ${tab === "export" ? "is-active" : ""}`,
4351
+ onClick: () => featureService.setModalTab("export"),
4352
+ children: t("yudaoSheets.modal.tabExport")
4353
+ }
4354
+ ),
4355
+ features.printTemplate && /* @__PURE__ */ jsx4(
4356
+ "button",
4357
+ {
4358
+ type: "button",
4359
+ className: `yudao-sheet-modal-tab ${tab === "print" ? "is-active" : ""}`,
4360
+ onClick: () => featureService.setModalTab("print"),
4361
+ children: t("yudaoSheets.modal.tabPrint")
4362
+ }
4363
+ ),
4364
+ /* @__PURE__ */ jsx4(
4365
+ "button",
4366
+ {
4367
+ type: "button",
4368
+ className: `yudao-sheet-modal-tab ${tab === "json" ? "is-active" : ""}`,
4369
+ onClick: () => featureService.setModalTab("json"),
4370
+ children: t("yudaoSheets.modal.tabJson")
4371
+ }
4372
+ )
4373
+ ] }),
4374
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
4375
+ /* @__PURE__ */ jsxs4(
4376
+ "span",
4377
+ {
4378
+ style: {
4379
+ fontSize: 11,
4380
+ padding: "3px 8px",
4381
+ borderRadius: 999,
4382
+ background: isCustomBackendAdapter ? "#F3F5FF" : "#EEEFF1",
4383
+ color: isCustomBackendAdapter ? "#2C53F1" : "#4E5565",
4384
+ border: `1px solid ${isCustomBackendAdapter ? "#D2DAFA" : "transparent"}`,
4385
+ fontWeight: 500
4386
+ },
4387
+ children: [
4388
+ t("yudaoSheets.modal.ioPipelinePrefix"),
4389
+ ": ",
4390
+ ioAdapter.name || "frontend-default"
4391
+ ]
4392
+ }
4393
+ ),
4394
+ /* @__PURE__ */ jsx4(
4395
+ "button",
4396
+ {
4397
+ type: "button",
4398
+ className: "yudao-sheet-btn",
4399
+ onClick: handleCloseModal,
4400
+ children: "\xD7"
4401
+ }
4402
+ )
4403
+ ] })
4404
+ ] }),
4405
+ tab === "import" || tab === "export" || tab === "print" ? /* @__PURE__ */ jsxs4("div", { style: { flex: 1, minHeight: 0, display: "flex" }, children: [
4406
+ /* @__PURE__ */ jsxs4(
4407
+ "div",
4408
+ {
4409
+ style: {
4410
+ width: (tab === "export" || tab === "import") && features.datasetBinding ? 336 : 318,
4411
+ borderRight: "1px solid #E3E5EA",
4412
+ padding: 14,
4413
+ display: "flex",
4414
+ flexDirection: "column",
4415
+ gap: 8,
4416
+ background: "#F9FAFB",
4417
+ overflowY: "auto"
4418
+ },
4419
+ children: [
4420
+ tab === "import" ? /* @__PURE__ */ jsxs4("div", { style: { fontSize: 12, color: "#4E5565", lineHeight: 1.55 }, children: [
4421
+ "\u652F\u6301\u9884\u68C0\u89E3\u6790\u672C\u5730\u6216\u670D\u52A1\u7AEF ",
4422
+ /* @__PURE__ */ jsx4("code", { children: ".xlsx" }),
4423
+ " / ",
4424
+ /* @__PURE__ */ jsx4("code", { children: ".xls" }),
4425
+ " / ",
4426
+ /* @__PURE__ */ jsx4("code", { children: ".csv" }),
4427
+ " / ",
4428
+ /* @__PURE__ */ jsx4("code", { children: ".xml" }),
4429
+ " / ",
4430
+ /* @__PURE__ */ jsx4("code", { children: ".json" }),
4431
+ " \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"
4432
+ ] }) : tab === "export" ? features.datasetBinding ? /* @__PURE__ */ jsxs4(Fragment2, { children: [
4433
+ /* @__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" }),
4539
4434
  /* @__PURE__ */ jsx4(
4540
- "input",
4435
+ "textarea",
4541
4436
  {
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
- }
4437
+ className: "yudao-sheet-code-area",
4438
+ value: datasetText,
4439
+ onChange: (e) => setDatasetText(e.target.value)
4550
4440
  }
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);
4441
+ ),
4442
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", gap: 6, flexWrap: "wrap" }, children: [
4443
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: () => rebuildPreview(), children: t("yudaoSheets.modal.refreshPreviewBtn") }),
4444
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleGenerateMockDataset, children: t("yudaoSheets.modal.mockDatasetBtn") }),
4445
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleApplyToSheet, children: t("yudaoSheets.modal.applyToSheetBtn") })
4446
+ ] })
4447
+ ] }) : /* @__PURE__ */ jsxs4("div", { style: { fontSize: 12, color: "#4E5565", lineHeight: 1.6 }, children: [
4448
+ "\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",
4449
+ " ",
4450
+ /* @__PURE__ */ jsx4("code", { children: ".xlsx" }),
4451
+ " \u4E0E ",
4452
+ /* @__PURE__ */ jsx4("code", { children: ".pdf" }),
4453
+ " \u6587\u4EF6\u3002"
4454
+ ] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
4455
+ /* @__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" }),
4456
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4457
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4458
+ /* @__PURE__ */ jsx4("span", { children: "\u7EB8\u5F20\u4E0E\u9488\u5F0F\u7968\u636E\u89C4\u683C" }),
4459
+ /* @__PURE__ */ jsxs4(
4460
+ "select",
4461
+ {
4462
+ value: printCfg.paperOrientation,
4463
+ onChange: (e) => {
4464
+ const next = {
4465
+ ...printCfg,
4466
+ paperOrientation: e.target.value
4467
+ };
4468
+ setPrintCfg(next);
4469
+ rebuildPreview(next);
4470
+ },
4471
+ children: [
4472
+ /* @__PURE__ */ jsx4("option", { value: "A4_LANDSCAPE", children: "A4 \u6A2A\u5411" }),
4473
+ /* @__PURE__ */ jsx4("option", { value: "A4_PORTRAIT", children: "A4 \u7EB5\u5411" }),
4474
+ /* @__PURE__ */ jsx4("option", { value: "A3_LANDSCAPE", children: "A3 \u6A2A\u5411" }),
4475
+ /* @__PURE__ */ jsx4("option", { value: "INVOICE_240_140", children: "240\xD7140mm \u4E8C\u7B49\u5206" }),
4476
+ /* @__PURE__ */ jsx4("option", { value: "INVOICE_240_93", children: "240\xD793mm \u4E09\u7B49\u5206" })
4477
+ ]
4478
+ }
4479
+ )
4480
+ ] }),
4481
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4482
+ /* @__PURE__ */ jsx4("span", { children: "\u6253\u5370/PDF \u7F29\u653E\u6A21\u5F0F" }),
4483
+ /* @__PURE__ */ jsxs4(
4484
+ "select",
4485
+ {
4486
+ value: printCfg.scaleMode ?? "all",
4487
+ onChange: (e) => {
4488
+ const next = {
4489
+ ...printCfg,
4490
+ scaleMode: e.target.value
4491
+ };
4492
+ setPrintCfg(next);
4493
+ rebuildPreview(next);
4494
+ },
4495
+ children: [
4496
+ /* @__PURE__ */ jsx4("option", { value: "all", children: "\u6807\u51C6\u5206\u9875" }),
4497
+ /* @__PURE__ */ jsx4("option", { value: "fitWidth", children: "\u9002\u5E94\u9875\u5BBD" }),
4498
+ /* @__PURE__ */ jsx4("option", { value: "fitSinglePage", children: "\u7F29\u81F3\u4E00\u9875" }),
4499
+ /* @__PURE__ */ jsx4("option", { value: "currentPage", children: "\u5F53\u524D\u9875" })
4500
+ ]
4501
+ }
4502
+ )
4503
+ ] })
4504
+ ] }),
4505
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4506
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4507
+ /* @__PURE__ */ jsx4("span", { children: "\u91CD\u590D\u8868\u5934\u884C (thead)" }),
4508
+ /* @__PURE__ */ jsx4(
4509
+ "input",
4510
+ {
4511
+ type: "number",
4512
+ min: 0,
4513
+ max: 20,
4514
+ value: printCfg.repeatHeaderRow ?? 0,
4515
+ onChange: (e) => {
4516
+ const n = Number(e.target.value);
4517
+ const next = { ...printCfg, repeatHeaderRow: n > 0 ? n : null };
4518
+ setPrintCfg(next);
4519
+ rebuildPreview(next);
4520
+ }
4521
+ }
4522
+ )
4523
+ ] }),
4524
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4525
+ /* @__PURE__ */ jsx4("span", { children: "\u91CD\u590D\u5C3E\u884C\u6570 (tfoot)" }),
4526
+ /* @__PURE__ */ jsx4(
4527
+ "input",
4528
+ {
4529
+ type: "number",
4530
+ min: 0,
4531
+ max: 10,
4532
+ value: printCfg.repeatFooterRows ?? 0,
4533
+ onChange: (e) => {
4534
+ const next = {
4535
+ ...printCfg,
4536
+ repeatFooterRows: Math.max(0, Number(e.target.value) || 0)
4537
+ };
4538
+ setPrintCfg(next);
4539
+ rebuildPreview(next);
4540
+ }
4541
+ }
4542
+ )
4543
+ ] })
4544
+ ] }),
4545
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 6 }, children: [
4546
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4547
+ /* @__PURE__ */ jsx4("span", { children: "\u591A\u680F\u5217\u6570" }),
4548
+ /* @__PURE__ */ jsx4(
4549
+ "input",
4550
+ {
4551
+ type: "number",
4552
+ min: 1,
4553
+ max: 4,
4554
+ value: printCfg.multiColumnCount ?? 1,
4555
+ onChange: (e) => {
4556
+ const n = Math.max(1, Math.min(4, Number(e.target.value) || 1));
4557
+ const next = {
4558
+ ...printCfg,
4559
+ multiColumnCount: n > 1 ? n : void 0
4560
+ };
4561
+ setPrintCfg(next);
4562
+ rebuildPreview(next);
4563
+ }
4564
+ }
4565
+ )
4566
+ ] }),
4567
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4568
+ /* @__PURE__ */ jsx4("span", { children: "\u680F\u95F4\u8DDD (pt)" }),
4569
+ /* @__PURE__ */ jsx4(
4570
+ "input",
4571
+ {
4572
+ type: "number",
4573
+ min: 0,
4574
+ max: 72,
4575
+ value: printCfg.columnMarginPt ?? 12,
4576
+ onChange: (e) => {
4577
+ const next = {
4578
+ ...printCfg,
4579
+ columnMarginPt: Math.max(0, Number(e.target.value) || 0)
4580
+ };
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: "\u5B9A\u884C\u5206\u9875" }),
4589
+ /* @__PURE__ */ jsx4(
4590
+ "input",
4591
+ {
4592
+ type: "number",
4593
+ min: 0,
4594
+ max: 200,
4595
+ placeholder: "\u81EA\u52A8",
4596
+ value: printCfg.fixedRowsPerPage ?? "",
4597
+ onChange: (e) => {
4598
+ const raw = e.target.value.trim();
4599
+ const n = raw === "" ? 0 : Math.max(0, Number(raw) || 0);
4600
+ const next = {
4601
+ ...printCfg,
4602
+ fixedRowsPerPage: n > 0 ? n : void 0
4603
+ };
4604
+ setPrintCfg(next);
4605
+ rebuildPreview(next);
4606
+ }
4607
+ }
4608
+ )
4609
+ ] })
4610
+ ] }),
4611
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4612
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4613
+ /* @__PURE__ */ jsx4("span", { children: "\u7F16\u9875\u8D77\u59CB\u7269\u7406\u9875" }),
4614
+ /* @__PURE__ */ jsx4(
4615
+ "input",
4616
+ {
4617
+ type: "number",
4618
+ min: 1,
4619
+ max: 99,
4620
+ title: "\u5982\u8BBE\u4E3A 2 \u53EF\u8DF3\u8FC7\u7B2C 1 \u9875\u5C01\u9762\u4E0D\u7F16\u9875\u7801",
4621
+ value: printCfg.pageNumberStartPage ?? 1,
4622
+ onChange: (e) => {
4623
+ const next = {
4624
+ ...printCfg,
4625
+ pageNumberStartPage: Math.max(1, Number(e.target.value) || 1)
4626
+ };
4627
+ setPrintCfg(next);
4628
+ rebuildPreview(next);
4629
+ }
4630
+ }
4631
+ )
4632
+ ] }),
4633
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4634
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u7801\u5BF9\u9F50\u65B9\u5F0F" }),
4635
+ /* @__PURE__ */ jsxs4(
4636
+ "select",
4637
+ {
4638
+ value: printCfg.pageNumberAlign ?? "right",
4639
+ onChange: (e) => {
4640
+ const next = {
4641
+ ...printCfg,
4642
+ pageNumberAlign: e.target.value
4643
+ };
4644
+ setPrintCfg(next);
4645
+ rebuildPreview(next);
4646
+ },
4647
+ children: [
4648
+ /* @__PURE__ */ jsx4("option", { value: "left", children: "\u5C45\u5DE6" }),
4649
+ /* @__PURE__ */ jsx4("option", { value: "center", children: "\u5C45\u4E2D" }),
4650
+ /* @__PURE__ */ jsx4("option", { value: "right", children: "\u5C45\u53F3" })
4651
+ ]
4652
+ }
4653
+ )
4654
+ ] })
4655
+ ] }),
4656
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4657
+ /* @__PURE__ */ jsx4("span", { children: "\u6253\u5370\u9875\u7709\u6807\u9898" }),
4658
+ /* @__PURE__ */ jsx4(
4659
+ "input",
4660
+ {
4661
+ type: "text",
4662
+ value: printCfg.headerTitle,
4663
+ onChange: (e) => {
4664
+ const next = { ...printCfg, headerTitle: e.target.value };
4665
+ setPrintCfg(next);
4666
+ rebuildPreview(next);
4667
+ }
4615
4668
  }
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: [
4669
+ )
4670
+ ] }),
4671
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 4 }, children: [
4672
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4673
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u7709\u5DE6 (&D/&F)" }),
4758
4674
  /* @__PURE__ */ jsx4(
4759
4675
  "input",
4760
4676
  {
4761
- type: "checkbox",
4762
- checked: paginationEnabled,
4677
+ type: "text",
4678
+ placeholder: "\u5982 &D",
4679
+ value: printCfg.headerLeft ?? "",
4763
4680
  onChange: (e) => {
4764
- const enabled = e.target.checked;
4765
- setPaginationEnabled(enabled);
4766
- setPageIndex(1);
4767
- rebuildPreview(void 0, { enabled, page: 1, pageSize });
4681
+ const next = { ...printCfg, headerLeft: e.target.value };
4682
+ setPrintCfg(next);
4683
+ rebuildPreview(next);
4768
4684
  }
4769
4685
  }
4770
- ),
4771
- "\u5927\u6570\u636E\u5206\u9875\u5207\u7247\u9884\u89C8"
4686
+ )
4772
4687
  ] }),
4773
- /* @__PURE__ */ jsxs4(
4774
- "select",
4688
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4689
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u7709\u4E2D" }),
4690
+ /* @__PURE__ */ jsx4(
4691
+ "input",
4692
+ {
4693
+ type: "text",
4694
+ placeholder: "\u5982 &A",
4695
+ value: printCfg.headerCenter ?? "",
4696
+ onChange: (e) => {
4697
+ const next = { ...printCfg, headerCenter: e.target.value };
4698
+ setPrintCfg(next);
4699
+ rebuildPreview(next);
4700
+ }
4701
+ }
4702
+ )
4703
+ ] }),
4704
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4705
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u7709\u53F3 (&P/&N)" }),
4706
+ /* @__PURE__ */ jsx4(
4707
+ "input",
4708
+ {
4709
+ type: "text",
4710
+ placeholder: "\u5982 \u7B2C&P/&N\u9875",
4711
+ value: printCfg.headerRight ?? "",
4712
+ onChange: (e) => {
4713
+ const next = { ...printCfg, headerRight: e.target.value };
4714
+ setPrintCfg(next);
4715
+ rebuildPreview(next);
4716
+ }
4717
+ }
4718
+ )
4719
+ ] })
4720
+ ] }),
4721
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 4 }, children: [
4722
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4723
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u811A\u5DE6" }),
4724
+ /* @__PURE__ */ jsx4(
4725
+ "input",
4726
+ {
4727
+ type: "text",
4728
+ placeholder: "\u5236\u8868\u90E8\u95E8",
4729
+ value: printCfg.footerLeft ?? "",
4730
+ onChange: (e) => {
4731
+ const next = { ...printCfg, footerLeft: e.target.value };
4732
+ setPrintCfg(next);
4733
+ rebuildPreview(next);
4734
+ }
4735
+ }
4736
+ )
4737
+ ] }),
4738
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4739
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u811A\u4E2D" }),
4740
+ /* @__PURE__ */ jsx4(
4741
+ "input",
4742
+ {
4743
+ type: "text",
4744
+ placeholder: "&F",
4745
+ value: printCfg.footerCenter ?? "",
4746
+ onChange: (e) => {
4747
+ const next = { ...printCfg, footerCenter: e.target.value };
4748
+ setPrintCfg(next);
4749
+ rebuildPreview(next);
4750
+ }
4751
+ }
4752
+ )
4753
+ ] }),
4754
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4755
+ /* @__PURE__ */ jsx4("span", { children: "\u9875\u811A\u53F3" }),
4756
+ /* @__PURE__ */ jsx4(
4757
+ "input",
4758
+ {
4759
+ type: "text",
4760
+ placeholder: "#[PAGE]/#[PAGES]",
4761
+ value: printCfg.footerRight ?? "",
4762
+ onChange: (e) => {
4763
+ const next = { ...printCfg, footerRight: e.target.value };
4764
+ setPrintCfg(next);
4765
+ rebuildPreview(next);
4766
+ }
4767
+ }
4768
+ )
4769
+ ] })
4770
+ ] }),
4771
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4772
+ /* @__PURE__ */ jsx4("span", { children: "\u659C\u5411\u9632\u4F2A\u5E73\u94FA\u6C34\u5370\u6587\u5B57" }),
4773
+ /* @__PURE__ */ jsx4(
4774
+ "input",
4775
4775
  {
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,
4776
+ type: "text",
4777
+ placeholder: "\u5982\uFF1A\u4F01\u4E1A\u62A5\u8868 \xB7 \u5185\u90E8\u8D44\u6599",
4778
+ value: printCfg.watermarkText ?? "",
4786
4779
  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
- ]
4780
+ const next = { ...printCfg, watermarkText: e.target.value };
4781
+ setPrintCfg(next);
4782
+ rebuildPreview(next);
4783
+ }
4798
4784
  }
4799
4785
  )
4800
4786
  ] }),
4801
- paginationEnabled && /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11 }, children: [
4787
+ /* @__PURE__ */ jsxs4("label", { className: "yudao-sheet-field-row", children: [
4788
+ /* @__PURE__ */ jsx4("span", { children: "\u7269\u7406\u5957\u6253\u6821\u51C6\u5E95\u56FE URL\uFF08\u53EF\u9009\uFF09" }),
4802
4789
  /* @__PURE__ */ jsx4(
4803
- "button",
4790
+ "input",
4804
4791
  {
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"
4792
+ type: "text",
4793
+ placeholder: "\u8F93\u5165\u9884\u5370\u53D1\u7968/\u8BC1\u4E66\u626B\u63CF\u4EF6\u56FE\u7247 URL",
4794
+ value: printCfg.overlayBackgroundUrl ?? "",
4795
+ onChange: (e) => {
4796
+ const next = { ...printCfg, overlayBackgroundUrl: e.target.value };
4797
+ setPrintCfg(next);
4798
+ rebuildPreview(next);
4799
+ }
4800
+ }
4801
+ )
4802
+ ] }),
4803
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4804
+ /* @__PURE__ */ jsx4(
4805
+ "input",
4806
+ {
4807
+ type: "checkbox",
4808
+ checked: Boolean(printCfg.pinFooterToBottom),
4809
+ onChange: (e) => {
4810
+ const next = { ...printCfg, pinFooterToBottom: e.target.checked };
4811
+ setPrintCfg(next);
4812
+ rebuildPreview(next);
4813
+ }
4815
4814
  }
4816
4815
  ),
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
- ] }),
4816
+ /* @__PURE__ */ jsx4("span", { children: "\u5C3E\u884C\u8D34\u5E95\u56FA\u5B9A\u6253\u5370 (pinFooterToBottom)" })
4817
+ ] }),
4818
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4826
4819
  /* @__PURE__ */ jsx4(
4827
- "button",
4820
+ "input",
4828
4821
  {
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"
4822
+ type: "checkbox",
4823
+ checked: Boolean(printCfg.pageBreakAfterGroup),
4824
+ onChange: (e) => {
4825
+ const next = { ...printCfg, pageBreakAfterGroup: e.target.checked };
4826
+ setPrintCfg(next);
4827
+ rebuildPreview(next);
4828
+ }
4839
4829
  }
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
- ] })
4830
+ ),
4831
+ /* @__PURE__ */ jsx4("span", { children: "\u6309\u7EC4\u81EA\u52A8\u5206\u9875 (pageBreakAfterGroup)" })
4866
4832
  ] }),
4867
- /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-segmented", style: { gridTemplateColumns: "1fr 1fr" }, children: [
4833
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4868
4834
  /* @__PURE__ */ jsx4(
4869
- "button",
4835
+ "input",
4870
4836
  {
4871
- type: "button",
4872
- className: `yudao-sheet-segmented-item ${ioTarget === "browser" ? "is-active" : ""}`,
4873
- onClick: () => setIoTarget("browser"),
4874
- children: t("yudaoSheets.modal.browserModeBtn")
4837
+ type: "checkbox",
4838
+ checked: printCfg.showPageNumbers !== false,
4839
+ onChange: (e) => {
4840
+ const next = { ...printCfg, showPageNumbers: e.target.checked };
4841
+ setPrintCfg(next);
4842
+ rebuildPreview(next);
4843
+ }
4875
4844
  }
4876
4845
  ),
4877
- /* @__PURE__ */ jsxs4(
4878
- "button",
4846
+ /* @__PURE__ */ jsx4("span", { children: "\u663E\u793A\u9875\u7801 (showPageNumbers)" })
4847
+ ] }),
4848
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4849
+ /* @__PURE__ */ jsx4(
4850
+ "input",
4879
4851
  {
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
- ]
4852
+ type: "checkbox",
4853
+ checked: printCfg.excludeBackgroundOnPrint ?? true,
4854
+ onChange: (e) => {
4855
+ const next = { ...printCfg, excludeBackgroundOnPrint: e.target.checked };
4856
+ setPrintCfg(next);
4857
+ rebuildPreview(next);
4858
+ }
4888
4859
  }
4889
- )
4860
+ ),
4861
+ /* @__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
4862
  ] }),
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: [
4863
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4864
+ /* @__PURE__ */ jsx4(
4865
+ "input",
4866
+ {
4867
+ type: "checkbox",
4868
+ checked: printCfg.showGridlines,
4869
+ onChange: (e) => {
4870
+ const next = { ...printCfg, showGridlines: e.target.checked };
4871
+ setPrintCfg(next);
4872
+ rebuildPreview(next);
4873
+ }
4874
+ }
4875
+ ),
4876
+ /* @__PURE__ */ jsx4("span", { children: "\u663E\u793A\u7A7A\u767D\u5355\u5143\u683C\u8F85\u52A9\u7F51\u683C\u7EBF" })
4877
+ ] }),
4878
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4911
4879
  /* @__PURE__ */ jsx4(
4912
4880
  "input",
4913
4881
  {
4914
4882
  type: "checkbox",
4915
- checked: skipDatasetOnExport,
4916
- onChange: (e) => setSkipDatasetOnExport(e.target.checked)
4883
+ checked: Boolean(printCfg.wordFormStyle),
4884
+ onChange: (e) => {
4885
+ const next = { ...printCfg, wordFormStyle: e.target.checked };
4886
+ setPrintCfg(next);
4887
+ rebuildPreview(next);
4888
+ }
4917
4889
  }
4918
4890
  ),
4919
- /* @__PURE__ */ jsx4("span", { children: "\u4EC5\u7F16\u7801\u5F53\u524D\u5FEB\u7167\uFF08\u4E0D\u91CD\u590D\u6267\u884C\u6570\u636E\u96C6\u586B\u6570\uFF09" })
4891
+ /* @__PURE__ */ jsx4("span", { children: "\u7C7B Word \u65E0\u8FB9\u6846\u516C\u6587/\u8868\u5355\u98CE\u683C" })
4920
4892
  ] })
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",
4893
+ ] }),
4894
+ /* @__PURE__ */ jsxs4(
4895
+ "div",
4998
4896
  {
4999
- type: "button",
5000
- className: "yudao-sheet-btn",
5001
- onClick: () => handleDownload("xml"),
5002
- children: "\u5BFC\u51FA\u6807\u51C6\u62A5\u8868 XML"
4897
+ style: {
4898
+ padding: "6px 8px",
4899
+ background: "#FFFFFF",
4900
+ border: "1px solid #E3E5EA",
4901
+ borderRadius: 6,
4902
+ display: "flex",
4903
+ flexDirection: "column",
4904
+ gap: 5
4905
+ },
4906
+ children: [
4907
+ /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11.5, cursor: "pointer" }, children: [
4908
+ /* @__PURE__ */ jsxs4("span", { style: { display: "inline-flex", alignItems: "center", gap: 5, fontWeight: 600, color: "#1B1C1F" }, children: [
4909
+ /* @__PURE__ */ jsx4(
4910
+ "input",
4911
+ {
4912
+ type: "checkbox",
4913
+ checked: paginationEnabled,
4914
+ onChange: (e) => {
4915
+ const enabled = e.target.checked;
4916
+ setPaginationEnabled(enabled);
4917
+ setPageIndex(1);
4918
+ rebuildPreview(void 0, { enabled, page: 1, pageSize });
4919
+ }
4920
+ }
4921
+ ),
4922
+ "\u5927\u6570\u636E\u5206\u9875\u5207\u7247\u9884\u89C8"
4923
+ ] }),
4924
+ /* @__PURE__ */ jsxs4(
4925
+ "select",
4926
+ {
4927
+ style: {
4928
+ fontSize: 10.5,
4929
+ padding: "1px 4px",
4930
+ borderRadius: 4,
4931
+ border: "1px solid #E3E5EA",
4932
+ background: "#FFFFFF",
4933
+ color: "#31363F"
4934
+ },
4935
+ value: pageSize,
4936
+ disabled: !paginationEnabled,
4937
+ onChange: (e) => {
4938
+ const nextSize = Number(e.target.value);
4939
+ setPageSize(nextSize);
4940
+ setPageIndex(1);
4941
+ rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize: nextSize });
4942
+ },
4943
+ children: [
4944
+ /* @__PURE__ */ jsx4("option", { value: 25, children: "25 \u884C/\u9875" }),
4945
+ /* @__PURE__ */ jsx4("option", { value: 50, children: "50 \u884C/\u9875" }),
4946
+ /* @__PURE__ */ jsx4("option", { value: 100, children: "100 \u884C/\u9875" }),
4947
+ /* @__PURE__ */ jsx4("option", { value: 500, children: "500 \u884C/\u9875" })
4948
+ ]
4949
+ }
4950
+ )
4951
+ ] }),
4952
+ paginationEnabled && /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11 }, children: [
4953
+ /* @__PURE__ */ jsx4(
4954
+ "button",
4955
+ {
4956
+ type: "button",
4957
+ className: "yudao-sheet-btn",
4958
+ style: { padding: "2px 6px", fontSize: 10.5 },
4959
+ disabled: pageIndex <= 1,
4960
+ onClick: () => {
4961
+ const prev = Math.max(1, pageIndex - 1);
4962
+ setPageIndex(prev);
4963
+ rebuildPreview(void 0, { enabled: true, page: prev, pageSize });
4964
+ },
4965
+ children: "\u4E0A\u4E00\u9875"
4966
+ }
4967
+ ),
4968
+ /* @__PURE__ */ jsxs4("span", { style: { color: "#4E5565" }, children: [
4969
+ "\u7B2C ",
4970
+ pageIndex,
4971
+ "/",
4972
+ pageSummary.totalPages,
4973
+ " \u9875 \xB7 \u5171 ",
4974
+ pageSummary.totalRows,
4975
+ " \u884C"
4976
+ ] }),
4977
+ /* @__PURE__ */ jsx4(
4978
+ "button",
4979
+ {
4980
+ type: "button",
4981
+ className: "yudao-sheet-btn",
4982
+ style: { padding: "2px 6px", fontSize: 10.5 },
4983
+ disabled: pageIndex >= pageSummary.totalPages,
4984
+ onClick: () => {
4985
+ const next = Math.min(pageSummary.totalPages, pageIndex + 1);
4986
+ setPageIndex(next);
4987
+ rebuildPreview(void 0, { enabled: true, page: next, pageSize });
4988
+ },
4989
+ children: "\u4E0B\u4E00\u9875"
4990
+ }
4991
+ )
4992
+ ] })
4993
+ ]
5003
4994
  }
5004
4995
  ),
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(
4996
+ /* @__PURE__ */ jsxs4(
5096
4997
  "div",
5097
4998
  {
5098
4999
  style: {
5099
- display: "inline-flex",
5100
- alignItems: "center",
5101
- gap: 6,
5102
- fontSize: 12,
5103
- color: "#31363F"
5000
+ marginTop: "auto",
5001
+ padding: "8px 10px",
5002
+ background: "#FFFFFF",
5003
+ border: "1px solid #E3E5EA",
5004
+ borderRadius: 8,
5005
+ display: "flex",
5006
+ flexDirection: "column",
5007
+ gap: 6
5104
5008
  },
5105
5009
  children: [
5106
- /* @__PURE__ */ jsxs4("span", { style: { fontWeight: 500, color: "#1B1C1F", whiteSpace: "nowrap" }, children: [
5107
- field.label || field.name,
5108
- field.required ? " *" : "",
5109
- ":"
5010
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5 }, children: [
5011
+ /* @__PURE__ */ jsxs4("span", { style: { fontWeight: 600, color: "#1B1C1F" }, children: [
5012
+ "\u5BFC\u5165/\u5BFC\u51FA\u5904\u7406\u65B9\u5F0F\uFF08\u5F53\u524D .",
5013
+ activeIoFormat,
5014
+ "\uFF09"
5015
+ ] }),
5016
+ /* @__PURE__ */ jsxs4("span", { style: { fontSize: 10.5, color: "#7D8698" }, children: [
5017
+ "\u5FEB\u7167 ",
5018
+ snapSizeKb,
5019
+ " KB"
5020
+ ] })
5110
5021
  ] }),
5111
- field.widget === "select" || field.widget === "cascader" ? /* @__PURE__ */ jsxs4(
5112
- "select",
5022
+ /* @__PURE__ */ jsxs4("div", { className: "yudao-sheet-segmented", style: { gridTemplateColumns: "1fr 1fr" }, children: [
5023
+ /* @__PURE__ */ jsxs4(
5024
+ "button",
5025
+ {
5026
+ type: "button",
5027
+ "data-testid": "yudao-io-target-browser",
5028
+ className: `yudao-sheet-segmented-item ${ioTarget === "browser" ? "is-active" : ""}`,
5029
+ onClick: () => {
5030
+ userTouchedTargetRef.current = true;
5031
+ setIoTarget("browser");
5032
+ },
5033
+ children: [
5034
+ /* @__PURE__ */ jsx4("span", { children: "\u6D4F\u89C8\u5668\u5904\u7406" }),
5035
+ /* @__PURE__ */ jsxs4("span", { style: { fontSize: 10, marginLeft: 3, opacity: 0.85 }, children: [
5036
+ "(",
5037
+ browserAvailabilityLabel,
5038
+ ")"
5039
+ ] })
5040
+ ]
5041
+ }
5042
+ ),
5043
+ /* @__PURE__ */ jsxs4(
5044
+ "button",
5045
+ {
5046
+ type: "button",
5047
+ "data-testid": "yudao-io-target-server",
5048
+ className: `yudao-sheet-segmented-item ${ioTarget === "server" ? "is-active" : ""}`,
5049
+ onClick: () => {
5050
+ userTouchedTargetRef.current = true;
5051
+ setIoTarget("server");
5052
+ },
5053
+ 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",
5054
+ children: [
5055
+ /* @__PURE__ */ jsx4("span", { children: "\u670D\u52A1\u7AEF\u5904\u7406" }),
5056
+ /* @__PURE__ */ jsxs4("span", { style: { fontSize: 10, marginLeft: 3, opacity: 0.85 }, children: [
5057
+ "(",
5058
+ serverAvailabilityLabel,
5059
+ ")"
5060
+ ] })
5061
+ ]
5062
+ }
5063
+ )
5064
+ ] }),
5065
+ ioTarget === "browser" ? exportCapReport.warnings.length > 0 ? /* @__PURE__ */ jsxs4(
5066
+ "div",
5113
5067
  {
5114
5068
  style: {
5115
- height: 28,
5116
- padding: "0 8px",
5117
- fontSize: 12,
5118
- borderRadius: 6,
5069
+ fontSize: 10.5,
5070
+ color: "#4E5565",
5071
+ background: "#F9FAFB",
5119
5072
  border: "1px solid #E3E5EA",
5120
- background: "#FFFFFF",
5121
- color: "#1B1C1F",
5122
- minWidth: 110
5073
+ padding: "4px 6px",
5074
+ borderRadius: 5,
5075
+ lineHeight: 1.4
5123
5076
  },
5124
- value: rawVal == null ? "" : String(rawVal),
5125
- onChange: (e) => setQueryValues((prev) => ({ ...prev, [field.name]: e.target.value })),
5126
5077
  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))
5078
+ "\u6D4F\u89C8\u5668\u7AEF\u63D0\u793A\uFF1A",
5079
+ exportCapReport.warnings.join("\uFF1B"),
5080
+ "\uFF08\u9AD8\u4FDD\u771F\u5EFA\u8BAE\u9009\u670D\u52A1\u7AEF\uFF09\u3002"
5129
5081
  ]
5130
5082
  }
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: [
5083
+ ) : /* @__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" }),
5084
+ features.datasetBinding && ioTarget === "browser" && /* @__PURE__ */ jsxs4("label", { style: { display: "flex", alignItems: "center", gap: 5, fontSize: 11, color: "#31363F", cursor: "pointer" }, children: [
5153
5085
  /* @__PURE__ */ jsx4(
5154
5086
  "input",
5155
5087
  {
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
- }
5088
+ type: "checkbox",
5089
+ checked: skipDatasetOnExport,
5090
+ onChange: (e) => setSkipDatasetOnExport(e.target.checked)
5172
5091
  }
5173
5092
  ),
5174
- /* @__PURE__ */ jsx4("span", { style: { color: "#7D8698" }, children: "-" }),
5175
- /* @__PURE__ */ jsx4(
5176
- "input",
5093
+ /* @__PURE__ */ jsx4("span", { children: "\u4EC5\u7F16\u7801\u5F53\u524D\u5FEB\u7167\uFF08\u4E0D\u91CD\u590D\u6267\u884C\u6570\u636E\u96C6\u586B\u6570\uFF09" })
5094
+ ] })
5095
+ ]
5096
+ }
5097
+ ),
5098
+ ioError && /* @__PURE__ */ jsxs4(
5099
+ "div",
5100
+ {
5101
+ "data-testid": "yudao-io-error-banner",
5102
+ style: {
5103
+ fontSize: 11,
5104
+ color: "#B42318",
5105
+ background: "#FEF3F2",
5106
+ border: "1px solid #FECDCA",
5107
+ padding: "8px 10px",
5108
+ borderRadius: 6,
5109
+ lineHeight: 1.45,
5110
+ display: "flex",
5111
+ flexDirection: "column",
5112
+ gap: 6
5113
+ },
5114
+ children: [
5115
+ /* @__PURE__ */ jsx4("div", { children: ioError }),
5116
+ /* @__PURE__ */ jsx4(
5117
+ "button",
5118
+ {
5119
+ type: "button",
5120
+ "data-testid": "yudao-io-switch-retry",
5121
+ className: "yudao-sheet-btn",
5122
+ style: { alignSelf: "flex-start", borderColor: "#FDA29B", color: "#B42318" },
5123
+ onClick: handleSwitchTargetAndRetry,
5124
+ 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"
5125
+ }
5126
+ )
5127
+ ]
5128
+ }
5129
+ ),
5130
+ /* @__PURE__ */ jsxs4(
5131
+ "div",
5132
+ {
5133
+ style: {
5134
+ padding: "8px 10px",
5135
+ background: "#FFFFFF",
5136
+ border: "1px solid #E3E5EA",
5137
+ borderRadius: 8,
5138
+ display: "flex",
5139
+ flexDirection: "column",
5140
+ gap: 6
5141
+ },
5142
+ children: [
5143
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5 }, children: [
5144
+ /* @__PURE__ */ jsx4("span", { style: { fontWeight: 600, color: "#1B1C1F" }, children: "\u5DE5\u4F5C\u7C3F\u5BFC\u5165\uFF08\u9884\u68C0\u6682\u5B58\uFF09" }),
5145
+ selectedImportFile && /* @__PURE__ */ jsx4(
5146
+ "span",
5177
5147
  {
5178
- type: "date",
5179
5148
  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"
5149
+ fontSize: 10.5,
5150
+ color: "#4E5565",
5151
+ maxWidth: 155,
5152
+ overflow: "hidden",
5153
+ textOverflow: "ellipsis",
5154
+ whiteSpace: "nowrap"
5187
5155
  },
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
- }
5156
+ title: selectedImportFile.name,
5157
+ children: selectedImportFile.name
5194
5158
  }
5195
5159
  )
5196
- ] }) : /* @__PURE__ */ jsx4(
5160
+ ] }),
5161
+ /* @__PURE__ */ jsx4(
5197
5162
  "input",
5198
5163
  {
5199
- type: field.widget === "number" ? "number" : field.widget === "date" ? "date" : "text",
5200
- placeholder: `\u8F93\u5165${field.label || field.name}`,
5164
+ ref: fileInputRef,
5165
+ type: "file",
5166
+ "data-testid": "yudao-io-file-input",
5167
+ accept: ".xlsx,.xls,.xml,.csv,.json",
5168
+ style: { display: "none" },
5169
+ onChange: handleFileInputChange
5170
+ }
5171
+ ),
5172
+ /* @__PURE__ */ jsx4(
5173
+ "button",
5174
+ {
5175
+ type: "button",
5176
+ "data-testid": "yudao-io-pick-file",
5177
+ className: `yudao-sheet-btn ${tab === "import" && !pendingImport ? "is-primary" : ""}`,
5178
+ onClick: () => fileInputRef.current?.click(),
5179
+ children: "\u9009\u62E9\u6587\u4EF6\u5BFC\u5165"
5180
+ }
5181
+ ),
5182
+ pendingImport && stagedSheetSummary && /* @__PURE__ */ jsxs4(
5183
+ "div",
5184
+ {
5185
+ "data-testid": "yudao-io-staged-result",
5201
5186
  style: {
5202
- height: 28,
5203
- padding: "0 8px",
5204
- fontSize: 12,
5187
+ fontSize: 11,
5188
+ color: "#31363F",
5189
+ background: "#F9FAFB",
5190
+ border: "1px solid #D2DAFA",
5191
+ padding: "8px",
5205
5192
  borderRadius: 6,
5206
- border: "1px solid #E3E5EA",
5207
- background: "#FFFFFF",
5208
- color: "#1B1C1F",
5209
- width: field.widget === "number" ? 96 : 124
5193
+ display: "flex",
5194
+ flexDirection: "column",
5195
+ gap: 5,
5196
+ lineHeight: 1.45
5210
5197
  },
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
- }))
5198
+ children: [
5199
+ /* @__PURE__ */ jsxs4("div", { style: { fontWeight: 600, color: "#1B1C1F" }, children: [
5200
+ "\u5F85\u786E\u8BA4\u6587\u4EF6\uFF1A",
5201
+ pendingImport.fileName
5202
+ ] }),
5203
+ /* @__PURE__ */ jsxs4("div", { children: [
5204
+ "\u89E3\u6790\u901A\u9053\uFF1A",
5205
+ pendingImport.executedBy === "server" ? "\u670D\u52A1\u7AEF\u5904\u7406" : "\u6D4F\u89C8\u5668\u5904\u7406"
5206
+ ] }),
5207
+ /* @__PURE__ */ jsxs4("div", { children: [
5208
+ "\u5DE5\u4F5C\u8868\u6982\u89C8\uFF1A\u5171 ",
5209
+ stagedSheetSummary.count,
5210
+ " \u4E2A\u5DE5\u4F5C\u8868\uFF08",
5211
+ stagedSheetSummary.names.join("\u3001") || "-",
5212
+ "\uFF09"
5213
+ ] }),
5214
+ /* @__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" }),
5215
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6, marginTop: 2 }, children: [
5216
+ /* @__PURE__ */ jsx4(
5217
+ "button",
5218
+ {
5219
+ type: "button",
5220
+ "data-testid": "yudao-io-confirm-import",
5221
+ className: "yudao-sheet-btn is-primary",
5222
+ onClick: handleConfirmStagedImport,
5223
+ children: "\u786E\u8BA4\u5E94\u7528\u5230\u8BBE\u8BA1\u5668"
5224
+ }
5225
+ ),
5226
+ /* @__PURE__ */ jsx4(
5227
+ "button",
5228
+ {
5229
+ type: "button",
5230
+ "data-testid": "yudao-io-cancel-import",
5231
+ className: "yudao-sheet-btn",
5232
+ onClick: handleCancelStagedImport,
5233
+ children: "\u53D6\u6D88\u672C\u6B21\u5BFC\u5165"
5234
+ }
5235
+ )
5236
+ ] })
5237
+ ]
5216
5238
  }
5217
5239
  )
5218
5240
  ]
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
5241
  }
5237
5242
  ),
5238
- /* @__PURE__ */ jsx4(
5239
- "button",
5243
+ /* @__PURE__ */ jsxs4("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
5244
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "112px 1fr", gap: 6 }, children: [
5245
+ /* @__PURE__ */ jsxs4(
5246
+ "select",
5247
+ {
5248
+ "data-testid": "yudao-io-export-format",
5249
+ style: {
5250
+ height: 30,
5251
+ padding: "0 6px",
5252
+ fontSize: 11.5,
5253
+ borderRadius: 6,
5254
+ border: "1px solid #E3E5EA",
5255
+ background: "#FFFFFF",
5256
+ color: "#1B1C1F"
5257
+ },
5258
+ value: exportFormat,
5259
+ onChange: (e) => setExportFormat(e.target.value),
5260
+ children: [
5261
+ /* @__PURE__ */ jsx4("option", { value: "xlsx", children: "Excel (.xlsx)" }),
5262
+ /* @__PURE__ */ jsx4("option", { value: "xls", children: "\u517C\u5BB9 (.xls)" }),
5263
+ /* @__PURE__ */ jsx4("option", { value: "pdf", children: "\u77E2\u91CF (.pdf)" }),
5264
+ /* @__PURE__ */ jsx4("option", { value: "docx", children: "Word (.docx)" }),
5265
+ /* @__PURE__ */ jsx4("option", { value: "csv", children: "\u8868\u683C (.csv)" }),
5266
+ /* @__PURE__ */ jsx4("option", { value: "xml", children: "\u62A5\u8868 (.xml)" }),
5267
+ /* @__PURE__ */ jsx4("option", { value: "html", children: "\u7F51\u9875 (.html)" }),
5268
+ /* @__PURE__ */ jsx4("option", { value: "json", children: "\u5FEB\u7167 (.json)" })
5269
+ ]
5270
+ }
5271
+ ),
5272
+ /* @__PURE__ */ jsxs4(
5273
+ "button",
5274
+ {
5275
+ type: "button",
5276
+ "data-testid": "yudao-io-export-download",
5277
+ className: `yudao-sheet-btn ${tab !== "import" ? "is-primary" : ""}`,
5278
+ onClick: () => handleDownload(exportFormat),
5279
+ children: [
5280
+ "\u5BFC\u51FA\u4E0B\u8F7D (.",
5281
+ exportFormat === "xml" ? "report.xml" : exportFormat,
5282
+ ")"
5283
+ ]
5284
+ }
5285
+ )
5286
+ ] }),
5287
+ /* @__PURE__ */ jsxs4("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
5288
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleExportReportPackage, children: "\u5BFC\u51FA\u62A5\u8868\u8FC1\u79FB\u5305 (.json)" }),
5289
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleImportReportPackage, children: "\u5BFC\u5165\u62A5\u8868\u8FC1\u79FB\u5305 (.json)" })
5290
+ ] }),
5291
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "yudao-sheet-btn", onClick: handleBrowserPrint, children: t("yudaoSheets.modal.triggerPrintBtn") }),
5292
+ 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)" })
5293
+ ] }),
5294
+ statusTip && /* @__PURE__ */ jsx4(
5295
+ "div",
5240
5296
  {
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");
5297
+ style: {
5298
+ fontSize: 11,
5299
+ color: "#31363F",
5300
+ background: "#F3F5FF",
5301
+ border: "1px solid #D2DAFA",
5302
+ padding: "6px 8px",
5303
+ borderRadius: 6,
5304
+ lineHeight: 1.4
5250
5305
  },
5251
- children: t("yudaoSheets.modal.resetBtn")
5306
+ children: statusTip
5252
5307
  }
5253
5308
  )
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)"
5309
+ ]
5271
5310
  }
5272
- }
5273
- ) })
5311
+ ),
5312
+ /* @__PURE__ */ jsxs4("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
5313
+ /* @__PURE__ */ jsxs4(
5314
+ "div",
5315
+ {
5316
+ className: "yudao-sheet-quick-export-bar",
5317
+ style: {
5318
+ background: "#F9FAFB",
5319
+ borderBottom: "1px solid #E3E5EA",
5320
+ padding: "6px 16px",
5321
+ display: "flex",
5322
+ alignItems: "center",
5323
+ justifyContent: "space-between",
5324
+ gap: 8,
5325
+ flexWrap: "wrap"
5326
+ },
5327
+ children: [
5328
+ /* @__PURE__ */ jsxs4("div", { style: { display: "inline-flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
5329
+ /* @__PURE__ */ jsx4("span", { style: { fontSize: 11.5, fontWeight: 600, color: "#31363F" }, children: t("yudaoSheets.modal.quickExportLabel") }),
5330
+ [
5331
+ ["xlsx", t("yudaoSheets.modal.quickExportXlsx")],
5332
+ ["pdf", t("yudaoSheets.modal.quickExportPdf")],
5333
+ ["docx", t("yudaoSheets.modal.quickExportDocx")],
5334
+ ["csv", t("yudaoSheets.modal.quickExportCsv")],
5335
+ ["html", t("yudaoSheets.modal.quickExportHtml")]
5336
+ ].map(([fmt, label]) => /* @__PURE__ */ jsx4(
5337
+ "button",
5338
+ {
5339
+ type: "button",
5340
+ className: `yudao-sheet-btn ${fmt === "xlsx" ? "is-primary" : ""}`,
5341
+ style: { height: 24, padding: "0 9px", fontSize: 11 },
5342
+ onClick: () => handleDownload(fmt),
5343
+ children: label
5344
+ },
5345
+ fmt
5346
+ ))
5347
+ ] }),
5348
+ /* @__PURE__ */ jsx4(
5349
+ "button",
5350
+ {
5351
+ type: "button",
5352
+ className: "yudao-sheet-btn",
5353
+ style: { height: 24, padding: "0 10px", fontSize: 11 },
5354
+ onClick: handleBrowserPrint,
5355
+ children: t("yudaoSheets.modal.triggerPrintBtn")
5356
+ }
5357
+ )
5358
+ ]
5359
+ }
5360
+ ),
5361
+ queryParamFields.length > 0 && /* @__PURE__ */ jsxs4(
5362
+ "div",
5363
+ {
5364
+ className: "yudao-sheet-query-bar",
5365
+ style: {
5366
+ background: "#FFFFFF",
5367
+ borderBottom: "1px solid #E3E5EA",
5368
+ padding: "10px 16px",
5369
+ display: "flex",
5370
+ flexWrap: "wrap",
5371
+ alignItems: "center",
5372
+ gap: 10
5373
+ },
5374
+ children: [
5375
+ queryParamFields.map((field) => {
5376
+ const rawVal = queryValues[field.name];
5377
+ const dictOpts = field.options ?? (field.dictCode ? templateService.getTemplateMetadata(workbook.getUnitId()).dicts?.[field.dictCode] : void 0) ?? [];
5378
+ return /* @__PURE__ */ jsxs4(
5379
+ "div",
5380
+ {
5381
+ style: {
5382
+ display: "inline-flex",
5383
+ alignItems: "center",
5384
+ gap: 6,
5385
+ fontSize: 12,
5386
+ color: "#31363F"
5387
+ },
5388
+ children: [
5389
+ /* @__PURE__ */ jsxs4("span", { style: { fontWeight: 500, color: "#1B1C1F", whiteSpace: "nowrap" }, children: [
5390
+ field.label || field.name,
5391
+ field.required ? " *" : "",
5392
+ ":"
5393
+ ] }),
5394
+ field.widget === "select" || field.widget === "cascader" ? /* @__PURE__ */ jsxs4(
5395
+ "select",
5396
+ {
5397
+ style: {
5398
+ height: 28,
5399
+ padding: "0 8px",
5400
+ fontSize: 12,
5401
+ borderRadius: 6,
5402
+ border: "1px solid #E3E5EA",
5403
+ background: "#FFFFFF",
5404
+ color: "#1B1C1F",
5405
+ minWidth: 110
5406
+ },
5407
+ value: rawVal == null ? "" : String(rawVal),
5408
+ onChange: (e) => setQueryValues((prev) => ({ ...prev, [field.name]: e.target.value })),
5409
+ children: [
5410
+ /* @__PURE__ */ jsx4("option", { value: "", children: t("yudaoSheets.modal.allOption") }),
5411
+ dictOpts.map((opt) => /* @__PURE__ */ jsx4("option", { value: opt.value, children: opt.label }, opt.value))
5412
+ ]
5413
+ }
5414
+ ) : field.widget === "multiSelect" ? /* @__PURE__ */ jsx4(
5415
+ "input",
5416
+ {
5417
+ type: "text",
5418
+ placeholder: "\u591A\u503C\u9017\u53F7\u5206\u9694",
5419
+ style: {
5420
+ height: 28,
5421
+ padding: "0 8px",
5422
+ fontSize: 12,
5423
+ borderRadius: 6,
5424
+ border: "1px solid #E3E5EA",
5425
+ background: "#FFFFFF",
5426
+ color: "#1B1C1F",
5427
+ width: 132
5428
+ },
5429
+ value: Array.isArray(rawVal) ? rawVal.join(",") : rawVal == null ? "" : String(rawVal),
5430
+ onChange: (e) => setQueryValues((prev) => ({
5431
+ ...prev,
5432
+ [field.name]: e.target.value.split(",").map((s) => s.trim()).filter(Boolean)
5433
+ }))
5434
+ }
5435
+ ) : field.widget === "dateRange" ? /* @__PURE__ */ jsxs4("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
5436
+ /* @__PURE__ */ jsx4(
5437
+ "input",
5438
+ {
5439
+ type: "date",
5440
+ style: {
5441
+ height: 28,
5442
+ padding: "0 6px",
5443
+ fontSize: 11.5,
5444
+ borderRadius: 6,
5445
+ border: "1px solid #E3E5EA",
5446
+ background: "#FFFFFF",
5447
+ color: "#1B1C1F"
5448
+ },
5449
+ value: Array.isArray(rawVal) ? String(rawVal[0] ?? "") : "",
5450
+ onChange: (e) => {
5451
+ const curArr = Array.isArray(rawVal) ? [...rawVal] : ["", ""];
5452
+ curArr[0] = e.target.value;
5453
+ setQueryValues((prev) => ({ ...prev, [field.name]: curArr }));
5454
+ }
5455
+ }
5456
+ ),
5457
+ /* @__PURE__ */ jsx4("span", { style: { color: "#7D8698" }, children: "-" }),
5458
+ /* @__PURE__ */ jsx4(
5459
+ "input",
5460
+ {
5461
+ type: "date",
5462
+ style: {
5463
+ height: 28,
5464
+ padding: "0 6px",
5465
+ fontSize: 11.5,
5466
+ borderRadius: 6,
5467
+ border: "1px solid #E3E5EA",
5468
+ background: "#FFFFFF",
5469
+ color: "#1B1C1F"
5470
+ },
5471
+ value: Array.isArray(rawVal) ? String(rawVal[1] ?? "") : "",
5472
+ onChange: (e) => {
5473
+ const curArr = Array.isArray(rawVal) ? [...rawVal] : ["", ""];
5474
+ curArr[1] = e.target.value;
5475
+ setQueryValues((prev) => ({ ...prev, [field.name]: curArr }));
5476
+ }
5477
+ }
5478
+ )
5479
+ ] }) : /* @__PURE__ */ jsx4(
5480
+ "input",
5481
+ {
5482
+ type: field.widget === "number" ? "number" : field.widget === "date" ? "date" : "text",
5483
+ placeholder: `\u8F93\u5165${field.label || field.name}`,
5484
+ style: {
5485
+ height: 28,
5486
+ padding: "0 8px",
5487
+ fontSize: 12,
5488
+ borderRadius: 6,
5489
+ border: "1px solid #E3E5EA",
5490
+ background: "#FFFFFF",
5491
+ color: "#1B1C1F",
5492
+ width: field.widget === "number" ? 96 : 124
5493
+ },
5494
+ value: rawVal == null ? "" : String(rawVal),
5495
+ onChange: (e) => setQueryValues((prev) => ({
5496
+ ...prev,
5497
+ [field.name]: field.widget === "number" && e.target.value !== "" ? Number(e.target.value) : e.target.value
5498
+ }))
5499
+ }
5500
+ )
5501
+ ]
5502
+ },
5503
+ field.name
5504
+ );
5505
+ }),
5506
+ /* @__PURE__ */ jsxs4("div", { style: { display: "inline-flex", alignItems: "center", gap: 6, marginLeft: "auto" }, children: [
5507
+ /* @__PURE__ */ jsx4(
5508
+ "button",
5509
+ {
5510
+ type: "button",
5511
+ className: "yudao-sheet-btn is-primary",
5512
+ style: { height: 28, padding: "0 12px", fontSize: 12 },
5513
+ onClick: () => {
5514
+ setPageIndex(1);
5515
+ rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize }, queryValues);
5516
+ setStatusTip("\u5DF2\u6309\u67E5\u8BE2\u6761\u4EF6\u8FC7\u6EE4\u6570\u636E\u96C6\u5E76\u5237\u65B0\u9884\u89C8");
5517
+ },
5518
+ children: t("yudaoSheets.modal.queryBtn")
5519
+ }
5520
+ ),
5521
+ /* @__PURE__ */ jsx4(
5522
+ "button",
5523
+ {
5524
+ type: "button",
5525
+ className: "yudao-sheet-btn",
5526
+ style: { height: 28, padding: "0 12px", fontSize: 12 },
5527
+ onClick: () => {
5528
+ const resetVals = buildInitialQueryValues(queryParamFields);
5529
+ setQueryValues(resetVals);
5530
+ setPageIndex(1);
5531
+ rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize }, resetVals);
5532
+ setStatusTip("\u5DF2\u91CD\u7F6E\u67E5\u8BE2\u6761\u4EF6");
5533
+ },
5534
+ children: t("yudaoSheets.modal.resetBtn")
5535
+ }
5536
+ )
5537
+ ] })
5538
+ ]
5539
+ }
5540
+ ),
5541
+ /* @__PURE__ */ jsx4("div", { style: { flex: 1, background: "#EEEFF1", padding: 16, overflow: "hidden" }, children: /* @__PURE__ */ jsx4(
5542
+ "iframe",
5543
+ {
5544
+ ref: printIframeRef,
5545
+ title: "Sheet Print & Expansion Preview",
5546
+ srcDoc: previewHtml,
5547
+ style: {
5548
+ width: "100%",
5549
+ height: "100%",
5550
+ border: "1px solid #E3E5EA",
5551
+ borderRadius: 8,
5552
+ background: "#FFFFFF",
5553
+ boxShadow: "0 4px 16px rgba(27, 28, 31, 0.08)"
5554
+ }
5555
+ }
5556
+ ) })
5557
+ ] })
5558
+ ] }) : /* @__PURE__ */ jsxs4("div", { style: { flex: 1, padding: 16, display: "flex", flexDirection: "column", gap: 8 }, children: [
5559
+ /* @__PURE__ */ jsxs4("div", { style: { fontSize: 12, color: "#4E5565" }, children: [
5560
+ "\u5F53\u524D\u5DE5\u4F5C\u7C3F\u9075\u5FAA\u6807\u51C6 Univer ",
5561
+ /* @__PURE__ */ jsx4("code", { children: "IWorkbookData" }),
5562
+ " JSON \u89C4\u8303\uFF08\u6269\u5C55\u5C5E\u6027\u5B58\u50A8\u5728",
5563
+ " ",
5564
+ /* @__PURE__ */ jsx4("code", { children: "cell.custom.yudaoMeta" }),
5565
+ "\uFF0C\u65E0\u79C1\u6709\u5916\u90E8\u4F9D\u8D56\uFF09\uFF1A"
5566
+ ] }),
5567
+ /* @__PURE__ */ jsx4("textarea", { className: "yudao-sheet-code-area", readOnly: true, value: jsonText })
5568
+ ] })
5274
5569
  ] })
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
- ] }) });
5570
+ }
5571
+ );
5287
5572
  };
5288
5573
 
5289
5574
  // src/views/overlay/SheetRichOverlayHost.tsx
@@ -6715,14 +7000,27 @@ var SheetRichOverlayHost = () => {
6715
7000
  });
6716
7001
  const unitId2 = workbook.getUnitId();
6717
7002
  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 {
7003
+ const renderSubs = [];
7004
+ const bump = () => setTick((v) => v + 1);
7005
+ const watchRenderUnit = (unit) => {
7006
+ if (!unit) return;
7007
+ try {
7008
+ renderSubs.push(unit.with(SheetScrollManagerService).validViewportScrollInfo$.subscribe(bump));
7009
+ renderSubs.push(unit.with(SheetSkeletonManagerService).currentSkeleton$.subscribe(bump));
7010
+ } catch {
7011
+ }
7012
+ renderSubs.push(unit.engine.onTransformChange$.subscribeEvent(bump));
7013
+ bump();
7014
+ };
7015
+ if (renderUnit) {
7016
+ watchRenderUnit(renderUnit);
7017
+ } else {
7018
+ const createdSub = renderManagerService.created$.subscribe((unit) => {
7019
+ if (unit.unitId !== unitId2) return;
7020
+ createdSub.unsubscribe();
7021
+ watchRenderUnit(renderManagerService.getRenderUnitById(unitId2));
7022
+ });
7023
+ renderSubs.push(createdSub);
6726
7024
  }
6727
7025
  const onResize = () => setTick((v) => v + 1);
6728
7026
  window.addEventListener("resize", onResize);
@@ -6808,8 +7106,7 @@ var SheetRichOverlayHost = () => {
6808
7106
  canvasEl?.addEventListener("drop", onDrop);
6809
7107
  return () => {
6810
7108
  disp.dispose();
6811
- scrollSub?.unsubscribe();
6812
- skelSub?.unsubscribe();
7109
+ renderSubs.forEach((sub) => sub.unsubscribe());
6813
7110
  window.removeEventListener("resize", onResize);
6814
7111
  canvasEl?.removeEventListener("dragover", onDragOver);
6815
7112
  canvasEl?.removeEventListener("drop", onDrop);