@univerjs/sheets 0.1.0-beta.1 → 0.1.0-beta.2

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.
@@ -13,17 +13,19 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import type { ICommand } from '@univerjs/core';
16
+ import type { ICommand, IRange } from '@univerjs/core';
17
17
  export interface IMoveRowsCommandParams {
18
- fromRow: number;
19
- toRow: number;
18
+ fromRange: IRange;
19
+ toRange: IRange;
20
20
  }
21
+ export declare const MoveRowsCommandId: "sheet.command.move-rows";
21
22
  /**
22
23
  * Command to move the selected rows (must currently selected) to the specified row.
23
24
  */
24
25
  export declare const MoveRowsCommand: ICommand<IMoveRowsCommandParams>;
25
26
  export interface IMoveColsCommandParams {
26
- fromCol: number;
27
- toCol: number;
27
+ fromRange: IRange;
28
+ toRange: IRange;
28
29
  }
30
+ export declare const MoveColsCommandId: "sheet.command.move-cols";
29
31
  export declare const MoveColsCommand: ICommand<IMoveColsCommandParams>;
@@ -16,10 +16,12 @@
16
16
  import type { BorderStyleTypes, ICommand } from '@univerjs/core';
17
17
  import { BorderType } from '@univerjs/core';
18
18
  import { type IBorderInfo } from '../../services/border-style-manager.service';
