@yudaocode/univer-sheets-ui 1.6.205 → 1.6.206

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
@@ -314,6 +314,7 @@ var enUS = {
314
314
  listExpandBadge: "List Expand",
315
315
  emptyBoundCells: "No dataset bindings found (or data already expanded; press Ctrl+Z to restore template).",
316
316
  kindList: "Vertical List",
317
+ kindCrossTab: "Cross-Tab Horizontal",
317
318
  kindScalar: "Scalar Value"
318
319
  },
319
320
  inspector: {
@@ -409,6 +410,7 @@ var zhCN = {
409
410
  listExpandBadge: "\u5217\u8868\u5C55\u5F00",
410
411
  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",
411
412
  kindList: "\u5217\u8868\u81EA\u52A8\u4E0B\u63A8",
413
+ kindCrossTab: "\u6A2A\u5411\u4EA4\u53C9\u6269\u5C55",
412
414
  kindScalar: "\u5355\u503C\u586B\u5145"
413
415
  },
414
416
  inspector: {
@@ -617,14 +619,20 @@ var SheetInspectorPanel = () => {
617
619
  }
618
620
  }
619
621
  const metadata = templateService.getTemplateMetadata(unitId);
622
+ const effectiveSyntax = templateService.getPlaceholderSyntax(unitId);
623
+ const effectiveImplicitExpand = templateService.getImplicitExpand(unitId);
620
624
  const allFields = (metadata.datasets ?? []).flatMap((g) => g.fields);
621
- const boundCount = (0, import_univer_sheets2.scanWorkbookBoundCells)(workbook.save(), metadata.sampleData).length;
625
+ const boundCount = (0, import_univer_sheets2.scanWorkbookBoundCells)(workbook.save(), metadata.sampleData, {
626
+ implicitExpand: effectiveImplicitExpand
627
+ }).length;
622
628
  const printCfg = metadata.printConfig ?? {};
623
629
  const protectionCfg = metadata.protection;
624
630
  const charts = metadata.charts ?? [];
625
631
  const activeAlertRule = cellMeta.alertRules?.[0];
626
- const currentExprMatch = typeof activeCell?.v === "string" ? activeCell.v.trim().match(/^(?:\$|#)\{(#?[a-zA-Z0-9_.\[\]]+)\}$/) : null;
632
+ const currentExprMatch = typeof activeCell?.v === "string" ? activeCell.v.trim().match(/^(?:\$|#)\{(#?[\p{L}\p{N}_.\[\]-]+)\}$/u) : null;
627
633
  const currentBoundKey = currentExprMatch?.[1] ?? "";
634
+ const hasExplicitListToken = typeof activeCell?.v === "string" && (activeCell.v.includes("${#") || activeCell.v.includes("#{#") || activeCell.v.includes("[]."));
635
+ const resolvedExpandValue = cellMeta.expand ?? (hasExplicitListToken ? "v" : effectiveImplicitExpand);
628
636
  const patchCellMeta = (patch) => {
629
637
  commandService.syncExecuteCommand(import_univer_sheets2.SetSheetCellMetaCommand.id, {
630
638
  unitId,
@@ -874,7 +882,7 @@ var SheetInspectorPanel = () => {
874
882
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
875
883
  "select",
876
884
  {
877
- value: metadata.placeholderSyntax ?? "dollar",
885
+ value: effectiveSyntax,
878
886
  onChange: (e) => templateService.setTemplateMetadata(unitId, {
879
887
  ...metadata,
880
888
  placeholderSyntax: e.target.value
@@ -883,12 +891,12 @@ var SheetInspectorPanel = () => {
883
891
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("option", { value: "dollar", children: [
884
892
  "$",
885
893
  "{set.field}",
886
- "\uFF08\u6807\u51C6\u6A21\u677F\u8BED\u6CD5\uFF09"
894
+ "\uFF08\u7F8E\u5143\u82B1\u62EC\u53F7\u8BED\u6CD5\uFF09"
887
895
  ] }),
888
896
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("option", { value: "hash", children: [
889
897
  "#",
890
898
  "{set.field}",
891
- "\uFF08\u517C\u5BB9 AJ-Report / \u4E2D\u56FD\u5F0F\u62A5\u8868\uFF09"
899
+ "\uFF08\u4E95\u53F7\u82B1\u62EC\u53F7\u8BED\u6CD5\uFF09"
892
900
  ] })
893
901
  ]
894
902
  }
@@ -934,12 +942,12 @@ var SheetInspectorPanel = () => {
934
942
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
935
943
  "select",
936
944
  {
937
- value: cellMeta.expand ?? "v",
945
+ value: resolvedExpandValue,
938
946
  onChange: (e) => patchCellMeta({ expand: e.target.value }),
939
947
  children: [
940
948
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "v", children: "\u7EB5\u5411\u5411\u4E0B\u6269\u5C55\u884C (List)" }),
941
949
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "h", children: "\u6A2A\u5411\u5411\u53F3\u6269\u5C55\u5217 (Cross-Tab \u4EA4\u53C9\u8868)" }),
942
- features.advancedCellBinding && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "none", children: "\u4E0D\u6269\u5C55\uFF08\u9759\u6001\u5355\u503C\u66FF\u6362\uFF09" })
950
+ (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" })
943
951
  ]
944
952
  }
945
953
  )
@@ -3647,20 +3655,25 @@ var SheetLeftSidebar = () => {
3647
3655
  }
3648
3656
  void rev;
3649
3657
  void metaVersion;
3650
- const metadata = templateService.getTemplateMetadata(workbook.getUnitId());
3658
+ const unitId = workbook.getUnitId();
3659
+ const metadata = templateService.getTemplateMetadata(unitId);
3660
+ const effectiveSyntax = templateService.getPlaceholderSyntax(unitId);
3661
+ const effectiveImplicitExpand = templateService.getImplicitExpand(unitId);
3651
3662
  const datasets = metadata.datasets ?? [];
3652
- const boundCells = (0, import_univer_sheets3.scanWorkbookBoundCells)(workbook.save(), metadata.sampleData).filter((item) => {
3663
+ const boundCells = (0, import_univer_sheets3.scanWorkbookBoundCells)(workbook.save(), metadata.sampleData, {
3664
+ implicitExpand: effectiveImplicitExpand
3665
+ }).filter((item) => {
3653
3666
  const sh = workbook.getSheetBySheetId(item.sheetId);
3654
3667
  return sh ? !sh.isSheetHidden() : true;
3655
3668
  });
3656
3669
  const handleJumpToCell = (item) => {
3657
3670
  try {
3658
- const unitId = workbook.getUnitId();
3671
+ const unitId2 = workbook.getUnitId();
3659
3672
  const targetSheet = workbook.getSheetBySheetId(item.sheetId);
3660
3673
  if (!targetSheet || targetSheet.isSheetHidden()) return;
3661
3674
  if (workbook.getActiveSheet()?.getSheetId() !== item.sheetId) {
3662
3675
  commandService.syncExecuteCommand(import_sheets2.SetWorksheetActiveOperation.id, {
3663
- unitId,
3676
+ unitId: unitId2,
3664
3677
  subUnitId: item.sheetId
3665
3678
  });
3666
3679
  }
@@ -3675,7 +3688,7 @@ var SheetLeftSidebar = () => {
3675
3688
  endColumn: master.col
3676
3689
  };
3677
3690
  const isMerged = Boolean(master.mergeRange);
3678
- selectionService.setSelections(unitId, item.sheetId, [
3691
+ selectionService.setSelections(unitId2, item.sheetId, [
3679
3692
  {
3680
3693
  range: selRange,
3681
3694
  primary: {
@@ -3692,7 +3705,7 @@ var SheetLeftSidebar = () => {
3692
3705
  }
3693
3706
  ]);
3694
3707
  commandService.syncExecuteCommand(import_sheets2.ScrollToCellOperation.id, {
3695
- unitId,
3708
+ unitId: unitId2,
3696
3709
  range: selRange
3697
3710
  });
3698
3711
  } catch {
@@ -3794,7 +3807,7 @@ var SheetLeftSidebar = () => {
3794
3807
  e.dataTransfer.setData("application/x-yudao-sheet-field", fieldExpr);
3795
3808
  e.dataTransfer.setData(
3796
3809
  "text/plain",
3797
- metadata.placeholderSyntax === "hash" ? `#{${fieldExpr.replace(/^#/, "")}}` : fieldExpr
3810
+ fieldExpr.startsWith("${") || fieldExpr.startsWith("#{") ? fieldExpr : effectiveSyntax === "hash" ? `#{${fieldExpr}}` : `\${${fieldExpr}}`
3798
3811
  );
3799
3812
  e.dataTransfer.effectAllowed = "copy";
3800
3813
  },
@@ -3835,10 +3848,10 @@ var SheetLeftSidebar = () => {
3835
3848
  fontWeight: 500,
3836
3849
  padding: "1px 6px",
3837
3850
  borderRadius: 999,
3838
- background: item.kind === "list" ? "#F3F5FF" : "#EEEFF1",
3839
- color: item.kind === "list" ? "#2C53F1" : "#4E5565"
3851
+ background: item.kind === "list" || item.kind === "crossTab" ? "#F3F5FF" : "#EEEFF1",
3852
+ color: item.kind === "list" || item.kind === "crossTab" ? "#2C53F1" : "#4E5565"
3840
3853
  },
3841
- children: item.kind === "list" ? t("yudaoSheets.leftSidebar.kindList") : t("yudaoSheets.leftSidebar.kindScalar")
3854
+ children: item.kind === "crossTab" ? t("yudaoSheets.leftSidebar.kindCrossTab") : item.kind === "list" ? t("yudaoSheets.leftSidebar.kindList") : t("yudaoSheets.leftSidebar.kindScalar")
3842
3855
  }
3843
3856
  )
3844
3857
  ] }),
@@ -3948,6 +3961,7 @@ var SheetPreviewAndIoModal = () => {
3948
3961
  const compiled = effectiveData ? (0, import_univer_sheets4.compileWorkbookWithDataset)(snap, effectiveData, {
3949
3962
  metadata: tplMeta,
3950
3963
  printConfig: cfg,
3964
+ implicitExpand: unitId ? templateService.getImplicitExpand(unitId) : void 0,
3951
3965
  loopBlocks,
3952
3966
  conditionProperties,
3953
3967
  drillLinks,
@@ -4151,6 +4165,7 @@ var SheetPreviewAndIoModal = () => {
4151
4165
  data: parsedData,
4152
4166
  printConfig: printCfg,
4153
4167
  metadata: templateService.getTemplateMetadata(unitId),
4168
+ implicitExpand: templateService.getImplicitExpand(unitId),
4154
4169
  target: ioTarget
4155
4170
  });
4156
4171
  const mime = format === "xlsx" ? "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : format === "xls" ? "application/vnd.ms-excel" : format === "pdf" ? "application/pdf" : format === "docx" ? "application/vnd.openxmlformats-officedocument.wordprocessingml.document" : format === "xml" ? "application/xml;charset=utf-8" : format === "html" ? "text/html;charset=utf-8" : "text/csv;charset=utf-8";