@yudaocode/univer-sheets-ui 1.6.209 → 1.6.211

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -207,37 +207,51 @@ var OpenSheetModalOperation = {
207
207
  return true;
208
208
  }
209
209
  };
210
+ function mergeImportedTemplateMetadata(prevMeta, importedMeta) {
211
+ const next = { ...prevMeta, ...importedMeta };
212
+ if (!importedMeta.charts) delete next.charts;
213
+ return next;
214
+ }
210
215
  var ImportSheetFileOperation = {
211
216
  id: "yudao-sheets-ui.operation.import-file",
212
217
  type: import_core2.CommandType.OPERATION,
213
218
  handler: (accessor, params) => {
214
- if (typeof document === "undefined") return false;
215
219
  const commandService = accessor.get(import_core2.ICommandService);
220
+ if (!params?.file) {
221
+ if (commandService.hasCommand(OpenSheetModalOperation.id)) {
222
+ return commandService.syncExecuteCommand(OpenSheetModalOperation.id, { tab: "import" });
223
+ }
224
+ accessor.get(ISheetsUIFeatureService).openModal("import");
225
+ return true;
226
+ }
227
+ const file = params.file;
216
228
  const instanceService = accessor.get(import_core2.IUniverInstanceService);
217
229
  const ioService = accessor.get(import_univer_sheets.ISheetIoService);
218
230
  const templateService = accessor.get(import_univer_sheets.ISheetTemplateService);
219
- const input = document.createElement("input");
220
- input.type = "file";
221
- input.accept = ".xlsx,.xls,.xml,.csv,.json";
222
- input.onchange = async () => {
223
- const file = input.files?.[0];
224
- if (!file) return;
225
- const workbook = instanceService.getCurrentUnitOfType(import_core2.UniverInstanceType.UNIVER_SHEET);
226
- if (!workbook) return;
227
- const unitId = workbook.getUnitId();
228
- const imported = await ioService.importSheet(file, unitId, {
229
- target: params?.target
230
- });
231
+ const workbook = instanceService.getCurrentUnitOfType(import_core2.UniverInstanceType.UNIVER_SHEET);
232
+ if (!workbook) return false;
233
+ const unitId = workbook.getUnitId();
234
+ return ioService.importSheetWithReport(file, {
235
+ unitId,
236
+ target: params.target
237
+ }).then((outcome) => {
238
+ const imported = outcome.snapshot ?? outcome.workbookData;
231
239
  const prevMeta = templateService.getTemplateMetadata(unitId);
232
240
  const xmlMeta = imported.__templateMetadata ?? {};
233
- commandService.syncExecuteCommand(import_univer_sheets.ApplyImportedWorkbookDataCommand.id, {
241
+ const mergedBase = mergeImportedTemplateMetadata(prevMeta, xmlMeta);
242
+ const nextMeta = {
243
+ ...mergedBase,
244
+ ...imported.definedNames ? { definedNames: imported.definedNames } : {},
245
+ ...typeof imported.workbookStructureLocked === "boolean" ? { workbookStructureLocked: imported.workbookStructureLocked } : {},
246
+ ...imported.conditionalRules ? { conditionalRules: imported.conditionalRules } : {},
247
+ ...imported.cellNotes ? { cellNotes: imported.cellNotes } : {}
248
+ };
249
+ return commandService.syncExecuteCommand(import_univer_sheets.ApplyImportedWorkbookDataCommand.id, {
234
250
  unitId,
235
251
  workbookData: imported,
236
- metadata: { ...prevMeta, ...xmlMeta }
252
+ metadata: nextMeta
237
253
  });
238
- };
239
- input.click();
240
- return true;
254
+ });
241
255
  }
242
256
  };
243
257
  var FillSheetSampleDatasetOperation = {
@@ -357,6 +371,7 @@ var enUS = {
357
371
  tagColorLabel: "Tag Accent Color"
358
372
  },
359
373
  modal: {
374
+ tabImport: "Import Workbook (.xlsx/.xls/.csv/.xml)",
360
375
  tabExport: "Live Expansion Preview & Export (.xlsx)",
361
376
  tabPrint: "Pre-Printed Form \xB7 Multi-Column \xB7 Print Preview",
362
377
  tabJson: "{ } Univer IWorkbookData Contract",
@@ -455,6 +470,7 @@ var zhCN = {
455
470
  tagColorLabel: "\u6807\u7B7E\u4E3B\u9898\u8272"
456
471
  },
457
472
  modal: {
473
+ tabImport: "\u5BFC\u5165\u5DE5\u4F5C\u7C3F (.xlsx/.xls/.csv/.xml)",
458
474
  tabExport: "\u52A8\u6001\u5C55\u5F00\u9884\u89C8 & \u5BFC\u51FA Excel (.xlsx)",
459
475
  tabPrint: "\u7968\u636E\u5957\u6253 \xB7 \u591A\u680F \xB7 \u5206\u9875\u6253\u5370\u9884\u89C8",
460
476
  tabJson: "{ } Univer IWorkbookData \u5951\u7EA6",
@@ -469,7 +485,7 @@ var zhCN = {
469
485
  resetBtn: "\u91CD\u7F6E",
470
486
  allOption: "\u5168\u90E8",
471
487
  browserModeBtn: "\u6D4F\u89C8\u5668\u5904\u7406",
472
- serverModeBtn: "\u670D\u52A1\u7AEF",
488
+ serverModeBtn: "\u670D\u52A1\u7AEF\u5904\u7406",
473
489
  serverNotConnected: " (\u672A\u63A5\u5165)",
474
490
  refreshPreviewBtn: "\u5237\u65B0\u53F3\u4FA7\u9884\u89C8",
475
491
  mockDatasetBtn: "\u751F\u6210\u6A21\u62DF\u6570\u636E",
@@ -3906,6 +3922,10 @@ var SheetPreviewAndIoModal = () => {
3906
3922
  const tab = (0, import_ui5.useObservable)(featureService.modalTab$, featureService.getModalTab());
3907
3923
  const features = (0, import_ui5.useObservable)(featureService.features$, featureService.getFeatures());
3908
3924
  const ioAdapter = (0, import_ui5.useObservable)(ioService.adapter$, ioService.getAdapter());
3925
+ const defaultIoTargetPref = (0, import_ui5.useObservable)(
3926
+ ioService.defaultIoTarget$,
3927
+ ioService.getDefaultIoTarget()
3928
+ );
3909
3929
  const workbook = (0, import_ui5.useObservable)(
3910
3930
  () => instanceService.getCurrentTypeOfUnit$(import_core6.UniverInstanceType.UNIVER_SHEET),
3911
3931
  instanceService.getCurrentUnitOfType(import_core6.UniverInstanceType.UNIVER_SHEET),
@@ -3917,8 +3937,12 @@ var SheetPreviewAndIoModal = () => {
3917
3937
  const [jsonText, setJsonText] = (0, import_react4.useState)("");
3918
3938
  const [statusTip, setStatusTip] = (0, import_react4.useState)("");
3919
3939
  const [ioTarget, setIoTarget] = (0, import_react4.useState)("browser");
3940
+ const [exportFormat, setExportFormat] = (0, import_react4.useState)("xlsx");
3941
+ const [selectedImportFile, setSelectedImportFile] = (0, import_react4.useState)(null);
3942
+ const [pendingImport, setPendingImport] = (0, import_react4.useState)(null);
3943
+ const [ioError, setIoError] = (0, import_react4.useState)(null);
3944
+ const [lastIoAction, setLastIoAction] = (0, import_react4.useState)(null);
3920
3945
  const [skipDatasetOnExport, setSkipDatasetOnExport] = (0, import_react4.useState)(false);
3921
- const [importWarnings, setImportWarnings] = (0, import_react4.useState)([]);
3922
3946
  const [paginationEnabled, setPaginationEnabled] = (0, import_react4.useState)(false);
3923
3947
  const [pageIndex, setPageIndex] = (0, import_react4.useState)(1);
3924
3948
  const [pageSize, setPageSize] = (0, import_react4.useState)(50);
@@ -3929,6 +3953,10 @@ var SheetPreviewAndIoModal = () => {
3929
3953
  const [queryValues, setQueryValues] = (0, import_react4.useState)({});
3930
3954
  const metaVersion = (0, import_ui5.useObservable)(templateService.metadataChange$, "");
3931
3955
  void metaVersion;
3956
+ void defaultIoTargetPref;
3957
+ const userTouchedTargetRef = (0, import_react4.useRef)(false);
3958
+ const prevOpenRef = (0, import_react4.useRef)(false);
3959
+ const fileInputRef = (0, import_react4.useRef)(null);
3932
3960
  const [printCfg, setPrintCfg] = (0, import_react4.useState)({
3933
3961
  paperOrientation: "A4_LANDSCAPE",
3934
3962
  scaleMode: "all",
@@ -4032,7 +4060,10 @@ var SheetPreviewAndIoModal = () => {
4032
4060
  return () => sub.unsubscribe();
4033
4061
  }, [templateService, featureService, workbook]);
4034
4062
  (0, import_react4.useEffect)(() => {
4063
+ const justOpened = open && !prevOpenRef.current;
4064
+ prevOpenRef.current = open;
4035
4065
  if (!open || !workbook) return;
4066
+ if (!justOpened) return;
4036
4067
  const snap = workbook.save();
4037
4068
  const meta = templateService.getTemplateMetadata(workbook.getUnitId());
4038
4069
  const initialData = meta.sampleData ?? {};
@@ -4093,10 +4124,27 @@ var SheetPreviewAndIoModal = () => {
4093
4124
  )
4094
4125
  );
4095
4126
  setJsonText(JSON.stringify(snap, null, 2));
4096
- setIoTarget(ioService.getIoCapabilities().recommendedDefaultTarget);
4097
- setImportWarnings([]);
4127
+ userTouchedTargetRef.current = false;
4128
+ const initExportFmt = tab === "print" ? "pdf" : "xlsx";
4129
+ setExportFormat(initExportFmt);
4130
+ const caps = ioService.getIoCapabilities();
4131
+ const initOp = tab === "import" ? "import" : "export";
4132
+ const initFmt = initOp === "import" ? "xlsx" : initExportFmt;
4133
+ setIoTarget(caps.formats[initOp]?.[initFmt]?.defaultTarget ?? caps.recommendedDefaultTarget);
4134
+ setSelectedImportFile(null);
4135
+ setPendingImport(null);
4136
+ setIoError(null);
4137
+ setLastIoAction(null);
4098
4138
  setStatusTip("");
4099
- }, [open, workbook, features.datasetBinding, templateService, ioService, ioAdapter]);
4139
+ }, [open, tab, workbook, features.datasetBinding, templateService, ioService]);
4140
+ (0, import_react4.useEffect)(() => {
4141
+ if (!open || userTouchedTargetRef.current) return;
4142
+ const caps = ioService.getIoCapabilities();
4143
+ const op = tab === "import" ? "import" : "export";
4144
+ const fmt = op === "import" ? selectedImportFile ? (0, import_univer_sheets4.inferSheetFileFormat)(selectedImportFile.name) : "xlsx" : exportFormat;
4145
+ const nextDefault = caps.formats[op]?.[fmt]?.defaultTarget ?? caps.recommendedDefaultTarget;
4146
+ setIoTarget(nextDefault);
4147
+ }, [open, tab, exportFormat, selectedImportFile, ioAdapter, defaultIoTargetPref, ioService]);
4100
4148
  if (!open || !workbook) return null;
4101
4149
  const ioCaps = ioService.getIoCapabilities();
4102
4150
  const isCustomBackendAdapter = Boolean(
@@ -4104,6 +4152,12 @@ var SheetPreviewAndIoModal = () => {
4104
4152
  );
4105
4153
  const exportCapReport = (0, import_univer_sheets4.inspectWorkbookExportCapabilities)(workbook.save());
4106
4154
  const snapSizeKb = (exportCapReport.snapshotByteSize / 1024).toFixed(1);
4155
+ const activeIoOp = tab === "import" ? "import" : "export";
4156
+ const activeIoFormat = activeIoOp === "import" ? selectedImportFile ? (0, import_univer_sheets4.inferSheetFileFormat)(selectedImportFile.name) : "xlsx" : exportFormat;
4157
+ const activeFormatCap = ioCaps.formats[activeIoOp]?.[activeIoFormat];
4158
+ const browserAvailabilityLabel = (activeFormatCap ? activeFormatCap.browser : true) ? "\u53EF\u7528" : "\u4E0D\u652F\u6301\u5F53\u524D\u683C\u5F0F";
4159
+ const serverHasOpHook = activeIoOp === "import" ? ioCaps.server.importSheet : ioCaps.server.exportSheet;
4160
+ const serverAvailabilityLabel = !serverHasOpHook ? "\u672A\u63A5\u5165" : activeFormatCap && !activeFormatCap.server ? "\u4E0D\u652F\u6301\u5F53\u524D\u683C\u5F0F" : "\u53EF\u7528";
4107
4161
  const queryParamFields = templateService.getQueryParamFields(workbook.getUnitId());
4108
4162
  const rebuildPreview = (nextCfg, nextPaging, nextQueryVals) => {
4109
4163
  try {
@@ -4178,7 +4232,28 @@ var SheetPreviewAndIoModal = () => {
4178
4232
  );
4179
4233
  setStatusTip("\u5DF2\u6839\u636E\u6A21\u677F\u5360\u4F4D\u7B26\u81EA\u52A8\u751F\u6210\u7C7B\u578B\u5316\u6A21\u62DF\u6570\u636E\u96C6");
4180
4234
  };
4181
- const handleDownload = async (format) => {
4235
+ const triggerBrowserBlobDownload = (blob, downloadFileName) => {
4236
+ if (typeof URL === "undefined" || typeof URL.createObjectURL !== "function") {
4237
+ return;
4238
+ }
4239
+ const url = URL.createObjectURL(blob);
4240
+ if (typeof document !== "undefined") {
4241
+ const a = document.createElement("a");
4242
+ a.href = url;
4243
+ a.download = downloadFileName;
4244
+ a.click();
4245
+ }
4246
+ setTimeout(() => {
4247
+ if (typeof URL.revokeObjectURL === "function") {
4248
+ URL.revokeObjectURL(url);
4249
+ }
4250
+ }, 1e3);
4251
+ };
4252
+ const handleDownload = async (format, targetOverride) => {
4253
+ const effectiveTarget = targetOverride ?? ioTarget;
4254
+ setExportFormat(format);
4255
+ setLastIoAction({ kind: "export", format });
4256
+ setIoError(null);
4182
4257
  try {
4183
4258
  const unitId = workbook.getUnitId();
4184
4259
  const rawParsedData = format !== "xml" && features.datasetBinding && !skipDatasetOnExport ? JSON.parse(datasetText) : void 0;
@@ -4192,71 +4267,120 @@ var SheetPreviewAndIoModal = () => {
4192
4267
  printConfig: printCfg,
4193
4268
  metadata: templateService.getTemplateMetadata(unitId),
4194
4269
  implicitExpand: templateService.getImplicitExpand(unitId),
4195
- target: ioTarget
4270
+ target: effectiveTarget
4196
4271
  });
4197
- 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";
4272
+ 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";
4198
4273
  const blob = new Blob([bytes.buffer], { type: mime });
4199
- const url = URL.createObjectURL(blob);
4200
- const a = document.createElement("a");
4201
- a.href = url;
4202
4274
  const ext = format === "xml" ? "report.xml" : format;
4203
- a.download = `${workbook.name || "workbook"}.${ext}`;
4204
- a.click();
4205
- setTimeout(() => URL.revokeObjectURL(url), 1e3);
4206
- const channelLabel = ioTarget === "server" ? `\u670D\u52A1\u7AEF (${ioAdapter.name})` : "\u6D4F\u89C8\u5668\u672C\u5730\u5F15\u64CE";
4275
+ triggerBrowserBlobDownload(blob, `${workbook.name || "workbook"}.${ext}`);
4276
+ const channelLabel = effectiveTarget === "server" ? `\u670D\u52A1\u7AEF (${ioAdapter.name})` : "\u6D4F\u89C8\u5668\u672C\u5730\u5F15\u64CE";
4207
4277
  setStatusTip(`\u5DF2\u901A\u8FC7 ${channelLabel} \u5BFC\u51FA .${ext} \u6587\u4EF6`);
4208
4278
  } catch (err) {
4209
- 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" : "";
4210
- setStatusTip(`\u5BFC\u51FA\u5931\u8D25: ${err?.message || String(err)}${hint}`);
4279
+ const exactMessage = err?.message || String(err);
4280
+ setIoError(exactMessage);
4281
+ setStatusTip(`\u5BFC\u51FA\u5931\u8D25: ${exactMessage}`);
4211
4282
  }
4212
4283
  };
4213
- const handleImportBySelectedTarget = () => {
4214
- const input = document.createElement("input");
4215
- input.type = "file";
4216
- input.accept = ".xlsx,.xls,.xml,.csv,.json";
4217
- input.onchange = async () => {
4218
- const file = input.files?.[0];
4219
- if (!file) return;
4220
- setImportWarnings([]);
4221
- try {
4222
- const unitId = workbook.getUnitId();
4223
- const outcome = await ioService.importSheetWithReport(file, {
4224
- unitId,
4225
- target: ioTarget
4226
- });
4227
- const imported = outcome.workbookData;
4228
- const prevMeta = templateService.getTemplateMetadata(unitId);
4229
- const xmlMeta = imported.__templateMetadata ?? {};
4230
- const nextMeta = { ...prevMeta, ...xmlMeta };
4231
- commandService.syncExecuteCommand(import_univer_sheets4.ApplyImportedWorkbookDataCommand.id, {
4232
- unitId,
4233
- workbookData: imported,
4234
- metadata: nextMeta
4235
- });
4236
- if (nextMeta.printConfig) {
4237
- setPrintCfg((prev) => ({ ...prev, ...nextMeta.printConfig }));
4238
- }
4239
- setImportWarnings(outcome.warnings.map((w) => w.message));
4240
- setJsonText(JSON.stringify(workbook.save(), null, 2));
4241
- setPreviewHtml(
4242
- renderPreviewSnapshotHtml(
4243
- workbook.save(),
4244
- void 0,
4245
- { ...printCfg, ...nextMeta.printConfig ?? {} },
4246
- paginationEnabled,
4247
- pageIndex,
4248
- pageSize
4249
- )
4250
- );
4251
- setStatusTip(
4252
- `\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`
4253
- );
4254
- } catch (err) {
4255
- 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" : "";
4256
- setStatusTip(`\u5BFC\u5165\u5931\u8D25: ${err?.message || String(err)}${hint}`);
4257
- }
4284
+ const runStagedImport = async (file, targetOverride) => {
4285
+ const effectiveTarget = targetOverride ?? ioTarget;
4286
+ setSelectedImportFile(file);
4287
+ setLastIoAction({ kind: "import", file });
4288
+ setIoError(null);
4289
+ setPendingImport(null);
4290
+ try {
4291
+ const unitId = workbook.getUnitId();
4292
+ const outcome = await ioService.importSheetWithReport(file, {
4293
+ unitId,
4294
+ target: effectiveTarget
4295
+ });
4296
+ const snapshot = outcome.snapshot ?? outcome.workbookData;
4297
+ setPendingImport({
4298
+ snapshot,
4299
+ warnings: outcome.warnings,
4300
+ executedBy: outcome.executedBy,
4301
+ fileName: outcome.fileName || file.name
4302
+ });
4303
+ setStatusTip(
4304
+ `\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`
4305
+ );
4306
+ } catch (err) {
4307
+ const exactMessage = err?.message || String(err);
4308
+ setIoError(exactMessage);
4309
+ setStatusTip(`\u5BFC\u5165\u5931\u8D25: ${exactMessage}`);
4310
+ }
4311
+ };
4312
+ const handleFileInputChange = (e) => {
4313
+ const file = e.target.files?.[0];
4314
+ if (e.target) {
4315
+ e.target.value = "";
4316
+ }
4317
+ if (!file) return;
4318
+ void runStagedImport(file);
4319
+ };
4320
+ const handleConfirmStagedImport = () => {
4321
+ if (!pendingImport) return;
4322
+ const unitId = workbook.getUnitId();
4323
+ const imported = pendingImport.snapshot;
4324
+ const prevMeta = templateService.getTemplateMetadata(unitId);
4325
+ const xmlMeta = imported.__templateMetadata ?? {};
4326
+ const mergedBase = mergeImportedTemplateMetadata(prevMeta, xmlMeta);
4327
+ const nextMeta = {
4328
+ ...mergedBase,
4329
+ ...imported.definedNames ? { definedNames: imported.definedNames } : {},
4330
+ ...typeof imported.workbookStructureLocked === "boolean" ? { workbookStructureLocked: imported.workbookStructureLocked } : {},
4331
+ ...imported.conditionalRules ? { conditionalRules: imported.conditionalRules } : {},
4332
+ ...imported.cellNotes ? { cellNotes: imported.cellNotes } : {}
4258
4333
  };
4259
- input.click();
4334
+ commandService.syncExecuteCommand(import_univer_sheets4.ApplyImportedWorkbookDataCommand.id, {
4335
+ unitId,
4336
+ workbookData: imported,
4337
+ metadata: nextMeta
4338
+ });
4339
+ const effectivePrintCfg = nextMeta.printConfig ? { ...printCfg, ...nextMeta.printConfig } : printCfg;
4340
+ if (nextMeta.printConfig) {
4341
+ setPrintCfg(effectivePrintCfg);
4342
+ }
4343
+ setPendingImport(null);
4344
+ setIoError(null);
4345
+ setJsonText(JSON.stringify(workbook.save(), null, 2));
4346
+ setPreviewHtml(
4347
+ renderPreviewSnapshotHtml(
4348
+ workbook.save(),
4349
+ void 0,
4350
+ effectivePrintCfg,
4351
+ paginationEnabled,
4352
+ pageIndex,
4353
+ pageSize
4354
+ )
4355
+ );
4356
+ 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");
4357
+ };
4358
+ const handleCancelStagedImport = () => {
4359
+ setPendingImport(null);
4360
+ setIoError(null);
4361
+ setStatusTip("\u5DF2\u53D6\u6D88\u672C\u6B21\u5BFC\u5165\uFF0C\u5F53\u524D\u5DE5\u4F5C\u7C3F\u672A\u53D1\u751F\u53D8\u66F4");
4362
+ };
4363
+ const handleSwitchTargetAndRetry = () => {
4364
+ const nextTarget = ioTarget === "server" ? "browser" : "server";
4365
+ userTouchedTargetRef.current = true;
4366
+ setIoTarget(nextTarget);
4367
+ setIoError(null);
4368
+ if (lastIoAction?.kind === "import") {
4369
+ const retryFile = lastIoAction.file ?? selectedImportFile;
4370
+ if (retryFile) {
4371
+ void runStagedImport(retryFile, nextTarget);
4372
+ }
4373
+ return;
4374
+ }
4375
+ if (lastIoAction?.kind === "export") {
4376
+ void handleDownload(lastIoAction.format, nextTarget);
4377
+ return;
4378
+ }
4379
+ if (selectedImportFile && tab === "import") {
4380
+ void runStagedImport(selectedImportFile, nextTarget);
4381
+ return;
4382
+ }
4383
+ void handleDownload(exportFormat, nextTarget);
4260
4384
  };
4261
4385
  const handleExportReportPackage = () => {
4262
4386
  try {
@@ -4266,12 +4390,7 @@ var SheetPreviewAndIoModal = () => {
4266
4390
  templateService.getTemplateMetadata(unitId)
4267
4391
  );
4268
4392
  const blob = new Blob([json], { type: "application/json;charset=utf-8" });
4269
- const url = URL.createObjectURL(blob);
4270
- const a = document.createElement("a");
4271
- a.href = url;
4272
- a.download = `${workbook.name || "report"}.yudao-sheet.json`;
4273
- a.click();
4274
- setTimeout(() => URL.revokeObjectURL(url), 1e3);
4393
+ triggerBrowserBlobDownload(blob, `${workbook.name || "report"}.yudao-sheet.json`);
4275
4394
  setStatusTip("\u5DF2\u5BFC\u51FA\u5B8C\u6574\u62A5\u8868\u8FC1\u79FB\u5305 (.yudao-sheet.json)");
4276
4395
  } catch (err) {
4277
4396
  setStatusTip(`\u5BFC\u51FA\u8FC1\u79FB\u5305\u5931\u8D25: ${err?.message || String(err)}`);
@@ -4337,1096 +4456,1263 @@ var SheetPreviewAndIoModal = () => {
4337
4456
  setStatusTip("\u5DF2\u5524\u8D77\u6D4F\u89C8\u5668\u77E2\u91CF\u6253\u5370\u5E76\u89E6\u53D1 onAfterPrint / onSheetPrintConfirmed \u6253\u5370\u5B8C\u6210\u56DE\u8C03");
4338
4457
  }
4339
4458
  };
4340
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-sheet-modal-backdrop", onClick: handleCloseModal, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-sheet-modal-card", onClick: (e) => e.stopPropagation(), children: [
4341
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-sheet-modal-header", children: [
4342
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-sheet-modal-tabs", children: [
4343
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4344
- "button",
4345
- {
4346
- type: "button",
4347
- className: `yudao-sheet-modal-tab ${tab === "export" ? "is-active" : ""}`,
4348
- onClick: () => featureService.setModalTab("export"),
4349
- children: t("yudaoSheets.modal.tabExport")
4350
- }
4351
- ),
4352
- features.printTemplate && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4353
- "button",
4354
- {
4355
- type: "button",
4356
- className: `yudao-sheet-modal-tab ${tab === "print" ? "is-active" : ""}`,
4357
- onClick: () => featureService.setModalTab("print"),
4358
- children: t("yudaoSheets.modal.tabPrint")
4359
- }
4360
- ),
4361
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4362
- "button",
4363
- {
4364
- type: "button",
4365
- className: `yudao-sheet-modal-tab ${tab === "json" ? "is-active" : ""}`,
4366
- onClick: () => featureService.setModalTab("json"),
4367
- children: t("yudaoSheets.modal.tabJson")
4368
- }
4369
- )
4370
- ] }),
4371
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
4372
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4373
- "span",
4374
- {
4375
- style: {
4376
- fontSize: 11,
4377
- padding: "3px 8px",
4378
- borderRadius: 999,
4379
- background: isCustomBackendAdapter ? "#F3F5FF" : "#EEEFF1",
4380
- color: isCustomBackendAdapter ? "#2C53F1" : "#4E5565",
4381
- border: `1px solid ${isCustomBackendAdapter ? "#D2DAFA" : "transparent"}`,
4382
- fontWeight: 500
4383
- },
4384
- children: [
4385
- t("yudaoSheets.modal.ioPipelinePrefix"),
4386
- ": ",
4387
- ioAdapter.name || "frontend-default"
4388
- ]
4389
- }
4390
- ),
4391
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4392
- "button",
4393
- {
4394
- type: "button",
4395
- className: "yudao-sheet-btn",
4396
- onClick: handleCloseModal,
4397
- children: "\xD7"
4398
- }
4399
- )
4400
- ] })
4401
- ] }),
4402
- tab === "export" || tab === "print" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex" }, children: [
4403
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4404
- "div",
4405
- {
4406
- style: {
4407
- width: tab === "export" && features.datasetBinding ? 330 : 305,
4408
- borderRight: "1px solid #E3E5EA",
4409
- padding: 14,
4410
- display: "flex",
4411
- flexDirection: "column",
4412
- gap: 8,
4413
- background: "#F9FAFB",
4414
- overflowY: "auto"
4415
- },
4416
- children: [
4417
- tab === "export" ? features.datasetBinding ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
4418
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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" }),
4419
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4420
- "textarea",
4421
- {
4422
- className: "yudao-sheet-code-area",
4423
- value: datasetText,
4424
- onChange: (e) => setDatasetText(e.target.value)
4425
- }
4426
- ),
4427
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: 6, flexWrap: "wrap" }, children: [
4428
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: () => rebuildPreview(), children: t("yudaoSheets.modal.refreshPreviewBtn") }),
4429
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleGenerateMockDataset, children: t("yudaoSheets.modal.mockDatasetBtn") }),
4430
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleApplyToSheet, children: t("yudaoSheets.modal.applyToSheetBtn") })
4431
- ] })
4432
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: 12, color: "#4E5565", lineHeight: 1.6 }, children: [
4433
- "\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",
4434
- " ",
4435
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: ".xlsx" }),
4436
- " \u4E0E ",
4437
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: ".pdf" }),
4438
- " \u6587\u4EF6\u3002"
4439
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
4440
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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" }),
4441
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4442
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4443
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7EB8\u5F20\u4E0E\u9488\u5F0F\u7968\u636E\u89C4\u683C" }),
4444
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4445
- "select",
4446
- {
4447
- value: printCfg.paperOrientation,
4448
- onChange: (e) => {
4449
- const next = {
4450
- ...printCfg,
4451
- paperOrientation: e.target.value
4452
- };
4453
- setPrintCfg(next);
4454
- rebuildPreview(next);
4455
- },
4456
- children: [
4457
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "A4_LANDSCAPE", children: "A4 \u6A2A\u5411" }),
4458
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "A4_PORTRAIT", children: "A4 \u7EB5\u5411" }),
4459
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "A3_LANDSCAPE", children: "A3 \u6A2A\u5411" }),
4460
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "INVOICE_240_140", children: "240\xD7140mm \u4E8C\u7B49\u5206" }),
4461
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "INVOICE_240_93", children: "240\xD793mm \u4E09\u7B49\u5206" })
4462
- ]
4463
- }
4464
- )
4465
- ] }),
4466
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4467
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6253\u5370/PDF \u7F29\u653E\u6A21\u5F0F" }),
4468
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4469
- "select",
4470
- {
4471
- value: printCfg.scaleMode ?? "all",
4472
- onChange: (e) => {
4473
- const next = {
4474
- ...printCfg,
4475
- scaleMode: e.target.value
4476
- };
4477
- setPrintCfg(next);
4478
- rebuildPreview(next);
4479
- },
4480
- children: [
4481
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "all", children: "\u6807\u51C6\u5206\u9875" }),
4482
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "fitWidth", children: "\u9002\u5E94\u9875\u5BBD" }),
4483
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "fitSinglePage", children: "\u7F29\u81F3\u4E00\u9875" }),
4484
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "currentPage", children: "\u5F53\u524D\u9875" })
4485
- ]
4486
- }
4487
- )
4488
- ] })
4489
- ] }),
4490
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4491
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4492
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u91CD\u590D\u8868\u5934\u884C (thead)" }),
4493
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4494
- "input",
4495
- {
4496
- type: "number",
4497
- min: 0,
4498
- max: 20,
4499
- value: printCfg.repeatHeaderRow ?? 0,
4500
- onChange: (e) => {
4501
- const n = Number(e.target.value);
4502
- const next = { ...printCfg, repeatHeaderRow: n > 0 ? n : null };
4503
- setPrintCfg(next);
4504
- rebuildPreview(next);
4505
- }
4506
- }
4507
- )
4508
- ] }),
4509
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4510
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u91CD\u590D\u5C3E\u884C\u6570 (tfoot)" }),
4511
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4512
- "input",
4513
- {
4514
- type: "number",
4515
- min: 0,
4516
- max: 10,
4517
- value: printCfg.repeatFooterRows ?? 0,
4518
- onChange: (e) => {
4519
- const next = {
4520
- ...printCfg,
4521
- repeatFooterRows: Math.max(0, Number(e.target.value) || 0)
4522
- };
4523
- setPrintCfg(next);
4524
- rebuildPreview(next);
4525
- }
4526
- }
4527
- )
4528
- ] })
4529
- ] }),
4530
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 6 }, children: [
4531
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4532
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u591A\u680F\u5217\u6570" }),
4533
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4534
- "input",
4535
- {
4536
- type: "number",
4537
- min: 1,
4538
- max: 4,
4539
- value: printCfg.multiColumnCount ?? 1,
4540
- onChange: (e) => {
4541
- const n = Math.max(1, Math.min(4, Number(e.target.value) || 1));
4542
- const next = {
4543
- ...printCfg,
4544
- multiColumnCount: n > 1 ? n : void 0
4545
- };
4546
- setPrintCfg(next);
4547
- rebuildPreview(next);
4548
- }
4549
- }
4550
- )
4551
- ] }),
4552
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4553
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u680F\u95F4\u8DDD (pt)" }),
4554
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4555
- "input",
4556
- {
4557
- type: "number",
4558
- min: 0,
4559
- max: 72,
4560
- value: printCfg.columnMarginPt ?? 12,
4561
- onChange: (e) => {
4562
- const next = {
4563
- ...printCfg,
4564
- columnMarginPt: Math.max(0, Number(e.target.value) || 0)
4565
- };
4566
- setPrintCfg(next);
4567
- rebuildPreview(next);
4568
- }
4569
- }
4570
- )
4571
- ] }),
4572
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4573
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5B9A\u884C\u5206\u9875" }),
4574
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4575
- "input",
4576
- {
4577
- type: "number",
4578
- min: 0,
4579
- max: 200,
4580
- placeholder: "\u81EA\u52A8",
4581
- value: printCfg.fixedRowsPerPage ?? "",
4582
- onChange: (e) => {
4583
- const raw = e.target.value.trim();
4584
- const n = raw === "" ? 0 : Math.max(0, Number(raw) || 0);
4585
- const next = {
4586
- ...printCfg,
4587
- fixedRowsPerPage: n > 0 ? n : void 0
4588
- };
4589
- setPrintCfg(next);
4590
- rebuildPreview(next);
4591
- }
4592
- }
4593
- )
4594
- ] })
4595
- ] }),
4596
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4597
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4598
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7F16\u9875\u8D77\u59CB\u7269\u7406\u9875" }),
4599
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4600
- "input",
4601
- {
4602
- type: "number",
4603
- min: 1,
4604
- max: 99,
4605
- title: "\u5982\u8BBE\u4E3A 2 \u53EF\u8DF3\u8FC7\u7B2C 1 \u9875\u5C01\u9762\u4E0D\u7F16\u9875\u7801",
4606
- value: printCfg.pageNumberStartPage ?? 1,
4607
- onChange: (e) => {
4608
- const next = {
4609
- ...printCfg,
4610
- pageNumberStartPage: Math.max(1, Number(e.target.value) || 1)
4611
- };
4612
- setPrintCfg(next);
4613
- rebuildPreview(next);
4614
- }
4615
- }
4616
- )
4617
- ] }),
4618
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4619
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u7801\u5BF9\u9F50\u65B9\u5F0F" }),
4620
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4621
- "select",
4622
- {
4623
- value: printCfg.pageNumberAlign ?? "right",
4624
- onChange: (e) => {
4625
- const next = {
4626
- ...printCfg,
4627
- pageNumberAlign: e.target.value
4628
- };
4629
- setPrintCfg(next);
4630
- rebuildPreview(next);
4631
- },
4632
- children: [
4633
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "left", children: "\u5C45\u5DE6" }),
4634
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "center", children: "\u5C45\u4E2D" }),
4635
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "right", children: "\u5C45\u53F3" })
4636
- ]
4637
- }
4638
- )
4639
- ] })
4640
- ] }),
4641
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4642
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6253\u5370\u9875\u7709\u6807\u9898" }),
4643
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4644
- "input",
4645
- {
4646
- type: "text",
4647
- value: printCfg.headerTitle,
4648
- onChange: (e) => {
4649
- const next = { ...printCfg, headerTitle: e.target.value };
4650
- setPrintCfg(next);
4651
- rebuildPreview(next);
4652
- }
4653
- }
4654
- )
4655
- ] }),
4656
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 4 }, children: [
4657
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4658
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u7709\u5DE6 (&D/&F)" }),
4659
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4660
- "input",
4661
- {
4662
- type: "text",
4663
- placeholder: "\u5982 &D",
4664
- value: printCfg.headerLeft ?? "",
4665
- onChange: (e) => {
4666
- const next = { ...printCfg, headerLeft: e.target.value };
4667
- setPrintCfg(next);
4668
- rebuildPreview(next);
4669
- }
4670
- }
4671
- )
4672
- ] }),
4673
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4674
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u7709\u4E2D" }),
4459
+ const stagedSheetSummary = pendingImport ? (() => {
4460
+ const sheetsObj = pendingImport.snapshot.sheets ?? {};
4461
+ const orderedIds = pendingImport.snapshot.sheetOrder && pendingImport.snapshot.sheetOrder.length > 0 ? pendingImport.snapshot.sheetOrder.filter((id) => Boolean(sheetsObj[id])) : Object.keys(sheetsObj);
4462
+ const names = orderedIds.map((id, idx) => sheetsObj[id]?.name || `Sheet${idx + 1}`);
4463
+ return { count: names.length, names };
4464
+ })() : null;
4465
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4466
+ "div",
4467
+ {
4468
+ className: "yudao-sheet-modal-backdrop",
4469
+ "data-testid": "yudao-io-modal",
4470
+ onClick: handleCloseModal,
4471
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-sheet-modal-card", onClick: (e) => e.stopPropagation(), children: [
4472
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-sheet-modal-header", children: [
4473
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-sheet-modal-tabs", children: [
4474
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4475
+ "button",
4476
+ {
4477
+ type: "button",
4478
+ className: `yudao-sheet-modal-tab ${tab === "import" ? "is-active" : ""}`,
4479
+ onClick: () => featureService.setModalTab("import"),
4480
+ children: t("yudaoSheets.modal.tabImport")
4481
+ }
4482
+ ),
4483
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4484
+ "button",
4485
+ {
4486
+ type: "button",
4487
+ className: `yudao-sheet-modal-tab ${tab === "export" ? "is-active" : ""}`,
4488
+ onClick: () => featureService.setModalTab("export"),
4489
+ children: t("yudaoSheets.modal.tabExport")
4490
+ }
4491
+ ),
4492
+ features.printTemplate && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4493
+ "button",
4494
+ {
4495
+ type: "button",
4496
+ className: `yudao-sheet-modal-tab ${tab === "print" ? "is-active" : ""}`,
4497
+ onClick: () => featureService.setModalTab("print"),
4498
+ children: t("yudaoSheets.modal.tabPrint")
4499
+ }
4500
+ ),
4501
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4502
+ "button",
4503
+ {
4504
+ type: "button",
4505
+ className: `yudao-sheet-modal-tab ${tab === "json" ? "is-active" : ""}`,
4506
+ onClick: () => featureService.setModalTab("json"),
4507
+ children: t("yudaoSheets.modal.tabJson")
4508
+ }
4509
+ )
4510
+ ] }),
4511
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
4512
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4513
+ "span",
4514
+ {
4515
+ style: {
4516
+ fontSize: 11,
4517
+ padding: "3px 8px",
4518
+ borderRadius: 999,
4519
+ background: isCustomBackendAdapter ? "#F3F5FF" : "#EEEFF1",
4520
+ color: isCustomBackendAdapter ? "#2C53F1" : "#4E5565",
4521
+ border: `1px solid ${isCustomBackendAdapter ? "#D2DAFA" : "transparent"}`,
4522
+ fontWeight: 500
4523
+ },
4524
+ children: [
4525
+ t("yudaoSheets.modal.ioPipelinePrefix"),
4526
+ ": ",
4527
+ ioAdapter.name || "frontend-default"
4528
+ ]
4529
+ }
4530
+ ),
4531
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4532
+ "button",
4533
+ {
4534
+ type: "button",
4535
+ className: "yudao-sheet-btn",
4536
+ onClick: handleCloseModal,
4537
+ children: "\xD7"
4538
+ }
4539
+ )
4540
+ ] })
4541
+ ] }),
4542
+ tab === "import" || tab === "export" || tab === "print" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, minHeight: 0, display: "flex" }, children: [
4543
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4544
+ "div",
4545
+ {
4546
+ style: {
4547
+ width: (tab === "export" || tab === "import") && features.datasetBinding ? 336 : 318,
4548
+ borderRight: "1px solid #E3E5EA",
4549
+ padding: 14,
4550
+ display: "flex",
4551
+ flexDirection: "column",
4552
+ gap: 8,
4553
+ background: "#F9FAFB",
4554
+ overflowY: "auto"
4555
+ },
4556
+ children: [
4557
+ tab === "import" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: 12, color: "#4E5565", lineHeight: 1.55 }, children: [
4558
+ "\u652F\u6301\u9884\u68C0\u89E3\u6790\u672C\u5730\u6216\u670D\u52A1\u7AEF ",
4559
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: ".xlsx" }),
4560
+ " / ",
4561
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: ".xls" }),
4562
+ " / ",
4563
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: ".csv" }),
4564
+ " / ",
4565
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: ".xml" }),
4566
+ " / ",
4567
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: ".json" }),
4568
+ " \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"
4569
+ ] }) : tab === "export" ? features.datasetBinding ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
4570
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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" }),
4675
4571
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4676
- "input",
4572
+ "textarea",
4677
4573
  {
4678
- type: "text",
4679
- placeholder: "\u5982 &A",
4680
- value: printCfg.headerCenter ?? "",
4681
- onChange: (e) => {
4682
- const next = { ...printCfg, headerCenter: e.target.value };
4683
- setPrintCfg(next);
4684
- rebuildPreview(next);
4685
- }
4574
+ className: "yudao-sheet-code-area",
4575
+ value: datasetText,
4576
+ onChange: (e) => setDatasetText(e.target.value)
4686
4577
  }
