@univerjs/sheets 0.2.9 → 0.2.11

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.
@@ -0,0 +1,2 @@
1
+ import { IWorkbookData } from '@univerjs/core';
2
+ export declare const snapshot: IWorkbookData;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Inc.
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 {};
@@ -0,0 +1,15 @@
1
+ import { IRange, Worksheet } from '@univerjs/core';
2
+ export interface IExpandParams {
3
+ left?: boolean;
4
+ right?: boolean;
5
+ up?: boolean;
6
+ down?: boolean;
7
+ }
8
+ /**
9
+ * Expand the range to a continuous range, it uses when Ctrl + A , or only one cell selected to add a pivot table adn so on.
10
+ * @param {IRange} startRange The start range.
11
+ * @param {IExpandParams} directions The directions to expand.
12
+ * @param {Worksheet} worksheet The worksheet working on.
13
+ * @returns {IRange} The expanded range.
14
+ */
15
+ export declare function expandToContinuousRange(startRange: IRange, directions: IExpandParams, worksheet: Worksheet): IRange;
@@ -1,5 +1,8 @@
1
1
  import { ICommand, IRange } from '@univerjs/core';
2
2
  export interface IMoveRowsCommandParams {
3
+ unitId?: string;
4
+ subUnitId?: string;
5
+ range?: IRange;
3
6
  fromRange: IRange;
4
7
  toRange: IRange;
5
8
  }
@@ -9,6 +12,9 @@ export declare const MoveRowsCommandId: "sheet.command.move-rows";
9
12
  */
10
13
  export declare const MoveRowsCommand: ICommand<IMoveRowsCommandParams>;
11
14
  export interface IMoveColsCommandParams {
15
+ unitId?: string;
16
+ subUnitId?: string;
17
+ range?: IRange;
12
18
  fromRange: IRange;
13
19
  toRange: IRange;
14
20
  }
@@ -6,5 +6,10 @@ export interface ISetSpecificColsVisibleCommandParams {
6
6
  }
7
7
  export declare const SetSpecificColsVisibleCommand: ICommand<ISetSpecificColsVisibleCommandParams>;
8
8
  export declare const SetSelectedColsVisibleCommand: ICommand;
9
+ export interface ISetColHiddenCommandParams {
10
+ unitId?: string;
11
+ subUnitId?: string;
12
+ ranges?: IRange[];
13
+ }
9
14
  export declare const SetColHiddenCommand: ICommand;
10
15
  export declare function divideRangesByHiddenCols(worksheet: Worksheet, ranges: IRange[]): IRange[];
@@ -6,5 +6,10 @@ export interface ISetSpecificRowsVisibleCommandParams {
6
6
  }
7
7
  export declare const SetSpecificRowsVisibleCommand: ICommand<ISetSpecificRowsVisibleCommandParams>;
8
8
  export declare const SetSelectedRowsVisibleCommand: ICommand;
9
- export declare const SetRowHiddenCommand: ICommand;
9
+ export interface ISetRowHiddenCommandParams {
10
+ unitId?: string;
11
+ subUnitId?: string;
12
+ ranges?: IRange[];
13
+ }
14
+ export declare const SetRowHiddenCommand: ICommand<ISetRowHiddenCommandParams>;
10
15
  export declare function divideRangesByHiddenRows(worksheet: Worksheet, ranges: IRange[]): IRange[];
@@ -1,10 +1,13 @@
1
- import { ICommand } from '@univerjs/core';
1
+ import { ICommand, IRange } from '@univerjs/core';
2
2
  export interface IDeltaColumnWidthCommandParams {
3
3
  anchorCol: number;
4
4
  deltaX: number;
5
5
  }
6
6
  export declare const DeltaColumnWidthCommand: ICommand<IDeltaColumnWidthCommandParams>;
7
7
  export interface ISetColWidthCommandParams {
8
+ unitId?: string;
9
+ subUnitId?: string;
10
+ ranges?: IRange[];
8
11
  value: number;
9
12
  }
10
13
  export declare const SetColWidthCommand: ICommand;
@@ -1,14 +1,19 @@
1
- import { ICommand } from '@univerjs/core';
1
+ import { ICommand, IRange } from '@univerjs/core';
2
2
  export interface IDeltaRowHeightCommand {
3
3
  anchorRow: number;
4
4
  deltaY: number;
5
5
  }
6
6
  export declare const DeltaRowHeightCommand: ICommand;
7
7
  export interface ISetRowHeightCommandParams {
8
+ unitId?: string;
9
+ subUnitId?: string;
10
+ ranges?: IRange[];
8
11
  value: number;
9
12
  }
10
13
  export declare const SetRowHeightCommand: ICommand;
