@yudaocode/univer-sheets-ui 1.6.211 → 1.6.213

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -561,6 +561,9 @@ var SheetInspectorPanel = () => {
561
561
  const [chartTrendline, setChartTrendline] = (0, import_react2.useState)("none");
562
562
  const [chartLogScale, setChartLogScale] = (0, import_react2.useState)(false);
563
563
  const [chartThreeD, setChartThreeD] = (0, import_react2.useState)(false);
564
+ const [chartSmooth, setChartSmooth] = (0, import_react2.useState)(false);
565
+ const [chartShowLegend, setChartShowLegend] = (0, import_react2.useState)(true);
566
+ const [chartLegendPos, setChartLegendPos] = (0, import_react2.useState)("right");
564
567
  const [auditOutput, setAuditOutput] = (0, import_react2.useState)("");
565
568
  const [goalTargetCell, setGoalTargetCell] = (0, import_react2.useState)("F10");
566
569
  const [goalTargetValue, setGoalTargetValue] = (0, import_react2.useState)("1000");
@@ -2304,7 +2307,18 @@ var SheetInspectorPanel = () => {
2304
2307
  }
2305
2308
  )
2306
2309
  ] }),
2307
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", gap: 8, paddingBottom: 4, fontSize: 11, color: "#31363F" }, children: [
2310
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, paddingBottom: 4, fontSize: 11, color: "#31363F" }, children: [
2311
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" }, children: [
2312
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2313
+ "input",
2314
+ {
2315
+ type: "checkbox",
2316
+ checked: chartSmooth || chartType.endsWith("Smooth"),
2317
+ onChange: (e) => setChartSmooth(e.target.checked)
2318
+ }
2319
+ ),
2320
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5E73\u6ED1\u66F2\u7EBF" })
2321
+ ] }),
2308
2322
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" }, children: [
2309
2323
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2310
2324
  "input",
@@ -2329,6 +2343,51 @@ var SheetInspectorPanel = () => {
2329
2343
  ] })
2330
2344
  ] })
2331
2345
  ] }),
2346
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "0.9fr 1.1fr", gap: 4, alignItems: "end" }, children: [
2347
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2348
+ "label",
2349
+ {
2350
+ style: {
2351
+ display: "flex",
2352
+ alignItems: "center",
2353
+ gap: 6,
2354
+ paddingBottom: 4,
2355
+ fontSize: 11,
2356
+ color: "#31363F",
2357
+ cursor: "pointer"
2358
+ },
2359
+ children: [
2360
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2361
+ "input",
2362
+ {
2363
+ type: "checkbox",
2364
+ checked: chartShowLegend,
2365
+ onChange: (e) => setChartShowLegend(e.target.checked)
2366
+ }
2367
+ ),
2368
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u663E\u793A\u56FE\u4F8B" })
2369
+ ]
2370
+ }
2371
+ ),
2372
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
2373
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u56FE\u4F8B\u4F4D\u7F6E" }),
2374
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2375
+ "select",
2376
+ {
2377
+ value: chartLegendPos,
2378
+ disabled: !chartShowLegend,
2379
+ onChange: (e) => setChartLegendPos(e.target.value),
2380
+ children: [
2381
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "right", children: "\u53F3\u4FA7 (Right)" }),
2382
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "top", children: "\u9876\u90E8 (Top)" }),
2383
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "bottom", children: "\u5E95\u90E8 (Bottom)" }),
2384
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "left", children: "\u5DE6\u4FA7 (Left)" }),
2385
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "topRight", children: "\u53F3\u4E0A\u89D2 (TopRight)" })
2386
+ ]
2387
+ }
2388
+ )
2389
+ ] })
2390
+ ] }),
2332
2391
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
2333
2392
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2334
2393
  "button",
