@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/es/index.js CHANGED
@@ -390,6 +390,9 @@ var SheetInspectorPanel = () => {
390
390
  const [chartTrendline, setChartTrendline] = useState("none");
391
391
  const [chartLogScale, setChartLogScale] = useState(false);
392
392
  const [chartThreeD, setChartThreeD] = useState(false);
393
+ const [chartSmooth, setChartSmooth] = useState(false);
394
+ const [chartShowLegend, setChartShowLegend] = useState(true);
395
+ const [chartLegendPos, setChartLegendPos] = useState("right");
393
396
  const [auditOutput, setAuditOutput] = useState("");
394
397
  const [goalTargetCell, setGoalTargetCell] = useState("F10");
395
398
  const [goalTargetValue, setGoalTargetValue] = useState("1000");
@@ -2133,7 +2136,18 @@ var SheetInspectorPanel = () => {
2133
2136
  }
2134
2137
  )
2135
2138
  ] }),
2136
- /* @__PURE__ */ jsxs2("div", { style: { display: "flex", gap: 8, paddingBottom: 4, fontSize: 11, color: "#31363F" }, children: [
2139
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexWrap: "wrap", gap: 8, paddingBottom: 4, fontSize: 11, color: "#31363F" }, children: [
2140
+ /* @__PURE__ */ jsxs2("label", { style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" }, children: [
2141
+ /* @__PURE__ */ jsx2(
2142
+ "input",
2143
+ {
2144
+ type: "checkbox",
2145
+ checked: chartSmooth || chartType.endsWith("Smooth"),
2146
+ onChange: (e) => setChartSmooth(e.target.checked)
2147
+ }
2148
+ ),
2149
+ /* @__PURE__ */ jsx2("span", { children: "\u5E73\u6ED1\u66F2\u7EBF" })
2150
+ ] }),
2137
2151
  /* @__PURE__ */ jsxs2("label", { style: { display: "flex", alignItems: "center", gap: 4, cursor: "pointer" }, children: [
2138
2152
  /* @__PURE__ */ jsx2(
2139
2153
  "input",
@@ -2158,6 +2172,51 @@ var SheetInspectorPanel = () => {
2158
2172
  ] })
2159
2173
  ] })
2160
2174
  ] }),
