@univerjs/sheets 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1624,7 +1624,7 @@ const MoveRangeMutation = {
1624
1624
  handler: (accessor, params) => {
1625
1625
  const { from, to } = params;
1626
1626
  if (!from || !to) return false;
1627
- const workbook = accessor.get(IUniverInstanceService).getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
1627
+ const workbook = accessor.get(IUniverInstanceService).getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
1628
1628
  if (!workbook) return false;
1629
1629
  const fromWorksheet = workbook.getSheetBySheetId(params.from.subUnitId);
1630
1630
  const toWorksheet = workbook.getSheetBySheetId(params.to.subUnitId);
@@ -3838,7 +3838,7 @@ function discreteRangeToRange(discreteRange) {
3838
3838
  }
3839
3839
  function rangeToDiscreteRange(range, accessor, unitId, subUnitId) {
3840
3840
  const univerInstanceService = accessor.get(IUniverInstanceService);
3841
- const workbook = unitId ? univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET) : univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
3841
+ const workbook = unitId ? univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET) : univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
3842
3842
  const worksheet = subUnitId ? workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId) : workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
3843
3843
  if (!worksheet) return null;
3844
3844
  const { startRow, endRow, startColumn, endColumn } = range;
@@ -4265,7 +4265,7 @@ var WorkbookSelectionModel = class extends Disposable {
4265
4265
  //#region src/services/selections/selection.service.ts
4266
4266
  let SheetsSelectionsService = class SheetsSelectionsService extends RxDisposable {
4267
4267
  get _currentSelectionPos() {
4268
- const workbook = this._instanceSrv.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
4268
+ const workbook = this._instanceSrv.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
4269
4269
  if (!workbook) return null;
4270
4270
  const worksheet = workbook.getActiveSheet();
4271
4271
  return {
@@ -4446,7 +4446,7 @@ let SheetsSelectionsService = class SheetsSelectionsService extends RxDisposable
4446
4446
  */
4447
4447
  getCellStylesProperty(property) {
4448
4448
  var _this$_instanceSrv$ge;
4449
- const worksheet = (_this$_instanceSrv$ge = this._instanceSrv.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) === null || _this$_instanceSrv$ge === void 0 ? void 0 : _this$_instanceSrv$ge.getActiveSheet();
4449
+ const worksheet = (_this$_instanceSrv$ge = this._instanceSrv.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) === null || _this$_instanceSrv$ge === void 0 ? void 0 : _this$_instanceSrv$ge.getActiveSheet();
4450
4450
  const selections = this.getCurrentSelections();
4451
4451
  if (!worksheet || selections.length === 0) return {
4452
4452
  isAllValuesSame: false,
@@ -5373,7 +5373,7 @@ const SetRangeValuesCommand = {
5373
5373
  };
5374
5374
 
5375
5375
  //#endregion
5376
- //#region src/commands/utils/handle-range-mutation.ts
5376
+ //#region src/commands/utils/handle-range.mutation.ts
5377
5377
  /**
5378
5378
  * InsertRange is not a mutation but combination of `SetRangeValuesMutation` and `MoveRangeMutation`.
5379
5379
  * @param accessor
@@ -8581,7 +8581,7 @@ let MergeCellController = class MergeCellController extends Disposable {
8581
8581
  case ClearSelectionAllCommand.id:
8582
8582
  case ClearSelectionFormatCommand.id: {
8583
8583
  var _self$_selectionManag;
8584
- const workbook = self._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
8584
+ const workbook = self._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
8585
8585
  const unitId = workbook.getUnitId();
8586
8586
  const worksheet = workbook === null || workbook === void 0 ? void 0 : workbook.getActiveSheet();
8587
8587
  if (!worksheet) return {
@@ -9531,7 +9531,7 @@ MergeCellController = __decorate([
9531
9531
  ], MergeCellController);
9532
9532
  function getWorkbook(univerInstanceService, unitId) {
9533
9533
  if (unitId) return univerInstanceService.getUniverSheetInstance(unitId);
9534
- return univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
9534
+ return univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
9535
9535
  }
9536
9536
  function getWorksheet(workbook, subUnitId) {
9537
9537
  if (subUnitId) return workbook.getSheetBySheetId(subUnitId);
@@ -13093,7 +13093,7 @@ var BorderStyleManagerService = class {
13093
13093
  };
13094
13094
 
13095
13095
  //#endregion
13096
- //#region src/commands/commands/set-border-command.ts
13096
+ //#region src/commands/commands/set-border.command.ts
13097
13097
  function forEach(range, action) {
13098
13098
  const { startRow, startColumn, endRow, endColumn } = range;
13099
13099
  for (let i = startRow; i <= endRow; i++) for (let j = startColumn; j <= endColumn; j++) action(i, j);
@@ -16762,7 +16762,7 @@ const SplitTextToColumnsCommand = {
16762
16762
  const INumfmtService = createIdentifier("INumfmtService");
16763
16763
 
16764
16764
  //#endregion
16765
- //#region src/commands/mutations/numfmt-mutation.ts
16765
+ //#region src/commands/mutations/numfmt.mutation.ts
16766
16766
  const factorySetNumfmtUndoMutation = (accessor, option) => {
16767
16767
  const numfmtService = accessor.get(INumfmtService);
16768
16768
  const { values, unitId, subUnitId } = option;
@@ -18523,7 +18523,7 @@ let SheetPermissionInitController = class SheetPermissionInitController extends
18523
18523
  }
18524
18524
  async initWorkbookPermissionChange(_unitId) {
18525
18525
  var _this$_univerInstance;
18526
- const unitId = _unitId || ((_this$_univerInstance = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId());
18526
+ const unitId = _unitId || ((_this$_univerInstance = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getUnitId());
18527
18527
  if (!unitId) return;
18528
18528
  return this._authzIoService.allowed({
18529
18529
  objectID: unitId,
@@ -19222,7 +19222,7 @@ RangeProtectionCache = __decorate([
19222
19222
  //#endregion
19223
19223
  //#region package.json
19224
19224
  var name = "@univerjs/sheets";
19225
- var version = "0.23.0";
19225
+ var version = "0.24.0";
19226
19226
 
19227
19227
  //#endregion
19228
19228
  //#region src/controllers/active-worksheet.controller.ts
@@ -19700,8 +19700,8 @@ SheetPermissionViewModelController = __decorate([
19700
19700
  ], SheetPermissionViewModelController);
19701
19701
 
19702
19702
  //#endregion
19703
- //#region src/services/exclusive-range/exclusive-range-service.ts
19704
- const IExclusiveRangeService = createIdentifier("univer.exclusive-range-service");
19703
+ //#region src/services/exclusive-range/exclusive-range.service.ts
19704
+ const IExclusiveRangeService = createIdentifier("univer.exclusive-range.service");
19705
19705
  var ExclusiveRangeService = class extends Disposable {
19706
19706
  constructor(..._args) {
19707
19707
  super(..._args);
@@ -19882,7 +19882,7 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
19882
19882
  }
19883
19883
  _onRefRangeChange() {
19884
19884
  const registerRefRange = (unitId, subUnitId) => {
19885
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
19885
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
19886
19886
  if (!workbook) return;
19887
19887
  if (!(workbook === null || workbook === void 0 ? void 0 : workbook.getSheetBySheetId(subUnitId))) return;
19888
19888
  this.disposableCollection.dispose();
@@ -19911,7 +19911,7 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
19911
19911
  registerRefRange(unitId, subUnitId);
19912
19912
  }
19913
19913
  }));
19914
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
19914
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
19915
19915
  if (workbook) {
19916
19916
  const sheet = workbook.getActiveSheet();
19917
19917
  if (!sheet) return;
@@ -20283,7 +20283,7 @@ let RangeProtectionRefRangeService = class RangeProtectionRefRangeService extend
20283
20283
  this.disposeWithMe(this._commandService.onCommandExecuted((command) => {
20284
20284
  if (mutationIdArrByMove.includes(command.id)) {
20285
20285
  if (!command.params) return;
20286
- const workbook = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
20286
+ const workbook = this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
20287
20287
  if (!workbook) return;
20288
20288
  const worksheet = workbook.getSheetBySheetId(command.params.subUnitId);
20289
20289
  if (!worksheet) return;
@@ -20562,7 +20562,7 @@ RangeProtectionService = __decorate([
20562
20562
  ], RangeProtectionService);
20563
20563
 
20564
20564
  //#endregion
20565
- //#region src/services/range-theme-service.ts
20565
+ //#region src/services/range-theme.service.ts
20566
20566
  let SheetRangeThemeService = class SheetRangeThemeService extends Disposable {
20567
20567
  constructor(_sheetRangeThemeModel) {
20568
20568
  super();
@@ -13,10 +13,10 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { CellValue, CustomData, ICellData, IColumnRange, IDisposable, IFreeze, IObjectArrayPrimitiveType, IRange, IRowRange, IStyleData, Nullable, Workbook, Worksheet } from '@univerjs/core';
16
+ import type { CellValue, CustomData, IColumnRange, IFreeze, IObjectArrayPrimitiveType, IRange, IRowRange, IStyleData, Nullable, Workbook, Worksheet } from '@univerjs/core';
17
17
  import type { FDefinedName } from './f-defined-name';
18
18
  import type { FWorkbook } from './f-workbook';
19
- import { BooleanNumber, ICommandService, ILogService, Injector, ObjectMatrix } from '@univerjs/core';
19
+ import { BooleanNumber, ICommandService, ILogService, Injector } from '@univerjs/core';
20
20
  import { FBaseInitialable } from '@univerjs/core/facade';
21
21
  import { SheetsSelectionsService } from '@univerjs/sheets';
22
22
  import { FRange } from './f-range';
@@ -940,7 +940,6 @@ export declare class FWorksheet extends FBaseInitialable {
940
940
  * Sets the frozen state of the current sheet.
941
941
  * @param {IFreeze} freeze - the scrolling viewport start range and count of freezed rows and columns.
942
942
  * that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
943
- * @deprecated use `setFrozenRows` and `setFrozenColumns` instead.
944
943
  * @returns {FWorksheet} This worksheet instance for chaining
945
944
  * @example
946
945
  * ```typescript
@@ -1157,14 +1156,6 @@ export declare class FWorksheet extends FBaseInitialable {
1157
1156
  * ```
1158
1157
  */
1159
1158
  getTabColor(): string | undefined;
1160
- /**
1161
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => {})` instead
1162
- */
1163
- onCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposable;
1164
- /**
1165
- * @deprecated use `univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {})` instead
1166
- */
1167
- onBeforeCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposable;
1168
1159
  /**
1169
1160
  * Hides this sheet. Has no effect if the sheet is already hidden. If this method is called on the only visible sheet, it throws an exception.
1170
1161
  * @returns {FWorksheet} Returns the current worksheet instance for method chaining
@@ -1282,7 +1273,7 @@ export declare class FWorksheet extends FBaseInitialable {
1282
1273
  clearFormats(): FWorksheet;
1283
1274
  /**
1284
1275
  * Returns a Range corresponding to the dimensions in which data is present.
1285
- * This is functionally equivalent to creating a Range bounded by A1 and (Sheet.getLastColumn(), Sheet.getLastRow()).
1276
+ * Empty cells with style or formatting will also be included in the data range. If there is no data on the sheet, returns a Range corresponding to the top-left cell of the sheet (A1).
1286
1277
  * @returns {FRange} The range of the data in the sheet.
1287
1278
  * @example
1288
1279
  * ```ts
@@ -1295,12 +1286,6 @@ export declare class FWorksheet extends FBaseInitialable {
1295
1286
  * ```
1296
1287
  */
1297
1288
  getDataRange(): FRange;
1298
- /**
1299
- * @deprecated use `getLastColumn` instead.
1300
- * Returns the column index of the last column that contains content.
1301
- * @returns {number} the column index of the last column that contains content.
1302
- */
1303
- getLastColumns(): number;
1304
1289
  /**
1305
1290
  * Returns the column index of the last column that contains content.
1306
1291
  * @returns {number} the column index of the last column that contains content.
@@ -1315,12 +1300,6 @@ export declare class FWorksheet extends FBaseInitialable {
1315
1300
  * ```
1316
1301
  */
1317
1302
  getLastColumn(): number;
1318
- /**
1319
- * @deprecated use `getLastRow` instead.
1320
- * Returns the row index of the last row that contains content.
1321
- * @returns {number} the row index of the last row that contains content.
1322
- */
1323
- getLastRows(): number;
1324
1303
  /**
1325
1304
  * Returns the row index of the last row that contains content.
1326
1305
  * @returns {number} the row index of the last row that contains content.
@@ -55,7 +55,7 @@ export { type IRemoveColByRangeCommandParams, type IRemoveRowByRangeCommandParam
55
55
  export { type IRemoveSheetCommandParams, RemoveSheetCommand } from './commands/commands/remove-sheet.command';
56
56
  export { type IRemoveWorksheetMergeCommandParams, RemoveWorksheetMergeCommand } from './commands/commands/remove-worksheet-merge.command';
57
57
  export { type IReorderRangeCommandParams, ReorderRangeCommand } from './commands/commands/reorder-range.command';
58
- export { type ISetBorderBasicCommandParams, type ISetBorderColorCommandParams, type ISetBorderCommandParams, type ISetBorderPositionCommandParams, type ISetBorderStyleCommandParams, SetBorderBasicCommand, SetBorderColorCommand, SetBorderCommand, SetBorderPositionCommand, SetBorderStyleCommand, } from './commands/commands/set-border-command';
58
+ export { type ISetBorderBasicCommandParams, type ISetBorderColorCommandParams, type ISetBorderCommandParams, type ISetBorderPositionCommandParams, type ISetBorderStyleCommandParams, SetBorderBasicCommand, SetBorderColorCommand, SetBorderCommand, SetBorderPositionCommand, SetBorderStyleCommand, } from './commands/commands/set-border.command';
59
59
  export { type ISetColDataCommandParams, SetColDataCommand } from './commands/commands/set-col-data.command';
60
60
  export { type ISetColHiddenCommandParams, type ISetSpecificColsVisibleCommandParams, SetColHiddenCommand, SetSelectedColsVisibleCommand, SetSpecificColsVisibleCommand, } from './commands/commands/set-col-visible.command';
61
61
  export { SetDefinedNameCommand } from './commands/commands/set-defined-name.command';
@@ -116,7 +116,7 @@ export { InsertSheetMutation, InsertSheetUndoMutationFactory } from './commands/
116
116
  export { type IMarkDirtyFilterChangeMutationParams, MarkDirtyFilterChangeMutation } from './commands/mutations/mark-dirty-filter-change.mutation';
117
117
  export { type IMoveRangeMutationParams, MoveRangeMutation } from './commands/mutations/move-range.mutation';
118
118
  export { type IMoveColumnsMutationParams, type IMoveRowsMutationParams, MoveColsMutation, MoveColsMutationUndoFactory, MoveRowsMutation, MoveRowsMutationUndoFactory, } from './commands/mutations/move-rows-cols.mutation';
119
- export { factoryRemoveNumfmtUndoMutation, factorySetNumfmtUndoMutation, type IRemoveNumfmtMutationParams, type ISetCellsNumfmt, type ISetNumfmtMutationParams, RemoveNumfmtMutation, SetNumfmtMutation, transformCellsToRange, } from './commands/mutations/numfmt-mutation';
119
+ export { factoryRemoveNumfmtUndoMutation, factorySetNumfmtUndoMutation, type IRemoveNumfmtMutationParams, type ISetCellsNumfmt, type ISetNumfmtMutationParams, RemoveNumfmtMutation, SetNumfmtMutation, transformCellsToRange, } from './commands/mutations/numfmt.mutation';
120
120
  export { type IRegisterWorksheetRangeThemeStyleMutationParams, RegisterWorksheetRangeThemeStyleMutation } from './commands/mutations/register-range-theme.mutation';
121
121
  export { RemoveRangeThemeMutation } from './commands/mutations/remove-range-theme.mutation';
122
122
  export type { IRemoveRangeThemeMutationParams } from './commands/mutations/remove-range-theme.mutation';
@@ -156,9 +156,9 @@ export { type IScrollToCellOperationParams, ScrollToCellOperation } from './comm
156
156
  export { type ISelectRangeCommandParams, type ISetSelectionsOperationParams, SelectRangeCommand, SetSelectionsOperation } from './commands/operations/selection.operation';
157
157
  export { type ISetWorksheetActiveOperationParams, SetWorksheetActiveOperation } from './commands/operations/set-worksheet-active.operation';
158
158
  export { AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory } from './commands/utils/handle-merge-operation';
159
- export { handleDeleteRangeMutation } from './commands/utils/handle-range-mutation';
160
- export { getInsertRangeMutations, getRemoveRangeMutations } from './commands/utils/handle-range-mutation';
161
- export { handleInsertRangeMutation } from './commands/utils/handle-range-mutation';
159
+ export { handleDeleteRangeMutation } from './commands/utils/handle-range.mutation';
160
+ export { getInsertRangeMutations, getRemoveRangeMutations } from './commands/utils/handle-range.mutation';
161
+ export { handleInsertRangeMutation } from './commands/utils/handle-range.mutation';
162
162
  export { type ISheetCommandSharedParams } from './commands/utils/interface';
163
163
  export { getSelectionsService } from './commands/utils/selection-command-util';
164
164
  export { defaultLargeSheetOperationConfig, type ILargeSheetOperationConfig, type IUniverSheetsConfig, SHEETS_PLUGIN_CONFIG_KEY } from './config/config';
@@ -185,7 +185,7 @@ export { default as AutoFillRules } from './services/auto-fill/rules';
185
185
  export { default as AutoFillTools } from './services/auto-fill/tools';
186
186
  export { type AUTO_FILL_APPLY_FUNCTIONS, AUTO_FILL_APPLY_TYPE, AUTO_FILL_DATA_TYPE, AUTO_FILL_HOOK_TYPE, type IAutoFillCopyDataInType, type IAutoFillCopyDataInTypeIndexInfo, type IAutoFillCopyDataPiece, type IAutoFillLocation, type IAutoFillRule, type IAutoFillRuleConfirmedData, type ISheetAutoFillHook, } from './services/auto-fill/type';
187
187
  export { BorderStyleManagerService, type IBorderInfo } from './services/border-style-manager.service';
188
- export { ExclusiveRangeService, IExclusiveRangeService } from './services/exclusive-range/exclusive-range-service';
188
+ export { ExclusiveRangeService, IExclusiveRangeService } from './services/exclusive-range/exclusive-range.service';
189
189
  export { SheetLazyExecuteScheduleService } from './services/lazy-execute-schedule.service';
190
190
  export { NumfmtService } from './services/numfmt/numfmt.service';
191
191
  export type { INumfmtItem, INumfmtItemWithCache } from './services/numfmt/type';
@@ -210,7 +210,7 @@ export { WorkbookPermissionService } from './services/permission/workbook-permis
210
210
  export { WorksheetProtectionPointModel, WorksheetProtectionRuleModel } from './services/permission/worksheet-permission';
211
211
  export type { IWorksheetProtectionRenderCellData } from './services/permission/worksheet-permission/type';
212
212
  export { WorksheetPermissionService } from './services/permission/worksheet-permission/worksheet-permission.service';
213
- export { SheetRangeThemeService } from './services/range-theme-service';
213
+ export { SheetRangeThemeService } from './services/range-theme.service';
214
214
  export { RefRangeService } from './services/ref-range/ref-range.service';
215
215
  export type { EffectRefRangeParams, IOperator } from './services/ref-range/type';
216
216
  export { EffectRefRangId, OperatorType } from './services/ref-range/type';