@a3s-lab/office 0.18.0 → 0.20.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.
Files changed (32) hide show
  1. package/README.md +19 -6
  2. package/dist/0~3635.js +23 -2
  3. package/dist/0~spreadsheet-editor.js +4457 -4022
  4. package/dist/0~work-office-diagnostics.js +1 -1
  5. package/dist/4104.js +693 -279
  6. package/dist/{1992.js → 6164.js} +107 -1
  7. package/dist/core.js +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/internal/features/work/editors/office-color-picker.d.ts +6 -1
  10. package/dist/internal/features/work/editors/spreadsheet-alignment-ribbon.d.ts +7 -0
  11. package/dist/internal/features/work/editors/spreadsheet-cell-format.d.ts +2 -0
  12. package/dist/internal/features/work/editors/spreadsheet-clipboard-ribbon.d.ts +7 -0
  13. package/dist/internal/features/work/editors/spreadsheet-command-catalog.d.ts +119 -9
  14. package/dist/internal/features/work/editors/spreadsheet-command-controller.d.ts +4 -2
  15. package/dist/internal/features/work/editors/spreadsheet-command-selection.d.ts +3 -0
  16. package/dist/internal/features/work/editors/spreadsheet-editing-ribbon.d.ts +6 -0
  17. package/dist/internal/features/work/editors/spreadsheet-keyboard-shortcut-runners.d.ts +16 -0
  18. package/dist/internal/features/work/editors/spreadsheet-keyboard-shortcuts.d.ts +3 -0
  19. package/dist/internal/features/work/editors/spreadsheet-rows-columns-ribbon.d.ts +5 -0
  20. package/dist/internal/features/work/editors/spreadsheet-selection-navigation-command.d.ts +3 -0
  21. package/dist/internal/features/work/editors/spreadsheet-structure-command.d.ts +5 -0
  22. package/dist/internal/features/work/editors/spreadsheet-text-orientation-command.d.ts +18 -0
  23. package/dist/internal/features/work/editors/spreadsheet-view-ribbon.d.ts +8 -0
  24. package/dist/internal/features/work/editors/spreadsheet-visibility-shortcuts.d.ts +3 -0
  25. package/dist/internal/features/work/work-spreadsheet-text-orientation.d.ts +21 -0
  26. package/dist/internal/features/work/work-xlsx-cell-style-origin.d.ts +44 -0
  27. package/dist/internal/features/work/work-xlsx-cell-style-values.d.ts +26 -0
  28. package/dist/internal/features/work/work-xlsx-cell-style-writer.d.ts +4 -1
  29. package/dist/internal/features/work/work-xlsx-cell-styles.d.ts +2 -0
  30. package/dist/office-kernel.wasm +0 -0
  31. package/dist/styles.css +103 -0
  32. package/package.json +6 -1
@@ -2092,6 +2092,112 @@ function isoDateFromTimestamp(timestamp) {
2092
2092
  if (!Number.isFinite(timestamp) || year < 1900 || year > 9999) return null;
2093
2093
  return `${String(year).padStart(4, '0')}-${String(date.getUTCMonth() + 1).padStart(2, '0')}-${String(date.getUTCDate()).padStart(2, '0')}`;
2094
2094
  }