4687
- )
4688
- ] }),
4689
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4690
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u7709\u53F3 (&P/&N)" }),
4691
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4692
- "input",
4693
- {
4694
- type: "text",
4695
- placeholder: "\u5982 \u7B2C&P/&N\u9875",
4696
- value: printCfg.headerRight ?? "",
4697
- onChange: (e) => {
4698
- const next = { ...printCfg, headerRight: e.target.value };
4699
- setPrintCfg(next);
4700
- rebuildPreview(next);
4701
- }
4702
- }
4703
- )
4704
- ] })
4705
- ] }),
4706
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 4 }, children: [
4707
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4708
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u811A\u5DE6" }),
4709
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4710
- "input",
4711
- {
4712
- type: "text",
4713
- placeholder: "\u5236\u8868\u90E8\u95E8",
4714
- value: printCfg.footerLeft ?? "",
4715
- onChange: (e) => {
4716
- const next = { ...printCfg, footerLeft: e.target.value };
4717
- setPrintCfg(next);
4718
- rebuildPreview(next);
4719
- }
4720
- }
4721
- )
4722
- ] }),
4723
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4724
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u811A\u4E2D" }),
4725
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4726
- "input",
4727
- {
4728
- type: "text",
4729
- placeholder: "&F",
4730
- value: printCfg.footerCenter ?? "",
4731
- onChange: (e) => {
4732
- const next = { ...printCfg, footerCenter: e.target.value };
4733
- setPrintCfg(next);
4734
- rebuildPreview(next);
4735
- }
4736
- }
4737
- )
4738
- ] }),
4739
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4740
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u811A\u53F3" }),
4741
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4742
- "input",
4743
- {
4744
- type: "text",
4745
- placeholder: "#[PAGE]/#[PAGES]",
4746
- value: printCfg.footerRight ?? "",
4747
- onChange: (e) => {
4748
- const next = { ...printCfg, footerRight: e.target.value };
4749
- setPrintCfg(next);
4750
- rebuildPreview(next);
4578
+ ),
4579
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: 6, flexWrap: "wrap" }, children: [
4580
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: () => rebuildPreview(), children: t("yudaoSheets.modal.refreshPreviewBtn") }),
4581
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleGenerateMockDataset, children: t("yudaoSheets.modal.mockDatasetBtn") }),
4582
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleApplyToSheet, children: t("yudaoSheets.modal.applyToSheetBtn") })
4583
+ ] })
4584
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: 12, color: "#4E5565", lineHeight: 1.6 }, children: [
4585
+ "\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",
4586
+ " ",
4587
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: ".xlsx" }),
4588
+ " \u4E0E ",
4589
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: ".pdf" }),
4590
+ " \u6587\u4EF6\u3002"
4591
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
4592
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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" }),
4593
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4594
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4595
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7EB8\u5F20\u4E0E\u9488\u5F0F\u7968\u636E\u89C4\u683C" }),
4596
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4597
+ "select",
4598
+ {
4599
+ value: printCfg.paperOrientation,
4600
+ onChange: (e) => {
4601
+ const next = {
4602
+ ...printCfg,
4603
+ paperOrientation: e.target.value
4604
+ };
4605
+ setPrintCfg(next);
4606
+ rebuildPreview(next);
4607
+ },
4608
+ children: [
4609
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "A4_LANDSCAPE", children: "A4 \u6A2A\u5411" }),
4610
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "A4_PORTRAIT", children: "A4 \u7EB5\u5411" }),
4611
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "A3_LANDSCAPE", children: "A3 \u6A2A\u5411" }),
4612
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "INVOICE_240_140", children: "240\xD7140mm \u4E8C\u7B49\u5206" }),
4613
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "INVOICE_240_93", children: "240\xD793mm \u4E09\u7B49\u5206" })
4614
+ ]
4615
+ }
4616
+ )
4617
+ ] }),
4618
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4619
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6253\u5370/PDF \u7F29\u653E\u6A21\u5F0F" }),
4620
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4621
+ "select",
4622
+ {
4623
+ value: printCfg.scaleMode ?? "all",
4624
+ onChange: (e) => {
4625
+ const next = {
4626
+ ...printCfg,
4627
+ scaleMode: e.target.value
4628
+ };
4629
+ setPrintCfg(next);
4630
+ rebuildPreview(next);
4631
+ },
4632
+ children: [
4633
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "all", children: "\u6807\u51C6\u5206\u9875" }),
4634
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "fitWidth", children: "\u9002\u5E94\u9875\u5BBD" }),
4635
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "fitSinglePage", children: "\u7F29\u81F3\u4E00\u9875" }),
4636
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "currentPage", children: "\u5F53\u524D\u9875" })
4637
+ ]
4638
+ }
4639
+ )
4640
+ ] })
4641
+ ] }),
4642
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4643
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4644
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u91CD\u590D\u8868\u5934\u884C (thead)" }),
4645
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4646
+ "input",
4647
+ {
4648
+ type: "number",
4649
+ min: 0,
4650
+ max: 20,
4651
+ value: printCfg.repeatHeaderRow ?? 0,
4652
+ onChange: (e) => {
4653
+ const n = Number(e.target.value);
4654
+ const next = { ...printCfg, repeatHeaderRow: n > 0 ? n : null };
4655
+ setPrintCfg(next);
4656
+ rebuildPreview(next);
4657
+ }
4658
+ }
4659
+ )
4660
+ ] }),
4661
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4662
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u91CD\u590D\u5C3E\u884C\u6570 (tfoot)" }),
4663
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4664
+ "input",
4665
+ {
4666
+ type: "number",
4667
+ min: 0,
4668
+ max: 10,
4669
+ value: printCfg.repeatFooterRows ?? 0,
4670
+ onChange: (e) => {
4671
+ const next = {
4672
+ ...printCfg,
4673
+ repeatFooterRows: Math.max(0, Number(e.target.value) || 0)
4674
+ };
4675
+ setPrintCfg(next);
4676
+ rebuildPreview(next);
4677
+ }
4678
+ }
4679
+ )
4680
+ ] })
4681
+ ] }),
4682
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 6 }, children: [
4683
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4684
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u591A\u680F\u5217\u6570" }),
4685
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4686
+ "input",
4687
+ {
4688
+ type: "number",
4689
+ min: 1,
4690
+ max: 4,
4691
+ value: printCfg.multiColumnCount ?? 1,
4692
+ onChange: (e) => {
4693
+ const n = Math.max(1, Math.min(4, Number(e.target.value) || 1));
4694
+ const next = {
4695
+ ...printCfg,
4696
+ multiColumnCount: n > 1 ? n : void 0
4697
+ };
4698
+ setPrintCfg(next);
4699
+ rebuildPreview(next);
4700
+ }
4701
+ }
4702
+ )
4703
+ ] }),
4704
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4705
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u680F\u95F4\u8DDD (pt)" }),
4706
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4707
+ "input",
4708
+ {
4709
+ type: "number",
4710
+ min: 0,
4711
+ max: 72,
4712
+ value: printCfg.columnMarginPt ?? 12,
4713
+ onChange: (e) => {
4714
+ const next = {
4715
+ ...printCfg,
4716
+ columnMarginPt: Math.max(0, Number(e.target.value) || 0)
4717
+ };
4718
+ setPrintCfg(next);
4719
+ rebuildPreview(next);
4720
+ }
4721
+ }
4722
+ )
4723
+ ] }),
4724
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4725
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5B9A\u884C\u5206\u9875" }),
4726
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4727
+ "input",
4728
+ {
4729
+ type: "number",
4730
+ min: 0,
4731
+ max: 200,
4732
+ placeholder: "\u81EA\u52A8",
4733
+ value: printCfg.fixedRowsPerPage ?? "",
4734
+ onChange: (e) => {
4735
+ const raw = e.target.value.trim();
4736
+ const n = raw === "" ? 0 : Math.max(0, Number(raw) || 0);
4737
+ const next = {
4738
+ ...printCfg,
4739
+ fixedRowsPerPage: n > 0 ? n : void 0
4740
+ };
4741
+ setPrintCfg(next);
4742
+ rebuildPreview(next);
4743
+ }
4744
+ }
4745
+ )
4746
+ ] })
4747
+ ] }),
4748
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
4749
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4750
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7F16\u9875\u8D77\u59CB\u7269\u7406\u9875" }),
4751
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4752
+ "input",
4753
+ {
4754
+ type: "number",
4755
+ min: 1,
4756
+ max: 99,
4757
+ title: "\u5982\u8BBE\u4E3A 2 \u53EF\u8DF3\u8FC7\u7B2C 1 \u9875\u5C01\u9762\u4E0D\u7F16\u9875\u7801",
4758
+ value: printCfg.pageNumberStartPage ?? 1,
4759
+ onChange: (e) => {
4760
+ const next = {
4761
+ ...printCfg,
4762
+ pageNumberStartPage: Math.max(1, Number(e.target.value) || 1)
4763
+ };
4764
+ setPrintCfg(next);
4765
+ rebuildPreview(next);
4766
+ }
4767
+ }
4768
+ )
4769
+ ] }),
4770
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4771
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u7801\u5BF9\u9F50\u65B9\u5F0F" }),
4772
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4773
+ "select",
4774
+ {
4775
+ value: printCfg.pageNumberAlign ?? "right",
4776
+ onChange: (e) => {
4777
+ const next = {
4778
+ ...printCfg,
4779
+ pageNumberAlign: e.target.value
4780
+ };
4781
+ setPrintCfg(next);
4782
+ rebuildPreview(next);
4783
+ },
4784
+ children: [
4785
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "left", children: "\u5C45\u5DE6" }),
4786
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "center", children: "\u5C45\u4E2D" }),
4787
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "right", children: "\u5C45\u53F3" })
4788
+ ]
4789
+ }
4790
+ )
4791
+ ] })
4792
+ ] }),
4793
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4794
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6253\u5370\u9875\u7709\u6807\u9898" }),
4795
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4796
+ "input",
4797
+ {
4798
+ type: "text",
4799
+ value: printCfg.headerTitle,
4800
+ onChange: (e) => {
4801
+ const next = { ...printCfg, headerTitle: e.target.value };
4802
+ setPrintCfg(next);
4803
+ rebuildPreview(next);
4804
+ }
4751
4805
  }
