@yudaocode/univer-sheets-ui 1.6.218 → 1.6.219
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/cjs/index.js +816 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/es/index.js +829 -1
- package/lib/es/index.js.map +1 -1
- package/package.json +3 -3
package/lib/cjs/index.js
CHANGED
|
@@ -654,9 +654,24 @@ var SheetInspectorPanel = () => {
|
|
|
654
654
|
const templateService = (0, import_ui3.useDependency)(import_univer_sheets2.ISheetTemplateService);
|
|
655
655
|
const ioService = (0, import_ui3.useDependency)(import_univer_sheets2.ISheetIoService);
|
|
656
656
|
const featureService = (0, import_ui3.useDependency)(ISheetsUIFeatureService);
|
|
657
|
+
const injector = (0, import_ui3.useInjector)();
|
|
658
|
+
const macroService = (() => {
|
|
659
|
+
try {
|
|
660
|
+
return injector.get(import_univer_sheets2.ISheetMacroService);
|
|
661
|
+
} catch {
|
|
662
|
+
return void 0;
|
|
663
|
+
}
|
|
664
|
+
})();
|
|
657
665
|
const features = (0, import_ui3.useObservable)(featureService.features$, featureService.getFeatures());
|
|
658
666
|
const metaVersion = (0, import_ui3.useObservable)(templateService.metadataChange$, "");
|
|
659
667
|
const protWarn = (0, import_ui3.useObservable)(templateService.protectionWarning$, null);
|
|
668
|
+
const defaultMacroRecState = {
|
|
669
|
+
recording: false,
|
|
670
|
+
stepCount: 0,
|
|
671
|
+
steps: []
|
|
672
|
+
};
|
|
673
|
+
const macroRecState = (0, import_ui3.useObservable)(macroService?.recordingState$, defaultMacroRecState);
|
|
674
|
+
const macroListVer = (0, import_ui3.useObservable)(macroService?.macrosChange$, "");
|
|
660
675
|
const workbook = (0, import_ui3.useObservable)(
|
|
661
676
|
() => instanceService.getCurrentTypeOfUnit$(import_core4.UniverInstanceType.UNIVER_SHEET),
|
|
662
677
|
instanceService.getCurrentUnitOfType(import_core4.UniverInstanceType.UNIVER_SHEET),
|
|
@@ -725,6 +740,21 @@ var SheetInspectorPanel = () => {
|
|
|
725
740
|
const [evalSteps, setEvalSteps] = (0, import_react2.useState)([]);
|
|
726
741
|
const [evalStepIdx, setEvalStepIdx] = (0, import_react2.useState)(0);
|
|
727
742
|
const [evalCellKey, setEvalCellKey] = (0, import_react2.useState)("");
|
|
743
|
+
const [scenarioNameInput, setScenarioNameInput] = (0, import_react2.useState)("\u4E50\u89C2\u589E\u957F\u65B9\u6848");
|
|
744
|
+
const [scenarioCellsInput, setScenarioCellsInput] = (0, import_react2.useState)("B2=120, B3=0.18");
|
|
745
|
+
const [scenarioResultsInput, setScenarioResultsInput] = (0, import_react2.useState)("F10");
|
|
746
|
+
const [scenarioCommentInput, setScenarioCommentInput] = (0, import_react2.useState)("");
|
|
747
|
+
const [whatIfMode, setWhatIfMode] = (0, import_react2.useState)("1var");
|
|
748
|
+
const [dtInputCell, setDtInputCell] = (0, import_react2.useState)("B2");
|
|
749
|
+
const [dtInputValues, setDtInputValues] = (0, import_react2.useState)("80, 100, 120");
|
|
750
|
+
const [dtFormulaCells, setDtFormulaCells] = (0, import_react2.useState)("F10");
|
|
751
|
+
const [dtColInputCell, setDtColInputCell] = (0, import_react2.useState)("B3");
|
|
752
|
+
const [dtColValues, setDtColValues] = (0, import_react2.useState)("10, 20, 30");
|
|
753
|
+
const [dtOutputTopLeft, setDtOutputTopLeft] = (0, import_react2.useState)("H2");
|
|
754
|
+
const [whatIfStatusMsg, setWhatIfStatusMsg] = (0, import_react2.useState)("");
|
|
755
|
+
const [macroNameInput, setMacroNameInput] = (0, import_react2.useState)("");
|
|
756
|
+
const [macroStatusMsg, setMacroStatusMsg] = (0, import_react2.useState)("");
|
|
757
|
+
const [previewMacro, setPreviewMacro] = (0, import_react2.useState)(null);
|
|
728
758
|
(0, import_react2.useEffect)(() => {
|
|
729
759
|
const sub = selectionService.selectionChanged$.subscribe(() => setSelTick((v) => v + 1));
|
|
730
760
|
const disp = commandService.onCommandExecuted((info) => {
|
|
@@ -740,6 +770,7 @@ var SheetInspectorPanel = () => {
|
|
|
740
770
|
if (!workbook) return null;
|
|
741
771
|
void selTick;
|
|
742
772
|
void metaVersion;
|
|
773
|
+
void macroListVer;
|
|
743
774
|
const unitId = workbook.getUnitId();
|
|
744
775
|
const sheet = workbook.getActiveSheet();
|
|
745
776
|
if (!sheet) return null;
|
|
@@ -4349,6 +4380,527 @@ var SheetInspectorPanel = () => {
|
|
|
4349
4380
|
},
|
|
4350
4381
|
children: auditOutput
|
|
4351
4382
|
}
|
|
4383
|
+
),
|
|
4384
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("hr", { style: { border: "none", borderTop: "1px solid #E3E5EA", margin: "4px 0" } }),
|
|
4385
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4386
|
+
"div",
|
|
4387
|
+
{
|
|
4388
|
+
"data-testid": "yudao-whatif-scenarios-card",
|
|
4389
|
+
style: {
|
|
4390
|
+
display: "flex",
|
|
4391
|
+
flexDirection: "column",
|
|
4392
|
+
gap: 6,
|
|
4393
|
+
padding: "7px 8px",
|
|
4394
|
+
borderRadius: 6,
|
|
4395
|
+
background: "#F8FAFC",
|
|
4396
|
+
border: "1px solid #E2E8F0"
|
|
4397
|
+
},
|
|
4398
|
+
children: [
|
|
4399
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4400
|
+
"div",
|
|
4401
|
+
{
|
|
4402
|
+
style: {
|
|
4403
|
+
display: "flex",
|
|
4404
|
+
alignItems: "center",
|
|
4405
|
+
justifyContent: "space-between",
|
|
4406
|
+
gap: 6
|
|
4407
|
+
},
|
|
4408
|
+
children: [
|
|
4409
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4410
|
+
"span",
|
|
4411
|
+
{
|
|
4412
|
+
style: {
|
|
4413
|
+
display: "inline-flex",
|
|
4414
|
+
alignItems: "center",
|
|
4415
|
+
gap: 5,
|
|
4416
|
+
fontSize: 11.5,
|
|
4417
|
+
fontWeight: 600,
|
|
4418
|
+
color: "#1B1C1F"
|
|
4419
|
+
},
|
|
4420
|
+
children: [
|
|
4421
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4422
|
+
"svg",
|
|
4423
|
+
{
|
|
4424
|
+
width: "13",
|
|
4425
|
+
height: "13",
|
|
4426
|
+
viewBox: "0 0 16 16",
|
|
4427
|
+
fill: "none",
|
|
4428
|
+
"aria-hidden": "true",
|
|
4429
|
+
children: [
|
|
4430
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4431
|
+
"rect",
|
|
4432
|
+
{
|
|
4433
|
+
x: "1.5",
|
|
4434
|
+
y: "2.5",
|
|
4435
|
+
width: "13",
|
|
4436
|
+
height: "11",
|
|
4437
|
+
rx: "2",
|
|
4438
|
+
stroke: "#2C53F1",
|
|
4439
|
+
strokeWidth: "1.3"
|
|
4440
|
+
}
|
|
4441
|
+
),
|
|
4442
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M1.5 6H14.5M6 6V13.5", stroke: "#2C53F1", strokeWidth: "1.2" })
|
|
4443
|
+
]
|
|
4444
|
+
}
|
|
4445
|
+
),
|
|
4446
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u6A21\u62DF\u5206\u6790\u4E0E\u65B9\u6848\u7BA1\u7406\u5668" })
|
|
4447
|
+
]
|
|
4448
|
+
}
|
|
4449
|
+
),
|
|
4450
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { fontSize: 10, color: "#64748B" }, children: [
|
|
4451
|
+
(0, import_univer_sheets2.getWorkbookScenarios)(workbook).length,
|
|
4452
|
+
" \u4E2A\u65B9\u6848"
|
|
4453
|
+
] })
|
|
4454
|
+
]
|
|
4455
|
+
}
|
|
4456
|
+
),
|
|
4457
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
|
|
4458
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u65B9\u6848\u540D\u79F0" }),
|
|
4460
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4461
|
+
"input",
|
|
4462
|
+
{
|
|
4463
|
+
"data-testid": "yudao-scenario-name-input",
|
|
4464
|
+
type: "text",
|
|
4465
|
+
placeholder: "\u5982\uFF1A\u4E50\u89C2\u589E\u957F\u65B9\u6848",
|
|
4466
|
+
value: scenarioNameInput,
|
|
4467
|
+
onChange: (e) => setScenarioNameInput(e.target.value)
|
|
4468
|
+
}
|
|
4469
|
+
)
|
|
4470
|
+
] }),
|
|
4471
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u7ED3\u679C\u76EE\u6807\u683C (\u9017\u53F7\u5206\u9694)" }),
|
|
4473
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4474
|
+
"input",
|
|
4475
|
+
{
|
|
4476
|
+
"data-testid": "yudao-scenario-results-input",
|
|
4477
|
+
type: "text",
|
|
4478
|
+
placeholder: "\u5982 F10, G10",
|
|
4479
|
+
value: scenarioResultsInput,
|
|
4480
|
+
onChange: (e) => setScenarioResultsInput(e.target.value)
|
|
4481
|
+
}
|
|
4482
|
+
)
|
|
4483
|
+
] })
|
|
4484
|
+
] }),
|
|
4485
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4486
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u53EF\u53D8\u5355\u5143\u683C\u8D4B\u503C (\u683C\u5F0F: B2=120, B3=0.18)" }),
|
|
4487
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4488
|
+
"input",
|
|
4489
|
+
{
|
|
4490
|
+
"data-testid": "yudao-scenario-cells-input",
|
|
4491
|
+
type: "text",
|
|
4492
|
+
placeholder: "\u5982 B2=120, B3=0.18",
|
|
4493
|
+
value: scenarioCellsInput,
|
|
4494
|
+
onChange: (e) => setScenarioCellsInput(e.target.value)
|
|
4495
|
+
}
|
|
4496
|
+
)
|
|
4497
|
+
] }),
|
|
4498
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4499
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u65B9\u6848\u5907\u6CE8 (\u53EF\u9009)" }),
|
|
4500
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4501
|
+
"input",
|
|
4502
|
+
{
|
|
4503
|
+
"data-testid": "yudao-scenario-comment-input",
|
|
4504
|
+
type: "text",
|
|
4505
|
+
placeholder: "\u8BB0\u5F55\u5047\u8BBE\u524D\u63D0\u6761\u4EF6",
|
|
4506
|
+
value: scenarioCommentInput,
|
|
4507
|
+
onChange: (e) => setScenarioCommentInput(e.target.value)
|
|
4508
|
+
}
|
|
4509
|
+
)
|
|
4510
|
+
] }),
|
|
4511
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1.2fr", gap: 4 }, children: [
|
|
4512
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4513
|
+
"button",
|
|
4514
|
+
{
|
|
4515
|
+
"data-testid": "yudao-scenario-save-btn",
|
|
4516
|
+
type: "button",
|
|
4517
|
+
className: "yudao-sheet-btn is-soft-primary",
|
|
4518
|
+
onClick: () => {
|
|
4519
|
+
const changingCells = scenarioCellsInput.split(/[,;\n]+/).map((seg) => seg.trim()).filter(Boolean).map((pair) => {
|
|
4520
|
+
const eqIdx = pair.indexOf("=");
|
|
4521
|
+
if (eqIdx <= 0) return null;
|
|
4522
|
+
const cellA1 = pair.slice(0, eqIdx).trim();
|
|
4523
|
+
const rawVal = pair.slice(eqIdx + 1).trim();
|
|
4524
|
+
if (!cellA1) return null;
|
|
4525
|
+
if (/^true$/i.test(rawVal)) return { cellA1, value: true };
|
|
4526
|
+
if (/^false$/i.test(rawVal)) return { cellA1, value: false };
|
|
4527
|
+
const asNum = Number(rawVal);
|
|
4528
|
+
return {
|
|
4529
|
+
cellA1,
|
|
4530
|
+
value: rawVal !== "" && Number.isFinite(asNum) ? asNum : rawVal
|
|
4531
|
+
};
|
|
4532
|
+
}).filter((item) => item !== null);
|
|
4533
|
+
if (changingCells.length === 0) {
|
|
4534
|
+
setWhatIfStatusMsg("\u8BF7\u586B\u5199\u81F3\u5C11\u4E00\u9879\u53EF\u53D8\u5355\u5143\u683C\uFF08\u4F8B\u5982 B2=120\uFF09");
|
|
4535
|
+
return;
|
|
4536
|
+
}
|
|
4537
|
+
const resultCells = scenarioResultsInput.split(/[,;\s]+/).map((s) => s.trim()).filter(Boolean);
|
|
4538
|
+
const ok = commandService.syncExecuteCommand(import_univer_sheets2.SaveSheetScenarioCommand.id, {
|
|
4539
|
+
unitId,
|
|
4540
|
+
scenario: {
|
|
4541
|
+
name: scenarioNameInput.trim() || "\u672A\u547D\u540D\u65B9\u6848",
|
|
4542
|
+
comment: scenarioCommentInput.trim() || void 0,
|
|
4543
|
+
sheetId: sheet.getSheetId(),
|
|
4544
|
+
changingCells,
|
|
4545
|
+
resultCells: resultCells.length > 0 ? resultCells : void 0
|
|
4546
|
+
}
|
|
4547
|
+
});
|
|
4548
|
+
if (ok) {
|
|
4549
|
+
setWhatIfStatusMsg(
|
|
4550
|
+
`\u5DF2\u4FDD\u5B58\u65B9\u6848\u300C${scenarioNameInput.trim() || "\u672A\u547D\u540D\u65B9\u6848"}\u300D\uFF08${changingCells.length} \u9879\u53EF\u53D8\u683C\uFF09`
|
|
4551
|
+
);
|
|
4552
|
+
}
|
|
4553
|
+
},
|
|
4554
|
+
children: "\u4FDD\u5B58\u65B9\u6848"
|
|
4555
|
+
}
|
|
4556
|
+
),
|
|
4557
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4558
|
+
"button",
|
|
4559
|
+
{
|
|
4560
|
+
"data-testid": "yudao-scenario-summary-btn",
|
|
4561
|
+
type: "button",
|
|
4562
|
+
className: "yudao-sheet-btn",
|
|
4563
|
+
onClick: () => {
|
|
4564
|
+
const resultCellsA1 = scenarioResultsInput.split(/[,;\s]+/).map((s) => s.trim()).filter(Boolean);
|
|
4565
|
+
const ok = commandService.syncExecuteCommand(
|
|
4566
|
+
import_univer_sheets2.GenerateScenarioSummaryCommand.id,
|
|
4567
|
+
{
|
|
4568
|
+
unitId,
|
|
4569
|
+
sheetId: sheet.getSheetId(),
|
|
4570
|
+
resultCellsA1: resultCellsA1.length > 0 ? resultCellsA1 : void 0
|
|
4571
|
+
}
|
|
4572
|
+
);
|
|
4573
|
+
setWhatIfStatusMsg(
|
|
4574
|
+
ok ? "\u5DF2\u751F\u6210/\u66F4\u65B0\u300C\u65B9\u6848\u6458\u8981\u300D\u5BF9\u6BD4\u5DE5\u4F5C\u8868" : "\u751F\u6210\u65B9\u6848\u6458\u8981\u5931\u8D25"
|
|
4575
|
+
);
|
|
4576
|
+
},
|
|
4577
|
+
children: "\u4E00\u952E\u751F\u6210\u65B9\u6848\u6458\u8981\u8868"
|
|
4578
|
+
}
|
|
4579
|
+
)
|
|
4580
|
+
] }),
|
|
4581
|
+
(0, import_univer_sheets2.getWorkbookScenarios)(workbook).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4582
|
+
"div",
|
|
4583
|
+
{
|
|
4584
|
+
"data-testid": "yudao-scenario-list",
|
|
4585
|
+
style: { display: "flex", flexDirection: "column", gap: 3 },
|
|
4586
|
+
children: (0, import_univer_sheets2.getWorkbookScenarios)(workbook).map((sc) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4587
|
+
"div",
|
|
4588
|
+
{
|
|
4589
|
+
style: {
|
|
4590
|
+
display: "flex",
|
|
4591
|
+
alignItems: "center",
|
|
4592
|
+
justifyContent: "space-between",
|
|
4593
|
+
gap: 4,
|
|
4594
|
+
padding: "4px 6px",
|
|
4595
|
+
borderRadius: 5,
|
|
4596
|
+
background: "#FFFFFF",
|
|
4597
|
+
border: "1px solid #E2E8F0",
|
|
4598
|
+
fontSize: 10.5
|
|
4599
|
+
},
|
|
4600
|
+
children: [
|
|
4601
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
4602
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { fontWeight: 600, color: "#1E293B" }, children: sc.name }),
|
|
4603
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { color: "#64748B", fontSize: 10 }, children: sc.changingCells.map((c) => `${c.cellA1}=${String(c.value)}`).join(", ") })
|
|
4604
|
+
] }),
|
|
4605
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", gap: 3 }, children: [
|
|
4606
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4607
|
+
"button",
|
|
4608
|
+
{
|
|
4609
|
+
"data-testid": `yudao-scenario-apply-${sc.id}`,
|
|
4610
|
+
type: "button",
|
|
4611
|
+
className: "yudao-sheet-btn is-soft-primary",
|
|
4612
|
+
style: { padding: "1px 6px", fontSize: 10 },
|
|
4613
|
+
onClick: () => {
|
|
4614
|
+
const ok = commandService.syncExecuteCommand(
|
|
4615
|
+
import_univer_sheets2.ApplySheetScenarioCommand.id,
|
|
4616
|
+
{
|
|
4617
|
+
unitId,
|
|
4618
|
+
scenarioId: sc.id
|
|
4619
|
+
}
|
|
4620
|
+
);
|
|
4621
|
+
if (ok) {
|
|
4622
|
+
setWhatIfStatusMsg(`\u5DF2\u5207\u6362\u5E94\u7528\u65B9\u6848\u300C${sc.name}\u300D`);
|
|
4623
|
+
}
|
|
4624
|
+
},
|
|
4625
|
+
children: "\u5207\u6362"
|
|
4626
|
+
}
|
|
4627
|
+
),
|
|
4628
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4629
|
+
"button",
|
|
4630
|
+
{
|
|
4631
|
+
"data-testid": `yudao-scenario-delete-${sc.id}`,
|
|
4632
|
+
type: "button",
|
|
4633
|
+
className: "yudao-sheet-btn",
|
|
4634
|
+
style: { padding: "1px 5px", fontSize: 10 },
|
|
4635
|
+
onClick: () => {
|
|
4636
|
+
commandService.syncExecuteCommand(import_univer_sheets2.DeleteSheetScenarioCommand.id, {
|
|
4637
|
+
unitId,
|
|
4638
|
+
scenarioId: sc.id
|
|
4639
|
+
});
|
|
4640
|
+
setWhatIfStatusMsg(`\u5DF2\u5220\u9664\u65B9\u6848\u300C${sc.name}\u300D`);
|
|
4641
|
+
},
|
|
4642
|
+
children: "\u5220\u9664"
|
|
4643
|
+
}
|
|
4644
|
+
)
|
|
4645
|
+
] })
|
|
4646
|
+
]
|
|
4647
|
+
},
|
|
4648
|
+
sc.id
|
|
4649
|
+
))
|
|
4650
|
+
}
|
|
4651
|
+
),
|
|
4652
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4653
|
+
"div",
|
|
4654
|
+
{
|
|
4655
|
+
style: {
|
|
4656
|
+
borderTop: "1px dashed #CBD5E1",
|
|
4657
|
+
paddingTop: 5,
|
|
4658
|
+
display: "flex",
|
|
4659
|
+
flexDirection: "column",
|
|
4660
|
+
gap: 5
|
|
4661
|
+
},
|
|
4662
|
+
children: [
|
|
4663
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4664
|
+
"div",
|
|
4665
|
+
{
|
|
4666
|
+
className: "yudao-sheet-segmented",
|
|
4667
|
+
style: { gridTemplateColumns: "1fr 1fr" },
|
|
4668
|
+
children: [
|
|
4669
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4670
|
+
"button",
|
|
4671
|
+
{
|
|
4672
|
+
"data-testid": "yudao-datatable-mode-1var",
|
|
4673
|
+
type: "button",
|
|
4674
|
+
className: `yudao-sheet-segmented-item ${whatIfMode === "1var" ? "is-active" : ""}`,
|
|
4675
|
+
style: { padding: "3px 4px", fontSize: 10.5 },
|
|
4676
|
+
onClick: () => setWhatIfMode("1var"),
|
|
4677
|
+
children: "\u5355\u53D8\u91CF\u6A21\u62DF\u8FD0\u7B97\u8868"
|
|
4678
|
+
}
|
|
4679
|
+
),
|
|
4680
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4681
|
+
"button",
|
|
4682
|
+
{
|
|
4683
|
+
"data-testid": "yudao-datatable-mode-2var",
|
|
4684
|
+
type: "button",
|
|
4685
|
+
className: `yudao-sheet-segmented-item ${whatIfMode === "2var" ? "is-active" : ""}`,
|
|
4686
|
+
style: { padding: "3px 4px", fontSize: 10.5 },
|
|
4687
|
+
onClick: () => setWhatIfMode("2var"),
|
|
4688
|
+
children: "\u53CC\u53D8\u91CF\u4EA4\u53C9\u6A21\u62DF\u8868"
|
|
4689
|
+
}
|
|
4690
|
+
)
|
|
4691
|
+
]
|
|
4692
|
+
}
|
|
4693
|
+
),
|
|
4694
|
+
whatIfMode === "1var" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
4695
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "0.9fr 1.4fr", gap: 4 }, children: [
|
|
4696
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4697
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u8F93\u5165\u53D8\u91CF\u683C" }),
|
|
4698
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4699
|
+
"input",
|
|
4700
|
+
{
|
|
4701
|
+
"data-testid": "yudao-dt-input-cell",
|
|
4702
|
+
type: "text",
|
|
4703
|
+
value: dtInputCell,
|
|
4704
|
+
onChange: (e) => setDtInputCell(e.target.value)
|
|
4705
|
+
}
|
|
4706
|
+
)
|
|
4707
|
+
] }),
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4709
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5019\u9009\u8F93\u5165\u5E8F\u5217 (\u9017\u53F7\u5206\u9694)" }),
|
|
4710
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4711
|
+
"input",
|
|
4712
|
+
{
|
|
4713
|
+
"data-testid": "yudao-dt-input-values",
|
|
4714
|
+
type: "text",
|
|
4715
|
+
value: dtInputValues,
|
|
4716
|
+
onChange: (e) => setDtInputValues(e.target.value)
|
|
4717
|
+
}
|
|
4718
|
+
)
|
|
4719
|
+
] })
|
|
4720
|
+
] }),
|
|
4721
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
|
|
4722
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4723
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u76EE\u6807\u516C\u5F0F\u683C (\u53EF\u591A\u4E2A)" }),
|
|
4724
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4725
|
+
"input",
|
|
4726
|
+
{
|
|
4727
|
+
"data-testid": "yudao-dt-formula-cells",
|
|
4728
|
+
type: "text",
|
|
4729
|
+
value: dtFormulaCells,
|
|
4730
|
+
onChange: (e) => setDtFormulaCells(e.target.value)
|
|
4731
|
+
}
|
|
4732
|
+
)
|
|
4733
|
+
] }),
|
|
4734
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4735
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u8F93\u51FA\u5DE6\u4E0A\u89D2 (\u53EF\u9009)" }),
|
|
4736
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4737
|
+
"input",
|
|
4738
|
+
{
|
|
4739
|
+
"data-testid": "yudao-dt-output-cell",
|
|
4740
|
+
type: "text",
|
|
4741
|
+
placeholder: "\u5982 H2",
|
|
4742
|
+
value: dtOutputTopLeft,
|
|
4743
|
+
onChange: (e) => setDtOutputTopLeft(e.target.value)
|
|
4744
|
+
}
|
|
4745
|
+
)
|
|
4746
|
+
] })
|
|
4747
|
+
] })
|
|
4748
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
4749
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "0.9fr 1.4fr", gap: 4 }, children: [
|
|
4750
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4751
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u884C\u53D8\u91CF\u683C" }),
|
|
4752
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4753
|
+
"input",
|
|
4754
|
+
{
|
|
4755
|
+
"data-testid": "yudao-dt-row-input-cell",
|
|
4756
|
+
type: "text",
|
|
4757
|
+
value: dtInputCell,
|
|
4758
|
+
onChange: (e) => setDtInputCell(e.target.value)
|
|
4759
|
+
}
|
|
4760
|
+
)
|
|
4761
|
+
] }),
|
|
4762
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4763
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u884C\u5019\u9009\u503C (\u9017\u53F7\u5206\u9694)" }),
|
|
4764
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4765
|
+
"input",
|
|
4766
|
+
{
|
|
4767
|
+
"data-testid": "yudao-dt-row-values",
|
|
4768
|
+
type: "text",
|
|
4769
|
+
value: dtInputValues,
|
|
4770
|
+
onChange: (e) => setDtInputValues(e.target.value)
|
|
4771
|
+
}
|
|
4772
|
+
)
|
|
4773
|
+
] })
|
|
4774
|
+
] }),
|
|
4775
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "0.9fr 1.4fr", gap: 4 }, children: [
|
|
4776
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4777
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5217\u53D8\u91CF\u683C" }),
|
|
4778
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4779
|
+
"input",
|
|
4780
|
+
{
|
|
4781
|
+
"data-testid": "yudao-dt-col-input-cell",
|
|
4782
|
+
type: "text",
|
|
4783
|
+
value: dtColInputCell,
|
|
4784
|
+
onChange: (e) => setDtColInputCell(e.target.value)
|
|
4785
|
+
}
|
|
4786
|
+
)
|
|
4787
|
+
] }),
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4789
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5217\u5019\u9009\u503C (\u9017\u53F7\u5206\u9694)" }),
|
|
4790
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4791
|
+
"input",
|
|
4792
|
+
{
|
|
4793
|
+
"data-testid": "yudao-dt-col-values",
|
|
4794
|
+
type: "text",
|
|
4795
|
+
value: dtColValues,
|
|
4796
|
+
onChange: (e) => setDtColValues(e.target.value)
|
|
4797
|
+
}
|
|
4798
|
+
)
|
|
4799
|
+
] })
|
|
4800
|
+
] }),
|
|
4801
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
|
|
4802
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4803
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u76EE\u6807\u516C\u5F0F\u683C" }),
|
|
4804
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4805
|
+
"input",
|
|
4806
|
+
{
|
|
4807
|
+
"data-testid": "yudao-dt-target-formula",
|
|
4808
|
+
type: "text",
|
|
4809
|
+
value: dtFormulaCells,
|
|
4810
|
+
onChange: (e) => setDtFormulaCells(e.target.value)
|
|
4811
|
+
}
|
|
4812
|
+
)
|
|
4813
|
+
] }),
|
|
4814
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
4815
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u8F93\u51FA\u5DE6\u4E0A\u89D2 (\u53EF\u9009)" }),
|
|
4816
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4817
|
+
"input",
|
|
4818
|
+
{
|
|
4819
|
+
"data-testid": "yudao-dt-output-cell",
|
|
4820
|
+
type: "text",
|
|
4821
|
+
placeholder: "\u5982 H2",
|
|
4822
|
+
value: dtOutputTopLeft,
|
|
4823
|
+
onChange: (e) => setDtOutputTopLeft(e.target.value)
|
|
4824
|
+
}
|
|
4825
|
+
)
|
|
4826
|
+
] })
|
|
4827
|
+
] })
|
|
4828
|
+
] }),
|
|
4829
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4830
|
+
"button",
|
|
4831
|
+
{
|
|
4832
|
+
"data-testid": "yudao-datatable-run-btn",
|
|
4833
|
+
type: "button",
|
|
4834
|
+
className: "yudao-sheet-btn is-soft-primary",
|
|
4835
|
+
onClick: () => {
|
|
4836
|
+
const parseCandidateValues = (raw) => raw.split(/[,;]+/).map((s) => s.trim()).filter(Boolean).map((tok) => {
|
|
4837
|
+
const n = Number(tok);
|
|
4838
|
+
return Number.isFinite(n) ? n : tok;
|
|
4839
|
+
});
|
|
4840
|
+
if (whatIfMode === "1var") {
|
|
4841
|
+
const inputVals = parseCandidateValues(dtInputValues);
|
|
4842
|
+
const fCells = dtFormulaCells.split(/[,;\s]+/).map((s) => s.trim()).filter(Boolean);
|
|
4843
|
+
commandService.syncExecuteCommand(import_univer_sheets2.RunSheetDataTableCommand.id, {
|
|
4844
|
+
unitId,
|
|
4845
|
+
mode: "1var",
|
|
4846
|
+
sheetId: sheet.getSheetId(),
|
|
4847
|
+
inputCellA1: dtInputCell.trim(),
|
|
4848
|
+
inputValues: inputVals,
|
|
4849
|
+
formulaCellsA1: fCells,
|
|
4850
|
+
outputTopLeftA1: dtOutputTopLeft.trim() || void 0,
|
|
4851
|
+
onResult: (res) => {
|
|
4852
|
+
setWhatIfStatusMsg(
|
|
4853
|
+
`\u5355\u53D8\u91CF\u6A21\u62DF\u5B8C\u6210 (${res.matrix.length}\xD7${res.formulaCellsA1.length})${res.outputRangeA1 ? ` -> \u5DF2\u5199\u5165 ${res.outputRangeA1}` : ""}: ${res.matrix.map((r) => `[${r.join(", ")}]`).join(" ")}`
|
|
4854
|
+
);
|
|
4855
|
+
}
|
|
4856
|
+
});
|
|
4857
|
+
} else {
|
|
4858
|
+
const rVals = parseCandidateValues(dtInputValues);
|
|
4859
|
+
const cVals = parseCandidateValues(dtColValues);
|
|
4860
|
+
const targetF = dtFormulaCells.split(/[,;\s]+/).map((s) => s.trim()).filter(Boolean)[0] ?? "F10";
|
|
4861
|
+
commandService.syncExecuteCommand(import_univer_sheets2.RunSheetDataTableCommand.id, {
|
|
4862
|
+
unitId,
|
|
4863
|
+
mode: "2var",
|
|
4864
|
+
sheetId: sheet.getSheetId(),
|
|
4865
|
+
rowInputCellA1: dtInputCell.trim(),
|
|
4866
|
+
colInputCellA1: dtColInputCell.trim(),
|
|
4867
|
+
rowValues: rVals,
|
|
4868
|
+
colValues: cVals,
|
|
4869
|
+
targetFormulaA1: targetF,
|
|
4870
|
+
outputTopLeftA1: dtOutputTopLeft.trim() || void 0,
|
|
4871
|
+
onResult: (res) => {
|
|
4872
|
+
setWhatIfStatusMsg(
|
|
4873
|
+
`\u53CC\u53D8\u91CF\u6A21\u62DF\u5B8C\u6210 (${res.colValues.length}\xD7${res.rowValues.length})${res.outputRangeA1 ? ` -> \u5DF2\u5199\u5165 ${res.outputRangeA1}` : ""}: ${res.matrix.map((r) => `[${r.join(", ")}]`).join(" ")}`
|
|
4874
|
+
);
|
|
4875
|
+
}
|
|
4876
|
+
});
|
|
4877
|
+
}
|
|
4878
|
+
},
|
|
4879
|
+
children: "\u8BA1\u7B97\u5E76\u8F93\u51FA\u6A21\u62DF\u8FD0\u7B97\u8868"
|
|
4880
|
+
}
|
|
4881
|
+
)
|
|
4882
|
+
]
|
|
4883
|
+
}
|
|
4884
|
+
),
|
|
4885
|
+
whatIfStatusMsg && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4886
|
+
"div",
|
|
4887
|
+
{
|
|
4888
|
+
"data-testid": "yudao-whatif-status",
|
|
4889
|
+
style: {
|
|
4890
|
+
fontSize: 10.5,
|
|
4891
|
+
padding: "4px 6px",
|
|
4892
|
+
borderRadius: 5,
|
|
4893
|
+
background: "#EEF2FF",
|
|
4894
|
+
border: "1px solid #C7D2FE",
|
|
4895
|
+
color: "#1E1B4B",
|
|
4896
|
+
lineHeight: 1.35,
|
|
4897
|
+
wordBreak: "break-all"
|
|
4898
|
+
},
|
|
4899
|
+
children: whatIfStatusMsg
|
|
4900
|
+
}
|
|
4901
|
+
)
|
|
4902
|
+
]
|
|
4903
|
+
}
|
|
4352
4904
|
)
|
|
4353
4905
|
] }),
|
|
4354
4906
|
features.datasetBinding && activeSubTab === "fill" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-sheet-section", children: [
|
|
@@ -5014,6 +5566,270 @@ var SheetInspectorPanel = () => {
|
|
|
5014
5566
|
}
|
|
5015
5567
|
)
|
|
5016
5568
|
] }),
|
|
5569
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-sheet-section", "data-testid": "yudao-macro-recorder-card", children: [
|
|
5570
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-sheet-section-title", children: [
|
|
5571
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 5 }, children: [
|
|
5572
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: "13", height: "13", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
|
|
5573
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5574
|
+
"circle",
|
|
5575
|
+
{
|
|
5576
|
+
cx: "8",
|
|
5577
|
+
cy: "8",
|
|
5578
|
+
r: "6",
|
|
5579
|
+
stroke: macroRecState.recording ? "#DC2626" : "#2C53F1",
|
|
5580
|
+
strokeWidth: "1.4"
|
|
5581
|
+
}
|
|
5582
|
+
),
|
|
5583
|
+
macroRecState.recording ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { x: "5.5", y: "5.5", width: "5", height: "5", rx: "1", fill: "#DC2626" }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("polygon", { points: "6.5,5 11.5,8 6.5,11", fill: "#2C53F1" })
|
|
5584
|
+
] }),
|
|
5585
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u64CD\u4F5C\u5B8F\u5F55\u5236\u4E0E\u56DE\u653E" })
|
|
5586
|
+
] }),
|
|
5587
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5588
|
+
"span",
|
|
5589
|
+
{
|
|
5590
|
+
"data-testid": "yudao-macro-badge",
|
|
5591
|
+
style: {
|
|
5592
|
+
fontSize: 10,
|
|
5593
|
+
fontWeight: 500,
|
|
5594
|
+
padding: "1px 6px",
|
|
5595
|
+
borderRadius: 999,
|
|
5596
|
+
background: macroRecState.recording ? "#FEF2F2" : "#F3F5FF",
|
|
5597
|
+
color: macroRecState.recording ? "#DC2626" : "#2C53F1"
|
|
5598
|
+
},
|
|
5599
|
+
children: macroRecState.recording ? `\u5F55\u5236\u4E2D (${macroRecState.stepCount} \u6B65)` : `${(macroService ? macroService.getMacros(unitId) : (0, import_univer_sheets2.getWorkbookMacros)(workbook)).length} \u4E2A\u5B8F`
|
|
5600
|
+
}
|
|
5601
|
+
)
|
|
5602
|
+
] }),
|
|
5603
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", gap: 4 }, children: [
|
|
5604
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5605
|
+
"input",
|
|
5606
|
+
{
|
|
5607
|
+
"data-testid": "yudao-macro-name-input",
|
|
5608
|
+
type: "text",
|
|
5609
|
+
style: {
|
|
5610
|
+
flex: 1,
|
|
5611
|
+
minWidth: 0,
|
|
5612
|
+
fontSize: 11.5,
|
|
5613
|
+
padding: "4px 6px",
|
|
5614
|
+
borderRadius: 6,
|
|
5615
|
+
border: "1px solid #E3E5EA",
|
|
5616
|
+
background: "#FFFFFF",
|
|
5617
|
+
color: "#1B1C1F",
|
|
5618
|
+
outline: "none"
|
|
5619
|
+
},
|
|
5620
|
+
placeholder: "\u5B8F\u540D\u79F0\uFF08\u5982\uFF1A\u6708\u5EA6\u62A5\u8868\u6E05\u6D17\uFF09",
|
|
5621
|
+
value: macroNameInput,
|
|
5622
|
+
onChange: (e) => setMacroNameInput(e.target.value)
|
|
5623
|
+
}
|
|
5624
|
+
),
|
|
5625
|
+
!macroRecState.recording ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5626
|
+
"button",
|
|
5627
|
+
{
|
|
5628
|
+
"data-testid": "yudao-macro-start-btn",
|
|
5629
|
+
type: "button",
|
|
5630
|
+
className: "yudao-sheet-btn is-soft-primary",
|
|
5631
|
+
onClick: () => {
|
|
5632
|
+
commandService.syncExecuteCommand(import_univer_sheets2.StartSheetMacroRecordCommand.id, {
|
|
5633
|
+
unitId,
|
|
5634
|
+
name: macroNameInput.trim() || void 0
|
|
5635
|
+
});
|
|
5636
|
+
setMacroStatusMsg("\u5DF2\u5F00\u59CB\u5F55\u5236\u5DE5\u4F5C\u8868\u64CD\u4F5C\uFF08\u4EC5\u8BB0\u5F55\u6570\u636E/\u6837\u5F0F/\u5206\u6790\u53D8\u66F4\uFF0C\u5FFD\u7565\u9009\u533A\u6EDA\u52A8\uFF09");
|
|
5637
|
+
},
|
|
5638
|
+
children: "\u5F00\u59CB\u5F55\u5236"
|
|
5639
|
+
}
|
|
5640
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5641
|
+
"button",
|
|
5642
|
+
{
|
|
5643
|
+
"data-testid": "yudao-macro-stop-btn",
|
|
5644
|
+
type: "button",
|
|
5645
|
+
className: "yudao-sheet-btn",
|
|
5646
|
+
style: { borderColor: "#FCA5A5", color: "#B91C1C", background: "#FEF2F2" },
|
|
5647
|
+
onClick: () => {
|
|
5648
|
+
commandService.syncExecuteCommand(import_univer_sheets2.StopSheetMacroRecordCommand.id, {
|
|
5649
|
+
unitId,
|
|
5650
|
+
name: macroNameInput.trim() || void 0,
|
|
5651
|
+
onSaved: (saved) => {
|
|
5652
|
+
setMacroStatusMsg(`\u5DF2\u4FDD\u5B58\u64CD\u4F5C\u5B8F\u300C${saved.name}\u300D\uFF08\u5171 ${saved.steps.length} \u6B65\uFF09`);
|
|
5653
|
+
setMacroNameInput("");
|
|
5654
|
+
}
|
|
5655
|
+
});
|
|
5656
|
+
},
|
|
5657
|
+
children: "\u505C\u6B62\u4FDD\u5B58"
|
|
5658
|
+
}
|
|
5659
|
+
)
|
|
5660
|
+
] }),
|
|
5661
|
+
(macroService ? macroService.getMacros(unitId) : (0, import_univer_sheets2.getWorkbookMacros)(workbook)).map((m) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
5662
|
+
"div",
|
|
5663
|
+
{
|
|
5664
|
+
"data-testid": `yudao-macro-item-${m.id}`,
|
|
5665
|
+
style: {
|
|
5666
|
+
display: "flex",
|
|
5667
|
+
alignItems: "center",
|
|
5668
|
+
justifyContent: "space-between",
|
|
5669
|
+
gap: 6,
|
|
5670
|
+
padding: "4px 6px",
|
|
5671
|
+
background: "#FFFFFF",
|
|
5672
|
+
border: "1px solid #E3E5EA",
|
|
5673
|
+
borderRadius: 6,
|
|
5674
|
+
fontSize: 11
|
|
5675
|
+
},
|
|
5676
|
+
children: [
|
|
5677
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { minWidth: 0, flex: 1 }, children: [
|
|
5678
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { fontWeight: 600, color: "#1B1C1F" }, children: m.name }),
|
|
5679
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { color: "#7D8698", fontSize: 10 }, children: [
|
|
5680
|
+
m.steps.length,
|
|
5681
|
+
" \u6B65\u81EA\u52A8\u5316\u6307\u4EE4"
|
|
5682
|
+
] })
|
|
5683
|
+
] }),
|
|
5684
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", gap: 3 }, children: [
|
|
5685
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5686
|
+
"button",
|
|
5687
|
+
{
|
|
5688
|
+
"data-testid": `yudao-macro-replay-${m.id}`,
|
|
5689
|
+
type: "button",
|
|
5690
|
+
className: "yudao-sheet-btn is-soft-primary",
|
|
5691
|
+
style: { padding: "2px 6px", fontSize: 10.5 },
|
|
5692
|
+
onClick: () => {
|
|
5693
|
+
const ok = commandService.syncExecuteCommand(import_univer_sheets2.ReplaySheetMacroCommand.id, {
|
|
5694
|
+
unitId,
|
|
5695
|
+
macroId: m.id,
|
|
5696
|
+
sheetId: sheet.getSheetId()
|
|
5697
|
+
});
|
|
5698
|
+
setMacroStatusMsg(
|
|
5699
|
+
ok ? `\u5DF2\u5728\u5DE5\u4F5C\u8868\u300C${sheet.getName()}\u300D\u4E00\u952E\u56DE\u653E\u5B8F\u300C${m.name}\u300D` : `\u56DE\u653E\u5B8F\u300C${m.name}\u300D\u5931\u8D25`
|
|
5700
|
+
);
|
|
5701
|
+
},
|
|
5702
|
+
children: "\u4E00\u952E\u56DE\u653E"
|
|
5703
|
+
}
|
|
5704
|
+
),
|
|
5705
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5706
|
+
"button",
|
|
5707
|
+
{
|
|
5708
|
+
"data-testid": `yudao-macro-view-script-${m.id}`,
|
|
5709
|
+
type: "button",
|
|
5710
|
+
className: "yudao-sheet-btn",
|
|
5711
|
+
style: { padding: "2px 6px", fontSize: 10.5 },
|
|
5712
|
+
onClick: () => setPreviewMacro(previewMacro?.id === m.id ? null : m),
|
|
5713
|
+
children: "\u67E5\u770B\u811A\u672C"
|
|
5714
|
+
}
|
|
5715
|
+
),
|
|
5716
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5717
|
+
"button",
|
|
5718
|
+
{
|
|
5719
|
+
"data-testid": `yudao-macro-delete-${m.id}`,
|
|
5720
|
+
type: "button",
|
|
5721
|
+
className: "yudao-sheet-btn",
|
|
5722
|
+
style: { padding: "2px 5px", fontSize: 10.5 },
|
|
5723
|
+
onClick: () => {
|
|
5724
|
+
commandService.syncExecuteCommand(import_univer_sheets2.DeleteSheetMacroCommand.id, {
|
|
5725
|
+
unitId,
|
|
5726
|
+
macroId: m.id
|
|
5727
|
+
});
|
|
5728
|
+
if (previewMacro?.id === m.id) setPreviewMacro(null);
|
|
5729
|
+
setMacroStatusMsg(`\u5DF2\u5220\u9664\u5B8F\u300C${m.name}\u300D`);
|
|
5730
|
+
},
|
|
5731
|
+
children: "\u5220\u9664"
|
|
5732
|
+
}
|
|
5733
|
+
)
|
|
5734
|
+
] })
|
|
5735
|
+
]
|
|
5736
|
+
},
|
|
5737
|
+
m.id
|
|
5738
|
+
)),
|
|
5739
|
+
previewMacro && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
5740
|
+
"div",
|
|
5741
|
+
{
|
|
5742
|
+
"data-testid": "yudao-macro-script-modal",
|
|
5743
|
+
style: {
|
|
5744
|
+
display: "flex",
|
|
5745
|
+
flexDirection: "column",
|
|
5746
|
+
gap: 5,
|
|
5747
|
+
padding: "6px 8px",
|
|
5748
|
+
borderRadius: 6,
|
|
5749
|
+
background: "#0F172A",
|
|
5750
|
+
color: "#E2E8F0",
|
|
5751
|
+
fontSize: 10.5
|
|
5752
|
+
},
|
|
5753
|
+
children: [
|
|
5754
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
5755
|
+
"div",
|
|
5756
|
+
{
|
|
5757
|
+
style: {
|
|
5758
|
+
display: "flex",
|
|
5759
|
+
alignItems: "center",
|
|
5760
|
+
justifyContent: "space-between",
|
|
5761
|
+
gap: 6
|
|
5762
|
+
},
|
|
5763
|
+
children: [
|
|
5764
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { fontWeight: 600, color: "#F8FAFC" }, children: [
|
|
5765
|
+
"Facade \u811A\u672C\u9884\u89C8\uFF1A",
|
|
5766
|
+
previewMacro.name
|
|
5767
|
+
] }),
|
|
5768
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", gap: 4 }, children: [
|
|
5769
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5770
|
+
"button",
|
|
5771
|
+
{
|
|
5772
|
+
"data-testid": "yudao-macro-script-copy-btn",
|
|
5773
|
+
type: "button",
|
|
5774
|
+
className: "yudao-sheet-btn",
|
|
5775
|
+
style: { padding: "1px 6px", fontSize: 10 },
|
|
5776
|
+
onClick: () => {
|
|
5777
|
+
void globalThis.navigator?.clipboard?.writeText?.(
|
|
5778
|
+
previewMacro.generatedScript
|
|
5779
|
+
);
|
|
5780
|
+
setMacroStatusMsg(`\u5DF2\u590D\u5236\u300C${previewMacro.name}\u300D\u81EA\u52A8\u5316\u811A\u672C`);
|
|
5781
|
+
},
|
|
5782
|
+
children: "\u590D\u5236\u4EE3\u7801"
|
|
5783
|
+
}
|
|
5784
|
+
),
|
|
5785
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5786
|
+
"button",
|
|
5787
|
+
{
|
|
5788
|
+
"data-testid": "yudao-macro-script-close-btn",
|
|
5789
|
+
type: "button",
|
|
5790
|
+
className: "yudao-sheet-btn",
|
|
5791
|
+
style: { padding: "1px 6px", fontSize: 10 },
|
|
5792
|
+
onClick: () => setPreviewMacro(null),
|
|
5793
|
+
children: "\u5173\u95ED"
|
|
5794
|
+
}
|
|
5795
|
+
)
|
|
5796
|
+
] })
|
|
5797
|
+
]
|
|
5798
|
+
}
|
|
5799
|
+
),
|
|
5800
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5801
|
+
"pre",
|
|
5802
|
+
{
|
|
5803
|
+
"data-testid": "yudao-macro-script-code",
|
|
5804
|
+
style: {
|
|
5805
|
+
margin: 0,
|
|
5806
|
+
padding: "6px",
|
|
5807
|
+
borderRadius: 4,
|
|
5808
|
+
background: "#1E293B",
|
|
5809
|
+
color: "#93C5FD",
|
|
5810
|
+
fontFamily: "monospace",
|
|
5811
|
+
fontSize: 10,
|
|
5812
|
+
lineHeight: 1.45,
|
|
5813
|
+
maxHeight: 160,
|
|
5814
|
+
overflow: "auto",
|
|
5815
|
+
whiteSpace: "pre-wrap",
|
|
5816
|
+
wordBreak: "break-all"
|
|
5817
|
+
},
|
|
5818
|
+
children: previewMacro.generatedScript
|
|
5819
|
+
}
|
|
5820
|
+
)
|
|
5821
|
+
]
|
|
5822
|
+
}
|
|
5823
|
+
),
|
|
5824
|
+
macroStatusMsg && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
5825
|
+
"div",
|
|
5826
|
+
{
|
|
5827
|
+
"data-testid": "yudao-macro-status",
|
|
5828
|
+
style: { fontSize: 10.5, color: "#4E5565", lineHeight: 1.35 },
|
|
5829
|
+
children: macroStatusMsg
|
|
5830
|
+
}
|
|
5831
|
+
)
|
|
5832
|
+
] }),
|
|
5017
5833
|
features.versionHistory && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-sheet-section", children: [
|
|
5018
5834
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-sheet-section-title", children: [
|
|
5019
5835
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u7248\u672C\u5386\u53F2\u4E0E\u62A5\u8868\u8FC1\u79FB\u5305" }),
|