@a3s-lab/office 0.23.0 → 0.25.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.
- package/README.md +4 -2
- package/dist/0~4595.js +3 -1
- package/dist/0~spreadsheet-editor.js +145 -49
- package/dist/0~work-office-diagnostics.js +2 -2
- package/dist/{5045.js → 164.js} +1076 -18
- package/dist/4104.js +46 -748
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/features/work/editors/office-select.d.ts +3 -1
- package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +28 -0
- package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +3 -1
- package/dist/internal/features/work/editors/spreadsheet-format-cells-dialog-model.d.ts +1 -20
- package/dist/internal/features/work/editors/spreadsheet-format-cells-dialog-panels.d.ts +2 -0
- package/dist/internal/features/work/editors/spreadsheet-format-cells-dialog.d.ts +3 -1
- package/dist/internal/features/work/editors/spreadsheet-format-cells-intent.d.ts +32 -0
- package/dist/internal/features/work/work-xlsx-cell-style-origin.d.ts +1 -0
- package/dist/internal/features/work/work-xlsx-colors.d.ts +1 -1
- package/dist/internal/features/work/work-xlsx-interop.d.ts +2 -0
- package/dist/internal/features/work/work-xlsx-rich-text.d.ts +55 -0
- package/dist/internal/features/work/work-xlsx-worksheet-scan.d.ts +1 -0
- package/dist/internal/features/work/work-xlsx-worksheet.d.ts +5 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/work-spreadsheet-package-scan.worker.js +6 -2
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -124,8 +124,8 @@ baseline rather than one specific release.
|
|
|
124
124
|
| Capability | A3S Office today | Traditional Office baseline |
|
|
125
125
|
| --- | --- | --- |
|
|
126
126
|
| Cells, sheets, navigation, and history | **Supported** — multiple sheets, sparse editing, search, clipboard, four-direction fill, exact formula/value copy from above, and undo/redo | Mature grid workflows across desktop and web |
|
|
127
|
-
| Formatting and style rendering | **Partial** — native fonts, colors, borders, alignment, number formats, cell styles,
|
|
128
|
-
| Ribbon and shortcuts | **Partial** — common Office-style Home/Data/View commands
|
|
127
|
+
| Formatting and style rendering | **Partial** — native fonts, colors, borders, alignment, number formats, cell styles, static date/time entry, contrast-safe font preview, and native XLSX rich-text runs with cell-wide font edits | Broader run-level rich-text authoring, themes, locale formats, and advanced style effects |
|
|
128
|
+
| Ribbon and shortcuts | **Partial** — common Office-style Home/Data/View commands, grid-scoped shortcuts, and focused Font-dialog aliases | Larger command catalog and platform-specific accelerators |
|
|
129
129
|
| Formulas and recalculation | **Partial** — dependency-aware calculation and common formula paths | Wider functions, arrays, volatile semantics, and calculation parity |
|
|
130
130
|
| Tables, pivots, charts, and rules | **Partial** — native tables, pivots, charts, conditional formatting, and validation | Calculated columns, slicers, pivot charts, advanced rules, and analysis |
|
|
131
131
|
| Large worksheets | **Supported with boundaries** — maximum-dimension sparse import/editing and viewport-bounded Canvas painting | Highly optimized native grid with hardware-dependent limits |
|
|
@@ -1347,6 +1347,8 @@ without hard-coded return URLs.
|
|
|
1347
1347
|
|
|
1348
1348
|
- [Live Playground](https://a3s-lab.github.io/Office/)
|
|
1349
1349
|
- [Documentation center](https://a3s-lab.github.io/Office/docs/)
|
|
1350
|
+
- [A3S Office 0.25.0 documentation](https://a3s-lab.github.io/Office/docs/0.25.0/)
|
|
1351
|
+
- [A3S Office 0.24.0 documentation](https://a3s-lab.github.io/Office/docs/0.24.0/)
|
|
1350
1352
|
- [A3S Office 0.23.0 documentation](https://a3s-lab.github.io/Office/docs/0.23.0/)
|
|
1351
1353
|
- [A3S Office 0.22.0 documentation](https://a3s-lab.github.io/Office/docs/0.22.0/)
|
|
1352
1354
|
- [A3S Office 0.21.0 documentation](https://a3s-lab.github.io/Office/docs/0.21.0/)
|
package/dist/0~4595.js
CHANGED
|
@@ -343,7 +343,7 @@ function Dialog({ title, description, children, footer, onClose, closeDisabled =
|
|
|
343
343
|
});
|
|
344
344
|
return "u" > typeof document && portalRootRef.current ? /*#__PURE__*/ createPortal(dialog, portalRootRef.current) : dialog;
|
|
345
345
|
}
|
|
346
|
-
function OfficeSelect({ ariaLabel, value, options, onValueChange, disabled = false, placeholder = '请选择', className = '' }) {
|
|
346
|
+
function OfficeSelect({ ariaLabel, value, options, onValueChange, disabled = false, placeholder = '请选择', className = '', ariaKeyShortcuts, initialFocus = false }) {
|
|
347
347
|
const reactId = useId().replaceAll(':', '');
|
|
348
348
|
const [open, setOpen] = useState(false);
|
|
349
349
|
const selectedIndex = useMemo(()=>options.findIndex((option)=>option.value === value), [
|
|
@@ -384,6 +384,8 @@ function OfficeSelect({ ariaLabel, value, options, onValueChange, disabled = fal
|
|
|
384
384
|
...triggerProps,
|
|
385
385
|
role: "combobox",
|
|
386
386
|
"aria-expanded": popoverOpen,
|
|
387
|
+
"aria-keyshortcuts": ariaKeyShortcuts,
|
|
388
|
+
"data-autofocus": initialFocus ? 'true' : void 0,
|
|
387
389
|
onClick: (event)=>{
|
|
388
390
|
if (!popoverOpen) {
|
|
389
391
|
const next = nearestEnabledOption(options, selectedIndex >= 0 ? selectedIndex : 0, 1);
|
|
@@ -4,7 +4,7 @@ import { Workbook } from "@fortune-sheet/react";
|
|
|
4
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, CalendarClock, CalendarDays, Check, ChevronDown, ChevronLeft, ChevronRight, ClipboardPaste, Clock, 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, spreadsheetTextOrientationFromChoice, spreadsheetMatrixProfile, withoutEditableRange, spreadsheetTextOrientationFromAngle, isSpreadsheetTextOrientationId, normalizeSpreadsheetConditionalVisualOptions, spreadsheetCellValueWithDiagonalBorder, spreadsheetUnderlineCellValue, effectiveSpreadsheetPageSetup, attachSpreadsheetShownCommentCells, withEditableRange, sameSpreadsheetHistoryValue, createOfficeSpreadsheetCollaborationBinding as createWorkOfficeSpreadsheetCollaborationBinding, isSpreadsheetConditionalComparisonOperator, spreadsheetConditionalIconForValue, defaultSpreadsheetConditionalIconThresholds, spreadsheetUnderlineStyle, normalizeSpreadsheetDateValidationBoundary, sheetProtectionAuthority, editableRangeCellCount, unlockedCellCount, registerDerivedSpreadsheetMatrix, editableRangeRequiresCredentials, spreadsheetTextOrientationCellStyle, normalizeSpreadsheetConditionalIconSetFormat, defaultSpreadsheetDataBarOptions, spreadsheetConditionalThresholdValue, spreadsheetTextOrientationChoiceFromCell, normalizeSheetProtectionAuthority, withSheetProtection, defaultSpreadsheetColorScaleThresholds, spreadsheetProtectionKey, spreadsheetDiagonalBorderFromCellValue, SPREADSHEET_CONDITIONAL_ICON_SETS, protectedSheetCount, withSheetSelectionPermissions, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, spreadsheetConditionalComparisonNeedsUpperValue, drawSpreadsheetConditionalIcon, spreadsheetTextOrientationFromCell, replaceOfficeSpreadsheetCollaboration as replaceWorkOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration as readWorkOfficeSpreadsheetCollaboration, spreadsheetConditionalThresholdsEqual, isSpreadsheetUnderlineStyle, spreadsheetVisibleTextRotationFromCell } from "./
|
|
7
|
+
import { freezeImportedSpreadsheetCell, spreadsheetTextOrientationFromChoice, spreadsheetMatrixProfile, withoutEditableRange, spreadsheetTextOrientationFromAngle, isSpreadsheetTextOrientationId, normalizeSpreadsheetConditionalVisualOptions, spreadsheetCellValueWithDiagonalBorder, spreadsheetUnderlineCellValue, effectiveSpreadsheetPageSetup, attachSpreadsheetShownCommentCells, withEditableRange, sameSpreadsheetHistoryValue, createOfficeSpreadsheetCollaborationBinding as createWorkOfficeSpreadsheetCollaborationBinding, isSpreadsheetConditionalComparisonOperator, spreadsheetConditionalIconForValue, defaultSpreadsheetConditionalIconThresholds, spreadsheetUnderlineStyle, normalizeSpreadsheetDateValidationBoundary, sheetProtectionAuthority, editableRangeCellCount, unlockedCellCount, registerDerivedSpreadsheetMatrix, editableRangeRequiresCredentials, spreadsheetTextOrientationCellStyle, normalizeSpreadsheetConditionalIconSetFormat, defaultSpreadsheetDataBarOptions, spreadsheetConditionalThresholdValue, spreadsheetTextOrientationChoiceFromCell, normalizeSheetProtectionAuthority, withSheetProtection, defaultSpreadsheetColorScaleThresholds, spreadsheetProtectionKey, spreadsheetDiagonalBorderFromCellValue, SPREADSHEET_CONDITIONAL_ICON_SETS, protectedSheetCount, withSheetSelectionPermissions, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, spreadsheetConditionalComparisonNeedsUpperValue, drawSpreadsheetConditionalIcon, spreadsheetTextOrientationFromCell, patchSpreadsheetRichTextFontRuns, replaceOfficeSpreadsheetCollaboration as replaceWorkOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration as readWorkOfficeSpreadsheetCollaboration, spreadsheetConditionalThresholdsEqual, isSpreadsheetUnderlineStyle, spreadsheetVisibleTextRotationFromCell } from "./164.js";
|
|
8
8
|
import { workSpreadsheetChartSupportsGrouping, spreadsheetFormulaRangesForSelection, 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";
|
|
@@ -3284,6 +3284,38 @@ const spreadsheetCommandCatalog = {
|
|
|
3284
3284
|
]
|
|
3285
3285
|
}
|
|
3286
3286
|
},
|
|
3287
|
+
formatCellsFont: {
|
|
3288
|
+
id: 'font.formatCellsFont',
|
|
3289
|
+
label: '设置字体格式',
|
|
3290
|
+
location: {
|
|
3291
|
+
area: 'ribbon',
|
|
3292
|
+
tab: 'home',
|
|
3293
|
+
group: 'font'
|
|
3294
|
+
},
|
|
3295
|
+
shortcut: {
|
|
3296
|
+
label: 'Cmd/Ctrl+Shift+F',
|
|
3297
|
+
aria: 'Control+Shift+F Meta+Shift+F',
|
|
3298
|
+
editor: [
|
|
3299
|
+
'Mod-Shift-f'
|
|
3300
|
+
]
|
|
3301
|
+
}
|
|
3302
|
+
},
|
|
3303
|
+
formatCellsFontSize: {
|
|
3304
|
+
id: 'font.formatCellsFontSize',
|
|
3305
|
+
label: '设置字号格式',
|
|
3306
|
+
location: {
|
|
3307
|
+
area: 'ribbon',
|
|
3308
|
+
tab: 'home',
|
|
3309
|
+
group: 'font'
|
|
3310
|
+
},
|
|
3311
|
+
shortcut: {
|
|
3312
|
+
label: 'Cmd/Ctrl+Shift+P',
|
|
3313
|
+
aria: 'Control+Shift+P Meta+Shift+P',
|
|
3314
|
+
editor: [
|
|
3315
|
+
'Mod-Shift-p'
|
|
3316
|
+
]
|
|
3317
|
+
}
|
|
3318
|
+
},
|
|
3287
3319
|
borderTop: {
|
|
3288
3320
|
id: 'font.borderTop',
|
|
3289
3321
|
label: '上框线',
|
|
@@ -4632,7 +4664,10 @@ function formatCell(source, patch) {
|
|
|
4632
4664
|
const format = spreadsheetNumberFormatValue(patch.numberFormat.trim(), source);
|
|
4633
4665
|
next.ct = {
|
|
4634
4666
|
...source?.ct,
|
|
4635
|
-
...format
|
|
4667
|
+
...format,
|
|
4668
|
+
...source?.ct?.t === 'inlineStr' ? {
|
|
4669
|
+
t: 'inlineStr'
|
|
4670
|
+
} : {}
|
|
4636
4671
|
};
|
|
4637
4672
|
delete next.m;
|
|
4638
4673
|
}
|
|
@@ -4669,7 +4704,8 @@ function formatCell(source, patch) {
|
|
|
4669
4704
|
delete next.lo;
|
|
4670
4705
|
delete next.hi;
|
|
4671
4706
|
}
|
|
4672
|
-
|
|
4707
|
+
const withRichText = patchSpreadsheetRichTextFontRuns(next, patch);
|
|
4708
|
+
return Object.keys(withRichText).length ? withRichText : null;
|
|
4673
4709
|
}
|
|
4674
4710
|
function formatProtectionRanges(sheet, range, patch) {
|
|
4675
4711
|
if (void 0 === patch.locked && void 0 === patch.hidden) return null;
|
|
@@ -4752,6 +4788,56 @@ function normalizeColor(value) {
|
|
|
4752
4788
|
function spreadsheet_cell_format_cellKey(row, column) {
|
|
4753
4789
|
return `${row}:${column}`;
|
|
4754
4790
|
}
|
|
4791
|
+
const spreadsheetFormatCellsTabs = [
|
|
4792
|
+
{
|
|
4793
|
+
id: 'number',
|
|
4794
|
+
label: '数字'
|
|
4795
|
+
},
|
|
4796
|
+
{
|
|
4797
|
+
id: 'alignment',
|
|
4798
|
+
label: '对齐'
|
|
4799
|
+
},
|
|
4800
|
+
{
|
|
4801
|
+
id: 'font',
|
|
4802
|
+
label: '字体'
|
|
4803
|
+
},
|
|
4804
|
+
{
|
|
4805
|
+
id: 'border',
|
|
4806
|
+
label: '边框'
|
|
4807
|
+
},
|
|
4808
|
+
{
|
|
4809
|
+
id: 'fill',
|
|
4810
|
+
label: '填充'
|
|
4811
|
+
},
|
|
4812
|
+
{
|
|
4813
|
+
id: 'protection',
|
|
4814
|
+
label: '保护'
|
|
4815
|
+
}
|
|
4816
|
+
];
|
|
4817
|
+
const defaultSpreadsheetFormatCellsOpenIntent = {
|
|
4818
|
+
tab: 'number'
|
|
4819
|
+
};
|
|
4820
|
+
const spreadsheetFormatCellsTabIds = new Set(spreadsheetFormatCellsTabs.map(({ id })=>id));
|
|
4821
|
+
function normalizeSpreadsheetFormatCellsOpenIntent(value) {
|
|
4822
|
+
if (void 0 === value) return defaultSpreadsheetFormatCellsOpenIntent;
|
|
4823
|
+
if (!spreadsheet_format_cells_intent_isRecord(value)) return null;
|
|
4824
|
+
const keys = Object.keys(value);
|
|
4825
|
+
if (keys.some((key)=>'tab' !== key && 'focus' !== key)) return null;
|
|
4826
|
+
if ('string' != typeof value.tab || !spreadsheetFormatCellsTabIds.has(value.tab)) return null;
|
|
4827
|
+
if ('font' !== value.tab) return void 0 === value.focus ? {
|
|
4828
|
+
tab: value.tab
|
|
4829
|
+
} : null;
|
|
4830
|
+
if (void 0 === value.focus) return {
|
|
4831
|
+
tab: 'font'
|
|
4832
|
+
};
|
|
4833
|
+
return 'fontFamily' === value.focus || 'fontSize' === value.focus ? {
|
|
4834
|
+
tab: 'font',
|
|
4835
|
+
focus: value.focus
|
|
4836
|
+
} : null;
|
|
4837
|
+
}
|
|
4838
|
+
function spreadsheet_format_cells_intent_isRecord(value) {
|
|
4839
|
+
return Boolean(value && 'object' == typeof value && !Array.isArray(value));
|
|
4840
|
+
}
|
|
4755
4841
|
function createSpreadsheetCellFormatExtension() {
|
|
4756
4842
|
return createOfficeEditorExtension({
|
|
4757
4843
|
name: 'spreadsheetCellFormat',
|
|
@@ -4766,17 +4852,27 @@ function createSpreadsheetCellFormatExtension() {
|
|
|
4766
4852
|
}
|
|
4767
4853
|
}),
|
|
4768
4854
|
addKeyboardShortcuts: ()=>({
|
|
4769
|
-
|
|
4855
|
+
[spreadsheetCommandCatalog.formatCells.shortcut.editor["0"]]: ({ can, commands }, event)=>runSpreadsheetFormatCellsShortcut(event, void 0, can.openFormatCells, commands.openFormatCells),
|
|
4856
|
+
[spreadsheetCommandCatalog.formatCellsFont.shortcut.editor["0"]]: ({ can, commands }, event)=>runSpreadsheetFormatCellsShortcut(event, {
|
|
4857
|
+
tab: 'font',
|
|
4858
|
+
focus: 'fontFamily'
|
|
4859
|
+
}, can.openFormatCells, commands.openFormatCells),
|
|
4860
|
+
[spreadsheetCommandCatalog.formatCellsFontSize.shortcut.editor["0"]]: ({ can, commands }, event)=>runSpreadsheetFormatCellsShortcut(event, {
|
|
4861
|
+
tab: 'font',
|
|
4862
|
+
focus: 'fontSize'
|
|
4863
|
+
}, can.openFormatCells, commands.openFormatCells)
|
|
4770
4864
|
})
|
|
4771
4865
|
});
|
|
4772
4866
|
}
|
|
4773
|
-
function canOpenSpreadsheetFormatCells(context) {
|
|
4867
|
+
function canOpenSpreadsheetFormatCells(context, intent) {
|
|
4868
|
+
if (!normalizeSpreadsheetFormatCellsOpenIntent(intent)) return false;
|
|
4774
4869
|
if (!context.editable || !context.formatCells.canOpen || !context.workbook || !context.targetSheetId || context.targetSheetId !== context.activeSheetId) return false;
|
|
4775
4870
|
const range = liveSpreadsheetFormatCellsRange(context);
|
|
4776
4871
|
return Boolean(range && spreadsheet_cell_range_spreadsheetCellRangeArea(range) <= 10000);
|
|
4777
4872
|
}
|
|
4778
|
-
function spreadsheet_cell_format_command_openSpreadsheetFormatCells(context) {
|
|
4779
|
-
|
|
4873
|
+
function spreadsheet_cell_format_command_openSpreadsheetFormatCells(context, intent) {
|
|
4874
|
+
const normalizedIntent = normalizeSpreadsheetFormatCellsOpenIntent(intent);
|
|
4875
|
+
if (!normalizedIntent || !canOpenSpreadsheetFormatCells(context, normalizedIntent) || !context.workbook) return false;
|
|
4780
4876
|
const selection = context.workbook.getSelection()?.at(-1) ?? context.fallbackRange;
|
|
4781
4877
|
const range = spreadsheet_cell_range_normalizeSpreadsheetCellRange(spreadsheetSingleRange(selection));
|
|
4782
4878
|
if (!range) return false;
|
|
@@ -4787,7 +4883,8 @@ function spreadsheet_cell_format_command_openSpreadsheetFormatCells(context) {
|
|
|
4787
4883
|
row: clampFocus(selection.row_focus, range.row),
|
|
4788
4884
|
column: clampFocus(selection.column_focus, range.column)
|
|
4789
4885
|
},
|
|
4790
|
-
cells: []
|
|
4886
|
+
cells: [],
|
|
4887
|
+
intent: normalizedIntent
|
|
4791
4888
|
};
|
|
4792
4889
|
try {
|
|
4793
4890
|
request.cells = context.workbook.getCellsByRange(range, {
|
|
@@ -4808,9 +4905,9 @@ function applySpreadsheetFormatCells(context, request) {
|
|
|
4808
4905
|
function liveSpreadsheetFormatCellsRange(context) {
|
|
4809
4906
|
return spreadsheet_cell_range_normalizeSpreadsheetCellRange(spreadsheetSingleRange(context.workbook?.getSelection()?.at(-1) ?? context.fallbackRange));
|
|
4810
4907
|
}
|
|
4811
|
-
function runSpreadsheetFormatCellsShortcut(event, canExecute, execute) {
|
|
4812
|
-
if (event.repeat || isOfficeShortcutBlocked(event.target) || isSpreadsheetNativeTextUndoTarget(event.target) || !canExecute()) return false;
|
|
4813
|
-
return execute();
|
|
4908
|
+
function runSpreadsheetFormatCellsShortcut(event, intent, canExecute, execute) {
|
|
4909
|
+
if (event.repeat || event.isComposing || isOfficeShortcutBlocked(event.target) || isSpreadsheetNativeTextUndoTarget(event.target) || !canExecute(intent)) return false;
|
|
4910
|
+
return execute(intent);
|
|
4814
4911
|
}
|
|
4815
4912
|
function clampFocus(value, range) {
|
|
4816
4913
|
const minimum = range[0] ?? 0;
|
|
@@ -13603,7 +13700,7 @@ function AlignmentPanel({ source, draft, errors, touched, setDraft, touch }) {
|
|
|
13603
13700
|
]
|
|
13604
13701
|
});
|
|
13605
13702
|
}
|
|
13606
|
-
function FontPanel({ source, draft, errors, touched, setDraft, touch }) {
|
|
13703
|
+
function FontPanel({ source, draft, errors, touched, initialFocus, setDraft, touch }) {
|
|
13607
13704
|
const familyMixed = source.fields.fontFamily.mixed && !touched.fontFamily;
|
|
13608
13705
|
const sizeMixed = source.fields.fontSize.mixed && !touched.fontSize;
|
|
13609
13706
|
const underlineMixed = source.fields.underline.mixed && !touched.underline;
|
|
@@ -13621,6 +13718,8 @@ function FontPanel({ source, draft, errors, touched, setDraft, touch }) {
|
|
|
13621
13718
|
label: "字体",
|
|
13622
13719
|
children: /*#__PURE__*/ jsx(OfficeSelect, {
|
|
13623
13720
|
ariaLabel: "单元格字体",
|
|
13721
|
+
ariaKeyShortcuts: spreadsheetCommandCatalog.formatCellsFont.shortcut.aria,
|
|
13722
|
+
initialFocus: 'fontFamily' === initialFocus,
|
|
13624
13723
|
value: familyMixed ? MIXED_VALUE : draft.fontFamily,
|
|
13625
13724
|
options: withMixedOption(spreadsheetFontFamilyOptions(draft.fontFamily), familyMixed),
|
|
13626
13725
|
onValueChange: (value)=>{
|
|
@@ -13637,6 +13736,8 @@ function FontPanel({ source, draft, errors, touched, setDraft, touch }) {
|
|
|
13637
13736
|
label: "字号",
|
|
13638
13737
|
children: /*#__PURE__*/ jsx(OfficeSelect, {
|
|
13639
13738
|
ariaLabel: "单元格字号",
|
|
13739
|
+
ariaKeyShortcuts: spreadsheetCommandCatalog.formatCellsFontSize.shortcut.aria,
|
|
13740
|
+
initialFocus: 'fontSize' === initialFocus,
|
|
13640
13741
|
value: sizeMixed ? MIXED_VALUE : String(draft.fontSize),
|
|
13641
13742
|
options: withMixedOption(spreadsheetFontSizeOptions(draft.fontSize), sizeMixed),
|
|
13642
13743
|
onValueChange: (value)=>{
|
|
@@ -13714,6 +13815,7 @@ function FontPanel({ source, draft, errors, touched, setDraft, touch }) {
|
|
|
13714
13815
|
/*#__PURE__*/ jsx("div", {
|
|
13715
13816
|
className: "work-spreadsheet-format-cells-font-preview",
|
|
13716
13817
|
style: {
|
|
13818
|
+
backgroundColor: spreadsheetFontPreviewBackground(draft.fontColor),
|
|
13717
13819
|
color: draft.fontColor,
|
|
13718
13820
|
fontFamily: draft.fontFamily,
|
|
13719
13821
|
fontSize: `${Math.max(10, draft.fontSize)}px`,
|
|
@@ -13731,6 +13833,21 @@ function FontPanel({ source, draft, errors, touched, setDraft, touch }) {
|
|
|
13731
13833
|
]
|
|
13732
13834
|
});
|
|
13733
13835
|
}
|
|
13836
|
+
function spreadsheetFontPreviewBackground(color) {
|
|
13837
|
+
const match = /^#([0-9a-f]{6})$/i.exec(color.trim());
|
|
13838
|
+
if (!match?.[1]) return '#f4f6f8';
|
|
13839
|
+
const channels = [
|
|
13840
|
+
0,
|
|
13841
|
+
2,
|
|
13842
|
+
4
|
|
13843
|
+
].map((offset)=>Number.parseInt(match[1].slice(offset, offset + 2), 16));
|
|
13844
|
+
const [red = 0, green = 0, blue = 0] = channels.map((channel)=>{
|
|
13845
|
+
const component = channel / 255;
|
|
13846
|
+
return component <= 0.04045 ? component / 12.92 : ((component + 0.055) / 1.055) ** 2.4;
|
|
13847
|
+
});
|
|
13848
|
+
const luminance = 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
13849
|
+
return luminance >= 0.55 ? '#172033' : '#f4f6f8';
|
|
13850
|
+
}
|
|
13734
13851
|
function BorderPanel({ source, draft, touched, setDraft, touch }) {
|
|
13735
13852
|
const hasTarget = (target)=>draft.borders.some((format)=>format.target === target);
|
|
13736
13853
|
const updateBorders = (borders)=>{
|
|
@@ -13983,32 +14100,6 @@ function borderCss(format) {
|
|
|
13983
14100
|
const style = 'dotted' === format.style ? 'dotted' : format.style.includes('dash') ? 'dashed' : 'solid';
|
|
13984
14101
|
return `${width}px ${style} ${format.color}`;
|
|
13985
14102
|
}
|
|
13986
|
-
const spreadsheetFormatCellsTabs = [
|
|
13987
|
-
{
|
|
13988
|
-
id: 'number',
|
|
13989
|
-
label: '数字'
|
|
13990
|
-
},
|
|
13991
|
-
{
|
|
13992
|
-
id: 'alignment',
|
|
13993
|
-
label: '对齐'
|
|
13994
|
-
},
|
|
13995
|
-
{
|
|
13996
|
-
id: 'font',
|
|
13997
|
-
label: '字体'
|
|
13998
|
-
},
|
|
13999
|
-
{
|
|
14000
|
-
id: 'border',
|
|
14001
|
-
label: '边框'
|
|
14002
|
-
},
|
|
14003
|
-
{
|
|
14004
|
-
id: 'fill',
|
|
14005
|
-
label: '填充'
|
|
14006
|
-
},
|
|
14007
|
-
{
|
|
14008
|
-
id: 'protection',
|
|
14009
|
-
label: '保护'
|
|
14010
|
-
}
|
|
14011
|
-
];
|
|
14012
14103
|
function createSpreadsheetFormatCellsDialogSource(content, sheetId, rangeInput, cells, requestedActiveCell) {
|
|
14013
14104
|
const range = spreadsheet_cell_range_normalizeSpreadsheetCellRange(rangeInput);
|
|
14014
14105
|
const sheet = content.sheets.find((candidate)=>candidate.id === sheetId);
|
|
@@ -14180,10 +14271,10 @@ function sameDialogValue(left, right) {
|
|
|
14180
14271
|
function clampIndex(value, minimum, maximum) {
|
|
14181
14272
|
return Math.min(maximum, Math.max(minimum, Math.trunc(value)));
|
|
14182
14273
|
}
|
|
14183
|
-
function SpreadsheetFormatCellsDialog({ source, restoreFocusTarget, onApply, onClose }) {
|
|
14274
|
+
function SpreadsheetFormatCellsDialog({ source, restoreFocusTarget, openIntent = defaultSpreadsheetFormatCellsOpenIntent, onApply, onClose }) {
|
|
14184
14275
|
const [draft, setDraft] = useState(()=>createSpreadsheetFormatCellsDraft(source));
|
|
14185
14276
|
const [touched, setTouched] = useState({});
|
|
14186
|
-
const [activeTab, setActiveTab] = useState(
|
|
14277
|
+
const [activeTab, setActiveTab] = useState(openIntent.tab);
|
|
14187
14278
|
const formId = useId();
|
|
14188
14279
|
const idBase = `spreadsheet-format-cells-${useId().replaceAll(':', '')}`;
|
|
14189
14280
|
const errors = spreadsheetFormatCellsDraftErrors(draft);
|
|
@@ -14244,6 +14335,7 @@ function SpreadsheetFormatCellsDialog({ source, restoreFocusTarget, onApply, onC
|
|
|
14244
14335
|
draft: draft,
|
|
14245
14336
|
errors: errors,
|
|
14246
14337
|
touched: touched,
|
|
14338
|
+
initialFocus: 'font' === openIntent.tab ? openIntent.focus : void 0,
|
|
14247
14339
|
setDraft: setDraft,
|
|
14248
14340
|
touch: (field)=>setTouched((current)=>({
|
|
14249
14341
|
...current,
|
|
@@ -23226,7 +23318,7 @@ function SpreadsheetEditorSurface({ autoFocus = true, content, collaborationHist
|
|
|
23226
23318
|
const [selectionState, setSelectionState] = useState(null);
|
|
23227
23319
|
const formatPainterSelectionHandlerRef = useRef((_sheetId, _selection)=>void 0);
|
|
23228
23320
|
const [contextMenu, setContextMenu] = useState(null);
|
|
23229
|
-
const [
|
|
23321
|
+
const [formatCellsDialog, setFormatCellsDialog] = useState(null);
|
|
23230
23322
|
const formatCellsInvokerRef = useRef(null);
|
|
23231
23323
|
const formatCellsSelectionRef = useRef(null);
|
|
23232
23324
|
const formatCellsApplyingRef = useRef(false);
|
|
@@ -23376,7 +23468,7 @@ function SpreadsheetEditorSurface({ autoFocus = true, content, collaborationHist
|
|
|
23376
23468
|
panelTriggerRef.current = null;
|
|
23377
23469
|
setPanel(null);
|
|
23378
23470
|
setContextMenu(null);
|
|
23379
|
-
|
|
23471
|
+
setFormatCellsDialog(null);
|
|
23380
23472
|
formatCellsInvokerRef.current = null;
|
|
23381
23473
|
formatCellsSelectionRef.current = null;
|
|
23382
23474
|
formatCellsApplyingRef.current = false;
|
|
@@ -23656,14 +23748,17 @@ function SpreadsheetEditorSurface({ autoFocus = true, content, collaborationHist
|
|
|
23656
23748
|
column_focus: request.activeCell.column
|
|
23657
23749
|
}
|
|
23658
23750
|
};
|
|
23659
|
-
|
|
23751
|
+
setFormatCellsDialog({
|
|
23752
|
+
source,
|
|
23753
|
+
intent: request.intent
|
|
23754
|
+
});
|
|
23660
23755
|
return true;
|
|
23661
23756
|
}, []);
|
|
23662
23757
|
const closeSpreadsheetFormatCells = useCallback(()=>{
|
|
23663
23758
|
const invoker = formatCellsInvokerRef.current;
|
|
23664
23759
|
const canvas = spreadsheetCanvasRef.current;
|
|
23665
23760
|
const openedFromGrid = Boolean(invoker && canvas?.contains(invoker));
|
|
23666
|
-
|
|
23761
|
+
setFormatCellsDialog(null);
|
|
23667
23762
|
requestAnimationFrame(()=>{
|
|
23668
23763
|
if (openedFromGrid || !invoker?.isConnected) focusSpreadsheetGrid(canvas, {
|
|
23669
23764
|
focusOrigin: invoker
|
|
@@ -23804,7 +23899,7 @@ function SpreadsheetEditorSurface({ autoFocus = true, content, collaborationHist
|
|
|
23804
23899
|
},
|
|
23805
23900
|
formatPainter,
|
|
23806
23901
|
formatCells: {
|
|
23807
|
-
canOpen: !preview && null ===
|
|
23902
|
+
canOpen: !preview && null === formatCellsDialog,
|
|
23808
23903
|
open: openSpreadsheetFormatCells
|
|
23809
23904
|
},
|
|
23810
23905
|
hyperlink: spreadsheetHyperlink.commandPort,
|
|
@@ -24247,16 +24342,17 @@ function SpreadsheetEditorSurface({ autoFocus = true, content, collaborationHist
|
|
|
24247
24342
|
onClose: ()=>setContextMenu(null),
|
|
24248
24343
|
onRestoreFocus: ()=>focusSpreadsheetGrid(spreadsheetCanvasRef.current)
|
|
24249
24344
|
}),
|
|
24250
|
-
|
|
24251
|
-
source:
|
|
24345
|
+
formatCellsDialog && /*#__PURE__*/ jsx(SpreadsheetFormatCellsDialog, {
|
|
24346
|
+
source: formatCellsDialog.source,
|
|
24347
|
+
openIntent: formatCellsDialog.intent,
|
|
24252
24348
|
restoreFocusTarget: ()=>formatCellsInvokerRef.current?.isConnected ? formatCellsInvokerRef.current : spreadsheetGridFocusTarget(spreadsheetCanvasRef.current),
|
|
24253
24349
|
onApply: (patch)=>{
|
|
24254
24350
|
formatCellsApplyingRef.current = true;
|
|
24255
24351
|
let handled = false;
|
|
24256
24352
|
try {
|
|
24257
24353
|
handled = spreadsheetCommands.applyCellFormat({
|
|
24258
|
-
sheetId:
|
|
24259
|
-
range:
|
|
24354
|
+
sheetId: formatCellsDialog.source.sheetId,
|
|
24355
|
+
range: formatCellsDialog.source.range,
|
|
24260
24356
|
patch
|
|
24261
24357
|
});
|
|
24262
24358
|
} finally{
|
|
@@ -4,8 +4,8 @@ import { normalizeDocumentBookmarkName, docxBookmarkReferenceTarget, normalizeDo
|
|
|
4
4
|
import { markDocxParagraphShading, inspectDocxPageSize, docxCaptionBookmark, hasInvalidDocxFieldStructure, inspectDocxPageMargins, inspectDocxPaperSource, createDocxParagraphStyleResolver, createDocxTableStyleResolver, docxFieldOccurrences, inspectDocxEquation, inspectDocxPageMarginSettings, markDocxParagraphBorders, isSupportedDocxParagraphFormattingChange, docxFieldOccurrenceIsInlineEditable, docxCaptionSequenceKind, inspectDocxPageBorders, isSupportedDocxRunFormattingChange, docxFieldInstructions, isSupportedDocxEquationPlacement } from "./0~5093.js";
|
|
5
5
|
import { normalizeDocumentHref } from "./0~work-document-links.js";
|
|
6
6
|
import { xmlAttributeLocalName, parseDocxParagraphDefaultCollapsed, readDocxBibliography, DOCX_WORDPROCESSING_NAMESPACES, xmlAttributeNamespace, createDocxThemeResolver } from "./0~2805.js";
|
|
7
|
-
import { updateSpreadsheetWorksheetCompatibilitySummary, inspectXlsxPivotTables, isSupportedXlsxChartLegend, isSupportedXlsxChartPlotLayout, xlsxChartNodeUsesStackedGrouping, isSupportedXlsxChartSeriesFormatting, readXlsxFormulaFeaturesFromPackage, inspectXlsxHeaderFooterText, emptySpreadsheetWorksheetCompatibilitySummary,
|
|
8
|
-
import { spreadsheetConditionalComparisonNeedsUpperValue, isSpreadsheetConditionalIconSetName, isSpreadsheetConditionalComparisonOperator, spreadsheetConditionalIconSetCount } from "./
|
|
7
|
+
import { updateSpreadsheetWorksheetCompatibilitySummary, inspectXlsxPivotTables, isSupportedXlsxChartLegend, isSupportedXlsxChartPlotLayout, xlsxChartNodeUsesStackedGrouping, isSupportedXlsxChartSeriesFormatting, readXlsxFormulaFeaturesFromPackage, inspectXlsxHeaderFooterText, emptySpreadsheetWorksheetCompatibilitySummary, isSupportedXlsxWorksheetImageContentType, MAX_XLSX_WORKSHEET_IMAGE_BYTES, xlsxChartSeriesFormattingShapeProperties, diagnoseXlsxProtection, isEditableXlsxPaperSizeCode, isSupportedXlsxCombinationChartNodes } from "./4104.js";
|
|
8
|
+
import { spreadsheetConditionalComparisonNeedsUpperValue, isSpreadsheetConditionalIconSetName, isSpreadsheetConditionalComparisonOperator, spreadsheetConditionalIconSetCount, xlsxWorksheetCellEntries } from "./164.js";
|
|
9
9
|
import { formulaHasStructuredReference, formulaHasExternalReference, parseSpreadsheetPrintTitles, volatileSpreadsheetFormulaFunctions, stripSpreadsheetSheetQualifier } from "./8715.js";
|
|
10
10
|
import { unsupportedSpreadsheetFormulaFunctions } from "./0~work-spreadsheet-formula-support.js";
|
|
11
11
|
var work_office_diagnostics_namespaceObject = {};
|