2095
+ const spreadsheetTextOrientationIds = [
2096
+ 'horizontal',
2097
+ 'angleCounterclockwise',
2098
+ 'angleClockwise',
2099
+ 'vertical',
2100
+ 'rotateUp',
2101
+ 'rotateDown'
2102
+ ];
2103
+ const presetAngles = {
2104
+ horizontal: 0,
2105
+ angleCounterclockwise: 45,
2106
+ angleClockwise: -45,
2107
+ rotateUp: 90,
2108
+ rotateDown: -90
2109
+ };
2110
+ const legacyFortunePresetAngles = {
2111
+ 0: 0,
2112
+ 1: 45,
2113
+ 2: -45,
2114
+ 4: 90,
2115
+ 5: -90
2116
+ };
2117
+ function isSpreadsheetTextOrientationId(value) {
2118
+ return spreadsheetTextOrientationIds.includes(value);
2119
+ }
2120
+ function spreadsheetTextOrientationFromChoice(choice) {
2121
+ return 'vertical' === choice ? {
2122
+ kind: 'stacked'
2123
+ } : {
2124
+ kind: 'rotation',
2125
+ angle: presetAngles[choice]
2126
+ };
2127
+ }
2128
+ function spreadsheetTextOrientationFromAngle(value) {
2129
+ const angle = integer(value);
2130
+ return null !== angle && angle >= -90 && angle <= 90 ? {
2131
+ kind: 'rotation',
2132
+ angle
2133
+ } : null;
2134
+ }
2135
+ function spreadsheetTextOrientationFromXlsx(value) {
2136
+ const rotation = integer(value);
2137
+ if (255 === rotation) return {
2138
+ kind: 'stacked'
2139
+ };
2140
+ if (null === rotation || rotation < 0 || rotation > 180) return null;
2141
+ return {
2142
+ kind: 'rotation',
2143
+ angle: rotation <= 90 ? rotation : 90 - rotation
2144
+ };
2145
+ }
2146
+ function spreadsheetExplicitTextOrientationFromCell(cell) {
2147
+ if (cell?.rt !== void 0 && null !== cell.rt) {
2148
+ const direct = spreadsheetTextOrientationFromXlsx(cell.rt);
2149
+ if (direct) return direct;
2150
+ }
2151
+ const legacy = String(cell?.tr ?? '').trim();
2152
+ if (!legacy) return null;
2153
+ if ('3' === legacy || '255' === legacy) return {
2154
+ kind: 'stacked'
2155
+ };
2156
+ const presetAngle = legacyFortunePresetAngles[legacy];
2157
+ if (void 0 !== presetAngle) return {
2158
+ kind: 'rotation',
2159
+ angle: presetAngle
2160
+ };
2161
+ const raw = integer(legacy);
2162
+ return null !== raw && raw >= 6 ? spreadsheetTextOrientationFromXlsx(raw) : null;
2163
+ }
2164
+ function spreadsheetTextOrientationFromCell(cell) {
2165
+ return spreadsheetExplicitTextOrientationFromCell(cell) ?? {
2166
+ kind: 'rotation',
2167
+ angle: 0
2168
+ };
2169
+ }
2170
+ function spreadsheetTextOrientationCellStyle(orientation) {
2171
+ if (!orientation) return null;
2172
+ if ('stacked' === orientation.kind) return {
2173
+ tr: '3'
2174
+ };
2175
+ return {
2176
+ rt: orientation.angle < 0 ? 90 - orientation.angle : orientation.angle
2177
+ };
2178
+ }
2179
+ function spreadsheetTextOrientationXlsxValue(orientation) {
2180
+ if (!orientation) return null;
2181
+ if ('stacked' === orientation.kind) return 255;
2182
+ return orientation.angle < 0 ? 90 - orientation.angle : orientation.angle;
2183
+ }
2184
+ function spreadsheetTextOrientationXlsxValueFromCell(cell) {
2185
+ return spreadsheetTextOrientationXlsxValue(spreadsheetExplicitTextOrientationFromCell(cell));
2186
+ }
2187
+ function spreadsheetVisibleTextRotationFromCell(cell) {
2188
+ const orientation = spreadsheetTextOrientationFromCell(cell);
2189
+ return 'rotation' === orientation.kind ? orientation.angle : 0;
2190
+ }
2191
+ function spreadsheetTextOrientationChoiceFromCell(cell) {
2192
+ const orientation = spreadsheetTextOrientationFromCell(cell);
2193
+ if ('stacked' === orientation.kind) return 'vertical';
2194
+ return Object.entries(presetAngles).find(([, angle])=>angle === orientation.angle)?.[0] ?? null;
2195
+ }
2196
+ function integer(value) {
2197
+ if ('string' == typeof value && !/^-?\d+$/.test(value.trim())) return null;
2198
+ const parsed = 'number' == typeof value ? value : Number(value);
2199
+ return Number.isSafeInteger(parsed) ? parsed : null;
2200
+ }
2095
2201
  const spreadsheetUnderlineStyles = [
2096
2202
  'none',
2097
2203
  'single',
@@ -2643,4 +2749,4 @@ function boundedInteger(value, minimum, maximum, fallback) {
2643
2749
  function boundedNumber(value, minimum, maximum, fallback) {
2644
2750
  return 'number' == typeof value && Number.isFinite(value) && value >= minimum && value <= maximum ? value : fallback;
2645
2751
  }
2646
- export { DEFAULT_PROTECTION_HINT, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, SPREADSHEET_CONDITIONAL_ICON_SETS, attachSpreadsheetShownCommentCells, createWorkOfficeSpreadsheetCollaborationBinding as createOfficeSpreadsheetCollaborationBinding, defaultSpreadsheetColorScaleThresholds, defaultSpreadsheetConditionalIconThresholds, defaultSpreadsheetDataBarOptions, drawSpreadsheetConditionalIcon, editableRangeCellCount, editableRangeRequiresCredentials, effectiveSpreadsheetPageSetup, freezeImportedSpreadsheetCell, importedSheetProtectionAuthority, initializeWorkOfficeSpreadsheetCollaboration as initializeOfficeSpreadsheetCollaboration, isSpreadsheetConditionalComparisonOperator, isSpreadsheetConditionalIconSetName, isSpreadsheetUnderlineStyle, normalizeSheetProtectionAuthority, normalizeSpreadsheetConditionalIconSetFormat, normalizeSpreadsheetConditionalVisualOptions, normalizeSpreadsheetDateValidationBoundary, normalizeSpreadsheetPaperSize, protectedSheetCount, readWorkOfficeSpreadsheetCollaboration as readOfficeSpreadsheetCollaboration, registerDerivedSpreadsheetMatrix, registerImportedSpreadsheetMatrix, replaceWorkOfficeSpreadsheetCollaboration as replaceOfficeSpreadsheetCollaboration, sameSpreadsheetHistoryValue, sheetHasProtectionState, sheetProtectionAuthority, spreadsheetConditionalComparisonNeedsUpperValue, spreadsheetConditionalIconForValue, spreadsheetConditionalIconSetCount, spreadsheetConditionalThresholdValue, spreadsheetConditionalThresholdsEqual, spreadsheetDateValidationFormula, spreadsheetMatrixProfile, spreadsheetProtectionKey, spreadsheetUnderlineCellValue, spreadsheetUnderlineCellValueFromSheetJs, spreadsheetUnderlineCellValueFromXlsx, spreadsheetUnderlineStyle, unlockedCellCount, withEditableRange, withSheetProtection, withSheetSelectionPermissions, withoutEditableRange };
2752
+ export { DEFAULT_PROTECTION_HINT, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, SPREADSHEET_CONDITIONAL_ICON_SETS, attachSpreadsheetShownCommentCells, createWorkOfficeSpreadsheetCollaborationBinding as createOfficeSpreadsheetCollaborationBinding, defaultSpreadsheetColorScaleThresholds, defaultSpreadsheetConditionalIconThresholds, defaultSpreadsheetDataBarOptions, drawSpreadsheetConditionalIcon, editableRangeCellCount, editableRangeRequiresCredentials, effectiveSpreadsheetPageSetup, freezeImportedSpreadsheetCell, importedSheetProtectionAuthority, initializeWorkOfficeSpreadsheetCollaboration as initializeOfficeSpreadsheetCollaboration, isSpreadsheetConditionalComparisonOperator, isSpreadsheetConditionalIconSetName, isSpreadsheetTextOrientationId, isSpreadsheetUnderlineStyle, normalizeSheetProtectionAuthority, normalizeSpreadsheetConditionalIconSetFormat, normalizeSpreadsheetConditionalVisualOptions, normalizeSpreadsheetDateValidationBoundary, normalizeSpreadsheetPaperSize, protectedSheetCount, readWorkOfficeSpreadsheetCollaboration as readOfficeSpreadsheetCollaboration, registerDerivedSpreadsheetMatrix, registerImportedSpreadsheetMatrix, replaceWorkOfficeSpreadsheetCollaboration as replaceOfficeSpreadsheetCollaboration, sameSpreadsheetHistoryValue, sheetHasProtectionState, sheetProtectionAuthority, spreadsheetConditionalComparisonNeedsUpperValue, spreadsheetConditionalIconForValue, spreadsheetConditionalIconSetCount, spreadsheetConditionalThresholdValue, spreadsheetConditionalThresholdsEqual, spreadsheetDateValidationFormula, spreadsheetExplicitTextOrientationFromCell, spreadsheetMatrixProfile, spreadsheetProtectionKey, spreadsheetTextOrientationCellStyle, spreadsheetTextOrientationChoiceFromCell, spreadsheetTextOrientationFromAngle, spreadsheetTextOrientationFromCell, spreadsheetTextOrientationFromChoice, spreadsheetTextOrientationFromXlsx, spreadsheetTextOrientationXlsxValueFromCell, spreadsheetUnderlineCellValue, spreadsheetUnderlineCellValueFromSheetJs, spreadsheetUnderlineCellValueFromXlsx, spreadsheetUnderlineStyle, spreadsheetVisibleTextRotationFromCell, unlockedCellCount, withEditableRange, withSheetProtection, withSheetSelectionPermissions, withoutEditableRange };
package/dist/core.js CHANGED
@@ -7,6 +7,6 @@ export { createArtifact, createOfficeId, officeTemplates } from "./5184.js";
7
7
  export { createOfficeDocumentCollaborationBinding, initializeOfficeDocumentCollaboration, officeDocumentCollaborationFragment, readOfficeDocumentCollaboration } from "./6282.js";
8
8
  export { createOfficeMarkdownCollaborationBinding, initializeOfficeMarkdownCollaboration, readOfficeMarkdownCollaboration, replaceOfficeMarkdownCollaboration } from "./2591.js";
9
9
  export { createOfficePresentationCollaborationBinding, initializeOfficePresentationCollaboration, readOfficePresentationCollaboration, replaceOfficePresentationCollaboration } from "./4560.js";
10
- export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./1992.js";
10
+ export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./6164.js";
11
11
  export { normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetBubbleSizeRepresents, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetDataLabelPosition, normalizeWorkSpreadsheetDataLabels, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetRadarStyle, normalizeWorkSpreadsheetScatterStyle, normalizeWorkSpreadsheetTrendline, normalizeWorkSpreadsheetTrendlineType, workSpreadsheetChartSupportsAxes, workSpreadsheetChartSupportsErrorBars, workSpreadsheetChartSupportsTrendlines, workSpreadsheetChartTypeLabel, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetCombinationSeriesTypeLabel, workSpreadsheetDataLabelPositionLabel, workSpreadsheetErrorBarTypeLabel, workSpreadsheetErrorBarValueTypeLabel, workSpreadsheetTrendlineTypeLabel } from "./8715.js";
12
12
  export { core_OFFICE_COLLABORATION_VERSION as OFFICE_COLLABORATION_VERSION };
package/dist/index.js CHANGED
@@ -10,6 +10,6 @@ export { createArtifact, createOfficeId, officeTemplates } from "./5184.js";
10
10
  export { createOfficeDocumentCollaborationBinding, initializeOfficeDocumentCollaboration, officeDocumentCollaborationFragment, readOfficeDocumentCollaboration } from "./6282.js";
11
11
  export { createOfficeMarkdownCollaborationBinding, initializeOfficeMarkdownCollaboration, readOfficeMarkdownCollaboration, replaceOfficeMarkdownCollaboration } from "./2591.js";
12
12
  export { createOfficePresentationCollaborationBinding, initializeOfficePresentationCollaboration, readOfficePresentationCollaboration, replaceOfficePresentationCollaboration } from "./4560.js";
13
- export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./1992.js";
13
+ export { createOfficeSpreadsheetCollaborationBinding, initializeOfficeSpreadsheetCollaboration, readOfficeSpreadsheetCollaboration, replaceOfficeSpreadsheetCollaboration } from "./6164.js";
14
14
  export { normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetBubbleSizeRepresents, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetDataLabelPosition, normalizeWorkSpreadsheetDataLabels, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetRadarStyle, normalizeWorkSpreadsheetScatterStyle, normalizeWorkSpreadsheetTrendline, normalizeWorkSpreadsheetTrendlineType, workSpreadsheetChartSupportsAxes, workSpreadsheetChartSupportsErrorBars, workSpreadsheetChartSupportsTrendlines, workSpreadsheetChartTypeLabel, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetCombinationSeriesTypeLabel, workSpreadsheetDataLabelPositionLabel, workSpreadsheetErrorBarTypeLabel, workSpreadsheetErrorBarValueTypeLabel, workSpreadsheetTrendlineTypeLabel } from "./8715.js";
15
15
  export { src_DOCUMENT_SNAPSHOT_VERSION as DOCUMENT_SNAPSHOT_VERSION, src_DOCUMENT_SOURCE_VERSION as DOCUMENT_SOURCE_VERSION, src_OFFICE_COLLABORATION_VERSION as OFFICE_COLLABORATION_VERSION };
@@ -1,11 +1,16 @@
1
1
  import { type ReactNode } from 'react';
2
- export declare function OfficeColorPicker({ ariaLabel, value, onValueChange, disabled, compact, className, triggerLabel, triggerIcon, }: {
2
+ export declare function OfficeColorPicker({ ariaLabel, value, onValueChange, disabled, compact, className, resetAction, triggerLabel, triggerIcon, }: {
3
3
  ariaLabel: string;
4
4
  value: string;
5
5
  onValueChange: (value: string) => void;
6
6
  disabled?: boolean;
7
7
  compact?: boolean;
8
8
  className?: string;
9
+ resetAction?: {
10
+ kind: 'automatic' | 'none';
11
+ label: string;
12
+ onSelect: () => void;
13
+ };
9
14
  triggerLabel?: string;
10
15
  triggerIcon?: ReactNode;
11
16
  }): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { Cell } from '@fortune-sheet/core';
2
+ import type { SpreadsheetEditorCanCommands, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
3
+ export declare function SpreadsheetAlignmentRibbonGroup({ can, commands, toolbarCell, }: {
4
+ can: SpreadsheetEditorCanCommands;
5
+ commands: SpreadsheetEditorCommands;
6
+ toolbarCell: Cell | null | undefined;
7
+ }): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import type { Cell } from '@fortune-sheet/core';
2
2
  import type { WorkSpreadsheetContent, WorkSpreadsheetSheet } from '../work-types';
3
3
  import { type SpreadsheetUnderlineStyle } from '../work-spreadsheet-underline';
4
+ import { type SpreadsheetTextOrientationId } from '../work-spreadsheet-text-orientation';
4
5
  import { type SpreadsheetCellBorderFormat } from './spreadsheet-cell-border';
5
6
  import { type SpreadsheetCellRange } from './spreadsheet-cell-range';
6
7
  export declare const MAX_SPREADSHEET_CELL_FORMAT_CELLS = 10000;
@@ -12,6 +13,7 @@ export interface SpreadsheetCellFormatPatch {
12
13
  verticalAlignment?: SpreadsheetVerticalAlignment;
13
14
  wrapText?: boolean;
14
15
  rotation?: number;
16
+ textOrientation?: SpreadsheetTextOrientationId;
15
17
  fontFamily?: string;
16
18
  fontSize?: number;
17
19
  fontColor?: string;
@@ -0,0 +1,7 @@
1
+ import type { SpreadsheetEditorCanCommands, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
2
+ import type { SpreadsheetFormatPainterMode } from './spreadsheet-format-painter';
3
+ export declare function SpreadsheetClipboardRibbonGroup({ can, commands, formatPainterMode, }: {
4
+ can: SpreadsheetEditorCanCommands;
5
+ commands: SpreadsheetEditorCommands;
6
+ formatPainterMode: SpreadsheetFormatPainterMode | null;
7
+ }): import("react").JSX.Element;
@@ -146,9 +146,9 @@ export declare const spreadsheetCommandCatalog: {
146
146
  readonly group: "font";
147
147
  };
148
148
  readonly shortcut: {
149
- readonly label: "Cmd/Ctrl+B";
150
- readonly aria: "Control+B Meta+B";
151
- readonly editor: readonly ["Mod-b"];
149
+ readonly label: "Cmd/Ctrl+B 或 Ctrl+2";
150
+ readonly aria: "Control+B Meta+B Control+2";
151
+ readonly editor: readonly ["Mod-b", "Control-2"];
152
152
  };
153
153
  };
154
154
  readonly italic: {
@@ -160,9 +160,9 @@ export declare const spreadsheetCommandCatalog: {
160
160
  readonly group: "font";
161
161
  };
162
162
  readonly shortcut: {
163
- readonly label: "Cmd/Ctrl+I";
164
- readonly aria: "Control+I Meta+I";
165
- readonly editor: readonly ["Mod-i"];
163
+ readonly label: "Cmd/Ctrl+I 或 Ctrl+3";
164
+ readonly aria: "Control+I Meta+I Control+3";
165
+ readonly editor: readonly ["Mod-i", "Control-3"];
166
166
  };
167
167
  };
168
168
  readonly underline: {
@@ -174,9 +174,9 @@ export declare const spreadsheetCommandCatalog: {
174
174
  readonly group: "font";
175
175
  };
176
176
  readonly shortcut: {
177
- readonly label: "Cmd/Ctrl+U";
178
- readonly aria: "Control+U Meta+U";
179
- readonly editor: readonly ["Mod-u"];
177
+ readonly label: "Cmd/Ctrl+U 或 Ctrl+4";
178
+ readonly aria: "Control+U Meta+U Control+4";
179
+ readonly editor: readonly ["Mod-u", "Control-4"];
180
180
  };
181
181
  };
182
182
  readonly strike: {
@@ -487,6 +487,60 @@ export declare const spreadsheetCommandCatalog: {
487
487
  readonly group: "font";
488
488
  };
489
489
  };
490
+ readonly textOrientationHorizontal: {
491
+ readonly id: "alignment.textOrientation.horizontal";
492
+ readonly label: "横排文字";
493
+ readonly location: {
494
+ readonly area: "ribbon";
495
+ readonly tab: "home";
496
+ readonly group: "alignment";
497
+ };
498
+ };
499
+ readonly textOrientationAngleCounterclockwise: {
500
+ readonly id: "alignment.textOrientation.angleCounterclockwise";
501
+ readonly label: "逆时针倾斜";
502
+ readonly location: {
503
+ readonly area: "ribbon";
504
+ readonly tab: "home";
505
+ readonly group: "alignment";
506
+ };
507
+ };
508
+ readonly textOrientationAngleClockwise: {
509
+ readonly id: "alignment.textOrientation.angleClockwise";
510
+ readonly label: "顺时针倾斜";
511
+ readonly location: {
512
+ readonly area: "ribbon";
513
+ readonly tab: "home";
514
+ readonly group: "alignment";
515
+ };
516
+ };
517
+ readonly textOrientationVertical: {
518
+ readonly id: "alignment.textOrientation.vertical";
519
+ readonly label: "竖排文字";
520
+ readonly location: {
521
+ readonly area: "ribbon";
522
+ readonly tab: "home";
523
+ readonly group: "alignment";
524
+ };
525
+ };
526
+ readonly textOrientationRotateUp: {
527
+ readonly id: "alignment.textOrientation.rotateUp";
528
+ readonly label: "向上旋转文字";
529
+ readonly location: {
530
+ readonly area: "ribbon";
531
+ readonly tab: "home";
532
+ readonly group: "alignment";
533
+ };
534
+ };
535
+ readonly textOrientationRotateDown: {
536
+ readonly id: "alignment.textOrientation.rotateDown";
537
+ readonly label: "向下旋转文字";
538
+ readonly location: {
539
+ readonly area: "ribbon";
540
+ readonly tab: "home";
541
+ readonly group: "alignment";
542
+ };
543
+ };
490
544
  readonly mergeAndCenter: {
491
545
  readonly id: "alignment.mergeAndCenter";
492
546
  readonly label: "合并居中";
@@ -609,6 +663,62 @@ export declare const spreadsheetCommandCatalog: {
609
663
  readonly group: "cells";
610
664
  };
611
665
  };
666
+ readonly hideRows: {
667
+ readonly id: "cells.hideRows";
668
+ readonly label: "隐藏所选行";
669
+ readonly location: {
670
+ readonly area: "ribbon";
671
+ readonly tab: "home";
672
+ readonly group: "cells";
673
+ };
674
+ readonly shortcut: {
675
+ readonly label: "Cmd/Ctrl+9";
676
+ readonly aria: "Control+9 Meta+9";
677
+ readonly editor: readonly ["Mod-9"];
678
+ };
679
+ };
680
+ readonly hideColumns: {
681
+ readonly id: "cells.hideColumns";
682
+ readonly label: "隐藏所选列";
683
+ readonly location: {
684
+ readonly area: "ribbon";
685
+ readonly tab: "home";
686
+ readonly group: "cells";
687
+ };
688
+ readonly shortcut: {
689
+ readonly label: "Cmd/Ctrl+0";
690
+ readonly aria: "Control+0 Meta+0";
691
+ readonly editor: readonly ["Mod-0"];
692
+ };
693
+ };
694
+ readonly unhideRows: {
695
+ readonly id: "cells.unhideRows";
696
+ readonly label: "取消隐藏所选行";
697
+ readonly location: {
698
+ readonly area: "ribbon";
699
+ readonly tab: "home";
700
+ readonly group: "cells";
701
+ };
702
+ readonly shortcut: {
703
+ readonly label: "Cmd/Ctrl+Shift+9";
704
+ readonly aria: "Control+Shift+9 Meta+Shift+9";
705
+ readonly editor: readonly ["Mod-Shift-9"];
706
+ };
707
+ };
708
+ readonly unhideColumns: {
709
+ readonly id: "cells.unhideColumns";
710
+ readonly label: "取消隐藏所选列";
711
+ readonly location: {
712
+ readonly area: "ribbon";
713
+ readonly tab: "home";
714
+ readonly group: "cells";
715
+ };
716
+ readonly shortcut: {
717
+ readonly label: "Cmd/Ctrl+Shift+0";
718
+ readonly aria: "Control+Shift+0 Meta+Shift+0";
719
+ readonly editor: readonly ["Mod-Shift-0"];
720
+ };
721
+ };
612
722
  readonly autoSum: {
613
723
  readonly id: "editing.autoSum";
614
724
  readonly label: "自动求和";
@@ -1,6 +1,7 @@
1
1
  import type { Cell, Selection, Sheet } from '@fortune-sheet/core';
2
- import { type SpreadsheetGridSize } from '../spreadsheet-sparse';
2
+ import type { SpreadsheetGridSize } from '../spreadsheet-sparse';
3
3
  import type { WorkSpreadsheetContent } from '../work-types';
4
+ import type { SpreadsheetTextOrientationId } from '../work-spreadsheet-text-orientation';
4
5
  import { type OfficeEditorCanCommands, type OfficeEditorExtension } from './office-editor-extension';
5
6
  import type { SpreadsheetAutoSumFunction } from './spreadsheet-auto-sum';
6
7
  import { type SpreadsheetCellClearMode } from './spreadsheet-cell-clear';
@@ -15,7 +16,7 @@ import { type SpreadsheetCellMergeCommand } from './spreadsheet-cell-merge';
15
16
  import type { SpreadsheetFormatPainterMode } from './spreadsheet-format-painter';
16
17
  import type { SpreadsheetHyperlinkCell, SpreadsheetHyperlinkRequest } from './spreadsheet-hyperlink';
17
18
  import { type SpreadsheetFreezePanePreset } from './spreadsheet-freeze-panes';
18
- import { type SpreadsheetKeyboardSelection, type SpreadsheetSelectionMove, type SpreadsheetSelectionScope } from './spreadsheet-keyboard-navigation';
19
+ import type { SpreadsheetKeyboardSelection, SpreadsheetSelectionMove, SpreadsheetSelectionScope } from './spreadsheet-keyboard-navigation';
19
20
  import type { SpreadsheetPasteContent } from './spreadsheet-paste-special';
20
21
  import { type SpreadsheetDecimalPlacesDirection } from './spreadsheet-number-format-command';
21
22
  import { type SpreadsheetSheetMoveDirection } from './spreadsheet-sheet-model';
@@ -188,6 +189,7 @@ export interface SpreadsheetEditorCommands {
188
189
  renameSheet: (sheetId: string, name: string) => boolean;
189
190
  redo: () => boolean;
190
191
  setCellFormat: (attribute: keyof Cell, value: unknown) => boolean;
192
+ setTextOrientation: (orientation: SpreadsheetTextOrientationId) => boolean;
191
193
  setSelectedCellBorders: (format: SpreadsheetCellBorderFormat) => boolean;
192
194
  setFreezePanes: (preset: SpreadsheetFreezePanePreset) => boolean;
193
195
  setGridLines: (visible: boolean) => boolean;
@@ -0,0 +1,3 @@
1
+ import type { SpreadsheetCommandContext, SpreadsheetCommandRange } from './spreadsheet-command-controller';
2
+ export declare function canEditSpreadsheetSelection(context: SpreadsheetCommandContext): boolean;
3
+ export declare function spreadsheetLiveCommandRange(context: SpreadsheetCommandContext): SpreadsheetCommandRange;
@@ -0,0 +1,6 @@
1
+ import type { SpreadsheetEditorCanCommands, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
2
+ export declare function SpreadsheetEditingRibbonGroup({ can, commands, findOpen, }: {
3
+ can: SpreadsheetEditorCanCommands;
4
+ commands: SpreadsheetEditorCommands;
5
+ findOpen: boolean;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import type { Cell } from '@fortune-sheet/core';
2
+ import type { SpreadsheetCellFillDirection } from './spreadsheet-cell-fill';
3
+ import type { SpreadsheetCommandContext, SpreadsheetEditorCanCommands, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
4
+ import { type SpreadsheetNumberFormatChoice } from './spreadsheet-number-format';
5
+ import { type SpreadsheetSheetMoveDirection } from './spreadsheet-sheet-model';
6
+ export declare function runSpreadsheetHistoryShortcut(event: KeyboardEvent, canExecute: () => boolean, execute: () => boolean): boolean;
7
+ export declare function runSpreadsheetCellFormatShortcut(event: KeyboardEvent, context: SpreadsheetCommandContext, canExecute: SpreadsheetEditorCanCommands['setCellFormat'], execute: SpreadsheetEditorCommands['setCellFormat'], attribute: Extract<keyof Cell, 'bl' | 'cl' | 'it' | 'un'>): boolean;
8
+ export declare function runSpreadsheetNumberFormatShortcut(event: KeyboardEvent, context: SpreadsheetCommandContext, canExecute: SpreadsheetEditorCanCommands['setCellFormat'], execute: SpreadsheetEditorCommands['setCellFormat'], preset: SpreadsheetNumberFormatChoice): boolean;
9
+ export declare function runSpreadsheetMergeShortcut(event: KeyboardEvent, canExecute: SpreadsheetEditorCanCommands['mergeSelectedCells'], execute: SpreadsheetEditorCommands['mergeSelectedCells']): boolean;
10
+ export declare function runSpreadsheetClearShortcut(event: KeyboardEvent, canExecute: SpreadsheetEditorCanCommands['clearSelectedCells'], execute: SpreadsheetEditorCommands['clearSelectedCells']): boolean;
11
+ export declare function runSpreadsheetFillShortcut(event: KeyboardEvent, canExecute: SpreadsheetEditorCanCommands['fillSelectedCells'], execute: SpreadsheetEditorCommands['fillSelectedCells'], direction: SpreadsheetCellFillDirection): boolean;
12
+ export declare function runSpreadsheetAutoFilterShortcut(event: KeyboardEvent, canExecute: () => boolean, execute: () => boolean): boolean;
13
+ export declare function runSpreadsheetFormatPainterEscape(event: KeyboardEvent, canExecute: SpreadsheetEditorCanCommands['cancelFormatPainter'], execute: SpreadsheetEditorCommands['cancelFormatPainter']): boolean;
14
+ export declare function runSpreadsheetSheetNavigationShortcut(event: KeyboardEvent, context: SpreadsheetCommandContext, activateSheet: SpreadsheetEditorCommands['activateSheet'], direction: SpreadsheetSheetMoveDirection): boolean;
15
+ export declare function runSpreadsheetAddSheetShortcut(event: KeyboardEvent, canExecute: SpreadsheetEditorCanCommands['addSheet'], execute: SpreadsheetEditorCommands['addSheet']): boolean;
16
+ export declare function runSpreadsheetRecalculationShortcut(event: KeyboardEvent, canExecute: SpreadsheetEditorCanCommands['recalculateFormula'], execute: SpreadsheetEditorCommands['recalculateFormula']): boolean;
@@ -0,0 +1,3 @@
1
+ import { type OfficeEditorExtension } from './office-editor-extension';
2
+ import type { SpreadsheetCommandContext, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
3
+ export declare function createSpreadsheetKeyboardShortcutExtension(): OfficeEditorExtension<SpreadsheetCommandContext, SpreadsheetEditorCommands>;
@@ -0,0 +1,5 @@
1
+ import type { SpreadsheetEditorCanCommands, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
2
+ export declare function SpreadsheetRowsAndColumnsMenu({ can, commands, }: {
3
+ can: SpreadsheetEditorCanCommands;
4
+ commands: SpreadsheetEditorCommands;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { type OfficeEditorExtension } from './office-editor-extension';
2
+ import type { SpreadsheetCommandContext, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
3
+ export declare function createSpreadsheetSelectionNavigationExtension(): OfficeEditorExtension<SpreadsheetCommandContext, SpreadsheetEditorCommands>;
@@ -0,0 +1,5 @@
1
+ import { type OfficeEditorExtension } from './office-editor-extension';
2
+ import type { SpreadsheetCommandContext, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
3
+ export declare const MAX_SPREADSHEET_VISIBILITY_ROWS = 10000;
4
+ export declare const MAX_SPREADSHEET_VISIBILITY_COLUMNS = 1000;
5
+ export declare function createSpreadsheetStructureExtension(): OfficeEditorExtension<SpreadsheetCommandContext, SpreadsheetEditorCommands>;
@@ -0,0 +1,18 @@
1
+ import type { Cell } from '@fortune-sheet/core';
2
+ import { type SpreadsheetTextOrientationId } from '../work-spreadsheet-text-orientation';
3
+ import { type OfficeEditorExtension } from './office-editor-extension';
4
+ import type { SpreadsheetCommandContext, SpreadsheetCommandRange, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
5
+ export declare const MAX_SPREADSHEET_TEXT_ORIENTATION_CELLS = 10000;
6
+ export interface SpreadsheetTextOrientationApiCall {
7
+ name: 'setCellFormatByRange';
8
+ args: [
9
+ 'rt' | 'tr',
10
+ Cell['rt'] | Cell['tr'] | undefined,
11
+ SpreadsheetCommandRange,
12
+ {
13
+ id: string;
14
+ }
15
+ ];
16
+ }
17
+ export declare function createSpreadsheetTextOrientationExtension(): OfficeEditorExtension<SpreadsheetCommandContext, SpreadsheetEditorCommands>;
18
+ export declare function spreadsheetTextOrientationApiCalls(range: SpreadsheetCommandRange, sheetId: string, choice: SpreadsheetTextOrientationId): SpreadsheetTextOrientationApiCall[];
@@ -0,0 +1,8 @@
1
+ import type { Selection } from '@fortune-sheet/core';
2
+ import type { SpreadsheetEditorCanCommands, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
3
+ export declare function SpreadsheetFreezePanesMenu({ active, can, commands, selection, }: {
4
+ active: boolean;
5
+ can: SpreadsheetEditorCanCommands;
6
+ commands: SpreadsheetEditorCommands;
7
+ selection: Selection;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { type OfficeEditorExtension } from './office-editor-extension';
2
+ import type { SpreadsheetCommandContext, SpreadsheetEditorCommands } from './spreadsheet-command-controller';
3
+ export declare function createSpreadsheetVisibilityShortcutExtension(): OfficeEditorExtension<SpreadsheetCommandContext, SpreadsheetEditorCommands>;
@@ -0,0 +1,21 @@
1
+ import type { Cell } from '@fortune-sheet/core';
2
+ export declare const spreadsheetTextOrientationIds: readonly ["horizontal", "angleCounterclockwise", "angleClockwise", "vertical", "rotateUp", "rotateDown"];
3
+ export type SpreadsheetTextOrientationId = (typeof spreadsheetTextOrientationIds)[number];
4
+ export type SpreadsheetTextOrientation = {
5
+ kind: 'rotation';
6
+ angle: number;
7
+ } | {
8
+ kind: 'stacked';
9
+ };
10
+ export type SpreadsheetTextOrientationCellStyle = Pick<Cell, 'rt' | 'tr'>;
11
+ export declare function isSpreadsheetTextOrientationId(value: unknown): value is SpreadsheetTextOrientationId;
12
+ export declare function spreadsheetTextOrientationFromChoice(choice: SpreadsheetTextOrientationId): SpreadsheetTextOrientation;
13
+ export declare function spreadsheetTextOrientationFromAngle(value: unknown): SpreadsheetTextOrientation | null;
14
+ export declare function spreadsheetTextOrientationFromXlsx(value: unknown): SpreadsheetTextOrientation | null;
15
+ export declare function spreadsheetExplicitTextOrientationFromCell(cell: Pick<Cell, 'rt' | 'tr'> | null | undefined): SpreadsheetTextOrientation | null;
16
+ export declare function spreadsheetTextOrientationFromCell(cell: Pick<Cell, 'rt' | 'tr'> | null | undefined): SpreadsheetTextOrientation;
17
+ export declare function spreadsheetTextOrientationCellStyle(orientation: SpreadsheetTextOrientation | null | undefined): SpreadsheetTextOrientationCellStyle | null;
18
+ export declare function spreadsheetTextOrientationXlsxValue(orientation: SpreadsheetTextOrientation | null | undefined): number | null;
19
+ export declare function spreadsheetTextOrientationXlsxValueFromCell(cell: Pick<Cell, 'rt' | 'tr'> | null | undefined): number | null;
20
+ export declare function spreadsheetVisibleTextRotationFromCell(cell: Pick<Cell, 'rt' | 'tr'> | null | undefined): number;
21
+ export declare function spreadsheetTextOrientationChoiceFromCell(cell: Pick<Cell, 'rt' | 'tr'> | null | undefined): SpreadsheetTextOrientationId | null;
@@ -0,0 +1,44 @@
1
+ import type { Cell } from '@fortune-sheet/core';
2
+ import { type XlsxColorResolver } from './work-xlsx-colors';
3
+ export type XlsxSemanticColorOrigin = {
4
+ kind: 'automatic';
5
+ baseColor: string;
6
+ renderedColor: string;
7
+ tint?: number;
8
+ } | {
9
+ kind: 'indexed';
10
+ baseColor: string;
11
+ index: number;
12
+ renderedColor: string;
13
+ tint?: number;
14
+ } | {
15
+ kind: 'theme';
16
+ baseColor: string;
17
+ index: number;
18
+ renderedColor: string;
19
+ tint?: number;
20
+ };
21
+ export type XlsxBorderColorOrigins = Partial<Record<'bottom' | 'diagonal' | 'left' | 'right' | 'top', XlsxSemanticColorOrigin>>;
22
+ export interface XlsxCellStyleOrigin {
23
+ borderColors?: XlsxBorderColorOrigins;
24
+ fillColor?: XlsxSemanticColorOrigin;
25
+ fontColor?: XlsxSemanticColorOrigin;
26
+ }
27
+ export interface XlsxSemanticPalette {
28
+ indexed: ReadonlyMap<number, string>;
29
+ theme: ReadonlyMap<number, string>;
30
+ }
31
+ export interface PreparedXlsxSemanticPalette {
32
+ palette: XlsxSemanticPalette;
33
+ stylesChanged: boolean;
34
+ themeChanged: boolean;
35
+ }
36
+ export declare function readXlsxSemanticColorOrigin(element: Element | undefined, colors: XlsxColorResolver): XlsxSemanticColorOrigin | undefined;
37
+ export declare function withXlsxCellStyleOrigin(cell: Cell, origin: XlsxCellStyleOrigin | undefined): Cell;
38
+ export declare function xlsxCellStyleOrigin(cell: Cell | null | undefined): XlsxCellStyleOrigin | undefined;
39
+ export declare function xlsxSemanticColorMatchesValue(origin: XlsxSemanticColorOrigin, value: unknown): boolean;
40
+ export declare function xlsxColorElementMatchesOrigin(element: Element | undefined, origin: XlsxSemanticColorOrigin): boolean;
41
+ export declare function applyXlsxSemanticColorOrigin(element: Element, origin: XlsxSemanticColorOrigin): void;
42
+ export declare function xlsxSemanticColorOriginKey(origin: XlsxSemanticColorOrigin | undefined): string;
43
+ export declare function xlsxSemanticColorOriginSupported(origin: XlsxSemanticColorOrigin, palette: XlsxSemanticPalette | undefined): boolean;
44
+ export declare function prepareXlsxSemanticPalette(styles: Document, theme: Document | null, origins: Iterable<XlsxCellStyleOrigin>): PreparedXlsxSemanticPalette;
@@ -0,0 +1,26 @@
1
+ import type { Cell } from '@fortune-sheet/core';
2
+ import { type SpreadsheetUnderlineStyle } from './work-spreadsheet-underline';
3
+ import type { XlsxCellBorder } from './work-xlsx-cell-borders';
4
+ import { type XlsxSemanticColorOrigin, type XlsxSemanticPalette } from './work-xlsx-cell-style-origin';
5
+ import { type XlsxDirectAlignmentStyle } from './work-xlsx-cell-style-xml';
6
+ import { type XlsxColorResolver } from './work-xlsx-colors';
7
+ export interface XlsxDirectFontStyle {
8
+ bold?: boolean;
9
+ color?: string;
10
+ italic?: boolean;
11
+ name?: string;
12
+ size?: number;
13
+ strike?: boolean;
14
+ underline?: SpreadsheetUnderlineStyle;
15
+ }
16
+ export declare function hasXlsxDirectFontStyle(cell: Cell): boolean;
17
+ export declare function directXlsxFontStyle(cell: Cell): XlsxDirectFontStyle;
18
+ export declare function directXlsxAlignment(cell: Cell): XlsxDirectAlignmentStyle | null;
19
+ export declare function xlsxStyleCollectionIndex(collection: Element, childName: string, value: string | null): number;
20
+ export declare function xlsxColorMatches(element: Element | undefined, value: string, colors: XlsxColorResolver, fallback?: string): boolean;
21
+ export declare function xlsxToggleEnabled(element: Element | undefined): boolean;
22
+ export declare function xlsxUnderlineStyle(element: Element | undefined): SpreadsheetUnderlineStyle;
23
+ export declare function xlsxBorderLineMatches(element: Element | undefined, line: NonNullable<XlsxCellBorder['top']> | null, colors: XlsxColorResolver, semanticColor?: XlsxSemanticColorOrigin): boolean;
24
+ export declare function activeXlsxSemanticColorOrigin(origin: XlsxSemanticColorOrigin | undefined, value: unknown, palette: XlsxSemanticPalette | undefined): XlsxSemanticColorOrigin | undefined;
25
+ export declare function xlsxBooleanAttribute(element: Element | undefined, name: string): boolean;
26
+ export declare function xlsxAlignmentMatches(xf: Element, style: XlsxDirectAlignmentStyle): boolean;
@@ -1,7 +1,9 @@
1
1
  import type { Cell } from '@fortune-sheet/core';
2
2
  import type { XlsxCellBorder } from './work-xlsx-cell-borders';
3
+ import { type XlsxSemanticPalette } from './work-xlsx-cell-style-origin';
3
4
  export declare class XlsxDirectCellStyleWriter {
4
5
  private readonly styles;
6
+ private readonly semanticPalette?;
5
7
  private readonly fonts;
6
8
  private readonly fills;
7
9
  private readonly borders;
@@ -10,8 +12,9 @@ export declare class XlsxDirectCellStyleWriter {
10
12
  private readonly generatedFills;
11
13
  private readonly generatedBorders;
12
14
  private readonly generatedStyles;
15
+ private readonly colors;
13
16
  changed: boolean;
14
- constructor(styles: Document);
17
+ constructor(styles: Document, theme?: Document | null, semanticPalette?: XlsxSemanticPalette | undefined);
15
18
  styleId(baseStyleId: number, cell: Cell, border?: XlsxCellBorder): number;
16
19
  private fontId;
17
20
  private fillId;
@@ -1,10 +1,12 @@
1
1
  import type { Cell, Sheet } from '@fortune-sheet/core';
2
2
  import { type XlsxCellBorder } from './work-xlsx-cell-borders';
3
3
  import { type XlsxDirectCellStyleWriter } from './work-xlsx-cell-style-writer';
4
+ import { type XlsxCellStyleOrigin } from './work-xlsx-cell-style-origin';
4
5
  export { XlsxDirectCellStyleWriter } from './work-xlsx-cell-style-writer';
5
6
  export interface XlsxDirectCellStyle {
6
7
  border?: XlsxCellBorder;
7
8
  column: number;
9
+ origin?: XlsxCellStyleOrigin;
8
10
  row: number;
9
11
  style: Partial<Cell>;
10
12
  }
Binary file