@univerjs/sheets 1.0.0-alpha.2 → 1.0.0-alpha.4

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.
@@ -11,12 +11,12 @@ const locale = { sheets: {
11
11
  hideSheet: "No hi ha fulls visibles després d'ocultar aquest"
12
12
  },
13
13
  definedName: {
14
- nameEmpty: "名称不能为空",
15
- nameDuplicate: "名称已存在",
16
- nameInvalid: "名称无效",
17
- nameSheetConflict: "名称与工作表名称冲突",
18
- formulaOrRefStringEmpty: "公式或引用字符串不能为空",
19
- nameConflict: "名称与函数名称冲突",
14
+ nameEmpty: "El nom no pot estar buit",
15
+ nameDuplicate: "El nom ja existeix",
16
+ nameInvalid: "El nom no és vàlid",
17
+ nameSheetConflict: "El nom entra en conflicte amb el nom del full de càlcul",
18
+ formulaOrRefStringEmpty: "La fórmula o la cadena de referència no pot estar buida",
19
+ nameConflict: "El nom entra en conflicte amb el nom d'una funció",
20
20
  defaultName: "NomDefinit"
21
21
  },
22
22
  permission: { dialog: {
@@ -33,10 +33,10 @@ const locale = { sheets: {
33
33
  setStyleErr: "L'interval està protegit i no teniu permís per establir estils. Per establir estils, contacteu amb el creador."
34
34
  } },
35
35
  autoFill: {
36
- copy: "复制单元格",
37
- series: "填充序列",
38
- formatOnly: "仅格式",
39
- noFormat: "无格式"
36
+ copy: "Copia les cel·les",
37
+ series: "Omple la sèrie",
38
+ formatOnly: "Només el format",
39
+ noFormat: "Sense format"
40
40
  },
41
41
  merge: { confirm: {
42
42
  title: "Continuar la fusió només conservarà el valor de la cel·la superior esquerra, descartant els altres valors. Estàs segur de continuar?",
package/lib/facade.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BooleanNumber, CanceledError, DEFAULT_STYLES, Dimension, Direction, HorizontalAlign, IAuthzIoService, ICommandService, ILogService, IPermissionService, IResourceLoaderService, IUniverInstanceService, Inject, Injector, LocaleService, ObjectMatrix, RANGE_TYPE, Rectangle, RedoCommand, RichTextValue, TextStyleValue, Tools, UndoCommand, UniverInstanceType, VerticalAlign, WrapStrategy, cellToRange, covertCellValue, covertCellValues, generateIntervalsByPoints, generateRandomId, getDisplayValueFromCell, getOriginCellValue, isNullCell, mergeWorksheetSnapshotWithDefault, toDisposable } from "@univerjs/core";
2
2
  import { FBase, FBaseInitialable, FEnum, FEventName, FUniver } from "@univerjs/core/facade";
3
- import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCommand, AutoFillCommand, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, EditStateEnum, InsertColByRangeCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowByRangeCommand, InsertSheetCommand, MoveColsCommand, MoveRowsCommand, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RangeThemeStyle, RegisterWorksheetRangeThemeStyleCommand, RemoveColByRangeCommand, RemoveDefinedNameCommand, RemoveRowByRangeCommand, RemoveSheetCommand, RemoveWorksheetMergeCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetBorderBasicCommand, SetColDataCommand, SetColHiddenCommand, SetColWidthCommand, SetDefinedNameCommand, SetFrozenCommand, SetGridlinesColorCommand, SetHorizontalTextAlignCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeValuesCommand, SetRowDataCommand, SetRowHeightCommand, SetRowHiddenCommand, SetSelectionsOperation, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextRotationCommand, SetTextWrapCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorksheetActiveOperation, SetWorksheetColumnCountCommand, SetWorksheetDefaultStyleMutation, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRowCountCommand, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetRangeThemeService, SheetSkeletonChangeType, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, ToggleGridlinesCommand, UnregisterWorksheetRangeThemeStyleCommand, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, addMergeCellsUtil, copyRangeStyles, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getNextPrimaryCell, getPrimaryForRange, getValueChangedEffectedRange, validateDefinedName } from "@univerjs/sheets";
3
+ import { AddRangeProtectionMutation, AddWorksheetProtectionMutation, AppendRowCommand, AutoFillCommand, COMMAND_LISTENER_VALUE_CHANGE, CancelFrozenCommand, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, EditStateEnum, InsertColByRangeCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowByRangeCommand, InsertSheetCommand, MoveColsCommand, MoveRowsCommand, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRuleModel, RangeThemeStyle, RegisterWorksheetRangeThemeStyleCommand, RemoveColByRangeCommand, RemoveDefinedNameCommand, RemoveRowByRangeCommand, RemoveSheetCommand, RemoveWorksheetMergeCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SetBorderBasicCommand, SetColDataCommand, SetColHiddenCommand, SetColWidthCommand, SetDefinedNameCommand, SetFrozenCommand, SetGridlinesColorCommand, SetHorizontalTextAlignCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeValuesCommand, SetRowDataCommand, SetRowHeightCommand, SetRowHiddenCommand, SetSelectionsOperation, SetShrinkToFitCommand, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextRotationCommand, SetTextWrapCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorksheetActiveOperation, SetWorksheetColumnCountCommand, SetWorksheetDefaultStyleMutation, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRowCountCommand, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetShowCommand, SheetRangeThemeService, SheetSkeletonChangeType, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, ToggleGridlinesCommand, UnregisterWorksheetRangeThemeStyleCommand, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, addMergeCellsUtil, copyRangeStyles, getAddMergeMutationRangeByType, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getNextPrimaryCell, getPrimaryForRange, getValueChangedEffectedRange, validateDefinedName } from "@univerjs/sheets";
4
4
  import { FormulaDataModel, IDefinedNamesService, IFunctionService, ISuperTableService, deserializeRangeWithSheet, serializeRange, serializeRangeWithSheet } from "@univerjs/engine-formula";
5
5
  import { ObjectScope, UnitAction, UnitObject, UnitRole } from "@univerjs/protocol";
6
6
 
@@ -978,6 +978,9 @@ function determineScope(editState, viewState) {
978
978
  /**
979
979
  * Check if there are no range protection rules for the given unit and subunit when removing a range protection rule.
980
980
  * If there are no rules left, also remove the associated worksheet protection and update the permission points accordingly.
981
+ * @param {Injector} injector The injector used to resolve permission services.
982
+ * @param {string} unitId The workbook unit id.
983
+ * @param {string} subUnitId The worksheet subunit id.
981
984
  */
982
985
  function handleWorksheetRangePermissionIsEmpty(injector, unitId, subUnitId) {
983
986
  const rangeProtectionRuleModel = injector.get(RangeProtectionRuleModel);
@@ -992,6 +995,14 @@ function handleWorksheetRangePermissionIsEmpty(injector, unitId, subUnitId) {
992
995
  }
993
996
  /**
994
997
  * Get the list of range protection rules for a specific worksheet or range, and convert them to FRangeProtectionRule instances.
998
+ * @param {Injector} injector The injector used to resolve permission services.
999
+ * @param {string} unitId The workbook unit id.
1000
+ * @param {string} subUnitId The worksheet subunit id.
1001
+ * @param {object} options Options for listing range protection rules.
1002
+ * @param {FWorksheet} options.worksheet The worksheet facade used to convert ranges.
1003
+ * @param {FRange} [options.specificRange] Optional range used to filter rules.
1004
+ * @param {boolean} [options.ignoreCollaborators] Whether to skip fetching collaborators for performance.
1005
+ * @returns {Promise<FRangeProtectionRule[]>} The range protection rules.
995
1006
  */
996
1007
  async function getListRangeProtectionRules(injector, unitId, subUnitId, options) {
997
1008
  const rangeProtectionRuleModel = injector.get(RangeProtectionRuleModel);
@@ -1849,6 +1860,8 @@ let FWorksheetPermission = class FWorksheetPermission extends FBase {
1849
1860
  }
1850
1861
  /**
1851
1862
  * List all range protection rules for the worksheet.
1863
+ * @param {object} [options] Options for listing range protection rules.
1864
+ * @param {boolean} [options.ignoreCollaborators] Whether to skip fetching collaborators for performance.
1852
1865
  * @returns {Promise<FRangeProtectionRule[]>} Array of protection rules.
1853
1866
  * @example
1854
1867
  * ```ts
@@ -4377,6 +4390,8 @@ let FRangePermission = class FRangePermission extends FBase {
4377
4390
  }
4378
4391
  /**
4379
4392
  * List all protection rules that intersect with the current range.
4393
+ * @param {object} [options] Options for listing protection rules.
4394
+ * @param {boolean} [options.ignoreCollaborators] Whether to skip fetching collaborators for performance.
4380
4395
  * @returns {Promise<FRangeProtectionRule[]>} Array of protection rules.
4381
4396
  * @example
4382
4397
  * ```ts
@@ -5064,6 +5079,12 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5064
5079
  getWrap() {
5065
5080
  return this._worksheet.getRange(this._range).getWrap() === BooleanNumber.TRUE;
5066
5081
  }
5082
+ /** Gets whether the top-left cell shrinks its font size to fit the cell width. */
5083
+ getShrinkToFit() {
5084
+ var _this$_worksheet$getC6;
5085
+ const { startRow, startColumn } = this._range;
5086
+ return ((_this$_worksheet$getC6 = this._worksheet.getComposedCellStyle(startRow, startColumn)) === null || _this$_worksheet$getC6 === void 0 ? void 0 : _this$_worksheet$getC6.stf) === BooleanNumber.TRUE;
5087
+ }
5067
5088
  /**
5068
5089
  * Gets whether text wrapping is enabled for cells in the range.
5069
5090
  * @returns {boolean[][]} A two-dimensional array of whether text wrapping is enabled for each cell in the range.
@@ -5526,6 +5547,16 @@ let FRange = _FRange = class FRange extends FBaseInitialable {
5526
5547
  });
5527
5548
  return this;
5528
5549
  }
5550
+ /** Sets whether cells shrink their font size to fit the cell width. */
5551
+ setShrinkToFit(enabled) {
5552
+ this._commandService.syncExecuteCommand(SetShrinkToFitCommand.id, {
5553
+ unitId: this._workbook.getUnitId(),
5554
+ subUnitId: this._worksheet.getSheetId(),
5555
+ range: this._range,
5556
+ value: enabled ? BooleanNumber.TRUE : BooleanNumber.FALSE
5557
+ });
5558
+ return this;
5559
+ }
5529
5560
  /**
5530
5561
  * Sets the text wrapping strategy for the cells in the range.
5531
5562
  * @param {WrapStrategy} strategy The text wrapping strategy
@@ -7079,6 +7110,7 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
7079
7110
  /**
7080
7111
  * Set the name of the workbook.
7081
7112
  * @param {string} name The new name of the workbook.
7113
+ * @returns {FWorkbook} The current FWorkbook instance for chaining.
7082
7114
  * @example
7083
7115
  * ```ts
7084
7116
  * // The code below sets the name of the workbook
@@ -7724,7 +7756,6 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
7724
7756
  /**
7725
7757
  * Insert a defined name by builder param.
7726
7758
  * @param {ISetDefinedNameMutationParam} param The param to insert the defined name
7727
- * @returns {void}
7728
7759
  * @example
7729
7760
  * ```ts
7730
7761
  * // The code below inserts a defined name by builder param
@@ -7743,7 +7774,6 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
7743
7774
  /**
7744
7775
  * Update the defined name with the given name.
7745
7776
  * @param {ISetDefinedNameMutationParam} param The param to insert the defined name
7746
- * @returns {void}
7747
7777
  * @example
7748
7778
  * ```ts
7749
7779
  * // The code below updates the defined name with the given name
@@ -7817,7 +7847,6 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
7817
7847
  /**
7818
7848
  * Register a custom range theme style.
7819
7849
  * @param {RangeThemeStyle} rangeThemeStyle The range theme style to register
7820
- * @returns {void}
7821
7850
  * @example
7822
7851
  * ```ts
7823
7852
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -7840,7 +7869,6 @@ let FWorkbook = class FWorkbook extends FBaseInitialable {
7840
7869
  /**
7841
7870
  * Unregister a custom range theme style.
7842
7871
  * @param {string} themeName The name of the theme to unregister
7843
- * @returns {void}
7844
7872
  * @example
7845
7873
  * ```ts
7846
7874
  * const fWorkbook = univerAPI.getActiveWorkbook();
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { AUTO_HEIGHT_FOR_MERGED_CELLS, BORDER_KEYS, BORDER_STYLE_KEYS, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, COLOR_STYLE_KEYS, CellModeEnum, CellValueType, CommandType, CustomCommandExecutionError, DependentOn, Dimension, Direction, Disposable, DisposableCollection, DocumentDataModel, ErrorService, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, MAX_COLUMN_COUNT, MAX_ROW_COUNT, ObjectMatrix, Optional, PADDING_KEYS, PermissionStatus, Plugin, RANGE_TYPE, RTree, Range, Rectangle, RxDisposable, STYLE_KEYS, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, TextX, Tools, UniverInstanceType, UserManagerService, cellToRange, cloneWorksheetData, composeInterceptors, concatMatrixArray, createIdentifier, createInterceptorKey, createRowColIter, escapeRegExp, generateRandomId, getArrayLength, isBooleanString, isDefaultFormat, isFormulaId, isFormulaString, isICellData, isRealNum, isSafeNumeric, isTextFormat, mapObjectMatrix, merge, mergeIntervals, mergeOverrideWithDependencies, mergeWorksheetSnapshotWithDefault, moveMatrixArray, normalizeTextRuns, numfmt, queryObjectMatrix, registerDependencies, remove, selectionToArray, sequenceExecute, sliceMatrixArray, spliceArray, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
1
+ import { AUTO_HEIGHT_FOR_MERGED_CELLS, BORDER_KEYS, BORDER_STYLE_KEYS, BooleanNumber, BorderStyleTypes, BorderType, BuildTextUtils, COLOR_STYLE_KEYS, CellModeEnum, CellValueType, CommandType, CustomCommandExecutionError, DependentOn, Dimension, Direction, Disposable, DisposableCollection, DocumentDataModel, ErrorService, FontItalic, FontWeight, HorizontalAlign, IAuthzIoService, ICommandService, IConfigService, IConfirmService, IContextService, ILogService, IPermissionService, IResourceManagerService, IS_ROW_STYLE_PRECEDE_COLUMN_STYLE, IUndoRedoService, IUniverInstanceService, Inject, Injector, InterceptorEffectEnum, InterceptorManager, LRUMap, LocaleService, MAX_COLUMN_COUNT, MAX_ROW_COUNT, ObjectMatrix, Optional, PADDING_KEYS, PermissionStatus, Plugin, RANGE_TYPE, RTree, Range, Rectangle, RxDisposable, STYLE_KEYS, TEXT_DECORATION_KEYS, TEXT_ROTATION_KEYS, TextX, Tools, UniverInstanceType, UserManagerService, cellToRange, cloneWorksheetData, composeInterceptors, concatMatrixArray, createIdentifier, createInterceptorKey, createRowColIter, generateRandomId, getArrayLength, isBooleanString, isDefaultFormat, isFormulaId, isFormulaString, isICellData, isRealNum, isSafeNumeric, isTextFormat, mapObjectMatrix, merge, mergeIntervals, mergeOverrideWithDependencies, mergeWorksheetSnapshotWithDefault, moveMatrixArray, normalizeTextRuns, numfmt, queryObjectMatrix, regexp, registerDependencies, remove, selectionToArray, sequenceExecute, sliceMatrixArray, spliceArray, throttle, toDisposable, touchDependencies, willLoseNumericPrecision } from "@univerjs/core";
2
2
  import { BehaviorSubject, Subject, distinctUntilChanged, filter, first, map, merge as merge$1, of, share, shareReplay, skip, switchMap, takeUntil } from "rxjs";
3
3
  import { IDefinedNamesService, LexerTreeBuilder, RemoveDefinedNameMutation, SetDefinedNameMutation, SetDefinedNameMutationFactory, SetFormulaCalculationResultMutation, UniverFormulaEnginePlugin, deserializeRangeWithSheet, deserializeRangeWithSheetWithCache, handleNumfmtInCell, isReferenceStringWithEffectiveColumn, operatorToken, sequenceNodeType, stripErrorMargin } from "@univerjs/engine-formula";
4
- import { SpreadsheetSkeleton, hasCJKText, precisionTo } from "@univerjs/engine-render";
4
+ import { SpreadsheetSkeleton, cjk, precisionTo } from "@univerjs/engine-render";
5
5
  import { UnitAction, UnitObject } from "@univerjs/protocol";
6
6
  import { filter as filter$1, map as map$1, takeUntil as takeUntil$1 } from "rxjs/operators";
7
7
  import { DataSyncPrimaryController } from "@univerjs/rpc";
@@ -3100,7 +3100,7 @@ function validateDefinedName(name, options) {
3100
3100
  const existingDefinedName = definedNamesService.getValueByName(unitId, name);
3101
3101
  if (existingDefinedName && (id === null || id === void 0 || id.length === 0 || existingDefinedName.id !== id)) return "sheets.definedName.nameDuplicate";
3102
3102
  if (superTableService.hasTable(unitId, name)) return "sheets.definedName.nameDuplicate";
3103
- if (!Tools.isValidParameter(name) || isReferenceStringWithEffectiveColumn(name) || !Tools.isStartValidPosition(name) && !hasCJKText(name.substring(0, 1))) return "sheets.definedName.nameInvalid";
3103
+ if (!Tools.isValidParameter(name) || isReferenceStringWithEffectiveColumn(name) || !Tools.isStartValidPosition(name) && !cjk.hasCJKText(name.substring(0, 1))) return "sheets.definedName.nameInvalid";
3104
3104
  const workbook = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET);
3105
3105
  if (!workbook) throw new Error(`Workbook not found for unitId: ${unitId}`);
3106
3106
  if (workbook.getSheets().some((sheet) => sheet.getName() === name)) return "sheets.definedName.nameSheetConflict";
@@ -3702,7 +3702,7 @@ function getDelimiterRegexItem(delimiter, treatMultipleDelimitersAsOne, customDe
3702
3702
  if ((delimiter & 4) > 0) delimiterList.push(";");
3703
3703
  if ((delimiter & 8) > 0) delimiterList.push(" ");
3704
3704
  let str = "";
3705
- for (const delimiter of delimiterList) str += escapeRegExp(delimiter);
3705
+ for (const delimiter of delimiterList) str += regexp.escapeRegExp(delimiter);
3706
3706
  let allStr = "[".concat(str, "]");
3707
3707
  if (treatMultipleDelimitersAsOne) allStr += "+";
3708
3708
  return new RegExp(allStr);
@@ -10298,6 +10298,7 @@ const AppendRowCommand = {
10298
10298
  const AFFECT_LAYOUT_STYLES = [
10299
10299
  "ff",
10300
10300
  "fs",
10301
+ "stf",
10301
10302
  "tr",
10302
10303
  "tb"
10303
10304
  ];
@@ -10626,6 +10627,30 @@ const SetTextWrapCommand = {
10626
10627
  return commandService.syncExecuteCommand(SetStyleCommand.id, setStyleParams);
10627
10628
  }
10628
10629
  };
10630
+ const SetShrinkToFitCommand = {
10631
+ type: CommandType.COMMAND,
10632
+ id: "sheet.command.set-shrink-to-fit",
10633
+ handler: (accessor, params) => {
10634
+ let value = params === null || params === void 0 ? void 0 : params.value;
10635
+ if (value === void 0) {
10636
+ var _target$worksheet$get;
10637
+ const selection = accessor.get(SheetsSelectionsService).getCurrentLastSelection();
10638
+ const target = getSheetCommandTarget(accessor.get(IUniverInstanceService));
10639
+ if (!(selection === null || selection === void 0 ? void 0 : selection.primary) || !target) return false;
10640
+ const { actualRow, actualColumn } = selection.primary;
10641
+ value = ((_target$worksheet$get = target.worksheet.getComposedCellStyle(actualRow, actualColumn)) === null || _target$worksheet$get === void 0 ? void 0 : _target$worksheet$get.stf) === BooleanNumber.TRUE ? BooleanNumber.FALSE : BooleanNumber.TRUE;
10642
+ }
10643
+ return accessor.get(ICommandService).syncExecuteCommand(SetStyleCommand.id, {
10644
+ unitId: params === null || params === void 0 ? void 0 : params.unitId,
10645
+ subUnitId: params === null || params === void 0 ? void 0 : params.subUnitId,
10646
+ range: params === null || params === void 0 ? void 0 : params.range,
10647
+ style: {
10648
+ type: "stf",
10649
+ value
10650
+ }
10651
+ });
10652
+ }
10653
+ };
10629
10654
  const SetTextRotationCommand = {
10630
10655
  type: CommandType.COMMAND,
10631
10656
  id: "sheet.command.set-text-rotation",
@@ -16195,7 +16220,7 @@ let WorksheetPermissionService = class WorksheetPermissionService extends RxDisp
16195
16220
  getAllWorksheetPermissionPoint().forEach((F) => {
16196
16221
  const instance = new F(unitId, subUnitId);
16197
16222
  instance.value = false;
16198
- this._permissionService.addPermissionPoint(instance);
16223
+ this._addOrUpdatePermissionPoint(instance);
16199
16224
  });
16200
16225
  });
16201
16226
  this._worksheetProtectionRuleModel.changeRuleInitState(true);
@@ -16242,7 +16267,7 @@ let WorksheetPermissionService = class WorksheetPermissionService extends RxDisp
16242
16267
  Object.keys(resources).forEach((subUnitId) => {
16243
16268
  getAllWorksheetPermissionPointByPointPanel().forEach((F) => {
16244
16269
  const instance = new F(unitId, subUnitId);
16245
- this._permissionService.addPermissionPoint(instance);
16270
+ this._addOrUpdatePermissionPoint(instance);
16246
16271
  });
16247
16272
  });
16248
16273
  },
@@ -16251,6 +16276,13 @@ let WorksheetPermissionService = class WorksheetPermissionService extends RxDisp
16251
16276
  }
16252
16277
  }));
16253
16278
  }
16279
+ _addOrUpdatePermissionPoint(instance) {
16280
+ if (this._permissionService.getPermissionPoint(instance.id)) {
16281
+ this._permissionService.updatePermissionPoint(instance.id, instance.value);
16282
+ return;
16283
+ }
16284
+ this._permissionService.addPermissionPoint(instance);
16285
+ }
16254
16286
  };
16255
16287
  WorksheetPermissionService = __decorate([
16256
16288
  __decorateParam(0, Inject(IPermissionService)),
@@ -17687,6 +17719,8 @@ let CalculateResultApplyController = class CalculateResultApplyController extend
17687
17719
  const redoMutationsInfo = [];
17688
17720
  for (let i = 0; i < unitIds.length; i++) {
17689
17721
  const unitId = unitIds[i];
17722
+ const workbook = this._univerInstanceService.getUniverSheetInstance(unitId);
17723
+ if (!workbook) continue;
17690
17724
  const sheetData = unitData[unitId];
17691
17725
  if (sheetData == null) continue;
17692
17726
  const sheetIds = Object.keys(sheetData);
@@ -17694,6 +17728,7 @@ let CalculateResultApplyController = class CalculateResultApplyController extend
17694
17728
  const sheetId = sheetIds[j];
17695
17729
  const cellData = sheetData[sheetId];
17696
17730
  if (cellData == null) continue;
17731
+ if (!workbook.getSheetBySheetId(sheetId)) continue;
17697
17732
  const setRangeValuesMutation = {
17698
17733
  subUnitId: sheetId,
17699
17734
  unitId,
@@ -19349,7 +19384,7 @@ RangeProtectionCache = __decorate([
19349
19384
  //#endregion
19350
19385
  //#region package.json
19351
19386
  var name = "@univerjs/sheets";
19352
- var version = "1.0.0-alpha.2";
19387
+ var version = "1.0.0-alpha.4";
19353
19388
 
19354
19389
  //#endregion
19355
19390
  //#region src/controllers/active-worksheet.controller.ts
@@ -19566,6 +19601,7 @@ let BasicWorksheetController = class BasicWorksheetController extends Disposable
19566
19601
  SetSpecificColsVisibleCommand,
19567
19602
  SetSpecificRowsVisibleCommand,
19568
19603
  SetStyleCommand,
19604
+ SetShrinkToFitCommand,
19569
19605
  SetTabColorCommand,
19570
19606
  SetTabColorMutation,
19571
19607
  SetTextColorCommand,
@@ -20606,7 +20642,7 @@ let RangeProtectionService = class RangeProtectionService extends Disposable {
20606
20642
  getAllRangePermissionPoint().forEach((Factor) => {
20607
20643
  const instance = new Factor(unitId, subUnitId, rule.permissionId);
20608
20644
  instance.value = false;
20609
- this._permissionService.addPermissionPoint(instance);
20645
+ this._addOrUpdatePermissionPoint(instance);
20610
20646
  });
20611
20647
  });
20612
20648
  this._selectionProtectionCache.reBuildCache(unitId, subUnitId);
@@ -20617,6 +20653,13 @@ let RangeProtectionService = class RangeProtectionService extends Disposable {
20617
20653
  }
20618
20654
  }));
20619
20655
  }
20656
+ _addOrUpdatePermissionPoint(instance) {
20657
+ if (this._permissionService.getPermissionPoint(instance.id)) {
20658
+ this._permissionService.updatePermissionPoint(instance.id, instance.value);
20659
+ return;
20660
+ }
20661
+ this._permissionService.addPermissionPoint(instance);
20662
+ }
20620
20663
  };
20621
20664
  RangeProtectionService = __decorate([
20622
20665
  __decorateParam(0, Inject(RangeProtectionRuleModel)),
@@ -21281,4 +21324,4 @@ function convertPositionCellToSheetOverGrid(unitId, subUnitId, cellOverGridPosit
21281
21324
  }
21282
21325
 
21283
21326
  //#endregion
21284
- export { AFFECT_LAYOUT_STYLES, AFTER_CELL_EDIT, AUTO_FILL_APPLY_TYPE, AUTO_FILL_DATA_TYPE, AUTO_FILL_HOOK_TYPE, AddMergeRedoSelectionsOperationFactory, AddMergeUndoMutationFactory, AddMergeUndoSelectionsOperationFactory, AddRangeProtectionCommand, AddRangeProtectionMutation, AddRangeThemeMutation, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeMutation, AddWorksheetMergeVerticalCommand, AddWorksheetProtectionCommand, AddWorksheetProtectionMutation, AppendRowCommand, AutoClearContentCommand, AutoFillCommand, AutoFillController, AutoFillRules, AutoFillService, AutoFillTools, BEFORE_CELL_EDIT, BorderStyleManagerService, COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE, CalculateResultApplyController, CancelFrozenCommand, CancelMarkDirtyRowAutoHeightOperation, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, CopyWorksheetEndMutation, DISABLE_NORMAL_SELECTIONS, DefinedNameDataController, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionCommand, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, DeleteWorksheetRangeThemeStyleMutation, DeleteWorksheetRangeThemeStyleMutationFactory, DeltaColumnWidthCommand, DeltaRowHeightCommand, EditStateEnum, EffectRefRangId, EmptyMutation, ExclusiveRangeService, FactoryAddRangeProtectionMutation, FactoryDeleteRangeProtectionMutation, FactorySetRangeProtectionMutation, IAutoFillService, IExclusiveRangeService, INTERCEPTOR_POINT, INumfmtService, IRefSelectionsService, InsertColAfterCommand, InsertColBeforeCommand, InsertColByRangeCommand, InsertColCommand, InsertColMutation, InsertColMutationUndoFactory, InsertDefinedNameCommand, InsertMultiColsLeftCommand, InsertMultiColsRightCommand, InsertMultiRowsAboveCommand, InsertMultiRowsAfterCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowAfterCommand, InsertRowBeforeCommand, InsertRowByRangeCommand, InsertRowCommand, InsertRowMutation, InsertRowMutationUndoFactory, InsertSheetCommand, InsertSheetMutation, InsertSheetUndoMutationFactory, InterceptCellContentPriority, MAX_CELL_PER_SHEET_KEY, MERGE_CELL_INTERCEPTOR_CHECK, MarkDirtyFilterChangeMutation, MarkDirtyRowAutoHeightOperation, MergeCellController, MoveColsCommand, MoveColsMutation, MoveColsMutationUndoFactory, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, MoveRowsMutationUndoFactory, NumfmtService, OperatorType, PermissionPointsDefinitions, REF_SELECTIONS_ENABLED, RangeMergeUtil, RangeProtectionCache, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRefRangeService, RangeProtectionRenderModel, RangeProtectionRuleModel, RangeProtectionService, RangeThemeStyle, RefRangeService, RefSelectionsService, RefillCommand, RegisterWorksheetRangeThemeStyleCommand, RegisterWorksheetRangeThemeStyleMutation, RemoveColByRangeCommand, RemoveColCommand, RemoveColMutation, RemoveDefinedNameCommand, RemoveMergeUndoMutationFactory, RemoveNumfmtMutation, RemoveRangeThemeMutation, RemoveRowByRangeCommand, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, RemoveSheetMutation, RemoveSheetUndoMutationFactory, RemoveWorksheetMergeCommand, RemoveWorksheetMergeMutation, ReorderRangeCommand, ReorderRangeMutation, ReorderRangeUndoMutationFactory, ResetBackgroundColorCommand, ResetTextColorCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SELECTIONS_ENABLED, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SHEETS_PLUGIN_CONFIG_KEY, ScrollToCellOperation, SelectRangeCommand, SelectionMoveType, SetBackgroundColorCommand, SetBoldCommand, SetBorderBasicCommand, SetBorderColorCommand, SetBorderCommand, SetBorderPositionCommand, SetBorderStyleCommand, SetColDataCommand, SetColDataMutation, SetColDataMutationFactory, SetColHiddenCommand, SetColHiddenMutation, SetColVisibleMutation, SetColWidthCommand, SetDefinedNameCommand, SetFontFamilyCommand, SetFontSizeCommand, SetFrozenCommand, SetFrozenMutation, SetFrozenMutationFactory, SetGridlinesColorCommand, SetGridlinesColorMutation, SetHorizontalTextAlignCommand, SetItalicCommand, SetNumfmtMutation, SetOverlineCommand, SetProtectionCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeThemeMutation, SetRangeValuesCommand, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetRowDataCommand, SetRowDataMutation, SetRowDataMutationFactory, SetRowHeightCommand, SetRowHiddenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedColsVisibleCommand, SetSelectedRowsVisibleCommand, SetSelectionsOperation, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStrikeThroughCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorkbookNameMutation, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SetWorksheetColWidthMutation, SetWorksheetColWidthMutationFactory, SetWorksheetColumnCountCommand, SetWorksheetColumnCountMutation, SetWorksheetColumnCountUndoMutationFactory, SetWorksheetDefaultStyleCommand, SetWorksheetDefaultStyleMutation, SetWorksheetDefaultStyleMutationFactory, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetNameMutation, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetPermissionPointsCommand, SetWorksheetPermissionPointsMutation, SetWorksheetProtectionCommand, SetWorksheetProtectionMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRangeThemeStyleMutation, SetWorksheetRangeThemeStyleMutationFactory, SetWorksheetRightToLeftCommand, SetWorksheetRightToLeftMutation, SetWorksheetRowAutoHeightMutation, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowCountCommand, SetWorksheetRowCountMutation, SetWorksheetRowCountUndoMutationFactory, SetWorksheetRowHeightMutation, SetWorksheetRowHeightMutationFactory, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetRowIsAutoHeightMutationFactory, SetWorksheetShowCommand, SheetCopyDownCommand, SheetCopyRightCommand, SheetInterceptorService, SheetLazyExecuteScheduleService, SheetPermissionCheckController, SheetPermissionInitController, SheetRangeThemeModel, SheetRangeThemeService, SheetSkeletonChangeType, SheetSkeletonService, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, TextToNumberCommand, ToggleCellCheckboxCommand, ToggleGridlinesCommand, ToggleGridlinesMutation, UniverSheetsPlugin, UnregisterWorksheetRangeThemeStyleCommand, UnregisterWorksheetRangeThemeStyleMutation, VALIDATE_CELL, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPermissionService, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSelectionModel, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPermissionService, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, ZebraCrossingCacheController, addMergeCellsUtil, adjustRangeOnMutation, alignToMergedCellsBorders, attachPrimaryWithCoord, attachRangeWithCoord, attachSelectionWithCoord, baseProtectionActions, checkCellValueType, checkRangesEditablePermission, convertPositionCellToSheetOverGrid, convertPositionSheetOverGridToAbsolute, convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, copyRangeStyles, countCells, createTopMatrixFromMatrix, createTopMatrixFromRanges, defaultLargeSheetOperationConfig, defaultWorkbookPermissionPoints, defaultWorksheetPermissionPoint, deserializeListOptions, discreteRangeToRange, expandToContinuousRange, factoryRemoveNumfmtUndoMutation, factorySetNumfmtUndoMutation, findAllRectangle, findFirstNonEmptyCell, followSelectionOperation, generateNullCell, generateNullCellValue, getAddMergeMutationRangeByType, getAllRangePermissionPoint, getAllWorkbookPermissionPoint, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getCellAtRowCol, getClearContentMutationParamForRange, getClearContentMutationParamsForRanges, getDefaultRangePermission, getInsertRangeMutations, getMoveRangeCommandMutations, getMoveRangeUndoRedoMutations, getNextPrimaryCell, getPrimaryForRange, getRemoveRangeMutations, getSelectionsService, getSeparateEffectedRangesOnCommand, getSheetCommandTarget, getSheetCommandTargetWorkbook, getSheetMutationTarget, getSkeletonChangedEffectedRange, getValueChangedEffectedRange, getVisibleRanges, handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleCommonDefaultRangeChangeWithEffectRefCommands, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests, handleDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleDeleteRangeMutation, handleIRemoveCol, handleIRemoveRow, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRangeMutation, handleInsertRow, handleMoveCols, handleMoveRange, handleMoveRows, isSingleCellSelection, rangeMerge, rangeToDiscreteRange, rotateRange, runRefRangeMutations, serializeListOptions, setEndForRange, splitRangeText, transformCellsToRange, validateDefinedName };
21327
+ export { AFFECT_LAYOUT_STYLES, AFTER_CELL_EDIT, AUTO_FILL_APPLY_TYPE, AUTO_FILL_DATA_TYPE, AUTO_FILL_HOOK_TYPE, AddMergeRedoSelectionsOperationFactory, AddMergeUndoMutationFactory, AddMergeUndoSelectionsOperationFactory, AddRangeProtectionCommand, AddRangeProtectionMutation, AddRangeThemeMutation, AddWorksheetMergeAllCommand, AddWorksheetMergeCommand, AddWorksheetMergeHorizontalCommand, AddWorksheetMergeMutation, AddWorksheetMergeVerticalCommand, AddWorksheetProtectionCommand, AddWorksheetProtectionMutation, AppendRowCommand, AutoClearContentCommand, AutoFillCommand, AutoFillController, AutoFillRules, AutoFillService, AutoFillTools, BEFORE_CELL_EDIT, BorderStyleManagerService, COMMAND_LISTENER_SKELETON_CHANGE, COMMAND_LISTENER_VALUE_CHANGE, CalculateResultApplyController, CancelFrozenCommand, CancelMarkDirtyRowAutoHeightOperation, ClearSelectionAllCommand, ClearSelectionContentCommand, ClearSelectionFormatCommand, CopySheetCommand, CopyWorksheetEndMutation, DISABLE_NORMAL_SELECTIONS, DefinedNameDataController, DeleteRangeMoveLeftCommand, DeleteRangeMoveUpCommand, DeleteRangeProtectionCommand, DeleteRangeProtectionMutation, DeleteWorksheetProtectionCommand, DeleteWorksheetProtectionMutation, DeleteWorksheetRangeThemeStyleCommand, DeleteWorksheetRangeThemeStyleMutation, DeleteWorksheetRangeThemeStyleMutationFactory, DeltaColumnWidthCommand, DeltaRowHeightCommand, EditStateEnum, EffectRefRangId, EmptyMutation, ExclusiveRangeService, FactoryAddRangeProtectionMutation, FactoryDeleteRangeProtectionMutation, FactorySetRangeProtectionMutation, IAutoFillService, IExclusiveRangeService, INTERCEPTOR_POINT, INumfmtService, IRefSelectionsService, InsertColAfterCommand, InsertColBeforeCommand, InsertColByRangeCommand, InsertColCommand, InsertColMutation, InsertColMutationUndoFactory, InsertDefinedNameCommand, InsertMultiColsLeftCommand, InsertMultiColsRightCommand, InsertMultiRowsAboveCommand, InsertMultiRowsAfterCommand, InsertRangeMoveDownCommand, InsertRangeMoveRightCommand, InsertRowAfterCommand, InsertRowBeforeCommand, InsertRowByRangeCommand, InsertRowCommand, InsertRowMutation, InsertRowMutationUndoFactory, InsertSheetCommand, InsertSheetMutation, InsertSheetUndoMutationFactory, InterceptCellContentPriority, MAX_CELL_PER_SHEET_KEY, MERGE_CELL_INTERCEPTOR_CHECK, MarkDirtyFilterChangeMutation, MarkDirtyRowAutoHeightOperation, MergeCellController, MoveColsCommand, MoveColsMutation, MoveColsMutationUndoFactory, MoveRangeCommand, MoveRangeMutation, MoveRowsCommand, MoveRowsMutation, MoveRowsMutationUndoFactory, NumfmtService, OperatorType, PermissionPointsDefinitions, REF_SELECTIONS_ENABLED, RangeMergeUtil, RangeProtectionCache, RangeProtectionPermissionDeleteProtectionPoint, RangeProtectionPermissionEditPoint, RangeProtectionPermissionManageCollaPoint, RangeProtectionPermissionViewPoint, RangeProtectionRefRangeService, RangeProtectionRenderModel, RangeProtectionRuleModel, RangeProtectionService, RangeThemeStyle, RefRangeService, RefSelectionsService, RefillCommand, RegisterWorksheetRangeThemeStyleCommand, RegisterWorksheetRangeThemeStyleMutation, RemoveColByRangeCommand, RemoveColCommand, RemoveColMutation, RemoveDefinedNameCommand, RemoveMergeUndoMutationFactory, RemoveNumfmtMutation, RemoveRangeThemeMutation, RemoveRowByRangeCommand, RemoveRowCommand, RemoveRowMutation, RemoveSheetCommand, RemoveSheetMutation, RemoveSheetUndoMutationFactory, RemoveWorksheetMergeCommand, RemoveWorksheetMergeMutation, ReorderRangeCommand, ReorderRangeMutation, ReorderRangeUndoMutationFactory, ResetBackgroundColorCommand, ResetTextColorCommand, SCOPE_WORKBOOK_VALUE_DEFINED_NAME, SELECTIONS_ENABLED, SELECTION_CONTROL_BORDER_BUFFER_COLOR, SELECTION_CONTROL_BORDER_BUFFER_WIDTH, SHEETS_PLUGIN_CONFIG_KEY, ScrollToCellOperation, SelectRangeCommand, SelectionMoveType, SetBackgroundColorCommand, SetBoldCommand, SetBorderBasicCommand, SetBorderColorCommand, SetBorderCommand, SetBorderPositionCommand, SetBorderStyleCommand, SetColDataCommand, SetColDataMutation, SetColDataMutationFactory, SetColHiddenCommand, SetColHiddenMutation, SetColVisibleMutation, SetColWidthCommand, SetDefinedNameCommand, SetFontFamilyCommand, SetFontSizeCommand, SetFrozenCommand, SetFrozenMutation, SetFrozenMutationFactory, SetGridlinesColorCommand, SetGridlinesColorMutation, SetHorizontalTextAlignCommand, SetItalicCommand, SetNumfmtMutation, SetOverlineCommand, SetProtectionCommand, SetRangeCustomMetadataCommand, SetRangeProtectionMutation, SetRangeThemeMutation, SetRangeValuesCommand, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SetRowDataCommand, SetRowDataMutation, SetRowDataMutationFactory, SetRowHeightCommand, SetRowHiddenCommand, SetRowHiddenMutation, SetRowVisibleMutation, SetSelectedColsVisibleCommand, SetSelectedRowsVisibleCommand, SetSelectionsOperation, SetShrinkToFitCommand, SetSpecificColsVisibleCommand, SetSpecificRowsVisibleCommand, SetStrikeThroughCommand, SetStyleCommand, SetTabColorCommand, SetTabColorMutation, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, SetWorkbookNameCommand, SetWorkbookNameMutation, SetWorksheetActivateCommand, SetWorksheetActiveOperation, SetWorksheetColWidthMutation, SetWorksheetColWidthMutationFactory, SetWorksheetColumnCountCommand, SetWorksheetColumnCountMutation, SetWorksheetColumnCountUndoMutationFactory, SetWorksheetDefaultStyleCommand, SetWorksheetDefaultStyleMutation, SetWorksheetDefaultStyleMutationFactory, SetWorksheetHideCommand, SetWorksheetHideMutation, SetWorksheetNameCommand, SetWorksheetNameMutation, SetWorksheetOrderCommand, SetWorksheetOrderMutation, SetWorksheetPermissionPointsCommand, SetWorksheetPermissionPointsMutation, SetWorksheetProtectionCommand, SetWorksheetProtectionMutation, SetWorksheetRangeThemeStyleCommand, SetWorksheetRangeThemeStyleMutation, SetWorksheetRangeThemeStyleMutationFactory, SetWorksheetRightToLeftCommand, SetWorksheetRightToLeftMutation, SetWorksheetRowAutoHeightMutation, SetWorksheetRowAutoHeightMutationFactory, SetWorksheetRowCountCommand, SetWorksheetRowCountMutation, SetWorksheetRowCountUndoMutationFactory, SetWorksheetRowHeightMutation, SetWorksheetRowHeightMutationFactory, SetWorksheetRowIsAutoHeightCommand, SetWorksheetRowIsAutoHeightMutation, SetWorksheetRowIsAutoHeightMutationFactory, SetWorksheetShowCommand, SheetCopyDownCommand, SheetCopyRightCommand, SheetInterceptorService, SheetLazyExecuteScheduleService, SheetPermissionCheckController, SheetPermissionInitController, SheetRangeThemeModel, SheetRangeThemeService, SheetSkeletonChangeType, SheetSkeletonService, SheetValueChangeType, SheetsFreezeSyncController, SheetsSelectionsService, SplitDelimiterEnum, SplitTextToColumnsCommand, TextToNumberCommand, ToggleCellCheckboxCommand, ToggleGridlinesCommand, ToggleGridlinesMutation, UniverSheetsPlugin, UnregisterWorksheetRangeThemeStyleCommand, UnregisterWorksheetRangeThemeStyleMutation, VALIDATE_CELL, ViewStateEnum, WorkbookCommentPermission, WorkbookCopyPermission, WorkbookCopySheetPermission, WorkbookCreateProtectPermission, WorkbookCreateSheetPermission, WorkbookDeleteColumnPermission, WorkbookDeleteRowPermission, WorkbookDeleteSheetPermission, WorkbookDuplicatePermission, WorkbookEditablePermission, WorkbookExportPermission, WorkbookHideSheetPermission, WorkbookInsertColumnPermission, WorkbookInsertRowPermission, WorkbookManageCollaboratorPermission, WorkbookMoveSheetPermission, WorkbookPermissionService, WorkbookPrintPermission, WorkbookRecoverHistoryPermission, WorkbookRenameSheetPermission, WorkbookSelectionModel, WorkbookSharePermission, WorkbookViewHistoryPermission, WorkbookViewPermission, WorksheetCopyPermission, WorksheetDeleteColumnPermission, WorksheetDeleteProtectionPermission, WorksheetDeleteRowPermission, WorksheetEditExtraObjectPermission, WorksheetEditPermission, WorksheetFilterPermission, WorksheetInsertColumnPermission, WorksheetInsertHyperlinkPermission, WorksheetInsertRowPermission, WorksheetManageCollaboratorPermission, WorksheetPermissionService, WorksheetPivotTablePermission, WorksheetProtectionPointModel, WorksheetProtectionRuleModel, WorksheetSelectProtectedCellsPermission, WorksheetSelectUnProtectedCellsPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission, WorksheetSetColumnStylePermission, WorksheetSetRowStylePermission, WorksheetSortPermission, WorksheetViewPermission, ZebraCrossingCacheController, addMergeCellsUtil, adjustRangeOnMutation, alignToMergedCellsBorders, attachPrimaryWithCoord, attachRangeWithCoord, attachSelectionWithCoord, baseProtectionActions, checkCellValueType, checkRangesEditablePermission, convertPositionCellToSheetOverGrid, convertPositionSheetOverGridToAbsolute, convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, copyRangeStyles, countCells, createTopMatrixFromMatrix, createTopMatrixFromRanges, defaultLargeSheetOperationConfig, defaultWorkbookPermissionPoints, defaultWorksheetPermissionPoint, deserializeListOptions, discreteRangeToRange, expandToContinuousRange, factoryRemoveNumfmtUndoMutation, factorySetNumfmtUndoMutation, findAllRectangle, findFirstNonEmptyCell, followSelectionOperation, generateNullCell, generateNullCellValue, getAddMergeMutationRangeByType, getAllRangePermissionPoint, getAllWorkbookPermissionPoint, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel, getCellAtRowCol, getClearContentMutationParamForRange, getClearContentMutationParamsForRanges, getDefaultRangePermission, getInsertRangeMutations, getMoveRangeCommandMutations, getMoveRangeUndoRedoMutations, getNextPrimaryCell, getPrimaryForRange, getRemoveRangeMutations, getSelectionsService, getSeparateEffectedRangesOnCommand, getSheetCommandTarget, getSheetCommandTargetWorkbook, getSheetMutationTarget, getSkeletonChangedEffectedRange, getValueChangedEffectedRange, getVisibleRanges, handleBaseInsertRange, handleBaseMoveRowsCols, handleBaseRemoveRange, handleCommonDefaultRangeChangeWithEffectRefCommands, handleCommonRangeChangeWithEffectRefCommandsSkipNoInterests, handleDefaultRangeChangeWithEffectRefCommands, handleDefaultRangeChangeWithEffectRefCommandsSkipNoInterests, handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleDeleteRangeMutation, handleIRemoveCol, handleIRemoveRow, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRangeMutation, handleInsertRow, handleMoveCols, handleMoveRange, handleMoveRows, isSingleCellSelection, rangeMerge, rangeToDiscreteRange, rotateRange, runRefRangeMutations, serializeListOptions, setEndForRange, splitRangeText, transformCellsToRange, validateDefinedName };
@@ -11,12 +11,12 @@ const locale = { sheets: {
11
11
  hideSheet: "No hi ha fulls visibles després d'ocultar aquest"
12
12
  },
13
13
  definedName: {
14
- nameEmpty: "名称不能为空",
15
- nameDuplicate: "名称已存在",
16
- nameInvalid: "名称无效",
17
- nameSheetConflict: "名称与工作表名称冲突",
18
- formulaOrRefStringEmpty: "公式或引用字符串不能为空",
19
- nameConflict: "名称与函数名称冲突",
14
+ nameEmpty: "El nom no pot estar buit",
15
+ nameDuplicate: "El nom ja existeix",
16
+ nameInvalid: "El nom no és vàlid",
17
+ nameSheetConflict: "El nom entra en conflicte amb el nom del full de càlcul",
18
+ formulaOrRefStringEmpty: "La fórmula o la cadena de referència no pot estar buida",
19
+ nameConflict: "El nom entra en conflicte amb el nom d'una funció",
20
20
  defaultName: "NomDefinit"
21
21
  },
22
22
  permission: { dialog: {
@@ -33,10 +33,10 @@ const locale = { sheets: {
33
33
  setStyleErr: "L'interval està protegit i no teniu permís per establir estils. Per establir estils, contacteu amb el creador."
34
34
  } },
35
35
  autoFill: {
36
- copy: "复制单元格",
37
- series: "填充序列",
38
- formatOnly: "仅格式",
39
- noFormat: "无格式"
36
+ copy: "Copia les cel·les",
37
+ series: "Omple la sèrie",
38
+ formatOnly: "Només el format",
39
+ noFormat: "Sense format"
40
40
  },
41
41
  merge: { confirm: {
42
42
  title: "Continuar la fusió només conservarà el valor de la cel·la superior esquerra, descartant els altres valors. Estàs segur de continuar?",
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import type { HorizontalAlign, ICommand, IRange, IStyleData, VerticalAlign, WrapStrategy } from '@univerjs/core';
17
17
  import type { ISheetCommandSharedParams } from '../utils/interface';
18
+ import { BooleanNumber } from '@univerjs/core';
18
19
  export interface IStyleTypeValue<T> {
19
20
  type: keyof IStyleData;
20
21
  value: T | T[][];
@@ -80,6 +81,10 @@ export interface ISetTextWrapCommandParams extends ISetStyleCommonParams {
80
81
  value: WrapStrategy;
81
82
  }
82
83
  export declare const SetTextWrapCommand: ICommand<ISetTextWrapCommandParams>;
84
+ export interface ISetShrinkToFitCommandParams extends ISetStyleCommonParams {
85
+ value?: BooleanNumber;
86
+ }
87
+ export declare const SetShrinkToFitCommand: ICommand<ISetShrinkToFitCommandParams>;
83
88
  export interface ISetTextRotationCommandParams extends ISetStyleCommonParams {
84
89
  value: number | string;
85
90
  }
@@ -321,7 +321,8 @@ export declare class FRange extends FBaseInitialable {
321
321
  * console.log(fRange.getValue(true));
322
322
  *
323
323
  * // set the first cell value to 123
324
- * const richText = univerAPI.newRichText({ body: { dataStream: 'Hello World\r\n' } })
324
+ * const richText = univerAPI.newRichText()
325
+ * .text('Hello World')
325
326
  * .setStyle(0, 1, { bl: 1, cl: { rgb: '#c81e1e' } })
326
327
  * .setStyle(6, 7, { bl: 1, cl: { rgb: '#c81e1e' } });
327
328
  * fRange.setRichTextValueForCell(richText);
@@ -579,6 +580,8 @@ export declare class FRange extends FBaseInitialable {
579
580
  * ```
580
581
  */
581
582
  getWrap(): boolean;
583
+ /** Gets whether the top-left cell shrinks its font size to fit the cell width. */
584
+ getShrinkToFit(): boolean;
582
585
  /**
583
586
  * Gets whether text wrapping is enabled for cells in the range.
584
587
  * @returns {boolean[][]} A two-dimensional array of whether text wrapping is enabled for each cell in the range.
@@ -892,6 +895,8 @@ export declare class FRange extends FBaseInitialable {
892
895
  * ```
893
896
  */
894
897
  setWrap(isWrapEnabled: boolean): FRange;
898
+ /** Sets whether cells shrink their font size to fit the cell width. */
899
+ setShrinkToFit(enabled: boolean): FRange;
895
900
  /**
896
901
  * Sets the text wrapping strategy for the cells in the range.
897
902
  * @param {WrapStrategy} strategy The text wrapping strategy
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export type FSheetEmbedUnitFacadeMapAugmentation = never;
@@ -81,6 +81,7 @@ export declare class FWorkbook extends FBaseInitialable {
81
81
  /**
82
82
  * Set the name of the workbook.
83
83
  * @param {string} name The new name of the workbook.
84
+ * @returns {FWorkbook} The current FWorkbook instance for chaining.
84
85
  * @example
85
86
  * ```ts
86
87
  * // The code below sets the name of the workbook
@@ -546,7 +547,6 @@ export declare class FWorkbook extends FBaseInitialable {
546
547
  /**
547
548
  * Insert a defined name by builder param.
548
549
  * @param {ISetDefinedNameMutationParam} param The param to insert the defined name
549
- * @returns {void}
550
550
  * @example
551
551
  * ```ts
552
552
  * // The code below inserts a defined name by builder param
@@ -563,7 +563,6 @@ export declare class FWorkbook extends FBaseInitialable {
563
563
  /**
564
564
  * Update the defined name with the given name.
565
565
  * @param {ISetDefinedNameMutationParam} param The param to insert the defined name
566
- * @returns {void}
567
566
  * @example
568
567
  * ```ts
569
568
  * // The code below updates the defined name with the given name
@@ -622,7 +621,6 @@ export declare class FWorkbook extends FBaseInitialable {
622
621
  /**
623
622
  * Register a custom range theme style.
624
623
  * @param {RangeThemeStyle} rangeThemeStyle The range theme style to register
625
- * @returns {void}
626
624
  * @example
627
625
  * ```ts
628
626
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -640,7 +638,6 @@ export declare class FWorkbook extends FBaseInitialable {
640
638
  /**
641
639
  * Unregister a custom range theme style.
642
640
  * @param {string} themeName The name of the theme to unregister
643
- * @returns {void}
644
641
  * @example
645
642
  * ```ts
646
643
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -19,7 +19,8 @@ export * from './f-enum';
19
19
  export * from './f-event';
20
20
  export { FRange } from './f-range';
21
21
  export { FSelection } from './f-selection';
22
+ export type { FSheetEmbedUnitFacadeMapAugmentation } from './f-types';
23
+ export type * from './f-univer';
22
24
  export { FWorkbook } from './f-workbook';
23
25
  export { FWorksheet } from './f-worksheet';
24
26
  export { FWorkbookPermission } from './permission/f-workbook-permission';
25
- export type * from './f-univer';
@@ -86,6 +86,8 @@ export declare class FRangePermission extends FBase {
86
86
  unprotect(): Promise<boolean>;
87
87
  /**
88
88
  * List all protection rules that intersect with the current range.
89
+ * @param {object} [options] Options for listing protection rules.
90
+ * @param {boolean} [options.ignoreCollaborators] Whether to skip fetching collaborators for performance.
89
91
  * @returns {Promise<FRangeProtectionRule[]>} Array of protection rules.
90
92
  * @example
91
93
  * ```ts
@@ -303,6 +303,8 @@ export declare class FWorksheetPermission extends FBase {
303
303
  unprotectRules(ruleIds: string[]): Promise<boolean>;
304
304
  /**
305
305
  * List all range protection rules for the worksheet.
306
+ * @param {object} [options] Options for listing range protection rules.
307
+ * @param {boolean} [options.ignoreCollaborators] Whether to skip fetching collaborators for performance.
306
308
  * @returns {Promise<FRangeProtectionRule[]>} Array of protection rules.
307
309
  * @example
308
310
  * ```ts
@@ -28,10 +28,21 @@ export declare function determineScope(editState: EditStateEnum, viewState: View
28
28
  /**
29
29
  * Check if there are no range protection rules for the given unit and subunit when removing a range protection rule.
30
30
  * If there are no rules left, also remove the associated worksheet protection and update the permission points accordingly.
31
+ * @param {Injector} injector The injector used to resolve permission services.
32
+ * @param {string} unitId The workbook unit id.
33
+ * @param {string} subUnitId The worksheet subunit id.
31
34
  */
32
35
  export declare function handleWorksheetRangePermissionIsEmpty(injector: Injector, unitId: string, subUnitId: string): void;
33
36
  /**
34
37
  * Get the list of range protection rules for a specific worksheet or range, and convert them to FRangeProtectionRule instances.
38
+ * @param {Injector} injector The injector used to resolve permission services.
39
+ * @param {string} unitId The workbook unit id.
40
+ * @param {string} subUnitId The worksheet subunit id.
41
+ * @param {object} options Options for listing range protection rules.
42
+ * @param {FWorksheet} options.worksheet The worksheet facade used to convert ranges.
43
+ * @param {FRange} [options.specificRange] Optional range used to filter rules.
44
+ * @param {boolean} [options.ignoreCollaborators] Whether to skip fetching collaborators for performance.
45
+ * @returns {Promise<FRangeProtectionRule[]>} The range protection rules.
35
46
  */
36
47
  export declare function getListRangeProtectionRules(injector: Injector, unitId: string, subUnitId: string, options: {
37
48
  worksheet: FWorksheet;
@@ -98,8 +98,8 @@ export { SetRowDataCommand } from './commands/commands/set-row-data.command';
98
98
  export type { ISetRowDataCommandParams } from './commands/commands/set-row-data.command';
99
99
  export { SetRowHiddenCommand, SetSelectedRowsVisibleCommand, SetSpecificRowsVisibleCommand, } from './commands/commands/set-row-visible.command';
100
100
  export type { ISetRowHiddenCommandParams, ISetSpecificRowsVisibleCommandParams, } from './commands/commands/set-row-visible.command';
101
- export { AFFECT_LAYOUT_STYLES, ResetBackgroundColorCommand, ResetTextColorCommand, SetBackgroundColorCommand, SetBoldCommand, SetFontFamilyCommand, SetFontSizeCommand, SetHorizontalTextAlignCommand, SetItalicCommand, SetOverlineCommand, SetStrikeThroughCommand, SetStyleCommand, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, } from './commands/commands/set-style.command';
102
- export type { ISetColorCommandParams, ISetFontFamilyCommandParams, ISetFontSizeCommandParams, ISetHorizontalTextAlignCommandParams, ISetStyleCommandParams, ISetTextRotationCommandParams, ISetTextWrapCommandParams, ISetVerticalTextAlignCommandParams, IStyleTypeValue, } from './commands/commands/set-style.command';
101
+ export { AFFECT_LAYOUT_STYLES, ResetBackgroundColorCommand, ResetTextColorCommand, SetBackgroundColorCommand, SetBoldCommand, SetFontFamilyCommand, SetFontSizeCommand, SetHorizontalTextAlignCommand, SetItalicCommand, SetOverlineCommand, SetShrinkToFitCommand, SetStrikeThroughCommand, SetStyleCommand, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, } from './commands/commands/set-style.command';
102
+ export type { ISetColorCommandParams, ISetFontFamilyCommandParams, ISetFontSizeCommandParams, ISetHorizontalTextAlignCommandParams, ISetShrinkToFitCommandParams, ISetStyleCommandParams, ISetTextRotationCommandParams, ISetTextWrapCommandParams, ISetVerticalTextAlignCommandParams, IStyleTypeValue, } from './commands/commands/set-style.command';
103
103
  export { SetTabColorCommand } from './commands/commands/set-tab-color.command';
104
104
  export { SetWorkbookNameCommand } from './commands/commands/set-workbook-name.command';
105
105
  export type { ISetWorkbookNameCommandParams } from './commands/commands/set-workbook-name.command';
@@ -25,4 +25,5 @@ export declare class RangeProtectionService extends Disposable {
25
25
  constructor(_selectionProtectionRuleModel: RangeProtectionRuleModel, _permissionService: IPermissionService, _resourceManagerService: IResourceManagerService, _selectionProtectionCache: RangeProtectionCache, _univerInstanceService: IUniverInstanceService);
26
26
  private _initRuleChange;
27
27
  private _initSnapshot;
28
+ private _addOrUpdatePermissionPoint;
28
29
  }
@@ -33,4 +33,5 @@ export declare class WorksheetPermissionService extends RxDisposable {
33
33
  private _initRuleChange;
34
34
  private _initRuleSnapshot;
35
35
  private _initPointSnapshot;
36
+ private _addOrUpdatePermissionPoint;
36
37
  }