4752
- }
4753
- )
4754
- ] })
4755
- ] }),
4756
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4757
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u659C\u5411\u9632\u4F2A\u5E73\u94FA\u6C34\u5370\u6587\u5B57" }),
4758
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4759
- "input",
4760
- {
4761
- type: "text",
4762
- placeholder: "\u5982\uFF1A\u4F01\u4E1A\u62A5\u8868 \xB7 \u5185\u90E8\u8D44\u6599",
4763
- value: printCfg.watermarkText ?? "",
4764
- onChange: (e) => {
4765
- const next = { ...printCfg, watermarkText: e.target.value };
4766
- setPrintCfg(next);
4767
- rebuildPreview(next);
4768
- }
4769
- }
4770
- )
4771
- ] }),
4772
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4773
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7269\u7406\u5957\u6253\u6821\u51C6\u5E95\u56FE URL\uFF08\u53EF\u9009\uFF09" }),
4774
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4775
- "input",
4776
- {
4777
- type: "text",
4778
- placeholder: "\u8F93\u5165\u9884\u5370\u53D1\u7968/\u8BC1\u4E66\u626B\u63CF\u4EF6\u56FE\u7247 URL",
4779
- value: printCfg.overlayBackgroundUrl ?? "",
4780
- onChange: (e) => {
4781
- const next = { ...printCfg, overlayBackgroundUrl: e.target.value };
4782
- setPrintCfg(next);
4783
- rebuildPreview(next);
4784
- }
4785
- }
4786
- )
4787
- ] }),
4788
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4789
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4790
- "input",
4791
- {
4792
- type: "checkbox",
4793
- checked: Boolean(printCfg.pinFooterToBottom),
4794
- onChange: (e) => {
4795
- const next = { ...printCfg, pinFooterToBottom: e.target.checked };
4796
- setPrintCfg(next);
4797
- rebuildPreview(next);
4798
- }
4799
- }
4800
- ),
4801
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5C3E\u884C\u8D34\u5E95\u56FA\u5B9A\u6253\u5370 (pinFooterToBottom)" })
4802
- ] }),
4803
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4804
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4805
- "input",
4806
- {
4807
- type: "checkbox",
4808
- checked: Boolean(printCfg.pageBreakAfterGroup),
4809
- onChange: (e) => {
4810
- const next = { ...printCfg, pageBreakAfterGroup: e.target.checked };
4811
- setPrintCfg(next);
4812
- rebuildPreview(next);
4813
- }
4814
- }
4815
- ),
4816
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6309\u7EC4\u81EA\u52A8\u5206\u9875 (pageBreakAfterGroup)" })
4817
- ] }),
4818
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4819
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4820
- "input",
4821
- {
4822
- type: "checkbox",
4823
- checked: printCfg.showPageNumbers !== false,
4824
- onChange: (e) => {
4825
- const next = { ...printCfg, showPageNumbers: e.target.checked };
4826
- setPrintCfg(next);
4827
- rebuildPreview(next);
4828
- }
4829
- }
4830
- ),
4831
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u663E\u793A\u9875\u7801 (showPageNumbers)" })
4832
- ] }),
4833
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4834
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4835
- "input",
4836
- {
4837
- type: "checkbox",
4838
- checked: printCfg.excludeBackgroundOnPrint ?? true,
4839
- onChange: (e) => {
4840
- const next = { ...printCfg, excludeBackgroundOnPrint: e.target.checked };
4841
- setPrintCfg(next);
4842
- rebuildPreview(next);
4843
- }
4844
- }
4845
- ),
4846
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5957\u6253\u6A21\u5F0F\uFF1A\u4EC5\u9884\u89C8\u53C2\u8003\u5E95\u56FE\uFF0C\u6253\u5370\u81EA\u52A8\u5265\u79BB\u5E95\u56FE" })
4847
- ] }),
4848
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4849
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4850
- "input",
4851
- {
4852
- type: "checkbox",
4853
- checked: printCfg.showGridlines,
4854
- onChange: (e) => {
4855
- const next = { ...printCfg, showGridlines: e.target.checked };
4856
- setPrintCfg(next);
4857
- rebuildPreview(next);
4858
- }
4859
- }
4860
- ),
4861
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u663E\u793A\u7A7A\u767D\u5355\u5143\u683C\u8F85\u52A9\u7F51\u683C\u7EBF" })
4862
- ] }),
4863
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4864
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4865
- "input",
4866
- {
4867
- type: "checkbox",
4868
- checked: Boolean(printCfg.wordFormStyle),
4869
- onChange: (e) => {
4870
- const next = { ...printCfg, wordFormStyle: e.target.checked };
4871
- setPrintCfg(next);
4872
- rebuildPreview(next);
4873
- }
4874
- }
4875
- ),
4876
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7C7B Word \u65E0\u8FB9\u6846\u516C\u6587/\u8868\u5355\u98CE\u683C" })
4877
- ] })
4878
- ] }),
4879
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4880
- "div",
4881
- {
4882
- style: {
4883
- padding: "6px 8px",
4884
- background: "#FFFFFF",
4885
- border: "1px solid #E3E5EA",
4886
- borderRadius: 6,
4887
- display: "flex",
4888
- flexDirection: "column",
4889
- gap: 5
4890
- },
4891
- children: [
4892
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11.5, cursor: "pointer" }, children: [
4893
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 5, fontWeight: 600, color: "#1B1C1F" }, children: [
4806
+ )
4807
+ ] }),
4808
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 4 }, children: [
4809
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4810
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u7709\u5DE6 (&D/&F)" }),
4894
4811
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4895
4812
  "input",
4896
4813
  {
4897
- type: "checkbox",
4898
- checked: paginationEnabled,
4814
+ type: "text",
4815
+ placeholder: "\u5982 &D",
4816
+ value: printCfg.headerLeft ?? "",
4899
4817
  onChange: (e) => {
4900
- const enabled = e.target.checked;
4901
- setPaginationEnabled(enabled);
4902
- setPageIndex(1);
4903
- rebuildPreview(void 0, { enabled, page: 1, pageSize });
4818
+ const next = { ...printCfg, headerLeft: e.target.value };
4819
+ setPrintCfg(next);
4820
+ rebuildPreview(next);
4904
4821
  }
4905
4822
  }
4906
- ),
4907
- "\u5927\u6570\u636E\u5206\u9875\u5207\u7247\u9884\u89C8"
4823
+ )
4908
4824
  ] }),
