@univerjs/sheets 0.1.2 → 0.1.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.
@@ -14,6 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IRange } from '@univerjs/core';
17
+ import { ObjectMatrix } from '@univerjs/core';
18
+ export declare const createTopMatrixFromRanges: (ranges: IRange[]) => ObjectMatrix<number>;
19
+ export declare const createTopMatrixFromMatrix: (matrix: ObjectMatrix<1>) => ObjectMatrix<number>;
20
+ export declare const findAllRectangle: (topMatrix: ObjectMatrix<number>) => IRange[];
17
21
  /**
18
22
  * Some operations generate sparse ranges such as paste/autofill/ref-range, and this function merge some small ranges into some large ranges to reduce transmission size.
19
23
  * Time Complexity: O(mn) , where m and n are rows and columns. It takes O(mn) to compute the markMatrix and O(n) to apply the histogram algorithm to each column.
@@ -22,3 +26,9 @@ import type { IRange } from '@univerjs/core';
22
26
  * @returns {IRange[]}
23
27
  */
24
28
  export declare const rangeMerge: (ranges: IRange[]) => IRange[];
29
+ export declare class RangeMergeUtil {
30
+ private _matrix;
31
+ add(...ranges: IRange[]): this;
32
+ subtract(...ranges: IRange[]): this;
33
+ merge(): IRange[];
34
+ }
@@ -14,9 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { ICellData, ICommand, IObjectMatrixPrimitiveType, IRange } from '@univerjs/core';
17
- export interface ISetRangeValuesCommandParams {
18
- subUnitId?: string;
19
- unitId?: string;
17
+ import type { ISheetCommandSharedParams } from '../utils/interface';
18
+ export interface ISetRangeValuesCommandParams extends Partial<ISheetCommandSharedParams> {
20
19
  range?: IRange;
21
20
  /**
22
21
  * 1. ICellData: Normal cell data
@@ -0,0 +1,27 @@
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
+ import type { IAccessor } from '@wendellhu/redi';
17
+ import type { IRange } from '@univerjs/core';
18
+ import type { IAddMergeCommandParams } from '../commands/add-worksheet-merge.command';
19
+ import type { ISetSelectionsOperationParams } from '../..';
20
+ export declare const AddMergeRedoSelectionsOperationFactory: (accessor: IAccessor, params: IAddMergeCommandParams, ranges: IRange[]) => {
21
+ id: string;
22
+ params: ISetSelectionsOperationParams;
23
+ } | null;
24
+ export declare const AddMergeUndoSelectionsOperationFactory: (accessor: IAccessor, params: IAddMergeCommandParams) => {
25
+ id: string;
26
+ params: ISetSelectionsOperationParams;
27
+ } | null;
@@ -22,7 +22,7 @@ export { MAX_CELL_PER_SHEET_KEY } from './controllers/config/config';
22
22
  export { BorderStyleManagerService, type IBorderInfo } from './services/border-style-manager.service';
23
23
  export { getCurrentSheetDisabled$, SheetEditablePermission, SheetPermissionService } from './services/permission';
24
24
  export { NORMAL_SELECTION_PLUGIN_NAME, SelectionManagerService, SelectionMoveType, } from './services/selection-manager.service';
25
- export { rangeMerge } from './basics/rangeMerge';
25
+ export { rangeMerge, createTopMatrixFromRanges, createTopMatrixFromMatrix, findAllRectangle, RangeMergeUtil } from './basics/rangeMerge';
26
26
  export { ClearSelectionAllCommand } from './commands/commands/clear-selection-all.command';
27
27
  export { ClearSelectionContentCommand } from './commands/commands/clear-selection-content.command';
28
28
  export { ClearSelectionFormatCommand } from './commands/commands/clear-selection-format.command';
@@ -113,3 +113,4 @@ export { INTERCEPTOR_POINT } from './services/sheet-interceptor/interceptor-cons
113
113
  export { SheetInterceptorService } from './services/sheet-interceptor/sheet-interceptor.service';
114
114
  export type { ISheetLocation } from './services/sheet-interceptor/utils/interceptor';
115
115
  export { MergeCellController } from './controllers/merge-cell.controller';
116
+ export { AddMergeRedoSelectionsOperationFactory, AddMergeUndoSelectionsOperationFactory } from './commands/utils/handle-merge-operation';