@yudaocode/univer-sheets-ui 1.6.206 → 1.6.207

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
@@ -121,6 +121,7 @@ function resolveSheetsUIFeatures(raw) {
121
121
  fieldDrag: raw?.fieldDrag ?? true,
122
122
  syntaxSelector: raw?.syntaxSelector ?? true,
123
123
  advancedCellBinding: raw?.advancedCellBinding ?? true,
124
+ contextualCellBinding: Boolean(raw?.contextualCellBinding),
124
125
  builtinPreviewModal: raw?.builtinPreviewModal ?? true
125
126
  };
126
127
  }
@@ -315,7 +316,8 @@ var enUS = {
315
316
  emptyBoundCells: "No dataset bindings found (or data already expanded; press Ctrl+Z to restore template).",
316
317
  kindList: "Vertical List",
317
318
  kindCrossTab: "Cross-Tab Horizontal",
318
- kindScalar: "Scalar Value"
319
+ kindScalar: "Scalar Value",
320
+ hiddenSheetBadge: "Hidden"
319
321
  },
320
322
  inspector: {
321
323
  activeCellLabel: "Active Cell: ",
@@ -330,6 +332,7 @@ var enUS = {
330
332
  subTabAnalytics: "Analytics",
331
333
  subTabFill: "Form Fill",
332
334
  datasetSectionTitle: "Dataset & Cross-Tab Expansion",
335
+ mergedCellExpandHint: "Merged cells only support vertical expansion without grouping",
333
336
  cellFilterTitle: "Cell Dataset Filter (cellFilterConditions)",
334
337
  cellFilterAddBtn: "+ Add Filter",
335
338
  cellFilterEmptyHint: "No cell-level filter configured (supports field or $param.xxx rules)",
@@ -411,7 +414,8 @@ var zhCN = {
411
414
  emptyBoundCells: "\u5F53\u524D\u5DE5\u4F5C\u7C3F\u6682\u65E0\u7ED1\u5B9A\u8868\u8FBE\u5F0F\uFF08\u6216\u5DF2\u5B8C\u6210\u6570\u636E\u586B\u5145\uFF0C\u6309 Ctrl+Z \u53EF\u56DE\u5230\u6A21\u677F\u6001\uFF09\u3002",
412
415
  kindList: "\u5217\u8868\u81EA\u52A8\u4E0B\u63A8",
413
416
  kindCrossTab: "\u6A2A\u5411\u4EA4\u53C9\u6269\u5C55",
414
- kindScalar: "\u5355\u503C\u586B\u5145"
417
+ kindScalar: "\u5355\u503C\u586B\u5145",
418
+ hiddenSheetBadge: "\u9690\u85CF\u8868"
415
419
  },
416
420
  inspector: {
417
421
  activeCellLabel: "\u5F53\u524D\u5355\u5143\u683C\uFF1A",
@@ -426,6 +430,7 @@ var zhCN = {
426
430
  subTabAnalytics: "\u900F\u89C6",
427
431
  subTabFill: "\u586B\u62A5",
428
432
  datasetSectionTitle: "\u6570\u636E\u96C6\u4E0E\u4EA4\u53C9\u6269\u5C55",
433
+ mergedCellExpandHint: "\u5408\u5E76\u5355\u5143\u683C\u4EC5\u652F\u6301\u7EB5\u5411\u6269\u5C55\u4E14\u4E0D\u5206\u7EC4",
429
434
  cellFilterTitle: "\u5355\u5143\u683C\u6570\u636E\u8FC7\u6EE4\u6761\u4EF6 (cellFilterConditions)",
430
435
  cellFilterAddBtn: "+ \u6DFB\u52A0\u8FC7\u6EE4",
431
436
  cellFilterEmptyHint: "\u672A\u914D\u7F6E\u5355\u5143\u683C\u7EA7\u8FC7\u6EE4\u6761\u4EF6\uFF08\u652F\u6301\u6309\u5B57\u6BB5\u6216 $param.xxx \u52A8\u6001\u7B5B\u9009\uFF09",
@@ -631,6 +636,11 @@ var SheetInspectorPanel = () => {
631
636
  const activeAlertRule = cellMeta.alertRules?.[0];
632
637
  const currentExprMatch = typeof activeCell?.v === "string" ? activeCell.v.trim().match(/^(?:\$|#)\{(#?[\p{L}\p{N}_.\[\]-]+)\}$/u) : null;
633
638
  const currentBoundKey = currentExprMatch?.[1] ?? "";
639
+ const activeCellText = activeCell?.v == null ? "" : String(activeCell.v);
640
+ const isMergedCell = Boolean(resolvedMaster.mergeRange);
641
+ const restrictMergedExpand = features.contextualCellBinding && isMergedCell;
642
+ const isDynamicBoundCell = features.contextualCellBinding ? effectiveSyntax === "hash" ? activeCellText.includes("#{") : activeCellText.includes("${") || activeCellText.includes("#{") : true;
643
+ const showStaticAutoOption = !features.contextualCellBinding || !isDynamicBoundCell;
634
644
  const hasExplicitListToken = typeof activeCell?.v === "string" && (activeCell.v.includes("${#") || activeCell.v.includes("#{#") || activeCell.v.includes("[]."));
635
645
  const resolvedExpandValue = cellMeta.expand ?? (hasExplicitListToken ? "v" : effectiveImplicitExpand);
636
646
  const patchCellMeta = (patch) => {
@@ -937,7 +947,7 @@ var SheetInspectorPanel = () => {
937
947
  }
938
948
  )
939
949
  ] }),
940
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
950
+ isDynamicBoundCell && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
941
951
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u6269\u5C55\u65B9\u5411\uFF08\u652F\u6301\u4EA4\u53C9\u8868\u6A2A\u5411\u88C2\u53D8\u5217\uFF09" }),
942
952
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
943
953
  "select",
@@ -946,13 +956,13 @@ var SheetInspectorPanel = () => {
946
956
  onChange: (e) => patchCellMeta({ expand: e.target.value }),
947
957
  children: [
948
958
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "v", children: "\u7EB5\u5411\u5411\u4E0B\u6269\u5C55\u884C (List)" }),
949
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "h", children: "\u6A2A\u5411\u5411\u53F3\u6269\u5C55\u5217 (Cross-Tab \u4EA4\u53C9\u8868)" }),
959
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "h", disabled: restrictMergedExpand && resolvedExpandValue !== "h", children: "\u6A2A\u5411\u5411\u53F3\u6269\u5C55\u5217 (Cross-Tab \u4EA4\u53C9\u8868)" }),
950
960
  (features.advancedCellBinding || resolvedExpandValue === "none") && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "none", children: "\u4E0D\u6269\u5C55\uFF08\u9759\u6001\u5355\u503C\u66FF\u6362\uFF09" })