4909
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4910
- "select",
4825
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4826
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u7709\u4E2D" }),
4827
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4828
+ "input",
4829
+ {
4830
+ type: "text",
4831
+ placeholder: "\u5982 &A",
4832
+ value: printCfg.headerCenter ?? "",
4833
+ onChange: (e) => {
4834
+ const next = { ...printCfg, headerCenter: e.target.value };
4835
+ setPrintCfg(next);
4836
+ rebuildPreview(next);
4837
+ }
4838
+ }
4839
+ )
4840
+ ] }),
4841
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4842
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u7709\u53F3 (&P/&N)" }),
4843
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4844
+ "input",
4845
+ {
4846
+ type: "text",
4847
+ placeholder: "\u5982 \u7B2C&P/&N\u9875",
4848
+ value: printCfg.headerRight ?? "",
4849
+ onChange: (e) => {
4850
+ const next = { ...printCfg, headerRight: e.target.value };
4851
+ setPrintCfg(next);
4852
+ rebuildPreview(next);
4853
+ }
4854
+ }
4855
+ )
4856
+ ] })
4857
+ ] }),
4858
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr 1fr", gap: 4 }, children: [
4859
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4860
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u811A\u5DE6" }),
4861
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4862
+ "input",
4863
+ {
4864
+ type: "text",
4865
+ placeholder: "\u5236\u8868\u90E8\u95E8",
4866
+ value: printCfg.footerLeft ?? "",
4867
+ onChange: (e) => {
4868
+ const next = { ...printCfg, footerLeft: e.target.value };
4869
+ setPrintCfg(next);
4870
+ rebuildPreview(next);
4871
+ }
4872
+ }
4873
+ )
4874
+ ] }),
4875
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4876
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u811A\u4E2D" }),
4877
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4878
+ "input",
4879
+ {
4880
+ type: "text",
4881
+ placeholder: "&F",
4882
+ value: printCfg.footerCenter ?? "",
4883
+ onChange: (e) => {
4884
+ const next = { ...printCfg, footerCenter: e.target.value };
4885
+ setPrintCfg(next);
4886
+ rebuildPreview(next);
4887
+ }
4888
+ }
4889
+ )
4890
+ ] }),
4891
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4892
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u9875\u811A\u53F3" }),
4893
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4894
+ "input",
4895
+ {
4896
+ type: "text",
4897
+ placeholder: "#[PAGE]/#[PAGES]",
4898
+ value: printCfg.footerRight ?? "",
4899
+ onChange: (e) => {
4900
+ const next = { ...printCfg, footerRight: e.target.value };
4901
+ setPrintCfg(next);
4902
+ rebuildPreview(next);
4903
+ }
4904
+ }
4905
+ )
4906
+ ] })
4907
+ ] }),
4908
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4909
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u659C\u5411\u9632\u4F2A\u5E73\u94FA\u6C34\u5370\u6587\u5B57" }),
4910
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4911
+ "input",
4911
4912
  {
4912
- style: {
4913
- fontSize: 10.5,
4914
- padding: "1px 4px",
4915
- borderRadius: 4,
4916
- border: "1px solid #E3E5EA",
4917
- background: "#FFFFFF",
4918
- color: "#31363F"
4919
- },
4920
- value: pageSize,
4921
- disabled: !paginationEnabled,
4913
+ type: "text",
4914
+ placeholder: "\u5982\uFF1A\u4F01\u4E1A\u62A5\u8868 \xB7 \u5185\u90E8\u8D44\u6599",
4915
+ value: printCfg.watermarkText ?? "",
4922
4916
  onChange: (e) => {
4923
- const nextSize = Number(e.target.value);
4924
- setPageSize(nextSize);
4925
- setPageIndex(1);
4926
- rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize: nextSize });
4927
- },
4928
- children: [
4929
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: 25, children: "25 \u884C/\u9875" }),
4930
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: 50, children: "50 \u884C/\u9875" }),
4931
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: 100, children: "100 \u884C/\u9875" }),
4932
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: 500, children: "500 \u884C/\u9875" })
4933
- ]
4917
+ const next = { ...printCfg, watermarkText: e.target.value };
4918
+ setPrintCfg(next);
4919
+ rebuildPreview(next);
4920
+ }
4934
4921
  }
