@a3s-lab/office 0.16.0 → 0.18.0

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.
@@ -1,10 +1,10 @@
1
1
  import { __webpack_require__ } from "./0~rslib-runtime.js";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { Workbook } from "@fortune-sheet/react";
4
- import { AlignCenter, AlignLeft, AlignRight, AlignVerticalJustifyCenter, AlignVerticalJustifyEnd, AlignVerticalJustifyStart, ArrowDown, ArrowDownToLine, ArrowLeft, ArrowLeftToLine, ArrowRight, ArrowRightToLine, ArrowUp, ArrowUpToLine, BadgeJapaneseYen, BarChart3, BetweenHorizontalEnd, BetweenHorizontalStart, BetweenVerticalEnd, BetweenVerticalStart, Bold, Bookmark, Calculator, Check, ChevronDown, ChevronLeft, ChevronRight, ClipboardPaste, Cloud, Columns3, Copy, CopyPlus, DecimalsArrowLeft, DecimalsArrowRight, Eraser, Eye, EyeOff, FileX2, Globe2, Grid2X2, Grid3X3, Hash, Italic, KeyRound, Layers2, Link2, Link2Off, ListChecks, ListFilter, LocateFixed, Merge, MessageSquareX, MoveHorizontal, MoveVertical, Paintbrush, Palette, PanelLeft, PanelTop, PanelsTopLeft, Pencil, Percent, Plus, Printer, Redo2, RefreshCw, Rows3, Save, Scissors, Search, Settings2, ShieldCheck, Sigma, SortAsc, SortDesc, Strikethrough, SwatchBook, Table2, TableProperties, Trash2, Underline, Undo2, WrapText, X } from "lucide-react";
4
+ import { AArrowDown, AArrowUp, AlignCenter, AlignLeft, AlignRight, AlignVerticalJustifyCenter, AlignVerticalJustifyEnd, AlignVerticalJustifyStart, ArrowDown, ArrowDownToLine, ArrowLeft, ArrowLeftToLine, ArrowRight, ArrowRightToLine, ArrowUp, ArrowUpToLine, BadgeJapaneseYen, BarChart3, BetweenHorizontalEnd, BetweenHorizontalStart, BetweenVerticalEnd, BetweenVerticalStart, Bold, Bookmark, Calculator, Check, ChevronDown, ChevronLeft, ChevronRight, ClipboardPaste, Cloud, Columns3, Copy, CopyPlus, DecimalsArrowLeft, DecimalsArrowRight, Eraser, Eye, EyeOff, FileX2, Globe2, Grid2X2, Grid3X3, Hash, Italic, KeyRound, Layers2, Link2, Link2Off, ListChecks, ListFilter, LocateFixed, Merge, MessageSquareX, MoveHorizontal, MoveVertical, Paintbrush, Palette, PanelLeft, PanelTop, PanelsTopLeft, Pencil, Percent, Plus, Printer, Redo2, RefreshCw, Rows3, Save, Scissors, Search, Settings2, ShieldCheck, Sigma, SortAsc, SortDesc, Strikethrough, SwatchBook, Table2, TableProperties, Trash2, Underline, Undo2, WrapText, X } from "lucide-react";
5
5
  import { Fragment as external_react_Fragment, cloneElement, memo, useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
6
6
  import { genarate, indexToColumnChar, update as core_update } from "@fortune-sheet/core";
7
- import { freezeImportedSpreadsheetCell, withoutEditableRange, spreadsheetMatrixProfile, normalizeSpreadsheetConditionalVisualOptions, effectiveSpreadsheetPageSetup, attachSpreadsheetShownCommentCells, withEditableRange, sameSpreadsheetHistoryValue, createOfficeSpreadsheetCollaborationBinding as createWorkOfficeSpreadsheetCollaborationBinding, isSpreadsheetConditionalComparisonOperator, spreadsheetConditionalIconForValue, defaultSpreadsheetConditionalIconThresholds, normalizeSpreadsheetDateValidationBoundary, sheetProtectionAuthority, editableRangeCellCount, unlockedCellCount, registerDerivedSpreadsheetMatrix, editableRangeRequiresCredentials, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, normalizeSpreadsheetConditionalIconSetFormat, defaultSpreadsheetDataBarOptions, spreadsheetConditionalThresholdValue, normalizeSheetProtectionAuthority, withSheetProtection, spreadsheetProtectionKey, defaultSpreadsheetColorScaleThresholds, protectedSheetCount, SPREADSHEET_CONDITIONAL_ICON_SETS, withSheetSelectionPermissions, spreadsheetConditionalComparisonNeedsUpperValue, drawSpreadsheetConditionalIcon, replaceOfficeSpreadsheetCollaboration as replaceWorkOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration as readWorkOfficeSpreadsheetCollaboration, spreadsheetConditionalThresholdsEqual } from "./2180.js";
7
+ import { freezeImportedSpreadsheetCell, withoutEditableRange, spreadsheetMatrixProfile, normalizeSpreadsheetConditionalVisualOptions, spreadsheetUnderlineCellValue, effectiveSpreadsheetPageSetup, attachSpreadsheetShownCommentCells, withEditableRange, sameSpreadsheetHistoryValue, createOfficeSpreadsheetCollaborationBinding as createWorkOfficeSpreadsheetCollaborationBinding, isSpreadsheetConditionalComparisonOperator, spreadsheetConditionalIconForValue, defaultSpreadsheetConditionalIconThresholds, spreadsheetUnderlineStyle, normalizeSpreadsheetDateValidationBoundary, sheetProtectionAuthority, editableRangeCellCount, unlockedCellCount, registerDerivedSpreadsheetMatrix, editableRangeRequiresCredentials, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, normalizeSpreadsheetConditionalIconSetFormat, defaultSpreadsheetDataBarOptions, spreadsheetConditionalThresholdValue, normalizeSheetProtectionAuthority, withSheetProtection, spreadsheetProtectionKey, defaultSpreadsheetColorScaleThresholds, protectedSheetCount, SPREADSHEET_CONDITIONAL_ICON_SETS, withSheetSelectionPermissions, spreadsheetConditionalComparisonNeedsUpperValue, drawSpreadsheetConditionalIcon, replaceOfficeSpreadsheetCollaboration as replaceWorkOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration as readWorkOfficeSpreadsheetCollaboration, spreadsheetConditionalThresholdsEqual, isSpreadsheetUnderlineStyle } from "./1992.js";
8
8
  import { workSpreadsheetChartSupportsGrouping, createSpreadsheetChartFromSelection, normalizeWorkSpreadsheetDataLabelPosition, normalizeSpreadsheetPrintTitleColumns, normalizeSpreadsheetPrintTitleRows, formulaHasStructuredReference, normalizeWorkSpreadsheetErrorBars, defaultPivotValueCaption, workSpreadsheetChartSupportsBarSpacing, normalizeWorkSpreadsheetChartGrouping, spreadsheetGridSize, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetScatterStyle, cloneSparseMatrix, spreadsheetPivotAggregationLabel, workSpreadsheetChartAxisIsCategoryAxis, reconcileSpreadsheetChartPreviews, normalizeWorkSpreadsheetChartAxes, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetChartLegendPosition, spreadsheetChartCount, workSpreadsheetChartTypeLabel, sparseArrayEntries, normalizeWorkSpreadsheetTrendline, effectiveSpreadsheetCalculationSettings, spreadsheetPivotIntersects, normalizeWorkSpreadsheetDataLabels, spreadsheetPivotOutputContains, normalizeSpreadsheetPrintArea, spreadsheetCellAddress, formatSpreadsheetCellRanges, normalizeWorkSpreadsheetChartLayout, spreadsheetFormulaRangeForCell, workSpreadsheetChartAxisIsValueAxis, normalizeWorkSpreadsheetChartSmoothLines, spreadsheetPivotFilterValueKey, normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetChartSeriesStyle, volatileSpreadsheetFormulaFunctions, sparseArrayIndexes, normalizeWorkSpreadsheetBubbleSizeRepresents, workSpreadsheetChartSupportsTrendlines, normalizeWorkSpreadsheetChartLegendOverlay, parseSpreadsheetChartReference, workSpreadsheetChartGroupingIsStacked, normalizeWorkSpreadsheetChartGapWidth, workSpreadsheetChartSupportsSmoothLines, refreshSpreadsheetPivotTables, createSpreadsheetPivotFromSelection, reconcileSpreadsheetPivots, spreadsheetPivotCount, sparseMatrixColumnCount, workSpreadsheetChartSupportsErrorBars, formulaHasExternalReference, isValidSpreadsheetDefinedName, spreadsheetPivotValidation, deleteSpreadsheetPivotTable, workSpreadsheetChartAxisDefaultLabelPosition, workSpreadsheetChartSupportsSeriesAnalysis, parseSpreadsheetCellRanges, spreadsheetPivotFilterItems, spreadsheetPivotFields, normalizeWorkSpreadsheetChartOverlap, spreadsheetFormulaRangeConflict, spreadsheetSheetsWithChartPreviews, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetChartAxisShowsMajorGridlinesByDefault, workSpreadsheetChartSupportsAxes, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetRadarStyle } from "./8715.js";
9
9
  import { moveOfficeMenuFocus, stepOfficeZoom, useOfficeRemoteParticipants, Popover, officePresenceColor, useOfficePublishPresenceLocation, button_Button, icon_button_IconButton, moveOfficeGridMenuFocus, office_text_field_OfficeTextField, useDialogFocusScope, useOfficeEditorWheelZoom } from "./0~6090.js";
10
10
  import { useOfficeTaskPaneEscape, OfficeCheckbox, CommittedOfficeNumberField, useOfficeDialog, useOfficeTaskPaneModal, createOfficeKernelClient, officeFontFamilies, CollectionState, OfficeNumberField, handleOfficeTaskPaneKeyDown } from "./0~7048.js";
@@ -187,15 +187,15 @@ function applyDefaultRule(styles, data, rule, blocked, matched) {
187
187
  for (const range of rule.cellrange){
188
188
  const positions = cellPositions(data, [
189
189
  range
190
- ]).filter(({ row, column })=>null != cellValue(data, row, column));
190
+ ]).filter(({ row, column })=>null != work_spreadsheet_conditional_format_cellValue(data, row, column));
191
191
  const occurrences = new Map();
192
192
  for (const { row, column } of positions){
193
- const key = comparableKey(cellValue(data, row, column));
193
+ const key = comparableKey(work_spreadsheet_conditional_format_cellValue(data, row, column));
194
194
  occurrences.set(key, (occurrences.get(key) ?? 0) + 1);
195
195
  }
196
196
  const unique = '1' === values[0];
197
197
  for (const { row, column } of positions){
198
- const count = occurrences.get(comparableKey(cellValue(data, row, column))) ?? 0;
198
+ const count = occurrences.get(comparableKey(work_spreadsheet_conditional_format_cellValue(data, row, column))) ?? 0;
199
199
  if (unique && 1 === count || !unique && count > 1) applyDifferentialStyle(styles, blocked, matched, row, column, style);
200
200
  }
201
201
  }