19
- export interface ISetBorderBasicCommand {
19
+ export interface ISetBorderBasicCommandParams {
20
+ unitId?: string;
21
+ subUnitId?: string;
20
22
  value: IBorderInfo;
21
23
  }
22
- export declare const SetBorderBasicCommand: ICommand<ISetBorderBasicCommand>;
24
+ export declare const SetBorderBasicCommand: ICommand<ISetBorderBasicCommandParams>;
23
25
  export interface ISetBorderPositionCommandParams {
24
26
  value: BorderType;
25
27
  }
@@ -32,6 +34,10 @@ export interface ISetBorderColorCommandParams {
32
34
  value: string;
33
35
  }
34
36
  export declare const SetBorderColorCommand: ICommand<ISetBorderColorCommandParams>;
37
+ export interface ISetBorderCommandParams {
38
+ unitId?: string;
39
+ subUnitId?: string;
40
+ }
35
41
  /**
36
42
  * The command to clear content in current selected ranges.
37
43
  */
@@ -18,10 +18,12 @@ export interface IStyleTypeValue<T> {
18
18
  type: keyof IStyleData;
19
19
  value: T | T[][];
20
20
  }
21
- export interface ISetStyleCommandParams<T> {
21
+ interface ISetStyleCommonParams {
22
22
  subUnitId?: string;
23
23
  unitId?: string;
24
24
  range?: IRange;
25
+ }
26
+ export interface ISetStyleCommandParams<T> extends ISetStyleCommonParams {
25
27
  style: IStyleTypeValue<T>;
26
28
  }
27
29
  /**
@@ -74,7 +76,7 @@ export interface ISetHorizontalTextAlignCommandParams {
74
76
  value: HorizontalAlign;
75
77
  }
76
78
  export declare const SetHorizontalTextAlignCommand: ICommand<ISetHorizontalTextAlignCommandParams>;
77
- export interface ISetTextWrapCommandParams {
79
+ export interface ISetTextWrapCommandParams extends ISetStyleCommonParams {
78
80
  value: WrapStrategy;
79
81
  }
80
82
  export declare const SetTextWrapCommand: ICommand<ISetTextWrapCommandParams>;
@@ -82,3 +84,4 @@ export interface ISetTextRotationCommandParams {
82
84
  value: number | string;
83
85
  }
84
86
  export declare const SetTextRotationCommand: ICommand<ISetTextRotationCommandParams>;
87
+ export {};
@@ -0,0 +1,25 @@
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 { IWorkbookData, Workbook } from '@univerjs/core';
17
+ import { Univer } from '@univerjs/core';
18
+ import type { Dependency } from '@wendellhu/redi';
19
+ import { Injector } from '@wendellhu/redi';
20
+ export interface ITestBed {
21
+ univer: Univer;
22
+ get: Injector['get'];
23
+ sheet: Workbook;
24
+ }
25
+ export declare function createCommandTestBed(workbookConfig?: IWorkbookData, dependencies?: Dependency[]): ITestBed;
@@ -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,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 {};
@@ -16,8 +16,13 @@
16
16
  import type { ICellData, IMutation, IObjectMatrixPrimitiveType, Nullable } from '@univerjs/core';
17
17
  export interface IMoveRangeMutationParams {
18
18
  unitId: string;
19
- subUnitId: string;
20
- from: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
21
- to: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
19
+ from: {
20
+ subUnitId: string;
21
+ value: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
22
+ };
23
+ to: {
24
+ subUnitId: string;
25
+ value: IObjectMatrixPrimitiveType<Nullable<ICellData>>;
26
+ };
22
27
  }
23
28
  export declare const MoveRangeMutation: IMutation<IMoveRangeMutationParams, boolean>;
@@ -32,7 +32,7 @@ export interface IMoveRowsMutationParams {
32
32
  * @param accessor
33
33
  * @param params
34
34
  */
35
- export declare function MoveRowsMutationUndoFactory(_accessor: IAccessor, params: IMoveRowsMutationParams): IMoveRowsMutationParams;
35
+ export declare function MoveRowsMutationUndoFactory(_accessor: IAccessor | null, params: IMoveRowsMutationParams): IMoveRowsMutationParams;
36
36
  export declare const MoveRowsMutation: IMutation<IMoveRowsMutationParams>;
37
37
  export interface IMoveColumnsMutationParams {
38
38
  unitId: string;
@@ -46,5 +46,5 @@ export interface IMoveColumnsMutationParams {
46
46
  */
47
47
  targetRange: IRange;
48
48
  }
49
- export declare function MoveColsMutationUndoFactory(_accessor: IAccessor, params: IMoveColumnsMutationParams): IMoveColumnsMutationParams;
49
+ export declare function MoveColsMutationUndoFactory(_accessor: IAccessor | null, params: IMoveColumnsMutationParams): IMoveColumnsMutationParams;
50
50
  export declare const MoveColsMutation: IMutation<IMoveColumnsMutationParams>;
@@ -22,6 +22,7 @@ export interface ISetFrozenMutationParams {
22
22
  startColumn: number;
23
23
  ySplit: number;
24
24
  xSplit: number;
25
+ resetScroll?: boolean;
25
26
  }
26
27
  export declare const SetFrozenMutationFactory: (accessor: IAccessor, params: ISetFrozenMutationParams) => ISetFrozenMutationParams;
27
28
  export declare const SetFrozenMutation: IMutation<ISetFrozenMutationParams>;
@@ -0,0 +1,32 @@
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 { IUniverInstanceService, Workbook, Worksheet } from '@univerjs/core';
17
+ /**
18
+ * Get target workbook and worksheet.
19
+ * @param univerInstanceService
20
+ * @param unitId
21
+ * @param subUnitId
22
+ *
23
+ * @internal
24
+ *
25
+ * @returns
26
+ */
27
+ export declare function getCommandTarget(univerInstanceService: IUniverInstanceService, unitId?: string, subUnitId?: string): {
28
+ workbook: Workbook;
29
+ worksheet: Worksheet;
30
+ unitId: string;
31
+ subUnitId: string;
32
+ };
@@ -36,6 +36,8 @@ export declare class MergeCellController extends Disposable {
36
36
  constructor(_commandService: ICommandService, _refRangeService: RefRangeService, _univerInstanceService: IUniverInstanceService, _injector: Injector, _sheetInterceptorService: SheetInterceptorService, _selectionManagerService: SelectionManagerService);
37
37
  private _initCommandInterceptor;
38
38
  private _onRefRangeChange;
39
+ private _handleMoveRowsCommand;
40
+ private _handleMoveColsCommand;
39
41
  private _handleMoveRangeCommand;
40
42
  private _handleInsertRowCommand;
41
43
  private _handleInsertColCommand;
@@ -20,7 +20,7 @@ export { convertPrimaryWithCoordToPrimary, convertSelectionDataToRange, getNorma
20
20
  export { alignToMergedCellsBorders, getCellAtRowCol } from './commands/commands/utils/selection-utils';
21
21
  export { MAX_CELL_PER_SHEET_KEY } from './controllers/config/config';
22
22
  export { BorderStyleManagerService, type IBorderInfo } from './services/border-style-manager.service';
23
- export { SheetEditablePermission, SheetPermissionService } from './services/permission';
23
+ export { getCurrentSheetDisabled$, SheetEditablePermission, SheetPermissionService } from './services/permission';
24
24
  export { NORMAL_SELECTION_PLUGIN_NAME, SelectionManagerService, SelectionMoveType, } from './services/selection-manager.service';
25
25
  export { rangeMerge } from './basics/rangeMerge';
26
26
  export { ClearSelectionAllCommand } from './commands/commands/clear-selection-all.command';
@@ -46,13 +46,13 @@ export { RemoveColCommand, RemoveRowCommand } from './commands/commands/remove-r
46
46
  export type { IRemoveSheetCommandParams } from './commands/commands/remove-sheet.command';
47
47
  export { RemoveSheetCommand } from './commands/commands/remove-sheet.command';
48
48
  export { RemoveWorksheetMergeCommand } from './commands/commands/remove-worksheet-merge.command';
49
- export type { ISetBorderColorCommandParams, ISetBorderPositionCommandParams, ISetBorderStyleCommandParams, } from './commands/commands/set-border-command';
49
+ export type { ISetBorderBasicCommandParams, ISetBorderColorCommandParams, ISetBorderCommandParams, ISetBorderPositionCommandParams, ISetBorderStyleCommandParams, } from './commands/commands/set-border-command';
50
50
  export { SetBorderBasicCommand, SetBorderColorCommand, SetBorderCommand, SetBorderPositionCommand, SetBorderStyleCommand, } from './commands/commands/set-border-command';
51
51
  export { type ISetSpecificColsVisibleCommandParams, SetColHiddenCommand, SetSelectedColsVisibleCommand, SetSpecificColsVisibleCommand, } from './commands/commands/set-col-visible.command';
52
52
  export { SetFrozenCommand } from './commands/commands/set-frozen.command';
53
53
  export { type ISetRangeValuesCommandParams, SetRangeValuesCommand } from './commands/commands/set-range-values.command';
54
54
  export { type ISetSpecificRowsVisibleCommandParams, SetRowHiddenCommand, SetSelectedRowsVisibleCommand, SetSpecificRowsVisibleCommand, } from './commands/commands/set-row-visible.command';
55
- export { type ISetStyleCommandParams, ResetBackgroundColorCommand, ResetTextColorCommand, SetBackgroundColorCommand, SetBoldCommand, SetFontFamilyCommand, SetFontSizeCommand, SetHorizontalTextAlignCommand, SetItalicCommand, SetStrikeThroughCommand, SetStyleCommand, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, } from './commands/commands/set-style.command';
55
+ export { type ISetColorCommandParams, type ISetFontFamilyCommandParams, type ISetFontSizeCommandParams, type ISetHorizontalTextAlignCommandParams, type ISetStyleCommandParams, type ISetTextRotationCommandParams, type ISetTextWrapCommandParams, type ISetVerticalTextAlignCommandParams, type IStyleTypeValue, ResetBackgroundColorCommand, ResetTextColorCommand, SetBackgroundColorCommand, SetBoldCommand, SetFontFamilyCommand, SetFontSizeCommand, SetHorizontalTextAlignCommand, SetItalicCommand, SetStrikeThroughCommand, SetStyleCommand, SetTextColorCommand, SetTextRotationCommand, SetTextWrapCommand, SetUnderlineCommand, SetVerticalTextAlignCommand, } from './commands/commands/set-style.command';
56
56
  export { SetTabColorCommand } from './commands/commands/set-tab-color.command';
57
57
  export { type ISetWorksheetActivateCommandParams, SetWorksheetActivateCommand, } from './commands/commands/set-worksheet-activate.command';
58
58
  export { DeltaColumnWidthCommand, type IDeltaColumnWidthCommandParams, SetColWidthCommand, } from './commands/commands/set-worksheet-col-width.command';
@@ -105,9 +105,9 @@ export { enUS, zhCN } from './locale';
105
105
  export type { FormatType, INumfmtItem, INumfmtItemWithCache } from './services/numfmt/type';
106
106
  export { INumfmtService } from './services/numfmt/type';
107
107
  export { RefRangeService } from './services/ref-range/ref-range.service';
108
- export type { EffectRefRangeParams } from './services/ref-range/type';
108
+ export type { EffectRefRangeParams, IOperator } from './services/ref-range/type';
109
109
  export { EffectRefRangId, OperatorType } from './services/ref-range/type';
110
- export { handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveRange, runRefRangeMutations, } from './services/ref-range/util';
110
+ export { handleDeleteRangeMoveLeft, handleDeleteRangeMoveUp, handleInsertCol, handleInsertRangeMoveDown, handleInsertRangeMoveRight, handleInsertRow, handleIRemoveCol, handleIRemoveRow, handleMoveCols, handleMoveRange, handleMoveRows, runRefRangeMutations, } from './services/ref-range/util';
111
111
  export { INTERCEPTOR_POINT } from './services/sheet-interceptor/interceptor-const';
112
112
  export { SheetInterceptorService } from './services/sheet-interceptor/sheet-interceptor.service';
113
113
  export type { ISheetLocation } from './services/sheet-interceptor/utils/interceptor';
@@ -16,6 +16,7 @@
16
16
  declare const _default: {
17
17
  sheets: {
18
18
  sheetCopy: string;
19
+ sheet: string;
19
20
  };
20
21
  };
21
22
  export default _default;
@@ -16,6 +16,7 @@
16
16
  declare const _default: {
17
17
  sheets: {
18
18
  sheetCopy: string;
19
+ sheet: string;
19
20
  };
20
21
  };
21
22
  export default _default;
@@ -15,3 +15,4 @@
15
15
  */
16
16
  export { SheetEditablePermission } from './permission-point';
17
17
  export { SheetPermissionService } from './sheet-permission.service';
18
+ export * from './tool';
@@ -0,0 +1,18 @@
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 { Observable } from 'rxjs';
18
+ export declare function getCurrentSheetDisabled$(accessor: IAccessor): Observable<boolean>;
@@ -26,8 +26,16 @@ import type { IInsertColCommandParams, IInsertRowCommandParams } from '../../com
26
26
  import { InsertColCommandId, InsertRowCommandId } from '../../commands/commands/insert-row-col.command';
27
27
  import type { IMoveRangeCommandParams } from '../../commands/commands/move-range.command';
28
28
  import { MoveRangeCommandId } from '../../commands/commands/move-range.command';
29
+ import type { IMoveColsCommandParams, IMoveRowsCommandParams } from '../../commands/commands/move-rows-cols.command';
30
+ import { MoveColsCommandId, MoveRowsCommandId } from '../../commands/commands/move-rows-cols.command';
29
31
  import type { IRemoveRowColCommandParams } from '../../commands/commands/remove-row-col.command';
30
32
  import { RemoveColCommandId, RemoveRowCommandId } from '../../commands/commands/remove-row-col.command';
33
+ export type IMoveRowsCommand = ICommandInfo<IMoveRowsCommandParams> & {
34
+ id: typeof MoveRowsCommandId;
35
+ };
36
+ export type IMoveColsCommand = ICommandInfo<IMoveColsCommandParams> & {
37
+ id: typeof MoveColsCommandId;
38
+ };
31
39
  export type IMoveRangeCommand = ICommandInfo<IMoveRangeCommandParams> & {
32
40
  id: typeof MoveRangeCommandId;
33
41
  };
@@ -52,7 +60,7 @@ export type IInsertRangeMoveDownCommand = ICommandInfo<InsertRangeMoveDownComman
52
60
  export type IInsertRangeMoveRightCommand = ICommandInfo<InsertRangeMoveRightCommandParams> & {
53
61
  id: typeof InsertRangeMoveRightCommandId;
54
62
  };
55
- export type EffectRefRangeParams = IMoveRangeCommand | IInsertRowCommand | IInsertColCommand | IRemoveRowColCommand | IDeleteRangeMoveLeftCommand | IDeleteRangeMoveUpCommand | IInsertRangeMoveDownCommand | IInsertRangeMoveRightCommand;
63
+ export type EffectRefRangeParams = IMoveRangeCommand | IInsertRowCommand | IInsertColCommand | IRemoveRowColCommand | IDeleteRangeMoveLeftCommand | IDeleteRangeMoveUpCommand | IInsertRangeMoveDownCommand | IInsertRangeMoveRightCommand | IMoveColsCommand | IMoveRowsCommand;
56
64
  export declare const EffectRefRangId: {
57
65
  readonly MoveRangeCommandId: "sheet.command.move-range";
58
66
  readonly InsertRowCommandId: "sheet.command.insert-row";
@@ -63,6 +71,8 @@ export declare const EffectRefRangId: {
63
71
  readonly DeleteRangeMoveUpCommandId: "sheet.command.delete-range-move-up";
64
72
  readonly InsertRangeMoveDownCommandId: "sheet.command.insert-range-move-down";
65
73
  readonly InsertRangeMoveRightCommandId: "sheet.command.insert-range-move-right";
74
+ readonly MoveColsCommandId: "sheet.command.move-cols";
75
+ readonly MoveRowsCommandId: "sheet.command.move-rows";
66
76
  };
67
77
  export declare enum OperatorType {
68
78
  Set = 0,
@@ -14,7 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { IRange } from '@univerjs/core';
17
- import type { IDeleteOperator, IDeleteRangeMoveLeftCommand, IDeleteRangeMoveUpCommand, IHorizontalMoveOperator, IInsertColCommand, IInsertRangeMoveDownCommand, IInsertRangeMoveRightCommand, IInsertRowCommand, IMoveRangeCommand, IOperator, IRemoveRowColCommand, IVerticalMoveOperator } from './type';
17
+ import type { IDeleteOperator, IDeleteRangeMoveLeftCommand, IDeleteRangeMoveUpCommand, IHorizontalMoveOperator, IInsertColCommand, IInsertRangeMoveDownCommand, IInsertRangeMoveRightCommand, IInsertRowCommand, IMoveColsCommand, IMoveRangeCommand, IMoveRowsCommand, IOperator, IRemoveRowColCommand, IVerticalMoveOperator } from './type';
18
+ export declare const handleMoveRows: (params: IMoveRowsCommand, targetRange: IRange) => IOperator[];
19
+ export declare const handleMoveCols: (params: IMoveColsCommand, targetRange: IRange) => IOperator[];
18
20
  export declare const handleMoveRange: (param: IMoveRangeCommand, targetRange: IRange) => IOperator[];
19
21
  /**
20
22
  * see the doc 【ref-range-remove-col.tldr】