@@ -2336,6 +2395,7 @@ var SheetInspectorPanel = () => {
2336
2395
  type: "button",
2337
2396
  className: "yudao-sheet-btn is-soft-primary",
2338
2397
  onClick: () => {
2398
+ const isSmoothEnabled = chartType.startsWith("line") && (chartSmooth || chartType.endsWith("Smooth"));
2339
2399
  templateService.addOrUpdateChart(unitId, {
2340
2400
  id: `chart-${(0, import_core4.generateRandomId)(5)}`,
2341
2401
  sheetId: sheet.getSheetId(),
@@ -2343,6 +2403,9 @@ var SheetInspectorPanel = () => {
2343
2403
  chartType,
2344
2404
  categoryRange: chartCatRange || "B6:B9",
2345
2405
  valueRange: chartValRange || "F6:F9",
2406
+ smooth: isSmoothEnabled ? true : void 0,
2407
+ showLegend: chartShowLegend,
2408
+ legendPosition: chartShowLegend ? chartLegendPos : void 0,
2346
2409
  trendline: chartTrendline !== "none" ? chartTrendline : void 0,
2347
2410
  yAxisScale: chartLogScale ? "log" : "linear",
2348
2411
  threeD: chartThreeD ? { rotX: 15, rotY: 20 } : void 0,
@@ -2361,6 +2424,7 @@ var SheetInspectorPanel = () => {
2361
2424
  type: "button",
2362
2425
  className: "yudao-sheet-btn",
2363
2426
  onClick: () => {
2427
+ const isSmoothEnabled = chartType.startsWith("line") && (chartSmooth || chartType.endsWith("Smooth"));
2364
2428
  commandService.syncExecuteCommand(import_univer_sheets2.InsertChartSheetCommand.id, {
2365
2429
  unitId,
2366
2430
  name: chartTitle || "\u56FE\u8868\u5DE5\u4F5C\u8868",
@@ -2371,6 +2435,9 @@ var SheetInspectorPanel = () => {
2371
2435
  chartType,
2372
2436
  categoryRange: chartCatRange || "B6:B9",
2373
2437
  valueRange: chartValRange || "F6:F9",
2438
+ smooth: isSmoothEnabled ? true : void 0,
2439
+ showLegend: chartShowLegend,
2440
+ legendPosition: chartShowLegend ? chartLegendPos : void 0,
2374
2441
  trendline: chartTrendline !== "none" ? chartTrendline : void 0,
2375
2442
  yAxisScale: chartLogScale ? "log" : "linear",
2376
2443
  threeD: chartThreeD ? { rotX: 15, rotY: 20 } : void 0,
@@ -5810,7 +5877,7 @@ var BuiltinSvgChart = ({ chart, data, onSelectItem }) => {
5810
5877
  index
5811
5878
  });
5812
5879
  };
5813
- const hasWave2Config = Boolean(chart.trendline) && chart.trendline !== "none" || Boolean(chart.errorBars && chart.errorBars.length > 0) || chart.yAxisScale === "log" || Boolean(chart.threeD) || chart.radarShape === "circle" || chart.radarFill !== void 0;
5880
+ const hasWave2Config = Boolean(chart.trendline) && chart.trendline !== "none" || Boolean(chart.errorBars && chart.errorBars.length > 0) || chart.yAxisScale === "log" || Boolean(chart.threeD) || chart.radarShape === "circle" || chart.radarFill !== void 0 || Boolean(chart.smooth) || cType === "lineSmooth" || cType === "lineStackedSmooth" || cType === "linePercentStackedSmooth" || chart.showLegend !== void 0 || Boolean(chart.legendPosition) || Boolean(chart.seriesOrientation) || Boolean(chart.series && chart.series.length > 0);
5814
5881
  if (!LEGACY_INLINE_CHART_TYPES.has(cType) || hasWave2Config) {
5815
5882
  const svgHtml = (0, import_univer_sheets5.renderSheetChartSvg)(chart, data).replace(
5816
5883
  "<svg ",