11
14
  export interface ISetWorksheetRowIsAutoHeightCommandParams {
12
- anchorRow?: number;
15
+ unitId?: string;
16
+ subUnitId?: string;
17
+ ranges?: IRange[];
13
18
  }
14
19
  export declare const SetWorksheetRowIsAutoHeightCommand: ICommand;
@@ -1,4 +1,4 @@
1
- import { IRange, ISelectionCell, Nullable, Workbook, Worksheet } from '@univerjs/core';
1
+ import { ICellData, IObjectMatrixPrimitiveType, IRange, ISelectionCell, Nullable, Workbook, Worksheet } from '@univerjs/core';
2
2
  import { ISetSelectionsOperationParams } from '../../operations/selection.operation';
3
3
  import { ISelectionWithStyle } from '../../../basics/selection';
4
4
  export interface IExpandParams {
@@ -49,3 +49,15 @@ export declare function isSingleCellSelection(selection: Nullable<ISelectionWith
49
49
  export declare function createRangeIteratorWithSkipFilteredRows(sheet: Worksheet): {
50
50
  forOperableEach: (ranges: IRange, operator: (row: number, col: number, range: IRange) => void) => void;
51
51
  };
52
+ /**
53
+ * Copy the styles of a range of cells to another range. Used for insert row and insert column.
54
+ * @param worksheet
55
+ * @param startRow
56
+ * @param endRow
57
+ * @param startColumn
58
+ * @param endColumn
59
+ * @param isRow
60
+ * @param styleRowOrColumn
61
+ * @returns
62
+ */
63
+ export declare function copyRangeStyles(worksheet: Worksheet, startRow: number, endRow: number, startColumn: number, endColumn: number, isRow: boolean, styleRowOrColumn: number): IObjectMatrixPrimitiveType<ICellData>;
@@ -25,7 +25,6 @@ export interface ISetRangeValuesRangeMutationParams extends ISetRangeValuesMutat
25
25
  export declare const SetRangeValuesUndoMutationFactory: (accessor: IAccessor, params: ISetRangeValuesMutationParams) => ISetRangeValuesMutationParams;
26
26
  /**
27
27
  * TODO@Dushusir: Excel can display numbers with up to about 15 digits of precision. When the user inputs more than 15 digits, interception is required, but there are unknown performance risks.
28
-
29
28
  Intercept 15-digit number reference function truncateNumber
30
29
  */
31
30
  export declare const SetRangeValuesMutation: IMutation<ISetRangeValuesMutationParams, boolean>;
@@ -48,7 +48,7 @@ export type { ISheetLocation, ISheetLocationBase, ISheetRowLocation } from './se
48
48
  export { MergeCellController, MERGE_CELL_INTERCEPTOR_CHECK } from './controllers/merge-cell.controller';
49
49
  export { AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory } from './commands/utils/handle-merge-operation';
50
50
  export type { FormatType } from './services/numfmt/type';
51
- export { expandToContinuousRange } from './basics/utils';
51
+ export { expandToContinuousRange } from './basics/expand-range';
52
52
  export { defaultWorksheetPermissionPoint, getAllWorksheetPermissionPoint, getAllWorksheetPermissionPointByPointPanel } from './services/permission';
53
53
  export type { IWorksheetProtectionRule } from './services/permission/type';
54
54
  export { WorksheetProtectionRuleModel, WorksheetProtectionPointModel } from './services/permission/worksheet-permission';
@@ -65,6 +65,7 @@ export { type IRangePermissionPoint, getAllRangePermissionPoint, getDefaultRange
65
65
  export { RangeProtectionPermissionEditPoint } from './services/permission/permission-point/range/edit';
66
66
  export { RangeProtectionPermissionViewPoint } from './services/permission/permission-point/range/view';
67
67
  export { generateNullCellValue, generateNullCell } from './basics/utils';
68
+ export { copyRangeStyles } from './commands/commands/utils/selection-utils';
68
69
  export { AddRangeProtectionCommand, type IAddRangeProtectionCommandParams } from './commands/commands/add-range-protection.command';
69
70
  export { AddWorksheetMergeCommand, AddWorksheetMergeAllCommand, AddWorksheetMergeVerticalCommand, AddWorksheetMergeHorizontalCommand, } from './commands/commands/add-worksheet-merge.command';
70
71
  export { ClearSelectionAllCommand } from './commands/commands/clear-selection-all.command';
@@ -1,4 +1,4 @@
1
- import { ISelectionCell, Nullable, Workbook, Disposable, IUniverInstanceService, RxDisposable } from '@univerjs/core';
1
+ import { DeepReadonly, ISelectionCell, Nullable, Workbook, Disposable, IUniverInstanceService, RxDisposable } from '@univerjs/core';
2
2
  import { Observable } from 'rxjs';
3
3
  import { ISelectionWithStyle } from '../../basics/selection';
4
4
  export interface ISelectionManagerSearchParam {
@@ -13,6 +13,7 @@ export declare enum SelectionMoveType {
13
13
  export declare class SheetsSelectionsService extends RxDisposable {
14
14
  protected readonly _instanceSrv: IUniverInstanceService;
15
15
  private get _currentSelectionPos();
16
+ get currentSelectionParam(): Nullable<ISelectionManagerSearchParam>;
16
17
  selectionMoveStart$: Observable<Nullable<ISelectionWithStyle[]>>;
17
18
  selectionMoving$: Observable<Nullable<ISelectionWithStyle[]>>;
18
19
  selectionMoveEnd$: Observable<ISelectionWithStyle[]>;
@@ -24,7 +25,7 @@ export declare class SheetsSelectionsService extends RxDisposable {
24
25
  */
25
26
  clear(): void;
26
27
  getCurrentSelections(): Readonly<ISelectionWithStyle[]>;
27
- getCurrentLastSelection(): Readonly<Nullable<ISelectionWithStyle & {
28
+ getCurrentLastSelection(): DeepReadonly<Nullable<ISelectionWithStyle & {
28
29
  primary: ISelectionCell;
29
30
  }>>;
30
31
  addSelections(selectionsData: ISelectionWithStyle[]): void;
@@ -69,7 +70,7 @@ export declare class WorkbookSelections extends Disposable {
69
70
  * @param selectionDatas
70
71
  * @param type
71
72
  */
72
- setSelections(sheetId: string, selectionDatas: ISelectionWithStyle[], type?: SelectionMoveType): void;
73
+ setSelections(sheetId: string, selectionDatas: ISelectionWithStyle[], type: SelectionMoveType): void;
73
74
  getCurrentSelections(): Readonly<ISelectionWithStyle[]>;
74
75
  getSelectionOfWorksheet(sheetId: string): ISelectionWithStyle[];
75
76
  private _getCurrentSelections;
@@ -1,5 +1,5 @@
1
1
  import { Dependency, IWorkbookData, Univer } from '@univerjs/core';
2
- export declare function createCoreTestBed(workbookData?: IWorkbookData, dependencies?: Dependency[]): {
2
+ export declare function createSheetTestBed(workbookData?: IWorkbookData, dependencies?: Dependency[]): {
3
3
  univer: Univer;
4
4
  get: {
5
5
  <T>(id: import('@univerjs/core').DependencyIdentifier<T>, lookUp?: import('@univerjs/core').LookUp): T;
@@ -18,8 +18,6 @@ export interface IRangeInterceptors {
18
18
  }
19
19
  /**
20
20
  * This class expose methods for sheet features to inject code to sheet underlying logic.
21
- *
22
- * It would inject Workbook & Worksheet.
23
21
  */
24
22
  export declare class SheetInterceptorService extends Disposable {
25
23
  private readonly _univerInstanceService;
@@ -29,6 +27,7 @@ export declare class SheetInterceptorService extends Disposable {
29
27
  private _beforeCommandInterceptor;
30
28
  private readonly _workbookDisposables;
31
29
  private readonly _worksheetDisposables;
30
+ /** @ignore */
32
31
  constructor(_univerInstanceService: IUniverInstanceService);
33
32
  dispose(): void;
34
33
  interceptCommand(interceptor: ICommandInterceptor): IDisposable;
@@ -1,4 +1,4 @@
1
- import { DependencyOverride, ICommandService, IConfigService, Injector, LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';
1
+ import { DependencyOverride, IConfigService, Injector, Plugin, UniverInstanceType } from '@univerjs/core';
2
2
  export interface IUniverSheetsConfig {
3
3
  notExecuteFormula?: boolean;
4
4
  override?: DependencyOverride;
@@ -8,18 +8,13 @@ export interface IUniverSheetsConfig {
8
8
  */
9
9
  onlyRegisterFormulaRelatedMutations?: true;
10
10
  }
11
- /**
12
- * The main sheet base, construct the sheet container and layout, mount the rendering engine
13
- */
14
11
  export declare class UniverSheetsPlugin extends Plugin {
15
12
  private _config;
16
- private readonly _commandService;
17
13
  private readonly _configService;
18
- private readonly _localeService;
19
14
  readonly _injector: Injector;
20
15
  static pluginName: string;
21
16
  static type: UniverInstanceType;
22
- constructor(_config: IUniverSheetsConfig | undefined, _commandService: ICommandService, _configService: IConfigService, _localeService: LocaleService, _injector: Injector);
17
+ constructor(_config: IUniverSheetsConfig | undefined, _configService: IConfigService, _injector: Injector);
23
18
  onRendered(): void;
24
19
  private _initConfig;
25
20
  private _initDependencies;