951
961
  ]
952
962
  }
953
963
  )
954
964
  ] }),
955
- features.advancedCellBinding && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
965
+ features.advancedCellBinding && isDynamicBoundCell && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
956
966
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 6 }, children: [
957
967
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { className: "yudao-sheet-field-row", children: [
958
968
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u5DE6\u7236\u683C (leftParentCell)" }),
@@ -1152,18 +1162,20 @@ var SheetInspectorPanel = () => {
1152
1162
  ] })
1153
1163
  ] }),
1154
1164
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 5 }, children: [
1155
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer" }, children: [
1165
+ isDynamicBoundCell && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer" }, children: [
1156
1166
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1157
1167
  "input",
1158
1168
  {
1159
1169
  type: "checkbox",
1160
1170
  checked: Boolean(cellMeta.group),
1171
+ disabled: restrictMergedExpand && !cellMeta.group,
1161
1172
  onChange: (e) => patchCellMeta({ group: e.target.checked })
1162
1173
  }
1163
1174
  ),
1164
1175
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u76F8\u90BB\u76F8\u540C\u5206\u7EC4\u503C\u81EA\u52A8\u7EB5\u5411\u5408\u5E76\u5355\u5143\u683C (Group)" })
1165
1176
  ] }),
1166
- features.advancedCellBinding && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer" }, children: [
1177
+ isDynamicBoundCell && restrictMergedExpand && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { fontSize: 11, color: "#7D8698" }, children: t("yudaoSheets.inspector.mergedCellExpandHint") }),
1178
+ features.advancedCellBinding && isDynamicBoundCell && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer" }, children: [
1167
1179
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1168
1180
  "input",
1169
1181
  {
@@ -1174,18 +1186,20 @@ var SheetInspectorPanel = () => {
1174
1186
  ),
1175
1187
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u81EA\u52A8\u751F\u6210\u9012\u589E\u5E8F\u53F7 (=SEQ / \u6309\u7EC4\u91CD\u6392)" })
1176
1188
  ] }),
1177
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer" }, children: [
1189
+ showStaticAutoOption && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer" }, children: [
1178
1190
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1179
1191
  "input",
1180
1192
  {
1181
1193
  type: "checkbox",
1182
- checked: Boolean(cellMeta.auto || activeCell?.custom?.auto),
1183
- onChange: (e) => patchCellMeta({ auto: e.target.checked || void 0 })
1194
+ checked: Boolean(cellMeta.auto),
1195
+ onChange: (e) => patchCellMeta({
1196
+ auto: templateService.getCellMetaLayout(unitId) === "flat" ? e.target.checked : e.target.checked || void 0
1197
+ })
1184
1198
  }
1185
1199
  ),
1186
1200
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u4F34\u968F\u540C\u884C\u5217\u8868\u81EA\u52A8\u590D\u5236\u6269\u5C55 (auto)" })
1187
1201
  ] }),
1188
- features.advancedCellBinding && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer" }, children: [
1202
+ features.advancedCellBinding && isDynamicBoundCell && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer" }, children: [
1189
1203
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1190
1204
  "input",
1191
1205
  {
@@ -1320,7 +1334,7 @@ var SheetInspectorPanel = () => {
1320
1334
  )
1321
1335
  ] })
1322
1336
  ] }),