4935
4922
  )
4936
4923
  ] }),
4937
- paginationEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11 }, children: [
4924
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-sheet-field-row", children: [
4925
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7269\u7406\u5957\u6253\u6821\u51C6\u5E95\u56FE URL\uFF08\u53EF\u9009\uFF09" }),
4938
4926
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4939
- "button",
4927
+ "input",
4940
4928
  {
4941
- type: "button",
4942
- className: "yudao-sheet-btn",
4943
- style: { padding: "2px 6px", fontSize: 10.5 },
4944
- disabled: pageIndex <= 1,
4945
- onClick: () => {
4946
- const prev = Math.max(1, pageIndex - 1);
4947
- setPageIndex(prev);
4948
- rebuildPreview(void 0, { enabled: true, page: prev, pageSize });
4949
- },
4950
- children: "\u4E0A\u4E00\u9875"
4929
+ type: "text",
4930
+ placeholder: "\u8F93\u5165\u9884\u5370\u53D1\u7968/\u8BC1\u4E66\u626B\u63CF\u4EF6\u56FE\u7247 URL",
4931
+ value: printCfg.overlayBackgroundUrl ?? "",
4932
+ onChange: (e) => {
4933
+ const next = { ...printCfg, overlayBackgroundUrl: e.target.value };
4934
+ setPrintCfg(next);
4935
+ rebuildPreview(next);
4936
+ }
4937
+ }
4938
+ )
4939
+ ] }),
4940
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4941
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4942
+ "input",
4943
+ {
4944
+ type: "checkbox",
4945
+ checked: Boolean(printCfg.pinFooterToBottom),
4946
+ onChange: (e) => {
4947
+ const next = { ...printCfg, pinFooterToBottom: e.target.checked };
4948
+ setPrintCfg(next);
4949
+ rebuildPreview(next);
4950
+ }
4951
4951
  }
4952
4952
  ),
4953
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { color: "#4E5565" }, children: [
4954
- "\u7B2C ",
4955
- pageIndex,
4956
- "/",
4957
- pageSummary.totalPages,
4958
- " \u9875 \xB7 \u5171 ",
4959
- pageSummary.totalRows,
4960
- " \u884C"
4961
- ] }),
4953
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5C3E\u884C\u8D34\u5E95\u56FA\u5B9A\u6253\u5370 (pinFooterToBottom)" })
4954
+ ] }),
4955
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4962
4956
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4963
- "button",
4957
+ "input",
4964
4958
  {
4965
- type: "button",
4966
- className: "yudao-sheet-btn",
4967
- style: { padding: "2px 6px", fontSize: 10.5 },
4968
- disabled: pageIndex >= pageSummary.totalPages,
4969
- onClick: () => {
4970
- const next = Math.min(pageSummary.totalPages, pageIndex + 1);
4971
- setPageIndex(next);
4972
- rebuildPreview(void 0, { enabled: true, page: next, pageSize });
4973
- },
4974
- children: "\u4E0B\u4E00\u9875"
4959
+ type: "checkbox",
4960
+ checked: Boolean(printCfg.pageBreakAfterGroup),
4961
+ onChange: (e) => {
4962
+ const next = { ...printCfg, pageBreakAfterGroup: e.target.checked };
4963
+ setPrintCfg(next);
4964
+ rebuildPreview(next);
4965
+ }
4975
4966
  }
4976
- )
4977
- ] })
4978
- ]
4979
- }
4980
- ),
4981
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4982
- "div",
4983
- {
4984
- style: {
4985
- marginTop: "auto",
4986
- padding: "8px 10px",
4987
- background: "#FFFFFF",
4988
- border: "1px solid #E3E5EA",
4989
- borderRadius: 8,
4990
- display: "flex",
4991
- flexDirection: "column",
4992
- gap: 6
4993
- },
4994
- children: [
4995
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5 }, children: [
4996
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontWeight: 600, color: "#1B1C1F" }, children: "\u5BFC\u5165/\u5BFC\u51FA\u5904\u7406\u65B9\u5F0F\uFF08\u6309\u6B21\u9009\u62E9\uFF09" }),
4997
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontSize: 10.5, color: "#7D8698" }, children: [
4998
- "\u5FEB\u7167 ",
4999
- snapSizeKb,
5000
- " KB"
5001
- ] })
4967
+ ),
4968
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6309\u7EC4\u81EA\u52A8\u5206\u9875 (pageBreakAfterGroup)" })
5002
4969
  ] }),
5003
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-sheet-segmented", style: { gridTemplateColumns: "1fr 1fr" }, children: [
4970
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
5004
4971
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5005
- "button",
4972
+ "input",
5006
4973
  {
5007
- type: "button",
5008
- className: `yudao-sheet-segmented-item ${ioTarget === "browser" ? "is-active" : ""}`,
5009
- onClick: () => setIoTarget("browser"),
5010
- children: t("yudaoSheets.modal.browserModeBtn")
4974
+ type: "checkbox",
4975
+ checked: printCfg.showPageNumbers !== false,
4976
+ onChange: (e) => {
4977
+ const next = { ...printCfg, showPageNumbers: e.target.checked };
4978
+ setPrintCfg(next);
4979
+ rebuildPreview(next);
4980
+ }
5011
4981
  }
5012
4982
  ),
5013
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5014
- "button",
4983
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u663E\u793A\u9875\u7801 (showPageNumbers)" })
4984
+ ] }),
4985
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
4986
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4987
+ "input",
5015
4988
  {
5016
- type: "button",
5017
- className: `yudao-sheet-segmented-item ${ioTarget === "server" ? "is-active" : ""}`,
5018
- onClick: () => setIoTarget("server"),
5019
- 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",
5020
- children: [
5021
- t("yudaoSheets.modal.serverModeBtn"),
5022
- ioCaps.server.exportSheet || ioCaps.server.importSheet ? "" : t("yudaoSheets.modal.serverNotConnected")
5023
- ]
4989
+ type: "checkbox",
4990
+ checked: printCfg.excludeBackgroundOnPrint ?? true,
4991
+ onChange: (e) => {
4992
+ const next = { ...printCfg, excludeBackgroundOnPrint: e.target.checked };
4993
+ setPrintCfg(next);
4994
+ rebuildPreview(next);
4995
+ }
5024
4996
  }
5025
- )
4997
+ ),
4998
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5957\u6253\u6A21\u5F0F\uFF1A\u4EC5\u9884\u89C8\u53C2\u8003\u5E95\u56FE\uFF0C\u6253\u5370\u81EA\u52A8\u5265\u79BB\u5E95\u56FE" })
5026
4999
  ] }),
5027
- ioTarget === "browser" ? exportCapReport.warnings.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5028
- "div",
5029
- {
5030
- style: {
5031
- fontSize: 10.5,
5032
- color: "#4E5565",
5033
- background: "#F9FAFB",
5034
- border: "1px solid #E3E5EA",
5035
- padding: "4px 6px",
5036
- borderRadius: 5,
5037
- lineHeight: 1.4
5038
- },
5039
- children: [
5040
- "\u6D4F\u89C8\u5668\u7AEF\u63D0\u793A\uFF1A",
5041
- exportCapReport.warnings.join("\uFF1B"),
5042
- "\uFF08\u9AD8\u4FDD\u771F\u5EFA\u8BAE\u9009\u670D\u52A1\u7AEF\uFF09\u3002"
5043
- ]
5044
- }
5045
- ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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__ */ (0, import_jsx_runtime4.jsx)("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" }),
5046
- features.datasetBinding && ioTarget === "browser" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 5, fontSize: 11, color: "#31363F", cursor: "pointer" }, children: [
5000
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
5001
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5002
+ "input",
5003
+ {
5004
+ type: "checkbox",
5005
+ checked: printCfg.showGridlines,
5006
+ onChange: (e) => {
5007
+ const next = { ...printCfg, showGridlines: e.target.checked };
5008
+ setPrintCfg(next);
5009
+ rebuildPreview(next);
5010
+ }
5011
+ }
5012
+ ),
5013
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u663E\u793A\u7A7A\u767D\u5355\u5143\u683C\u8F85\u52A9\u7F51\u683C\u7EBF" })
5014
+ ] }),
5015
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 11.5 }, children: [
5047
5016
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5048
5017
  "input",
5049
5018
  {
5050
5019
  type: "checkbox",
5051
- checked: skipDatasetOnExport,
5052
- onChange: (e) => setSkipDatasetOnExport(e.target.checked)
5020
+ checked: Boolean(printCfg.wordFormStyle),
5021
+ onChange: (e) => {
5022
+ const next = { ...printCfg, wordFormStyle: e.target.checked };
5023
+ setPrintCfg(next);
5024
+ rebuildPreview(next);
5025
+ }
5053
5026
  }
5054
5027
  ),
5055
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u4EC5\u7F16\u7801\u5F53\u524D\u5FEB\u7167\uFF08\u4E0D\u91CD\u590D\u6267\u884C\u6570\u636E\u96C6\u586B\u6570\uFF09" })
5028
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7C7B Word \u65E0\u8FB9\u6846\u516C\u6587/\u8868\u5355\u98CE\u683C" })
5056
5029
  ] })