@@ -215,7 +215,7 @@ function applyDefaultRule(styles, data, rule, blocked, matched) {
215
215
  return;
216
216
  }
217
217
  forEachCell(data, rule.cellrange, ({ row, column })=>{
218
- const current = cellValue(data, row, column);
218
+ const current = work_spreadsheet_conditional_format_cellValue(data, row, column);
219
219
  if (matchesCondition(current, rule.conditionName, values)) applyDifferentialStyle(styles, blocked, matched, row, column, style);
220
220
  });
221
221
  }
@@ -370,13 +370,13 @@ function evaluateFormula(source, row, column, baseRange, data) {
370
370
  const blank = /^(NOT\()?ISBLANK\((\$?)([A-Z]{1,3})(\$?)([1-9]\d*)\)\)?$/i.exec(formula);
371
371
  if (blank) {
372
372
  const target = formulaReference(blank[2], blank[3], blank[4], blank[5], row, column, baseRange);
373
- const empty = null == cellValue(data, target.row, target.column) || '' === cellValue(data, target.row, target.column);
373
+ const empty = null == work_spreadsheet_conditional_format_cellValue(data, target.row, target.column) || '' === work_spreadsheet_conditional_format_cellValue(data, target.row, target.column);
374
374
  return blank[1] ? !empty : empty;
375
375
  }
376
376
  const comparison = /^(\$?)([A-Z]{1,3})(\$?)([1-9]\d*)(=|<>|>=|<=|>|<)(?:"((?:[^"]|"")*)"|(-?\d+(?:\.\d+)?))$/i.exec(formula);
377
377
  if (!comparison) return false;
378
378
  const target = formulaReference(comparison[1], comparison[2], comparison[3], comparison[4], row, column, baseRange);
379
- const left = cellValue(data, target.row, target.column);
379
+ const left = work_spreadsheet_conditional_format_cellValue(data, target.row, target.column);
380
380
  const right = void 0 !== comparison[6] ? comparison[6].replaceAll('""', '"') : Number(comparison[7]);
381
381
  return compareWithOperator(left, comparison[5], right);
382
382
  }
@@ -445,11 +445,11 @@ function forEachCell(data, ranges, visit) {
445
445
  column
446
446
  });
447
447
  }