2175
+ /* @__PURE__ */ jsxs2("div", { style: { display: "grid", gridTemplateColumns: "0.9fr 1.1fr", gap: 4, alignItems: "end" }, children: [
2176
+ /* @__PURE__ */ jsxs2(
2177
+ "label",
2178
+ {
2179
+ style: {
2180
+ display: "flex",
2181
+ alignItems: "center",
2182
+ gap: 6,
2183
+ paddingBottom: 4,
2184
+ fontSize: 11,
2185
+ color: "#31363F",
2186
+ cursor: "pointer"
2187
+ },
2188
+ children: [
2189
+ /* @__PURE__ */ jsx2(
2190
+ "input",
2191
+ {
2192
+ type: "checkbox",
2193
+ checked: chartShowLegend,
2194
+ onChange: (e) => setChartShowLegend(e.target.checked)
2195
+ }
2196
+ ),
2197
+ /* @__PURE__ */ jsx2("span", { children: "\u663E\u793A\u56FE\u4F8B" })
2198
+ ]
2199
+ }
2200
+ ),
2201
+ /* @__PURE__ */ jsxs2("label", { className: "yudao-sheet-field-row", children: [
2202
+ /* @__PURE__ */ jsx2("span", { children: "\u56FE\u4F8B\u4F4D\u7F6E" }),
2203
+ /* @__PURE__ */ jsxs2(
2204
+ "select",
2205
+ {
2206
+ value: chartLegendPos,
2207
+ disabled: !chartShowLegend,
2208
+ onChange: (e) => setChartLegendPos(e.target.value),
2209
+ children: [
2210
+ /* @__PURE__ */ jsx2("option", { value: "right", children: "\u53F3\u4FA7 (Right)" }),
2211
+ /* @__PURE__ */ jsx2("option", { value: "top", children: "\u9876\u90E8 (Top)" }),
2212
+ /* @__PURE__ */ jsx2("option", { value: "bottom", children: "\u5E95\u90E8 (Bottom)" }),
2213
+ /* @__PURE__ */ jsx2("option", { value: "left", children: "\u5DE6\u4FA7 (Left)" }),
2214
+ /* @__PURE__ */ jsx2("option", { value: "topRight", children: "\u53F3\u4E0A\u89D2 (TopRight)" })
2215
+ ]
2216
+ }
2217
+ )
2218
+ ] })
2219
+ ] }),
2161
2220
  /* @__PURE__ */ jsxs2("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 4 }, children: [
2162
2221
  /* @__PURE__ */ jsx2(
2163
2222
  "button",
@@ -2165,6 +2224,7 @@ var SheetInspectorPanel = () => {
2165
2224
  type: "button",
2166
2225
  className: "yudao-sheet-btn is-soft-primary",
2167
2226
  onClick: () => {
2227
+ const isSmoothEnabled = chartType.startsWith("line") && (chartSmooth || chartType.endsWith("Smooth"));
2168
2228
  templateService.addOrUpdateChart(unitId, {
2169
2229
  id: `chart-${generateRandomId(5)}`,
2170
2230
  sheetId: sheet.getSheetId(),
@@ -2172,6 +2232,9 @@ var SheetInspectorPanel = () => {
2172
2232
  chartType,
2173
2233
  categoryRange: chartCatRange || "B6:B9",
2174
2234
  valueRange: chartValRange || "F6:F9",
2235
+ smooth: isSmoothEnabled ? true : void 0,
2236
+ showLegend: chartShowLegend,
2237
+ legendPosition: chartShowLegend ? chartLegendPos : void 0,
2175
2238
  trendline: chartTrendline !== "none" ? chartTrendline : void 0,
2176
2239
  yAxisScale: chartLogScale ? "log" : "linear",
2177
2240
  threeD: chartThreeD ? { rotX: 15, rotY: 20 } : void 0,
@@ -2190,6 +2253,7 @@ var SheetInspectorPanel = () => {
2190
2253
  type: "button",
2191
2254
  className: "yudao-sheet-btn",
2192
2255
  onClick: () => {
2256
+ const isSmoothEnabled = chartType.startsWith("line") && (chartSmooth || chartType.endsWith("Smooth"));
2193
2257
  commandService.syncExecuteCommand(InsertChartSheetCommand.id, {
2194
2258
  unitId,
2195
2259
  name: chartTitle || "\u56FE\u8868\u5DE5\u4F5C\u8868",
@@ -2200,6 +2264,9 @@ var SheetInspectorPanel = () => {
2200
2264
  chartType,
2201
2265
  categoryRange: chartCatRange || "B6:B9",
2202
2266
  valueRange: chartValRange || "F6:F9",
2267
+ smooth: isSmoothEnabled ? true : void 0,
2268
+ showLegend: chartShowLegend,
2269
+ legendPosition: chartShowLegend ? chartLegendPos : void 0,
2203
2270
  trendline: chartTrendline !== "none" ? chartTrendline : void 0,
2204
2271
  yAxisScale: chartLogScale ? "log" : "linear",
2205
2272
  threeD: chartThreeD ? { rotX: 15, rotY: 20 } : void 0,
@@ -5705,7 +5772,7 @@ var BuiltinSvgChart = ({ chart, data, onSelectItem }) => {
5705
5772
  index
5706
5773
  });
5707
5774
  };
5708
- 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;
5775
+ 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);
5709
5776
  if (!LEGACY_INLINE_CHART_TYPES.has(cType) || hasWave2Config) {
5710
5777
  const svgHtml = renderSheetChartSvg(chart, data).replace(
5711
5778
  "<svg ",