5057
- ]
5058
- }
5059
- ),
5060
- importWarnings.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5061
- "div",
5062
- {
5063
- style: {
5064
- fontSize: 10.5,
5065
- color: "#4E5565",
5066
- background: "#F9FAFB",
5067
- border: "1px solid #E3E5EA",
5068
- padding: "5px 7px",
5069
- borderRadius: 6,
5070
- lineHeight: 1.4
5071
- },
5072
- children: [
5073
- "\u5BFC\u5165\u964D\u7EA7\u6E05\u5355\uFF1A",
5074
- importWarnings.join("\uFF1B")
5075
- ]
5076
- }
5077
- ),
5078
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
5079
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
5080
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5081
- "button",
5082
- {
5083
- type: "button",
5084
- className: `yudao-sheet-btn ${tab !== "print" ? "is-primary" : ""}`,
5085
- onClick: () => handleDownload("xlsx"),
5086
- children: "\u5BFC\u51FA Excel (.xlsx)"
5087
- }
5088
- ),
5089
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5090
- "button",
5091
- {
5092
- type: "button",
5093
- className: "yudao-sheet-btn",
5094
- onClick: () => handleDownload("xls"),
5095
- children: "\u5BFC\u51FA\u517C\u5BB9 (.xls)"
5096
- }
5097
- )
5098
- ] }),
5099
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
5100
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5101
- "button",
5102
- {
5103
- type: "button",
5104
- className: `yudao-sheet-btn ${tab === "print" ? "is-primary" : ""}`,
5105
- onClick: () => handleDownload("pdf"),
5106
- children: "\u5BFC\u51FA\u77E2\u91CF PDF"
5107
- }
5108
- ),
5109
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5110
- "button",
5111
- {
5112
- type: "button",
5113
- className: "yudao-sheet-btn",
5114
- onClick: () => handleDownload("docx"),
5115
- children: "\u5BFC\u51FA Word (.docx)"
5116
- }
5117
- )
5118
- ] }),
5119
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
5120
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleImportBySelectedTarget, children: "\u5BFC\u5165 (.xlsx/.xls/.xml/.csv)" }),
5121
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5122
- "button",
5123
- {
5124
- type: "button",
5125
- className: "yudao-sheet-btn",
5126
- onClick: () => handleDownload("csv"),
5127
- children: "\u5BFC\u51FA CSV"
5128
- }
5129
- )
5130
- ] }),
5131
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
5132
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5133
- "button",
5030
+ ] }),
5031
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5032
+ "div",
5134
5033
  {
5135
- type: "button",
5136
- className: "yudao-sheet-btn",
5137
- onClick: () => handleDownload("xml"),
5138
- children: "\u5BFC\u51FA\u6807\u51C6\u62A5\u8868 XML"
5034
+ style: {
5035
+ padding: "6px 8px",
5036
+ background: "#FFFFFF",
5037
+ border: "1px solid #E3E5EA",
5038
+ borderRadius: 6,
5039
+ display: "flex",
5040
+ flexDirection: "column",
5041
+ gap: 5
5042
+ },
5043
+ children: [
5044
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11.5, cursor: "pointer" }, children: [
5045
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 5, fontWeight: 600, color: "#1B1C1F" }, children: [
5046
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5047
+ "input",
5048
+ {
5049
+ type: "checkbox",
5050
+ checked: paginationEnabled,
5051
+ onChange: (e) => {
5052
+ const enabled = e.target.checked;
5053
+ setPaginationEnabled(enabled);
5054
+ setPageIndex(1);
5055
+ rebuildPreview(void 0, { enabled, page: 1, pageSize });
5056
+ }
5057
+ }
5058
+ ),
5059
+ "\u5927\u6570\u636E\u5206\u9875\u5207\u7247\u9884\u89C8"
5060
+ ] }),
5061
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5062
+ "select",
5063
+ {
5064
+ style: {
5065
+ fontSize: 10.5,
5066
+ padding: "1px 4px",
5067
+ borderRadius: 4,
5068
+ border: "1px solid #E3E5EA",
5069
+ background: "#FFFFFF",
5070
+ color: "#31363F"
5071
+ },
5072
+ value: pageSize,
5073
+ disabled: !paginationEnabled,
5074
+ onChange: (e) => {
5075
+ const nextSize = Number(e.target.value);
5076
+ setPageSize(nextSize);
5077
+ setPageIndex(1);
5078
+ rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize: nextSize });
5079
+ },
5080
+ children: [
5081
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: 25, children: "25 \u884C/\u9875" }),
5082
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: 50, children: "50 \u884C/\u9875" }),
5083
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: 100, children: "100 \u884C/\u9875" }),
5084
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: 500, children: "500 \u884C/\u9875" })
5085
+ ]
5086
+ }
5087
+ )
5088
+ ] }),
5089
+ paginationEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", fontSize: 11 }, children: [
5090
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5091
+ "button",
5092
+ {
5093
+ type: "button",
5094
+ className: "yudao-sheet-btn",
5095
+ style: { padding: "2px 6px", fontSize: 10.5 },
5096
+ disabled: pageIndex <= 1,
5097
+ onClick: () => {
5098
+ const prev = Math.max(1, pageIndex - 1);
5099
+ setPageIndex(prev);
5100
+ rebuildPreview(void 0, { enabled: true, page: prev, pageSize });
5101
+ },
5102
+ children: "\u4E0A\u4E00\u9875"
5103
+ }
5104
+ ),
5105
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { color: "#4E5565" }, children: [
5106
+ "\u7B2C ",
5107
+ pageIndex,
5108
+ "/",
5109
+ pageSummary.totalPages,
5110
+ " \u9875 \xB7 \u5171 ",
5111
+ pageSummary.totalRows,
5112
+ " \u884C"
5113
+ ] }),
5114
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5115
+ "button",
5116
+ {
5117
+ type: "button",
5118
+ className: "yudao-sheet-btn",
5119
+ style: { padding: "2px 6px", fontSize: 10.5 },
5120
+ disabled: pageIndex >= pageSummary.totalPages,
5121
+ onClick: () => {
5122
+ const next = Math.min(pageSummary.totalPages, pageIndex + 1);
5123
+ setPageIndex(next);
5124
+ rebuildPreview(void 0, { enabled: true, page: next, pageSize });
5125
+ },
5126
+ children: "\u4E0B\u4E00\u9875"
5127
+ }
5128
+ )
5129
+ ] })
5130
+ ]
5139
5131
  }
5140
5132
  ),
5141
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleExportReportPackage, children: "\u5BFC\u51FA\u62A5\u8868\u8FC1\u79FB\u5305 (.json)" })
5142
- ] }),
5143
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleImportReportPackage, children: "\u5BFC\u5165\u62A5\u8868\u8FC1\u79FB\u5305 (.yudao-sheet.json)" }),
5144
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleBrowserPrint, children: t("yudaoSheets.modal.triggerPrintBtn") }),
5145
- Boolean(ioAdapter.onSave) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleSaveToHost, children: "\u4FDD\u5B58\u6A21\u677F\u81F3\u4E1A\u52A1\u540E\u7AEF (onSave)" })
5146
- ] }),
5147
- statusTip && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5148
- "div",
5149
- {
5150
- style: {
5151
- fontSize: 11,
5152
- color: "#31363F",
5153
- background: "#F3F5FF",
5154
- border: "1px solid #D2DAFA",
5155
- padding: "6px 8px",
5156
- borderRadius: 6,
5157
- lineHeight: 1.4
5158
- },
5159
- children: statusTip
5160
- }
5161
- )
5162
- ]
5163
- }
5164
- ),
5165
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
5166
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5167
- "div",
5168
- {
5169
- className: "yudao-sheet-quick-export-bar",
5170
- style: {
5171
- background: "#F9FAFB",
5172
- borderBottom: "1px solid #E3E5EA",
5173
- padding: "6px 16px",
5174
- display: "flex",
5175
- alignItems: "center",
5176
- justifyContent: "space-between",
5177
- gap: 8,
5178
- flexWrap: "wrap"
5179
- },
5180
- children: [
5181
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "inline-flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
5182
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: 11.5, fontWeight: 600, color: "#31363F" }, children: t("yudaoSheets.modal.quickExportLabel") }),
5183
- [
5184
- ["xlsx", t("yudaoSheets.modal.quickExportXlsx")],
5185
- ["pdf", t("yudaoSheets.modal.quickExportPdf")],
5186
- ["docx", t("yudaoSheets.modal.quickExportDocx")],
5187
- ["csv", t("yudaoSheets.modal.quickExportCsv")],
5188
- ["html", t("yudaoSheets.modal.quickExportHtml")]
5189
- ].map(([fmt, label]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5190
- "button",
5191
- {
5192
- type: "button",
5193
- className: `yudao-sheet-btn ${fmt === "xlsx" ? "is-primary" : ""}`,
5194
- style: { height: 24, padding: "0 9px", fontSize: 11 },
5195
- onClick: () => handleDownload(fmt),
5196
- children: label
5197
- },
5198
- fmt
5199
- ))
5200
- ] }),
5201
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5202
- "button",
5203
- {
5204
- type: "button",
5205
- className: "yudao-sheet-btn",
5206
- style: { height: 24, padding: "0 10px", fontSize: 11 },
5207
- onClick: handleBrowserPrint,
5208
- children: t("yudaoSheets.modal.triggerPrintBtn")
5209
- }
5210
- )
5211
- ]
5212
- }
5213
- ),
5214
- queryParamFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5215
- "div",
5216
- {
5217
- className: "yudao-sheet-query-bar",
5218
- style: {
5219
- background: "#FFFFFF",
5220
- borderBottom: "1px solid #E3E5EA",
5221
- padding: "10px 16px",
5222
- display: "flex",
5223
- flexWrap: "wrap",
5224
- alignItems: "center",
5225
- gap: 10
5226
- },
5227
- children: [
5228
- queryParamFields.map((field) => {
5229
- const rawVal = queryValues[field.name];
5230
- const dictOpts = field.options ?? (field.dictCode ? templateService.getTemplateMetadata(workbook.getUnitId()).dicts?.[field.dictCode] : void 0) ?? [];
5231
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5133
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5232
5134
  "div",
5233
5135
  {
5234
5136
  style: {
5235
- display: "inline-flex",
5236
- alignItems: "center",
5237
- gap: 6,
5238
- fontSize: 12,
5239
- color: "#31363F"
5137
+ marginTop: "auto",
5138
+ padding: "8px 10px",
5139
+ background: "#FFFFFF",
5140
+ border: "1px solid #E3E5EA",
5141
+ borderRadius: 8,
5142
+ display: "flex",
5143
+ flexDirection: "column",
5144
+ gap: 6
5240
5145
  },
5241
5146
  children: [
5242
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontWeight: 500, color: "#1B1C1F", whiteSpace: "nowrap" }, children: [
5243
- field.label || field.name,
5244
- field.required ? " *" : "",
5245
- ":"
5147
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5 }, children: [
5148
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontWeight: 600, color: "#1B1C1F" }, children: [
5149
+ "\u5BFC\u5165/\u5BFC\u51FA\u5904\u7406\u65B9\u5F0F\uFF08\u5F53\u524D .",
5150
+ activeIoFormat,
5151
+ "\uFF09"
5152
+ ] }),
5153
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontSize: 10.5, color: "#7D8698" }, children: [
5154
+ "\u5FEB\u7167 ",
5155
+ snapSizeKb,
5156
+ " KB"
5157
+ ] })
5246
5158
  ] }),
5247
- field.widget === "select" || field.widget === "cascader" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5248
- "select",
5159
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-sheet-segmented", style: { gridTemplateColumns: "1fr 1fr" }, children: [
5160
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5161
+ "button",
5162
+ {
5163
+ type: "button",
5164
+ "data-testid": "yudao-io-target-browser",
5165
+ className: `yudao-sheet-segmented-item ${ioTarget === "browser" ? "is-active" : ""}`,
5166
+ onClick: () => {
5167
+ userTouchedTargetRef.current = true;
5168
+ setIoTarget("browser");
5169
+ },
5170
+ children: [
5171
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6D4F\u89C8\u5668\u5904\u7406" }),
5172
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontSize: 10, marginLeft: 3, opacity: 0.85 }, children: [
5173
+ "(",
5174
+ browserAvailabilityLabel,
5175
+ ")"
5176
+ ] })
5177
+ ]
5178
+ }
5179
+ ),
5180
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5181
+ "button",
5182
+ {
5183
+ type: "button",
5184
+ "data-testid": "yudao-io-target-server",
5185
+ className: `yudao-sheet-segmented-item ${ioTarget === "server" ? "is-active" : ""}`,
5186
+ onClick: () => {
5187
+ userTouchedTargetRef.current = true;
5188
+ setIoTarget("server");
5189
+ },
5190
+ 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",
5191
+ children: [
5192
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u670D\u52A1\u7AEF\u5904\u7406" }),
5193
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontSize: 10, marginLeft: 3, opacity: 0.85 }, children: [
5194
+ "(",
5195
+ serverAvailabilityLabel,
5196
+ ")"
5197
+ ] })
5198
+ ]
5199
+ }
5200
+ )
5201
+ ] }),
5202
+ ioTarget === "browser" ? exportCapReport.warnings.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5203
+ "div",
5249
5204
  {
5250
5205
  style: {
5251
- height: 28,
5252
- padding: "0 8px",
5253
- fontSize: 12,
5254
- borderRadius: 6,
5206
+ fontSize: 10.5,
5207
+ color: "#4E5565",
5208
+ background: "#F9FAFB",
5255
5209
  border: "1px solid #E3E5EA",
5256
- background: "#FFFFFF",
5257
- color: "#1B1C1F",
5258
- minWidth: 110
5210
+ padding: "4px 6px",
5211
+ borderRadius: 5,
5212
+ lineHeight: 1.4
5259
5213
  },
5260
- value: rawVal == null ? "" : String(rawVal),
5261
- onChange: (e) => setQueryValues((prev) => ({ ...prev, [field.name]: e.target.value })),
5262
5214
  children: [
5263
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", children: t("yudaoSheets.modal.allOption") }),
5264
- dictOpts.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
5215
+ "\u6D4F\u89C8\u5668\u7AEF\u63D0\u793A\uFF1A",
5216
+ exportCapReport.warnings.join("\uFF1B"),
5217
+ "\uFF08\u9AD8\u4FDD\u771F\u5EFA\u8BAE\u9009\u670D\u52A1\u7AEF\uFF09\u3002"
5265
5218
  ]
5266
5219
  }
5267
- ) : field.widget === "multiSelect" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5268
- "input",
5269
- {
5270
- type: "text",
5271
- placeholder: "\u591A\u503C\u9017\u53F7\u5206\u9694",
5272
- style: {
5273
- height: 28,
5274
- padding: "0 8px",
5275
- fontSize: 12,
5276
- borderRadius: 6,
5277
- border: "1px solid #E3E5EA",
5278
- background: "#FFFFFF",
5279
- color: "#1B1C1F",
5280
- width: 132
5281
- },
5282
- value: Array.isArray(rawVal) ? rawVal.join(",") : rawVal == null ? "" : String(rawVal),
5283
- onChange: (e) => setQueryValues((prev) => ({
5284
- ...prev,
5285
- [field.name]: e.target.value.split(",").map((s) => s.trim()).filter(Boolean)
5286
- }))
5287
- }
5288
- ) : field.widget === "dateRange" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
5220
+ ) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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__ */ (0, import_jsx_runtime4.jsx)("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" }),
5221
+ features.datasetBinding && ioTarget === "browser" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 5, fontSize: 11, color: "#31363F", cursor: "pointer" }, children: [
5289
5222
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5290
5223
  "input",
5291
5224
  {
5292
- type: "date",
5293
- style: {
5294
- height: 28,
5295
- padding: "0 6px",
5296
- fontSize: 11.5,
5297
- borderRadius: 6,
5298
- border: "1px solid #E3E5EA",
5299
- background: "#FFFFFF",
5300
- color: "#1B1C1F"
5301
- },
5302
- value: Array.isArray(rawVal) ? String(rawVal[0] ?? "") : "",
5303
- onChange: (e) => {
5304
- const curArr = Array.isArray(rawVal) ? [...rawVal] : ["", ""];
5305
- curArr[0] = e.target.value;
5306
- setQueryValues((prev) => ({ ...prev, [field.name]: curArr }));
5307
- }
5225
+ type: "checkbox",
5226
+ checked: skipDatasetOnExport,
5227
+ onChange: (e) => setSkipDatasetOnExport(e.target.checked)
5308
5228
  }
5309
5229
  ),