448
- function cellValue(data, row, column) {
448
+ function work_spreadsheet_conditional_format_cellValue(data, row, column) {
449
449
  return data[row]?.[column]?.v ?? null;
450
450
  }
451
451
  function numericCellValue(data, row, column) {
452
- const value = cellValue(data, row, column);
452
+ const value = work_spreadsheet_conditional_format_cellValue(data, row, column);
453
453
  return 'number' == typeof value && Number.isFinite(value) ? value : null;
454
454
  }
455
455
  function comparableKey(value) {
@@ -1357,6 +1357,28 @@ function isSpreadsheetCoordinate(value) {
1357
1357
  function positiveSpreadsheetDimension(value) {
1358
1358
  return 'number' == typeof value && Number.isFinite(value) && value > 0 ? Math.floor(value) : 0;
1359
1359
  }
1360
+ const spreadsheetFontSizes = [
1361
+ 9,
1362
+ 10,
1363
+ 11,
1364
+ 12,
1365
+ 14,
1366
+ 16,
1367
+ 18,
1368
+ 20,
1369
+ 22,
1370
+ 24,
1371
+ 28,
1372
+ 36,
1373
+ 48,
1374
+ 72
1375
+ ];
1376
+ function nextSpreadsheetFontSize(current, direction) {
1377
+ if (!Number.isFinite(current) || current < 1 || current > 409) return null;
1378
+ return 'grow' === direction ? spreadsheetFontSizes.find((size)=>size > current) ?? null : [
1379
+ ...spreadsheetFontSizes
1380
+ ].reverse().find((size)=>size < current) ?? null;
1381
+ }
1360
1382
  function canApplySpreadsheetTableStructureChange(sheet, change) {
1361
1383
  if (!sheet || !validSpreadsheetTableStructureChange(change)) return false;
1362
1384
  for (const table of sheet.tables ?? []){
@@ -1700,22 +1722,6 @@ function sameSpreadsheetTableColumns(left, right) {
1700
1722
  function spreadsheet_table_reconciliation_isRecord(value) {
1701
1723
  return Boolean(value && 'object' == typeof value && !Array.isArray(value));
1702
1724
  }
1703
- const spreadsheetFontSizes = [
1704
- 9,
1705
- 10,
1706
- 11,
1707
- 12,
1708
- 14,
1709
- 16,
1710
- 18,
1711
- 20,
1712
- 22,
1713
- 24,
1714
- 28,
1715
- 36,
1716
- 48,
1717
- 72
1718
- ];
1719
1725
  function spreadsheetSelectionReference(selection) {
1720
1726
  const rowStart = Math.min(selection.row[0] ?? 0, selection.row[1] ?? selection.row[0] ?? 0);
1721
1727
  const rowEnd = Math.max(selection.row[0] ?? 0, selection.row[1] ?? selection.row[0] ?? 0);
@@ -2805,6 +2811,40 @@ const spreadsheetCommandCatalog = {
2805
2811
  ]
2806
2812
  }
2807
2813
  },
2814
+ growFont: {
2815
+ id: 'font.grow',
2816
+ label: '增大字号',
2817
+ location: {
2818
+ area: 'ribbon',
2819
+ tab: 'home',
2820
+ group: 'font'
2821
+ },
2822
+ shortcut: {
2823
+ label: 'Cmd/Ctrl+Shift+. 或 Cmd/Ctrl+]',
2824
+ aria: 'Control+Shift+. Meta+Shift+. Control+] Meta+]',
2825
+ editor: [
2826
+ 'Mod-Shift-.',
2827
+ 'Mod-]'
2828
+ ]
2829
+ }
2830
+ },
2831
+ shrinkFont: {
2832
+ id: 'font.shrink',
2833
+ label: '减小字号',
2834
+ location: {
2835
+ area: 'ribbon',
2836
+ tab: 'home',
2837
+ group: 'font'
2838
+ },
2839
+ shortcut: {
2840
+ label: 'Cmd/Ctrl+Shift+, 或 Cmd/Ctrl+[',
2841
+ aria: 'Control+Shift+, Meta+Shift+, Control+[ Meta+[',
2842
+ editor: [
2843
+ 'Mod-Shift-,',
2844
+ 'Mod-['
2845
+ ]
2846
+ }
2847
+ },
2808
2848
  numberFormatGeneral: {
2809
2849
  id: 'number.general',
2810
2850
  label: spreadsheetNumberFormatPresetLabels.general,
@@ -3021,6 +3061,14 @@ const spreadsheetCommandCatalog = {
3021
3061
  area: 'ribbon',
3022
3062
  tab: 'home',
3023
3063
  group: 'font'
3064
+ },
3065
+ shortcut: {
3066
+ label: 'Cmd/Ctrl+Shift+_',
3067
+ aria: 'Control+Shift+_ Meta+Shift+_',
3068
+ editor: [
3069
+ 'Mod-Shift-_',
3070
+ 'Mod-Shift-Minus'
3071
+ ]
3024
3072
  }
3025
3073
  },
3026
3074
  borderAll: {
@@ -3039,6 +3087,14 @@ const spreadsheetCommandCatalog = {
3039
3087
  area: 'ribbon',
3040
3088
  tab: 'home',
3041
3089
  group: 'font'
3090
+ },
3091
+ shortcut: {
3092
+ label: 'Cmd/Ctrl+Shift+&',
3093
+ aria: 'Control+Shift+& Meta+Shift+&',
3094
+ editor: [
3095
+ 'Mod-Shift-&',
3096
+ 'Mod-Shift-7'
3097
+ ]
3042
3098
  }
3043
3099
  },
3044
3100
  borderInside: {
@@ -3842,6 +3898,8 @@ function spreadsheet_cell_clear_isRecord(value) {
3842
3898
  return Boolean(value && 'object' == typeof value && !Array.isArray(value));
3843
3899
  }
3844
3900
  function createSpreadsheetCellBorderExtension() {
3901
+ const outsideShortcuts = spreadsheetCommandCatalog.borderOutside.shortcut.editor;
3902
+ const noneShortcuts = spreadsheetCommandCatalog.borderNone.shortcut.editor;
3845
3903
  return createOfficeEditorExtension({
3846
3904
  name: 'spreadsheetCellBorders',
3847
3905
  addCommands: ()=>({
@@ -3849,6 +3907,28 @@ function createSpreadsheetCellBorderExtension() {
3849
3907
  canExecute: canSetSelectedCellBorders,
3850
3908
  execute: setSelectedCellBorders
3851
3909
  }
3910
+ }),
3911
+ addKeyboardShortcuts: ()=>({
3912
+ [outsideShortcuts[0]]: ({ can, commands }, event)=>runSpreadsheetBorderShortcut(event, can.setSelectedCellBorders, commands.setSelectedCellBorders, {
3913
+ target: 'outside',
3914
+ color: '#000000',
3915
+ style: 'thin'
3916
+ }),
3917
+ [outsideShortcuts[1]]: ({ can, commands }, event)=>runSpreadsheetBorderShortcut(event, can.setSelectedCellBorders, commands.setSelectedCellBorders, {
3918
+ target: 'outside',
3919
+ color: '#000000',
3920
+ style: 'thin'
3921
+ }),
3922
+ [noneShortcuts[0]]: ({ can, commands }, event)=>runSpreadsheetBorderShortcut(event, can.setSelectedCellBorders, commands.setSelectedCellBorders, {
3923
+ target: 'none',
3924
+ color: '#000000',
3925
+ style: 'thin'
3926
+ }),
3927
+ [noneShortcuts[1]]: ({ can, commands }, event)=>runSpreadsheetBorderShortcut(event, can.setSelectedCellBorders, commands.setSelectedCellBorders, {
3928
+ target: 'none',
3929
+ color: '#000000',
3930
+ style: 'thin'
3931
+ })
3852
3932
  })
3853
3933
  });
3854
3934
  }
@@ -3856,15 +3936,22 @@ function canSetSelectedCellBorders(context, format) {
3856
3936
  return Boolean(context.editable && context.workbook && context.targetSheetId && canSetSpreadsheetCellBorders(context.content, context.targetSheetId, liveSpreadsheetBorderRange(context), format));
3857
3937
  }
3858
3938
  function setSelectedCellBorders(context, format) {
3859
- if (!canSetSelectedCellBorders(context, format)) return false;
3860
- const next = setSpreadsheetCellBorders(context.content, context.targetSheetId, liveSpreadsheetBorderRange(context), format);
3939
+ if (!context.editable || !context.workbook || !context.targetSheetId) return false;
3940
+ const selection = context.workbook.getSelection()?.at(-1) ?? context.fallbackRange;
3941
+ const range = spreadsheetSingleRange(selection);
3942
+ if (!canSetSpreadsheetCellBorders(context.content, context.targetSheetId, range, format)) return false;
3943
+ const next = setSpreadsheetCellBorders(context.content, context.targetSheetId, range, format);
3861
3944
  if (!next) return false;
3862
- context.onChange(next);
3945
+ context.onChange(spreadsheetContentWithSelection(next, context.targetSheetId, selection));
3863
3946
  return true;
3864
3947
  }
3865
3948
  function liveSpreadsheetBorderRange(context) {
3866
3949
  return spreadsheetSingleRange(context.workbook?.getSelection()?.at(-1) ?? context.fallbackRange);
3867
3950
  }
3951
+ function runSpreadsheetBorderShortcut(event, canExecute, execute, format) {
3952
+ if (event.repeat || isOfficeShortcutBlocked(event.target) || isSpreadsheetNativeTextUndoTarget(event.target) || !canExecute(format)) return false;
3953
+ return execute(format);
3954
+ }
3868
3955
  const MAX_SPREADSHEET_PER_CELL_BORDER_CELLS = 10000;
3869
3956
  function setSpreadsheetCellBordersPerCell(content, sheetId, range, formats) {
3870
3957
  const normalizedRange = spreadsheet_cell_range_normalizeSpreadsheetCellRange(range);
@@ -3962,7 +4049,7 @@ function canApplySpreadsheetCellFormat(content, request) {
3962
4049
  'top',
3963
4050
  'middle',
3964
4051
  'bottom'
3965
- ].includes(patch.verticalAlignment) || void 0 !== patch.wrapText && 'boolean' != typeof patch.wrapText || void 0 !== patch.rotation && (!Number.isInteger(patch.rotation) || patch.rotation < -90 || patch.rotation > 90) || void 0 !== patch.fontFamily && !validTrimmedString(patch.fontFamily, 128) || void 0 !== patch.fontSize && (!Number.isFinite(patch.fontSize) || patch.fontSize < 1 || patch.fontSize > 409) || void 0 !== patch.fontColor && !normalizeColor(patch.fontColor) || void 0 !== patch.fillColor && null !== patch.fillColor && !normalizeColor(patch.fillColor) || !validOptionalBoolean(patch.bold) || !validOptionalBoolean(patch.italic) || !validOptionalBoolean(patch.underline) || !validOptionalBoolean(patch.strike) || !validOptionalBoolean(patch.locked) || !validOptionalBoolean(patch.hidden)) return false;
4052
+ ].includes(patch.verticalAlignment) || void 0 !== patch.wrapText && 'boolean' != typeof patch.wrapText || void 0 !== patch.rotation && (!Number.isInteger(patch.rotation) || patch.rotation < -90 || patch.rotation > 90) || void 0 !== patch.fontFamily && !validTrimmedString(patch.fontFamily, 128) || void 0 !== patch.fontSize && (!Number.isFinite(patch.fontSize) || patch.fontSize < 1 || patch.fontSize > 409) || void 0 !== patch.fontColor && !normalizeColor(patch.fontColor) || void 0 !== patch.fillColor && null !== patch.fillColor && !normalizeColor(patch.fillColor) || !validOptionalBoolean(patch.bold) || !validOptionalBoolean(patch.italic) || void 0 !== patch.underline && !isSpreadsheetUnderlineStyle(patch.underline) || !validOptionalBoolean(patch.strike) || !validOptionalBoolean(patch.locked) || !validOptionalBoolean(patch.hidden)) return false;
3966
4053
  if (void 0 !== patch.borders) {
3967
4054
  const normalized = patch.borders.map(normalizeSpreadsheetBorderFormat);
3968
4055
  if (normalized.some((format)=>!format || ![
@@ -4127,7 +4214,7 @@ function formatCell(source, patch) {
4127
4214
  if (void 0 !== patch.fontColor) next.fc = normalizeColor(patch.fontColor) ?? patch.fontColor;
4128
4215
  if (void 0 !== patch.bold) next.bl = patch.bold ? 1 : 0;
4129
4216
  if (void 0 !== patch.italic) next.it = patch.italic ? 1 : 0;
4130
- if (void 0 !== patch.underline) next.un = patch.underline ? 1 : 0;
4217
+ if (void 0 !== patch.underline) next.un = spreadsheetUnderlineCellValue(patch.underline);
4131
4218
  if (void 0 !== patch.strike) next.cl = patch.strike ? 1 : 0;
4132
4219
  if (void 0 !== patch.fillColor) if (null === patch.fillColor) delete next.bg;
4133
4220
  else next.bg = normalizeColor(patch.fillColor) ?? patch.fillColor;
@@ -4719,6 +4806,157 @@ function spreadsheetSelectedCellFillPlan(context, direction) {
4719
4806
  const sheet = context.content.sheets.find((candidate)=>candidate.id === context.targetSheetId);
4720
4807
  return canApplySpreadsheetCellFill(sheet, plan) ? plan : null;
4721
4808
  }
4809
+ const MAX_SPREADSHEET_FONT_SIZE_CELLS = 10000;
4810
+ function createSpreadsheetFontSizeExtension() {
4811
+ const growShortcuts = spreadsheetCommandCatalog.growFont.shortcut.editor;
4812
+ const shrinkShortcuts = spreadsheetCommandCatalog.shrinkFont.shortcut.editor;
4813
+ return createOfficeEditorExtension({
4814
+ name: 'spreadsheetFontSize',
4815
+ addCommands: ()=>({
4816
+ adjustFontSize: {
4817
+ canExecute: canAdjustSelectedFontSize,
4818
+ execute: adjustSelectedFontSize
4819
+ }
4820
+ }),
4821
+ addKeyboardShortcuts: ()=>({
4822
+ [growShortcuts[0]]: ({ can, commands }, event)=>runSpreadsheetFontSizeShortcut(event, can.adjustFontSize, commands.adjustFontSize, 'grow'),
4823
+ [growShortcuts[1]]: ({ can, commands }, event)=>runSpreadsheetFontSizeShortcut(event, can.adjustFontSize, commands.adjustFontSize, 'grow'),
4824
+ [shrinkShortcuts[0]]: ({ can, commands }, event)=>runSpreadsheetFontSizeShortcut(event, can.adjustFontSize, commands.adjustFontSize, 'shrink'),
4825
+ [shrinkShortcuts[1]]: ({ can, commands }, event)=>runSpreadsheetFontSizeShortcut(event, can.adjustFontSize, commands.adjustFontSize, 'shrink')
4826
+ })
4827
+ });
4828
+ }
4829
+ function spreadsheetFontSizeApiCalls(cells, range, sheetId, direction) {
4830
+ const normalizedRange = spreadsheet_cell_range_normalizeSpreadsheetCellRange(range);
4831
+ if (!normalizedRange || !sheetId || !isSpreadsheetFontSizeDirection(direction) || spreadsheet_cell_range_spreadsheetCellRangeArea(normalizedRange) > MAX_SPREADSHEET_FONT_SIZE_CELLS) return [];
4832
+ const rectangles = [];
4833
+ let active = new Map();
4834
+ const rowCount = normalizedRange.row[1] - normalizedRange.row[0] + 1;
4835
+ const columnCount = normalizedRange.column[1] - normalizedRange.column[0] + 1;
4836
+ for(let rowOffset = 0; rowOffset < rowCount; rowOffset += 1){
4837
+ const row = normalizedRange.row[0] + rowOffset;
4838
+ const runs = spreadsheetFontSizeRowRuns(cells[rowOffset], row, normalizedRange.column[0], columnCount, direction);
4839
+ const nextActive = new Map();
4840
+ for (const run of runs){
4841
+ const signature = `${run.key}:${run.range.column[0]}:${run.range.column[1]}`;
4842
+ const previous = active.get(signature);
4843
+ if (previous && previous.range.row[1] === row - 1) {
4844
+ previous.range.row[1] = row;
4845
+ nextActive.set(signature, previous);
4846
+ } else nextActive.set(signature, run);
4847
+ }
4848
+ for (const [signature, run] of active)if (!nextActive.has(signature)) rectangles.push(run);
4849
+ active = nextActive;
4850
+ }
4851
+ rectangles.push(...active.values());
4852
+ rectangles.sort((left, right)=>left.range.row[0] - right.range.row[0] || left.range.column[0] - right.range.column[0] || left.range.row[1] - right.range.row[1] || left.range.column[1] - right.range.column[1]);
4853
+ return rectangles.map(({ range: targetRange, size })=>({
4854
+ name: 'setCellFormatByRange',
4855
+ args: [
4856
+ 'fs',
4857
+ size,
4858
+ targetRange,
4859
+ {
4860
+ id: sheetId
4861
+ }
4862
+ ]
4863
+ }));
4864
+ }
4865
+ function spreadsheetFontSizeRowRuns(cells, row, firstColumn, columnCount, direction) {
4866
+ const runs = [];
4867
+ let current = null;
4868
+ for(let columnOffset = 0; columnOffset < columnCount; columnOffset += 1){
4869
+ const column = firstColumn + columnOffset;
4870
+ const size = adjustedSpreadsheetFontSize(cells?.[columnOffset], direction);
4871
+ if (null === size) {
4872
+ if (current) runs.push(current);
4873
+ current = null;
4874
+ continue;
4875
+ }
4876
+ const key = String(size);
4877
+ if (current && current.key === key) {
4878
+ current.range.column[1] = column;
4879
+ continue;
4880
+ }
4881
+ if (current) runs.push(current);
4882
+ current = {
4883
+ key,
4884
+ range: {
4885
+ row: [
4886
+ row,
4887
+ row
4888
+ ],
4889
+ column: [
4890
+ column,
4891
+ column
4892
+ ]
4893
+ },
4894
+ size
4895
+ };
4896
+ }
4897
+ if (current) runs.push(current);
4898
+ return runs;
4899
+ }
4900
+ function adjustedSpreadsheetFontSize(cell, direction) {
4901
+ const size = cell?.fs === void 0 ? 10 : Number(cell.fs);
4902
+ return nextSpreadsheetFontSize(size, direction);
4903
+ }
4904
+ function canAdjustSelectedFontSize(context, direction) {
4905
+ const workbook = context.workbook;
4906
+ const sheetId = context.targetSheetId;
4907
+ if (!context.editable || !workbook || !sheetId || sheetId !== context.activeSheetId || !isSpreadsheetFontSizeDirection(direction)) return false;
4908
+ const range = liveSpreadsheetFontSizeRange(context);
4909
+ if (spreadsheet_cell_range_spreadsheetCellRangeArea(range) > MAX_SPREADSHEET_FONT_SIZE_CELLS) return false;
4910
+ try {
4911
+ const cells = workbook.getCellsByRange(range, {
4912
+ id: sheetId
4913
+ });
4914
+ return canAdjustSpreadsheetFontSizeCells(range.row[1] - range.row[0] + 1, range.column[1] - range.column[0] + 1, (rowOffset, columnOffset)=>cells[rowOffset]?.[columnOffset] ?? null, direction);
4915
+ } catch {
4916
+ return false;
4917
+ }
4918
+ }
4919
+ function adjustSelectedFontSize(context, direction) {
4920
+ const workbook = context.workbook;
4921
+ const sheetId = context.targetSheetId;
4922
+ if (!context.editable || !workbook || !sheetId || sheetId !== context.activeSheetId || !isSpreadsheetFontSizeDirection(direction)) return false;
4923
+ const range = liveSpreadsheetFontSizeRange(context);
4924
+ if (spreadsheet_cell_range_spreadsheetCellRangeArea(range) > MAX_SPREADSHEET_FONT_SIZE_CELLS) return false;
4925
+ try {
4926
+ const cells = workbook.getCellsByRange(range, {
4927
+ id: sheetId
4928
+ });
4929
+ const calls = spreadsheetFontSizeApiCalls(cells, range, sheetId, direction);
4930
+ if (!calls.length) return false;
4931
+ workbook.batchCallApis(calls);
4932
+ return true;
4933
+ } catch {
4934
+ return false;
4935
+ }
4936
+ }
4937
+ function canAdjustSpreadsheetFontSizeCells(rowCount, columnCount, cellAt, direction) {
4938
+ for(let rowOffset = 0; rowOffset < rowCount; rowOffset += 1)for(let columnOffset = 0; columnOffset < columnCount; columnOffset += 1)if (null !== adjustedSpreadsheetFontSize(cellAt(rowOffset, columnOffset), direction)) return true;
4939
+ return false;
4940
+ }
4941
+ function liveSpreadsheetFontSizeRange(context) {
4942
+ return spreadsheet_cell_range_normalizeSpreadsheetCellRange(spreadsheetSingleRange(context.workbook?.getSelection()?.at(-1) ?? context.fallbackRange)) ?? {
4943
+ row: [
4944
+ 0,
4945
+ 0
4946
+ ],
4947
+ column: [
4948
+ 0,
4949
+ 0
4950
+ ]
4951
+ };
4952
+ }
4953
+ function isSpreadsheetFontSizeDirection(value) {
4954
+ return 'grow' === value || 'shrink' === value;
4955
+ }
4956
+ function runSpreadsheetFontSizeShortcut(event, canExecute, execute, direction) {
4957
+ if (event.repeat || isOfficeShortcutBlocked(event.target) || isSpreadsheetNativeTextUndoTarget(event.target) || !canExecute(direction)) return false;
4958
+ return execute(direction);
4959
+ }
4722
4960
  const spreadsheet_go_to_spreadsheetMaximumRows = 1048576;
4723
4961
  const spreadsheet_go_to_spreadsheetMaximumColumns = 16384;
4724
4962
  const spreadsheetGoToMaximumInputLength = 512;
@@ -7268,6 +7506,7 @@ function createSpreadsheetEditorExtensions() {
7268
7506
  })
7269
7507
  }),
7270
7508
  createSpreadsheetCellFormatExtension(),
7509
+ createSpreadsheetFontSizeExtension(),
7271
7510
  createSpreadsheetCellBorderExtension(),
7272
7511
  createSpreadsheetCellStyleExtension(),
7273
7512
  createSpreadsheetNumberFormatExtension(),
@@ -7927,7 +8166,8 @@ function isSpreadsheetAutoFilterTextTarget(target) {
7927
8166
  }
7928
8167
  function runSpreadsheetCellFormatShortcut(event, context, canExecute, execute, attribute) {
7929
8168
  if (event.repeat || isOfficeShortcutBlocked(event.target) || isSpreadsheetNativeTextUndoTarget(event.target)) return false;
7930
- const value = 1 === Number(context.toolbarCell?.[attribute]) ? 0 : 1;
8169
+ const active = 'un' === attribute ? 'none' !== spreadsheetUnderlineStyle(context.toolbarCell?.un) : 1 === Number(context.toolbarCell?.[attribute]);
8170
+ const value = active ? 0 : 1;
7931
8171
  return canExecute(attribute, value) && execute(attribute, value);
7932
8172
  }
7933
8173
  function runSpreadsheetNumberFormatShortcut(event, context, canExecute, execute, preset) {
@@ -8846,6 +9086,7 @@ function SpreadsheetBorderRibbon({ can, commands }) {
8846
9086
  color
8847
9087
  };
8848
9088
  const currentDefinition = spreadsheetBorderTargetOptions.find((option)=>option.target === target)?.definition;
9089
+ const currentShortcut = currentDefinition && 'shortcut' in currentDefinition ? currentDefinition.shortcut : void 0;
8849
9090
  const currentLabel = currentDefinition?.label ?? '所有框线';
8850
9091
  const styleLabel = spreadsheetBorderStyleOptions.find((option)=>option.value === style)?.label;
8851
9092
  const menuDisabled = spreadsheetBorderTargetOptions.every((option)=>!can.setSelectedCellBorders({
@@ -8868,7 +9109,8 @@ function SpreadsheetBorderRibbon({ can, commands }) {
8868
9109
  type: "button",
8869
9110
  className: "work-spreadsheet-border-primary",
8870
9111
  "aria-label": currentLabel,
8871
- title: `${currentLabel}(${styleLabel},${color.toUpperCase()})`,
9112
+ "aria-keyshortcuts": currentShortcut?.aria,
9113
+ title: `${currentLabel}(${styleLabel},${color.toUpperCase()}${currentShortcut ? `;${currentShortcut.label}` : ''})`,
8872
9114
  disabled: !can.setSelectedCellBorders(format),
8873
9115
  onClick: ()=>commands.setSelectedCellBorders(format),
8874
9116
  children: /*#__PURE__*/ jsx(SpreadsheetBorderGlyph, {
@@ -8902,11 +9144,14 @@ function SpreadsheetBorderRibbon({ can, commands }) {
8902
9144
  ...format,
8903
9145
  target: option
8904
9146
  };
9147
+ const shortcut = 'shortcut' in definition ? definition.shortcut : void 0;
8905
9148
  return /*#__PURE__*/ jsxs("button", {
8906
9149
  type: "button",
8907
9150
  role: "menuitemradio",
8908
9151
  tabIndex: 0 === index ? 0 : -1,
8909
9152
  "aria-checked": option === target,
9153
+ "aria-label": definition.label,
9154
+ "aria-keyshortcuts": shortcut?.aria,
8910
9155
  disabled: !can.setSelectedCellBorders(next),
8911
9156
  onClick: ()=>{
8912
9157
  setTarget(option);
@@ -8918,7 +9163,11 @@ function SpreadsheetBorderRibbon({ can, commands }) {
8918
9163
  target: option
8919
9164
  }),
8920
9165
  /*#__PURE__*/ jsx("span", {
9166
+ className: "work-spreadsheet-border-target-label",
8921
9167
  children: definition.label
9168
+ }),
9169
+ shortcut && /*#__PURE__*/ jsx("kbd", {
9170
+ children: shortcut.label
8922
9171
  })
8923
9172
  ]
8924
9173
  }, definition.id);
@@ -8984,6 +9233,108 @@ function SpreadsheetBorderGlyph({ target }) {
8984
9233
  "aria-hidden": "true"
8985
9234
  });
8986
9235
  }
9236
+ const underlineOptions = [
9237
+ {
9238
+ value: 'none',
9239
+ label: '无下划线'
9240
+ },
9241
+ {
9242
+ value: 'single',
9243
+ label: '单下划线'
9244
+ },
9245
+ {
9246
+ value: 'double',
9247
+ label: '双下划线'
9248
+ },
9249
+ {
9250
+ value: 'singleAccounting',
9251
+ label: '单会计用下划线'
9252
+ },
9253
+ {
9254
+ value: 'doubleAccounting',
9255
+ label: '双会计用下划线'
9256
+ }
9257
+ ];
9258
+ function SpreadsheetUnderlineRibbon({ can, commands, value }) {
9259
+ const style = spreadsheetUnderlineStyle(value);
9260
+ const active = 'none' !== style;
9261
+ const toggleValue = active ? 0 : 1;
9262
+ const definition = spreadsheetCommandCatalog.underline;
9263
+ const currentLabel = underlineOptions.find((option)=>option.value === style)?.label ?? underlineOptions[0].label;
9264
+ const menuDisabled = underlineOptions.every((option)=>!can.setCellFormat('un', spreadsheetUnderlineCellValue(option.value)));
9265
+ return /*#__PURE__*/ jsx(Popover, {
9266
+ label: "更多下划线",
9267
+ panelLabel: "下划线样式",
9268
+ panelRole: "menu",
9269
+ portal: true,
9270
+ placement: "bottom-end",
9271
+ className: "work-spreadsheet-underline-split-root",
9272
+ panelClassName: "work-office-context-menu work-spreadsheet-ribbon-menu work-spreadsheet-underline-menu",
9273
+ disabled: menuDisabled,
9274
+ focusFirstOnOpen: true,
9275
+ onPanelKeyDown: moveOfficeMenuFocus,
9276
+ trigger: (triggerProps, { open })=>/*#__PURE__*/ jsxs(Fragment, {
9277
+ children: [
9278
+ /*#__PURE__*/ jsx("button", {
9279
+ type: "button",
9280
+ className: `work-spreadsheet-underline-primary${active ? ' active' : ''}`,
9281
+ "aria-label": definition.label,
9282
+ "aria-keyshortcuts": definition.shortcut.aria,
9283
+ "aria-pressed": active,
9284
+ title: `${definition.label}(${currentLabel};${definition.shortcut.label})`,
9285
+ disabled: !can.setCellFormat('un', toggleValue),
9286
+ onClick: ()=>commands.setCellFormat('un', toggleValue),
9287
+ children: /*#__PURE__*/ jsx(Underline, {
9288
+ size: 15,
9289
+ "aria-hidden": "true"
9290
+ })
9291
+ }),
9292
+ /*#__PURE__*/ jsx("button", {
9293
+ ...triggerProps,
9294
+ className: `work-spreadsheet-underline-disclosure${open ? ' active' : ''}`,
9295
+ title: "更多下划线",
9296
+ children: /*#__PURE__*/ jsx(ChevronDown, {
9297
+ size: 12,
9298
+ "aria-hidden": "true"
9299
+ })
9300
+ })
9301
+ ]
9302
+ }),
9303
+ children: (close)=>underlineOptions.map((option)=>{
9304
+ const cellValue = spreadsheetUnderlineCellValue(option.value);
9305
+ return /*#__PURE__*/ jsxs("button", {
9306
+ type: "button",
9307
+ role: "menuitemradio",
9308
+ tabIndex: -1,
9309
+ "aria-checked": style === option.value,
9310
+ "aria-label": option.label,
9311
+ disabled: !can.setCellFormat('un', cellValue),
9312
+ onClick: ()=>{
9313
+ close();
9314
+ commands.setCellFormat('un', cellValue);
9315
+ },
9316
+ children: [
9317
+ /*#__PURE__*/ jsx(SpreadsheetUnderlineGlyph, {
9318
+ style: option.value
9319
+ }),
9320
+ /*#__PURE__*/ jsx("span", {
9321
+ children: option.label
9322
+ })
9323
+ ]
9324
+ }, option.value);
9325
+ })
9326
+ });
9327
+ }
9328
+ function SpreadsheetUnderlineGlyph({ style }) {
9329
+ return /*#__PURE__*/ jsx("span", {
9330
+ className: "work-spreadsheet-underline-glyph",
9331
+ "data-underline-style": style,
9332
+ "aria-hidden": "true",
9333
+ children: /*#__PURE__*/ jsx(Underline, {
9334
+ size: 16
9335
+ })
9336
+ });
9337
+ }
8987
9338
  const spreadsheetNumberFormatOptions = [
8988
9339
  {
8989
9340
  value: 'general',
@@ -9054,10 +9405,11 @@ function SpreadsheetFontRibbonGroup({ can, commands, toolbarCell }) {
9054
9405
  const fontSize = Number(toolbarCell?.fs ?? 10);
9055
9406
  const bold = 1 === Number(toolbarCell?.bl);
9056
9407
  const italic = 1 === Number(toolbarCell?.it);
9057
- const underline = 1 === Number(toolbarCell?.un);
9058
9408
  const strike = 1 === Number(toolbarCell?.cl);
9059
9409
  const textColor = 'string' == typeof toolbarCell?.fc ? toolbarCell.fc : '#172033';
9060
9410
  const fillColor = 'string' == typeof toolbarCell?.bg ? toolbarCell.bg : '#ffffff';
9411
+ const growFont = spreadsheetCommandCatalog.growFont;
9412
+ const shrinkFont = spreadsheetCommandCatalog.shrinkFont;
9061
9413
  return /*#__PURE__*/ jsxs(WorkOfficeRibbonGroup, {
9062
9414
  label: "字体",
9063
9415
  priority: "high",
@@ -9077,6 +9429,28 @@ function SpreadsheetFontRibbonGroup({ can, commands, toolbarCell }) {
9077
9429
  options: spreadsheetFontSizeOptions(toolbarCell?.fs),
9078
9430
  onValueChange: (value)=>commands.setCellFormat('fs', Number(value))
9079
9431
  }),
9432
+ /*#__PURE__*/ jsx(WorkOfficeRibbonButton, {
9433
+ label: growFont.label,
9434
+ title: `${growFont.label}(${growFont.shortcut.label})`,
9435
+ "aria-keyshortcuts": growFont.shortcut.aria,
9436
+ displayLabel: false,
9437
+ disabled: !can.adjustFontSize('grow'),
9438
+ onClick: ()=>commands.adjustFontSize('grow'),
9439
+ children: /*#__PURE__*/ jsx(AArrowUp, {
9440
+ size: 15
9441
+ })
9442
+ }),
9443
+ /*#__PURE__*/ jsx(WorkOfficeRibbonButton, {
9444
+ label: shrinkFont.label,
9445
+ title: `${shrinkFont.label}(${shrinkFont.shortcut.label})`,
9446
+ "aria-keyshortcuts": shrinkFont.shortcut.aria,
9447
+ displayLabel: false,
9448
+ disabled: !can.adjustFontSize('shrink'),
9449
+ onClick: ()=>commands.adjustFontSize('shrink'),
9450
+ children: /*#__PURE__*/ jsx(AArrowDown, {
9451
+ size: 15
9452
+ })
9453
+ }),
9080
9454
  /*#__PURE__*/ jsx(SpreadsheetFontToggle, {
9081
9455
  active: bold,
9082
9456
  attribute: "bl",
@@ -9097,15 +9471,10 @@ function SpreadsheetFontRibbonGroup({ can, commands, toolbarCell }) {
9097
9471
  size: 15
9098
9472
  })
9099
9473
  }),
9100
- /*#__PURE__*/ jsx(SpreadsheetFontToggle, {
9101
- active: underline,
9102
- attribute: "un",
9474
+ /*#__PURE__*/ jsx(SpreadsheetUnderlineRibbon, {
9103
9475
  can: can,
9104
9476
  commands: commands,
9105
- command: "underline",
9106
- icon: /*#__PURE__*/ jsx(Underline, {
9107
- size: 15
9108
- })
9477
+ value: toolbarCell?.un
9109
9478
  }),
9110
9479
  /*#__PURE__*/ jsx(SpreadsheetFontToggle, {
9111
9480
  active: strike,
@@ -11798,6 +12167,28 @@ const verticalOptions = [
11798
12167
  label: '底端对齐'
11799
12168
  }
11800
12169
  ];
12170
+ const spreadsheet_format_cells_dialog_panels_underlineOptions = [
12171
+ {
12172
+ value: 'none',
12173
+ label: '无'
12174
+ },
12175
+ {
12176
+ value: 'single',
12177
+ label: '单下划线'
12178
+ },
12179
+ {
12180
+ value: 'double',
12181
+ label: '双下划线'
12182
+ },
12183
+ {
12184
+ value: 'singleAccounting',
12185
+ label: '单会计用下划线'
12186
+ },
12187
+ {
12188
+ value: 'doubleAccounting',
12189
+ label: '双会计用下划线'
12190
+ }
12191
+ ];
11801
12192
  const borderStyleOptions = [
11802
12193
  {
11803
12194
  value: 'thin',
@@ -12030,6 +12421,7 @@ function AlignmentPanel({ source, draft, errors, touched, setDraft, touch }) {
12030
12421
  function FontPanel({ source, draft, errors, touched, setDraft, touch }) {
12031
12422
  const familyMixed = source.fields.fontFamily.mixed && !touched.fontFamily;
12032
12423
  const sizeMixed = source.fields.fontSize.mixed && !touched.fontSize;
12424
+ const underlineMixed = source.fields.underline.mixed && !touched.underline;
12033
12425
  const toggle = (field, checked)=>{
12034
12426
  touch(field);
12035
12427
  setDraft((current)=>({
@@ -12091,10 +12483,6 @@ function FontPanel({ source, draft, errors, touched, setDraft, touch }) {
12091
12483
  'italic',
12092
12484
  '斜体'
12093
12485
  ],
12094
- [
12095
- 'underline',
12096
- '下划线'
12097
- ],
12098
12486
  [
12099
12487
  'strike',
12100
12488
  '删除线'
@@ -12108,6 +12496,22 @@ function FontPanel({ source, draft, errors, touched, setDraft, touch }) {
12108
12496
  }, field))
12109
12497
  ]
12110
12498
  }),
12499
+ /*#__PURE__*/ jsx(Field, {
12500
+ label: "下划线",
12501
+ children: /*#__PURE__*/ jsx(OfficeSelect, {
12502
+ ariaLabel: "下划线样式",
12503
+ value: underlineMixed ? MIXED_VALUE : draft.underline,
12504
+ options: withMixedOption(spreadsheet_format_cells_dialog_panels_underlineOptions, underlineMixed),
12505
+ onValueChange: (value)=>{
12506
+ if (value === MIXED_VALUE) return;
12507
+ touch('underline');
12508
+ setDraft((current)=>({
12509
+ ...current,
12510
+ underline: value
12511
+ }));
12512
+ }
12513
+ })
12514
+ }),
12111
12515
  /*#__PURE__*/ jsx(Field, {
12112
12516
  label: "文字颜色",
12113
12517
  children: /*#__PURE__*/ jsx(OfficeColorPicker, {
@@ -12130,10 +12534,12 @@ function FontPanel({ source, draft, errors, touched, setDraft, touch }) {
12130
12534
  fontSize: `${Math.max(10, draft.fontSize)}px`,
12131
12535
  fontStyle: draft.italic ? 'italic' : 'normal',
12132
12536
  fontWeight: draft.bold ? 700 : 400,
12133
- textDecoration: [
12134
- draft.underline && 'underline',
12537
+ textDecorationLine: [
12538
+ 'none' !== draft.underline && 'underline',
12135
12539
  draft.strike && 'line-through'
12136
- ].filter(Boolean).join(' ')
12540
+ ].filter(Boolean).join(' '),
12541
+ textDecorationStyle: 'double' === draft.underline || 'doubleAccounting' === draft.underline ? 'double' : 'solid',
12542
+ textUnderlineOffset: 'singleAccounting' === draft.underline || 'doubleAccounting' === draft.underline ? '0.24em' : '0.12em'
12137
12543
  },
12138
12544
  children: "A3S Office 字体预览"
12139
12545
  })
@@ -12450,7 +12856,7 @@ function createSpreadsheetFormatCellsDialogSource(content, sheetId, rangeInput,
12450
12856
  fontColor: values((cell)=>normalizedColor(cell?.fc, '#172033')),
12451
12857
  bold: values((cell)=>1 === Number(cell?.bl)),
12452
12858
  italic: values((cell)=>1 === Number(cell?.it)),
12453
- underline: values((cell)=>1 === Number(cell?.un)),
12859
+ underline: values((cell)=>spreadsheetUnderlineStyle(cell?.un)),
12454
12860
  strike: values((cell)=>1 === Number(cell?.cl)),
12455
12861
  fillColor: values((cell)=>'string' == typeof cell?.bg && cell.bg.trim() ? normalizedColor(cell.bg, null) : null),
12456
12862
  borders: {
@@ -22849,6 +23255,7 @@ function spreadsheetCommandsWithGridFocus(commands, restoreFocus) {
22849
23255
  return {
22850
23256
  ...commands,
22851
23257
  adjustDecimalPlaces: afterSuccessfulCommand(commands.adjustDecimalPlaces),
23258
+ adjustFontSize: afterSuccessfulCommand(commands.adjustFontSize),
22852
23259
  applyAutoSum: afterSuccessfulCommand(commands.applyAutoSum),
22853
23260
  activateFormatPainter: afterSuccessfulCommand(commands.activateFormatPainter),
22854
23261
  cancelFormatPainter: afterSuccessfulCommand(commands.cancelFormatPainter),