1323
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1337
+ isDynamicBoundCell && (!features.contextualCellBinding || resolvedExpandValue !== "h") && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1324
1338
  "div",
1325
1339
  {
1326
1340
  style: {
@@ -3662,9 +3676,6 @@ var SheetLeftSidebar = () => {
3662
3676
  const datasets = metadata.datasets ?? [];
3663
3677
  const boundCells = (0, import_univer_sheets3.scanWorkbookBoundCells)(workbook.save(), metadata.sampleData, {
3664
3678
  implicitExpand: effectiveImplicitExpand
3665
- }).filter((item) => {
3666
- const sh = workbook.getSheetBySheetId(item.sheetId);
3667
- return sh ? !sh.isSheetHidden() : true;
3668
3679
  });
3669
3680
  const handleJumpToCell = (item) => {
3670
3681
  try {
@@ -3827,39 +3838,50 @@ var SheetLeftSidebar = () => {
3827
3838
  },
3828
3839
  group.id || group.name
3829
3840
  ))
3830
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "yudao-sheet-left-body", children: boundCells.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 12, color: "#7D8698", textAlign: "center", padding: "24px 8px" }, children: t("yudaoSheets.leftSidebar.emptyBoundCells") }) : boundCells.map((item) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
3831
- "div",
3832
- {
3833
- className: "yudao-sheet-section",
3834
- style: { padding: "8px 10px", cursor: "pointer", background: "#FFFFFF" },
3835
- onClick: () => handleJumpToCell(item),
3836
- children: [
3837
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
3838
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("strong", { style: { color: "#1B1C1F", fontSize: 12 }, children: [
3839
- item.sheetName,
3840
- "!",
3841
- item.cellRef
3841
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "yudao-sheet-left-body", children: boundCells.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: { fontSize: 12, color: "#7D8698", textAlign: "center", padding: "24px 8px" }, children: t("yudaoSheets.leftSidebar.emptyBoundCells") }) : boundCells.map((item) => {
3842
+ const isHiddenSheet = Boolean(workbook.getSheetBySheetId(item.sheetId)?.isSheetHidden());
3843
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
3844
+ "div",
3845
+ {
3846
+ className: "yudao-sheet-section",
3847
+ style: {
3848
+ padding: "8px 10px",
3849
+ cursor: isHiddenSheet ? "not-allowed" : "pointer",
3850
+ opacity: isHiddenSheet ? 0.72 : 1,
3851
+ background: "#FFFFFF"
3852
+ },
3853
+ onClick: () => handleJumpToCell(item),
3854
+ children: [
3855
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
3856
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("strong", { style: { color: "#1B1C1F", fontSize: 12 }, children: [
3857
+ item.sheetName,
3858
+ "!",
3859
+ item.cellRef
3860
+ ] }),
3861
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
3862
+ "span",
3863
+ {
3864
+ style: {
3865
+ fontSize: 10,
3866
+ fontWeight: 500,
3867
+ padding: "1px 6px",
3868
+ borderRadius: 999,
3869
+ background: item.kind === "list" || item.kind === "crossTab" ? "#F3F5FF" : "#EEEFF1",
3870
+ color: item.kind === "list" || item.kind === "crossTab" ? "#2C53F1" : "#4E5565"
3871
+ },
3872
+ children: [
3873
+ isHiddenSheet ? `${t("yudaoSheets.leftSidebar.hiddenSheetBadge")} \xB7 ` : "",
3874
+ item.kind === "crossTab" ? t("yudaoSheets.leftSidebar.kindCrossTab") : item.kind === "list" ? t("yudaoSheets.leftSidebar.kindList") : t("yudaoSheets.leftSidebar.kindScalar")
3875
+ ]
3876
+ }
3877
+ )
3842
3878
  ] }),
3843
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
3844
- "span",
3845
- {
3846
- style: {
3847
- fontSize: 10,
3848
- fontWeight: 500,
3849
- padding: "1px 6px",
3850
- borderRadius: 999,
3851
- background: item.kind === "list" || item.kind === "crossTab" ? "#F3F5FF" : "#EEEFF1",
3852
- color: item.kind === "list" || item.kind === "crossTab" ? "#2C53F1" : "#4E5565"
3853
- },
3854
- children: item.kind === "crossTab" ? t("yudaoSheets.leftSidebar.kindCrossTab") : item.kind === "list" ? t("yudaoSheets.leftSidebar.kindList") : t("yudaoSheets.leftSidebar.kindScalar")
3855
- }
3856
- )
3857
- ] }),
3858
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { style: { fontSize: 11, color: "#7D8698", wordBreak: "break-all" }, children: item.rawText })
3859
- ]
3860
- },
3861
- `${item.sheetId}_${item.row}_${item.col}`
3862
- )) })
3879
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { style: { fontSize: 11, color: "#7D8698", wordBreak: "break-all" }, children: item.rawText })
3880
+ ]
3881
+ },
3882
+ `${item.sheetId}_${item.row}_${item.col}`
3883
+ );
3884
+ }) })
3863
3885
  ] });
3864
3886
  };
3865
3887