5310
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: "#7D8698" }, children: "-" }),
5311
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5312
- "input",
5230
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u4EC5\u7F16\u7801\u5F53\u524D\u5FEB\u7167\uFF08\u4E0D\u91CD\u590D\u6267\u884C\u6570\u636E\u96C6\u586B\u6570\uFF09" })
5231
+ ] })
5232
+ ]
5233
+ }
5234
+ ),
5235
+ ioError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5236
+ "div",
5237
+ {
5238
+ "data-testid": "yudao-io-error-banner",
5239
+ style: {
5240
+ fontSize: 11,
5241
+ color: "#B42318",
5242
+ background: "#FEF3F2",
5243
+ border: "1px solid #FECDCA",
5244
+ padding: "8px 10px",
5245
+ borderRadius: 6,
5246
+ lineHeight: 1.45,
5247
+ display: "flex",
5248
+ flexDirection: "column",
5249
+ gap: 6
5250
+ },
5251
+ children: [
5252
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: ioError }),
5253
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5254
+ "button",
5255
+ {
5256
+ type: "button",
5257
+ "data-testid": "yudao-io-switch-retry",
5258
+ className: "yudao-sheet-btn",
5259
+ style: { alignSelf: "flex-start", borderColor: "#FDA29B", color: "#B42318" },
5260
+ onClick: handleSwitchTargetAndRetry,
5261
+ 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"
5262
+ }
5263
+ )
5264
+ ]
5265
+ }
5266
+ ),
5267
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5268
+ "div",
5269
+ {
5270
+ style: {
5271
+ padding: "8px 10px",
5272
+ background: "#FFFFFF",
5273
+ border: "1px solid #E3E5EA",
5274
+ borderRadius: 8,
5275
+ display: "flex",
5276
+ flexDirection: "column",
5277
+ gap: 6
5278
+ },
5279
+ children: [
5280
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: 11.5 }, children: [
5281
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontWeight: 600, color: "#1B1C1F" }, children: "\u5DE5\u4F5C\u7C3F\u5BFC\u5165\uFF08\u9884\u68C0\u6682\u5B58\uFF09" }),
5282
+ selectedImportFile && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5283
+ "span",
5313
5284
  {
5314
- type: "date",
5315
5285
  style: {
5316
- height: 28,
5317
- padding: "0 6px",
5318
- fontSize: 11.5,
5319
- borderRadius: 6,
5320
- border: "1px solid #E3E5EA",
5321
- background: "#FFFFFF",
5322
- color: "#1B1C1F"
5286
+ fontSize: 10.5,
5287
+ color: "#4E5565",
5288
+ maxWidth: 155,
5289
+ overflow: "hidden",
5290
+ textOverflow: "ellipsis",
5291
+ whiteSpace: "nowrap"
5323
5292
  },
5324
- value: Array.isArray(rawVal) ? String(rawVal[1] ?? "") : "",
5325
- onChange: (e) => {
5326
- const curArr = Array.isArray(rawVal) ? [...rawVal] : ["", ""];
5327
- curArr[1] = e.target.value;
5328
- setQueryValues((prev) => ({ ...prev, [field.name]: curArr }));
5329
- }
5293
+ title: selectedImportFile.name,
5294
+ children: selectedImportFile.name
5330
5295
  }
5331
5296
  )
5332
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5297
+ ] }),
5298
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5333
5299
  "input",
5334
5300
  {
5335
- type: field.widget === "number" ? "number" : field.widget === "date" ? "date" : "text",
5336
- placeholder: `\u8F93\u5165${field.label || field.name}`,
5301
+ ref: fileInputRef,
5302
+ type: "file",
5303
+ "data-testid": "yudao-io-file-input",
5304
+ accept: ".xlsx,.xls,.xml,.csv,.json",
5305
+ style: { display: "none" },
5306
+ onChange: handleFileInputChange
5307
+ }
5308
+ ),
5309
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5310
+ "button",
5311
+ {
5312
+ type: "button",
5313
+ "data-testid": "yudao-io-pick-file",
5314
+ className: `yudao-sheet-btn ${tab === "import" && !pendingImport ? "is-primary" : ""}`,
5315
+ onClick: () => fileInputRef.current?.click(),
5316
+ children: "\u9009\u62E9\u6587\u4EF6\u5BFC\u5165"
5317
+ }
5318
+ ),
5319
+ pendingImport && stagedSheetSummary && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5320
+ "div",
5321
+ {
5322
+ "data-testid": "yudao-io-staged-result",
5337
5323
  style: {
5338
- height: 28,
5339
- padding: "0 8px",
5340
- fontSize: 12,
5324
+ fontSize: 11,
5325
+ color: "#31363F",
5326
+ background: "#F9FAFB",
5327
+ border: "1px solid #D2DAFA",
5328
+ padding: "8px",
5341
5329
  borderRadius: 6,
5342
- border: "1px solid #E3E5EA",
5343
- background: "#FFFFFF",
5344
- color: "#1B1C1F",
5345
- width: field.widget === "number" ? 96 : 124
5330
+ display: "flex",
5331
+ flexDirection: "column",
5332
+ gap: 5,
5333
+ lineHeight: 1.45
5346
5334
  },
5347
- value: rawVal == null ? "" : String(rawVal),
5348
- onChange: (e) => setQueryValues((prev) => ({
5349
- ...prev,
5350
- [field.name]: field.widget === "number" && e.target.value !== "" ? Number(e.target.value) : e.target.value
5351
- }))
5335
+ children: [
5336
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontWeight: 600, color: "#1B1C1F" }, children: [
5337
+ "\u5F85\u786E\u8BA4\u6587\u4EF6\uFF1A",
5338
+ pendingImport.fileName
5339
+ ] }),
5340
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
5341
+ "\u89E3\u6790\u901A\u9053\uFF1A",
5342
+ pendingImport.executedBy === "server" ? "\u670D\u52A1\u7AEF\u5904\u7406" : "\u6D4F\u89C8\u5668\u5904\u7406"
5343
+ ] }),
5344
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
5345
+ "\u5DE5\u4F5C\u8868\u6982\u89C8\uFF1A\u5171 ",
5346
+ stagedSheetSummary.count,
5347
+ " \u4E2A\u5DE5\u4F5C\u8868\uFF08",
5348
+ stagedSheetSummary.names.join("\u3001") || "-",
5349
+ "\uFF09"
5350
+ ] }),
5351
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "data-testid": "yudao-io-warnings", style: { color: "#4E5565" }, children: pendingImport.warnings.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ul", { style: { margin: "2px 0 0", paddingLeft: 16 }, children: pendingImport.warnings.map((w, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { children: w.message }, `${w.code}-${idx}`)) }) : "\u65E0\u517C\u5BB9\u6027\u8B66\u544A" }),
5352
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6, marginTop: 2 }, children: [
5353
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5354
+ "button",
5355
+ {
5356
+ type: "button",
5357
+ "data-testid": "yudao-io-confirm-import",
5358
+ className: "yudao-sheet-btn is-primary",
5359
+ onClick: handleConfirmStagedImport,
5360
+ children: "\u786E\u8BA4\u5E94\u7528\u5230\u8BBE\u8BA1\u5668"
5361
+ }
5362
+ ),
5363
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5364
+ "button",
5365
+ {
5366
+ type: "button",
5367
+ "data-testid": "yudao-io-cancel-import",
5368
+ className: "yudao-sheet-btn",
5369
+ onClick: handleCancelStagedImport,
5370
+ children: "\u53D6\u6D88\u672C\u6B21\u5BFC\u5165"
5371
+ }
5372
+ )
5373
+ ] })
5374
+ ]
5352
5375
  }
5353
5376
  )
5354
5377
  ]
5355
- },
5356
- field.name
5357
- );
5358
- }),
5359
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "inline-flex", alignItems: "center", gap: 6, marginLeft: "auto" }, children: [
5360
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5361
- "button",
5362
- {
5363
- type: "button",
5364
- className: "yudao-sheet-btn is-primary",
5365
- style: { height: 28, padding: "0 12px", fontSize: 12 },
5366
- onClick: () => {
5367
- setPageIndex(1);
5368
- rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize }, queryValues);
5369
- setStatusTip("\u5DF2\u6309\u67E5\u8BE2\u6761\u4EF6\u8FC7\u6EE4\u6570\u636E\u96C6\u5E76\u5237\u65B0\u9884\u89C8");
5370
- },
5371
- children: t("yudaoSheets.modal.queryBtn")
5372
5378
  }
5373
5379
  ),
5374
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5375
- "button",
5380
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
5381
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "112px 1fr", gap: 6 }, children: [
5382
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5383
+ "select",
5384
+ {
5385
+ "data-testid": "yudao-io-export-format",
5386
+ style: {
5387
+ height: 30,
5388
+ padding: "0 6px",
5389
+ fontSize: 11.5,
5390
+ borderRadius: 6,
5391
+ border: "1px solid #E3E5EA",
5392
+ background: "#FFFFFF",
5393
+ color: "#1B1C1F"
5394
+ },
5395
+ value: exportFormat,
5396
+ onChange: (e) => setExportFormat(e.target.value),
5397
+ children: [
5398
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "xlsx", children: "Excel (.xlsx)" }),
5399
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "xls", children: "\u517C\u5BB9 (.xls)" }),
5400
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "pdf", children: "\u77E2\u91CF (.pdf)" }),
5401
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "docx", children: "Word (.docx)" }),
5402
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "csv", children: "\u8868\u683C (.csv)" }),
5403
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "xml", children: "\u62A5\u8868 (.xml)" }),
5404
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "html", children: "\u7F51\u9875 (.html)" }),
5405
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "json", children: "\u5FEB\u7167 (.json)" })
5406
+ ]
5407
+ }
5408
+ ),
5409
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5410
+ "button",
5411
+ {
5412
+ type: "button",
5413
+ "data-testid": "yudao-io-export-download",
5414
+ className: `yudao-sheet-btn ${tab !== "import" ? "is-primary" : ""}`,
5415
+ onClick: () => handleDownload(exportFormat),
5416
+ children: [
5417
+ "\u5BFC\u51FA\u4E0B\u8F7D (.",
5418
+ exportFormat === "xml" ? "report.xml" : exportFormat,
5419
+ ")"
5420
+ ]
5421
+ }
5422
+ )
5423
+ ] }),
5424
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
5425
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleExportReportPackage, children: "\u5BFC\u51FA\u62A5\u8868\u8FC1\u79FB\u5305 (.json)" }),
5426
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleImportReportPackage, children: "\u5BFC\u5165\u62A5\u8868\u8FC1\u79FB\u5305 (.json)" })
5427
+ ] }),
5428
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleBrowserPrint, children: t("yudaoSheets.modal.triggerPrintBtn") }),
5429
+ Boolean(ioAdapter.onSave) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "yudao-sheet-btn", onClick: handleSaveToHost, children: "\u4FDD\u5B58\u6A21\u677F\u81F3\u4E1A\u52A1\u540E\u7AEF (onSave)" })
5430
+ ] }),
5431
+ statusTip && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5432
+ "div",
5376
5433
  {
5377
- type: "button",
5378
- className: "yudao-sheet-btn",
5379
- style: { height: 28, padding: "0 12px", fontSize: 12 },
5380
- onClick: () => {
5381
- const resetVals = buildInitialQueryValues(queryParamFields);
5382
- setQueryValues(resetVals);
5383
- setPageIndex(1);
5384
- rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize }, resetVals);
5385
- setStatusTip("\u5DF2\u91CD\u7F6E\u67E5\u8BE2\u6761\u4EF6");
5434
+ style: {
5435
+ fontSize: 11,
5436
+ color: "#31363F",
5437
+ background: "#F3F5FF",
5438
+ border: "1px solid #D2DAFA",
5439
+ padding: "6px 8px",
5440
+ borderRadius: 6,
5441
+ lineHeight: 1.4
5386
5442
  },
5387
- children: t("yudaoSheets.modal.resetBtn")
5443
+ children: statusTip
5388
5444
  }
5389
5445
  )
