@yudaocode/univer-sheets-ui 1.6.217 → 1.6.218
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 +2282 -338
- package/lib/cjs/index.js.map +1 -1
- package/lib/es/index.js +2283 -340
- package/lib/es/index.js.map +1 -1
- package/package.json +3 -3
package/lib/cjs/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
20
30
|
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
@@ -302,6 +312,10 @@ var OpenSheetIoModalOperation = {
|
|
|
302
312
|
function mergeImportedTemplateMetadata(prevMeta, importedMeta) {
|
|
303
313
|
const next = { ...prevMeta, ...importedMeta };
|
|
304
314
|
if (!importedMeta.charts) delete next.charts;
|
|
315
|
+
if (!importedMeta.shapes) delete next.shapes;
|
|
316
|
+
if (!importedMeta.outlines) delete next.outlines;
|
|
317
|
+
if (!importedMeta.pivots) delete next.pivots;
|
|
318
|
+
if (!importedMeta.sparklines) delete next.sparklines;
|
|
305
319
|
return next;
|
|
306
320
|
}
|
|
307
321
|
var ImportSheetFileOperation = {
|
|
@@ -694,6 +708,23 @@ var SheetInspectorPanel = () => {
|
|
|
694
708
|
const [qpDatasetCode, setQpDatasetCode] = (0, import_react2.useState)("");
|
|
695
709
|
const [qpTargetField, setQpTargetField] = (0, import_react2.useState)("");
|
|
696
710
|
const [qpDefaultVal, setQpDefaultVal] = (0, import_react2.useState)("");
|
|
711
|
+
const [selectedChartId, setSelectedChartId] = (0, import_react2.useState)("");
|
|
712
|
+
const [selectedPivotId, setSelectedPivotId] = (0, import_react2.useState)("__new__");
|
|
713
|
+
const [pivotSourceRange, setPivotSourceRange] = (0, import_react2.useState)("");
|
|
714
|
+
const [pivotChipTarget, setPivotChipTarget] = (0, import_react2.useState)("rows");
|
|
715
|
+
const [pivotRowFields, setPivotRowFields] = (0, import_react2.useState)([1]);
|
|
716
|
+
const [pivotColFields, setPivotColFields] = (0, import_react2.useState)([]);
|
|
717
|
+
const [pivotValueFields, setPivotValueFields] = (0, import_react2.useState)([
|
|
718
|
+
{ colIndex: 5, aggFunc: "sum" }
|
|
719
|
+
]);
|
|
720
|
+
const [pivotFilterFields, setPivotFilterFields] = (0, import_react2.useState)([]);
|
|
721
|
+
const [pivotCalcFields, setPivotCalcFields] = (0, import_react2.useState)([]);
|
|
722
|
+
const [calcFieldName, setCalcFieldName] = (0, import_react2.useState)("");
|
|
723
|
+
const [calcFieldFormula, setCalcFieldFormula] = (0, import_react2.useState)("");
|
|
724
|
+
const [watchInputRef, setWatchInputRef] = (0, import_react2.useState)("");
|
|
725
|
+
const [evalSteps, setEvalSteps] = (0, import_react2.useState)([]);
|
|
726
|
+
const [evalStepIdx, setEvalStepIdx] = (0, import_react2.useState)(0);
|
|
727
|
+
const [evalCellKey, setEvalCellKey] = (0, import_react2.useState)("");
|
|
697
728
|
(0, import_react2.useEffect)(() => {
|
|
698
729
|
const sub = selectionService.selectionChanged$.subscribe(() => setSelTick((v) => v + 1));
|
|
699
730
|
const disp = commandService.onCommandExecuted((info) => {
|
|
@@ -751,6 +782,63 @@ var SheetInspectorPanel = () => {
|
|
|
751
782
|
const printCfg = metadata.printConfig ?? {};
|
|
752
783
|
const protectionCfg = metadata.protection;
|
|
753
784
|
const charts = metadata.charts ?? [];
|
|
785
|
+
const pivots = metadata.pivots ?? [];
|
|
786
|
+
const editingChart = charts.find((c) => c.id === selectedChartId) ?? charts[0];
|
|
787
|
+
const activePivot = selectedPivotId !== "__new__" ? pivots.find((p) => p.id === selectedPivotId) : void 0;
|
|
788
|
+
const pivotSrcSheet = (activePivot?.sourceSheetId ? workbook.getSheetBySheetId(activePivot.sourceSheetId) : null) ?? sheet;
|
|
789
|
+
const rawPivotRangePart = (pivotSourceRange || activePivot?.sourceRange || "").trim().replace(/^.*!/, "");
|
|
790
|
+
const parsedPivotRange = rawPivotRangePart ? (0, import_univer_sheets2.parseA1Range)(rawPivotRangePart) : null;
|
|
791
|
+
const pivotHeaderRow = parsedPivotRange ? parsedPivotRange.startRow : 0;
|
|
792
|
+
const pivotStartCol = parsedPivotRange ? parsedPivotRange.startColumn : 0;
|
|
793
|
+
const pivotEndCol = (() => {
|
|
794
|
+
if (parsedPivotRange) {
|
|
795
|
+
return Math.max(parsedPivotRange.startColumn, parsedPivotRange.endColumn);
|
|
796
|
+
}
|
|
797
|
+
let maxCol = 6;
|
|
798
|
+
for (let c = 0; c < 20; c++) {
|
|
799
|
+
const v = pivotSrcSheet.getCellRaw(0, c)?.v;
|
|
800
|
+
if (v !== void 0 && v !== null && String(v).trim() !== "") {
|
|
801
|
+
maxCol = Math.max(maxCol, c);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
return maxCol;
|
|
805
|
+
})();
|
|
806
|
+
const pivotSourceColumns = [];
|
|
807
|
+
for (let c = pivotStartCol; c <= pivotEndCol; c++) {
|
|
808
|
+
const hdrVal = pivotSrcSheet.getCellRaw(pivotHeaderRow, c)?.v;
|
|
809
|
+
const hdrStr = hdrVal !== void 0 && hdrVal !== null ? String(hdrVal).trim() : "";
|
|
810
|
+
pivotSourceColumns.push({
|
|
811
|
+
colIndex: c,
|
|
812
|
+
rawHeader: hdrStr || `${(0, import_univer_sheets2.colIndexToLetter)(c)}\u5217`,
|
|
813
|
+
label: hdrStr ? `${hdrStr} (${(0, import_univer_sheets2.colIndexToLetter)(c)})` : `${(0, import_univer_sheets2.colIndexToLetter)(c)} \u5217`
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
const resolvePivotFieldCol = (fieldOrIdx, fallback = 0) => {
|
|
817
|
+
if (typeof fieldOrIdx === "number" && Number.isFinite(fieldOrIdx)) return fieldOrIdx;
|
|
818
|
+
if (typeof fieldOrIdx === "string") {
|
|
819
|
+
const tStr = fieldOrIdx.trim();
|
|
820
|
+
if (/^\d+$/.test(tStr)) return Number(tStr);
|
|
821
|
+
const hit = pivotSourceColumns.find(
|
|
822
|
+
(col) => col.rawHeader.toLowerCase() === tStr.toLowerCase()
|
|
823
|
+
);
|
|
824
|
+
if (hit) return hit.colIndex;
|
|
825
|
+
}
|
|
826
|
+
return fallback;
|
|
827
|
+
};
|
|
828
|
+
const getPivotColumnLabel = (colIdx) => pivotSourceColumns.find((col) => col.colIndex === colIdx)?.rawHeader ?? `${(0, import_univer_sheets2.colIndexToLetter)(Math.max(0, colIdx))}\u5217`;
|
|
829
|
+
const getPivotFilterChoices = (colIdx) => {
|
|
830
|
+
const startR = pivotHeaderRow + 1;
|
|
831
|
+
const endR = parsedPivotRange ? Math.min(parsedPivotRange.endRow, startR + 200) : Math.min(pivotSrcSheet.getRowCount() - 1, startR + 150);
|
|
832
|
+
const seen = /* @__PURE__ */ new Set();
|
|
833
|
+
for (let r = startR; r <= endR; r++) {
|
|
834
|
+
const val = pivotSrcSheet.getCellRaw(r, colIdx)?.v;
|
|
835
|
+
if (val !== void 0 && val !== null && String(val).trim() !== "") {
|
|
836
|
+
seen.add(String(val).trim());
|
|
837
|
+
if (seen.size >= 24) break;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
return Array.from(seen);
|
|
841
|
+
};
|
|
754
842
|
const activeAlertRule = cellMeta.alertRules?.[0];
|
|
755
843
|
const singleExprRe = features.contextualCellBinding && effectiveSyntax === "hash" ? /^#\{([#$]?\s*[\p{L}\p{N}_][\p{L}\p{N}_.\[\]-]*)\}$/u : features.contextualCellBinding && effectiveSyntax === "dollar" ? /^\$\{([#$]?\s*[\p{L}\p{N}_][\p{L}\p{N}_.\[\]-]*)\}$/u : /^(?:\$|#)\{([#$]?\s*[\p{L}\p{N}_][\p{L}\p{N}_.\[\]-]*)\}$/u;
|
|
756
844
|
const currentExprMatch = typeof activeCell?.v === "string" ? activeCell.v.trim().match(singleExprRe) : null;
|
|
@@ -2160,7 +2248,9 @@ var SheetInspectorPanel = () => {
|
|
|
2160
2248
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "ellipse", children: "\u692D\u5706 (Ellipse)" }),
|
|
2161
2249
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "diamond", children: "\u83F1\u5F62 (Diamond)" }),
|
|
2162
2250
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "arrow", children: "\u53F3\u5411\u7BAD\u5934 (Arrow)" }),
|
|
2163
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "callout", children: "\u6807\u6CE8\u6C14\u6CE1 (Callout)" })
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "callout", children: "\u6807\u6CE8\u6C14\u6CE1 (Callout)" }),
|
|
2252
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "line", children: "\u8FDE\u63A5\u76F4\u7EBF (Line)" }),
|
|
2253
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "connector", children: "\u7BAD\u5934\u8FDE\u63A5\u7EBF (Connector)" })
|
|
2164
2254
|
]
|
|
2165
2255
|
}
|
|
2166
2256
|
)
|
|
@@ -2211,7 +2301,8 @@ var SheetInspectorPanel = () => {
|
|
|
2211
2301
|
left: 360,
|
|
2212
2302
|
top: 56,
|
|
2213
2303
|
width: 148,
|
|
2214
|
-
height: 60
|
|
2304
|
+
height: shapeType === "line" || shapeType === "connector" ? 36 : 60,
|
|
2305
|
+
...shapeType === "connector" ? { arrowEnd: true } : {}
|
|
2215
2306
|
}
|
|
2216
2307
|
});
|
|
2217
2308
|
},
|
|
@@ -2493,24 +2584,30 @@ var SheetInspectorPanel = () => {
|
|
|
2493
2584
|
className: "yudao-sheet-btn is-soft-primary",
|
|
2494
2585
|
onClick: () => {
|
|
2495
2586
|
const isSmoothEnabled = chartType.startsWith("line") && (chartSmooth || chartType.endsWith("Smooth"));
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2587
|
+
const newId = `chart-${(0, import_core4.generateRandomId)(5)}`;
|
|
2588
|
+
commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2589
|
+
unitId,
|
|
2590
|
+
chart: {
|
|
2591
|
+
id: newId,
|
|
2592
|
+
sheetId: sheet.getSheetId(),
|
|
2593
|
+
title: chartTitle || "\u4E1A\u52A1\u7EDF\u8BA1\u56FE",
|
|
2594
|
+
chartType,
|
|
2595
|
+
categoryRange: chartCatRange || "B6:B9",
|
|
2596
|
+
valueRange: chartValRange || "F6:F9",
|
|
2597
|
+
smooth: isSmoothEnabled ? true : void 0,
|
|
2598
|
+
showLegend: chartShowLegend,
|
|
2599
|
+
legendPosition: chartShowLegend ? chartLegendPos : "none",
|
|
2600
|
+
trendline: chartTrendline !== "none" ? chartTrendline : void 0,
|
|
2601
|
+
...chartType === "combo" ? { comboLineSeriesIndices: [1], secondarySeriesIndices: [1] } : {},
|
|
2602
|
+
yAxisScale: chartLogScale ? "log" : "linear",
|
|
2603
|
+
threeD: chartThreeD ? { rotX: 15, rotY: 20 } : void 0,
|
|
2604
|
+
left: 520,
|
|
2605
|
+
top: 48 + charts.length * 24,
|
|
2606
|
+
width: 280,
|
|
2607
|
+
height: 175
|
|
2608
|
+
}
|
|
2513
2609
|
});
|
|
2610
|
+
setSelectedChartId(newId);
|
|
2514
2611
|
},
|
|
2515
2612
|
children: "+ \u63D2\u5165\u6D6E\u52A8\u56FE\u8868"
|
|
2516
2613
|
}
|
|
@@ -2549,145 +2646,1213 @@ var SheetInspectorPanel = () => {
|
|
|
2549
2646
|
}
|
|
2550
2647
|
)
|
|
2551
2648
|
] }),
|
|
2552
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
2553
|
-
|
|
2554
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
|
|
2555
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2556
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u884C\u7EF4\u5EA6\u5217" }),
|
|
2557
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("select", { value: pivotRowCol, onChange: (e) => setPivotRowCol(Number(e.target.value)), children: [0, 1, 2, 3, 4, 5].map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("option", { value: c, children: [
|
|
2558
|
-
(0, import_univer_sheets2.colIndexToLetter)(c),
|
|
2559
|
-
" \u5217"
|
|
2560
|
-
] }, c)) })
|
|
2561
|
-
] }),
|
|
2562
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2563
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5217\u7EF4\u5EA6\uFF08\u53EF\u9009\u4EA4\u53C9\uFF09" }),
|
|
2564
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("select", { value: pivotColCol, onChange: (e) => setPivotColCol(Number(e.target.value)), children: [
|
|
2565
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: -1, children: "\u65E0\uFF08\u4E00\u7EF4\u6C47\u603B\uFF09" }),
|
|
2566
|
-
[0, 1, 2, 3, 4, 5].map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("option", { value: c, children: [
|
|
2567
|
-
(0, import_univer_sheets2.colIndexToLetter)(c),
|
|
2568
|
-
" \u5217"
|
|
2569
|
-
] }, c))
|
|
2570
|
-
] })
|
|
2571
|
-
] }),
|
|
2572
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2573
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u7EDF\u8BA1\u6570\u503C\u5217" }),
|
|
2574
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("select", { value: pivotValCol, onChange: (e) => setPivotValCol(Number(e.target.value)), children: [0, 1, 2, 3, 4, 5, 6].map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("option", { value: c, children: [
|
|
2575
|
-
(0, import_univer_sheets2.colIndexToLetter)(c),
|
|
2576
|
-
" \u5217"
|
|
2577
|
-
] }, c)) })
|
|
2578
|
-
] }),
|
|
2579
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2580
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u805A\u5408\u51FD\u6570 (11 \u79CD)" }),
|
|
2581
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2582
|
-
"select",
|
|
2583
|
-
{
|
|
2584
|
-
value: pivotAgg,
|
|
2585
|
-
onChange: (e) => setPivotAgg(e.target.value),
|
|
2586
|
-
children: [
|
|
2587
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "SUM", children: "\u6C42\u548C (SUM)" }),
|
|
2588
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "COUNT", children: "\u6570\u503C\u8BA1\u6570 (COUNT)" }),
|
|
2589
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "COUNTA", children: "\u975E\u7A7A\u8BA1\u6570 (COUNTA)" }),
|
|
2590
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "AVG", children: "\u5747\u503C (AVG)" }),
|
|
2591
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "MAX", children: "\u6700\u5927\u503C (MAX)" }),
|
|
2592
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "MIN", children: "\u6700\u5C0F\u503C (MIN)" }),
|
|
2593
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "PRODUCT", children: "\u4E58\u79EF (PRODUCT)" }),
|
|
2594
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "STDEV", children: "\u6837\u672C\u6807\u51C6\u5DEE (STDEV)" }),
|
|
2595
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "STDEVP", children: "\u603B\u4F53\u6807\u51C6\u5DEE (STDEVP)" }),
|
|
2596
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "VAR", children: "\u6837\u672C\u65B9\u5DEE (VAR)" }),
|
|
2597
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "VARP", children: "\u603B\u4F53\u65B9\u5DEE (VARP)" })
|
|
2598
|
-
]
|
|
2599
|
-
}
|
|
2600
|
-
)
|
|
2601
|
-
] }),
|
|
2602
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2603
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u503C\u663E\u793A\u65B9\u5F0F" }),
|
|
2604
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2605
|
-
"select",
|
|
2606
|
-
{
|
|
2607
|
-
value: pivotShowAs,
|
|
2608
|
-
onChange: (e) => setPivotShowAs(e.target.value),
|
|
2609
|
-
children: [
|
|
2610
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "normal", children: "\u5E38\u89C4\u6C47\u603B\u503C" }),
|
|
2611
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "percentOfGrandTotal", children: "\u5360\u603B\u8BA1\u767E\u5206\u6BD4" }),
|
|
2612
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "percentOfRow", children: "\u5360\u884C\u6C47\u603B\u767E\u5206\u6BD4" }),
|
|
2613
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "percentOfColumn", children: "\u5360\u5217\u6C47\u603B\u767E\u5206\u6BD4" }),
|
|
2614
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "runningTotal", children: "\u6309\u5217\u7D2F\u8BA1\u503C" }),
|
|
2615
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "rankDesc", children: "\u964D\u5E8F\u6392\u540D" })
|
|
2616
|
-
]
|
|
2617
|
-
}
|
|
2618
|
-
)
|
|
2619
|
-
] }),
|
|
2620
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2621
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u884C\u7EF4\u5EA6\u65E5\u671F\u5206\u7EC4" }),
|
|
2622
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2623
|
-
"select",
|
|
2624
|
-
{
|
|
2625
|
-
value: pivotDateGroup,
|
|
2626
|
-
onChange: (e) => setPivotDateGroup(e.target.value),
|
|
2627
|
-
children: [
|
|
2628
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "\u4E0D\u6309\u65E5\u671F\u5206\u7EC4" }),
|
|
2629
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "year", children: "\u6309\u5E74\u4EFD (YYYY\u5E74)" }),
|
|
2630
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "quarter", children: "\u6309\u5B63\u5EA6 (YYYY-QN)" }),
|
|
2631
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "month", children: "\u6309\u6708\u4EFD (YYYY-MM)" })
|
|
2632
|
-
]
|
|
2633
|
-
}
|
|
2634
|
-
)
|
|
2635
|
-
] })
|
|
2636
|
-
] }),
|
|
2637
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer", fontSize: 11.5 }, children: [
|
|
2638
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2639
|
-
"input",
|
|
2640
|
-
{
|
|
2641
|
-
type: "checkbox",
|
|
2642
|
-
checked: withPivotChart,
|
|
2643
|
-
onChange: (e) => setWithPivotChart(e.target.checked)
|
|
2644
|
-
}
|
|
2645
|
-
),
|
|
2646
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u540C\u6B65\u751F\u6210\u900F\u89C6\u8054\u52A8\u56FE\u8868 (Pivot Chart)" })
|
|
2647
|
-
] }),
|
|
2648
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2649
|
-
"button",
|
|
2649
|
+
editingChart && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2650
|
+
"div",
|
|
2650
2651
|
{
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
valueShowAs: pivotShowAs,
|
|
2662
|
-
...pivotDateGroup ? { dateGroupBy: pivotDateGroup } : {},
|
|
2663
|
-
showSubtotals: true,
|
|
2664
|
-
withPivotChart,
|
|
2665
|
-
pivotChartType: chartType
|
|
2666
|
-
}
|
|
2667
|
-
}),
|
|
2652
|
+
"data-testid": "yudao-chart-inspector",
|
|
2653
|
+
style: {
|
|
2654
|
+
display: "flex",
|
|
2655
|
+
flexDirection: "column",
|
|
2656
|
+
gap: 6,
|
|
2657
|
+
padding: "7px 8px",
|
|
2658
|
+
borderRadius: 6,
|
|
2659
|
+
background: "#F9FAFB",
|
|
2660
|
+
border: "1px solid #E3E5EA"
|
|
2661
|
+
},
|
|
2668
2662
|
children: [
|
|
2669
|
-
"
|
|
2670
|
-
|
|
2663
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 4 }, children: [
|
|
2664
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: 11.5, fontWeight: 600, color: "#1B1C1F" }, children: "\u56FE\u8868\u914D\u7F6E\u5668 (Chart Inspector)" }),
|
|
2665
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2666
|
+
"button",
|
|
2667
|
+
{
|
|
2668
|
+
type: "button",
|
|
2669
|
+
className: "yudao-sheet-btn",
|
|
2670
|
+
style: { padding: "1px 6px", fontSize: 10.5, color: "#DC2626" },
|
|
2671
|
+
onClick: () => {
|
|
2672
|
+
commandService.syncExecuteCommand(import_univer_sheets2.RemoveSheetChartCommand.id, {
|
|
2673
|
+
unitId,
|
|
2674
|
+
chartId: editingChart.id
|
|
2675
|
+
});
|
|
2676
|
+
},
|
|
2677
|
+
children: "\u5220\u9664\u56FE\u8868"
|
|
2678
|
+
}
|
|
2679
|
+
)
|
|
2680
|
+
] }),
|
|
2681
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2682
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u9009\u62E9\u5DF2\u6709\u56FE\u8868" }),
|
|
2683
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2684
|
+
"select",
|
|
2685
|
+
{
|
|
2686
|
+
"data-testid": "yudao-chart-inspector-select",
|
|
2687
|
+
value: editingChart.id,
|
|
2688
|
+
onChange: (e) => setSelectedChartId(e.target.value),
|
|
2689
|
+
children: charts.map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("option", { value: c.id, children: [
|
|
2690
|
+
c.title || c.id,
|
|
2691
|
+
" (",
|
|
2692
|
+
c.chartType,
|
|
2693
|
+
c.pivotId ? " \xB7 \u900F\u89C6\u56FE" : "",
|
|
2694
|
+
")"
|
|
2695
|
+
] }, c.id))
|
|
2696
|
+
}
|
|
2697
|
+
)
|
|
2698
|
+
] }),
|
|
2699
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1.15fr 0.85fr", gap: 4 }, children: [
|
|
2700
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2701
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u56FE\u8868\u7C7B\u578B" }),
|
|
2702
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2703
|
+
"select",
|
|
2704
|
+
{
|
|
2705
|
+
"data-testid": "yudao-chart-inspector-type",
|
|
2706
|
+
value: editingChart.chartType,
|
|
2707
|
+
onChange: (e) => {
|
|
2708
|
+
const nextType = e.target.value;
|
|
2709
|
+
commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2710
|
+
unitId,
|
|
2711
|
+
chart: {
|
|
2712
|
+
...editingChart,
|
|
2713
|
+
chartType: nextType,
|
|
2714
|
+
...nextType === "combo" && !editingChart.comboLineSeriesIndices?.length ? {
|
|
2715
|
+
comboLineSeriesIndices: [1],
|
|
2716
|
+
secondarySeriesIndices: editingChart.secondarySeriesIndices?.length ? editingChart.secondarySeriesIndices : [1]
|
|
2717
|
+
} : {}
|
|
2718
|
+
}
|
|
2719
|
+
});
|
|
2720
|
+
},
|
|
2721
|
+
children: import_univer_sheets2.SHEET_CHART_TYPE_GROUPS.map((grp) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("optgroup", { label: grp.label, children: grp.options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: opt.value, children: opt.label }, opt.value)) }, grp.category))
|
|
2722
|
+
}
|
|
2723
|
+
)
|
|
2724
|
+
] }),
|
|
2725
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2726
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u6807\u9898" }),
|
|
2727
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2728
|
+
"input",
|
|
2729
|
+
{
|
|
2730
|
+
type: "text",
|
|
2731
|
+
value: editingChart.title,
|
|
2732
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2733
|
+
unitId,
|
|
2734
|
+
chart: { ...editingChart, title: e.target.value }
|
|
2735
|
+
})
|
|
2736
|
+
}
|
|
2737
|
+
)
|
|
2738
|
+
] })
|
|
2739
|
+
] }),
|
|
2740
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
|
|
2741
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2742
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "X / \u5206\u7C7B\u533A\u95F4" }),
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2744
|
+
"input",
|
|
2745
|
+
{
|
|
2746
|
+
"data-testid": "yudao-chart-inspector-cat-range",
|
|
2747
|
+
type: "text",
|
|
2748
|
+
value: editingChart.categoryRange,
|
|
2749
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2750
|
+
unitId,
|
|
2751
|
+
chart: { ...editingChart, categoryRange: e.target.value }
|
|
2752
|
+
})
|
|
2753
|
+
}
|
|
2754
|
+
)
|
|
2755
|
+
] }),
|
|
2756
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2757
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Y / \u7CFB\u5217\u533A\u95F4" }),
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2759
|
+
"input",
|
|
2760
|
+
{
|
|
2761
|
+
"data-testid": "yudao-chart-inspector-val-range",
|
|
2762
|
+
type: "text",
|
|
2763
|
+
value: editingChart.valueRange,
|
|
2764
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2765
|
+
unitId,
|
|
2766
|
+
chart: { ...editingChart, valueRange: e.target.value }
|
|
2767
|
+
})
|
|
2768
|
+
}
|
|
2769
|
+
)
|
|
2770
|
+
] })
|
|
2771
|
+
] }),
|
|
2772
|
+
(() => {
|
|
2773
|
+
const trObj = typeof editingChart.trendline === "object" && editingChart.trendline ? editingChart.trendline : typeof editingChart.trendline === "string" && editingChart.trendline !== "none" ? {
|
|
2774
|
+
type: editingChart.trendline === "movingAverage" ? "movingAvg" : editingChart.trendline
|
|
2775
|
+
} : void 0;
|
|
2776
|
+
const trType = trObj?.type ?? "none";
|
|
2777
|
+
const errObj = Array.isArray(editingChart.errorBars) ? editingChart.errorBars[0] ? {
|
|
2778
|
+
type: editingChart.errorBars[0].valueType === "fixed" ? "fixedVal" : editingChart.errorBars[0].valueType === "stdev" ? "stdDev" : "percentage",
|
|
2779
|
+
value: editingChart.errorBars[0].value
|
|
2780
|
+
} : void 0 : editingChart.errorBars;
|
|
2781
|
+
const errType = errObj?.type ?? "none";
|
|
2782
|
+
const legVal = editingChart.showLegend === false || editingChart.legendPosition === "none" ? "none" : editingChart.legendPosition === "bottom" || editingChart.legendPosition === "b" ? "b" : editingChart.legendPosition === "top" || editingChart.legendPosition === "t" ? "t" : editingChart.legendPosition === "left" || editingChart.legendPosition === "l" ? "l" : "r";
|
|
2783
|
+
const hasSecondary = (editingChart.secondarySeriesIndices?.length ?? 0) > 0;
|
|
2784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
2785
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
|
|
2786
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2787
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u8D8B\u52BF\u7EBF\u7C7B\u578B" }),
|
|
2788
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2789
|
+
"select",
|
|
2790
|
+
{
|
|
2791
|
+
"data-testid": "yudao-chart-inspector-trendline",
|
|
2792
|
+
value: trType,
|
|
2793
|
+
onChange: (e) => {
|
|
2794
|
+
const val = e.target.value;
|
|
2795
|
+
const nextTr = val === "none" ? void 0 : {
|
|
2796
|
+
type: val,
|
|
2797
|
+
...val === "polynomial" ? { order: trObj?.order ?? 2 } : {},
|
|
2798
|
+
...val === "movingAvg" ? { period: trObj?.period ?? 2 } : {},
|
|
2799
|
+
displayEquation: trObj?.displayEquation,
|
|
2800
|
+
displayRSqr: trObj?.displayRSqr
|
|
2801
|
+
};
|
|
2802
|
+
commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2803
|
+
unitId,
|
|
2804
|
+
chart: { ...editingChart, trendline: nextTr }
|
|
2805
|
+
});
|
|
2806
|
+
},
|
|
2807
|
+
children: [
|
|
2808
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "none", children: "\u65E0\u8D8B\u52BF\u7EBF" }),
|
|
2809
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "linear", children: "\u7EBF\u6027 (Linear)" }),
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "exponential", children: "\u6307\u6570 (Exponential)" }),
|
|
2811
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "polynomial", children: "\u591A\u9879\u5F0F (Polynomial)" }),
|
|
2812
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "movingAvg", children: "\u79FB\u52A8\u5E73\u5747 (MovingAvg)" })
|
|
2813
|
+
]
|
|
2814
|
+
}
|
|
2815
|
+
)
|
|
2816
|
+
] }),
|
|
2817
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2818
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u8BEF\u5DEE\u7EBF (Error Bars)" }),
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2820
|
+
"select",
|
|
2821
|
+
{
|
|
2822
|
+
"data-testid": "yudao-chart-inspector-errbars",
|
|
2823
|
+
value: errType,
|
|
2824
|
+
onChange: (e) => {
|
|
2825
|
+
const val = e.target.value;
|
|
2826
|
+
commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2827
|
+
unitId,
|
|
2828
|
+
chart: {
|
|
2829
|
+
...editingChart,
|
|
2830
|
+
errorBars: val === "none" ? void 0 : {
|
|
2831
|
+
type: val,
|
|
2832
|
+
value: errObj?.value ?? (val === "percentage" ? 10 : val === "fixedVal" ? 5 : 1)
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
});
|
|
2836
|
+
},
|
|
2837
|
+
children: [
|
|
2838
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "none", children: "\u65E0\u8BEF\u5DEE\u7EBF" }),
|
|
2839
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "percentage", children: "\u767E\u5206\u6BD4 (%)" }),
|
|
2840
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "fixedVal", children: "\u56FA\u5B9A\u503C (Fixed)" }),
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "stdDev", children: "\u6807\u51C6\u5DEE (StdDev)" })
|
|
2842
|
+
]
|
|
2843
|
+
}
|
|
2844
|
+
)
|
|
2845
|
+
] })
|
|
2846
|
+
] }),
|
|
2847
|
+
(trType === "polynomial" || trType === "movingAvg" || errType !== "none") && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
|
|
2848
|
+
trType === "polynomial" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2849
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u591A\u9879\u5F0F\u9636\u6570 (2-6)" }),
|
|
2850
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2851
|
+
"input",
|
|
2852
|
+
{
|
|
2853
|
+
type: "number",
|
|
2854
|
+
min: 2,
|
|
2855
|
+
max: 6,
|
|
2856
|
+
value: trObj?.order ?? 2,
|
|
2857
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2858
|
+
unitId,
|
|
2859
|
+
chart: {
|
|
2860
|
+
...editingChart,
|
|
2861
|
+
trendline: {
|
|
2862
|
+
...trObj,
|
|
2863
|
+
order: Math.max(2, Math.min(6, Number(e.target.value) || 2))
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
})
|
|
2867
|
+
}
|
|
2868
|
+
)
|
|
2869
|
+
] }),
|
|
2870
|
+
trType === "movingAvg" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2871
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u79FB\u52A8\u5E73\u5747\u5468\u671F" }),
|
|
2872
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2873
|
+
"input",
|
|
2874
|
+
{
|
|
2875
|
+
type: "number",
|
|
2876
|
+
min: 2,
|
|
2877
|
+
max: 12,
|
|
2878
|
+
value: trObj?.period ?? 2,
|
|
2879
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2880
|
+
unitId,
|
|
2881
|
+
chart: {
|
|
2882
|
+
...editingChart,
|
|
2883
|
+
trendline: {
|
|
2884
|
+
...trObj,
|
|
2885
|
+
period: Math.max(2, Math.min(12, Number(e.target.value) || 2))
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
})
|
|
2889
|
+
}
|
|
2890
|
+
)
|
|
2891
|
+
] }),
|
|
2892
|
+
errType !== "none" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u8BEF\u5DEE\u6570\u503C" }),
|
|
2894
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2895
|
+
"input",
|
|
2896
|
+
{
|
|
2897
|
+
type: "number",
|
|
2898
|
+
min: 0,
|
|
2899
|
+
step: "0.5",
|
|
2900
|
+
value: errObj?.value ?? 10,
|
|
2901
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2902
|
+
unitId,
|
|
2903
|
+
chart: {
|
|
2904
|
+
...editingChart,
|
|
2905
|
+
errorBars: {
|
|
2906
|
+
type: errType,
|
|
2907
|
+
value: Math.max(0, Number(e.target.value) || 0)
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
})
|
|
2911
|
+
}
|
|
2912
|
+
)
|
|
2913
|
+
] })
|
|
2914
|
+
] }),
|
|
2915
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr auto", gap: 6, alignItems: "end" }, children: [
|
|
2916
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2917
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u56FE\u4F8B\u4F4D\u7F6E" }),
|
|
2918
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2919
|
+
"select",
|
|
2920
|
+
{
|
|
2921
|
+
"data-testid": "yudao-chart-inspector-legend",
|
|
2922
|
+
value: legVal,
|
|
2923
|
+
onChange: (e) => {
|
|
2924
|
+
const nextPos = e.target.value;
|
|
2925
|
+
commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2926
|
+
unitId,
|
|
2927
|
+
chart: {
|
|
2928
|
+
...editingChart,
|
|
2929
|
+
showLegend: nextPos !== "none",
|
|
2930
|
+
legendPosition: nextPos
|
|
2931
|
+
}
|
|
2932
|
+
});
|
|
2933
|
+
},
|
|
2934
|
+
children: [
|
|
2935
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "r", children: "\u53F3\u4FA7 (Right)" }),
|
|
2936
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "t", children: "\u9876\u90E8 (Top)" }),
|
|
2937
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "b", children: "\u5E95\u90E8 (Bottom)" }),
|
|
2938
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "l", children: "\u5DE6\u4FA7 (Left)" }),
|
|
2939
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "none", children: "\u9690\u85CF\u56FE\u4F8B (None)" })
|
|
2940
|
+
]
|
|
2941
|
+
}
|
|
2942
|
+
)
|
|
2943
|
+
] }),
|
|
2944
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
2945
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u4E3B\u8272" }),
|
|
2946
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2947
|
+
"input",
|
|
2948
|
+
{
|
|
2949
|
+
type: "color",
|
|
2950
|
+
style: { width: 38, height: 25, padding: 1 },
|
|
2951
|
+
value: editingChart.palette?.[0] ?? "#2C53F1",
|
|
2952
|
+
onChange: (e) => {
|
|
2953
|
+
const rest = editingChart.palette?.slice(1) ?? [
|
|
2954
|
+
"#10B981",
|
|
2955
|
+
"#F59E0B",
|
|
2956
|
+
"#EF4444",
|
|
2957
|
+
"#8B5CF6"
|
|
2958
|
+
];
|
|
2959
|
+
commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2960
|
+
unitId,
|
|
2961
|
+
chart: {
|
|
2962
|
+
...editingChart,
|
|
2963
|
+
palette: [e.target.value, ...rest]
|
|
2964
|
+
}
|
|
2965
|
+
});
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
)
|
|
2969
|
+
] })
|
|
2970
|
+
] }),
|
|
2971
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 10, fontSize: 11, color: "#31363F" }, children: [
|
|
2972
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" }, children: [
|
|
2973
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2974
|
+
"input",
|
|
2975
|
+
{
|
|
2976
|
+
"data-testid": "yudao-chart-inspector-secondary-axis",
|
|
2977
|
+
type: "checkbox",
|
|
2978
|
+
checked: hasSecondary,
|
|
2979
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
2980
|
+
unitId,
|
|
2981
|
+
chart: {
|
|
2982
|
+
...editingChart,
|
|
2983
|
+
secondarySeriesIndices: e.target.checked ? [1] : void 0,
|
|
2984
|
+
...e.target.checked && editingChart.chartType === "combo" ? {
|
|
2985
|
+
comboLineSeriesIndices: editingChart.comboLineSeriesIndices?.length ? editingChart.comboLineSeriesIndices : [1]
|
|
2986
|
+
} : {}
|
|
2987
|
+
}
|
|
2988
|
+
})
|
|
2989
|
+
}
|
|
2990
|
+
),
|
|
2991
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u53CC\u8F74\u6B21\u5750\u6807\u8F74 (\u53F3\u4FA7\u8F74)" })
|
|
2992
|
+
] }),
|
|
2993
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" }, children: [
|
|
2994
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2995
|
+
"input",
|
|
2996
|
+
{
|
|
2997
|
+
type: "checkbox",
|
|
2998
|
+
checked: Boolean(editingChart.showDataLabels || editingChart.dataLabels?.showVal),
|
|
2999
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
3000
|
+
unitId,
|
|
3001
|
+
chart: {
|
|
3002
|
+
...editingChart,
|
|
3003
|
+
showDataLabels: e.target.checked,
|
|
3004
|
+
dataLabels: {
|
|
3005
|
+
...editingChart.dataLabels,
|
|
3006
|
+
showVal: e.target.checked
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
3009
|
+
})
|
|
3010
|
+
}
|
|
3011
|
+
),
|
|
3012
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u663E\u793A\u6570\u636E\u6807\u7B7E" })
|
|
3013
|
+
] }),
|
|
3014
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" }, children: [
|
|
3015
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3016
|
+
"input",
|
|
3017
|
+
{
|
|
3018
|
+
type: "checkbox",
|
|
3019
|
+
checked: Boolean(editingChart.smooth),
|
|
3020
|
+
onChange: (e) => commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
3021
|
+
unitId,
|
|
3022
|
+
chart: { ...editingChart, smooth: e.target.checked }
|
|
3023
|
+
})
|
|
3024
|
+
}
|
|
3025
|
+
),
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5E73\u6ED1\u66F2\u7EBF" })
|
|
3027
|
+
] })
|
|
3028
|
+
] })
|
|
3029
|
+
] });
|
|
3030
|
+
})()
|
|
2671
3031
|
]
|
|
2672
3032
|
}
|
|
2673
3033
|
),
|
|
2674
3034
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("hr", { style: { border: "none", borderTop: "1px solid #E3E5EA", margin: "4px 0" } }),
|
|
2675
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
{
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
3035
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3036
|
+
"div",
|
|
3037
|
+
{
|
|
3038
|
+
"data-testid": "yudao-pivot-configurator",
|
|
3039
|
+
style: { display: "flex", flexDirection: "column", gap: 6 },
|
|
3040
|
+
children: [
|
|
3041
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 4 }, children: [
|
|
3042
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: 11.5, fontWeight: 600, color: "#1B1C1F" }, children: "\u56DB\u8C61\u9650\u6570\u636E\u900F\u89C6\u8868\u914D\u7F6E\u9762\u677F" }),
|
|
3043
|
+
pivots.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3044
|
+
"span",
|
|
3045
|
+
{
|
|
3046
|
+
style: {
|
|
3047
|
+
fontSize: 10,
|
|
3048
|
+
padding: "1px 6px",
|
|
3049
|
+
borderRadius: 999,
|
|
3050
|
+
background: "#EEF2FF",
|
|
3051
|
+
color: "#2C53F1"
|
|
3052
|
+
},
|
|
3053
|
+
children: [
|
|
3054
|
+
pivots.length,
|
|
3055
|
+
" \u4E2A\u900F\u89C6\u8868"
|
|
3056
|
+
]
|
|
3057
|
+
}
|
|
3058
|
+
)
|
|
3059
|
+
] }),
|
|
3060
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
|
|
3061
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u900F\u89C6\u8868\u5B9E\u4F8B" }),
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3064
|
+
"select",
|
|
3065
|
+
{
|
|
3066
|
+
"data-testid": "yudao-pivot-instance-select",
|
|
3067
|
+
value: activePivot ? activePivot.id : "__new__",
|
|
3068
|
+
onChange: (e) => {
|
|
3069
|
+
const nextId = e.target.value;
|
|
3070
|
+
setSelectedPivotId(nextId);
|
|
3071
|
+
const found = pivots.find((p) => p.id === nextId);
|
|
3072
|
+
if (found) {
|
|
3073
|
+
setPivotSourceRange(found.sourceRange ?? "");
|
|
3074
|
+
const rows = (found.rowFields ?? found.rowDimCols ?? []).map(
|
|
3075
|
+
(f) => resolvePivotFieldCol(f, 0)
|
|
3076
|
+
);
|
|
3077
|
+
const cols = (found.columnFields ?? found.colDimCols ?? []).map(
|
|
3078
|
+
(f) => resolvePivotFieldCol(f, 0)
|
|
3079
|
+
);
|
|
3080
|
+
const vals = found.valueFields && found.valueFields.length > 0 ? found.valueFields.map((vf) => ({
|
|
3081
|
+
...vf,
|
|
3082
|
+
colIndex: resolvePivotFieldCol(vf.colIndex ?? vf.field, 0)
|
|
3083
|
+
})) : [{ colIndex: found.valueCol ?? 0, aggFunc: found.aggFunc ?? "SUM" }];
|
|
3084
|
+
setPivotRowFields(rows);
|
|
3085
|
+
setPivotColFields(cols);
|
|
3086
|
+
setPivotValueFields(vals);
|
|
3087
|
+
setPivotFilterFields(
|
|
3088
|
+
(found.filterFields ?? []).map((ff) => ({
|
|
3089
|
+
...ff,
|
|
3090
|
+
colIndex: resolvePivotFieldCol(ff.colIndex ?? ff.field, 0)
|
|
3091
|
+
}))
|
|
3092
|
+
);
|
|
3093
|
+
setPivotCalcFields(found.calculatedFields ?? []);
|
|
3094
|
+
if (rows[0] !== void 0) setPivotRowCol(rows[0]);
|
|
3095
|
+
setPivotColCol(cols[0] ?? -1);
|
|
3096
|
+
if (vals[0]) {
|
|
3097
|
+
setPivotValCol(resolvePivotFieldCol(vals[0].colIndex ?? vals[0].field, 0));
|
|
3098
|
+
setPivotAgg(vals[0].aggFunc);
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
},
|
|
3102
|
+
children: [
|
|
3103
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "__new__", children: "+ \u65B0\u5EFA\u6570\u636E\u900F\u89C6\u8868" }),
|
|
3104
|
+
pivots.map((p, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: p.id ?? `__idx_${idx}`, children: p.name || p.targetSheetName || `PivotTable${idx + 1}` }, p.id ?? idx))
|
|
3105
|
+
]
|
|
3106
|
+
}
|
|
3107
|
+
)
|
|
3108
|
+
] }),
|
|
3109
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
3110
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u6570\u636E\u6E90\u533A\u95F4 (\u53EF\u9009)" }),
|
|
3111
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3112
|
+
"input",
|
|
3113
|
+
{
|
|
3114
|
+
type: "text",
|
|
3115
|
+
placeholder: "\u9ED8\u8BA4\u6574\u8868\u5982 A1:F20",
|
|
3116
|
+
value: pivotSourceRange,
|
|
3117
|
+
onChange: (e) => setPivotSourceRange(e.target.value)
|
|
3118
|
+
}
|
|
3119
|
+
)
|
|
3120
|
+
] })
|
|
3121
|
+
] }),
|
|
3122
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3123
|
+
"div",
|
|
3124
|
+
{
|
|
3125
|
+
style: {
|
|
3126
|
+
padding: "5px 6px",
|
|
3127
|
+
borderRadius: 6,
|
|
3128
|
+
background: "#F8FAFC",
|
|
3129
|
+
border: "1px solid #E2E8F0",
|
|
3130
|
+
display: "flex",
|
|
3131
|
+
flexDirection: "column",
|
|
3132
|
+
gap: 4
|
|
3133
|
+
},
|
|
3134
|
+
children: [
|
|
3135
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 4 }, children: [
|
|
3136
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: 10.5, fontWeight: 600, color: "#475569" }, children: "\u6E90\u5B57\u6BB5\u5217\u8868\uFF08\u70B9\u51FB\u6DFB\u52A0\u81F3\uFF1A" }),
|
|
3137
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { display: "flex", gap: 2 }, children: [
|
|
3138
|
+
{ key: "rows", label: "\u884C" },
|
|
3139
|
+
{ key: "cols", label: "\u5217" },
|
|
3140
|
+
{ key: "values", label: "\u503C" },
|
|
3141
|
+
{ key: "filters", label: "\u7B5B\u9009" }
|
|
3142
|
+
].map((q) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3143
|
+
"button",
|
|
3144
|
+
{
|
|
3145
|
+
type: "button",
|
|
3146
|
+
onClick: () => setPivotChipTarget(q.key),
|
|
3147
|
+
style: {
|
|
3148
|
+
fontSize: 10,
|
|
3149
|
+
padding: "1px 5px",
|
|
3150
|
+
borderRadius: 4,
|
|
3151
|
+
border: "1px solid",
|
|
3152
|
+
borderColor: pivotChipTarget === q.key ? "#2C53F1" : "#CBD5E1",
|
|
3153
|
+
background: pivotChipTarget === q.key ? "#EEF2FF" : "#FFFFFF",
|
|
3154
|
+
color: pivotChipTarget === q.key ? "#2C53F1" : "#475569",
|
|
3155
|
+
cursor: "pointer"
|
|
3156
|
+
},
|
|
3157
|
+
children: q.label
|
|
3158
|
+
},
|
|
3159
|
+
q.key
|
|
3160
|
+
)) })
|
|
3161
|
+
] }),
|
|
3162
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 4 }, children: pivotSourceColumns.map((col) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3163
|
+
"button",
|
|
3164
|
+
{
|
|
3165
|
+
type: "button",
|
|
3166
|
+
onClick: () => {
|
|
3167
|
+
if (pivotChipTarget === "rows") {
|
|
3168
|
+
if (!pivotRowFields.includes(col.colIndex)) {
|
|
3169
|
+
const next = [...pivotRowFields, col.colIndex];
|
|
3170
|
+
setPivotRowFields(next);
|
|
3171
|
+
setPivotRowCol(next[0]);
|
|
3172
|
+
}
|
|
3173
|
+
} else if (pivotChipTarget === "cols") {
|
|
3174
|
+
if (!pivotColFields.includes(col.colIndex)) {
|
|
3175
|
+
const next = [...pivotColFields, col.colIndex];
|
|
3176
|
+
setPivotColFields(next);
|
|
3177
|
+
setPivotColCol(next[0]);
|
|
3178
|
+
}
|
|
3179
|
+
} else if (pivotChipTarget === "values") {
|
|
3180
|
+
const next = [
|
|
3181
|
+
...pivotValueFields,
|
|
3182
|
+
{ colIndex: col.colIndex, aggFunc: "sum" }
|
|
3183
|
+
];
|
|
3184
|
+
setPivotValueFields(next);
|
|
3185
|
+
setPivotValCol(col.colIndex);
|
|
3186
|
+
} else if (!pivotFilterFields.some((f) => f.colIndex === col.colIndex)) {
|
|
3187
|
+
setPivotFilterFields([...pivotFilterFields, { colIndex: col.colIndex }]);
|
|
3188
|
+
}
|
|
3189
|
+
},
|
|
3190
|
+
style: {
|
|
3191
|
+
fontSize: 10.5,
|
|
3192
|
+
padding: "2px 6px",
|
|
3193
|
+
borderRadius: 999,
|
|
3194
|
+
border: "1px solid #CBD5E1",
|
|
3195
|
+
background: "#FFFFFF",
|
|
3196
|
+
color: "#1E293B",
|
|
3197
|
+
cursor: "pointer"
|
|
3198
|
+
},
|
|
3199
|
+
children: [
|
|
3200
|
+
"+ ",
|
|
3201
|
+
col.label
|
|
3202
|
+
]
|
|
3203
|
+
},
|
|
3204
|
+
col.colIndex
|
|
3205
|
+
)) })
|
|
3206
|
+
]
|
|
3207
|
+
}
|
|
3208
|
+
),
|
|
3209
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3210
|
+
"div",
|
|
3211
|
+
{
|
|
3212
|
+
"data-testid": "yudao-pivot-quadrants",
|
|
3213
|
+
style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 5 },
|
|
3214
|
+
children: [
|
|
3215
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3216
|
+
"div",
|
|
3217
|
+
{
|
|
3218
|
+
style: {
|
|
3219
|
+
padding: "5px 6px",
|
|
3220
|
+
borderRadius: 6,
|
|
3221
|
+
border: "1px solid #E2E8F0",
|
|
3222
|
+
background: "#FFFFFF",
|
|
3223
|
+
display: "flex",
|
|
3224
|
+
flexDirection: "column",
|
|
3225
|
+
gap: 4,
|
|
3226
|
+
minHeight: 74
|
|
3227
|
+
},
|
|
3228
|
+
children: [
|
|
3229
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: 10.5, fontWeight: 600, color: "#334155" }, children: "\u7B5B\u9009\u5668 (Filters)" }),
|
|
3231
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3232
|
+
"select",
|
|
3233
|
+
{
|
|
3234
|
+
value: "",
|
|
3235
|
+
style: { fontSize: 10, padding: "0 2px", maxWidth: 68 },
|
|
3236
|
+
onChange: (e) => {
|
|
3237
|
+
if (e.target.value === "") return;
|
|
3238
|
+
const c = Number(e.target.value);
|
|
3239
|
+
if (!pivotFilterFields.some((f) => f.colIndex === c)) {
|
|
3240
|
+
setPivotFilterFields([...pivotFilterFields, { colIndex: c }]);
|
|
3241
|
+
}
|
|
3242
|
+
},
|
|
3243
|
+
children: [
|
|
3244
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "+ \u5B57\u6BB5" }),
|
|
3245
|
+
pivotSourceColumns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: c.colIndex, children: c.label }, c.colIndex))
|
|
3246
|
+
]
|
|
3247
|
+
}
|
|
3248
|
+
)
|
|
3249
|
+
] }),
|
|
3250
|
+
pivotFilterFields.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: 10, color: "#94A3B8" }, children: "\u672A\u8BBE\u7F6E\u62A5\u8868\u7B5B\u9009" }),
|
|
3251
|
+
pivotFilterFields.map((ff, ffIdx) => {
|
|
3252
|
+
const ffCol = resolvePivotFieldCol(ff.colIndex ?? ff.field, 0);
|
|
3253
|
+
const choices = getPivotFilterChoices(ffCol);
|
|
3254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3255
|
+
"div",
|
|
3256
|
+
{
|
|
3257
|
+
style: {
|
|
3258
|
+
display: "flex",
|
|
3259
|
+
flexDirection: "column",
|
|
3260
|
+
gap: 2,
|
|
3261
|
+
padding: "3px 4px",
|
|
3262
|
+
borderRadius: 4,
|
|
3263
|
+
background: "#F8FAFC",
|
|
3264
|
+
fontSize: 10
|
|
3265
|
+
},
|
|
3266
|
+
children: [
|
|
3267
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
|
|
3268
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontWeight: 500, color: "#1E293B" }, children: getPivotColumnLabel(ffCol) }),
|
|
3269
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3270
|
+
"button",
|
|
3271
|
+
{
|
|
3272
|
+
type: "button",
|
|
3273
|
+
onClick: () => setPivotFilterFields(
|
|
3274
|
+
pivotFilterFields.filter((_, idx) => idx !== ffIdx)
|
|
3275
|
+
),
|
|
3276
|
+
style: {
|
|
3277
|
+
border: "none",
|
|
3278
|
+
background: "transparent",
|
|
3279
|
+
color: "#64748B",
|
|
3280
|
+
cursor: "pointer",
|
|
3281
|
+
fontSize: 11,
|
|
3282
|
+
padding: "0 2px"
|
|
3283
|
+
},
|
|
3284
|
+
children: "\xD7"
|
|
3285
|
+
}
|
|
3286
|
+
)
|
|
3287
|
+
] }),
|
|
3288
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3289
|
+
"select",
|
|
3290
|
+
{
|
|
3291
|
+
value: ff.selectedValues?.length === 1 ? ff.selectedValues[0] : "__all__",
|
|
3292
|
+
style: { fontSize: 10, padding: "1px 2px" },
|
|
3293
|
+
onChange: (e) => {
|
|
3294
|
+
const v = e.target.value;
|
|
3295
|
+
setPivotFilterFields(
|
|
3296
|
+
pivotFilterFields.map(
|
|
3297
|
+
(item, idx) => idx === ffIdx ? { ...item, selectedValues: v === "__all__" ? void 0 : [v] } : item
|
|
3298
|
+
)
|
|
3299
|
+
);
|
|
3300
|
+
},
|
|
3301
|
+
children: [
|
|
3302
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "__all__", children: "(\u5168\u90E8\u503C)" }),
|
|
3303
|
+
choices.map((val) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: val, children: val }, val))
|
|
3304
|
+
]
|
|
3305
|
+
}
|
|
3306
|
+
)
|
|
3307
|
+
]
|
|
3308
|
+
},
|
|
3309
|
+
`${ffCol}-${ffIdx}`
|
|
3310
|
+
);
|
|
3311
|
+
})
|
|
3312
|
+
]
|
|
3313
|
+
}
|
|
3314
|
+
),
|
|
3315
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3316
|
+
"div",
|
|
3317
|
+
{
|
|
3318
|
+
style: {
|
|
3319
|
+
padding: "5px 6px",
|
|
3320
|
+
borderRadius: 6,
|
|
3321
|
+
border: "1px solid #E2E8F0",
|
|
3322
|
+
background: "#FFFFFF",
|
|
3323
|
+
display: "flex",
|
|
3324
|
+
flexDirection: "column",
|
|
3325
|
+
gap: 4,
|
|
3326
|
+
minHeight: 74
|
|
3327
|
+
},
|
|
3328
|
+
children: [
|
|
3329
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
3330
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: 10.5, fontWeight: 600, color: "#334155" }, children: "\u5217\u7EF4\u5EA6 (Columns)" }),
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3332
|
+
"select",
|
|
3333
|
+
{
|
|
3334
|
+
value: "",
|
|
3335
|
+
style: { fontSize: 10, padding: "0 2px", maxWidth: 68 },
|
|
3336
|
+
onChange: (e) => {
|
|
3337
|
+
if (e.target.value === "") return;
|
|
3338
|
+
const c = Number(e.target.value);
|
|
3339
|
+
if (!pivotColFields.includes(c)) {
|
|
3340
|
+
const next = [...pivotColFields, c];
|
|
3341
|
+
setPivotColFields(next);
|
|
3342
|
+
setPivotColCol(next[0]);
|
|
3343
|
+
}
|
|
3344
|
+
},
|
|
3345
|
+
children: [
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "+ \u5B57\u6BB5" }),
|
|
3347
|
+
pivotSourceColumns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: c.colIndex, children: c.label }, c.colIndex))
|
|
3348
|
+
]
|
|
3349
|
+
}
|
|
3350
|
+
)
|
|
3351
|
+
] }),
|
|
3352
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 3 }, children: [
|
|
3353
|
+
pivotColFields.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: 10, color: "#94A3B8" }, children: "\u65E0\u4EA4\u53C9\u5217\uFF08\u4E00\u7EF4\u6C47\u603B\uFF09" }),
|
|
3354
|
+
pivotColFields.map((colIdx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3355
|
+
"span",
|
|
3356
|
+
{
|
|
3357
|
+
style: {
|
|
3358
|
+
display: "inline-flex",
|
|
3359
|
+
alignItems: "center",
|
|
3360
|
+
gap: 3,
|
|
3361
|
+
fontSize: 10,
|
|
3362
|
+
padding: "2px 5px",
|
|
3363
|
+
borderRadius: 4,
|
|
3364
|
+
background: "#EEF2FF",
|
|
3365
|
+
color: "#2C53F1"
|
|
3366
|
+
},
|
|
3367
|
+
children: [
|
|
3368
|
+
getPivotColumnLabel(colIdx),
|
|
3369
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3370
|
+
"button",
|
|
3371
|
+
{
|
|
3372
|
+
type: "button",
|
|
3373
|
+
onClick: () => {
|
|
3374
|
+
const next = pivotColFields.filter((x) => x !== colIdx);
|
|
3375
|
+
setPivotColFields(next);
|
|
3376
|
+
setPivotColCol(next[0] ?? -1);
|
|
3377
|
+
},
|
|
3378
|
+
style: {
|
|
3379
|
+
border: "none",
|
|
3380
|
+
background: "transparent",
|
|
3381
|
+
color: "#2C53F1",
|
|
3382
|
+
cursor: "pointer",
|
|
3383
|
+
padding: 0,
|
|
3384
|
+
fontSize: 11
|
|
3385
|
+
},
|
|
3386
|
+
children: "\xD7"
|
|
3387
|
+
}
|
|
3388
|
+
)
|
|
3389
|
+
]
|
|
3390
|
+
},
|
|
3391
|
+
colIdx
|
|
3392
|
+
))
|
|
3393
|
+
] })
|
|
3394
|
+
]
|
|
3395
|
+
}
|
|
3396
|
+
),
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3398
|
+
"div",
|
|
3399
|
+
{
|
|
3400
|
+
style: {
|
|
3401
|
+
padding: "5px 6px",
|
|
3402
|
+
borderRadius: 6,
|
|
3403
|
+
border: "1px solid #E2E8F0",
|
|
3404
|
+
background: "#FFFFFF",
|
|
3405
|
+
display: "flex",
|
|
3406
|
+
flexDirection: "column",
|
|
3407
|
+
gap: 4,
|
|
3408
|
+
minHeight: 74
|
|
3409
|
+
},
|
|
3410
|
+
children: [
|
|
3411
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
3412
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: 10.5, fontWeight: 600, color: "#334155" }, children: "\u884C\u7EF4\u5EA6 (Rows)" }),
|
|
3413
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3414
|
+
"select",
|
|
3415
|
+
{
|
|
3416
|
+
value: "",
|
|
3417
|
+
style: { fontSize: 10, padding: "0 2px", maxWidth: 68 },
|
|
3418
|
+
onChange: (e) => {
|
|
3419
|
+
if (e.target.value === "") return;
|
|
3420
|
+
const c = Number(e.target.value);
|
|
3421
|
+
if (!pivotRowFields.includes(c)) {
|
|
3422
|
+
const next = [...pivotRowFields, c];
|
|
3423
|
+
setPivotRowFields(next);
|
|
3424
|
+
setPivotRowCol(next[0]);
|
|
3425
|
+
}
|
|
3426
|
+
},
|
|
3427
|
+
children: [
|
|
3428
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "+ \u5B57\u6BB5" }),
|
|
3429
|
+
pivotSourceColumns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: c.colIndex, children: c.label }, c.colIndex))
|
|
3430
|
+
]
|
|
3431
|
+
}
|
|
3432
|
+
)
|
|
3433
|
+
] }),
|
|
3434
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 3 }, children: pivotRowFields.map((colIdx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3435
|
+
"span",
|
|
3436
|
+
{
|
|
3437
|
+
style: {
|
|
3438
|
+
display: "inline-flex",
|
|
3439
|
+
alignItems: "center",
|
|
3440
|
+
gap: 3,
|
|
3441
|
+
fontSize: 10,
|
|
3442
|
+
padding: "2px 5px",
|
|
3443
|
+
borderRadius: 4,
|
|
3444
|
+
background: "#ECFDF5",
|
|
3445
|
+
color: "#047857"
|
|
3446
|
+
},
|
|
3447
|
+
children: [
|
|
3448
|
+
getPivotColumnLabel(colIdx),
|
|
3449
|
+
pivotRowFields.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3450
|
+
"button",
|
|
3451
|
+
{
|
|
3452
|
+
type: "button",
|
|
3453
|
+
onClick: () => {
|
|
3454
|
+
const next = pivotRowFields.filter((x) => x !== colIdx);
|
|
3455
|
+
setPivotRowFields(next);
|
|
3456
|
+
if (next[0] !== void 0) setPivotRowCol(next[0]);
|
|
3457
|
+
},
|
|
3458
|
+
style: {
|
|
3459
|
+
border: "none",
|
|
3460
|
+
background: "transparent",
|
|
3461
|
+
color: "#047857",
|
|
3462
|
+
cursor: "pointer",
|
|
3463
|
+
padding: 0,
|
|
3464
|
+
fontSize: 11
|
|
3465
|
+
},
|
|
3466
|
+
children: "\xD7"
|
|
3467
|
+
}
|
|
3468
|
+
)
|
|
3469
|
+
]
|
|
3470
|
+
},
|
|
3471
|
+
colIdx
|
|
3472
|
+
)) })
|
|
3473
|
+
]
|
|
3474
|
+
}
|
|
3475
|
+
),
|
|
3476
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3477
|
+
"div",
|
|
3478
|
+
{
|
|
3479
|
+
style: {
|
|
3480
|
+
padding: "5px 6px",
|
|
3481
|
+
borderRadius: 6,
|
|
3482
|
+
border: "1px solid #E2E8F0",
|
|
3483
|
+
background: "#FFFFFF",
|
|
3484
|
+
display: "flex",
|
|
3485
|
+
flexDirection: "column",
|
|
3486
|
+
gap: 4,
|
|
3487
|
+
minHeight: 74
|
|
3488
|
+
},
|
|
3489
|
+
children: [
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
3491
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: 10.5, fontWeight: 600, color: "#334155" }, children: "\u503C\u6307\u6807 (Values)" }),
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3493
|
+
"select",
|
|
3494
|
+
{
|
|
3495
|
+
value: "",
|
|
3496
|
+
style: { fontSize: 10, padding: "0 2px", maxWidth: 68 },
|
|
3497
|
+
onChange: (e) => {
|
|
3498
|
+
if (e.target.value === "") return;
|
|
3499
|
+
const c = Number(e.target.value);
|
|
3500
|
+
const next = [
|
|
3501
|
+
...pivotValueFields,
|
|
3502
|
+
{ colIndex: c, aggFunc: "sum" }
|
|
3503
|
+
];
|
|
3504
|
+
setPivotValueFields(next);
|
|
3505
|
+
setPivotValCol(c);
|
|
3506
|
+
},
|
|
3507
|
+
children: [
|
|
3508
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "+ \u5B57\u6BB5" }),
|
|
3509
|
+
pivotSourceColumns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: c.colIndex, children: c.label }, c.colIndex))
|
|
3510
|
+
]
|
|
3511
|
+
}
|
|
3512
|
+
)
|
|
3513
|
+
] }),
|
|
3514
|
+
pivotValueFields.map((vf, idx) => {
|
|
3515
|
+
const vfCol = resolvePivotFieldCol(vf.colIndex ?? vf.field, 0);
|
|
3516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3517
|
+
"div",
|
|
3518
|
+
{
|
|
3519
|
+
style: {
|
|
3520
|
+
display: "flex",
|
|
3521
|
+
alignItems: "center",
|
|
3522
|
+
justifyContent: "space-between",
|
|
3523
|
+
gap: 2,
|
|
3524
|
+
padding: "2px 4px",
|
|
3525
|
+
borderRadius: 4,
|
|
3526
|
+
background: "#FFFBEB",
|
|
3527
|
+
fontSize: 10
|
|
3528
|
+
},
|
|
3529
|
+
children: [
|
|
3530
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3531
|
+
"span",
|
|
3532
|
+
{
|
|
3533
|
+
style: {
|
|
3534
|
+
color: "#92400E",
|
|
3535
|
+
fontWeight: 500,
|
|
3536
|
+
overflow: "hidden",
|
|
3537
|
+
textOverflow: "ellipsis",
|
|
3538
|
+
whiteSpace: "nowrap"
|
|
3539
|
+
},
|
|
3540
|
+
children: getPivotColumnLabel(vfCol)
|
|
3541
|
+
}
|
|
3542
|
+
),
|
|
3543
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 2 }, children: [
|
|
3544
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3545
|
+
"select",
|
|
3546
|
+
{
|
|
3547
|
+
value: vf.aggFunc.toLowerCase(),
|
|
3548
|
+
style: { fontSize: 10, padding: "0 2px" },
|
|
3549
|
+
onChange: (e) => {
|
|
3550
|
+
const nextAgg = e.target.value;
|
|
3551
|
+
const next = pivotValueFields.map(
|
|
3552
|
+
(item, i) => i === idx ? { ...item, aggFunc: nextAgg } : item
|
|
3553
|
+
);
|
|
3554
|
+
setPivotValueFields(next);
|
|
3555
|
+
if (idx === 0) setPivotAgg(nextAgg.toUpperCase());
|
|
3556
|
+
},
|
|
3557
|
+
children: [
|
|
3558
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "sum", children: "\u6C42\u548C" }),
|
|
3559
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "count", children: "\u8BA1\u6570" }),
|
|
3560
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "avg", children: "\u5E73\u5747" }),
|
|
3561
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "max", children: "\u6700\u5927" }),
|
|
3562
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "min", children: "\u6700\u5C0F" }),
|
|
3563
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "stdev", children: "\u6807\u51C6\u5DEE" }),
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "var", children: "\u65B9\u5DEE" })
|
|
3565
|
+
]
|
|
3566
|
+
}
|
|
3567
|
+
),
|
|
3568
|
+
pivotValueFields.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3569
|
+
"button",
|
|
3570
|
+
{
|
|
3571
|
+
type: "button",
|
|
3572
|
+
onClick: () => setPivotValueFields(pivotValueFields.filter((_, i) => i !== idx)),
|
|
3573
|
+
style: {
|
|
3574
|
+
border: "none",
|
|
3575
|
+
background: "transparent",
|
|
3576
|
+
color: "#92400E",
|
|
3577
|
+
cursor: "pointer",
|
|
3578
|
+
padding: 0,
|
|
3579
|
+
fontSize: 11
|
|
3580
|
+
},
|
|
3581
|
+
children: "\xD7"
|
|
3582
|
+
}
|
|
3583
|
+
)
|
|
3584
|
+
] })
|
|
3585
|
+
]
|
|
3586
|
+
},
|
|
3587
|
+
`${vfCol}-${idx}`
|
|
3588
|
+
);
|
|
3589
|
+
})
|
|
3590
|
+
]
|
|
3591
|
+
}
|
|
3592
|
+
)
|
|
3593
|
+
]
|
|
3594
|
+
}
|
|
3595
|
+
),
|
|
3596
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
|
|
3597
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
3598
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u503C\u663E\u793A\u65B9\u5F0F" }),
|
|
3599
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3600
|
+
"select",
|
|
3601
|
+
{
|
|
3602
|
+
value: pivotShowAs,
|
|
3603
|
+
onChange: (e) => setPivotShowAs(e.target.value),
|
|
3604
|
+
children: [
|
|
3605
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "normal", children: "\u5E38\u89C4\u6C47\u603B\u503C" }),
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "percentOfGrandTotal", children: "\u5360\u603B\u8BA1\u767E\u5206\u6BD4" }),
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "percentOfRow", children: "\u5360\u884C\u6C47\u603B\u767E\u5206\u6BD4" }),
|
|
3608
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "percentOfColumn", children: "\u5360\u5217\u6C47\u603B\u767E\u5206\u6BD4" }),
|
|
3609
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "runningTotal", children: "\u6309\u5217\u7D2F\u8BA1\u503C" }),
|
|
3610
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "rankDesc", children: "\u964D\u5E8F\u6392\u540D" })
|
|
3611
|
+
]
|
|
3612
|
+
}
|
|
3613
|
+
)
|
|
3614
|
+
] }),
|
|
3615
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
3616
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u884C\u65E5\u671F\u5206\u7EC4" }),
|
|
3617
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3618
|
+
"select",
|
|
3619
|
+
{
|
|
3620
|
+
value: pivotDateGroup,
|
|
3621
|
+
onChange: (e) => setPivotDateGroup(e.target.value),
|
|
3622
|
+
children: [
|
|
3623
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "\u4E0D\u6309\u65E5\u671F\u5206\u7EC4" }),
|
|
3624
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "year", children: "\u6309\u5E74\u4EFD (YYYY\u5E74)" }),
|
|
3625
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "quarter", children: "\u6309\u5B63\u5EA6 (YYYY-QN)" }),
|
|
3626
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "month", children: "\u6309\u6708\u4EFD (YYYY-MM)" })
|
|
3627
|
+
]
|
|
3628
|
+
}
|
|
3629
|
+
)
|
|
3630
|
+
] })
|
|
3631
|
+
] }),
|
|
3632
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3633
|
+
"div",
|
|
3634
|
+
{
|
|
3635
|
+
style: {
|
|
3636
|
+
display: "flex",
|
|
3637
|
+
flexDirection: "column",
|
|
3638
|
+
gap: 4,
|
|
3639
|
+
padding: "5px 6px",
|
|
3640
|
+
borderRadius: 6,
|
|
3641
|
+
background: "#F8FAFC",
|
|
3642
|
+
border: "1px solid #E2E8F0"
|
|
3643
|
+
},
|
|
3644
|
+
children: [
|
|
3645
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { style: { fontSize: 10.5, fontWeight: 600, color: "#334155" }, children: "\u8BA1\u7B97\u5B57\u6BB5 (Calculated Fields)" }),
|
|
3646
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "0.8fr 1.2fr auto", gap: 4 }, children: [
|
|
3647
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3648
|
+
"input",
|
|
3649
|
+
{
|
|
3650
|
+
type: "text",
|
|
3651
|
+
placeholder: "\u540D\u79F0\u5982 \u6BDB\u5229\u7387",
|
|
3652
|
+
style: { fontSize: 10.5, padding: "3px 5px" },
|
|
3653
|
+
value: calcFieldName,
|
|
3654
|
+
onChange: (e) => setCalcFieldName(e.target.value)
|
|
3655
|
+
}
|
|
3656
|
+
),
|
|
3657
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3658
|
+
"input",
|
|
3659
|
+
{
|
|
3660
|
+
type: "text",
|
|
3661
|
+
placeholder: "\u516C\u5F0F\u5982 \u5229\u6DA6 / \u9500\u552E\u989D",
|
|
3662
|
+
style: { fontSize: 10.5, padding: "3px 5px" },
|
|
3663
|
+
value: calcFieldFormula,
|
|
3664
|
+
onChange: (e) => setCalcFieldFormula(e.target.value)
|
|
3665
|
+
}
|
|
3666
|
+
),
|
|
3667
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3668
|
+
"button",
|
|
3669
|
+
{
|
|
3670
|
+
type: "button",
|
|
3671
|
+
className: "yudao-sheet-btn",
|
|
3672
|
+
style: { padding: "2px 6px", fontSize: 10.5 },
|
|
3673
|
+
onClick: () => {
|
|
3674
|
+
const n = calcFieldName.trim();
|
|
3675
|
+
const f = calcFieldFormula.trim();
|
|
3676
|
+
if (!n || !f) return;
|
|
3677
|
+
setPivotCalcFields([
|
|
3678
|
+
...pivotCalcFields.filter((c) => c.name !== n),
|
|
3679
|
+
{ name: n, formula: f }
|
|
3680
|
+
]);
|
|
3681
|
+
setCalcFieldName("");
|
|
3682
|
+
setCalcFieldFormula("");
|
|
3683
|
+
},
|
|
3684
|
+
children: "+ \u6DFB\u52A0"
|
|
3685
|
+
}
|
|
3686
|
+
)
|
|
3687
|
+
] }),
|
|
3688
|
+
pivotCalcFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: 4 }, children: pivotCalcFields.map((cf) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
3689
|
+
"span",
|
|
3690
|
+
{
|
|
3691
|
+
style: {
|
|
3692
|
+
display: "inline-flex",
|
|
3693
|
+
alignItems: "center",
|
|
3694
|
+
gap: 4,
|
|
3695
|
+
fontSize: 10,
|
|
3696
|
+
padding: "2px 6px",
|
|
3697
|
+
borderRadius: 4,
|
|
3698
|
+
background: "#F3E8FF",
|
|
3699
|
+
color: "#6B21A8"
|
|
3700
|
+
},
|
|
3701
|
+
children: [
|
|
3702
|
+
cf.name,
|
|
3703
|
+
" = ",
|
|
3704
|
+
cf.formula,
|
|
3705
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3706
|
+
"button",
|
|
3707
|
+
{
|
|
3708
|
+
type: "button",
|
|
3709
|
+
onClick: () => setPivotCalcFields(pivotCalcFields.filter((x) => x.name !== cf.name)),
|
|
3710
|
+
style: {
|
|
3711
|
+
border: "none",
|
|
3712
|
+
background: "transparent",
|
|
3713
|
+
color: "#6B21A8",
|
|
3714
|
+
cursor: "pointer",
|
|
3715
|
+
padding: 0,
|
|
3716
|
+
fontSize: 11
|
|
3717
|
+
},
|
|
3718
|
+
children: "\xD7"
|
|
3719
|
+
}
|
|
3720
|
+
)
|
|
3721
|
+
]
|
|
3722
|
+
},
|
|
3723
|
+
cf.name
|
|
3724
|
+
)) })
|
|
3725
|
+
]
|
|
3726
|
+
}
|
|
3727
|
+
),
|
|
3728
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer", fontSize: 11 }, children: [
|
|
3729
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3730
|
+
"input",
|
|
3731
|
+
{
|
|
3732
|
+
type: "checkbox",
|
|
3733
|
+
checked: withPivotChart,
|
|
3734
|
+
onChange: (e) => setWithPivotChart(e.target.checked)
|
|
3735
|
+
}
|
|
3736
|
+
),
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u65B0\u5EFA\u65F6\u540C\u6B65\u751F\u6210\u8054\u52A8\u900F\u89C6\u56FE (PivotChart)" })
|
|
3738
|
+
] }),
|
|
3739
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1.15fr 0.85fr", gap: 4 }, children: [
|
|
3740
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3741
|
+
"button",
|
|
3742
|
+
{
|
|
3743
|
+
"data-testid": "yudao-pivot-apply-btn",
|
|
3744
|
+
type: "button",
|
|
3745
|
+
className: "yudao-sheet-btn is-soft-primary",
|
|
3746
|
+
onClick: () => {
|
|
3747
|
+
const effectiveRows = pivotRowFields.length > 0 ? pivotRowFields : [pivotRowCol];
|
|
3748
|
+
const effectiveVals = pivotValueFields.length > 0 ? pivotValueFields : [{ colIndex: pivotValCol, aggFunc: pivotAgg }];
|
|
3749
|
+
const firstVal = effectiveVals[0];
|
|
3750
|
+
const builtConfig = {
|
|
3751
|
+
...activePivot ?? {},
|
|
3752
|
+
...pivotSourceRange.trim() ? { sourceRange: pivotSourceRange.trim() } : {},
|
|
3753
|
+
rowDimCols: effectiveRows,
|
|
3754
|
+
rowFields: effectiveRows,
|
|
3755
|
+
colDimCols: pivotColFields,
|
|
3756
|
+
columnFields: pivotColFields,
|
|
3757
|
+
valueCol: firstVal.colIndex,
|
|
3758
|
+
aggFunc: firstVal.aggFunc.toUpperCase(),
|
|
3759
|
+
valueFields: effectiveVals,
|
|
3760
|
+
filterFields: pivotFilterFields.length > 0 ? pivotFilterFields : void 0,
|
|
3761
|
+
calculatedFields: pivotCalcFields.length > 0 ? pivotCalcFields : void 0,
|
|
3762
|
+
valueShowAs: pivotShowAs,
|
|
3763
|
+
...pivotDateGroup ? { dateGroupBy: pivotDateGroup } : {},
|
|
3764
|
+
showSubtotals: true,
|
|
3765
|
+
withPivotChart,
|
|
3766
|
+
pivotChartType: chartType
|
|
3767
|
+
};
|
|
3768
|
+
if (activePivot?.id) {
|
|
3769
|
+
templateService.addOrUpdatePivot(unitId, builtConfig);
|
|
3770
|
+
commandService.syncExecuteCommand(import_univer_sheets2.RefreshSheetPivotCommand.id, {
|
|
3771
|
+
unitId,
|
|
3772
|
+
pivotId: activePivot.id
|
|
3773
|
+
});
|
|
3774
|
+
} else {
|
|
3775
|
+
commandService.syncExecuteCommand(import_univer_sheets2.GenerateSheetPivotCommand.id, {
|
|
3776
|
+
unitId,
|
|
3777
|
+
sourceSubUnitId: sheet.getSheetId(),
|
|
3778
|
+
pivotConfig: builtConfig
|
|
3779
|
+
});
|
|
3780
|
+
}
|
|
3781
|
+
},
|
|
3782
|
+
children: activePivot ? "\u5E94\u7528\u5E76\u5237\u65B0\u900F\u89C6\u8868" : `\u751F\u6210\u900F\u89C6\u8868${withPivotChart ? " + \u900F\u89C6\u56FE" : ""}`
|
|
3783
|
+
}
|
|
3784
|
+
),
|
|
3785
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3786
|
+
"button",
|
|
3787
|
+
{
|
|
3788
|
+
"data-testid": "yudao-pivot-create-chart-btn",
|
|
3789
|
+
type: "button",
|
|
3790
|
+
className: "yudao-sheet-btn",
|
|
3791
|
+
onClick: () => {
|
|
3792
|
+
const targetPivot = activePivot ?? pivots[pivots.length - 1];
|
|
3793
|
+
if (targetPivot?.targetSheetId) {
|
|
3794
|
+
const pivotSheet = workbook.getSheetBySheetId(targetPivot.targetSheetId);
|
|
3795
|
+
if (pivotSheet) {
|
|
3796
|
+
const pSnap = pivotSheet.getConfig();
|
|
3797
|
+
const linked = (0, import_univer_sheets2.buildPivotLinkedChart)(
|
|
3798
|
+
pSnap,
|
|
3799
|
+
{ ...targetPivot, pivotChartType: chartType },
|
|
3800
|
+
targetPivot.targetSheetId
|
|
3801
|
+
);
|
|
3802
|
+
if (linked) {
|
|
3803
|
+
commandService.syncExecuteCommand(import_univer_sheets2.UpdateSheetChartCommand.id, {
|
|
3804
|
+
unitId,
|
|
3805
|
+
chart: linked
|
|
3806
|
+
});
|
|
3807
|
+
setSelectedChartId(linked.id);
|
|
3808
|
+
return;
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3812
|
+
commandService.syncExecuteCommand(import_univer_sheets2.GenerateSheetPivotCommand.id, {
|
|
3813
|
+
unitId,
|
|
3814
|
+
sourceSubUnitId: sheet.getSheetId(),
|
|
3815
|
+
pivotConfig: {
|
|
3816
|
+
...pivotSourceRange.trim() ? { sourceRange: pivotSourceRange.trim() } : {},
|
|
3817
|
+
rowDimCols: pivotRowFields.length > 0 ? pivotRowFields : [pivotRowCol],
|
|
3818
|
+
rowFields: pivotRowFields.length > 0 ? pivotRowFields : [pivotRowCol],
|
|
3819
|
+
colDimCols: pivotColFields,
|
|
3820
|
+
columnFields: pivotColFields,
|
|
3821
|
+
valueCol: pivotValueFields[0]?.colIndex ?? pivotValCol,
|
|
3822
|
+
aggFunc: (pivotValueFields[0]?.aggFunc ?? pivotAgg).toUpperCase(),
|
|
3823
|
+
valueFields: pivotValueFields,
|
|
3824
|
+
filterFields: pivotFilterFields.length > 0 ? pivotFilterFields : void 0,
|
|
3825
|
+
calculatedFields: pivotCalcFields.length > 0 ? pivotCalcFields : void 0,
|
|
3826
|
+
showSubtotals: true,
|
|
3827
|
+
withPivotChart: true,
|
|
3828
|
+
pivotChartType: chartType
|
|
3829
|
+
}
|
|
3830
|
+
});
|
|
3831
|
+
},
|
|
3832
|
+
children: "+ \u521B\u5EFA\u900F\u89C6\u56FE"
|
|
3833
|
+
}
|
|
3834
|
+
)
|
|
3835
|
+
] })
|
|
3836
|
+
]
|
|
3837
|
+
}
|
|
3838
|
+
),
|
|
3839
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("hr", { style: { border: "none", borderTop: "1px solid #E3E5EA", margin: "4px 0" } }),
|
|
3840
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { fontSize: 11.5, fontWeight: 600, color: "#1B1C1F" }, children: "\u4EA4\u4E92\u5F0F\u5207\u7247\u5668 & \u65E5\u671F\u65F6\u95F4\u8F74\u7B5B\u9009" }),
|
|
3841
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1.2fr 0.8fr 1fr", gap: 4 }, children: [
|
|
3842
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
3843
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u6570\u636E\u533A\u95F4" }),
|
|
3844
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
3845
|
+
"input",
|
|
3846
|
+
{
|
|
3847
|
+
type: "text",
|
|
3848
|
+
value: slicerRange,
|
|
3849
|
+
onChange: (e) => setSlicerRange(e.target.value)
|
|
3850
|
+
}
|
|
3851
|
+
)
|
|
3852
|
+
] }),
|
|
3853
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
|
|
3854
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u7B5B\u9009\u5217" }),
|
|
3855
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("select", { value: slicerCol, onChange: (e) => setSlicerCol(Number(e.target.value)), children: [0, 1, 2, 3, 4, 5].map((c) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("option", { value: c, children: [
|
|
2691
3856
|
(0, import_univer_sheets2.colIndexToLetter)(c),
|
|
2692
3857
|
" \u5217"
|
|
2693
3858
|
] }, c)) })
|
|
@@ -2793,11 +3958,11 @@ var SheetInspectorPanel = () => {
|
|
|
2793
3958
|
),
|
|
2794
3959
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("hr", { style: { border: "none", borderTop: "1px solid #E3E5EA", margin: "4px 0" } }),
|
|
2795
3960
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { fontSize: 11.5, fontWeight: 600, color: "#1B1C1F" }, children: [
|
|
2796
|
-
"\u516C\u5F0F\
|
|
3961
|
+
"\u516C\u5F0F\u6C42\u503C\u4E0E\u76D1\u89C6\u7A97\u53E3 (",
|
|
2797
3962
|
activeRef,
|
|
2798
3963
|
")"
|
|
2799
3964
|
] }),
|
|
2800
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr
|
|
3965
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
|
|
2801
3966
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2802
3967
|
"button",
|
|
2803
3968
|
{
|
|
@@ -2835,64 +4000,231 @@ var SheetInspectorPanel = () => {
|
|
|
2835
4000
|
},
|
|
2836
4001
|
children: "\u8FFD\u8E2A\u4ECE\u5C5E\u5355\u5143\u683C"
|
|
2837
4002
|
}
|
|
2838
|
-
),
|
|
2839
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2840
|
-
"button",
|
|
2841
|
-
{
|
|
2842
|
-
type: "button",
|
|
2843
|
-
className: "yudao-sheet-btn",
|
|
2844
|
-
onClick: () => {
|
|
2845
|
-
const steps = (0, import_univer_sheets2.evaluateFormulaSteps)(
|
|
2846
|
-
workbook.save(),
|
|
2847
|
-
sheet.getSheetId(),
|
|
2848
|
-
activeRow,
|
|
2849
|
-
activeCol
|
|
2850
|
-
);
|
|
2851
|
-
setAuditOutput(steps.join(" => "));
|
|
2852
|
-
},
|
|
2853
|
-
children: "\u516C\u5F0F\u5206\u6B65\u6C42\u503C"
|
|
2854
|
-
}
|
|
2855
|
-
)
|
|
2856
|
-
] }),
|
|
2857
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 4 }, children: [
|
|
2858
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { fontSize: 11, color: "#4E5565" }, children: [
|
|
2859
|
-
"\u76D1\u89C6\u7A97\u53E3 (",
|
|
2860
|
-
(metadata.watchCells ?? []).length,
|
|
2861
|
-
" \u9879)"
|
|
2862
|
-
] }),
|
|
2863
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2864
|
-
"button",
|
|
2865
|
-
{
|
|
2866
|
-
type: "button",
|
|
2867
|
-
className: "yudao-sheet-btn",
|
|
2868
|
-
style: { padding: "2px 8px", fontSize: 10.5 },
|
|
2869
|
-
onClick: () => {
|
|
2870
|
-
const curList = metadata.watchCells ?? [];
|
|
2871
|
-
const sid = sheet.getSheetId();
|
|
2872
|
-
if (curList.some((w) => w.sheetId === sid && w.row === activeRow && w.col === activeCol)) {
|
|
2873
|
-
return;
|
|
2874
|
-
}
|
|
2875
|
-
templateService.setTemplateMetadata(unitId, {
|
|
2876
|
-
...metadata,
|
|
2877
|
-
watchCells: [
|
|
2878
|
-
...curList,
|
|
2879
|
-
{
|
|
2880
|
-
id: `watch-${(0, import_core4.generateRandomId)(5)}`,
|
|
2881
|
-
sheetId: sid,
|
|
2882
|
-
row: activeRow,
|
|
2883
|
-
col: activeCol,
|
|
2884
|
-
cellRef: activeRef
|
|
2885
|
-
}
|
|
2886
|
-
]
|
|
2887
|
-
});
|
|
2888
|
-
},
|
|
2889
|
-
children: [
|
|
2890
|
-
"+ \u76D1\u89C6\u5F53\u524D\u5355\u5143\u683C ",
|
|
2891
|
-
activeRef
|
|
2892
|
-
]
|
|
2893
|
-
}
|
|
2894
4003
|
)
|
|
2895
4004
|
] }),
|
|
4005
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4006
|
+
"div",
|
|
4007
|
+
{
|
|
4008
|
+
"data-testid": "yudao-formula-step-evaluator",
|
|
4009
|
+
style: {
|
|
4010
|
+
display: "flex",
|
|
4011
|
+
flexDirection: "column",
|
|
4012
|
+
gap: 5,
|
|
4013
|
+
padding: "6px 7px",
|
|
4014
|
+
borderRadius: 6,
|
|
4015
|
+
background: "#F8FAFC",
|
|
4016
|
+
border: "1px solid #E2E8F0"
|
|
4017
|
+
},
|
|
4018
|
+
children: [
|
|
4019
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr auto", gap: 4 }, children: [
|
|
4020
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4021
|
+
"button",
|
|
4022
|
+
{
|
|
4023
|
+
"data-testid": "yudao-formula-step-into",
|
|
4024
|
+
type: "button",
|
|
4025
|
+
className: "yudao-sheet-btn is-soft-primary",
|
|
4026
|
+
onClick: () => {
|
|
4027
|
+
const key = `${sheet.getSheetId()}:${activeRef}`;
|
|
4028
|
+
const steps = (0, import_univer_sheets2.evaluateFormulaSteps)(
|
|
4029
|
+
workbook.save(),
|
|
4030
|
+
sheet.getSheetId(),
|
|
4031
|
+
activeRow,
|
|
4032
|
+
activeCol
|
|
4033
|
+
);
|
|
4034
|
+
setEvalCellKey(key);
|
|
4035
|
+
setEvalSteps(steps);
|
|
4036
|
+
const nextIdx = evalCellKey === key && evalSteps.length === steps.length ? Math.min(steps.length - 1, evalStepIdx + 1) : 0;
|
|
4037
|
+
setEvalStepIdx(nextIdx);
|
|
4038
|
+
setAuditOutput(steps.join(" => "));
|
|
4039
|
+
},
|
|
4040
|
+
children: "\u6B65\u5165\u6C42\u503C (Step Into)"
|
|
4041
|
+
}
|
|
4042
|
+
),
|
|
4043
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4044
|
+
"button",
|
|
4045
|
+
{
|
|
4046
|
+
"data-testid": "yudao-formula-eval-next",
|
|
4047
|
+
type: "button",
|
|
4048
|
+
className: "yudao-sheet-btn",
|
|
4049
|
+
onClick: () => {
|
|
4050
|
+
const key = `${sheet.getSheetId()}:${activeRef}`;
|
|
4051
|
+
const steps = evalCellKey === key && evalSteps.length > 0 ? evalSteps : (0, import_univer_sheets2.evaluateFormulaSteps)(
|
|
4052
|
+
workbook.save(),
|
|
4053
|
+
sheet.getSheetId(),
|
|
4054
|
+
activeRow,
|
|
4055
|
+
activeCol
|
|
4056
|
+
);
|
|
4057
|
+
const nextIdx = evalCellKey === key ? Math.min(steps.length - 1, evalStepIdx + 1) : 0;
|
|
4058
|
+
setEvalCellKey(key);
|
|
4059
|
+
setEvalSteps(steps);
|
|
4060
|
+
setEvalStepIdx(nextIdx);
|
|
4061
|
+
setAuditOutput(steps[nextIdx] ?? "");
|
|
4062
|
+
},
|
|
4063
|
+
children: "\u4E0B\u4E00\u6B65\u6C42\u503C (Next)"
|
|
4064
|
+
}
|
|
4065
|
+
),
|
|
4066
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4067
|
+
"button",
|
|
4068
|
+
{
|
|
4069
|
+
type: "button",
|
|
4070
|
+
className: "yudao-sheet-btn",
|
|
4071
|
+
style: { padding: "2px 7px", fontSize: 10.5 },
|
|
4072
|
+
onClick: () => {
|
|
4073
|
+
setEvalStepIdx(0);
|
|
4074
|
+
},
|
|
4075
|
+
children: "\u91CD\u7F6E"
|
|
4076
|
+
}
|
|
4077
|
+
)
|
|
4078
|
+
] }),
|
|
4079
|
+
evalSteps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 3, fontSize: 10.5 }, children: [
|
|
4080
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", color: "#475569" }, children: [
|
|
4081
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
|
|
4082
|
+
"\u5F53\u524D\u6C42\u503C\u5B50\u8868\u8FBE\u5F0F (",
|
|
4083
|
+
evalCellKey.split(":")[1] ?? activeRef,
|
|
4084
|
+
")"
|
|
4085
|
+
] }),
|
|
4086
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { fontWeight: 600, color: "#2C53F1" }, children: [
|
|
4087
|
+
"\u6B65\u9AA4 ",
|
|
4088
|
+
Math.min(evalStepIdx + 1, evalSteps.length),
|
|
4089
|
+
" / ",
|
|
4090
|
+
evalSteps.length
|
|
4091
|
+
] })
|
|
4092
|
+
] }),
|
|
4093
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4094
|
+
"div",
|
|
4095
|
+
{
|
|
4096
|
+
"data-testid": "yudao-formula-current-step",
|
|
4097
|
+
style: {
|
|
4098
|
+
padding: "4px 6px",
|
|
4099
|
+
borderRadius: 4,
|
|
4100
|
+
background: "#EEF2FF",
|
|
4101
|
+
border: "1px solid #C7D2FE",
|
|
4102
|
+
color: "#1E1B4B",
|
|
4103
|
+
fontFamily: "monospace",
|
|
4104
|
+
wordBreak: "break-all"
|
|
4105
|
+
},
|
|
4106
|
+
children: evalSteps[Math.min(evalStepIdx, evalSteps.length - 1)]
|
|
4107
|
+
}
|
|
4108
|
+
)
|
|
4109
|
+
] })
|
|
4110
|
+
]
|
|
4111
|
+
}
|
|
4112
|
+
),
|
|
4113
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4114
|
+
"div",
|
|
4115
|
+
{
|
|
4116
|
+
"data-testid": "yudao-formula-watch-window",
|
|
4117
|
+
style: { display: "flex", flexDirection: "column", gap: 4 },
|
|
4118
|
+
children: [
|
|
4119
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 4 }, children: [
|
|
4120
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { style: { fontSize: 11, fontWeight: 600, color: "#4E5565" }, children: [
|
|
4121
|
+
"\u76D1\u89C6\u7A97\u53E3 (",
|
|
4122
|
+
(metadata.watchCells ?? []).length,
|
|
4123
|
+
" \u9879)"
|
|
4124
|
+
] }),
|
|
4125
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
4126
|
+
"button",
|
|
4127
|
+
{
|
|
4128
|
+
type: "button",
|
|
4129
|
+
className: "yudao-sheet-btn",
|
|
4130
|
+
style: { padding: "2px 8px", fontSize: 10.5 },
|
|
4131
|
+
onClick: () => {
|
|
4132
|
+
const curList = metadata.watchCells ?? [];
|
|
4133
|
+
const sid = sheet.getSheetId();
|
|
4134
|
+
if (curList.some((w) => w.sheetId === sid && w.row === activeRow && w.col === activeCol)) {
|
|
4135
|
+
return;
|
|
4136
|
+
}
|
|
4137
|
+
templateService.setTemplateMetadata(unitId, {
|
|
4138
|
+
...metadata,
|
|
4139
|
+
watchCells: [
|
|
4140
|
+
...curList,
|
|
4141
|
+
{
|
|
4142
|
+
id: `watch-${(0, import_core4.generateRandomId)(5)}`,
|
|
4143
|
+
sheetId: sid,
|
|
4144
|
+
row: activeRow,
|
|
4145
|
+
col: activeCol,
|
|
4146
|
+
cellRef: activeRef
|
|
4147
|
+
}
|
|
4148
|
+
]
|
|
4149
|
+
});
|
|
4150
|
+
},
|
|
4151
|
+
children: [
|
|
4152
|
+
"+ \u76D1\u89C6\u5F53\u524D\u683C ",
|
|
4153
|
+
activeRef
|
|
4154
|
+
]
|
|
4155
|
+
}
|
|
4156
|
+
)
|
|
4157
|
+
] }),
|
|
4158
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr auto", gap: 4 }, children: [
|
|
4159
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4160
|
+
"input",
|
|
4161
|
+
{
|
|
4162
|
+
"data-testid": "yudao-watch-ref-input",
|
|
4163
|
+
type: "text",
|
|
4164
|
+
placeholder: "\u8F93\u5165\u5F15\u7528\u5982 Sheet1!D10 \u6216 F10",
|
|
4165
|
+
style: { fontSize: 11, padding: "3px 6px" },
|
|
4166
|
+
value: watchInputRef,
|
|
4167
|
+
onChange: (e) => setWatchInputRef(e.target.value)
|
|
4168
|
+
}
|
|
4169
|
+
),
|
|
4170
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4171
|
+
"button",
|
|
4172
|
+
{
|
|
4173
|
+
"data-testid": "yudao-watch-add-input-btn",
|
|
4174
|
+
type: "button",
|
|
4175
|
+
className: "yudao-sheet-btn is-soft-primary",
|
|
4176
|
+
style: { padding: "2px 8px", fontSize: 10.5 },
|
|
4177
|
+
onClick: () => {
|
|
4178
|
+
const raw = watchInputRef.trim();
|
|
4179
|
+
if (!raw) return;
|
|
4180
|
+
let targetSheet = sheet;
|
|
4181
|
+
let cellPart = raw;
|
|
4182
|
+
const bangIdx = raw.lastIndexOf("!");
|
|
4183
|
+
if (bangIdx > 0) {
|
|
4184
|
+
const sheetToken = raw.slice(0, bangIdx).trim().replace(/^'+|'+$/g, "");
|
|
4185
|
+
cellPart = raw.slice(bangIdx + 1).trim();
|
|
4186
|
+
const snap = workbook.save();
|
|
4187
|
+
for (const sid2 of snap.sheetOrder ?? Object.keys(snap.sheets ?? {})) {
|
|
4188
|
+
const ws = workbook.getSheetBySheetId(sid2);
|
|
4189
|
+
if (ws && (ws.getName() === sheetToken || ws.getSheetId() === sheetToken)) {
|
|
4190
|
+
targetSheet = ws;
|
|
4191
|
+
break;
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
const cleanCell = cellPart.replace(/\$/g, "").toUpperCase();
|
|
4196
|
+
const coords = (0, import_univer_sheets2.a1ToCellCoords)(cleanCell);
|
|
4197
|
+
if (!coords) return;
|
|
4198
|
+
const sid = targetSheet.getSheetId();
|
|
4199
|
+
const curList = metadata.watchCells ?? [];
|
|
4200
|
+
if (curList.some(
|
|
4201
|
+
(w) => w.sheetId === sid && w.row === coords.row && w.col === coords.col
|
|
4202
|
+
)) {
|
|
4203
|
+
setWatchInputRef("");
|
|
4204
|
+
return;
|
|
4205
|
+
}
|
|
4206
|
+
templateService.setTemplateMetadata(unitId, {
|
|
4207
|
+
...metadata,
|
|
4208
|
+
watchCells: [
|
|
4209
|
+
...curList,
|
|
4210
|
+
{
|
|
4211
|
+
id: `watch-${(0, import_core4.generateRandomId)(5)}`,
|
|
4212
|
+
sheetId: sid,
|
|
4213
|
+
row: coords.row,
|
|
4214
|
+
col: coords.col,
|
|
4215
|
+
cellRef: (0, import_univer_sheets2.cellCoordsToA1)(coords.row, coords.col)
|
|
4216
|
+
}
|
|
4217
|
+
]
|
|
4218
|
+
});
|
|
4219
|
+
setWatchInputRef("");
|
|
4220
|
+
},
|
|
4221
|
+
children: "+ \u6DFB\u52A0\u76D1\u89C6"
|
|
4222
|
+
}
|
|
4223
|
+
)
|
|
4224
|
+
] })
|
|
4225
|
+
]
|
|
4226
|
+
}
|
|
4227
|
+
),
|
|
2896
4228
|
(metadata.watchCells ?? []).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
2897
4229
|
"div",
|
|
2898
4230
|
{
|
|
@@ -5925,7 +7257,7 @@ var import_sheets3 = require("@univerjs/sheets");
|
|
|
5925
7257
|
var import_sheets_ui4 = require("@univerjs/sheets-ui");
|
|
5926
7258
|
var import_ui6 = require("@univerjs/ui");
|
|
5927
7259
|
var import_univer_sheets5 = require("@yudaocode/univer-sheets");
|
|
5928
|
-
var import_react5 = require("react");
|
|
7260
|
+
var import_react5 = __toESM(require("react"));
|
|
5929
7261
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
5930
7262
|
var QrCellImage = ({ text, size, errorLevel = "M", color, bgColor, logoDataUrl, logoSizeRatio }) => {
|
|
5931
7263
|
const src = (0, import_react5.useMemo)(
|
|
@@ -6020,7 +7352,9 @@ var BuiltinSvgChart = ({ chart, data, onSelectItem }) => {
|
|
|
6020
7352
|
index
|
|
6021
7353
|
});
|
|
6022
7354
|
};
|
|
6023
|
-
const hasWave2Config = Boolean(chart.trendline) && chart.trendline !== "none" || Boolean(
|
|
7355
|
+
const hasWave2Config = Boolean(chart.trendline) && chart.trendline !== "none" || Boolean(
|
|
7356
|
+
chart.errorBars && (Array.isArray(chart.errorBars) ? chart.errorBars.length > 0 : Boolean(chart.errorBars.type))
|
|
7357
|
+
) || Boolean(chart.secondarySeriesIndices && chart.secondarySeriesIndices.length > 0) || Boolean(chart.comboLineSeriesIndices && chart.comboLineSeriesIndices.length > 0) || Boolean(chart.showDataLabels) || cType === "combo" || cType === "bubble" || cType === "scatter" || cType === "radar" || chart.yAxisScale === "log" || Boolean(chart.threeD) || chart.radarShape === "circle" || chart.radarFill !== void 0 || Boolean(chart.smooth) || cType === "lineSmooth" || cType === "lineStackedSmooth" || cType === "linePercentStackedSmooth" || chart.showLegend !== void 0 || Boolean(chart.legendPosition) || Boolean(chart.seriesOrientation) || Boolean(chart.series && chart.series.length > 0);
|
|
6024
7358
|
if (!LEGACY_INLINE_CHART_TYPES.has(cType) || hasWave2Config) {
|
|
6025
7359
|
const svgHtml = (0, import_univer_sheets5.renderSheetChartSvg)(chart, data).replace(
|
|
6026
7360
|
"<svg ",
|
|
@@ -6166,40 +7500,6 @@ var BuiltinSvgChart = ({ chart, data, onSelectItem }) => {
|
|
|
6166
7500
|
] }, i);
|
|
6167
7501
|
}) });
|
|
6168
7502
|
}
|
|
6169
|
-
if (cType === "radar") {
|
|
6170
|
-
const count2 = Math.max(3, vals.length);
|
|
6171
|
-
const cx = 130;
|
|
6172
|
-
const cy = 70;
|
|
6173
|
-
const rMax = 46;
|
|
6174
|
-
const dataPoly = Array.from({ length: count2 }, (_, i) => {
|
|
6175
|
-
const ang = -Math.PI / 2 + i / count2 * Math.PI * 2;
|
|
6176
|
-
const rad = Math.max(0, vals[i] ?? 0) / maxVal * rMax;
|
|
6177
|
-
return `${(cx + rad * Math.cos(ang)).toFixed(1)},${(cy + rad * Math.sin(ang)).toFixed(1)}`;
|
|
6178
|
-
}).join(" ");
|
|
6179
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { viewBox: "0 0 260 136", style: { width: "100%", height: "100%", display: "block" }, children: [
|
|
6180
|
-
[0.35, 0.7, 1].map((ratio, rIdx) => {
|
|
6181
|
-
const ringPts = Array.from({ length: count2 }, (_, i) => {
|
|
6182
|
-
const ang = -Math.PI / 2 + i / count2 * Math.PI * 2;
|
|
6183
|
-
return `${(cx + rMax * ratio * Math.cos(ang)).toFixed(1)},${(cy + rMax * ratio * Math.sin(ang)).toFixed(1)}`;
|
|
6184
|
-
}).join(" ");
|
|
6185
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polygon", { points: ringPts, fill: "none", stroke: "#E3E5EA", strokeWidth: 0.8 }, rIdx);
|
|
6186
|
-
}),
|
|
6187
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polygon", { points: dataPoly, fill: "rgba(44, 83, 241, 0.14)", stroke: primaryColor, strokeWidth: 1.8 }),
|
|
6188
|
-
Array.from({ length: count2 }, (_, i) => {
|
|
6189
|
-
const ang = -Math.PI / 2 + i / count2 * Math.PI * 2;
|
|
6190
|
-
const v = vals[i] ?? 0;
|
|
6191
|
-
const rad = Math.max(0, v) / maxVal * rMax;
|
|
6192
|
-
const px = cx + rad * Math.cos(ang);
|
|
6193
|
-
const py = cy + rad * Math.sin(ang);
|
|
6194
|
-
const lx = cx + (rMax + 14) * Math.cos(ang);
|
|
6195
|
-
const ly = cy + (rMax + 11) * Math.sin(ang);
|
|
6196
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { style: { cursor: "pointer" }, onClick: () => fireSelect(i, v), children: [
|
|
6197
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: px, cy: py, r: 2.8, fill: primaryColor }),
|
|
6198
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: lx, y: ly, textAnchor: "middle", fontSize: 8.5, fill: "#4E5565", children: (cats[i] ?? `\u7EF4${i + 1}`).slice(0, 5) })
|
|
6199
|
-
] }, i);
|
|
6200
|
-
})
|
|
6201
|
-
] });
|
|
6202
|
-
}
|
|
6203
7503
|
if (cType === "horizontalBar") {
|
|
6204
7504
|
const count2 = Math.max(1, vals.length);
|
|
6205
7505
|
const slotH = Math.min(24, 108 / count2);
|
|
@@ -7157,19 +8457,201 @@ var FloatingTimelineCard = ({ timeline, onMove, onRemove, onUpdateGranularity, o
|
|
|
7157
8457
|
}
|
|
7158
8458
|
);
|
|
7159
8459
|
};
|
|
7160
|
-
|
|
8460
|
+
function getShapeAnchorMidpoints(sh) {
|
|
8461
|
+
const cx = sh.left + sh.width / 2;
|
|
8462
|
+
const cy = sh.top + sh.height / 2;
|
|
8463
|
+
return [
|
|
8464
|
+
{ x: cx, y: sh.top },
|
|
8465
|
+
{ x: sh.left + sh.width, y: cy },
|
|
8466
|
+
{ x: cx, y: sh.top + sh.height },
|
|
8467
|
+
{ x: sh.left, y: cy }
|
|
8468
|
+
];
|
|
8469
|
+
}
|
|
8470
|
+
function findNearestAnchorMidpoint(px, py, candidates, excludeId, threshold = 22) {
|
|
8471
|
+
let best = null;
|
|
8472
|
+
for (const cand of candidates) {
|
|
8473
|
+
if (cand.id === excludeId || cand.shapeType === "line" || cand.shapeType === "connector") {
|
|
8474
|
+
continue;
|
|
8475
|
+
}
|
|
8476
|
+
for (const pt of getShapeAnchorMidpoints(cand)) {
|
|
8477
|
+
const d = Math.hypot(pt.x - px, pt.y - py);
|
|
8478
|
+
if (d <= threshold && (!best || d < best.dist)) {
|
|
8479
|
+
best = { shapeId: cand.id, x: pt.x, y: pt.y, dist: d };
|
|
8480
|
+
}
|
|
8481
|
+
}
|
|
8482
|
+
}
|
|
8483
|
+
return best ? { shapeId: best.shapeId, x: best.x, y: best.y } : null;
|
|
8484
|
+
}
|
|
8485
|
+
var FloatingShapeCard = ({
|
|
8486
|
+
shape,
|
|
8487
|
+
rawShape,
|
|
8488
|
+
allShapes,
|
|
8489
|
+
scrollX,
|
|
8490
|
+
scrollY,
|
|
8491
|
+
selected,
|
|
8492
|
+
displayText,
|
|
8493
|
+
onSelect,
|
|
8494
|
+
onUpdate,
|
|
8495
|
+
onRemove
|
|
8496
|
+
}) => {
|
|
7161
8497
|
const fill = shape.fillColor || "#F3F5FF";
|
|
7162
8498
|
const stroke = shape.strokeColor || "#2C53F1";
|
|
7163
8499
|
const textColor = shape.textColor || "#1B1C1F";
|
|
8500
|
+
const isConnector = shape.shapeType === "line" || shape.shapeType === "connector";
|
|
8501
|
+
const resolvedBox = (0, import_react5.useMemo)(() => {
|
|
8502
|
+
if (!isConnector || !rawShape.startShapeId && !rawShape.endShapeId) {
|
|
8503
|
+
return { left: shape.left, top: shape.top, width: shape.width, height: shape.height };
|
|
8504
|
+
}
|
|
8505
|
+
let x1 = rawShape.left;
|
|
8506
|
+
let y1 = rawShape.top;
|
|
8507
|
+
let x2 = rawShape.left + rawShape.width;
|
|
8508
|
+
let y2 = rawShape.top + rawShape.height;
|
|
8509
|
+
if (rawShape.startShapeId) {
|
|
8510
|
+
const startTarget = allShapes.find((s) => s.id === rawShape.startShapeId);
|
|
8511
|
+
if (startTarget) {
|
|
8512
|
+
const mids = getShapeAnchorMidpoints(startTarget);
|
|
8513
|
+
mids.sort((a, b) => Math.hypot(a.x - x2, a.y - y2) - Math.hypot(b.x - x2, b.y - y2));
|
|
8514
|
+
x1 = mids[0].x;
|
|
8515
|
+
y1 = mids[0].y;
|
|
8516
|
+
}
|
|
8517
|
+
}
|
|
8518
|
+
if (rawShape.endShapeId) {
|
|
8519
|
+
const endTarget = allShapes.find((s) => s.id === rawShape.endShapeId);
|
|
8520
|
+
if (endTarget) {
|
|
8521
|
+
const mids = getShapeAnchorMidpoints(endTarget);
|
|
8522
|
+
mids.sort((a, b) => Math.hypot(a.x - x1, a.y - y1) - Math.hypot(b.x - x1, b.y - y1));
|
|
8523
|
+
x2 = mids[0].x;
|
|
8524
|
+
y2 = mids[0].y;
|
|
8525
|
+
}
|
|
8526
|
+
}
|
|
8527
|
+
const minX = Math.min(x1, x2) - scrollX;
|
|
8528
|
+
const minY = Math.min(y1, y2) - scrollY;
|
|
8529
|
+
return {
|
|
8530
|
+
left: minX,
|
|
8531
|
+
top: minY,
|
|
8532
|
+
width: Math.max(12, Math.abs(x2 - x1)),
|
|
8533
|
+
height: Math.max(12, Math.abs(y2 - y1))
|
|
8534
|
+
};
|
|
8535
|
+
}, [isConnector, rawShape, allShapes, shape.left, shape.top, shape.width, shape.height, scrollX, scrollY]);
|
|
7164
8536
|
const handleDragStart = (e) => {
|
|
7165
8537
|
e.preventDefault();
|
|
7166
8538
|
e.stopPropagation();
|
|
8539
|
+
onSelect();
|
|
8540
|
+
const startX = e.clientX;
|
|
8541
|
+
const startY = e.clientY;
|
|
8542
|
+
const origL = rawShape.left;
|
|
8543
|
+
const origT = rawShape.top;
|
|
8544
|
+
const onMouseMove = (ev) => {
|
|
8545
|
+
const nextL = Math.max(4, origL + (ev.clientX - startX));
|
|
8546
|
+
const nextT = Math.max(4, origT + (ev.clientY - startY));
|
|
8547
|
+
if (isConnector) {
|
|
8548
|
+
const snapStart = findNearestAnchorMidpoint(nextL, nextT, allShapes, rawShape.id);
|
|
8549
|
+
const snapEnd = findNearestAnchorMidpoint(
|
|
8550
|
+
nextL + rawShape.width,
|
|
8551
|
+
nextT + rawShape.height,
|
|
8552
|
+
allShapes,
|
|
8553
|
+
rawShape.id
|
|
8554
|
+
);
|
|
8555
|
+
onUpdate({
|
|
8556
|
+
...rawShape,
|
|
8557
|
+
left: snapStart ? snapStart.x : nextL,
|
|
8558
|
+
top: snapStart ? snapStart.y : nextT,
|
|
8559
|
+
startShapeId: snapStart?.shapeId,
|
|
8560
|
+
endShapeId: snapEnd?.shapeId
|
|
8561
|
+
});
|
|
8562
|
+
} else {
|
|
8563
|
+
onUpdate({ ...rawShape, left: nextL, top: nextT });
|
|
8564
|
+
}
|
|
8565
|
+
};
|
|
8566
|
+
const onMouseUp = () => {
|
|
8567
|
+
window.removeEventListener("mousemove", onMouseMove);
|
|
8568
|
+
window.removeEventListener("mouseup", onMouseUp);
|
|
8569
|
+
};
|
|
8570
|
+
window.addEventListener("mousemove", onMouseMove);
|
|
8571
|
+
window.addEventListener("mouseup", onMouseUp);
|
|
8572
|
+
};
|
|
8573
|
+
const handleResizeStart = (dir) => (e) => {
|
|
8574
|
+
e.preventDefault();
|
|
8575
|
+
e.stopPropagation();
|
|
8576
|
+
onSelect();
|
|
7167
8577
|
const startX = e.clientX;
|
|
7168
8578
|
const startY = e.clientY;
|
|
7169
|
-
const origL =
|
|
7170
|
-
const origT =
|
|
8579
|
+
const origL = rawShape.left;
|
|
8580
|
+
const origT = rawShape.top;
|
|
8581
|
+
const origW = rawShape.width;
|
|
8582
|
+
const origH = rawShape.height;
|
|
8583
|
+
const onMouseMove = (ev) => {
|
|
8584
|
+
const dx = ev.clientX - startX;
|
|
8585
|
+
const dy = ev.clientY - startY;
|
|
8586
|
+
let nextL = origL;
|
|
8587
|
+
let nextT = origT;
|
|
8588
|
+
let nextW = origW;
|
|
8589
|
+
let nextH = origH;
|
|
8590
|
+
if (dir.includes("e")) nextW = Math.max(20, origW + dx);
|
|
8591
|
+
if (dir.includes("s")) nextH = Math.max(16, origH + dy);
|
|
8592
|
+
if (dir.includes("w")) {
|
|
8593
|
+
const proposedW = Math.max(20, origW - dx);
|
|
8594
|
+
nextL = origL + (origW - proposedW);
|
|
8595
|
+
nextW = proposedW;
|
|
8596
|
+
}
|
|
8597
|
+
if (dir.includes("n")) {
|
|
8598
|
+
const proposedH = Math.max(16, origH - dy);
|
|
8599
|
+
nextT = origT + (origH - proposedH);
|
|
8600
|
+
nextH = proposedH;
|
|
8601
|
+
}
|
|
8602
|
+
if (isConnector) {
|
|
8603
|
+
const snapStart = dir.includes("w") || dir.includes("n") ? findNearestAnchorMidpoint(nextL, nextT, allShapes, rawShape.id) : null;
|
|
8604
|
+
const snapEnd = dir.includes("e") || dir.includes("s") ? findNearestAnchorMidpoint(nextL + nextW, nextT + nextH, allShapes, rawShape.id) : null;
|
|
8605
|
+
if (snapStart) {
|
|
8606
|
+
nextW = Math.max(12, nextL + nextW - snapStart.x);
|
|
8607
|
+
nextH = Math.max(12, nextT + nextH - snapStart.y);
|
|
8608
|
+
nextL = snapStart.x;
|
|
8609
|
+
nextT = snapStart.y;
|
|
8610
|
+
}
|
|
8611
|
+
if (snapEnd) {
|
|
8612
|
+
nextW = Math.max(12, snapEnd.x - nextL);
|
|
8613
|
+
nextH = Math.max(12, snapEnd.y - nextT);
|
|
8614
|
+
}
|
|
8615
|
+
onUpdate({
|
|
8616
|
+
...rawShape,
|
|
8617
|
+
left: Math.round(nextL),
|
|
8618
|
+
top: Math.round(nextT),
|
|
8619
|
+
width: Math.round(nextW),
|
|
8620
|
+
height: Math.round(nextH),
|
|
8621
|
+
...dir.includes("w") || dir.includes("n") ? { startShapeId: snapStart?.shapeId } : {},
|
|
8622
|
+
...dir.includes("e") || dir.includes("s") ? { endShapeId: snapEnd?.shapeId } : {}
|
|
8623
|
+
});
|
|
8624
|
+
} else {
|
|
8625
|
+
onUpdate({
|
|
8626
|
+
...rawShape,
|
|
8627
|
+
left: Math.round(nextL),
|
|
8628
|
+
top: Math.round(nextT),
|
|
8629
|
+
width: Math.round(nextW),
|
|
8630
|
+
height: Math.round(nextH)
|
|
8631
|
+
});
|
|
8632
|
+
}
|
|
8633
|
+
};
|
|
8634
|
+
const onMouseUp = () => {
|
|
8635
|
+
window.removeEventListener("mousemove", onMouseMove);
|
|
8636
|
+
window.removeEventListener("mouseup", onMouseUp);
|
|
8637
|
+
};
|
|
8638
|
+
window.addEventListener("mousemove", onMouseMove);
|
|
8639
|
+
window.addEventListener("mouseup", onMouseUp);
|
|
8640
|
+
};
|
|
8641
|
+
const handleRotateStart = (e) => {
|
|
8642
|
+
e.preventDefault();
|
|
8643
|
+
e.stopPropagation();
|
|
8644
|
+
onSelect();
|
|
8645
|
+
const boxEl = e.currentTarget.parentElement;
|
|
8646
|
+
if (!boxEl) return;
|
|
8647
|
+
const rect = boxEl.getBoundingClientRect();
|
|
8648
|
+
const cx = rect.left + rect.width / 2;
|
|
8649
|
+
const cy = rect.top + rect.height / 2;
|
|
7171
8650
|
const onMouseMove = (ev) => {
|
|
7172
|
-
|
|
8651
|
+
const rad = Math.atan2(ev.clientY - cy, ev.clientX - cx);
|
|
8652
|
+
let deg = Math.round((rad * 180 / Math.PI + 90 + 360) % 360);
|
|
8653
|
+
if (ev.shiftKey) deg = Math.round(deg / 15) * 15;
|
|
8654
|
+
onUpdate({ ...rawShape, rotation: deg });
|
|
7173
8655
|
};
|
|
7174
8656
|
const onMouseUp = () => {
|
|
7175
8657
|
window.removeEventListener("mousemove", onMouseMove);
|
|
@@ -7179,7 +8661,37 @@ var FloatingShapeCard = ({ shape, displayText, onMove, onRemove }) => {
|
|
|
7179
8661
|
window.addEventListener("mouseup", onMouseUp);
|
|
7180
8662
|
};
|
|
7181
8663
|
const renderShapeGeometry = () => {
|
|
8664
|
+
const markerId = `yudao-arrow-${shape.id}`;
|
|
7182
8665
|
switch (shape.shapeType) {
|
|
8666
|
+
case "line":
|
|
8667
|
+
case "connector":
|
|
8668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
8669
|
+
(shape.arrowEnd || shape.shapeType === "connector") && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
8670
|
+
"marker",
|
|
8671
|
+
{
|
|
8672
|
+
id: markerId,
|
|
8673
|
+
viewBox: "0 0 10 10",
|
|
8674
|
+
refX: "8",
|
|
8675
|
+
refY: "5",
|
|
8676
|
+
markerWidth: "6",
|
|
8677
|
+
markerHeight: "6",
|
|
8678
|
+
orient: "auto-start-reverse",
|
|
8679
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M 0 0 L 10 5 L 0 10 z", fill: stroke })
|
|
8680
|
+
}
|
|
8681
|
+
) }),
|
|
8682
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
8683
|
+
"line",
|
|
8684
|
+
{
|
|
8685
|
+
x1: 4,
|
|
8686
|
+
y1: 4,
|
|
8687
|
+
x2: 96,
|
|
8688
|
+
y2: 96,
|
|
8689
|
+
stroke,
|
|
8690
|
+
strokeWidth: shape.strokeWidth || 2.2,
|
|
8691
|
+
markerEnd: shape.arrowEnd || shape.shapeType === "connector" ? `url(#${markerId})` : void 0
|
|
8692
|
+
}
|
|
8693
|
+
)
|
|
8694
|
+
] });
|
|
7183
8695
|
case "roundRect":
|
|
7184
8696
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: 2, y: 2, width: 96, height: 96, rx: 14, fill, stroke, strokeWidth: 2 });
|
|
7185
8697
|
case "ellipse":
|
|
@@ -7187,6 +8699,7 @@ var FloatingShapeCard = ({ shape, displayText, onMove, onRemove }) => {
|
|
|
7187
8699
|
case "diamond":
|
|
7188
8700
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polygon", { points: "50,3 97,50 50,97 3,50", fill, stroke, strokeWidth: 2 });
|
|
7189
8701
|
case "arrow":
|
|
8702
|
+
case "rightArrow":
|
|
7190
8703
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7191
8704
|
"polygon",
|
|
7192
8705
|
{
|
|
@@ -7197,6 +8710,7 @@ var FloatingShapeCard = ({ shape, displayText, onMove, onRemove }) => {
|
|
|
7197
8710
|
}
|
|
7198
8711
|
);
|
|
7199
8712
|
case "callout":
|
|
8713
|
+
case "wedgeRoundRectCallout":
|
|
7200
8714
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7201
8715
|
"polygon",
|
|
7202
8716
|
{
|
|
@@ -7211,19 +8725,32 @@ var FloatingShapeCard = ({ shape, displayText, onMove, onRemove }) => {
|
|
|
7211
8725
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: 2, y: 2, width: 96, height: 96, rx: 3, fill, stroke, strokeWidth: 2 });
|
|
7212
8726
|
}
|
|
7213
8727
|
};
|
|
8728
|
+
const handles = [
|
|
8729
|
+
{ dir: "nw", style: { left: -4, top: -4 }, cursor: "nwse-resize" },
|
|
8730
|
+
{ dir: "n", style: { left: "calc(50% - 4px)", top: -4 }, cursor: "ns-resize" },
|
|
8731
|
+
{ dir: "ne", style: { right: -4, top: -4 }, cursor: "nesw-resize" },
|
|
8732
|
+
{ dir: "e", style: { right: -4, top: "calc(50% - 4px)" }, cursor: "ew-resize" },
|
|
8733
|
+
{ dir: "se", style: { right: -4, bottom: -4 }, cursor: "nwse-resize" },
|
|
8734
|
+
{ dir: "s", style: { left: "calc(50% - 4px)", bottom: -4 }, cursor: "ns-resize" },
|
|
8735
|
+
{ dir: "sw", style: { left: -4, bottom: -4 }, cursor: "nesw-resize" },
|
|
8736
|
+
{ dir: "w", style: { left: -4, top: "calc(50% - 4px)" }, cursor: "ew-resize" }
|
|
8737
|
+
];
|
|
7214
8738
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
7215
8739
|
"div",
|
|
7216
8740
|
{
|
|
7217
8741
|
onMouseDown: handleDragStart,
|
|
7218
8742
|
style: {
|
|
7219
8743
|
position: "absolute",
|
|
7220
|
-
left:
|
|
7221
|
-
top:
|
|
7222
|
-
width:
|
|
7223
|
-
height:
|
|
8744
|
+
left: resolvedBox.left,
|
|
8745
|
+
top: resolvedBox.top,
|
|
8746
|
+
width: resolvedBox.width,
|
|
8747
|
+
height: resolvedBox.height,
|
|
8748
|
+
transform: rawShape.rotation ? `rotate(${rawShape.rotation}deg)` : void 0,
|
|
8749
|
+
transformOrigin: "center center",
|
|
8750
|
+
outline: selected ? "1.5px dashed #2C53F1" : void 0,
|
|
7224
8751
|
pointerEvents: "auto",
|
|
7225
8752
|
cursor: "move",
|
|
7226
|
-
zIndex: 24,
|
|
8753
|
+
zIndex: selected ? 28 : 24,
|
|
7227
8754
|
display: "flex",
|
|
7228
8755
|
alignItems: "center",
|
|
7229
8756
|
justifyContent: "center"
|
|
@@ -7234,18 +8761,18 @@ var FloatingShapeCard = ({ shape, displayText, onMove, onRemove }) => {
|
|
|
7234
8761
|
{
|
|
7235
8762
|
viewBox: "0 0 100 100",
|
|
7236
8763
|
preserveAspectRatio: "none",
|
|
7237
|
-
style: { position: "absolute", inset: 0, width: "100%", height: "100%" },
|
|
8764
|
+
style: { position: "absolute", inset: 0, width: "100%", height: "100%", overflow: "visible" },
|
|
7238
8765
|
children: renderShapeGeometry()
|
|
7239
8766
|
}
|
|
7240
8767
|
),
|
|
7241
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
8768
|
+
!isConnector && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7242
8769
|
"span",
|
|
7243
8770
|
{
|
|
7244
8771
|
style: {
|
|
7245
8772
|
position: "relative",
|
|
7246
8773
|
padding: "4px 8px",
|
|
7247
8774
|
color: textColor,
|
|
7248
|
-
fontSize: 12,
|
|
8775
|
+
fontSize: rawShape.fontSize || 12,
|
|
7249
8776
|
fontWeight: 600,
|
|
7250
8777
|
textAlign: "center",
|
|
7251
8778
|
lineHeight: 1.3,
|
|
@@ -7255,6 +8782,43 @@ var FloatingShapeCard = ({ shape, displayText, onMove, onRemove }) => {
|
|
|
7255
8782
|
children: displayText
|
|
7256
8783
|
}
|
|
7257
8784
|
),
|
|
8785
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
8786
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
8787
|
+
"div",
|
|
8788
|
+
{
|
|
8789
|
+
onMouseDown: handleRotateStart,
|
|
8790
|
+
title: `\u62D6\u62FD\u65CB\u8F6C\u56FE\u5F62 (${rawShape.rotation ?? 0}\xB0)`,
|
|
8791
|
+
style: {
|
|
8792
|
+
position: "absolute",
|
|
8793
|
+
left: "calc(50% - 5px)",
|
|
8794
|
+
top: -20,
|
|
8795
|
+
width: 10,
|
|
8796
|
+
height: 10,
|
|
8797
|
+
borderRadius: "50%",
|
|
8798
|
+
background: "#FFFFFF",
|
|
8799
|
+
border: "2px solid #2C53F1",
|
|
8800
|
+
cursor: "grab"
|
|
8801
|
+
}
|
|
8802
|
+
}
|
|
8803
|
+
),
|
|
8804
|
+
handles.map((h) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
8805
|
+
"div",
|
|
8806
|
+
{
|
|
8807
|
+
onMouseDown: handleResizeStart(h.dir),
|
|
8808
|
+
style: {
|
|
8809
|
+
position: "absolute",
|
|
8810
|
+
width: 8,
|
|
8811
|
+
height: 8,
|
|
8812
|
+
borderRadius: 2,
|
|
8813
|
+
background: "#FFFFFF",
|
|
8814
|
+
border: "1.5px solid #2C53F1",
|
|
8815
|
+
cursor: h.cursor,
|
|
8816
|
+
...h.style
|
|
8817
|
+
}
|
|
8818
|
+
},
|
|
8819
|
+
h.dir
|
|
8820
|
+
))
|
|
8821
|
+
] }),
|
|
7258
8822
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7259
8823
|
"button",
|
|
7260
8824
|
{
|
|
@@ -7306,6 +8870,8 @@ var SheetRichOverlayHost = () => {
|
|
|
7306
8870
|
);
|
|
7307
8871
|
const [tick, setTick] = (0, import_react5.useState)(0);
|
|
7308
8872
|
const [drillToast, setDrillToast] = (0, import_react5.useState)(null);
|
|
8873
|
+
const [selectedShapeId, setSelectedShapeId] = (0, import_react5.useState)(null);
|
|
8874
|
+
const [pageBreakPreviewMode, setPageBreakPreviewMode] = (0, import_react5.useState)(false);
|
|
7309
8875
|
(0, import_react5.useEffect)(() => {
|
|
7310
8876
|
if (!workbook) return;
|
|
7311
8877
|
const disp = commandService.onCommandExecuted((info) => {
|
|
@@ -7528,33 +9094,89 @@ var SheetRichOverlayHost = () => {
|
|
|
7528
9094
|
);
|
|
7529
9095
|
const outlines = (metadata.outlines ?? []).filter((o) => o.sheetId === activeSheetId);
|
|
7530
9096
|
const outlinePills2 = [];
|
|
9097
|
+
let maxRowOutlineLevel = 0;
|
|
9098
|
+
let maxColOutlineLevel = 0;
|
|
7531
9099
|
for (const o of outlines) {
|
|
7532
9100
|
if (o.dimension === "row") {
|
|
7533
|
-
|
|
7534
|
-
const
|
|
7535
|
-
const
|
|
9101
|
+
if (o.level > maxRowOutlineLevel) maxRowOutlineLevel = o.level;
|
|
9102
|
+
const startCoord = skeleton.getCellWithCoordByIndex(Math.max(0, o.startIndex), 0);
|
|
9103
|
+
const endCoord = skeleton.getCellWithCoordByIndex(Math.max(0, o.endIndex), 0);
|
|
9104
|
+
const top = (startCoord.startY - colHeaderH - vpScrollXY.y) * scaleY;
|
|
9105
|
+
const bottom = (endCoord.endY - colHeaderH - vpScrollXY.y) * scaleY;
|
|
7536
9106
|
const left = Math.max(2, (o.level - 1) * 18 + 2);
|
|
7537
|
-
if (
|
|
7538
|
-
outlinePills2.push({
|
|
9107
|
+
if (bottom >= -16 && top <= canvasRect.height) {
|
|
9108
|
+
outlinePills2.push({
|
|
9109
|
+
outline: o,
|
|
9110
|
+
left,
|
|
9111
|
+
top: Math.max(2, top + 2),
|
|
9112
|
+
spanSize: Math.max(16, bottom - top)
|
|
9113
|
+
});
|
|
7539
9114
|
}
|
|
7540
9115
|
} else {
|
|
7541
|
-
|
|
7542
|
-
const
|
|
7543
|
-
const
|
|
9116
|
+
if (o.level > maxColOutlineLevel) maxColOutlineLevel = o.level;
|
|
9117
|
+
const startCoord = skeleton.getCellWithCoordByIndex(0, Math.max(0, o.startIndex));
|
|
9118
|
+
const endCoord = skeleton.getCellWithCoordByIndex(0, Math.max(0, o.endIndex));
|
|
9119
|
+
const left = (startCoord.startX - rowHeaderW - vpScrollXY.x) * scaleX;
|
|
9120
|
+
const right = (endCoord.endX - rowHeaderW - vpScrollXY.x) * scaleX;
|
|
7544
9121
|
const top = Math.max(2, (o.level - 1) * 18 + 2);
|
|
7545
|
-
if (
|
|
7546
|
-
outlinePills2.push({
|
|
9122
|
+
if (right >= -16 && left <= canvasRect.width) {
|
|
9123
|
+
outlinePills2.push({
|
|
9124
|
+
outline: o,
|
|
9125
|
+
left: Math.max(2, left + 2),
|
|
9126
|
+
top,
|
|
9127
|
+
spanSize: Math.max(16, right - left)
|
|
9128
|
+
});
|
|
7547
9129
|
}
|
|
7548
9130
|
}
|
|
7549
9131
|
}
|
|
7550
|
-
const
|
|
7551
|
-
|
|
7552
|
-
|
|
9132
|
+
const effectiveSheetPrintCfg = (0, import_univer_sheets5.resolveWorksheetPrintConfig)(wbSnapWithMeta, activeSheetId, {
|
|
9133
|
+
printConfig: metadata.printConfig
|
|
9134
|
+
});
|
|
9135
|
+
const printOrientation = effectiveSheetPrintCfg.paperOrientation ?? effectiveSheetPrintCfg.orientation ?? metadata.printConfig?.paperOrientation ?? "A4_LANDSCAPE";
|
|
9136
|
+
const showPageBreakLines = features.printTemplate && (pageBreakPreviewMode || effectiveSheetPrintCfg.showPageBreakLines !== false);
|
|
9137
|
+
const isPortrait = printOrientation === "A4_PORTRAIT" || printOrientation === "portrait";
|
|
9138
|
+
const pageWidthPx = isPortrait ? 680 : printOrientation === "A3_LANDSCAPE" ? 1360 : printOrientation === "INVOICE_240_140" || printOrientation === "INVOICE_240_93" ? 820 : 980;
|
|
9139
|
+
const pageHeightPx = isPortrait ? 960 : 680;
|
|
7553
9140
|
const pageBreakX = (pageWidthPx - vpScrollXY.x) * scaleX;
|
|
9141
|
+
const manualRowBreaks = Array.isArray(effectiveSheetPrintCfg.rowBreaks) ? effectiveSheetPrintCfg.rowBreaks.filter((n) => Number.isFinite(n) && n >= 1) : [];
|
|
9142
|
+
const manualColBreaks = Array.isArray(effectiveSheetPrintCfg.colBreaks) ? effectiveSheetPrintCfg.colBreaks.filter((n) => Number.isFinite(n) && n >= 1) : [];
|
|
9143
|
+
const rowBreakLines = [];
|
|
9144
|
+
for (const brkId of manualRowBreaks) {
|
|
9145
|
+
const c = skeleton.getCellWithCoordByIndex(Math.max(0, brkId - 1), 0);
|
|
9146
|
+
const y = (c.endY - colHeaderH - vpScrollXY.y) * scaleY;
|
|
9147
|
+
rowBreakLines.push({ y, breakId: brkId, manual: true });
|
|
9148
|
+
}
|
|
9149
|
+
if (pageBreakPreviewMode) {
|
|
9150
|
+
for (let p = 1; p <= 4; p++) {
|
|
9151
|
+
const autoY = (p * pageHeightPx - vpScrollXY.y) * scaleY;
|
|
9152
|
+
if (!rowBreakLines.some((l) => Math.abs(l.y - autoY) < 24)) {
|
|
9153
|
+
const estRow = Math.max(1, Math.round(p * pageHeightPx / 24));
|
|
9154
|
+
rowBreakLines.push({ y: autoY, breakId: estRow, manual: false });
|
|
9155
|
+
}
|
|
9156
|
+
}
|
|
9157
|
+
}
|
|
9158
|
+
const colBreakLines = [];
|
|
9159
|
+
for (const brkId of manualColBreaks) {
|
|
9160
|
+
const c = skeleton.getCellWithCoordByIndex(0, Math.max(0, brkId - 1));
|
|
9161
|
+
const x = (c.endX - rowHeaderW - vpScrollXY.x) * scaleX;
|
|
9162
|
+
colBreakLines.push({ x, breakId: brkId, manual: true });
|
|
9163
|
+
}
|
|
9164
|
+
if (!colBreakLines.some((l) => Math.abs(l.x - pageBreakX) < 24)) {
|
|
9165
|
+
const estCol = Math.max(1, Math.round(pageWidthPx / 88));
|
|
9166
|
+
colBreakLines.push({ x: pageBreakX, breakId: estCol, manual: false });
|
|
9167
|
+
}
|
|
7554
9168
|
return {
|
|
7555
9169
|
unitId: unitId2,
|
|
7556
9170
|
sheetId: activeSheetId,
|
|
7557
9171
|
sheetCfg: sheetCfg2,
|
|
9172
|
+
metadata,
|
|
9173
|
+
effectiveSheetPrintCfg,
|
|
9174
|
+
skeleton,
|
|
9175
|
+
scaleX,
|
|
9176
|
+
scaleY,
|
|
9177
|
+
vpScrollXY,
|
|
9178
|
+
rowHeaderW,
|
|
9179
|
+
colHeaderH,
|
|
7558
9180
|
workbookSnapshot: workbook.save(),
|
|
7559
9181
|
viewportBox: {
|
|
7560
9182
|
left: canvasRect.left + rowHeaderW * scaleX,
|
|
@@ -7570,7 +9192,11 @@ var SheetRichOverlayHost = () => {
|
|
|
7570
9192
|
timelines: timelines2,
|
|
7571
9193
|
shapes: shapes2,
|
|
7572
9194
|
outlinePills: outlinePills2,
|
|
7573
|
-
|
|
9195
|
+
maxRowOutlineLevel,
|
|
9196
|
+
maxColOutlineLevel,
|
|
9197
|
+
rowBreakLines: rowBreakLines.sort((a, b) => a.y - b.y),
|
|
9198
|
+
colBreakLines: colBreakLines.sort((a, b) => a.x - b.x),
|
|
9199
|
+
overlayBackgroundUrl: effectiveSheetPrintCfg.overlayBackgroundUrl || effectiveSheetPrintCfg.backgroundImageUrl || metadata.printConfig?.overlayBackgroundUrl || metadata.printConfig?.backgroundImageUrl || "",
|
|
7574
9200
|
showPageBreakLines,
|
|
7575
9201
|
pageBreakX,
|
|
7576
9202
|
printOrientation
|
|
@@ -7579,6 +9205,7 @@ var SheetRichOverlayHost = () => {
|
|
|
7579
9205
|
workbook,
|
|
7580
9206
|
features.datasetBinding,
|
|
7581
9207
|
features.printTemplate,
|
|
9208
|
+
pageBreakPreviewMode,
|
|
7582
9209
|
tick,
|
|
7583
9210
|
metaVersion,
|
|
7584
9211
|
renderManagerService,
|
|
@@ -7600,7 +9227,8 @@ var SheetRichOverlayHost = () => {
|
|
|
7600
9227
|
} = overlayState;
|
|
7601
9228
|
const renderSparklineNode = (box) => {
|
|
7602
9229
|
const spark = box.meta.sparkline;
|
|
7603
|
-
const
|
|
9230
|
+
const rawRange = spark.dataRange.includes("!") ? spark.dataRange.slice(spark.dataRange.lastIndexOf("!") + 1) : spark.dataRange;
|
|
9231
|
+
const rng = (0, import_univer_sheets5.parseA1Range)(rawRange);
|
|
7604
9232
|
if (!rng) return null;
|
|
7605
9233
|
const vals = [];
|
|
7606
9234
|
for (let r = rng.startRow; r <= rng.endRow; r++) {
|
|
@@ -7610,8 +9238,9 @@ var SheetRichOverlayHost = () => {
|
|
|
7610
9238
|
}
|
|
7611
9239
|
}
|
|
7612
9240
|
if (vals.length === 0) return null;
|
|
7613
|
-
const color = spark.color || "#2C53F1";
|
|
7614
|
-
const negColor = spark.negativeColor || "#7D8698";
|
|
9241
|
+
const color = spark.colorSeries || spark.color || "#2C53F1";
|
|
9242
|
+
const negColor = spark.colorNegative || spark.negativeColor || "#7D8698";
|
|
9243
|
+
const mrkColor = spark.colorMarkers || spark.markerColor || "#1B1C1F";
|
|
7615
9244
|
const highVal = Math.max(...vals);
|
|
7616
9245
|
const lowVal = Math.min(...vals);
|
|
7617
9246
|
const highIdx = vals.indexOf(highVal);
|
|
@@ -7620,8 +9249,8 @@ var SheetRichOverlayHost = () => {
|
|
|
7620
9249
|
const max = Math.max(1, highVal);
|
|
7621
9250
|
const span = max - min || 1;
|
|
7622
9251
|
const isWinLoss = spark.type === "winLoss" || spark.type === "winloss";
|
|
7623
|
-
const isHighlighted = (idx) => spark.showHighPoint && idx === highIdx || spark.showLowPoint && idx === lowIdx || spark.showFirstPoint && idx === 0 || spark.showLastPoint && idx === vals.length - 1;
|
|
7624
|
-
if (spark.type === "bar" || isWinLoss) {
|
|
9252
|
+
const isHighlighted = (idx) => Boolean(spark.markers) || spark.showHighPoint && idx === highIdx || spark.showLowPoint && idx === lowIdx || spark.showFirstPoint && idx === 0 || spark.showLastPoint && idx === vals.length - 1;
|
|
9253
|
+
if (spark.type === "bar" || spark.type === "column" || isWinLoss) {
|
|
7625
9254
|
const bw = Math.max(4, Math.floor(82 / vals.length) - 2);
|
|
7626
9255
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { viewBox: "0 0 96 24", style: { width: "92%", height: "78%" }, children: [
|
|
7627
9256
|
isWinLoss && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("line", { x1: 4, y1: 12, x2: 92, y2: 12, stroke: "#E3E5EA", strokeWidth: 0.8 }),
|
|
@@ -7667,17 +9296,28 @@ var SheetRichOverlayHost = () => {
|
|
|
7667
9296
|
});
|
|
7668
9297
|
const pts = coords.map((p) => `${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(" ");
|
|
7669
9298
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { viewBox: "0 0 96 24", style: { width: "92%", height: "78%" }, children: [
|
|
9299
|
+
spark.displayXAxis && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
9300
|
+
"line",
|
|
9301
|
+
{
|
|
9302
|
+
x1: 4,
|
|
9303
|
+
y1: 20 - (0 - min) / span * 16,
|
|
9304
|
+
x2: 92,
|
|
9305
|
+
y2: 20 - (0 - min) / span * 16,
|
|
9306
|
+
stroke: "#CBD5E1",
|
|
9307
|
+
strokeWidth: 0.8
|
|
9308
|
+
}
|
|
9309
|
+
),
|
|
7670
9310
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polyline", { fill: "none", stroke: color, strokeWidth: 1.6, points: pts }),
|
|
7671
9311
|
coords.map((p) => {
|
|
7672
9312
|
const marker = isHighlighted(p.i);
|
|
7673
|
-
if (!marker && !(p.v < 0 && spark.negativeColor)) return null;
|
|
9313
|
+
if (!marker && !(p.v < 0 && (spark.negativeColor || spark.colorNegative))) return null;
|
|
7674
9314
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7675
9315
|
"circle",
|
|
7676
9316
|
{
|
|
7677
9317
|
cx: p.x,
|
|
7678
9318
|
cy: p.y,
|
|
7679
9319
|
r: 2.3,
|
|
7680
|
-
fill: p.v < 0 && spark.negativeColor ? negColor :
|
|
9320
|
+
fill: p.v < 0 && (spark.negativeColor || spark.colorNegative) ? negColor : mrkColor
|
|
7681
9321
|
},
|
|
7682
9322
|
p.i
|
|
7683
9323
|
);
|
|
@@ -7713,39 +9353,201 @@ var SheetRichOverlayHost = () => {
|
|
|
7713
9353
|
}
|
|
7714
9354
|
}
|
|
7715
9355
|
),
|
|
7716
|
-
|
|
7717
|
-
"
|
|
9356
|
+
features.printTemplate && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
9357
|
+
"button",
|
|
7718
9358
|
{
|
|
9359
|
+
type: "button",
|
|
9360
|
+
onClick: () => setPageBreakPreviewMode((v) => !v),
|
|
7719
9361
|
style: {
|
|
7720
9362
|
position: "absolute",
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
9363
|
+
top: 6,
|
|
9364
|
+
right: 10,
|
|
9365
|
+
background: pageBreakPreviewMode ? "#2C53F1" : "rgba(255,255,255,0.92)",
|
|
9366
|
+
color: pageBreakPreviewMode ? "#FFFFFF" : "#4E5565",
|
|
9367
|
+
border: `1px solid ${pageBreakPreviewMode ? "#2C53F1" : "#D2DAFA"}`,
|
|
9368
|
+
borderRadius: 999,
|
|
9369
|
+
fontSize: 10.5,
|
|
9370
|
+
fontWeight: 600,
|
|
9371
|
+
padding: "2px 8px",
|
|
9372
|
+
cursor: "pointer",
|
|
9373
|
+
pointerEvents: "auto",
|
|
9374
|
+
zIndex: 30
|
|
7727
9375
|
},
|
|
7728
|
-
children:
|
|
7729
|
-
|
|
9376
|
+
children: pageBreakPreviewMode ? "\u9000\u51FA\u5206\u9875\u9884\u89C8" : "\u5206\u9875\u9884\u89C8"
|
|
9377
|
+
}
|
|
9378
|
+
),
|
|
9379
|
+
overlayState.showPageBreakLines && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
9380
|
+
overlayState.colBreakLines.map((cb, cbIdx) => {
|
|
9381
|
+
if (cb.x <= 12 || cb.x >= viewportBox.width) return null;
|
|
9382
|
+
const handleColBreakDrag = (e) => {
|
|
9383
|
+
e.preventDefault();
|
|
9384
|
+
e.stopPropagation();
|
|
9385
|
+
const onUp = (upEv) => {
|
|
9386
|
+
window.removeEventListener("mouseup", onUp);
|
|
9387
|
+
const localX = (upEv.clientX - viewportBox.left) / (overlayState.scaleX || 1) + overlayState.rowHeaderW + overlayState.vpScrollXY.x;
|
|
9388
|
+
let targetCol = 1;
|
|
9389
|
+
for (let c = 0; c < 120; c++) {
|
|
9390
|
+
const coord = overlayState.skeleton.getCellWithCoordByIndex(0, c);
|
|
9391
|
+
if (localX <= coord.endX) {
|
|
9392
|
+
targetCol = c + 1;
|
|
9393
|
+
break;
|
|
9394
|
+
}
|
|
9395
|
+
}
|
|
9396
|
+
const prevList = Array.isArray(overlayState.effectiveSheetPrintCfg.colBreaks) ? overlayState.effectiveSheetPrintCfg.colBreaks.filter((x) => x !== cb.breakId) : [];
|
|
9397
|
+
const nextCols = Array.from(/* @__PURE__ */ new Set([...prevList, targetCol])).sort((a, b) => a - b);
|
|
9398
|
+
const prevPrint = overlayState.metadata.printConfig ?? {};
|
|
9399
|
+
templateService.patchPrintConfig(unitId, {
|
|
9400
|
+
colBreaks: nextCols,
|
|
9401
|
+
bySheetId: {
|
|
9402
|
+
...prevPrint.bySheetId ?? {},
|
|
9403
|
+
[sheetId]: {
|
|
9404
|
+
...prevPrint.bySheetId?.[sheetId] ?? {},
|
|
9405
|
+
colBreaks: nextCols
|
|
9406
|
+
}
|
|
9407
|
+
}
|
|
9408
|
+
});
|
|
9409
|
+
};
|
|
9410
|
+
window.addEventListener("mouseup", onUp);
|
|
9411
|
+
};
|
|
9412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
9413
|
+
"div",
|
|
7730
9414
|
{
|
|
9415
|
+
onMouseDown: handleColBreakDrag,
|
|
9416
|
+
title: "\u62D6\u62FD\u8C03\u6574\u7EB5\u5411\u5206\u9875\u7B26\u4F4D\u7F6E",
|
|
7731
9417
|
style: {
|
|
7732
9418
|
position: "absolute",
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
padding: "1px 5px",
|
|
7742
|
-
whiteSpace: "nowrap"
|
|
9419
|
+
left: cb.x,
|
|
9420
|
+
top: 0,
|
|
9421
|
+
bottom: 0,
|
|
9422
|
+
width: 5,
|
|
9423
|
+
borderLeft: cb.manual ? "2px solid #1D4ED8" : "1.5px dashed #3B82F6",
|
|
9424
|
+
cursor: "col-resize",
|
|
9425
|
+
pointerEvents: pageBreakPreviewMode || cb.manual ? "auto" : "none",
|
|
9426
|
+
zIndex: 9
|
|
7743
9427
|
},
|
|
7744
|
-
children:
|
|
9428
|
+
children: cbIdx === 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
9429
|
+
"span",
|
|
9430
|
+
{
|
|
9431
|
+
style: {
|
|
9432
|
+
position: "absolute",
|
|
9433
|
+
top: 30,
|
|
9434
|
+
right: 6,
|
|
9435
|
+
background: "#F3F5FF",
|
|
9436
|
+
color: "#2C53F1",
|
|
9437
|
+
border: "1px solid #D2DAFA",
|
|
9438
|
+
borderRadius: 4,
|
|
9439
|
+
fontSize: 9.5,
|
|
9440
|
+
fontWeight: 600,
|
|
9441
|
+
padding: "1px 5px",
|
|
9442
|
+
whiteSpace: "nowrap",
|
|
9443
|
+
pointerEvents: "none"
|
|
9444
|
+
},
|
|
9445
|
+
children: t("yudaoSheets.overlay.pageBreakBadge")
|
|
9446
|
+
}
|
|
9447
|
+
)
|
|
9448
|
+
},
|
|
9449
|
+
`cb-${cbIdx}-${cb.breakId}`
|
|
9450
|
+
);
|
|
9451
|
+
}),
|
|
9452
|
+
overlayState.rowBreakLines.map((rb, rbIdx) => {
|
|
9453
|
+
if (rb.y <= 12 || rb.y >= viewportBox.height) return null;
|
|
9454
|
+
const handleRowBreakDrag = (e) => {
|
|
9455
|
+
e.preventDefault();
|
|
9456
|
+
e.stopPropagation();
|
|
9457
|
+
const onUp = (upEv) => {
|
|
9458
|
+
window.removeEventListener("mouseup", onUp);
|
|
9459
|
+
const localY = (upEv.clientY - viewportBox.top) / (overlayState.scaleY || 1) + overlayState.colHeaderH + overlayState.vpScrollXY.y;
|
|
9460
|
+
let targetRow = 1;
|
|
9461
|
+
for (let r = 0; r < 500; r++) {
|
|
9462
|
+
const coord = overlayState.skeleton.getCellWithCoordByIndex(r, 0);
|
|
9463
|
+
if (localY <= coord.endY) {
|
|
9464
|
+
targetRow = r + 1;
|
|
9465
|
+
break;
|
|
9466
|
+
}
|
|
9467
|
+
}
|
|
9468
|
+
const prevList = Array.isArray(overlayState.effectiveSheetPrintCfg.rowBreaks) ? overlayState.effectiveSheetPrintCfg.rowBreaks.filter((x) => x !== rb.breakId) : [];
|
|
9469
|
+
const nextRows = Array.from(/* @__PURE__ */ new Set([...prevList, targetRow])).sort((a, b) => a - b);
|
|
9470
|
+
const prevPrint = overlayState.metadata.printConfig ?? {};
|
|
9471
|
+
templateService.patchPrintConfig(unitId, {
|
|
9472
|
+
rowBreaks: nextRows,
|
|
9473
|
+
bySheetId: {
|
|
9474
|
+
...prevPrint.bySheetId ?? {},
|
|
9475
|
+
[sheetId]: {
|
|
9476
|
+
...prevPrint.bySheetId?.[sheetId] ?? {},
|
|
9477
|
+
rowBreaks: nextRows
|
|
9478
|
+
}
|
|
9479
|
+
}
|
|
9480
|
+
});
|
|
9481
|
+
};
|
|
9482
|
+
window.addEventListener("mouseup", onUp);
|
|
9483
|
+
};
|
|
9484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
9485
|
+
"div",
|
|
9486
|
+
{
|
|
9487
|
+
onMouseDown: handleRowBreakDrag,
|
|
9488
|
+
title: "\u62D6\u62FD\u8C03\u6574\u6A2A\u5411\u5206\u9875\u7B26\u4F4D\u7F6E",
|
|
9489
|
+
style: {
|
|
9490
|
+
position: "absolute",
|
|
9491
|
+
left: 0,
|
|
9492
|
+
right: 0,
|
|
9493
|
+
top: rb.y,
|
|
9494
|
+
height: 5,
|
|
9495
|
+
borderTop: rb.manual ? "2px solid #1D4ED8" : "1.5px dashed #3B82F6",
|
|
9496
|
+
cursor: "row-resize",
|
|
9497
|
+
pointerEvents: "auto",
|
|
9498
|
+
zIndex: 9
|
|
9499
|
+
}
|
|
9500
|
+
},
|
|
9501
|
+
`rb-${rbIdx}-${rb.breakId}`
|
|
9502
|
+
);
|
|
9503
|
+
}),
|
|
9504
|
+
pageBreakPreviewMode && (() => {
|
|
9505
|
+
const yStops = [0, ...overlayState.rowBreakLines.map((r) => r.y).filter((y) => y > 0)];
|
|
9506
|
+
const xStops = [0, ...overlayState.colBreakLines.map((c) => c.x).filter((x) => x > 0)];
|
|
9507
|
+
const marks = [];
|
|
9508
|
+
let pageSeq = 1;
|
|
9509
|
+
for (let rIdx = 0; rIdx < Math.min(3, yStops.length); rIdx++) {
|
|
9510
|
+
const y0 = yStops[rIdx];
|
|
9511
|
+
const y1 = yStops[rIdx + 1] ?? viewportBox.height;
|
|
9512
|
+
for (let cIdx = 0; cIdx < Math.min(2, xStops.length); cIdx++) {
|
|
9513
|
+
const x0 = xStops[cIdx];
|
|
9514
|
+
const x1 = xStops[cIdx + 1] ?? viewportBox.width;
|
|
9515
|
+
const cx = (x0 + Math.min(x1, viewportBox.width)) / 2;
|
|
9516
|
+
const cy = (y0 + Math.min(y1, viewportBox.height)) / 2;
|
|
9517
|
+
const pNum = pageSeq++;
|
|
9518
|
+
if (cx > 40 && cy > 30 && cx < viewportBox.width && cy < viewportBox.height) {
|
|
9519
|
+
marks.push(
|
|
9520
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
9521
|
+
"div",
|
|
9522
|
+
{
|
|
9523
|
+
style: {
|
|
9524
|
+
position: "absolute",
|
|
9525
|
+
left: cx,
|
|
9526
|
+
top: cy,
|
|
9527
|
+
transform: "translate(-50%, -50%)",
|
|
9528
|
+
fontSize: 28,
|
|
9529
|
+
fontWeight: 800,
|
|
9530
|
+
color: "rgba(37, 99, 235, 0.16)",
|
|
9531
|
+
letterSpacing: 2,
|
|
9532
|
+
pointerEvents: "none",
|
|
9533
|
+
userSelect: "none",
|
|
9534
|
+
zIndex: 7
|
|
9535
|
+
},
|
|
9536
|
+
children: [
|
|
9537
|
+
"\u7B2C ",
|
|
9538
|
+
pNum,
|
|
9539
|
+
" \u9875"
|
|
9540
|
+
]
|
|
9541
|
+
},
|
|
9542
|
+
`wm-${pNum}`
|
|
9543
|
+
)
|
|
9544
|
+
);
|
|
9545
|
+
}
|
|
7745
9546
|
}
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
9547
|
+
}
|
|
9548
|
+
return marks;
|
|
9549
|
+
})()
|
|
9550
|
+
] }),
|
|
7749
9551
|
drillToast && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
7750
9552
|
"div",
|
|
7751
9553
|
{
|
|
@@ -8016,60 +9818,202 @@ var SheetRichOverlayHost = () => {
|
|
|
8016
9818
|
},
|
|
8017
9819
|
ch.id
|
|
8018
9820
|
)),
|
|
8019
|
-
|
|
8020
|
-
"
|
|
9821
|
+
(overlayState.maxRowOutlineLevel > 0 || overlayState.maxColOutlineLevel > 0) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
9822
|
+
"div",
|
|
8021
9823
|
{
|
|
8022
|
-
type: "button",
|
|
8023
|
-
title: `${outline.dimension === "row" ? "\u884C" : "\u5217"}\u5206\u7EA7\u7EC4\u5408 L${outline.level} (${outline.startIndex + 1}-${outline.endIndex + 1})`,
|
|
8024
|
-
onClick: (e) => {
|
|
8025
|
-
e.stopPropagation();
|
|
8026
|
-
commandService.syncExecuteCommand(import_univer_sheets5.ToggleSheetOutlineCommand.id, {
|
|
8027
|
-
unitId,
|
|
8028
|
-
outlineId: outline.id
|
|
8029
|
-
});
|
|
8030
|
-
},
|
|
8031
9824
|
style: {
|
|
8032
9825
|
position: "absolute",
|
|
8033
|
-
left,
|
|
8034
|
-
top,
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
9826
|
+
left: 4,
|
|
9827
|
+
top: 4,
|
|
9828
|
+
display: "flex",
|
|
9829
|
+
alignItems: "center",
|
|
9830
|
+
gap: 3,
|
|
9831
|
+
padding: "2px 5px",
|
|
9832
|
+
borderRadius: 5,
|
|
9833
|
+
background: "rgba(249, 250, 251, 0.95)",
|
|
8038
9834
|
border: "1px solid #D2DAFA",
|
|
8039
|
-
background: outline.collapsed ? "#F3F5FF" : "#FFFFFF",
|
|
8040
|
-
color: "#2C53F1",
|
|
8041
|
-
fontSize: 11,
|
|
8042
|
-
fontWeight: 700,
|
|
8043
|
-
lineHeight: 1,
|
|
8044
|
-
padding: 0,
|
|
8045
|
-
cursor: "pointer",
|
|
8046
9835
|
pointerEvents: "auto",
|
|
8047
|
-
zIndex:
|
|
9836
|
+
zIndex: 23
|
|
8048
9837
|
},
|
|
8049
|
-
children:
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
9838
|
+
children: [
|
|
9839
|
+
overlayState.maxRowOutlineLevel > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 2 }, children: [
|
|
9840
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: 9.5, color: "#4E5565", fontWeight: 600 }, children: "\u884C\u7EA7" }),
|
|
9841
|
+
Array.from({ length: overlayState.maxRowOutlineLevel + 1 }, (_, i) => i + 1).map(
|
|
9842
|
+
(lvl) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
9843
|
+
"button",
|
|
9844
|
+
{
|
|
9845
|
+
type: "button",
|
|
9846
|
+
title: `\u5C55\u5F00\u884C\u5927\u7EB2\u81F3\u7B2C ${lvl} \u7EA7`,
|
|
9847
|
+
onClick: (e) => {
|
|
9848
|
+
e.stopPropagation();
|
|
9849
|
+
commandService.syncExecuteCommand(import_univer_sheets5.ExpandSheetOutlineToLevelCommand.id, {
|
|
9850
|
+
unitId,
|
|
9851
|
+
sheetId,
|
|
9852
|
+
dimension: "row",
|
|
9853
|
+
maxVisibleLevel: lvl
|
|
9854
|
+
});
|
|
9855
|
+
},
|
|
9856
|
+
style: {
|
|
9857
|
+
width: 15,
|
|
9858
|
+
height: 15,
|
|
9859
|
+
borderRadius: 3,
|
|
9860
|
+
border: "1px solid #CBD5E1",
|
|
9861
|
+
background: "#FFFFFF",
|
|
9862
|
+
color: "#1B1C1F",
|
|
9863
|
+
fontSize: 9.5,
|
|
9864
|
+
fontWeight: 700,
|
|
9865
|
+
padding: 0,
|
|
9866
|
+
cursor: "pointer"
|
|
9867
|
+
},
|
|
9868
|
+
children: lvl
|
|
9869
|
+
},
|
|
9870
|
+
`rlvl-${lvl}`
|
|
9871
|
+
)
|
|
9872
|
+
)
|
|
9873
|
+
] }),
|
|
9874
|
+
overlayState.maxColOutlineLevel > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { style: { display: "inline-flex", alignItems: "center", gap: 2, marginLeft: 4 }, children: [
|
|
9875
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { fontSize: 9.5, color: "#4E5565", fontWeight: 600 }, children: "\u5217\u7EA7" }),
|
|
9876
|
+
Array.from({ length: overlayState.maxColOutlineLevel + 1 }, (_, i) => i + 1).map(
|
|
9877
|
+
(lvl) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
9878
|
+
"button",
|
|
9879
|
+
{
|
|
9880
|
+
type: "button",
|
|
9881
|
+
title: `\u5C55\u5F00\u5217\u5927\u7EB2\u81F3\u7B2C ${lvl} \u7EA7`,
|
|
9882
|
+
onClick: (e) => {
|
|
9883
|
+
e.stopPropagation();
|
|
9884
|
+
commandService.syncExecuteCommand(import_univer_sheets5.ExpandSheetOutlineToLevelCommand.id, {
|
|
9885
|
+
unitId,
|
|
9886
|
+
sheetId,
|
|
9887
|
+
dimension: "column",
|
|
9888
|
+
maxVisibleLevel: lvl
|
|
9889
|
+
});
|
|
9890
|
+
},
|
|
9891
|
+
style: {
|
|
9892
|
+
width: 15,
|
|
9893
|
+
height: 15,
|
|
9894
|
+
borderRadius: 3,
|
|
9895
|
+
border: "1px solid #CBD5E1",
|
|
9896
|
+
background: "#FFFFFF",
|
|
9897
|
+
color: "#1B1C1F",
|
|
9898
|
+
fontSize: 9.5,
|
|
9899
|
+
fontWeight: 700,
|
|
9900
|
+
padding: 0,
|
|
9901
|
+
cursor: "pointer"
|
|
9902
|
+
},
|
|
9903
|
+
children: lvl
|
|
9904
|
+
},
|
|
9905
|
+
`clvl-${lvl}`
|
|
9906
|
+
)
|
|
9907
|
+
)
|
|
9908
|
+
] }),
|
|
9909
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
9910
|
+
"button",
|
|
9911
|
+
{
|
|
9912
|
+
type: "button",
|
|
9913
|
+
title: "\u65B0\u589E\u884C\u5206\u7EC4 (AddSheetOutlineGroupCommand)",
|
|
9914
|
+
onClick: (e) => {
|
|
9915
|
+
e.stopPropagation();
|
|
9916
|
+
commandService.syncExecuteCommand(import_univer_sheets5.AddSheetOutlineGroupCommand.id, {
|
|
9917
|
+
unitId,
|
|
9918
|
+
sheetId,
|
|
9919
|
+
dimension: "row",
|
|
9920
|
+
startIndex: 1,
|
|
9921
|
+
endIndex: 3
|
|
9922
|
+
});
|
|
9923
|
+
},
|
|
9924
|
+
style: {
|
|
9925
|
+
height: 15,
|
|
9926
|
+
borderRadius: 3,
|
|
9927
|
+
border: "1px solid #D2DAFA",
|
|
9928
|
+
background: "#F3F5FF",
|
|
9929
|
+
color: "#2C53F1",
|
|
9930
|
+
fontSize: 9.5,
|
|
9931
|
+
fontWeight: 600,
|
|
9932
|
+
padding: "0 4px",
|
|
9933
|
+
cursor: "pointer"
|
|
9934
|
+
},
|
|
9935
|
+
children: "+\u7EC4"
|
|
9936
|
+
}
|
|
9937
|
+
)
|
|
9938
|
+
]
|
|
9939
|
+
}
|
|
9940
|
+
),
|
|
9941
|
+
outlinePills.map(({ outline, left, top, spanSize }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react5.default.Fragment, { children: [
|
|
9942
|
+
!outline.collapsed && spanSize > 20 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
9943
|
+
"div",
|
|
9944
|
+
{
|
|
9945
|
+
style: {
|
|
9946
|
+
position: "absolute",
|
|
9947
|
+
left: outline.dimension === "row" ? left + 7 : left + 16,
|
|
9948
|
+
top: outline.dimension === "row" ? top + 28 : top + 7,
|
|
9949
|
+
width: outline.dimension === "row" ? 4 : Math.max(4, spanSize - 18),
|
|
9950
|
+
height: outline.dimension === "row" ? Math.max(4, spanSize - 18) : 4,
|
|
9951
|
+
borderLeft: outline.dimension === "row" ? "2px solid #93C5FD" : void 0,
|
|
9952
|
+
borderBottom: outline.dimension === "row" ? "2px solid #93C5FD" : void 0,
|
|
9953
|
+
borderTop: outline.dimension === "column" ? "2px solid #93C5FD" : void 0,
|
|
9954
|
+
borderRight: outline.dimension === "column" ? "2px solid #93C5FD" : void 0,
|
|
9955
|
+
pointerEvents: "none",
|
|
9956
|
+
zIndex: 21
|
|
9957
|
+
}
|
|
9958
|
+
}
|
|
9959
|
+
),
|
|
9960
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
9961
|
+
"button",
|
|
9962
|
+
{
|
|
9963
|
+
type: "button",
|
|
9964
|
+
title: `${outline.dimension === "row" ? "\u884C" : "\u5217"}\u5206\u7EA7\u7EC4\u5408 L${outline.level} (${outline.startIndex + 1}-${outline.endIndex + 1})`,
|
|
9965
|
+
onClick: (e) => {
|
|
9966
|
+
e.stopPropagation();
|
|
9967
|
+
commandService.syncExecuteCommand(import_univer_sheets5.ToggleSheetOutlineCollapseCommand.id, {
|
|
9968
|
+
unitId,
|
|
9969
|
+
outlineId: outline.id
|
|
9970
|
+
});
|
|
9971
|
+
},
|
|
9972
|
+
style: {
|
|
9973
|
+
position: "absolute",
|
|
9974
|
+
left,
|
|
9975
|
+
top: outline.dimension === "row" ? top + 24 : top,
|
|
9976
|
+
width: 16,
|
|
9977
|
+
height: 16,
|
|
9978
|
+
borderRadius: 4,
|
|
9979
|
+
border: "1px solid #D2DAFA",
|
|
9980
|
+
background: outline.collapsed ? "#F3F5FF" : "#FFFFFF",
|
|
9981
|
+
color: "#2C53F1",
|
|
9982
|
+
fontSize: 11,
|
|
9983
|
+
fontWeight: 700,
|
|
9984
|
+
lineHeight: 1,
|
|
9985
|
+
padding: 0,
|
|
9986
|
+
cursor: "pointer",
|
|
9987
|
+
pointerEvents: "auto",
|
|
9988
|
+
zIndex: 22
|
|
9989
|
+
},
|
|
9990
|
+
children: outline.collapsed ? "+" : "-"
|
|
9991
|
+
}
|
|
9992
|
+
)
|
|
9993
|
+
] }, outline.id)),
|
|
8053
9994
|
shapes.map((sh) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
8054
9995
|
FloatingShapeCard,
|
|
8055
9996
|
{
|
|
9997
|
+
rawShape: sh,
|
|
9998
|
+
allShapes: shapes,
|
|
9999
|
+
scrollX: overlayState.scrollX,
|
|
10000
|
+
scrollY: overlayState.scrollY,
|
|
10001
|
+
selected: selectedShapeId === sh.id,
|
|
8056
10002
|
shape: {
|
|
8057
10003
|
...sh,
|
|
8058
10004
|
left: sh.left - overlayState.scrollX,
|
|
8059
10005
|
top: sh.top - overlayState.scrollY
|
|
8060
10006
|
},
|
|
8061
10007
|
displayText: (0, import_univer_sheets5.resolveShapeDisplayText)(sheetCfg, sh),
|
|
8062
|
-
|
|
8063
|
-
|
|
10008
|
+
onSelect: () => setSelectedShapeId(sh.id),
|
|
10009
|
+
onUpdate: (nextShape) => {
|
|
10010
|
+
commandService.syncExecuteCommand(import_univer_sheets5.UpdateSheetShapeCommand.id, {
|
|
8064
10011
|
unitId,
|
|
8065
|
-
shape:
|
|
8066
|
-
...sh,
|
|
8067
|
-
left: nextVisL + overlayState.scrollX,
|
|
8068
|
-
top: nextVisT + overlayState.scrollY
|
|
8069
|
-
}
|
|
10012
|
+
shape: nextShape
|
|
8070
10013
|
});
|
|
8071
10014
|
},
|
|
8072
10015
|
onRemove: () => {
|
|
10016
|
+
if (selectedShapeId === sh.id) setSelectedShapeId(null);
|
|
8073
10017
|
commandService.syncExecuteCommand(import_univer_sheets5.RemoveSheetShapeCommand.id, {
|
|
8074
10018
|
unitId,
|
|
8075
10019
|
shapeId: sh.id
|