5390
- ] })
5391
- ]
5392
- }
5393
- ),
5394
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { flex: 1, background: "#EEEFF1", padding: 16, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5395
- "iframe",
5396
- {
5397
- ref: printIframeRef,
5398
- title: "Sheet Print & Expansion Preview",
5399
- srcDoc: previewHtml,
5400
- style: {
5401
- width: "100%",
5402
- height: "100%",
5403
- border: "1px solid #E3E5EA",
5404
- borderRadius: 8,
5405
- background: "#FFFFFF",
5406
- boxShadow: "0 4px 16px rgba(27, 28, 31, 0.08)"
5446
+ ]
5407
5447
  }
5408
- }
5409
- ) })
5448
+ ),
5449
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, display: "flex", flexDirection: "column", minWidth: 0, overflow: "hidden" }, children: [
5450
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5451
+ "div",
5452
+ {
5453
+ className: "yudao-sheet-quick-export-bar",
5454
+ style: {
5455
+ background: "#F9FAFB",
5456
+ borderBottom: "1px solid #E3E5EA",
5457
+ padding: "6px 16px",
5458
+ display: "flex",
5459
+ alignItems: "center",
5460
+ justifyContent: "space-between",
5461
+ gap: 8,
5462
+ flexWrap: "wrap"
5463
+ },
5464
+ children: [
5465
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "inline-flex", alignItems: "center", gap: 6, flexWrap: "wrap" }, children: [
5466
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { fontSize: 11.5, fontWeight: 600, color: "#31363F" }, children: t("yudaoSheets.modal.quickExportLabel") }),
5467
+ [
5468
+ ["xlsx", t("yudaoSheets.modal.quickExportXlsx")],
5469
+ ["pdf", t("yudaoSheets.modal.quickExportPdf")],
5470
+ ["docx", t("yudaoSheets.modal.quickExportDocx")],
5471
+ ["csv", t("yudaoSheets.modal.quickExportCsv")],
5472
+ ["html", t("yudaoSheets.modal.quickExportHtml")]
5473
+ ].map(([fmt, label]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5474
+ "button",
5475
+ {
5476
+ type: "button",
5477
+ className: `yudao-sheet-btn ${fmt === "xlsx" ? "is-primary" : ""}`,
5478
+ style: { height: 24, padding: "0 9px", fontSize: 11 },
5479
+ onClick: () => handleDownload(fmt),
5480
+ children: label
5481
+ },
5482
+ fmt
5483
+ ))
5484
+ ] }),
5485
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5486
+ "button",
5487
+ {
5488
+ type: "button",
5489
+ className: "yudao-sheet-btn",
5490
+ style: { height: 24, padding: "0 10px", fontSize: 11 },
5491
+ onClick: handleBrowserPrint,
5492
+ children: t("yudaoSheets.modal.triggerPrintBtn")
5493
+ }
5494
+ )
5495
+ ]
5496
+ }
5497
+ ),
5498
+ queryParamFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5499
+ "div",
5500
+ {
5501
+ className: "yudao-sheet-query-bar",
5502
+ style: {
5503
+ background: "#FFFFFF",
5504
+ borderBottom: "1px solid #E3E5EA",
5505
+ padding: "10px 16px",
5506
+ display: "flex",
5507
+ flexWrap: "wrap",
5508
+ alignItems: "center",
5509
+ gap: 10
5510
+ },
5511
+ children: [
5512
+ queryParamFields.map((field) => {
5513
+ const rawVal = queryValues[field.name];
5514
+ const dictOpts = field.options ?? (field.dictCode ? templateService.getTemplateMetadata(workbook.getUnitId()).dicts?.[field.dictCode] : void 0) ?? [];
5515
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5516
+ "div",
5517
+ {
5518
+ style: {
5519
+ display: "inline-flex",
5520
+ alignItems: "center",
5521
+ gap: 6,
5522
+ fontSize: 12,
5523
+ color: "#31363F"
5524
+ },
5525
+ children: [
5526
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { fontWeight: 500, color: "#1B1C1F", whiteSpace: "nowrap" }, children: [
5527
+ field.label || field.name,
5528
+ field.required ? " *" : "",
5529
+ ":"
5530
+ ] }),
5531
+ field.widget === "select" || field.widget === "cascader" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5532
+ "select",
5533
+ {
5534
+ style: {
5535
+ height: 28,
5536
+ padding: "0 8px",
5537
+ fontSize: 12,
5538
+ borderRadius: 6,
5539
+ border: "1px solid #E3E5EA",
5540
+ background: "#FFFFFF",
5541
+ color: "#1B1C1F",
5542
+ minWidth: 110
5543
+ },
5544
+ value: rawVal == null ? "" : String(rawVal),
5545
+ onChange: (e) => setQueryValues((prev) => ({ ...prev, [field.name]: e.target.value })),
5546
+ children: [
5547
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", children: t("yudaoSheets.modal.allOption") }),
5548
+ dictOpts.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
5549
+ ]
5550
+ }
5551
+ ) : field.widget === "multiSelect" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5552
+ "input",
5553
+ {
5554
+ type: "text",
5555
+ placeholder: "\u591A\u503C\u9017\u53F7\u5206\u9694",
5556
+ style: {
5557
+ height: 28,
5558
+ padding: "0 8px",
5559
+ fontSize: 12,
5560
+ borderRadius: 6,
5561
+ border: "1px solid #E3E5EA",
5562
+ background: "#FFFFFF",
5563
+ color: "#1B1C1F",
5564
+ width: 132
5565
+ },
5566
+ value: Array.isArray(rawVal) ? rawVal.join(",") : rawVal == null ? "" : String(rawVal),
5567
+ onChange: (e) => setQueryValues((prev) => ({
5568
+ ...prev,
5569
+ [field.name]: e.target.value.split(",").map((s) => s.trim()).filter(Boolean)
5570
+ }))
5571
+ }
5572
+ ) : field.widget === "dateRange" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
5573
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5574
+ "input",
5575
+ {
5576
+ type: "date",
5577
+ style: {
5578
+ height: 28,
5579
+ padding: "0 6px",
5580
+ fontSize: 11.5,
5581
+ borderRadius: 6,
5582
+ border: "1px solid #E3E5EA",
5583
+ background: "#FFFFFF",
5584
+ color: "#1B1C1F"
5585
+ },
5586
+ value: Array.isArray(rawVal) ? String(rawVal[0] ?? "") : "",
5587
+ onChange: (e) => {
5588
+ const curArr = Array.isArray(rawVal) ? [...rawVal] : ["", ""];
5589
+ curArr[0] = e.target.value;
5590
+ setQueryValues((prev) => ({ ...prev, [field.name]: curArr }));
5591
+ }
5592
+ }
5593
+ ),
5594
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: "#7D8698" }, children: "-" }),
5595
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5596
+ "input",
5597
+ {
5598
+ type: "date",
5599
+ style: {
5600
+ height: 28,
5601
+ padding: "0 6px",
5602
+ fontSize: 11.5,
5603
+ borderRadius: 6,
5604
+ border: "1px solid #E3E5EA",
5605
+ background: "#FFFFFF",
5606
+ color: "#1B1C1F"
5607
+ },
5608
+ value: Array.isArray(rawVal) ? String(rawVal[1] ?? "") : "",
5609
+ onChange: (e) => {
5610
+ const curArr = Array.isArray(rawVal) ? [...rawVal] : ["", ""];
5611
+ curArr[1] = e.target.value;
5612
+ setQueryValues((prev) => ({ ...prev, [field.name]: curArr }));
5613
+ }
5614
+ }
5615
+ )
5616
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5617
+ "input",
5618
+ {
5619
+ type: field.widget === "number" ? "number" : field.widget === "date" ? "date" : "text",
5620
+ placeholder: `\u8F93\u5165${field.label || field.name}`,
5621
+ style: {
5622
+ height: 28,
5623
+ padding: "0 8px",
5624
+ fontSize: 12,
5625
+ borderRadius: 6,
5626
+ border: "1px solid #E3E5EA",
5627
+ background: "#FFFFFF",
5628
+ color: "#1B1C1F",
5629
+ width: field.widget === "number" ? 96 : 124
5630
+ },
5631
+ value: rawVal == null ? "" : String(rawVal),
5632
+ onChange: (e) => setQueryValues((prev) => ({
5633
+ ...prev,
5634
+ [field.name]: field.widget === "number" && e.target.value !== "" ? Number(e.target.value) : e.target.value
5635
+ }))
5636
+ }
5637
+ )
5638
+ ]
5639
+ },
5640
+ field.name
5641
+ );
5642
+ }),
5643
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "inline-flex", alignItems: "center", gap: 6, marginLeft: "auto" }, children: [
5644
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5645
+ "button",
5646
+ {
5647
+ type: "button",
5648
+ className: "yudao-sheet-btn is-primary",
5649
+ style: { height: 28, padding: "0 12px", fontSize: 12 },
5650
+ onClick: () => {
5651
+ setPageIndex(1);
5652
+ rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize }, queryValues);
5653
+ setStatusTip("\u5DF2\u6309\u67E5\u8BE2\u6761\u4EF6\u8FC7\u6EE4\u6570\u636E\u96C6\u5E76\u5237\u65B0\u9884\u89C8");
5654
+ },
5655
+ children: t("yudaoSheets.modal.queryBtn")
5656
+ }
5657
+ ),
5658
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5659
+ "button",
5660
+ {
5661
+ type: "button",
5662
+ className: "yudao-sheet-btn",
5663
+ style: { height: 28, padding: "0 12px", fontSize: 12 },
5664
+ onClick: () => {
5665
+ const resetVals = buildInitialQueryValues(queryParamFields);
5666
+ setQueryValues(resetVals);
5667
+ setPageIndex(1);
5668
+ rebuildPreview(void 0, { enabled: paginationEnabled, page: 1, pageSize }, resetVals);
5669
+ setStatusTip("\u5DF2\u91CD\u7F6E\u67E5\u8BE2\u6761\u4EF6");
5670
+ },
5671
+ children: t("yudaoSheets.modal.resetBtn")
5672
+ }
5673
+ )
5674
+ ] })
5675
+ ]
5676
+ }
5677
+ ),
5678
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { flex: 1, background: "#EEEFF1", padding: 16, overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5679
+ "iframe",
5680
+ {
5681
+ ref: printIframeRef,
5682
+ title: "Sheet Print & Expansion Preview",
5683
+ srcDoc: previewHtml,
5684
+ style: {
5685
+ width: "100%",
5686
+ height: "100%",
5687
+ border: "1px solid #E3E5EA",
5688
+ borderRadius: 8,
5689
+ background: "#FFFFFF",
5690
+ boxShadow: "0 4px 16px rgba(27, 28, 31, 0.08)"
5691
+ }
5692
+ }
5693
+ ) })
5694
+ ] })
5695
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, padding: 16, display: "flex", flexDirection: "column", gap: 8 }, children: [
5696
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: 12, color: "#4E5565" }, children: [
5697
+ "\u5F53\u524D\u5DE5\u4F5C\u7C3F\u9075\u5FAA\u6807\u51C6 Univer ",
5698
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: "IWorkbookData" }),
5699
+ " JSON \u89C4\u8303\uFF08\u6269\u5C55\u5C5E\u6027\u5B58\u50A8\u5728",
5700
+ " ",
5701
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: "cell.custom.yudaoMeta" }),
5702
+ "\uFF0C\u65E0\u79C1\u6709\u5916\u90E8\u4F9D\u8D56\uFF09\uFF1A"
5703
+ ] }),
5704
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("textarea", { className: "yudao-sheet-code-area", readOnly: true, value: jsonText })
5705
+ ] })
5410
5706
  ] })
5411
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { flex: 1, padding: 16, display: "flex", flexDirection: "column", gap: 8 }, children: [
5412
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { fontSize: 12, color: "#4E5565" }, children: [
5413
- "\u5F53\u524D\u5DE5\u4F5C\u7C3F\u9075\u5FAA\u6807\u51C6 Univer ",
5414
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: "IWorkbookData" }),
5415
- " JSON \u89C4\u8303\uFF08\u6269\u5C55\u5C5E\u6027\u5B58\u50A8\u5728",
5416
- " ",
5417
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("code", { children: "cell.custom.yudaoMeta" }),
5418
- "\uFF0C\u65E0\u79C1\u6709\u5916\u90E8\u4F9D\u8D56\uFF09\uFF1A"
5419
- ] }),
5420
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("textarea", { className: "yudao-sheet-code-area", readOnly: true, value: jsonText })
5421
- ] })
5422
- ] }) });
5707
+ }
5708
+ );
5423
5709
  };
5424
5710
 
5425
5711
  // src/views/overlay/SheetRichOverlayHost.tsx
5426
5712
  var import_core7 = require("@univerjs/core");
5427
5713
  var import_engine_render = require("@univerjs/engine-render");
5428
5714
  var import_sheets3 = require("@univerjs/sheets");
5429
- var import_sheets_ui3 = require("@univerjs/sheets-ui");
5715
+ var import_sheets_ui4 = require("@univerjs/sheets-ui");
5430
5716
  var import_ui6 = require("@univerjs/ui");
5431
5717
  var import_univer_sheets5 = require("@yudaocode/univer-sheets");
5432
5718
  var import_react5 = require("react");
@@ -6819,14 +7105,27 @@ var SheetRichOverlayHost = () => {
6819
7105
  });
6820
7106
  const unitId2 = workbook.getUnitId();
6821
7107
  const renderUnit = renderManagerService.getRenderUnitById(unitId2);
6822
- let scrollSub;
6823
- let skelSub;
6824
- try {
6825
- const scrollMgr = renderUnit?.with(import_sheets_ui3.SheetScrollManagerService);
6826
- scrollSub = scrollMgr?.validViewportScrollInfo$.subscribe(() => setTick((v) => v + 1));
6827
- const skelMgr = renderUnit?.with(import_sheets_ui3.SheetSkeletonManagerService);
6828
- skelSub = skelMgr?.currentSkeleton$.subscribe(() => setTick((v) => v + 1));
6829
- } catch {
7108
+ const renderSubs = [];
7109
+ const bump = () => setTick((v) => v + 1);
7110
+ const watchRenderUnit = (unit) => {
7111
+ if (!unit) return;
7112
+ try {
7113
+ renderSubs.push(unit.with(import_sheets_ui4.SheetScrollManagerService).validViewportScrollInfo$.subscribe(bump));
7114
+ renderSubs.push(unit.with(import_sheets_ui4.SheetSkeletonManagerService).currentSkeleton$.subscribe(bump));
7115
+ } catch {
7116
+ }
7117
+ renderSubs.push(unit.engine.onTransformChange$.subscribeEvent(bump));
7118
+ bump();
7119
+ };
7120
+ if (renderUnit) {
7121
+ watchRenderUnit(renderUnit);
7122
+ } else {
7123
+ const createdSub = renderManagerService.created$.subscribe((unit) => {
7124
+ if (unit.unitId !== unitId2) return;
7125
+ createdSub.unsubscribe();
7126
+ watchRenderUnit(renderManagerService.getRenderUnitById(unitId2));
7127
+ });
7128
+ renderSubs.push(createdSub);
6830
7129
  }
6831
7130
  const onResize = () => setTick((v) => v + 1);
6832
7131
  window.addEventListener("resize", onResize);
@@ -6846,7 +7145,7 @@ var SheetRichOverlayHost = () => {
6846
7145
  if (!expr || !canvasEl || !renderUnit?.scene) return;
6847
7146
  e.preventDefault();
6848
7147
  try {
6849
- const skel = renderUnit.with(import_sheets_ui3.SheetSkeletonManagerService).getCurrentSkeleton();
7148
+ const skel = renderUnit.with(import_sheets_ui4.SheetSkeletonManagerService).getCurrentSkeleton();
6850
7149
  const activeSheet = workbook.getActiveSheet();
6851
7150
  if (!skel || !activeSheet) return;
6852
7151
  const rect = canvasEl.getBoundingClientRect();
@@ -6912,8 +7211,7 @@ var SheetRichOverlayHost = () => {
6912
7211
  canvasEl?.addEventListener("drop", onDrop);
6913
7212
  return () => {
6914
7213
  disp.dispose();
6915
- scrollSub?.unsubscribe();
6916
- skelSub?.unsubscribe();
7214
+ renderSubs.forEach((sub) => sub.unsubscribe());
6917
7215
  window.removeEventListener("resize", onResize);
6918
7216
  canvasEl?.removeEventListener("dragover", onDragOver);
6919
7217
  canvasEl?.removeEventListener("drop", onDrop);
@@ -6934,7 +7232,7 @@ var SheetRichOverlayHost = () => {
6934
7232
  let scrollX = 0;
6935
7233
  let scrollY = 0;
6936
7234
  try {
6937
- const skelMgr = renderUnit.with(import_sheets_ui3.SheetSkeletonManagerService);
7235
+ const skelMgr = renderUnit.with(import_sheets_ui4.SheetSkeletonManagerService);
6938
7236
  skeleton = skelMgr.getCurrentSkeleton();
6939
7237
  } catch {
6940
7238
  return null;
@@ -7847,7 +8145,7 @@ SheetsExtUIController = __decorateClass([
7847
8145
  // src/plugin.ts
7848
8146
  var import_core9 = require("@univerjs/core");
7849
8147
  var import_sheets4 = require("@univerjs/sheets");
7850
- var import_sheets_ui6 = require("@univerjs/sheets-ui");
8148
+ var import_sheets_ui7 = require("@univerjs/sheets-ui");
7851
8149
  var import_univer_sheets7 = require("@yudaocode/univer-sheets");
7852
8150
  var UNIVER_SHEETS_EXT_UI_PLUGIN_NAME = "YUDAO_UNIVER_SHEETS_EXT_UI_PLUGIN";
7853
8151
  var UniverSheetsExtUIPlugin = class extends import_core9.Plugin {
@@ -7886,7 +8184,7 @@ UniverSheetsExtUIPlugin.pluginName = UNIVER_SHEETS_EXT_UI_PLUGIN_NAME;
7886
8184
  UniverSheetsExtUIPlugin.packageName = "@yudaocode/univer-sheets-ui";
7887
8185
  UniverSheetsExtUIPlugin.type = import_core9.UniverInstanceType.UNIVER_SHEET;
7888
8186
  UniverSheetsExtUIPlugin = __decorateClass([
7889
- (0, import_core9.DependentOn)(import_sheets4.UniverSheetsPlugin, import_sheets_ui6.UniverSheetsUIPlugin, import_univer_sheets7.UniverSheetsExtPlugin),
8187
+ (0, import_core9.DependentOn)(import_sheets4.UniverSheetsPlugin, import_sheets_ui7.UniverSheetsUIPlugin, import_univer_sheets7.UniverSheetsExtPlugin),
7890
8188
  __decorateParam(1, (0, import_core9.Inject)(import_core9.Injector))
7891
8189
  ], UniverSheetsExtUIPlugin);
7892
8190
  // Annotate the CommonJS export names for ESM import in node: